/****************************************/
function verifContact()
{
	/*Valider=true;

	if (formContact.email.value!="")
	{
		Valider=verifMail(formAvis.email,"Votre adresse e-mail n\'est pas correcte!",Valider);	
	}
	if (Valider==true)
	{
		Valider=verifChampText(document.formAvis.pseudo, "Veuillez préciser votre pseudo.");
	}
	if (Valider==true)
	{
		Valider=verifChampText(document.formAvis.message, "Veuillez préciser votre message.");
	}
	return Valider;	*/

}
/****************************************/

/* CONTACT */
/****************************************/
function afficheSouhaitContact(val)
{
	document.getElementById("chambre").style.display='none';
	document.getElementById("restaurant").style.display='none';
	document.getElementById("cours").style.display='none';
	if (val=="restaurant"||val=="chambre"||val=="cours")
	{
		document.getElementById(val).style.display='';
	}
}

function afficheNatureContact(val)
{
	if (val=="professionnel")
	{
		document.getElementById(val).style.display='';
	}
	else
	{
		document.getElementById("professionnel").style.display='none';
	}
}

function verifFormContact()
{

	validerOK=true;

	if (validerOK==true&&document.formContact.nature=="professionnel")
	{
		validerOK=verifChampText(document.formContact.societe, "Veuillez préciser votre société.\nPlease specify the name of your company.");
	}
	if (validerOK==true)
	{
		validerOK=verifChampText(document.formContact.nom, "Veuillez préciser votre nom.\nPlease specify your name.");
	}
	if (validerOK==true)
	{
		validerOK=verifMail(formContact.email,"Votre adresse e-mail n\'est pas correcte !\nYour e-mail address is not correct.",validerOK);	
	}
	if (validerOK==true&&formContact.souhait.value=='')
	{
		alert("Sélectionnez la raison de la prise de contact.\nPlease select the reason why you are contacting us.");
		validerOK=false;
		formContact.souhait.focus();
	}
	//souhait
	return validerOK;
}
/****************************************/


/****************************************/
function verifMail(champ,message,Valider)
{
PasEncoreErreur=Valider;

	if (PasEncoreErreur) 
		{
		mail = champ.value;
		listemail=new Array;
		
		if(mail=="" || mail=="null" || mail.indexOf('@')==-1 || mail.indexOf(' ')>=0 )
			{
			alert(message);
			champ.select ();
			champ.focus ();
			PasEncoreErreur = false;
			}
		else
			{
			listemail=mail.split('@');

			if( (listemail[1].indexOf('.') <2) || (listemail[1].length<=listemail[1].indexOf('.')+2 ) || (listemail[0].length<1))
				{
				alert(message);
				champ.select ();
				champ.focus ();
				PasEncoreErreur = false;
				}
			} 		
		}
		// if ( (!(/^[0-9A-Za-z.@\-_]+$/.test(champ.value))) && (PasEncoreErreur) )
		if ( (!(/^[a-zA-Z0-9_\.\-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]+$/.test(champ.value))) && (PasEncoreErreur) )
			{alert('Votre adresse est incorrecte, elle comprend des caractères spéciaux.\nYou e-mail address is not correct.');
			PasEncoreErreur = false;}
return PasEncoreErreur;
}
/****************************************/


/****************************************/
function verifChampText(champ, message)
{
	retour=true;
	if (champ.value=="")
	{
		alert(message);
		champ.focus();
		retour=false;
	}
	return retour;
}
/****************************************/
