// PNG transparent sous internet Explorer
function IE_CorrectAlpha_PNG(){ 
	for(i=0; i<document.images.length; i++){ 
		img    = document.images[i]; 
		imgExt  = img.src.substring(img.src.length-3, img.src.length); 
		imgExt  = imgExt.toUpperCase(); 
		if (imgExt == "PNG"){ 
			imgID    = (img.id) ? "id='" + img.id + "' " : ""; 
			imgClass= (img.className) ? "class='" + img.className + "' " : ""; 
			imgTitle= (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "; 
			imgStyle= "display:inline-block;" + img.style.cssText; 
			if (img.align == "left") { 
				imgStyle = "float:left;"  + imgStyle;
			}else if (img.align == "right"){
				imgStyle = "float:right;" + imgStyle;
			} 
			if (img.parentElement.href){ 
				imgStyle = "cursor:hand;" + imgStyle;
			}        
			strNewHTML    = '<span '+imgID+imgClass+imgTitle+' style="width:'+img.width+'px; height:'+img.height+'px;'+imgStyle+';'+'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+img.src+'\', sizingMethod=\'scale\');"></span>'; 
			img.outerHTML = strNewHTML; 
			i = i-1; 
		}
	}
} 
window.attachEvent("onload", IE_CorrectAlpha_PNG);
/* Ajouter au favoris */
function favoris() {
	/* IE */
	if ( navigator.appName != 'Microsoft Internet Explorer' ){ 
		window.sidebar.addPanel("Events :: Une équipe à l'écoute de vos enfants","http://www.eventsfrance.fr/",""); 
	}
	/* FireFox */
	else { 
		window.external.AddFavorite("http://www.eventsfrance.fr/","Events :: Une équipe à l'écoute de vos enfants"); 
	} 
}
/* Popup image centré + lien fermer */
function PopupImage(img) {
	titre="Agrandissement";
	w=open("popup-agrandissement.php?img="+img,"image","width=400,height=400,toolbar=no,scrollbars=no,resizable=no,top=0,left=0");
	w.document.close();
}
/* Chargement des pages à partir d'un menu Flash */
function chargePage(page) {
	top.location.href=page+".php";
}
/* Validation javascript du mail */
function arobaceok()
{
	if(document.formulaire.lAdresseDeMessagerie.value == ""){
		alert("Il manque votre adresse e-mail!");
		return false;
	}else if(document.formulaire.leOu.value == ""){
		alert("Vous devez indiquer l'agence que vous souhaitez contacter !");
		return false;
	}
	var a=document.forms[0].lAdresseDeMessagerie.value;
	var test="" + a;
	for(var k = 0; k < test.length;k++)
		{
		var c = test.substring(k,k+1);
		if(c == "@")
		{
		return true;
		}
	}
	alert("La syntaxe de votre e-mail est incorrect !");
	return false;
}
/* Validation javascript du mail recommander */
function arobaceokR()
{
	var a=document.forms[0].lAdresseDeMessagerie.value;
	var test="" + a;
	for(var k = 0; k < test.length;k++){
		var c = test.substring(k,k+1);
		if(c == "@"){
			var a=document.forms[0].lAdresseDeMessagerie2.value;
			var test="" + a;
			for(var k = 0; k < test.length;k++){
				var c = test.substring(k,k+1);
				if(c == "@"){
					return true;
				}
			}
			alert("La syntaxe de son e-mail est incorrect ou l'email est manquant.");
			return false;
		}
	}
	alert("La syntaxe de votre e-mail est incorrect ou l'email est manquant.");
	return false;
}

 


/* Encode mail */
function encodeMailto(a,b){
	var tg="<";
	var name=a;
	var at="@";
	var host=b;
	var text="Email direct";
	document.write(tg+"a hr"+"ef=mai"+"lto:"+name);
	document.write(at+host+">"+text+tg+"/a>");
}

/* Affichage des divs des photos */
function afficheDiv(qui){
	for(i = 1; i<= 4; i++ ){
		document.getElementById(i).style.display="none";
	}
	document.getElementById(qui).style.display="block";
	
	/*for(i = 1; i<= 4; i++ ){
		if(i==qui){
		document.getElementById("petite"+i).style.display="none";
		}else{
		document.getElementById("petite"+i).style.display="block";	
		}
	}*/
}

function PopupMdp() {
	sw=Math.round((screen.availWidth-350)/2);
	sh=Math.round((screen.availHeight-160)/2);
	titre="Mot de passe oublié";
	window.open("popup-mdp.php","titre","width=350,height=160,toolbar=no,scrollbars=no,resizable=no,top="+sh+",left="+sw+"");
}

// valider l'identification
function validerIdentification(){
	l0 = document.getElementById('li0').checked;
	l1 = document.getElementById('li1').checked;
	if(!l1 && !l0){
		alert("Veuillez indiquer si vous souhaitez recevoir la lettre d’information d’Events.")
	}else{
		document.formulaire.valide.value=1;
		document.formulaire.submit();
	}
}
