/*
/ Menu Javascript. Ne pas oublier de spécifier le nombre de menus et une hauteur générique.
*/
var iMouseX, iMouseY;
var iMenuX, iMenuWidth;
var	iMenuY = 168;
var iMenuHeight1 = 150;
var iMenuHeight2 = 135;
var iMenuHeight3 = 125;
var iNumMenus = 2;
var mac = false;

var currentUrl = document.location.toString();

if (navigator.appVersion.indexOf("Macintosh") > -1) var mac = true;
	
if (document.images) 
{
  fleetoff = new Image();
  fleetoff.src = "../images/layout/fleet_off_en.gif"
  fleeton = new Image();
  fleeton.src = "../images/layout/fleet_on_en.gif"
  
  regoff = new Image();
  regoff.src = "../images/layout/reg_off.gif"
  regon = new Image();
  regon.src = "../images/layout/reg_on.gif"
  
  groupoff = new Image();
  groupoff.src = "../images/layout/group_off_en.gif"
  groupon = new Image();
  groupon.src = "../images/layout/group_on_en.gif"
  
  newsoff = new Image();
  newsoff.src = "../images/layout/news_off_en.gif"
  newson = new Image();
  newson.src = "../images/layout/news_on_en.gif"
  
  specialsoff = new Image();
  specialsoff.src = "../images/layout/specials_off_en.gif"
  specialson = new Image();
  specialson.src = "../images/layout/specials_on_en.gif"
  
  accountoff = new Image();
  accountoff.src = "../images/layout/account_off_en.gif"
  accounton = new Image();
  accounton.src = "../images/layout/account_on_en.gif"
  
  bookingoff = new Image();
  bookingoff.src = "../images/layout/booking_off_en.gif"
  bookingon = new Image();
  bookingon.src = "../images/layout/booking_on_en.gif"
  
  item_aboutoff = new Image();
  item_aboutoff.src = "../images/layout/item_about_off_en.gif"
  item_abouton = new Image();
  item_abouton.src = "../images/layout/item_about_on_en.gif"
  
  item_philooff = new Image();
  item_philooff.src = "../images/layout/item_philo_off_en.gif"
  item_philoon = new Image();
  item_philoon.src = "../images/layout/item_philo_on_en.gif"
  
  item_magoff = new Image();
  item_magoff.src = "../images/layout/item_mag_off_en.gif"
  item_magon = new Image();
  item_magon.src = "../images/layout/item_mag_on_en.gif"
  
  item_officeoff = new Image();
  item_officeoff.src = "../images/layout/item_office_off_en.gif"
  item_officeon = new Image();
  item_officeon.src = "../images/layout/item_office_on_en.gif"
  
  item_linkoff = new Image();
  item_linkoff.src = "../images/layout/item_link_off_en.gif"
  item_linkon = new Image();
  item_linkon.src = "../images/layout/item_link_on_en.gif"
  
  item_contactoff = new Image();
  item_contactoff.src = "../images/layout/item_contact_off_en.gif"
  item_contacton = new Image();
  item_contacton.src = "../images/layout/item_contact_on_en.gif"
  
  item_selfoff = new Image();
  item_selfoff.src = "../images/layout/item_self_off_en.gif"
  item_selfon = new Image();
  item_selfon.src = "../images/layout/item_self_on_en.gif"
  
  item_chaufoff = new Image();
  item_chaufoff.src = "../images/layout/item_chauf_off_en.gif"
  item_chaufon = new Image();
  item_chaufon.src = "../images/layout/item_chauf_on_en.gif"
  
  item_yachtoff = new Image();
  item_yachtoff.src = "../images/layout/item_yacht_off_en.gif"
  item_yachton = new Image();
  item_yachton.src = "../images/layout/item_yacht_on_en.gif"
  
  item_usedoff = new Image();
  item_usedoff.src = "../images/layout/item_used_off_en.gif"
  item_usedon = new Image();
  item_usedon.src = "../images/layout/item_used_on_en.gif"
  
  item_rentaloff = new Image();
  item_rentaloff.src = "../images/layout/item_rental_off_en.gif"
  item_rentalon = new Image();
  item_rentalon.src = "../images/layout/item_rental_on_en.gif"
  
  item_chauf2off = new Image();
  item_chauf2off.src = "../images/layout/item_chauf2_off_en.gif"
  item_chauf2on = new Image();
  item_chauf2on.src = "../images/layout/item_chauf2_on_en.gif"
  
  item_yacht2off = new Image();
  item_yacht2off.src = "../images/layout/item_yacht2_off_en.gif"
  item_yacht2on = new Image();
  item_yacht2on.src = "../images/layout/item_yacht2_on_en.gif"
  
  item_specoff = new Image();
  item_specoff.src = "../images/layout/item_spec_off_en.gif"
  item_specon = new Image();
  item_specon.src = "../images/layout/item_spec_on_en.gif"
  
  item_mobileoff = new Image();
  item_mobileoff.src = "../images/layout/item_mobile_off_en.gif"
  item_mobileon = new Image();
  item_mobileon.src = "../images/layout/item_mobile_on_en.gif"
  


}

function changeImages() 
{
  if (document.images) 
  {
    for (var i=0; i < changeImages.arguments.length; i+=2)
    {
      document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

function getXPos(eElement)
{
    var iXPos = eElement.offsetLeft;          
    var eParents = eElement.offsetParent;  
    
    while (eParents != null)
    {
        iXPos += eParents.offsetLeft;      
        eParents = eParents.offsetParent; 
    }
    return iXPos;                           
}

function ShowMenu(iMenuID)
{
	HideMenus();
	setTimeout("ShowOK("+iMenuID+")", 30);
}

function ShowOK(iMenuID)
{
	var LayerName = "menu"+iMenuID.toString();
	if(document.all)
	{	
		iMenuX = parseInt(getXPos(document.all["menu_image"+iMenuID.toString()]));
		iMenuWidth = parseInt(document.all["menu_table"+iMenuID.toString()].width);
		iMenuHeight = eval("iMenuHeight"+iMenuID.toString());
		document.all[LayerName].style.left = iMenuX;
		(mac) ? document.all[LayerName].style.top = 30 : document.all[LayerName].style.top = iMenuY+21;
		document.all[LayerName].style.visibility = "visible";
	}
	else if(document.getElementById)
	{
		iMenuX = parseInt(getXPos(document.getElementById("menu_image"+iMenuID.toString())));
		iMenuWidth = parseInt(document.getElementById("menu_table"+iMenuID.toString()).width);
		iMenuHeight = eval("iMenuHeight"+iMenuID.toString());
		document.getElementById(LayerName).style.left = iMenuX;
		document.getElementById(LayerName).style.top = iMenuY+21;
		document.getElementById(LayerName).style.visibility = "visible";
	}
	
	ControlMenu();
}

function HideMenus()
{
	for(i=1; i<iNumMenus+1;i++)
	{
		if(document.all)
		{
			if(document.all["menu"+ i.toString()].style.visibility == "visible")
				document.all["menu"+ i.toString()].style.visibility = "hidden";
		}
		else if(document.getElementById)
		{
			if(document.getElementById("menu"+ i.toString()).style.visibility == "visible")
				document.getElementById("menu"+ i.toString()).style.visibility = "hidden";
		}
	}
}

function ControlMenu()
{
	if(iMouseX < iMenuX || iMouseX > (iMenuX + iMenuWidth) || iMouseY < iMenuY-30 || iMouseY > (iMenuY + iMenuHeight))
	{
		HideMenus();
		return;
	}
	setTimeout("ControlMenu()", 15);
}

//capture de la position de la souris
function GetMousePos(e)
{
	if(document.all)
	{
		iMouseX = window.event.x + document.body.scrollLeft;
		iMouseY = window.event.y + document.body.scrollTop;
//		document.all["mousePos"].innerHTML = "mouse X : " + iMouseX + "<br>mouse Y : " + iMouseY;
	}
	else if(document.getElementById)
	{
		iMouseX = e.pageX;
		iMouseY = e.pageY;
//		document.getElementById("mousePos").innerHTML = "mouse X : " + iMouseX + "<br>mouse Y : " + iMouseY;
	}
}

document.onmousemove = GetMousePos;



/*//////////////////////////////////////////////////
////////////////////////////////////////////////////
///////Système de changement des pays et monnaies///
///////la fonction php correspondante se trouve/////
///////dans language_functions.php/////////////////////////
*///////////////////////////////////////////////////
function changeGlobalCountry()
{
	if(currentUrl.indexOf("?") != -1)
		document.location = currentUrl+"&globcountry="+document.global_country_form.global_country.value;
	else
		document.location = currentUrl+"?globcountry="+document.global_country_form.global_country.value;
}





