// JavaScript Document
unique = 0;
function valider(theForm)
{
	if (unique==1)
	{
		// double click
		return (false);
	}
	
	// pseudo
	if (theForm.pseudo.value.length < 4)
	{
		alert("Champ utilisateur 4 caractères min.");
		theForm.pseudo.select();
		theForm.pseudo.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);
	}
	
	if (theForm.pseudo.value == theForm.pwd.value)
	{
		alert("La valeur \"Utilisateur\" doit être différente de \"Mot de passe\".");
		theForm.pseudo.select();
		theForm.pseudo.focus();
		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);
	}
	
	// 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);
	}
	
	// Societe
	if (theForm.societe.value.length < 2)
	{
		alert("Champ Société obligatoire.");
		theForm.societe.select();
		theForm.societe.focus();
		return (false);
	}
	
	unique = 1; 
	return (true);
}
