// JavaScript Document
unique = 0;
function valider(theForm)
{
	if (unique==1)
	{
		// double click
		return (false);
	}
	
	
	// email
	var lemail = theForm.email.value;
	var regexp  = /^[A-Za-z0-9_-]+([\.][A-Za-z0-9_-]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/;
	flag = regexp.test(lemail);
	if (!flag) 
	{
		alert("Adresse mail erronée\nCorriger SVP.");
		theForm.email.select();
		theForm.email.focus();
		return (false);
	}
	
	// pwd
	if (theForm.pwd.value.length < 6)
	{
		alert("Champ mot de passe 6 caractères min.");
		theForm.pwd.select();
		theForm.pwd.focus();
		return (false);
	}
	
	// prenom
	if (theForm.prenom.value.length < 2)
	{
		alert("Champ Prénom obligatoire.");
		theForm.prenom.select();
		theForm.prenom.focus();
		return (false);
	}
	
	
	// nom
	if (theForm.nom.value.length < 2)
	{
		alert("Champ Nom obligatoire.");
		theForm.nom.select();
		theForm.nom.focus();
		return (false);
	}
	
	// CP
	if (theForm.code_postal.value.length < 2)
	{
		alert("Champ Code Postal obligatoire.");
		theForm.code_postal.select();
		theForm.code_postal.focus();
		return (false);
	}
	
	
	// ville
	if (theForm.nom.ville.length < 2)
	{
		alert("Champ Ville obligatoire.");
		theForm.ville.select();
		theForm.ville.focus();
		return (false);
	}
		
	unique = 1; 
	return (true);
}

// JavaScript Document
unique = 0;
function valider_2(theForm)
{
	if (unique==1)
	{
		// double click
		return (false);
	}
		
	// email	
	var lemail = theForm.email_2.value;
	var regexp  = /^[A-Za-z0-9_-]+([\.][A-Za-z0-9_-]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/;
	flag = regexp.test(lemail);
	if (!flag) 
	{
		alert("Adresse mail erronée\nCorriger SVP.");
		theForm.email_2.select();
		theForm.email_2.focus();
		return (false);
	}
	
	// pwd
	if (theForm.pwd_2.value.length < 6)
	{
		alert("Champ mot de passe 6 caractères min.");
		theForm.pwd_2.select();
		theForm.pwd_2.focus();
		return (false);
	}
	
	
	unique = 1; 
	return (true);
}

// JavaScript Document
unique = 0;
function valider_3(theForm)
{
	if (unique==1)
	{
		// double click
		return (false);
	}
	
	// email	
	var lemail = theForm.email_3.value;
	var regexp  = /^[A-Za-z0-9_-]+([\.][A-Za-z0-9_-]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/;
	flag = regexp.test(lemail);
	if (!flag) 
	{
		alert("Adresse mail erronée\nCorriger SVP.");
		theForm.email_3.select();
		theForm.email_3.focus();
		return (false);
	}
	
	// prenom
	if (theForm.prenom_2.value.length < 2)
	{
		alert("Champ Prénom obligatoire.");
		theForm.prenom_2.select();
		theForm.prenom_2.focus();
		return (false);
	}
	
	
	// nom
	if (theForm.nom_2.value.length < 2)
	{
		alert("Champ Nom obligatoire.");
		theForm.nom_2.select();
		theForm.nom_2.focus();
		return (false);
	
	}	
	
		
	unique = 1; 
	return (true);
}

unique = 0;
function valider_4(theForm)
{
	if (unique==1)
	{
		// double click
		return (false);
	}
		
		// email	
	var lemail = theForm.email_4.value;
	var regexp  = /^[A-Za-z0-9_-]+([\.][A-Za-z0-9_-]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/;
	flag = regexp.test(lemail);
	if (!flag) 
	{
		alert("Adresse mail erronée\nCorriger SVP.");
		theForm.email_4.select();
		theForm.email_4.focus();
		return (false);
	}

	// prenom
	if (theForm.prenom_4.value.length < 2)
	{
		alert("Champ Prénom obligatoire.");
		theForm.prenom_4.select();
		theForm.prenom_4.focus();
		return (false);
	}
	
	// nom
	if (theForm.nom_4.value.length < 2)
	{
		alert("Champ Nom obligatoire.");
		theForm.nom_4.select();
		theForm.nom_4.focus();
		return (false);
	}

	//commentaire
	if(theForm.commentaire.value.length > 350)
	{
		alert("Commentaire trop long, merci de le réduire à 350 caractères max.");
		theForm.commentaire.select();
		theForm.commentaire.focus();
		return (false);
	}
		
	unique = 1; 
	return (true);
}

