/*	Evènements
Webmanager © Lezartcom
*/
var N = (navigator.appName=="Netscape") ? 1 : 0;
var idObj;
var FF = (navigator.userAgent.indexOf("Firefox")>-1 || navigator.userAgent.indexOf("Safari")>-1) ? 1 : 0;
var ssX; // Sauvegarde de la position de la souris lors du mousedown
var ssY;
var X;
var Y;
var ssX; // Sauvegarde de la position de la souris lors du mousedown
var ssY;
var idR=0;
var margebienvenue;
if(ie){
	window.attachEvent("onload", evenement);
}
else{
	window.addEventListener("load", evenement, false);
}



function evenement(){
	if(ie){
		if(GetE('nav')){
			GetE('nav').attachEvent('onmouseover', setIdObj) ;
			GetE('contenu').attachEvent('onmouseover', setIdObj) ;
		}
	}
	else{
		if(GetE('nav')){
			GetE('nav').addEventListener('mouseover', setIdObj, false) ;
			GetE('contenu').addEventListener('mouseover', setIdObj, false) ;
		}
	}
}
var delay = 10;
var maxtop = 100;
var maxbas = 500;
var position="haut";

function getLeft(l){
  if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
  else return (l.offsetLeft);
}
function setIdObj(e){
	if (N) {
		idObj = e.id;
		X=e.x;
		Y=e.y;
		if (FF) {
			idObj = e.target.id;
			ssX = e.clientX;
			ssY = e.clientY;
			X = e.clientX + self.pageXOffset - e.target.offsetLeft;
			Y = e.clientY + self.pageYOffset - e.target.offsetTop;
		}
	}
	else {
		idObj = event.srcElement.id;
		ssX = event.clientX;
		ssY = event.clientY;
		X=event.offsetX;
		Y=event.offsetY;
	}

	if(idObj.substring(0,3)!="nab" && idObj!="" && GetE("nab"+idR)){
		GetE("nab"+idR).style.display='none';

	}
	if (idObj.substring(0,6)=="nabImg") {
		if(GetE("nab"+idR)){
			GetE("nab"+idR).style.display='none';
		}
		idR=idObj.substring(6);
		
			if(GetE("nab"+idR)){
				xR=getLeft(GetE(idObj));
				GetE("nab"+idR).style.display='block';
				GetE("nab"+idR).style.marginLeft=xR+'px';
			}
/*
		if(GetE("nab"+idR)){
			xR=getLeft(GetE(idObj));
			
			GetE("nab"+idR).style.display='block';
			GetE("nab"+idR).style.marginLeft=xR+'px';
			//mLeft = Math.round((ssX-30)/30)*30;
			//GetE("sousNav"+idC).style.margin='0 0 0 '+(mLeft)+'px';
		}
		
		*/
	}
	if (idObj.substring(0,7)=="nabHref") {
		if(GetE("nab"+idR)){
			GetE("nab"+idR).style.display='none';
		}
		idR=idObj.substring(7);
/*
		if(GetE("nab"+idR)){
			xR=getLeft(GetE(idObj));
			GetE("nab"+idR).style.display='block';
			GetE("nab"+idR).style.marginLeft=xR+'px';
			//mLeft = Math.round((ssX-30)/30)*30;
			//GetE("sousNav"+idC).style.margin='0 0 0 '+(mLeft)+'px';
		}*/
		
		
			if(GetE("nab"+idR)){
				xR=getLeft(GetE(idObj));
				marge_gauche=getLeft(GetE('container'));
				if(idR==2)
					xR-=marge_gauche;
				else
					xR-=marge_gauche;
				GetE("nab"+idR).style.display='block';
				GetE("nab"+idR).style.marginLeft=xR+'px';
			}
	}
}
