function checkWholeForm(bookingform) {
	var why = "";

		why += isEmpty(bookingform.name.value, "NAME");
		if (why != "") {
			alert(why);
			bookingform.name.focus();
			return false;
		}
		why += isEmpty(bookingform.homephone.value, "HOME PHONE");
		if (why != "") {
			alert(why);
			bookingform.homephone.focus();
			return false;
		}

		why += isEmpty(bookingform.businessphone.value, "BUSINESS PHONE");
		if (why != "") {
			alert(why);
			bookingform.businessphone.focus();
			return false;
		}
		
		why += checkEmail(bookingform.email.value, "EMAIL");
		if (why != "") {
			alert(why);
			bookingform.email.focus();
			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;    
}

// non-empty textbox

function isEmpty(strng, fldName) {
var error = "";
  if (strng.length == 0) {
     error = "The " + fldName + " field has not been filled in.\n"
  }
return error;	  
}
// valid selector from dropdown list

function checkDropdown(choice, fldName) {
var error = "";
    if (choice == 0) {
    error = "You didn't choose an option from the " + fldName + " drop-down list.\n";
    }    
return error;
}
