var Step = 2;	// Pixel di spostamento per ogni ciclo
var Tempo = 40;	// Velocita' di scorrimento: millisecond per il setInterval() - piu' piccolo il numero --> piu' veloce lo scorrimento
var nn = document.layers?true:false;
var N6 = navigator.userAgent.toLowerCase().indexOf("gecko")!=-1?true:false;
var LayText=null;
var AltezzaLivello=0;
var LarghezzaLivello=0;
var Limite =0;
var texTop=0;
var DeltaTop = 0;
var timsc=null;
var actualScroll;

function Start()
{
	if(document.getElementById('modulo_7').style.overflow=='auto')
	 return;
	LayText=nn?document.layers.textLayer:N6?document.getElementById("textLayer").style:document.all.textLayer.style;
	DeltaTop=nn?LayText.top:N6?document.getElementById("textLayer").offsetTop:document.all.textLayer.offsetTop;
	AltezzaLivello=parseInt(nn?LayText.clip.height:N6?LayText.height:LayText.height);
	LarghezzaLivello=parseInt(nn?LayText.clip.width:N6?LayText.width:LayText.width);
	Limite=-AltezzaLivello+(nn?LayText.document.height:N6?document.getElementById("divN6").offsetHeight:document.all.textLayer.clientHeight);
}

function Move(where)
{
	actualScroll=where;
	//if(AltezzaLivello==altoModulo_7) return;
	where?texTop>=Limite?null:texTop+=Step:texTop==0?null:texTop-=Step;
	LayText.top=-texTop+DeltaTop;
	if (nn)
	{
		LayText.clip.top=texTop;
		LayText.clip.bottom=eval(texTop+AltezzaLivello);
	}
	else
		LayText.clip = "rect(" + texTop + ", " + LarghezzaLivello + ", " +eval(texTop+AltezzaLivello) + ", 0)";

	if(altoModulo_7<=texTop+AltezzaLivello)
	{
		clearInterval(timsc);
		StartScroll(false);
	}

	if(texTop+AltezzaLivello==AltezzaLivello)
	{
		clearInterval(timsc);
		StartScroll(true);
	}
}
function StartScroll(updown){timsc=setInterval(updown?"Move(true)":"Move(false)",Tempo);}

function StopScroll(x)
{
	if(x)actualScroll=x;
		clearInterval(timsc);
}
