// email

function checkWholeForm(theForm) {
    var why = "";
	why += checkName(theForm.name.value);
	why += checkAdd(theForm.address.value);
	why += checkCountry(theForm.country.value);
	why += checkDesignation(theForm.designation.value);
	why += checkTel(theForm.telephone.value);
	why += checkEmail(theForm.email.value);
	   
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkName (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your name.\n";
}
return error;
}

function checkAdd (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your address.\n";
}
return error;
}

function checkCountry (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your Contry.\n";
}
return error;
}

function checkDesignation (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your Designation.\n";
}
return error;
}

function checkTel (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter your telephone.\n";
}
return error;
}

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

