//JS Document



function validateEmail($email) 

{

   var reg = /^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$/;

   return (reg.test($email));

}

// Suppression des intitulés des cases au clic (focus)

function FocusTexth(BoxName) {

	if (BoxName.value == BoxName.defaultValue)

	{

		BoxName.value = '';

	}

}

function BlurTexth(BoxName) {

	if (BoxName.value == '')

	{

		BoxName.value = BoxName.defaultValue;

	}

}

//=============================================================================================

function required(champ,error)

 {

 	if($("#"+champ).val().length == 0)

		{

			$("#"+error).html("Champs obligatoire");

			return false;

		}

	$("#"+error).html("");

	return true;

 }

 function requireddate(champ,error)

 {

 	if($("#"+champ).val() == 0)

		{

			$("#"+error).html("Champs obligatoire");

			return false;

		}

	$("#"+error).html("");

	return true;

 }

 //=============================================================================================

 function unSetMsg(msgError){

 	$("#"+msgError).html("");

 }

 //=============================================================================================

function verif_form()

{
	a1 = required('nom','prenomError');

	a2= required('email','emailError');

	$nomform = $("#nomform").val();

	if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

	

  else

	

	$("#"+$nomform).submit();

	

}
function verif_form_certif()

{
	certf = $("#certif").is(':checked');
	
	a1 = required('nom','prenomError');

	a2= required('email','emailError');

	$nomform = $("#nomform").val();

	if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

	else if(!$("#certif").is(':checked'))

		alert("Pour réussir votre inscription, il faut cocher la case en bas. Merci");

		

  else

	

	$("#"+$nomform).submit();

	

}

function verif_formaccesastro1()

{

	

	a1 = required('nom','prenomError');

	a2= required('email','emailError');

	

	$nomform = $("#nomform").val();

	if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

		

	

	

  else

	

	$("#"+$nomform).submit();

	

}

function verif_formaccesastro()

{

	

	a1 = required('nom','prenomError');

	a2= required('email','emailError');

	

	$nomform = $("#nomform").val();

	if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

	

  else

	

	$("#"+$nomform).submit();

	

}

function verif_formcathyy()

{

	

	a1 = required('nom','prenomError');

	a2= required('email','emailError');

	

	$nomform = $("#nomform").val();

	if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

	

  else

	

	$("#"+$nomform).submit();

	

}

function form_divinologue()

{

	

	//a1 = required('nomhaut','prenomhautError');

	//a2= required('emailhaut','emailhautError');

	$nomform = $("#nomform").val();

	if($("#email").val()=='Votre e-mail')

	{

	//$("#emailhautError").html("Champs obligatoire");

	alert("Veuillez entrer votre e-mail");

	$("#email").select();

	}

	

	else if(!validateEmail($("#email").val()))

	{

	//$("#emailhautError").html("Votre email ne semble pas valide");

	alert("Votre email ne semble pas valide");

	$("#email").select();

	}

		

	

	else if($("#nom").val()=='Votre prénom')

	{

	//$("#prenomhautError").html("Champs obligatoire");

	alert("Veuillez entrer votre prénom");

	$("#nom").select();

	}

	else if($("#code").val()=='')

	{

		alert("Veuillez entrer le code sécurisé");

		$("#code").select();

	}

  else

	

	$("#"+$nomform).submit();

	

}

function formhorosc_fmhaut()

{

	

	//a1 = required('nomhaut','prenomhautError');

	//a2= required('emailhaut','emailhautError');

	

	if($("#emailhaut").val()=='')

	{

	//$("#emailhautError").html("Champs obligatoire");

	alert("Veuillez entrer votre e-mail");

	$("#emailhaut").select();

	}

	

	else if(!validateEmail($("#emailhaut").val()))

	{

	//$("#emailhautError").html("Votre email ne semble pas valide");

	alert("Votre email ne semble pas valide");

	$("#emailhaut").select();

	}

		

	

	else if($("#nomhaut").val()=='')

	{

	//$("#prenomhautError").html("Champs obligatoire");

	alert("Veuillez entrer votre prénom");

	$("#nomhaut").select();

	}

  else

	

	$("#formhoroscfmh").submit();

	

}

function formhorosuppf()

{

	

	//a1 = required('nomhaut','prenomhautError');

	//a2= required('emailhaut','emailhautError');

	

	if($("#emailhaut").val()=='')

	{

	//$("#emailhautError").html("Champs obligatoire");

	alert("Veuillez entrer votre e-mail");

	$("#emailhaut").select();

	}

	

	else if(!validateEmail($("#emailhaut").val()))

	{

	//$("#emailhautError").html("Votre email ne semble pas valide");

	alert("Votre email ne semble pas valide");

	$("#emailhaut").select();

	}

		

	

	else if($("#nomhaut").val()=='')

	{

	//$("#prenomhautError").html("Champs obligatoire");

	alert("Veuillez entrer votre prénom");

	$("#nomhaut").select();

	}

  else

	

	$("#formhomehorofm").submit();

	

}

function verif_formvoygrat()

{

	

	a1 = required('nomfamille','nomfError');

	a2= required('email','emailError');

	a3= required('nom','prenomError');

	a4= required('adresse2','adresse2Error');

	a5= required('codePostal','codePostalError');

	a6= required('ville','villeError');

	a7= required('pays','paysError');

	a8= required('telfixe','telfixeError');

	a9= required('telmob','telmobError');

	a155= requireddate('day','dateError');

	a156= requireddate('month','dateError');

	a157= requireddate('year','dateError');

	

	$nomform = $("#nomform").val();

	if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	

	else if($("#nomfamille").val()=='')

	

		$("#nomfError").html("Champs obligatoire");

		

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

		

	else if($("#adresse2").val()=='')



	$("#adresse2Error").html("Champs obligatoire");

	

	else if($("#codePostal").val()=='')



	$("#codePostalError").html("Champs obligatoire");

	

	else if($("#ville").val()=='')



	$("#villeError").html("Champs obligatoire");

	

	else if($("#pays").val()=='')



	$("#paysError").html("Champs obligatoire");

	

	else if($("#telfixe").val()=='')



	$("#telfixeError").html("Champs obligatoire");

	

	else if($("#telmob").val()=='')



	$("#telmobError").html("Champs obligatoire");

	else if($("#day").val()==0)



	$("#dateError").html("Selectionnez le jour de votre date de naissance");

	else if($("#month").val()==0)



	$("#dateError").html("Selectionnez le mois de votre date de naissance");

	else if($("#year").val()==0)



	$("#dateError").html("Selectionnez l\'ann&eacute;e de votre date de naissance");

	

  else

	

	$("#"+$nomform).submit();

	

}

function recuperepassword()

{

$('#passworddiv').show();

}

function verif_formrecette()

{

	

	a1 = required('nomfamille','nomfError');

	a2= required('email','emailError');

	a13= required('titre','titreError');

	a3= required('nom','prenomError');

	a4= required('adresse1','adresse1Error');

	a5= required('codePostal','codePostalError');

	a6= required('ville','villeError');

	a7= required('pays','paysError');

	a10= required('pseudo','pseudoError');

	a11= required('password','passwordError');

	a12= required('confemail','confemailError');

	a155= requireddate('day','dateError');

	a156= requireddate('month','dateError');

	a157= requireddate('year','dateError');

	

	$nomform = $("#nomform").val();

	if($("#pseudo").val()=='')

	$("#pseudoError").html("Champs obligatoire");

	else if($("#pseudo").val().length < 4)

	$("#pseudoError").html("au moins 4 caractères(lettres/chiffres)");

	else if($("#password").val()=='')

	$("#passwordError").html("Champs obligatoire");

	else if($("#password").val().length < 6)

	$("#passwordError").html("au moins 6 caractères(lettres/chiffres)");

	else if($("#email").val()=='')

	$("#emailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#email").val()))

	

		$("#emailError").html("Votre email ne semble pas valide");

	else if($("#confemail").val()=='')

	$("#confemailError").html("Champs obligatoire");

	

	else if(!validateEmail($("#confemail").val()))

	

		$("#confemailError").html("Votre email de confirmation ne semble pas valide");	

		

	else if($("#confemail").val() != $("#email").val())

	

		$("#confemailError").html("Veuillez confirmer votre adresse email");

		

	else if($("#titre").val()=='')

	

		$("#titreError").html("Champs obligatoire");

	

	else if($("#nomfamille").val()=='')

	

		$("#nomfError").html("Champs obligatoire");

		

	else if($("#nom").val()=='')

	

		$("#prenomError").html("Champs obligatoire");

		

	else if($("#adresse1").val()=='')



	$("#adresse1Error").html("Champs obligatoire");

	

	else if($("#codePostal").val()=='')



	$("#codePostalError").html("Champs obligatoire");

	

	else if($("#ville").val()=='')



	$("#villeError").html("Champs obligatoire");

	else if($("#pays").val()=='')



	$("#paysError").html("Champs obligatoire");

	else if($("#day").val()==0)



	$("#dateError").html("Selectionnez le jour de votre date de naissance");

	else if($("#month").val()==0)



	$("#dateError").html("Selectionnez le mois de votre date de naissance");

	else if($("#year").val()==0)



	$("#dateError").html("Selectionnez l\'ann&eacute;e de votre date de naissance");

	

	

	

  else

	

	$("#"+$nomform).submit();

	

}
