function CenterNavigationPrincipale()
{
	// Trouve tout les éléments de la navigation 
	var objNav = document.getElementById("NavigPrinc");
	var arrLi = objNav.getElementsByTagName('a');
	
	// Trier les pages n'étant pas attaché au root
	var cptElement = 0;
	for(i=0;i<arrLi.length;i++)
	{
		if (arrLi[i].className == "BtnNavPrinc" || arrLi[i].className == "BtnNavPrincActive")
		{
			cptElement++;
		}
	}
	
	// Calcule la largeur des pages attaché au root
	var large = cptElement * 152;
	//alert(large);
	objNav.style.width = large+"px";
}


function OuvrirSousMenu(objParent)
{
	//alert("OuvrirSousMenu");
	var posLeft = objParent.offsetLeft;
	var objPere = objParent.parentNode;
	var objNewSousMenu = objParent.getElementsByTagName('div');
	var objSousMenu = objPere.getElementsByTagName('div');
	if (getStyle(objNewSousMenu[0],"display") != "list-item")
	{
		for(i=0;i<objSousMenu.length;i++)
		{
			objSousMenu[i].style.display = "none";
		}
		if (objNewSousMenu.length>0)
		{
			objNewSousMenu[0].style.display = "list-item";
			//alert(objSousMenu[0].offsetWidth);
			if (objNewSousMenu[0].offsetWidth > 152)
			{
				posLeft = posLeft - (objNewSousMenu[0].offsetWidth - 152)/2;
			}
			else
			{
				posLeft = posLeft + (152 - objNewSousMenu[0].offsetWidth)/2;
			}
			if (posLeft + objNewSousMenu[0].offsetWidth + 18 > document.getElementById("NavigPrinc").offsetWidth)
			{
				var diff = (document.getElementById("NavigPrinc").offsetWidth - (posLeft + objNewSousMenu[0].offsetWidth))*-1;
				var pos = posLeft + objNewSousMenu[0].offsetWidth;
				objNewSousMenu[0].style.left = posLeft-diff+"px";
			}
			else
			{
				objNewSousMenu[0].style.left = (posLeft+3)+"px";
			}
		}
	}
}

function FermerSousMenu(objParent)
{
	objParent.style.display = "none";
}


function ActivationChampsAutresSelonValeur(objCliquer, strValeurEgal, idChampAlterner)
{
	var objAlterer = document.getElementById(idChampAlterner);
	if (objCliquer.options[objCliquer.selectedIndex].value == strValeurEgal){
		document.getElementById("OtherAirport").style.display = "block";
		objAlterer.focus();
	}else{
		document.getElementById("OtherAirport").style.display = "none";
	}
}


function getStyle(el,styleProp)
{
	//var x = document.getElementById(el);
	if (el.currentStyle)
		var y = el.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
	return y;
}
