<!-- Original:  Ernst Straka (ernst.straka@central-europe.basf.org) -->
<!-- Web Site:  http://www.rs-systems.at/straka -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Script was modified by: G. Ajamian -->


//-------------------------------
// vars
//-------------------------------
// static vars
var topPos =  115;      // top of ticker in pixel, or 0 to position relative
var tickerWidth = 250;  // width of ticker in pixel
var Half_abcdc_PageWidth = (780/2)-10;
var ie = document.all ? true : false;
var first = true;

// dynamic vars
var leftPos = 0;  // left of ticker in pixel, or 0 to position relative
var rightPos = leftPos + tickerWidth;
var nowWidth = leftPos - rightPos;
var nowRight = rightPos;

//-------------------------------------
// tickinit
//   Called from the InitLayers Method
//   in Library.inc
//-------------------------------------
function tickinit() 
{
	if (ie) 
	{
		if (leftPos == 0 && topPos == 0) 
		{
			pos = document.all['tickpos'];
			leftPos = getLeft(pos);
			topPos = getTop(pos);
		}

		ticktext.style.posTop = topPos;
	}
	else 
	{
		if (leftPos == 0 && topPos == 0) 
		{
			leftPos = getLeft(document.getElementById("tickpos").style.left);
			topPos  = getTop(document.getElementById("tickpos").style.top);
		}

		document.getElementById("ticktext").style.top = topPos;
	}

	leftPos = GetLeftEdge();
	rightPos = GetStartingRtEdge();
	nowWidth = leftPos - rightPos;
	nowRight = rightPos;
	window.setInterval('tick()', 10);		// keeps calling to move ticker
}

//-------------------------------
// getLeft
//-------------------------------
function getLeft(ll) 
{
	if (ll.offsetParent)
		return (ll.offsetLeft + getLeft(ll.offsetParent));
	else 
		return (ll.offsetLeft);
}

//-------------------------------
// getTop
//-------------------------------
function getTop(ll) 
{
	if (ll.offsetParent)
		return (ll.offsetTop + getTop(ll.offsetParent));
	else
		return (ll.offsetTop);
}

//-------------------------------
// tick 
//-------------------------------
function tick() 
{
	leftPos = GetLeftEdge();
	rightPos = GetStartingRtEdge();
	nowWidth = leftPos - rightPos;
	nowRight = nowRight - 0.5;

	if (nowRight < nowWidth) nowRight = rightPos;
	cl = leftPos - nowRight;
	cr = rightPos - nowRight;

	if (ie)	
	{
		ticktext.style.posLeft = nowRight;
		ticktext.style.posTop = topPos;
		ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
		if (first) ticktext.style.visibility = "visible";
	}
	else 
	{
		document.getElementById("ticktext").style.left = nowRight;
		document.getElementById("ticktext").style.top = topPos;
		document.getElementById("ticktext").style.clip = "rect(auto "+cr+"px auto "+cl+"px)";
		if (first) document.getElementById("ticktext").style.visibility = "visible";
	}

	first = false;
}

//-------------------------------
// GetStartingRtEdge (for dynamic resizing) 
//-------------------------------
function GetStartingRtEdge()
{
	if ((Half_abcdc_PageWidth) < GetMidPix())
		return leftPos + tickerWidth;
	else
		return tickerWidth;

}

//-------------------------------
// GetLeftEdge (for dynamic resizing) 
//-------------------------------
function GetLeftEdge()
{
	if (GetMidPix() - Half_abcdc_PageWidth < 0)
		return 0;

	return GetMidPix() - Half_abcdc_PageWidth;
}

//-------------------------------
// GetMidPix (for dynamic resizing) 
//-------------------------------
function GetMidPix()
{
	var midPix;

	if (navigator.userAgent.indexOf("MSIE") > 0) {
		midPix = document.body.clientWidth/2;
	} 
	else {                                                
		midPix = window.outerWidth/2;
	}
	return midPix;   
}

