<!--
function popup(adr,nompop,larg,haut,res){window.open(adr,nompop,'width='+larg+',height='+haut+',scrollbars=1,toolbar=0,location=0,status=0,menubar=0,resizable='+res);}
function imgPopup(nomPop,img,fond,txt,css){
	var ressources = "ressources/";
	if(arguments[5]!= undefined){ressources = arguments[5];}
   imgPop = window.open("",nomPop,"scrollbars=yes,width=700,height=550");
   imgPop.document.write("<html>\n\n");
   imgPop.document.write("<head><title>Apercu d'image</title></head>\n\n");
   imgPop.document.write("<body bgcolor=\""+fond+"\">\n");
   imgPop.document.write("  <table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">\n");
   imgPop.document.write("    <tr><td align=\"center\"><img src=\""+ressources+img+"\"></td></tr>\n");
   imgPop.document.write("    <tr><td align=\"center\">\n");
   imgPop.document.write("      <table border=\"0\" cellpadding=\"0\" cellspacing=\"2\">\n");
   imgPop.document.write("        <tr><td><span style=\""+css+"\">"+txt+"</span></td></tr>\n");
   imgPop.document.write("      </table>\n");
   imgPop.document.write("    </td></tr>\n");
   imgPop.document.write("  </table>\n");
   imgPop.document.write("</body>\n\n");
   imgPop.document.write("</html>");
}
function Makepop(url,my_l,my_h,my_s,my_status,my_resize,my_name){
	/* Version 1.0 */
	/* Creation Marc alias DMC */
	addPop=window.open(url,my_name,"width="+my_l+",height="+my_h+",scrollbars="+my_s+",toolbar=0,location=0,status="+my_status+",menubar=no,resizable="+my_resize);addPop.focus();
}

/* ////////////////////////////////////////////// */
/*	Test un ensemble de caract šres                */
/*	@return true ou false                         */
/* ////////////////////////////////////////////// */
function defendu(string) {
if (!string){return false;}

   var iChars = "abcdefghijklmnopqrstuvwxyz@-_.~0123456789";
   for (var i = 0; i < string.length; i++) {
		if (iChars.indexOf(string.charAt(i).toLowerCase()) == -1){
			return false;
		}
   }
   return true;
} 
/* ////////////////////////////////////////////// */
/*	Test l'email                                  */
/*	@return false ou String                       */
/* ////////////////////////////////////////////// */
function is_Email(emails){
	if (emails.indexOf("@") != -1 && emails.indexOf("..")==-1 && defendu(emails)==true){
			var longueur = emails.split("@");
			if((longueur.length==2) && (longueur[0]!="" && longueur[1]!="")){
				var taille=longueur[1].lastIndexOf(".");
				if(taille!=-1){
					if((longueur[1].length-1-taille)==2 || (longueur[1].length-1-taille)==3 ){
						return true;
					}
					return false;
				}
				return false;
			}
			return false;
	}
	return false;		
}

function setActualite(id){

}
/**
  * Retaille l'iframe actualite
  * auteur : marc
  */
function initIframeActualite(hauteur){
	var frameactualite = $("frameactualite");
	var taille = 600;
	if(hauteur!=undefined){	taille=hauteur ;}
	frameactualite.setStyle({height:taille+"px"});
}

function testchamp(objformulaire,nom){
 if(objformulaire[nom].value!="" && objformulaire[nom].value!=objformulaire[nom].defaultValue){
 	return true;
 }else{
 	return false;
 }
}

function formulmaire (){	 
	this.champ = ["nom","prenom","email","tel"];
	this.libelle = ["Nom","Prénom","E-mail","Téléphone"];
	this.test =  ["vide","vide","email","vide"];
	this.formulaire = null;
	this.captcha = false;
	
	this.init = function (form){
		this.formulaire = document.forms[form];
		for(var i =0; i <this.champ.length;i++){
			this.formulaire[this.champ[i]].onblur = function (){
				var value = this.value;
				if(this.value == "" || this.value==this.defaultValue){
					this.value =this.defaultValue;
				}
			}

			this.formulaire[this.champ[i]].onfocus = function (){
				if(this.value==this.defaultValue){
					this.value="";
				}
			}
		}
	};
	
	this.valider = function(){
		var message ="";
		for(var i =0; i <this.champ.length;i++){
			  switch (this.test[i]){ 
				case "vide"  : message += (testchamp(this.formulaire,this.champ[i])==false)? "- "+this.libelle[i]+"\n" : "" ; break; 
				case "email" : message += (is_Email(this.formulaire[this.champ[i]].value)==false)? "- "+this.libelle[i]+"\n" : "" ; break; 
				case "site"  : message += (testchamp(this.formulaire,this.champ[i])==false)? "- "+this.libelle[i]+"\n" : "" ; break; 
				default : ""; 
			  } 
		}
		if(message !=""){
			message = "Veuillez remplir les champs suivant :\n"+message; 
			alert(message)
		}else{
			if(!this.captcha) {
				this.formulaire.submit();
			} else {
				var fieldset;
				var divCaptcha = document.getElementById("captcha");
				for(var i=0;i<this.formulaire.childNodes.length;i++) {
					if(this.formulaire.childNodes[i].nodeName.toLowerCase()=="fieldset") {
						fieldset = this.formulaire.childNodes[i];
					}
				}
				fieldset.style.display = "none";
				divCaptcha.style.display = "block";
				this.formulaire["captchaValue"].focus();
			}
		}
		return false;
	}
	this.confirmWithCaptcha = function() {
		var captchaValue = this.formulaire["captchaValue"].value;
		if(!captchaValue == "") {
			//alert(captchaValue);
			this.formulaire.submit();
		} else {
			alert("Veuillez saisir les caractères présents sur l'image");
		}	
	}
}
var contactRapide =  new formulmaire();
contactRapide.champ = ["nom","prenom","email","tel"];
contactRapide.libelle = ["Nom","Prénom","E-mail","Téléphone"],
contactRapide.test = ["vide","vide","email","vide"];
contactRapide.captcha = true;



Event.observe(window, "load", function() {
	
	var jours = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"];
	var mois = ["Janvier", "février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Novembre", "Décembre"];
	
	if($("ephemeride") != null) {
	new Ajax.Request('flash/ephemeride.xml',
	  {
	    method:'post',
	    onSuccess: function(transport){
			var xml = transport.responseXML;
			var lignes = xml.getElementsByTagName("ligne");
			var now = new Date();
			var nowToString = ((now.getDate() < 10)? "0" + now.getDate() : now.getDate()) + "/" + ((now.getMonth()+1 < 10)? "0" + (now.getMonth()+1) : (now.getMonth()+1));
			var texte = "<span>";
			for(var i=0; i<lignes.length; i++) {
				var date = lignes[i].getAttribute("date");
				var ferie = lignes[i].getAttribute("ferie");
				var nom = lignes[i].firstChild.nodeValue;
				
				if(date == nowToString) {
					texte += jours[now.getDay()] + " " + now.getDate() + " " + mois[now.getMonth()] + ",</span> ";
					if(ferie == "true") {
						texte += "nous célébrons ";
					} else {
						texte += "une joyeuse fête aux ";
					}
					texte += "<span>" + nom + "</span>";
				}
			}
			$("ephemeride").innerHTML = texte;
	    },
	    onFailure: function(){ alert('Something went wrong...') }
	  });
	}

});


//-->
