var oCurrInterval = "";
var oCurrScroll = "";

function clearScrolls()
{
	if (oCurrScroll != ""){
		if (isDOM){
			oCurrScroll.style.visibility = 'hidden';
		}
		if (isNS4){
			oCurrScroll.visibility = 'hidden';
		}
	}
	
	if (oCurrInterval != ""){
		window.clearInterval(oCurrInterval);
		oCurrInterval="";
	}
}

function showText(id,threshold)
{
	clearScrolls();
	
	oCurrScroll = MM_findObj('divText'+id);

	var oText1 = MM_findObj('div'+id+'1');
	var oText2 = MM_findObj('div'+id+'2');
	var height = 0;
	
	if (isDOM){
		height = oText1.clientHeight + 40;

		oCurrScroll.style.visibility = 'visible';
		oText1.style.top = 40;
		// if text layer height is > threshold then create a duplicate and have both
		// layers scroll up wards
		if (height>threshold)	oText2.style.top = oText1.clientHeight;
	}

	if (isNS4){
		height = oText1.clip.height + 30;

		oCurrScroll.visibility = 'visible';
		oText1.top = 40;
		// if text layer height is > threshold then create a duplicate and have both
		// layers scroll up wards
		if (height>threshold)	oText2.top = oText1.clip.height;
	}

	if (height>threshold)	setTimeout('startScrollTextLoop("'+id+'",'+height+')',2000);
}


function startScrollTextLoop(id,height)
{
	sFunc= 'scrollText("'+id+'",'+height+')';
	oCurrInterval = window.setInterval (sFunc,125);
}

function scrollText(id,height)
{
	var newTop1;
	var newTop2;

	var oText1 = MM_findObj('div'+id+'1');
	var oText2 = MM_findObj('div'+id+'2');
	
	if(isNS4){
		newTop1 = parseInt(oText1.top);
		newTop2 = parseInt(oText2.top);
	}
	if(isDOM){
		newTop1 = parseInt(oText1.style.top);
		newTop2 = parseInt(oText2.style.top);
	}
			
	newTop1-=1;
	newTop2-=1;
	
	if (newTop1 == 0) newTop2 = height;
	if (newTop2 == 0) newTop1 = height;
	
	if (isNS4){
		oText1.top = newTop1;
		oText2.top = newTop2;
	}
	if (isDOM){
		oText1.style.top = newTop1;
		oText2.style.top = newTop2;
	}
}
