//----------------------------------------
// MENU

var ns4 = (document.layers)? true:false;
var ie4 = ((document.all) && (!document.getElementById))? true:false;
var ns6 = ((document.getElementById) && (!ie4))? true:false;

var tto;
var thisDiv;

function gety(theitem){
	var obj =eval("document.getElementById('m_" + theitem + "')");
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	//return curleft;
	// For vp_cms, we need to substract the offsetleft de main_frame because it is position:relative
	if (document.getElementById("main_frame")!=null) curleft -= document.getElementById("main_frame").offsetLeft;
	return(curleft);
}
function getx(theitem){
	var obj =eval("document.getElementById('m_" + theitem + "')");
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curtop += obj.x;
	//return curleft;
	return(curtop);
}

function showMenu(theItem){
	
	// ATTENTION : LES x ET y SONT INVERSES
   var y=gety(theItem);
   var x= getx(theItem);
  clearTimeout(tto);
   if (ns4) {
      thisDiv = document.layers['mc_'+theItem];
	   thisDiv.top=x;
      thisDiv.left=y;
      thisDiv.visibility="show";
	   }
   if (ie4) {
      if ((thisDiv) &&(thisDiv!=document.layers['mc_'+theItem])){
		   thisDiv.visibility='hidden';
	   }
      thisDiv = document.layers['mc_'+theItem];
	   thisDiv.top=x;
      thisDiv.left=y;
      thisDiv.visibility="visible";
      }
   if (ns6) {
      if ((thisDiv) &&(thisDiv!=document.getElementById('mc_'+theItem).style)){
        thisDiv.visibility='hidden';
	   }
   	thisDiv = document.getElementById('mc_'+theItem).style;
		thisDiv.top=x+"px";
      thisDiv.left=y+"px";
      thisDiv.visibility="visible";
      }
}
			
function hideMenu(theItem){
	
   var thetime=400;
   if (ns4) {
      thisDiv = document.layers['mc_'+theItem];
      tto=setTimeout("thisDiv.visibility='hide'",thetime);
      }
   if (ie4) {
      thisDiv = document.layers['mc_'+theItem];
      tto=setTimeout("thisDiv.visibility='hidden'",thetime);
      }
   if (ns6) {
      thisDiv = document.getElementById('mc_'+theItem).style;
      tto=setTimeout("thisDiv.visibility='hidden'",thetime);
      }
}		

