// JavaScript Document

// ========================= INPUT RECHERCHE =========================
	function initialise(champ,valeur)
	{
		if(champ.value == valeur)
		{
			champ.value = "";
		}
		else
		{
		}
	}
	
	function restaure(champ,valeur)
	{
		if(champ.value == "")
		{
			champ.value = valeur;
		}
		else
		{
		}
	}
// ========================= INPUT RECHERCHE =========================


// ========================= VARIABLES POUR LES CONTROLES DE FORM =========================
	var erreurs = 0;
	var yaEudesErreurs = false;
	var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
// ========================= VARIABLES POUR LES CONTROLES DE FORM =========================


// ========================= VERIFICATION FORMULAIRE CONTACT ET CONTACT PRESSE =========================
	function validationForm()
	{
		erreurs = 0;
		monform = document.contactForm;
		document.getElementById("contactError").className = "invisible";
		document.getElementById("erreurNom").className="invisible";
		document.getElementById("erreurPrenom").className="invisible";
		document.getElementById("erreurEmail").className="invisible";
		document.getElementById("erreurSujet").className="invisible";
		document.getElementById("erreurMessage").className="invisible";
		document.getElementById("contactNom").style.border = "1px solid #dadada";
		document.getElementById("contactPrenom").style.border = "1px solid #dadada";
		document.getElementById("contactEmail").style.border = "1px solid #dadada";
		document.getElementById("contactSujetSelected").style.border = "1px solid #dadada";
		document.getElementById("contactMessage").style.border = "1px solid #dadada";
		
		if(monform.contactNom.value=='')
		{
			erreurs++;
			document.getElementById("contactNom").style.border = "1px solid #ed1e03";
			document.getElementById("erreurNom").className="visible";
		}
		
		if(monform.contactPrenom.value=='')
		{
			erreurs++;
			document.getElementById("contactPrenom").style.border = "1px solid #ed1e03";
			document.getElementById("erreurPrenom").className="visible";
		}
		
		if(monform.contactEmail.value=='' || !reg_email.test(monform.contactEmail.value))
		{
			erreurs++;
			document.getElementById("contactEmail").style.border = "1px solid #ed1e03";
			document.getElementById("erreurEmail").className="visible";
		}
		
		if(monform.contactSujet.value=="1")
		{
			erreurs++;
			document.getElementById("contactSujetSelected").style.border = "1px solid #ed1e03";
			document.getElementById("erreurSujet").className="visible";
		}
		
		if(monform.contactMessage.value=="")
		{
			erreurs++;
			document.getElementById("contactMessage").style.border = "1px solid #ed1e03";
			document.getElementById("erreurMessage").className="visible";
		}
		
		if(erreurs>0)
		{
			document.getElementById("contactError").className = "visible";
			yaEudesErreurs = true;
			return false;
		}
		return true;
	}
	
	function validationForm2()
	{
		document.getElementById("contactNom").onmouseout = correctionNom;
		document.getElementById("contactPrenom").onmouseout = correctionPrenom;
		document.getElementById("contactEmail").onmouseout = correctionEmail;
		document.getElementById("sujetBlur").onmouseout = correctionSujet;
		document.getElementById("contactMessage").onmouseout = correctionMessage;
		
		document.getElementById("contactNom").onblur = correctionNom;
		document.getElementById("contactPrenom").onblur = correctionPrenom;
		document.getElementById("contactEmail").onblur = correctionEmail;
		document.getElementById("sujetBlur").onblur = correctionSujet;
		document.getElementById("contactMessage").onblur = correctionMessage;
	}
	
	function verifAffichageErreur()
	{
		if(document.getElementById("erreurNom").className == "invisible" && document.getElementById("erreurPrenom").className == "invisible" && document.getElementById("erreurEmail").className == "invisible" && document.getElementById("erreurSujet").className == "invisible" && document.getElementById("erreurMessage").className == "invisible")
		{
			document.getElementById("contactError").className="invisible";
		}
		else
		{
			document.getElementById("contactError").className="visible";
		}
	}
	
	function correctionNom()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.contactNom.value!='')
			{
				document.getElementById("contactNom").style.border = "1px solid #dadada";
				document.getElementById("erreurNom").className="invisible";
				verifAffichageErreur();
			}
			else
			{
				document.getElementById("contactNom").style.border = "1px solid #ed1e03";
				document.getElementById("erreurNom").className="visible";
			}
		}
	}
	
	function correctionPrenom()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.contactPrenom.value!='')
			{
				document.getElementById("contactPrenom").style.border = "1px solid #dadada";
				document.getElementById("erreurPrenom").className="invisible";
				verifAffichageErreur();
			}
			else
			{
				document.getElementById("contactPrenom").style.border = "1px solid #ed1e03";
				document.getElementById("erreurPrenom").className="visible";
			}
		}
	}
	
	function correctionEmail()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.contactEmail.value!='' && reg_email.test(monform.contactEmail.value))
			{
				document.getElementById("contactEmail").style.border = "1px solid #dadada";
				document.getElementById("erreurEmail").className="invisible";
				verifAffichageErreur();
			}
			else
			{
				document.getElementById("contactEmail").style.border = "1px solid #ed1e03";
				document.getElementById("erreurEmail").className="visible";
			}
		}
	}
	
	function correctionSujet()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.contactSujet.value!="1")
			{
				document.getElementById("contactSujetSelected").style.border = "1px solid #dadada";
				document.getElementById("erreurSujet").className="invisible";
				verifAffichageErreur();
			}
			else
			{
				document.getElementById("contactSujetSelected").style.border = "1px solid #ed1e03";
				document.getElementById("erreurSujet").className="visible";
			}
		}
	}
	
	function correctionMessage()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.contactMessage.value!='')
			{
				document.getElementById("contactMessage").style.border = "1px solid #dadada";
				document.getElementById("erreurMessage").className="invisible";
				verifAffichageErreur();
			}
			else
			{
				document.getElementById("contactMessage").style.border = "1px solid #ed1e03";
				document.getElementById("erreurMessage").className="visible";
			}
		}
	}
// ========================= VERIFICATION FORMULAIRE CONTACT ET CONTACT PRESSE =========================



// ========================= VERIFICATION FORMULAIRE INSCRIPTION =========================
	function validationFormClub()
	{
		erreurs = 0;
		monform = document.inscriptionClubForm;
		document.getElementById("champNomInscription").style.border = "1px solid #dadada";
		document.getElementById("champPrenomInscription").style.border = "1px solid #dadada";
		document.getElementById("champEmailInscription").style.border = "1px solid #dadada";
		
		if(monform.champNomInscription.value=='')
		{
			erreurs++;
			document.getElementById("champNomInscription").style.border = "1px solid #f97c04";
		}
		
		if(monform.champPrenomInscription.value=='')
		{
			erreurs++;
			document.getElementById("champPrenomInscription").style.border = "1px solid #f97c04";
		}
		
		if(monform.champEmailInscription.value=='' || !reg_email.test(monform.champEmailInscription.value))
		{
			erreurs++;
			document.getElementById("champEmailInscription").style.border = "1px solid #f97c04";
		}
		
		if(monform.champDateJour.value=='' || isNaN(monform.champDateJour.value) == true || monform.champDateJour.value.length != 2)
		{
			erreurs++;
			document.getElementById("champDateJour").style.border = "1px solid #f97c04";
		}
		
		if(monform.champDateMois.value=='' || isNaN(monform.champDateMois.value) == true || monform.champDateMois.value.length != 2)
		{
			erreurs++;
			document.getElementById("champDateMois").style.border = "1px solid #f97c04";
		}
		
		if(monform.champDateAnnee.value=='' || isNaN(monform.champDateAnnee.value) == true || monform.champDateAnnee.value.length != 4)
		{
			erreurs++;
			document.getElementById("champDateAnnee").style.border = "1px solid #f97c04";
		}
		
		if(erreurs>0)
		{
			yaEudesErreurs = true;
			return false;
		}
		return true;
	}
	
	function correctionNom2()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.champNomInscription.value!='')
			{
				document.getElementById("champNomInscription").style.border = "1px solid #dadada";
			}
			else
			{
				document.getElementById("champNomInscription").style.border = "1px solid #f97c04";
			}
		}
	}
	
	function correctionPrenom2()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.champPrenomInscription.value!='')
			{
				document.getElementById("champPrenomInscription").style.border = "1px solid #dadada";
			}
			else
			{
				document.getElementById("champPrenomInscription").style.border = "1px solid #f97c04";
			}
		}
	}
	
	function correctionEmail2()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.champEmailInscription.value!='' && reg_email.test(monform.champEmailInscription.value))
			{
				document.getElementById("champEmailInscription").style.border = "1px solid #dadada";
			}
			else
			{
				document.getElementById("champEmailInscription").style.border = "1px solid #f97c04";
			}
		}
	}
	
	function correctionDateJour()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.champDateJour.value!='' && isNaN(monform.champDateJour.value) == false && monform.champDateJour.value.length == 2)
			{
				document.getElementById("champDateJour").style.border = "1px solid #dadada";
			}
			else
			{
				document.getElementById("champDateJour").style.border = "1px solid #f97c04";
			}
		}
	}
	
	function correctionDateMois()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.champDateMois.value!='' && isNaN(monform.champDateMois.value) == false && monform.champDateMois.value.length == 2)
			{
				document.getElementById("champDateMois").style.border = "1px solid #dadada";
			}
			else
			{
				document.getElementById("champDateMois").style.border = "1px solid #f97c04";
			}
		}
	}
	
	function correctionDateAnnee()
	{
		if(yaEudesErreurs == true)
		{
			if(monform.champDateAnnee.value!='' && isNaN(monform.champDateAnnee.value) == false && monform.champDateAnnee.value.length == 4)
			{
				document.getElementById("champDateAnnee").style.border = "1px solid #dadada";
			}
			else
			{
				document.getElementById("champDateAnnee").style.border = "1px solid #f97c04";
			}
		}
	}
	
	function validationFormClub2()
	{
		document.getElementById("champNomInscription").onmouseout = correctionNom2;
		document.getElementById("champPrenomInscription").onmouseout = correctionPrenom2;
		document.getElementById("champEmailInscription").onmouseout = correctionEmail2;
		document.getElementById("champDateJour").onmouseout = correctionDateJour;
		document.getElementById("champDateMois").onmouseout = correctionDateMois;
		document.getElementById("champDateAnnee").onmouseout = correctionDateAnnee;
		
		document.getElementById("champNomInscription").onblur = correctionNom2;
		document.getElementById("champPrenomInscription").onblur = correctionPrenom2;
		document.getElementById("champEmailInscription").onblur = correctionEmail2;
		document.getElementById("champDateJour").onblur = correctionDateJour;
		document.getElementById("champDateMois").onblur = correctionDateMois;
		document.getElementById("champDateAnnee").onblur = correctionDateAnnee;
	}
// ========================= VERIFICATION FORMULAIRE INSCRIPTION =========================
