function submitForm () {
	var validForm = true;
	var errorMessage = "############## Votre formulaire n'est pas valide ##############\n\n\n";
	if ($('news_prenom').value == "") {
		validForm = false;
		errorMessage+="*** Probleme de de Prenom ***\n\nLe champs \"Prenom\" est obligatoire\n\n\n"; 
	}
	if ($('news_nom').value == "") {
		validForm = false;
		errorMessage+="*** Probleme de de Nom ***\n\nLe champs \"Nom\" est obligatoire\n\n\n"; 
	}
	if (!isEmail($('news_mail').value)) {
		validForm = false;
		errorMessage+= "*** Probleme d'adresse mail ***\n\nVotre adresse mail  \"" + $('news_mail').value + "\"  n'est pas valide.\n Rappel : Elle doit etre sous la forme xxxx@yyyy.zzz\n\n\n";
	}
	if (!isBirth($('news_birth').value)) {
		validForm = false;
		errorMessage+="*** Probleme de date de naissance ***\n\nVotre date de naissance n'est pas valide\nRappel : Elle doit etre sous la forme \"JJ/MM/AAAA\"\n\n\n"; 
	}
	if ($('news_postal').value == "") {
		validForm = false;
		errorMessage+="*** Probleme de Code Postal ***\n\nLe champs \"Code Postal\" est obligatoire\n\n\n"; 
	}
	if (!validForm) {alert (errorMessage+"  ")}
	else {$('form_newsletter').submit();}
	
}

function isBirth (birthStr) {
	birthSplit = birthStr.split("/");
	if (birthSplit[0] < 1 || birthSplit[0] > 31 || birthSplit[0] == "undefined" || birthSplit[0] == "" || !IsNumeric(birthSplit[0])) {
		return false;
	}
	if (birthSplit[1] < 1 || birthSplit[1] > 12 || birthSplit[1] == "undefined" || birthSplit[1] == "" || !IsNumeric(birthSplit[1])) {
		return false;
	}
	if ((birthSplit[2]/1000)<1 || birthSplit[2] == "undefined" || birthSplit[2] == "" || !IsNumeric(birthSplit[2])) {
		return false;
	}
	if (birthSplit[3]) {
		return false;
	}
	return true;	
}

function isEmail (emailStr) {
	var checkTLD = 1;
	var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|­pro|museum|fr)$/;
	var emailPat = /^(.+)@(.+)$/;
	var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars = "\[^\\s" + specialChars + "\]";
	var quotedUser = "(\"[^\"]*\")";
	var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom = validChars + '+';
	var word = "(" + atom + "|" + quotedUser + ")";
	var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat = new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray = emailStr.match(emailPat);
	if (matchArray == null) { return false; }
	var user = matchArray[1];
	var domain = matchArray[2];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i) > 127) { return false; }
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i) > 127) { return false; }
	}
	if (user.match(userPat) == null) { return false; }
	var IPArray=domain.match(ipDomainPat);
	if (IPArray != null) {
		for (var i=1; i<=4; i++) {
			if (IPArray[i] > 255) { return false; }
		}
		return true;
	}
	var atomPat = new RegExp("^" + atom + "$");
	var domArr = domain.split(".");
	var len = domArr.length;
	for (i=0; i<len; i++) {
		if (domArr[i].search(atomPat) == -1) { return false; }
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) { return false; }
	if (len < 2) { return false; }
	return true;
}
function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }