
window.onload = chargerPage;

function chargerPage() {
//	alphaPng();  Attention, conflit avec GoogleMap. Placer avant!
	GererAffichage();
	if (typeof(google) != "undefined") {
		initialize(largeur, longueur);
	}
}

function alphaPng() {
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters)) 
	{
	document.execCommand('BackgroundImageCache', false, true); // background flicker

		for(var i=0; i<document.images.length; i++)
		{
		  var img = document.images[i]
		  var imgName = img.src.toUpperCase()
		  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		  {
			 var imgID = (img.id) ? "id='" + img.id + "' " : ""
			 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			 var imgStyle = "display:inline-block;" + img.style.cssText 
			 if (img.align == "left") imgStyle = "float:left;" + imgStyle
			 if (img.align == "right") imgStyle = "float:right;" + imgStyle
			 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	
			var width = img.width;
			var height = img.height;
	
			var strNewHTML = "<span " + imgID + imgClass + imgTitle
			 + " style=\"" + "width:" + width + "px; height:" + height + "px;" + imgStyle + ";"
			 + " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			 + "(src=\'" + img.src + "\', sizingMethod='crop');";
			 if (img.className == "png") {
				 strNewHTML = strNewHTML + " margin-top: 10px; margin-left: 6px;";
			 }
			 strNewHTML = strNewHTML + "\"></span>"; 
			 img.outerHTML = strNewHTML
			 i = i-1
		  }
		}
	}
}

function GererAffichage() {

	var x = LireTemoin("GrandeurTexte");
	if (x==1){
		Agrandir();
		}
	else{
		Restaurer();
		}
	
	// Assigne l'action au lien pour agrandir le texte
	var liengrand=document.getElementById('grand');
	liengrand.onclick=function(){
		
		Agrandir();
		//AgrandirMenus();
		CreerTemoin();
		return false;
		};
	
	// Assigne l'action au lien pour réduire le texte
	var lienpetit=document.getElementById('petit');
	lienpetit.onclick=function() {
	
		Restaurer();
		EffacerTemoin();
		return false;
		};
}

function Agrandir(){
	var bodys=document.getElementsByTagName('body');
	bodys[0].style.fontSize='1.5em';
}

function AgrandirMenus() {
	var sousmenu = document.getElementById("sousemploi");
	sousmenu.parentNode.style.height = "250px";
	sousmenu.onmouseover = function() {
		//alert(this);
		this.parentNode.style.backgroundImage = "none";
		this.parentNode.style.backgroundColor = "#ECEAD5";
		var li = this.getElementsByTagName("li");
		for (var i=0; i<li.length; i++) {
			li[i].style.top = "0";
			li[i].style.listStyleType = "disc"; // sinon les puces ne s'affichent pas
		}
	};
	sousmenu.onmouseout = function() {
		this.parentNode.style.backgroundImage = "url(../images/accueil/emploi.jpg)";
		this.parentNode.style.backgroundColor = ""; // "none" ne marche pas dans IE7
		var li = this.getElementsByTagName("li");
		for (var i=0; i<li.length; i++) {
			li[i].style.top = "-10000px";
			li[i].style.listStyleType = "none"; // sinon les puces restent affichées dans IE7
		}
	};
	document.getElementById("education").style.height = "250px";
}

function Restaurer(){
	var bodys=document.getElementsByTagName('body');
	bodys[0].style.fontSize='1em';
}

function CreerTemoin(){
	// Créer le cookie
	 var expires=new Date;
	 expires.setDate(expires.getDate()+1);
	 document.cookie='GrandeurTexte=1; expires=' + expires + '; domain; path=/; ';
}

function EffacerTemoin(){
	 // Efface le cookie
	 var expires=new Date;
	 expires.setDate(expires.getDate()-1);
	 document.cookie='GrandeurTexte=1; expires=' + expires + '; domain; path=/; ';
}

function LireTemoin() {
	var nom = "GrandeurTexte=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nom) == 0) return c.substring(nom.length,c.length);
	}
	return null;
}
/******Fin de la gestion de l'affichage *******/

function active(ssmenu) { 
	document.getElementById(ssmenu).className = document.getElementById(ssmenu).className + " actif";
}

