


var news;           
var text = new Array();
var mouseIsOver = 0;
var posLeftIni = 5;
var scorWidth = 490;
var increment = 1;
var left = 0;
var top;
var right = left + scorWidth;
var display;
var shiftCont;
var posLeft;
var shiftFlag = 1;
var pivot;
var shiftTime = 20;  // Tempo di aggiornamento, in millisecondi.
function initShift()
{
	if ((display = document.getElementById('scor')) ==  null)
    return;
	shiftCont = document.getElementById('shiftContainer');
	pivot = document.getElementById('shiftPivot');
	var left = findPosX(pivot)+5;
	var top = findPosY(pivot)+5;
	//window.alert(left);
	shiftCont.style.left = left + "px";
	shiftCont.style.top = top + "px";
	text = display.firstChild.data;
	//window.alert(text.length);
	total = text.length*60;
	display.style.width = total+"px";
	posLeft = posLeftIni ;
	display.style.visibility = "visible";
	shiftCont.style.visibility = "visible";
	pivot.style.visibility = "visible";
	setTimeout(scorri, shiftTime);
}
function scorri()
{
	if (shiftFlag)
		{
		  shiftCont.style.visibility = "visible";
		  display.style.visibility = "visible";
			display.style.background = "white";
			display.style.clip = "rect(0px, "+right+"px, 40px, "+left+"px)";
			display.style.left = posLeft+"px";
			left += increment;
			right += increment;
			posLeft -= increment;
			//if (text == "")
			if (left > 1500)
				{
					left = 0;
					right = left + scorWidth;
					posLeft = posLeftIni ;
				}
		}		
	setTimeout(scorri, shiftTime);
}

function enableShift()
{
	shiftFlag = 1;
}

function disableShift()
{
	shiftFlag = 0;
}

window.onload=function()
{
	if(NiftyCheck())
		Rounded("ul#round a","top","#ADD8E6","transparent","smooth");	
	initShift();
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}
