function validateform(theForm){

 function trim_string(item) {
  var ichar, icount;
  var strValue = item;
  ichar = strValue.length - 1;
  icount = -1;
  while (strValue.charAt(ichar)==' ' && ichar > icount)
   --ichar;
  if (ichar!=(strValue.length-1))
   strValue = strValue.slice(0,ichar+1);
  ichar = 0;
  icount = strValue.length - 1;
  while (strValue.charAt(ichar)==' ' && ichar < icount)
   ++ichar;
  if (ichar!=0)
   strValue = strValue.slice(ichar,strValue.length);
  return strValue;
 }

 checkemail = trim_string(theForm.email.value);
 if (!(/^[\w\.]+@[a-z\.\-]+$/.test(checkemail))) {
  alert("Please enter a valid email address for the \"E-mail address\" field.");
  theForm.email.focus();
  return (false);
 }

 checkemail2 = trim_string(theForm.email2.value);
 if (!(/^[\w\.]+@[a-z\.\-]+$/.test(checkemail2))) {
  alert("Please enter a valid email address for the \"2nd E-mail address\" field.");
  theForm.email.focus();
  return (false);
 }

 if (checkemail != checkemail2) {
  alert("Your email address entries do not match.");
  theForm.email.focus();
  return (false);
 }

 if (theForm.phonenumber.value == "" || theForm.phonenumber.value.length < 7)
 {
  alert("Please enter a value for the \"Daytime contact phone\" field.");
  theForm.phonenumber.focus();
  return (false);
 }

 if (theForm.noa.value == "")
 {
  alert("Please enter a value for the \"Number of adults\" field.");
  theForm.noa.focus();
  return (false);
 }

 var checkOK = "0123456789-.,";
 var checkStr = theForm.noa.value;
 var allValid = true;
 var decPoints = 0;
 var allNum = "";
 for (i = 0;  i < checkStr.length;  i++)
 {
  ch = checkStr.charAt(i);
  for (j = 0;  j < checkOK.length;  j++)
   if (ch == checkOK.charAt(j))
    break;
  if (j == checkOK.length)
  {
   allValid = false;
   break;
  }
  if (ch == ".")
  {
   allNum += ".";
   decPoints++;
  }
  else if (ch != ",")
   allNum += ch;
 }
 if (!allValid || decPoints > 1)
 {
  alert("Please enter only digit characters in the \"Number of adults\" field.");
  theForm.noa.focus();
  return (false);
 }

 if(document.getElementById("fname").value==""){
  alert("Please enter your first name.");
  document.getElementById("fname").focus();
  return (false);
 }
 if(document.getElementById("lname").value==""){
  alert("Please enter your last name.");
  document.getElementById("lname").focus();
  return (false);
 }

 return (true);
}