// JavaScript Document

function verifmail(mail)
{
    var regex = /^[a-zA-Z0-9\._-]+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
        if (!regex.test(mail)) 
            return false;
        else
            return true;   
}

function envoie(theform){
	var phrase=""
	if (theform=='contact'){
		if (document.contact.nom.value=="") {phrase=phrase+"Veuillez fournir votre nom\n";}
		if (document.contact.prenom.value=="") {phrase=phrase+"Veuillez fournir votre prenom\n";}
		if (verifmail(document.contact.email.value)==false) {phrase=phrase+"Email incorrect\n";}
		if (phrase!="") {alert(phrase);} else {document.contact.submit();}
	}
	if (theform=='incentive'){
		if (document.pr.nom.value=="") {phrase=phrase+"Veuillez fournir votre nom\n";}
		if (document.pr.societe.value=="") {phrase=phrase+"Veuillez fournir le nom de votre entreprise\n";}
		if (verifmail(document.pr.email.value)==false) {phrase=phrase+"Email incorrect\n";}
		if (phrase!="") {alert(phrase)} else { document.pr.submit();}
	}
	if (theform=='news' || typeof(theform)=='undefined'){
		if (verifmail(document.news.NLmail.value)==false) {
			phrase=phrase+"Email incorrect\n";
		}
		if (phrase!=""){
			alert(phrase);
		} else {
			alert("Merci pour votre inscription : "+document.news.NLmail.value);
			document.news.submit();
		}
	}	
}