function validateForm(theForm){
	var error = "";
		error += checkNom(theForm.nom.value);
		error += checkSociete(theForm.societe.value);
		error += checkEmail(theForm.email.value);
    if (error != "") {
       alert(error);
       return false;
    }
	return true;
}
function checkNom(strng) {
	error = "";
	if (strng == "") {
    	error+= "Veuillez entrer votre nom.\n";
	}else{
		if (strng.length < 3) {
		error += "Votre Nom doit comporter au moins 3 caractères.\n";
		}
		/* The JavaScript regular expression /\W/ is a standard character class that’s handily predefined to mean "any character other than letters, numbers, and underscores."*/
		var illegalChars = /\W/;
		if (illegalChars.test(strng)) {
		   error = "Votre nom contient des caractères interdits.\n";
		}
	}
	return error;
}
function checkSociete(strng){
	error = "";
	if (strng == "") {
    	error+= "Veuillez entrer le nom de votre Société.\n";
	}else 
	if (strng.length < 3) {
    error += "Le nom de votre Société doit comporter au moins 3 caractères.\n";
	}
	return error;
}
function checkEmail(strng){
	error="";
	if(strng==""){
		error="Veuillez entrer une adresse email.\n";
	}else{
		var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
		if (strng.match(illegalChars)) {
		   error += "Votre adresse email contient des caractères interdits.\n";
		}
		var emailFilter=/^.+@.+\..{2,4}$/;
		if (!(emailFilter.test(strng))) { 
			   error += "Veuillez entrer une adresse email valide.\n";
		}
	}
	return error;
}
