
function checkform ( form )
{

  // ** START **
  if (form.name.value == "") {
    alert( "Please enter your name." );
    form.name.focus();
    return false ;
  }


if (form.email.value == "")
  {
    alert( "Please enter your email address." );
    form.email.focus();
    return false ;
  }

// START confirm valid email address

if ((form.email.value.indexOf ('@',0) == -1 ||
   form.email.value.indexOf ('.',0) == -1) &&
   form.email.value != "")
  {
    alert( "The email address entered doesn’t seem to be valid." );
    form.email.focus();
    return false ;
  }

// END confirm valid email address




  if (form.adults.value == "") {
    alert( "Please enter the number of adults." );
    form.adults.focus();
    return false ;
  }


// START confirm entry in adults field is a number and not a letter

  var digits = "0123456789";

  for (var i = 0; i < form.adults.value.length; i++)
  {
    temp = form.adults.value.substring(i, i+1)

    if (digits.indexOf(temp) == -1 &&
     form.adults.value != "")
    {
    alert( "You must enter a number in No of Adults field." );
    form.adults.focus();
    return false ;
    }
  }

// END confirm entry in adults field is a number and not a letter



  if (form.pickupdate.value == "") {
    alert( "Please enter date you wish to be picked up." );
    form.pickupdate.focus();
    return false ;
  }


// START confirm entry in pickupdate field is in the correct format

    var minYear = (new Date()).getFullYear();
    var maxYear = ((new Date()).getFullYear())+2;

    // regular expression to match required date format
    re = /^(\d{1,2})\/(\d{1,2})\/(\d{4})$/;

    if(form.pickupdate.value != '') {
      if(regs = form.pickupdate.value.match(re)) {
        if(regs[1] < 1 || regs[1] > 31) {
          alert("Invalid day: " + regs[1]);
          form.pickupdate.focus();
          return false;
        }
        if(regs[2] < 1 || regs[2] > 12) {
          alert("Invalid month: " + regs[2]);
          form.pickupdate.focus();
          return false;
        }
        if(regs[3] < minYear || regs[3] > maxYear) {
          alert("Invalid year: " + regs[3] + " - must be between "  + minYear + " and " + maxYear);
          form.pickupdate.focus();
          return false;
        }
      } else {
        alert("Invalid date format. Enter as dd/mm/yyyy ");
        form.pickupdate.focus();
        return false;
      }
    }

// END confirm entry in pickupdate field is in the correct format




 if (form.pickuptimeh.options[0].selected != ""){
    alert( "Please select the hour you wish to be picked up." );
    form.pickuptimeh.focus();
    return false ;
  }

 if (form.pickuptimem.options[0].selected != ""){
    alert( "Please select the minutes you wish to be picked up." );
    form.pickuptimem.focus();
    return false ;
  }

 if (form.pickuptimea.options[0].selected != ""){
    alert( "Please select if it is am or pm you wish picked up." );
    form.pickuptimea.focus();
    return false ;
  }


  if (form.pickup.value == "") {
    alert( "Please enter the location you wish to be collected at." );
    form.pickup.focus();
    return false ;
  }


  if (form.destination.value == "") {
    alert( "Please enter your destination." );
    form.destination.focus();
    return false ;
  }


  // ** END **
  return true ;
}













