// email
function checkEmail (strng) {
var error="";
var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error += "Entrez un courriel valide s.v.p.\n";
    }
    else {
		//test email for illegal characters
		var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
		if (strng.match(illegalChars)) {
          error += "Le courriel contient des charactères illégaux.\n";
		}
    }

return error+="";    
}
// phone number - strip out delimiters and check for 10 digits
function checkPhone (strng) {
var error = "";
//strip out acceptable non-numeric characters
var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
var s = ""
    
    if (isNaN(stripped)) {
    error += "Le numéro contient des caractères illégaux.\n";
    }else
	  if (stripped.length > 11) {
	   error += "Le numéro est trop long.\n";
	  }else
		if (stripped.length < 10) {
		 error += "Le numéro doit contenir 10 caractères comprenant le code régional.\n";
		}
return error+="";
}
//name >3 chars, uc, lc only.
function checkName (strng) {
var error = "";

    var illegalChars =  /[\(0-9)\_\(\)\<\>\,\;\:\\\"\[\]]/; // allow only letters

   if (strng.length < 4) {
   error = "Nom trop court.\n";
   }
   if (illegalChars.test(strng)) {
   error += "Le nom contient des charactères illégaux.\n";
   } 

   if (!strng.match(/^[A-Z]+/))
   error += "Vous méritez un nom avec une majuscule.\n";
   
return error +="";
}           
