﻿function doValidate()
{
  if (document.Booking_Form1.f_name.value.length == "")
  {
    alert("Please enter your first name");
    document.Booking_Form1.f_name.focus();
    return (false);
  }
if (document.Booking_Form1.s_name.value.length == "")
  {
    alert("Please enter your surname");
    document.Booking_Form1.s_name.focus();
    return (false);
  }
  if (document.Booking_Form1.address.value.length == "")
    {
      alert("Please enter your contact address");
      document.Booking_Form1.address.focus();
      return (false);
    }
if (document.Booking_Form1.e_mail_address.value.length == "" && document.Booking_Form1.t_phone.value.length == "")
  {
    alert("Please enter a telephone number or e-mail address");
    document.Booking_Form1.t_phone.focus();
    return (false);
  }
if (document.Booking_Form1.e_mail_address.value.length != "")
  {
    apos=document.Booking_Form1.e_mail_address.value.indexOf('@')
	dotpos=document.Booking_Form1.e_mail_address.value.lastIndexOf('.')
	if (apos<1||dotpos-apos<2)
		  {
		  alert("Email format is invalid.");
		  document.Booking_Form1.e_mail_address.focus();
		  return false
	  }
  }
if (document.Booking_Form1.party_total.value.length == "")
  {
    alert("Please enter the total number of people in your party");
    document.Booking_Form1.party_total.focus();
    return (false);
  }
if (document.Booking_Form1.all_occupants.value.length == "")
  {
    alert("Please enter the names of all occupants");
    document.Booking_Form1.all_occupants.focus();
    return (false);
  }
if (document.Booking_Form1.previous_visitor.value == "- - - >")
  {
    alert("Please select whether you are a return visitor or not");
    document.Booking_Form1.previous_visitor.focus();
    return (false);
  }
if (document.Booking_Form1.previous_visitor.value == "no" && document.Booking_Form1.where_hear.value == "- - - - - - - - >")
  {
    alert("Please enter where you heard about us");
    document.Booking_Form1.where_hear.focus();
    return (false);
  }
}