function validateForm() 
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("Email addresses you entered do not match.  Please re-enter.")
    email.focus()
  }
  if (thesubject.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the subject.")
    thesubject.focus()
  }
  if (animal_class_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the class for this horse.")
    animal_class_a.focus()
  }
  if (animal_name_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the name of this horse.")
    animal_name_a.focus()
  }
  if (animal_age_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the age for this horse.")
    animal_age_a.focus()
  }
  if (animal_sex_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the gender for this horse.")
    animal_sex_a.focus()
  }
  if (animal_reg_num_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the registration number for this horse.")
    animal_reg_num_a.focus()
  }
  if (animal_sire_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the sire for this horse.")
    animal_sire_a.focus()
  }
  if (animal_dam_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter the dam for this horse.")
    animal_dam_a.focus()
  }
  if (animal_breeder_a.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter a breeder for this horse.")
    animal_breeder_a.focus()
  }
  if (acceptconditions.checked == false && okSoFar)
  {
    okSoFar=false
    alert("Click the checkbox at the bottom of the form to indicate that you accept the terms and conditions.")
    acceptconditions.focus()
  }
  if (okSoFar==true)  submit();
 }
}
