index_courant=0
//On active la détection de mouvement de la souris
//Pour cacher la divsion courante si on clic à l'extérieur
document.onclick= checkMousePosition
function go(lien)
{
 var cible
 cible="_top"
 window.open(lien,cible);
}
function displayMenu(index){
	hideMenu(1);
	hideMenu(2);
	hideMenu(3);
	
	obj=document.getElementById("topmenu"+index);
	if (document.body.offsetWidth>766){
	position=(document.body.offsetWidth-800)/2 +155+(index-1)*150;}
	else{position=120+(index-1)*150;}
	//alert(document.body.offsetWidth);
	obj.style.left=position;
	obj.style.visibility='visible'
	
	index_courant=index
	document.onmousemove=Menu_mousemouve;
	//alert("ouvre toi");
}
function hideMenu(index){
	obj=document.getElementById("topmenu"+index);
	if (obj!=null) obj.style.visibility='hidden'
}

//Cache toutes les divisions actives
function checkMousePosition(){
	obj=document.getElementById("topmenu"+index_courant);
	if (obj!=null) obj.style.visibility='hidden';
}

function Menu_mousemouve(){
	
	//Si Un menu est actif et que la souris ne s'y trouve pas, on le cache
	obj=document.getElementById("topmenu"+index_courant);
	offset=0;
	//Sous pc les valeurs retournées sont suivies de 'px', pas sous mac
	if(obj.style.top.indexOf("x")!=-1){offset=2;}
	ymin=parseInt(obj.style.top.substring(0,obj.style.top.length-offset));
	xmin=parseInt(obj.style.left.substring(0,obj.style.left.length-offset));
	ymax=ymin+parseInt(obj.style.height.substring(0,obj.style.height.length-offset));
	xmax=xmin+parseInt(obj.style.width.substring(0,obj.style.width.length-offset));
	//alert(window.event.x+"<"+ xmin +"-"+ window.event.x+">"+ xmax  +"-"+ window.event.y+">"+ ymax);
	if (event.x< xmin || event.x> xmax || event.y> ymax){
		hideMenu(index_courant);
	}
	
}