var delaytime = 30;	
var movingbox = false;
var movingtext = false;
var boxHeight;
var textHeight;	

var textObjects = new Array();
var defaultslideSpeed = false;
function slidebox(boxId)
{
	var topPos = textObjects[boxId]['objRef'].style.top.replace(/[^\-0-9]/g,'');
	topPos = topPos - textObjects[boxId]['boxSpeed'];
	if(topPos/1 + textObjects[boxId]['textHeight']/1<0)topPos = textObjects[boxId]['boxHeight'];
	textObjects[boxId]['objRef'].style.top = topPos + 'px';
	setTimeout('slidebox("' + boxId + '")',delaytime);
}

function stopMoving()
{
	var boxId = this.id;
	textObjects[boxId]['boxSpeed'] = 0;	
}

function resumeMoving()
{
	var boxId = this.id;
	textObjects[boxId]['boxSpeed'] = textObjects[boxId]['originalSpeed'];
	
}
function initMovingText(boxId,boxSpeed)
{
	movingbox = document.getElementById(boxId);
	movingtext = movingbox.getElementsByTagName('DIV')[0];
	
	movingbox.style.position = 'relative';
	movingbox.style.overflow = 'hidden';
	movingtext.style.position = 'relative';
	
	movingbox.onmouseover = stopMoving;
	movingbox.onmouseout = resumeMoving;
	
	defaultslideSpeed = boxSpeed;
	
	movingtext.style.top = '0px';
	
	textObjects[boxId] = new Array();
	textObjects[boxId]['objRef'] = movingtext;
	textObjects[boxId]['textHeight'] = movingtext.offsetHeight;
	textObjects[boxId]['boxHeight'] = movingbox.clientHeight;
	textObjects[boxId]['boxSpeed'] = boxSpeed;
	textObjects[boxId]['originalSpeed'] = boxSpeed;
	slidebox(boxId);
}