<!-- 
//
// Written for: My Devine Things Pty Ltd.
// Copyright: A Better Deal for ALL (C) 2008 all rights reserved.
// Designed & Developed by: A Better Deal for All ABN: 64 648 123 459
// URL: http://www.ABetterDealForAll.net.au/
// Author: Graham Hagney.
// Program Name: BB001.js
// Date Created: February 2009
// Description: 
//    Validation form.....

  function validEmailAddress2(EmailAddress) {
//----------------------------
     invalidChars = " /:,;"
     if (EmailAddress == "") {                                                // cannot be empty
         return false
     }
     for (i=0; i<invalidChars.length; i++) {        // does it contain any invalid characters?
         badChar = invalidChars.charAt(i)
         if (EmailAddress.indexOf(badChar,0) > -1) {
             return false
             }
     }
     atPos = EmailAddress.indexOf("@",1)                        // there must be one "@" symbol
     if (atPos == -1) {
        return false
     }
     if (EmailAddress.indexOf("@",atPos+1) != -1) {        // and only one "@" symbol
        return false
     }
     periodPos = EmailAddress.indexOf(".",atPos)
     if (periodPos == -1) {                                        // and at least one "." after the "@"
         return false
     }
     if (periodPos+3 > EmailAddress.length)        {                // must be at least 2 characters after the "."
         return false
     }
     return true
}

  function submitIt2(Enquiry) {
//-------------------------
// Check that First Name field has been entered
  if (Enquiry.ChildsName.value == "") {
      alert("Please enter Child's Name.")
      Enquiry.ChildsName.focus()
      Enquiry.ChildsName.select()
      return false
  }
  if (Enquiry.Day.value == "1") {
   if (Enquiry.Month.value == "Jan") {
    if (Enquiry.Year.value == "2000") {
      alert("Please enter Child's Date of Birth.")
      Enquiry.ChildsName.focus()
      //Enquiry.ChildsName.select()
      return false
    }
   }
  }
  if (Enquiry.MHYN[0].checked==true) {
   if (Enquiry.MHConditions.value == "") {
      alert("Please enter Medical History/Conditions.")
      Enquiry.MHConditions.focus()
      Enquiry.MHConditions.select()
      return false
   }
  }
  if (Enquiry.Name.value == "") {
      alert("Please enter Parent/Guardian's Name.")
      Enquiry.Name.focus()
      Enquiry.Name.select()
      return false
  }
  if (Enquiry.Phone.value == "") {
      alert("Please enter Phone.")
      Enquiry.Phone.focus()
      Enquiry.Phone.select()
      return false
  }
  if (Enquiry.Mobile.value == "") {
      alert("Please enter Mobile.")
      Enquiry.Mobile.focus()
      Enquiry.Mobile.select()
      return false
  }
// check to see if the Email Address's valid
  if (Enquiry.EmailAddress.value == "") {
      alert("Email Address is not a valid Email address!\nPlease re-enter.")
      Enquiry.EmailAddress.focus()
      Enquiry.EmailAddress.select()
      return false
  }
  if (!validEmailAddress2(Enquiry.EmailAddress.value)) {
      alert("Email Address is not a valid Email address!\nPlease re-enter.")
      Enquiry.EmailAddress.focus()
      Enquiry.EmailAddress.select()
      return false
  }
  if (Enquiry.Address.value == "") {
      alert("Please enter Address.")
      Enquiry.Address.focus()
      Enquiry.Address.select()
      return false
  }
   if (Enquiry.City.value == "") {
      alert("Please enter City.")
      Enquiry.City.focus()
      Enquiry.City.select()
      return false
  }
  if (Enquiry.PostCode.value == "") {
      alert("Please enter Postcode.")
      Enquiry.PostCode.focus()
      Enquiry.PostCode.select()
      return false
  }
  if (Enquiry.PaymentOption[0].checked==false) {
	if (Enquiry.PaymentOption[1].checked==false) {
      alert("Please select a payment method!")
      Enquiry.Relationship.focus()
      Enquiry.Relationship.select()
      return false
	}
  }
  if (Enquiry.Terms.checked==false) {
      alert(" You must read and agree to the terms and conditions!")
      Enquiry.Terms.focus()
      Enquiry.Terms.select()
      return false
  }

  
// If we made it to here, everything's valid, so return true
  return true
}

// -->
