var tickerUpdate = 15;

function initScrolling()
{
	var i;
	if (scrollARR != undefined)
	{
	    for (i = 0; i < scrollARR.length; i++)
	    {
		    if (scrollARR[i].scrollType == "horizontal")
		    {
		        if (document.getElementById(scrollARR[i].divid) != undefined)
		        {
		            document.getElementById(scrollARR[i].divid).onmouseover = pause;
		            document.getElementById(scrollARR[i].divid).onmouseout = play;
			        startScrolling(i);
			    }
		    }
	    }
	}
}

function pause(){
    if (scrollARR != undefined)
    {
        for (i = 0; i < scrollARR.length; i++)
	    {
	        if (scrollARR[i].scrollType == "horizontal"){
	            if (scrollARR[i].divid == this.id){
	                scrollARR[i].paused = true;
	            }
	        }
        }
    }
}

function play(){
    if (scrollARR != undefined)
    {
        for (i = 0; i < scrollARR.length; i++)
	    {
	        if (scrollARR[i].scrollType == "horizontal"){
	            if (scrollARR[i].divid == this.id){
	                scrollARR[i].paused = false;
	            }
	        }
        }
    }
}

function startScrolling(i)
{
	var myContent = "";
	var useElement = scrollARR[i].divid;
	myContent = document.getElementById(useElement).innerHTML;
	isPaused = scrollARR[i].paused;
	
	var isSupported = false;
	myWidth = document.getElementById(useElement).style.width;

	// Check For Firefox and Safari
	if (navigator.userAgent.indexOf("Firefox")!=-1 || navigator.userAgent.indexOf("Safari")!=-1)
	{
		document.getElementById(useElement).innerHTML = "<TABLE  cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'>"+scrollARR[i].spacer+"<SPAN style='"+scrollARR[i].styleis+"' ID='" + useElement + "_inside' width='100%'>&nbsp;</SPAN>"+scrollARR[i].spacer+"</TD></TR></TABLE>";
		isSupported = true;
	}
	// Check for IE and Opera
	if (navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1)
	{
		document.getElementById(useElement).innerHTML = "<DIV nowrap='nowrap' style='width:100%;'>"+scrollARR[i].spacer+"<SPAN style='"+scrollARR[i].styleis+"' ID='" + useElement + "_inside' width='100%'></SPAN>"+scrollARR[i].spacer+"</DIV>";
		isSupported = true;
	}
	if(!isSupported)
	{
		document.getElementById(useElement).outerHTML = "";
	}
	else
	{
		document.getElementById(useElement).scrollLeft = scrollARR[i].scrollDirection_leftToRight ? document.getElementById(useElement).scrollWidth - document.getElementById(useElement).offsetWidth : 0;
		document.getElementById(useElement + "_inside").innerHTML = myContent;
		document.getElementById(useElement).style.display="block";
		scrollMe(i);
	}
}

function scrollMe(i)
{
	myElement = scrollARR[i].divid;
	if(!scrollARR[i].paused) 
	{
		document.getElementById(myElement).scrollLeft += scrollARR[i].speed * (scrollARR[i].scrollDirection_leftToRight ? -1 : 1);
	}
	if(scrollARR[i].scrollDirection_leftToRight && document.getElementById(myElement).scrollLeft <= 0)
	{
		document.getElementById(myElement).scrollLeft = document.getElementById(myElement).scrollWidth - document.getElementById(myElement).offsetWidth;
	}
	if(!scrollARR[i].scrollDirection_leftToRight && document.getElementById(myElement).scrollLeft >= document.getElementById(myElement).scrollWidth - document.getElementById(myElement).offsetWidth)
	{
		document.getElementById(myElement).scrollLeft = 0;
	}
	window.setTimeout("scrollMe('" + i + "')", tickerUpdate);
}



