function checkWholeForm(theForm) {
    var why = "";
    why += isEmptyName(theForm.Name.value);
    why += isEmptyTel(theForm.tel.value);
    why += checkEmail(theForm.email.value);
    why += isEmptyMessage(theForm.Comments.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}
// email
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;    
}

function isEmptyName(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please include your name.\n";
  }
return error;	  
}
// non-empty textbox
function isEmptyTel(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please provide a contact number. \n";
  }else {
//test email for illegal characters
       var illegalChars= /[\@\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "Your contact number contains illegal characters.\n";
       }
    }
return error;	  
}
function isEmptyMessage(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please provide a message. \n";
  } 
return error;	  
}