//Détection du navigateur
nava = (document.layers);
dom = (document.getElementById);
ie = (document.all);

var f_WindowWidth = 0;
var f_TableWidth = 758;
var nCstAjustement = 10;

//var nPosX = 331;
//var nPosY = 450;

function CMenuUp()
{
   if (f_WindowWidth > f_TableWidth)
   {
      if(ie)
      {
	  	 oImgChooseCountry = document.all["ChooseCountry"];
         document.all["MenuPays"].style.left = Number(getRealLeft( oImgChooseCountry ) - 128) + 'px'; //((f_WindowWidth - f_TableWidth) / 2) + nPosX - nCstAjustement;
         document.all["MenuPays"].style.top = Number(getRealTop( oImgChooseCountry ) - 153) + 'px';
         document.all["MenuPays"].style.visibility = 'visible';
      }         
      else if (dom)
      {
		 oImgChooseCountry = document.getElementById("ChooseCountry");
		 document.getElementById("MenuPays").style.left = Number(getRealLeft( oImgChooseCountry ) - 128) + 'px'; //((f_WindowWidth - f_TableWidth) / 2) + nPosX - nCstAjustement;
		 document.getElementById("MenuPays").style.top = Number(getRealTop( oImgChooseCountry ) - 153) + 'px';
		 document.getElementById("MenuPays").style.visibility = 'visible';
      }         
      else 
      {
	  	 oImgChooseCountry = document.layers["ChooseCountry"];
         document.layers["MenuPays"].left = Number(getRealLeft( oImgChooseCountry ) - 128) + 'px'; //((f_WindowWidth - f_TableWidth) / 2) + nPosX - nCstAjustement;
         document.layers["MenuPays"].top = Number(getRealTop( oImgChooseCountry ) - 153) + 'px';
         document.layers["MenuPays"].visibility = 'visible';
      }
   }
}

function CMenuDown()
{
   if(ie)
      document.all["MenuPays"].style.visibility = 'hidden';
   else if (dom)
      document.getElementById("MenuPays").style.visibility = 'hidden';
   else 
      document.layers["MenuPays"].visibility = 'hidden';
}

function getRealLeft(imgElem)
{
	xPos = eval(imgElem).offsetLeft;
	tempEl = eval(imgElem).offsetParent;
  	while (tempEl != null)
	{
  		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
  	}
  	
    if(navigator.platform == "MacPPC" && navigator.userAgent.indexOf("MSIE") != -1)
    {           
        //Dans IE pour Mac, il faut additionner la marge du body.
        xPos += parseInt(document.body.currentStyle.marginLeft);       
    }
      	
	return xPos;
}

function getRealTop(imgElem)
 {
	yPos = eval(imgElem).offsetTop;
	tempEl = eval(imgElem).offsetParent;
	while ( tempEl != null )
	{
        //Note: On a pas besoin de passer par ici pour calculer la position avec
        //      opera car offsetTop contient déjà  la bonne position.  On a pas besoin
        //      de l'additionnner aux positions de ses éléments parent.
  		yPos += tempEl.offsetTop;
  		
  		if(navigator.userAgent.indexOf("Opera") != -1 && yPos != 0)
  		    tempEl = null;
  		else
  		    tempEl = tempEl.offsetParent;	
  	}
  	
    if( (navigator.platform == "MacPPC" && navigator.userAgent.indexOf("MSIE") != -1) )
    {           
        //Dans IE pour Mac, il faut additionner la marge du body.
        yPos += parseInt(document.body.currentStyle.marginTop);       
    }
              	
	return yPos;
}