// JavaScript Document

/* VERIFICATION FORMULAIRES*/

var emailFilter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/ ;
var telephoneFilter  = /([0-9])/ ;
var dateFilter  = /^([0-9]{2})+\/([0-9]{2})\/([0-9]{4})+$/ ;
var dateJJMMFilter  = /^([0-9]{2})+$/ ;
var dateAAAAFilter  = /^([0-9]{4})+$/ ;
var poidsFilter  = /^([0-9]{2,3})+$/ ;
var societeFilter = /^([a-zA-Z0-9_\.\-\ ])+$/ ;
var PseudoFilter = /^([A-Za-z0-9_]{4,20})+$/ ;
var MotPasseFilter = /^([A-Za-z0-9]{4,})+$/ ;
var VerifMotPasseFilter = ($_POST["TB_Mot_de_Passe"] != $_POST["TB_Confirmation_Mot_de_Passe"]);

						/*l'email doit contenir une arobase et un point*/
						/*avant l'@ il peut y avoir des lettres quelconques (en minuscule ou majuscule), n'importe quel chiffre, 
						  et les caractères "-" ou "_"*/
						/*aprés l'@, idem, mais on interdit la présence de "_", et il faut impérativement au moins 2 caractères 
						  entre l'@ et le point*/
						/*aprés le point, faut impérativement au moins 2 ou 4 caractères */
function checkFormContact(c) 
{
		
	if(c.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		c.nom.focus() ;
		return false ;
		};
		
	if(c.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		c.nom.focus() ;
		return false ;
		};
		
	if(c.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		c.prenom.focus() ;
		return false ;
		};
		
	if(c.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		c.prenom.focus() ;
		return false ;
		};

	if(c.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		c.mail.focus() ;
		return false ;
		};
		
	if(c.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		c.mail.focus() ;
		return false ;
		};

	if(c.mail.value.length>0 && !emailFilter.test(c.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		c.mail.focus() ;
		return false ;
		};

	if(c.lesremarquescontact.value.length==0) 
		{
		alert('Le champs « Votre Message » est obligatoire') ;
		c.lesremarquescontact.focus() ;
		return false ;
		};
		
};

function checklogin(d) {
	
	if (d.TB_Nom_Utilisateur.value.length==0 || d.TB_Nom_Utilisateur.value=='Pseudo'){
		alert("Le champs 'PSEUDO' est obligatoire");
		d.TB_Nom_Utilisateur.focus();
		return false;
	}

	if (d.TB_Mot_de_Passe.value.length==0 || d.TB_Mot_de_Passe.value=='motpasse')	{
		alert("Le champs 'Mot de passe' est obligatoire");
		d.TB_Mot_de_Passe.focus();
		return false;
	}
		return true;
}

function checkForm(f) /*Vérifie le Formulaire RESERVATIONS dans RP */
{

	if(f.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		f.nom.focus() ;
		return false ;
		};
		
	if(f.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		f.nom.focus() ;
		return false ;
		};
		
	if(f.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		f.prenom.focus() ;
		return false ;
		};
		
	if(f.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		f.prenom.focus() ;
		return false ;
		};

	if(f.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		f.mail.focus() ;
		return false ;
		};
		
	if(f.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		f.mail.focus() ;
		return false ;
		};

	if(f.mail.value.length>0 && !emailFilter.test(f.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		f.mail.focus() ;
		return false ;
		};
};

function checkFormAccr(g) /*Vérifie le Formulaire ACCREDITATIONS dans Presse */
{

	if(g.medianame.value.length==0) 
		{
		alert('Le champs « Nom du Média » est obligatoire') ;
		g.medianame.focus() ;
		return false ;
		};
		
	if(g.medianame.value=="Nom du Média") 
		{
		alert('Le champs « Nom du Média » est obligatoire') ;
		g.medianame.focus() ;
		return false ;
		};
	
	if(g.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		g.nom.focus() ;
		return false ;
		};
		
	if(g.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		g.nom.focus() ;
		return false ;
		};
		
	if(g.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		g.prenom.focus() ;
		return false ;
		};
		
	if(g.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		g.prenom.focus() ;
		return false ;
		};

	if(g.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		g.mail.focus() ;
		return false ;
		};
		
	if(g.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		g.mail.focus() ;
		return false ;
		};

	if(g.mail.value.length>0 && !emailFilter.test(g.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		g.mail.focus() ;
		return false ;
		};
};

function checkFormBourse(j) /*Vérifie le Formulaire BOURSE AUX EQUIPIERS */
{
	
	
	if(j.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		j.nom.focus() ;
		return false ;
		};
		
	if(j.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		j.nom.focus() ;
		return false ;
		};
		
	if(j.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		j.prenom.focus() ;
		return false ;
		};
		
	if(j.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		j.prenom.focus() ;
		return false ;
		};

	if(j.lanaissjj.value.length==0) 
		{
		alert('Le champs « jj » est obligatoire') ;
		j.lanaissjj.focus() ;
		return false ;
		};
		
	if(j.lanaissjj.value=="jj") 
		{
		alert('Le champs « jj » est obligatoire') ;
		j.lanaissjj.focus() ;
		return false ;
		};
		
	if(j.lanaissjj.value.length>0 && !telephoneFilter.test(j.lanaissjj.value)) 
		{
		alert('Le champs « jj » est incorect') ;
		j.lanaissjj.focus() ;
		return false ;
		};
	
	if(j.lanaissmm.value.length==0) 
		{
		alert('Le champs « mm » est obligatoire') ;
		j.lanaissmm.focus() ;
		return false ;
		};
		
	if(j.lanaissmm.value=="mm") 
		{
		alert('Le champs « mm » est obligatoire') ;
		j.lanaissmm.focus() ;
		return false ;
		};

	if(j.lanaissmm.value.length>0 && !telephoneFilter.test(j.lanaissmm.value)) 
		{
		alert('Le champs « mm » est incorect') ;
		j.lanaissmm.focus() ;
		return false ;
		};

	if(j.lanaissaaaa.value.length==0) 
		{
		alert('Le champs « aaaa » est obligatoire') ;
		j.lanaissaaaa.focus() ;
		return false ;
		};
		
	if(j.lanaissaaaa.value=="aaaa") 
		{
		alert('Le champs « aaaa » est obligatoire') ;
		j.lanaissaaaa.focus() ;
		return false ;
		};
	
	if(j.lanaissaaaa.value.length>0 && !telephoneFilter.test(j.lanaissaaaa.value)) 
		{
		alert('Le champs « aaaa » est incorect') ;
		j.lanaissaaaa.focus() ;
		return false ;
		};
	
	if(j.poids.value.length==0) 
		{
		alert('Le champs « Poids » est obligatoire') ;
		j.poids.focus() ;
		return false ;
		};
		
	if(j.poids.value=="Poids") 
		{
		alert('Le champs « Poids » est obligatoire') ;
		j.poids.focus() ;
		return false ;
		};

	if(j.poids.value.length>0 && !telephoneFilter.test(j.poids.value)) 
		{
		alert('Le champs « Poids » est incorect, seuls les chiffres sont acceptés') ;
		j.poids.focus() ;
		return false ;
		};

	if(j.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		j.mail.focus() ;
		return false ;
		};
		
	if(j.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		j.mail.focus() ;
		return false ;
		};

	if(j.mail.value.length>0 && !emailFilter.test(j.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		j.mail.focus() ;
		return false ;
		};
		
	if(j.posteabord.value.length==0) 
		{
		alert('Le champs « Poste à bord » est obligatoire') ;
		j.posteabord.focus() ;
		return false ;
		};
		
	if(j.posteabord.value=="Poste à bord") 
		{
		alert('Le champs « Poste à bord » est obligatoire') ;
		j.posteabord.focus() ;
		return false ;
		};	

};


function checkFormMailing(m) 
{
		
	if(m.nom.value.length==0) 
		{
		alert('Le champs « Nom » est obligatoire') ;
		m.nom.focus() ;
		return false ;
		};
		
	if(m.nom.value=="Nom") 
		{
		alert('Le champs « Nom » est obligatoire') ;
		m.nom.focus() ;
		return false ;
		};
		
	if(m.prenom.value.length==0) 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		m.prenom.focus() ;
		return false ;
		};
		
	if(m.prenom.value=="Prénom") 
		{
		alert('Le champs « Prénom » est obligatoire') ;
		m.prenom.focus() ;
		return false ;
		};

	if(m.mail.value.length==0) 
		{
		alert('Le champs « Mail » est obligatoire') ;
		m.mail.focus() ;
		return false ;
		};
		
	if(m.mail.value=="Mail") 
		{
		alert('Le champs « Mail » est obligatoire') ;
		m.mail.focus() ;
		return false ;
		};

	if(m.mail.value.length>0 && !emailFilter.test(m.mail.value)) 
		{
		alert('Le champs « Mail » est incorect') ;
		m.mail.focus() ;
		return false ;
		};

};
