
function InverserItem(Id) {
	Status=document.getElementById("Div"+Id).style.display;
	if(Status=="none" || Status=="") {
		document.getElementById("Div"+Id).style.display="Block";
		document.getElementById("Img"+Id).src="liste-moins.png";
	}
	else {
		document.getElementById("Div"+Id).style.display="None";
		document.getElementById("Img"+Id).src="liste-plus.png";
	}
}

function IniMenu() {
	MenuActif = GetCookie("MenuActif");
	if(MenuActif != "Menu1")
		{document.getElementById("Menu1").style.height = "1px";}
	if(MenuActif != "Menu2")
		{document.getElementById("Menu2").style.height = "1px";}
	if(MenuActif != "Menu3")
		{document.getElementById("Menu3").style.height = "1px";}
	if(MenuActif != "Menu4")
		{document.getElementById("Menu4").style.height = "1px";}
	if(MenuActif != "Menu5")
		{document.getElementById("Menu5").style.height = "1px";}
	if(MenuActif != "Menu6")
		{document.getElementById("Menu6").style.height = "1px";}
}
function AffMenu(Id) {
	if(Id!="Menu1") {FermerMenu("Menu1",30);}
	if(Id!="Menu2") {FermerMenu("Menu2",30);}
	if(Id!="Menu3") {FermerMenu("Menu3",30);}
	if(Id!="Menu4") {FermerMenu("Menu4",30);}
	if(Id!="Menu5") {FermerMenu("Menu5",30);}
	if(Id!="Menu6") {FermerMenu("Menu6",30);}
	OuvrirMenu(Id, 1);
	SetCookie("MenuActif", Id, 0, "/");
}
function OuvrirMenu(Id,Height) {
	document.getElementById(Id).style.height=Height + "px";
	if(Height<100)
		{window.setTimeout("OuvrirMenu('" + Id + "'," + (Height+10) + ")",50);}
	else
		{document.getElementById(Id).style.height = "Auto";}
}
function FermerMenu(Id, Height) {
	document.getElementById(Id).style.height=Height + "px";
	if(Height>1)
		{window.setTimeout("FermerMenu('" + Id + "'," + (Height-10) + ")",50);}
	else
		{document.getElementById(Id).style.height = "1px";}
}

// ----------------------- Gestion des cookies -----------------------

function GetCookie(nomCookie)
   {
   if (document.cookie == "") { return "" ;}

   nomCookie = nomCookie + "=";
   Deb = document.cookie.indexOf(nomCookie);
   if(Deb == -1)  { return "" ;}
       
   Deb += nomCookie.length;
   Fin = document.cookie.indexOf(";", Deb);
   if (Fin == -1) {Fin = document.cookie.length}
   return unescape(document.cookie.substring(Deb, Fin))
   }

function SetCookie(NomCookie, ValCookie, NbJours, Path, Domaine) {
	Cookie = NomCookie+"="+escape(ValCookie);
	if(NbJours) {
		Expiration = new Date();
		Expiration.setDate(Expiration.getDate()+NbJours);
		Cookie+= "; expires="+Expiration.toGMTString();
	}
	if(Path) 
		{Cookie+= "; path=" + Path;}
	if(Domaine)
		{Cookie+= "; domain=" + Domaine;}
	document.cookie = Cookie;
}


// ----------------------------- Validation de formulaires ----------------------------

function ValiderMail(Saisie, NonVide) {
	Saisie = Saisie.toLowerCase();
	if(Saisie == "" && NonVide)
		{throw new Error("Vous devez indiquer une adresse mail S.V.P.");}
	if(Saisie == "")
		{return Saisie;}
	if(Saisie.search(/.+@.+\..+/) < 0) 
		{throw new Error("Vous devez indiquer une adresse mail valide S.V.P.");}
	return Saisie;
}
function ValiderUrl(Saisie, NonVide) {
	if(Saisie == "" && NonVide)
		{throw new Error("Le site internet est obligatoire.");}
	if (Saisie == "")
		{return Saisie;}
	if(Saisie.substr(0,7).toLowerCase() != "http://") {
		Saisie = "http://" + Saisie;}
	return Saisie;
}
function ValiderVille(Saisie, NonVide) {
	if(NonVide && Saisie == "") {
		throw new Error("La ville est obligatoire.");}
	if(Saisie == "")
		{return Saisie;}
	Saisie = Saisie.replace(/-/g, " ");
	Saisie = Saisie.replace(/\./g, "");
	Saisie = Saisie.replace(/é|è|ê|ë/g, "e");
	Saisie = Saisie.replace(/à|â/g, "a");	
	Saisie = Saisie.replace(/ç/g, "c");
	Saisie = Saisie.toUpperCase();
	Saisie = Saisie.replace(/SAINT/g, "ST");		
	return Saisie;
}
// ----------------------------- Validation de formulaires ----------------------------
function AffCodeLien(){
	window.open("http://www.declique.com/lien_croise.htm","","left=160,Top=200,Width=550,Height=230,Resizable=yes");
}
