// fonctions de vérification de la saisie d'un formulaire



function IsEmail(txt_email) {
	//var verif = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/
	var verif = /^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,4}$/;
	if (verif.exec(txt_email))
		return true;
}

function IsTel(txt_tel) {
	//var verif = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/
	var verif = /^\+?([0-9 ])+$/;
	if (verif.exec(txt_tel))
		return true;
}

function IsNotEmpty(champ) {
	//var verif = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9-]{2,}[.][a-zA-Z]{2,3}$/
	if (document.getElementById(champ).value.length>0)
		return true;
}


function valideMail()
{
	champ_mail = document.getElementById('email');
	texte = document.getElementById('mailobligatoire');
	//alert(champ_mail.value);
	if (IsEmail(champ_mail.value)) 
	{
		champ_mail.style.border="2px solid #00ff00";
		texte.style.color="#00ff00";
		texte.innerHTML="OK";
	}
	else
	{
		champ_mail.style.border="2px solid #ff0000";
		texte.style.color="#ff0000";
		texte.innerHTML="champ obligatoire";
	}
}


function valideTel()
{
	champ_tel = document.getElementById('telephone');
	texte = document.getElementById('telobligatoire');
	//alert(champ_mail.value);
	if (IsTel(champ_tel.value)) 
	{
		champ_tel.style.border="2px solid #00ff00";
		texte.style.color="#00ff00";
		texte.innerHTML="OK";
	}
	else
	{
		champ_tel.style.border="2px solid #ff0000";
		texte.style.color="#ff0000";
		texte.innerHTML="&nbsp;&nbsp;&nbsp;champ obligatoire";
	}
}

function verifMail()
{
	txt_mail = document.getElementById('email').value;
	if (!txt_mail) 
	{
		alert("Vous devez saisir votre e-mail");
		return(false);
	}
	if (!IsEmail(txt_mail)) 
	{
		alert("E-mail non valide");
		return(false);
	}
	return(true);
}

function verifTel()
{
	txt_tel = document.getElementById('telephone').value;
	if (!txt_tel) 
	{
		alert("Vous devez saisir votre num\351ro de t\351l\351phone");
		return(false);
	}
	if (!IsTel(txt_tel)) 
	{
		alert("T\351l\351phone non valide");
		return(false);
	}
	return(true);
}



