//
// ValidateInsertion
//
function 	ValidateInsertion()
{
	var errormsg = "";
	var errors = 0;

	//emailspan.classname="normal";
	//nomspan.classname="normal";
	//prenomspan.classname="normal";
	//adessespan.classname="normal";
	//motdepassespan.classname="normal";
	//confirmationdumotdepassespan.classname="normal";
	//villespan.classname="normal";
	//codepostalspan.classname="normal";
	
	document.NETMINEFORM2.CUSTOMER_NAME.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_FIRSTNAME.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_LOGIN.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_ADDRESS.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_TOWN.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_POSTALCODE.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_PORTABLE.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_EMAIL.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_COOPT_EMAIL.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_PASSWORD.className = "y-textfield";
	document.NETMINEFORM2.CUSTOMER_READ_REGLEMENT.className = "y-textfield";

	if (isString(document.NETMINEFORM2.CUSTOMER_NAME.value, 2, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_NAME.className = "red";
			Nomspan.className="textred";
			errors=1;
//			errormsg +='Le champ NOM n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_NAME.focus();
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_FIRSTNAME.value, 2, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_FIRSTNAME.className = "red";
			Prenomspan.className="textred";
			errors=1;
//			errormsg +='Le champ PRENOM n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_FIRSTNAME.focus();

	}
	if (IsAlphaNumeric(document.NETMINEFORM2.CUSTOMER_LOGIN.value) == false)
	{
			document.NETMINEFORM2.CUSTOMER_LOGIN.className = "red";
			Loginspan.className="textred";
			errors=1;
			document.NETMINEFORM2.CUSTOMER_LOGIN.focus();
	}
	if (isLogin(document.NETMINEFORM2.CUSTOMER_LOGIN.value, 5, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_LOGIN.className = "red";
			Loginspan.className="textred";
			errors=1;
//			errormsg +='Le champ LOGIN n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_LOGIN.focus();
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_ADDRESS.value, 2, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_ADDRESS.className = "red";
			Adressespan.className="textred";
			errors=1;
//			errormsg +='Le champ ADRESSE n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_ADDRESS.focus();
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_TOWN.value, 2, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_TOWN.className = "red";
			Villespan.className="textred";
			errors=1;
//			errormsg +='Le champ VILLE n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_TOWN.focus();
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_POSTALCODE.value, 2, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_POSTALCODE.className = "red";
			Codepostalspan.className="textred";
			errors=1;
//			errormsg +='Le champ CODE POSTAL n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_POSTALCODE.focus();
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_PORTABLE.value, 0, 255, 1) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_PORTABLE.className = "red";
			
			errors=1;
//			errormsg +='Le champ TELEPHONE n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_PORTABLE.focus();
	}
	if (isNumeric(document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.className = "red";
			errors=1;
//			errormsg +='Le champ ANNEE DE NAISSANCE n\'est pas un numérique !\n';
			document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.focus();
	}
	if ((document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value <= 1800) || (document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value >= 2100) || ((document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value == "")))
	{
			document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.className = "red";
			errors=1;
//			errormsg +='Le champ ANNEE DE NAISSANCE n\'est pas valide !\n';
			document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.focus();
	}
	if (isEmail(document.NETMINEFORM2.CUSTOMER_EMAIL.value, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_EMAIL.className = "red";
			emailspan.className="textred";
			//alert(emailspan.className);
			errors=1;
//			errormsg +='Le champ EMAIL n\'est pas un email valide !\n';
			document.NETMINEFORM2.CUSTOMER_EMAIL.focus();
	}
	if (isEmail(document.NETMINEFORM2.CUSTOMER_COOPT_EMAIL.value, 1) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_COOPT_EMAIL.className = "red";
			cooptemailspan.className="textred";
			errors=1;
//			errormsg +='Le champ EMAIL DU PARRAIN	 n\'est pas un email valide !\n';
			document.NETMINEFORM2.CUSTOMER_COOPT_EMAIL.focus();
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_PASSWORD.value, 5, 255, 0) == 0)
	{
			document.NETMINEFORM2.CUSTOMER_PASSWORD.className = "red";
			Motdepassespan.className="textred";
			errors=1;
//			errormsg +='Le champ PASSWORD n\'est pas un texte valide !\n';
			document.NETMINEFORM2.CUSTOMER_PASSWORD.focus();
	}
	if (document.NETMINEFORM2.CUSTOMER_PASSWORD.value != document.NETMINEFORM2.CUSTOMER_PASSWORD2.value)
	{
			document.NETMINEFORM2.CUSTOMER_PASSWORD.className = "red";
			Confirmationdumotdepassespan.className="textred";
			errors=1;
//			errormsg +='Les PASSWORDS ne correspondent pas !\n';
			document.NETMINEFORM2.CUSTOMER_PASSWORD.focus();
	}
	if (document.NETMINEFORM2.CUSTOMER_READ_REGLEMENT.checked == false)
	{
			document.NETMINEFORM2.CUSTOMER_READ_REGLEMENT.className = "red";
			errors=1;
//			errormsg +='Pour vous inscrire vous DEVEZ LIRE LE RÉGLEMENT...\n';		
			document.NETMINEFORM2.CUSTOMER_READ_REGLEMENT.focus();
	}
	if (errors == 0)
	{
		document.NETMINEFORM2.submit();
	}
	else
	{
		alert ("Veuillez compléter ou renseigner correctement les champs indiqués en rouges");
		return;
	}
}

//
// ValidateModification
//
function 	ValidateModification()
{

	if (isString(document.NETMINEFORM2.CUSTOMER_NAME.value, 2, 255, 0) == 0)
	{
			alert('Le champ nom n\'est pas un texte valide !');
			document.NETMINEFORM2.CUSTOMER_NAME.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_FIRSTNAME.value, 2, 255, 0) == 0)
	{
			alert('Le champ prénom n\'est pas un texte valide !');
			document.NETMINEFORM2.CUSTOMER_FIRSTNAME.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_ADDRESS.value, 2, 255, 0) == 0)
	{
			alert('Le champ adresse n\'est pas un texte valide !');
			document.NETMINEFORM2.CUSTOMER_ADDRESS.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_TOWN.value, 2, 255, 0) == 0)
	{
			alert('Le champ ville n\'est pas un texte valide !');
			document.NETMINEFORM2.CUSTOMER_TOWN.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_POSTALCODE.value, 2, 255, 0) == 0)
	{
			alert('Le champ code postal n\'est pas un texte valide !');
			document.NETMINEFORM2.CUSTOMER_POSTALCODE.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.CUSTOMER_PORTABLE.value, 0, 255, 1) == 0)
	{
			alert('Le champ portable n\'est pas un texte valide !');
			document.NETMINEFORM2.CUSTOMER_PORTABLE.focus();
			return;
	}
	if (isNumeric(document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value, 0) == 0)
	{
			alert('Le champ année de naissance n\'est pas un numérique !');
			document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.focus();
			return;
	}
	if ((document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value <= 1800) || (document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.value >= 2100))
	{
			alert('Le champ année de naissance n\'est pas valide !');
			document.NETMINEFORM2.CUSTOMER_BIRTHYEAR.focus();
			return;
	}
	if (isEmail(document.NETMINEFORM2.CUSTOMER_EMAIL.value, 0) == 0)
	{
			alert('Le champ email n\'est pas un email valide !');
			document.NETMINEFORM2.CUSTOMER_EMAIL.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.CCUSTOMER_PASSWORD.value, 5, 255, 0) == 0)
	{
			alert('Le champ mot de passe n\'est pas valide');
			document.NETMINEFORM2.CCUSTOMER_PASSWORD.focus();
			return;
	}
	if (document.NETMINEFORM2.CCUSTOMER_PASSWORD.value != document.NETMINEFORM2.CCUSTOMER_PASSWORD2.value)
	{
			alert('Les mots de passe ne correspondent pas !');
			document.NETMINEFORM2.CCUSTOMER_PASSWORD.focus();
			return;
	}
	document.NETMINEFORM2.submit();
}


//
// ValidateParainnage
//
function ValidateParrainage()
{
	if (isString(document.NETMINEFORM2.NAME.value, 2, 255, 0) == 0)
	{
			alert('Le champ nom  n\'est pas un texte valide !');
			document.NETMINEFORM2.NAME.focus();
			return;
	}
	if (isString(document.NETMINEFORM2.FIRSTNAME.value, 0, 255, 0) == 0)
	{
			alert('Le champ prénom n\'est pas un texte valide !');
			document.NETMINEFORM2.FIRSTNAME.focus();
			return;
	}
	if (isEmail(document.NETMINEFORM2.EMAIL.value, 0) == 0)
	{
			alert('Le champ email n\'est pas un email valide !');
			document.NETMINEFORM2.EMAIL.focus();
			return;
	}
	document.NETMINEFORM2.TEXTPERSO.value +="----------------------\nwww.luckyvillage.com\nGagnez 1 million de francs chaque jour, gratuitement !";
	document.NETMINEFORM2.submit();
}
