// JavaScript Document

function goMail(f, num){
	//f.mode.value=num;
	f.submit();	
}

function checkMail(E) {
	var aroB;
	var le_pt;
	var oke; 
	aroB = E.indexOf("@");
	oke = ((aroB != -1) && 
			   (aroB != 0) &&
			   (aroB != (E.length - 1)) &&
			   (E.indexOf("@", aroB + 1) == -1)
			  );
	if (oke) {
		le_pt = E.indexOf(".");
		//oke = ((le_pt != -1) && (le_pt != (E.length - 1)) && (le_pt > aroB));
         oke = ((le_pt != -1) && (le_pt != (E.length - 1)));
	}
	
	return oke;
}


function champsok(f) {

var mode = f.mode.value;
	
	if (f.mode.value==7){
	if (f.datelieu.value.length == 0)
	{
		alert("Place and date ?");
		return false;
	}
	}

	if (f.civilite[0].checked == false && f.civilite[1].checked == false && f.civilite[2].checked == false)
	{
		alert("Mrs Miss Mr ?");
		return false;
	}
	if (f.nom.value.length == 0)
	{
		alert("Last name ?");
		return false;
	}
	if (f.prenom.value.length == 0)
	{
		alert("First name ?");
		return false;
	}
	if(!(checkMail(f.email.value)))
	{
		alert("Invalid Email ?");
		return false;
	}
	if (f.adresse.value.length == 0)
	{
		alert("Address ?");
		return false;
	}
	if (f.cp.value.length == 0)
	{
		alert("Zip code ?");
		return false;
	}
	if (f.ville.value.length == 0)
	{
		alert("City ?");
		return false;
	}
	if (f.pays.value.length == 0)
	{
		alert("Country ?");
		return false;
	}
	
	if (f.situation.value.length == 0)
	{
		alert("Occupation ?");
		return false;
	}
	
		if (f.situation.value=="Student" || f.situation.value =="Other" ||  f.situation.value =="shareholder" )
		{
		}
		else
		{
			if (f.mode.value==20){
			
				if (f.txtCompany.value.length==0)
				{
					
					alert("Company?");
					return false;
				}
				if (f.txtPost.value.length==0)
				{
					
					alert("Post?");
					return false;
				}
			}
		}
	if (f.mode.value==20){
	if (f.langue1.value.length == 0)
	{
		alert("Language?");
		return false;
	}
	}
	
	if (f.mode.value==30){
	if (f.avis.value.length == 0)
	{
		alert("Merci de préciser votre avis");
		return false;
	}
	}
	
	f.action="/site/us/contact/loreal-formulaire-fr-confirm.asp"; 
	f.submit();
	
}

function champsokmobile(f) {

var mode = f.mode.value;


	if (f.civilite[0].checked == false && f.civilite[1].checked == false && f.civilite[2].checked == false)
	{
		alert("Mrs Miss Mr ?");
		return false;
	}
	if (f.nom.value.length == 0)
	{
		alert("Last name ?");
		return false;
	}
	if (f.prenom.value.length == 0)
	{
		alert("First name ?");
		return false;
	}
	if(!(checkMail(f.email.value)))
	{
		alert("Invalid Email ?");
		return false;
	}
	if (f.adresse.value.length == 0)
	{
		alert("Address ?");
		return false;
	}
	if (f.cp.value.length == 0)
	{
		alert("Zip code ?");
		return false;
	}
	if (f.ville.value.length == 0)
	{
		alert("City ?");
		return false;
	}
	if (f.pays.value.length == 0)
	{
		alert("Country ?");
		return false;
	}
	
	
	
	f.action="/site/us/contact/loreal-formulaire-fr-confirm.asp"; 
	f.submit();
	
}

function validmobile(f) {

var mode = f.mode.value;
	
	if (f.indicatif.value.length == 0)
	{
		alert("Country code ?");
		return false;
	}

	if (f.recipient.value.length == 0)
	{
		alert("Your phone number ?");
		return false;
	}
	
	f.submit();
	
}