

var barWidth = 130;//altezza barra navigazione
var deltaT = 10;//tempo interazione(ms)
var zoneNeutre = barWidth/2; // delimita zona neutra

var lasty=barWidth/2;
var Ypos=barWidth/2,Yold=0;
var layerNav;
var hautNav;
var mouseIsOut=true;

var on=true;

goodNN = (document.layers) ? 1:0;
goodIE = (document.all) ? 1:0;
if(goodNN){
	layerNav=document.NAV; 
	document.nascosto.clip.top = (0);
	document.nascosto.clip.bottom = (barWidth);
	document.nascosto.clip.right = 1050;
	document.nascosto.clip.left = 0;
	document.nascosto.visibility = "visible";
}
else if(goodIE){
	layerNav=document.all.NAV.style; 
	//document.all.nascosto.style.visibility = "hidden";
	document.all.nascosto.style.clip = "rect("+ (0)+" 1050 "+(barWidth)+" 0)";
	//document.all.nascosto.style.visibility = "visible";
}

setTimeout("intro()",2000);

function intro(){
//lasty=barWidth/2;Ypos=0;
setInterval("poursuite()",deltaT);
//lasty=barWidth/2;Ypos=0;
//Test navigateur
if (goodNN || goodIE){
	if (goodNN) {
	hautNav=window.innerHeight;
	window.captureEvents(Event.MOUSEMOVE);
	window.onMouseMove = MoveHandlerNN;
	}
	else if (goodIE) {
	hautNav=document.body.offsetHeight;
	document.onmousemove=MoveHandlerIE;
	//var xlast=0, ylast=0;
	}
}
}

function MoveHandlerNN(e){
Ypos = e.pageY;
}
function MoveHandlerIE(e){
Ypos = event.y;
}
function poursuite(){
//if(Math.abs(Yold-Ypos)<10) return
if(goodNN){
	var y = calculY(Ypos);
	document.nascosto.clip.top = (y-barWidth/2);
	document.nascosto.clip.bottom = (y+barWidth/2);
	document.nascosto.clip.right = 1050;
	document.nascosto.clip.left = 0;
	document.nascosto.visibility = "visible";
}
else if(goodIE){
	var y = calculY(Ypos);
		//alert(y);
	document.all.nascosto.style.visibility = "hidden";
	document.all.nascosto.style.clip = "rect("+ (y-barWidth/2)+" 1050 "+(y+barWidth/2)+" 0)";
	document.all.nascosto.style.visibility = "visible";
	//alert(Ypos);
	//if(on){ alert(y);on=false;}
}
layerNav.top=y-barWidth/2;
Yold=Ypos;
}


function calculY(Ypos){
//alert(Ypos + "   " + lasty);
//conditions aux bords:
if(Math.abs(lasty-Ypos)<=20) mouseIsOut=false;
if(lasty<=barWidth/2 && Ypos<=barWidth/2){
y=barWidth/2;
return Math.round(y);
}
if(lasty>=(hautNav-barWidth/2) && Ypos>=(hautNav-barWidth/2)){
y=hautNav-barWidth/2;
return Math.round(y);
}
if(Math.abs(lasty-Ypos)<=zoneNeutre && !mouseIsOut) {return y;}

y=lasty+((Ypos-lasty)*0.2)




lasty=y;
mouseIsOut=true;
return Math.round(y);
}
