function checkWholeForm(theForm)
{
    var why = "";
    why += checkEmail(theForm.Email.value);
    why += checkPhone(theForm.Teljour.value);
    why += isEmpty(theForm.Nom.value);

    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "Entrez un adresse de courriel.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Entrez un adresse de courriel valide.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Entrez une adresse de courriel valide.\n";
       }
    }
return error;    
}

function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "Entrez un numéro de téléphone.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "Entrez un numéro de téléphone valide.";
  
    }
    if (!(stripped.length > 6)) {
	error = "Entrez un numéro de téléphone de plus de 6 chiffres.\n";
    } 
return error;
}


function isEmpty(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Les zones obligatoires n'ont pas été tous remplies.\n"
  }
return error;	  
}
