// JavaScript Document

	function rubriqueActive(rub)
	{
		if(rub!=0)
		{
			document.getElementById(rub).className = "actif";
		}
	}
	
	
	// contrôle du formulaire
	function validationForm(monform) // validation des formualires
		{
			var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
			
			if(monform.nom)
			{
				monform.nom.style.borderColor="#7f9db9";
			}
			if(monform.prenom)
			{
				monform.prenom.style.borderColor="#7f9db9";
			}
			if(monform.adresse)
			{
				monform.adresse.style.borderColor="#7f9db9";
			}
			if(monform.pays)
			{
				monform.pays.style.borderColor="#7f9db9";
			}
			if(monform.tel)
			{
				monform.tel.style.borderColor="#7f9db9";
			}
			if(monform.email)
			{
				monform.email.style.borderColor="#7f9db9";
			}
			if(monform.message)
			{
				monform.message.style.borderColor="#7f9db9";
			}
			
			
			if(monform.nom)
			{
				if (monform.nom.value=='')
				{
					alert("Veuillez indiquer votre nom");
					monform.nom.style.borderColor="#b8563a";
					monform.nom.focus();
					return false;
				}
			}
			if(monform.prenom)
			{
				if (monform.prenom.value=='')
				{
					alert("Veuillez indiquer votre prénom");
					monform.prenom.style.borderColor="#b8563a";
					monform.prenom.focus();
					return false;
				}
			}
			if(monform.adresse)
			{
				if (monform.adresse.value=='')
				{
					alert("Veuillez indiquer votre adresse");
					monform.adresse.style.borderColor="#b8563a";
					monform.adresse.focus();
					return false;
				}
			}
			if(monform.tel)
			{
				if (monform.tel.value=='')
				{
					alert("Veuillez indiquer votre n° de téléphone");
					monform.tel.style.borderColor="#b8563a";
					monform.tel.focus();
					return false;
				}
			}
			if(monform.email)
			{
				if (monform.email.value=='')
				{
					alert("Veuillez indiquer votre adresse email");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
				if(!reg_email.test(monform.email.value))
				{
					alert("Le format de votre adresse email est invalide");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
			}
			if(monform.message)
			{
				if (monform.message.value=='')
				{
					alert("Veuillez indiquer votre message");
					monform.message.style.borderColor="#b8563a";
					monform.message.focus();
					return false;
				}
			}
			return true;
		}
		
// contrôle inscription
	function validationForm2(monform) // validation des formualires
		{
			var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
			
			if(monform.nom)
			{
				monform.nom.style.borderColor="#76000f";
			}
			if(monform.prenom)
			{
				monform.prenom.style.borderColor="#76000f";
			}
			if(monform.adresse)
			{
				monform.adresse.style.borderColor="#76000f";
			}
			if(monform.cp)
			{
				monform.adresse.style.borderColor="#7f9db9";
			}
			if(monform.ville)
			{
				monform.adresse.style.borderColor="#7f9db9";
			}
			if(monform.tel)
			{
				monform.tel.style.borderColor="#76000f";
			}
			if(monform.email)
			{
				monform.email.style.borderColor="#76000f";
			}
			
			
			if(monform.nom)
			{
				if (monform.nom.value=='')
				{
					alert("Veuillez indiquer votre nom");
					monform.nom.style.borderColor="#b8563a";
					monform.nom.focus();
					return false;
				}
			}
			if(monform.prenom)
			{
				if (monform.prenom.value=='')
				{
					alert("Veuillez indiquer votre prénom");
					monform.prenom.style.borderColor="#b8563a";
					monform.prenom.focus();
					return false;
				}
			}
			if(monform.adresse)
			{
				if (monform.adresse.value=='')
				{
					alert("Veuillez indiquer votre adresse");
					monform.adresse.style.borderColor="#b8563a";
					monform.adresse.focus();
					return false;
				}
			}
			if(monform.cp)
			{
				if (monform.cp.value=='')
				{
					alert("Veuillez indiquer votre code postal");
					monform.cp.style.borderColor="#b8563a";
					monform.cp.focus();
					return false;
				}
			}
			if(monform.ville)
			{
				if (monform.ville.value=='')
				{
					alert("Veuillez indiquer votre ville");
					monform.ville.style.borderColor="#b8563a";
					monform.ville.focus();
					return false;
				}
			}
			if(monform.tel)
			{
				if (monform.tel.value=='')
				{
					alert("Veuillez indiquer votre n° de téléphone");
					monform.tel.style.borderColor="#b8563a";
					monform.tel.focus();
					return false;
				}
			}
			if(monform.email)
			{
				if (monform.email.value=='')
				{
					alert("Veuillez indiquer votre adresse email");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
				if(!reg_email.test(monform.email.value))
				{
					alert("Le format de votre adresse email est invalide");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
			}
			return true;
		}
		
// contrôle identification
	function validationForm3(monform) // validation des formualires
		{
			var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
			
			if(monform.email)
			{
				monform.email.style.borderColor="#76000f";
			}
			if(monform.mdp)
			{
				monform.mdp.style.borderColor="#76000f";
			}
			
			
			if(monform.email)
			{
				if (monform.email.value=='')
				{
					alert("Veuillez indiquer votre adresse email");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
				if(!reg_email.test(monform.email.value))
				{
					alert("Le format de votre adresse email est invalide");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
			}
			if(monform.mdp)
			{
				if (monform.mdp.value=='')
				{
					alert("Veuillez indiquer votre mot de passe");
					monform.mdp.style.borderColor="#b8563a";
					monform.mdp.focus();
					return false;
				}
			}
			return true;
		}
		
// contrôle oubli mdp
	function validationForm4(monform) // validation des formualires
		{
			var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
			
			if(monform.email)
			{
				monform.email.style.borderColor="#76000f";
			}
			
			if(monform.email)
			{
				if (monform.email.value=='')
				{
					alert("Veuillez indiquer votre adresse email");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
				if(!reg_email.test(monform.email.value))
				{
					alert("Le format de votre adresse email est invalide");
					monform.email.style.borderColor="#b8563a";
					monform.email.focus();
					return false;
				}
			}
			return true;
		}
		
// contrôle de la recherche

		function validationRecherche(monform) // validation des formualires
		{
			var regDate = /^(\d\d?)(\/|-|\.)(\d\d?)(\/|-|\.)(\d\d)(\d\d)?$/;

			monform.mariee.style.borderColor="#7f9db9";
			monform.marie.style.borderColor="#7f9db9";
			monform.dateMariage.style.borderColor="#7f9db9";
			
			if (monform.mariee.value=='' && monform.marie.value=='')
			{
				alert("Veuillez indiquer le prénom de la mariée OU le prénom du marié");
				monform.mariee.style.borderColor="#b8563a";
				monform.marie.style.borderColor="#b8563a";
				monform.mariee.focus();
				return false;
			}
			
			if (monform.dateMariage.value=='')
			{
				alert("Veuillez indiquer la date du mariage");
				monform.dateMariage.style.borderColor="#b8563a";
				monform.dateMariage.focus();
				return false;
			}
			if(!regDate.test(monform.dateMariage.value))
			{
				alert("Le format de votre date est invalide, veuillez rentrer la date au format JJ/MM/AAAA");
				monform.dateMariage.style.borderColor="#b8563a";
				monform.dateMariage.focus();
				return false;
			}
			return true;
		}
		
// contrôle du mode de paiement et case "lire les CGV"

		function verifLuCGV(mode){
			if(document.Cgv.luCGV.checked == true)
			{
/*				if(mode == "cb")
				{
					if(confirm("Vous souhaitez effectuer votre paiement par CB"))
					{
					}
				}
				else if (mode == "visa")
				{
					if(confirm("Vous souhaitez effectuer votre paiement par carte Visa"))
					{
					}
				}
				else if (mode == "eurocard")
				{
					if(confirm("Vous souhaitez effectuer votre paiement par carte Eurocard / Mastercard"))
					{
					}
				}
				else */
				if (mode == "cheque")
				{
					if(confirm("Vous souhaitez effectuer votre paiement par chèque"))
					{
						window.open("paiement-cheque-poteries-vallee-noire.php","_self");
					}
				}
			}
			else
			{
				alert("Vous devez accepter les Conditions Générales de Vente en cochant la case correspondante");
			}
		}

		function verifLuCGV2()
		{
			if (document.Cgv.luCGV.checked == true) return(true);
			else 
			{
				alert("Vous devez accepter les Conditions Générales de Vente en cochant la case correspondante");
				return(false);
			}
		}