/* fonctions de bases - verif email */
function isValidEmail(isItValid) { 
	var validFormatRegExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})/i; 
	return validFormatRegExp.test(isItValid); 
	}

/* formulaire Se Loguer */
function ValidateFormSeloguer(seloguer) 
{
	if (document.seloguer.username.value=="")
	{
		alert ("Votre Identifiant est vide !");
		document.seloguer.username.focus();
	}
	else if (document.seloguer.mdp.value=="")
	{
		alert ("Le Mot de passe est vide !");
		document.seloguer.mdp.focus();
	}
	else {document.seloguer.submit();}
}

/* formulaire Contact */
function ValidateFormContact(formcontact) 
{
	if (document.formcontact.nom.value=="")
	{
		alert ("Votre nom est vide !");
		document.formcontact.nom.focus();
	}
	else if (document.formcontact.societe.value=="")
	{
		alert ("Votre nom de societe est vide !");
		document.formcontact.societe.focus();
	}
	else if (document.formcontact.mail.value=="")
	{
		alert ("Le Mail est vide !");
		document.formcontact.mail.focus();
	}
	else if (!isValidEmail(document.formcontact.mail.value))
	{
		alert ("Le Mail n'est valide !");
		document.formcontact.mail.focus();
	}
	else if (document.formcontact.message.value=="")
	{
		alert ("Le Message est vide !");
		document.formcontact.message.focus();
	}
	else {document.formcontact.submit();}
}

/* formulaire Adhesion */
function ValidateFormAdhesion(formadhesion) 
{
	if (document.formadhesion.nom.value=="")
	{
		alert ("Votre nom est vide !");
		document.formadhesion.nom.focus();
	}
	else if (document.formadhesion.societe.value=="")
	{
		alert ("Indiquez votre societe !");
		document.formadhesion.societe.focus();
	}
	else if (document.formadhesion.fonction.value=="")
	{
		alert ("Indiquez votre fonction !");
		document.formadhesion.fonction.focus();
	}
	else if (document.formadhesion.adresse.value=="")
	{
		alert ("Indiquez votre adresse !");
		document.formadhesion.adresse.focus();
	}
	else if (document.formadhesion.cp.value=="")
	{
		alert ("Indiquez votre code postal !");
		document.formadhesion.cp.focus();
	}
	else if (document.formadhesion.ville.value=="")
	{
		alert ("Indiquez votre ville !");
		document.formadhesion.ville.focus();
	}
	else if (document.formadhesion.pays.value=="")
	{
		alert ("Indiquez votre pays !");
		document.formadhesion.pays.focus();
	}
	else if (document.formadhesion.tel.value=="")
	{
		alert ("Indiquez votre telephone !");
		document.formadhesion.tel.focus();
	}
	else if (document.formadhesion.mail.value=="")
	{
		alert ("Le Mail est vide !");
		document.formadhesion.mail.focus();
	}
	else if (!isValidEmail(document.formadhesion.mail.value))
	{
		alert ("Le Mail n'est valide !");
		document.formadhesion.mail.focus();
	}
	else if (document.formadhesion.descriptif.value=="")
	{
		alert ("Indiquez le descriptif de votre societe !");
		document.formadhesion.descriptif.focus();
	}
	else if (document.formadhesion.salarie.value=="")
	{
		alert ("Indiquez le nombre de salaries !");
		document.formadhesion.salarie.focus();
	}
	else if (document.formadhesion.ca.value=="")
	{
		alert ("Indiquez le chiffre d'affaire !");
		document.formadhesion.ca.focus();
	}
	else {document.formadhesion.submit();}
}

/* formulaire Depot Annonce */
function ValidateFormAnnonce(formdepotannonce) 
{
	if (document.formdepotannonce.nom.value=="")
	{
		alert ("Votre nom est vide !");
		document.formdepotannonce.nom.focus();
	}
	else if (document.formdepotannonce.prenom.value=="")
	{
		alert ("Indiquez votre prenom !");
		document.formdepotannonce.prenom.focus();
	}
	else if (document.formdepotannonce.mail.value=="")
	{
		alert ("Le Mail est vide !");
		document.formdepotannonce.mail.focus();
	}
	else if (!isValidEmail(document.formdepotannonce.mail.value))
	{
		alert ("Le Mail n'est valide !");
		document.formdepotannonce.mail.focus();
	}
	else if (document.formdepotannonce.libelle.value=="")
	{
		alert ("Indiquez le libelle de votre Annonce !");
		document.formdepotannonce.libelle.focus();
	}
		else {document.formdepotannonce.submit();}
}

/* formulaire Nouveau topic */
function ValidateFormTopic(formtopic) 
{
	if (document.formtopic.titre.value=="")
	{
		alert ("Indiquez le titre de votre topic !");
		document.formtopic.titre.focus();
	}
	else {document.formtopic.submit();}
}

/* formulaire Repondre Sujet */
function ValidateFormReponse(formrep) 
{
	document.formrep.submit();
}

/* formulaire Ajouter Invite */
function ValidateFormInvite(forminscriptioninvite) 
{
	if (document.forminscriptioninvite.prenom.value=="")
	{
		alert ("Le prenom de votre invite est vide !");
		document.forminscriptioninvite.prenom.focus();
	}
	else if (document.forminscriptioninvite.nom.value=="")
	{
		alert ("Le nom de votre invite est vide !");
		document.forminscriptioninvite.nom.focus();
	}
	else {document.forminscriptioninvite.submit();}
}

/* formulaire Modifier Profil */
function ValidateFormProfil(formprofil) 
{
	if (document.formprofil.nom.value=="")
	{
		alert ("Indiquez votre nom !");
		document.formprofil.nom.focus();
	}
	else if (document.formprofil.prenom.value=="")
	{
		alert ("Indiquez votre prenom !");
		document.formprofil.prenom.focus();
	}
	else if (document.formprofil.societe.value=="")
	{
		alert ("Indiquez votre nom de societe !");
		document.formprofil.societe.focus();
	}
	else if (document.formprofil.activite.value=="")
	{
		alert ("Indiquez votre activite !");
		document.formprofil.activite.focus();
	}
	else if (document.formprofil.fonction.value=="")
	{
		alert ("Indiquez votre fonction !");
		document.formprofil.fonction.focus();
	}
	else if (document.formprofil.adresse.value=="")
	{
		alert ("Indiquez votre adresse !");
		document.formprofil.adresse.focus();
	}
	else if (document.formprofil.cp.value=="")
	{
		alert ("Indiquez votre code postal !");
		document.formprofil.cp.focus();
	}
	else if (document.formprofil.ville.value=="")
	{
		alert ("Indiquez votre ville !");
		document.formprofil.ville.focus();
	}
	else if (document.formprofil.tel.value=="")
	{
		alert ("Indiquez votre telephone !");
		document.formprofil.tel.focus();
	}
	else if (document.formprofil.email.value=="")
	{
		alert ("Indiquez votre email !");
		document.formprofil.email.focus();
	}
	else if (!isValidEmail(document.formprofil.email.value))
	{
		alert ("Le Mail n'est valide !");
		document.formprofil.email.focus();
	}
	else {document.formprofil.submit();}
}


/* formulaire Isncription non Membre */
function ValidateFormInscription(forminscription) 
{
	if (document.forminscription.nom.value=="")
	{
		alert ("Indiquez votre nom !");
		document.forminscription.nom.focus();
	}
	else if (document.forminscription.prenom.value=="")
	{
		alert ("Indiquez votre prenom !");
		document.forminscription.prenom.focus();
	}
	else if (document.forminscription.societe.value=="")
	{
		alert ("Indiquez votre nom de societe !");
		document.forminscription.societe.focus();
	}
	else if (document.forminscription.fonction.value=="")
	{
		alert ("Indiquez votre fonction !");
		document.forminscription.fonction.focus();
	}
	else if (document.forminscription.adresse.value=="")
	{
		alert ("Indiquez votre adresse !");
		document.forminscription.adresse.focus();
	}
	else if (document.forminscription.cp.value=="")
	{
		alert ("Indiquez votre code postal !");
		document.forminscription.cp.focus();
	}
	else if (document.forminscription.ville.value=="")
	{
		alert ("Indiquez votre ville !");
		document.forminscription.ville.focus();
	}
	else if (document.forminscription.tel.value=="")
	{
		alert ("Indiquez votre telephone !");
		document.forminscription.tel.focus();
	}
	else if (document.forminscription.email.value=="")
	{
		alert ("Indiquez votre email !");
		document.forminscription.email.focus();
	}
	else if (!isValidEmail(document.forminscription.email.value))
	{
		alert ("Le Mail n'est valide !");
		document.forminscription.email.focus();
	}
	else {document.forminscription.submit();}
}

/* formulaire Facturation Invite */
function ValidateFormFaturationInvite(FormfactureInvite) 
{
	if (document.FormfactureInvite.societe.value=="")
	{
		alert ("Votre nom de societe est vide !");
		document.FormfactureInvite.societe.focus();
	}
	else if (document.FormfactureInvite.adresse.value=="")
	{
		alert ("Votre adresse est vide !");
		document.FormfactureInvite.adresse.focus();
	}
	else if (document.FormfactureInvite.cp.value=="")
	{
		alert ("Votre code postal est vide !");
		document.FormfactureInvite.cp.focus();
	}
	else if (document.FormfactureInvite.ville.value=="")
	{
		alert ("Votre ville est vide !");
		document.FormfactureInvite.ville.focus();
	}
	else {document.FormfactureInvite.submit();}
}

/* formulaire MdP oublie */
function ValidateFormOublieMdp(mdpoublie) 
{
	if (document.mdpoublie.identifiant.value=="")
	{
		alert ("Indiquez votre identifiant !");
		document.mdpoublie.identifiant.focus();
	}
	else if (document.mdpoublie.email.value=="")
	{
		alert ("Indiquez votre email !");
		document.mdpoublie.email.focus();
	}
	else if (!isValidEmail(document.mdpoublie.email.value))
	{
		alert ("Le Mail n'est valide !");
		document.mdpoublie.email.focus();
	}
	else {document.mdpoublie.submit();}
}


