function checkenquiryFields() { 

if (document.enquireform.firstname.value == "") { 
alert("Details incorrect. Please enter your First Name."); 
document.enquireform.firstname.focus(); return false; 

}

 var str = document.enquireform.firstname.value
 var slen = str.length
 
 for (i=0; i < slen; i++) {
    var ch = str.substring(i,i+1)
    if ( (ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && ch != " ") {
     alert("Details incorrect. " + (i+1)  + "th Character in the FIRST NAME field is Invalid!")
     document.enquireform.firstname.value.focus()
     return false; 
     }
  }

if (document.enquireform.lastname.value == "") { 
alert("Details incorrect. Please enter your Last Name."); 
document.enquireform.lastname.focus(); return false; 

}

 var str = document.enquireform.lastname.value
 var slen = str.length
 
 for (i=0; i < slen; i++) {
    var ch = str.substring(i,i+1)
    if ( (ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && ch != " ") {
     alert("Details incorrect. " + (i+1)  + "th Character in the LAST NAME field is Invalid!")
     document.enquireform.lastname.value.focus()
     return false; 
     }
  }



if (document.enquireform.emailaddress.value.indexOf("@")<3){ // checks for at least 3 characters before the @

alert("The email entered appears to be incorrect - please check the username and format of the email that it contains '@' ");
document.enquireform.emailaddress.focus(); return false; 

}

if (document.enquireform.phone.value == "") { 
alert("Details incorrect. Please enter a valid contact phone number."); 
document.enquireform.phone.focus(); return false; 

}


if (document.enquireform.referral.value == "Other" & document.enquireform.otherreferral.value == "")  { 
alert("Details incorrect. You have selected an alternative referral source for our website but have not stated what it is. Please enter the correct information and try again."); 
document.enquireform.otherreferral.focus(); return false; 

}



if (document.enquireform.store.value == "") { 
alert("Details incorrect. Please enter your preferred Autobahn store"); 
document.enquireform.store.focus(); return false; 

}

if (document.enquireform.method.value == "Phone" & document.enquireform.phone.value == "")  { 
alert("Details incorrect. You have requested to be contacted by phone but you have not entered a valid telephone number."); 
document.enquireform.phone.focus(); return false; 

}



else {  // if none of the fields have any errors then submit the form

document.enquireform.submit(); // In this document,  submit the form called notify

}


}

function checkbookingFields() { 

if (document.bookingform.auto.value == "" & document.bookingform.brake.value == "" & document.bookingform.electronic.value == "" & document.bookingform.air.value == "" & document.bookingform.fuelinject.value == "" & document.bookingform.trans.value == "" & document.bookingform.pre.value == "" & document.bookingform.fixed.value == "" & document.bookingform.log.value == ""){ 
alert("Details incorrect - Please select a service to book"); 
document.bookingform.auto.focus(); return false; 

}

if (document.bookingform.firstname.value == "") { 
alert("Details incorrect. Please enter your First Name."); 
document.bookingform.firstname.focus(); return false; 

}

var str = document.bookingform.firstname.value
 var slen = str.length
 
 for (i=0; i < slen; i++) {
    var ch = str.substring(i,i+1)
    if ( (ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && ch != " ") {
     alert("Details incorrect. " + (i+1)  + "th Character in the FIRST NAME field is Invalid!")
     document.bookingform.firstname.value.focus()
     return false; 
     }
  }

if (document.bookingform.lastname.value == "") { 
alert("Details incorrect. Please enter your Last Name."); 
document.bookingform.lastname.focus(); return false; 

}

var str = document.bookingform.lastname.value
 var slen = str.length
 
 for (i=0; i < slen; i++) {
    var ch = str.substring(i,i+1)
    if ( (ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch) && ch != " ") {
     alert("Details incorrect. " + (i+1)  + "th Character in the LAST NAME field is Invalid!")
     document.bookingform.lastname.value.focus()
     return false; 
     }
  }

if (document.bookingform.emailaddress.value.indexOf("@")<3){ // checks for at least 3 characters before the @

alert("The email entered appears to be incorrect - please check the username and format of the email that it contains '@' ");
document.bookingform.emailaddress.focus(); return false; 

}

if (document.bookingform.phone.value == "") { 
alert("Details incorrect. Please enter a valid contact phone number."); 
document.bookingform.phone.focus(); return false; 

}



if (document.bookingform.referral.value == "Other" & document.bookingform.otherreferral.value == "")  { 
alert("Details incorrect. You have selected an alternative referral source for our website but have not stated what it is. Please enter the correct information and try again."); 
document.bookingform.otherreferral.focus(); return false; 

}



if (document.bookingform.method.value == "Phone" & document.bookingform.phone.value == "")  { 
alert("Details incorrect. You have requested to be contacted by phone but you have not entered a valid telephone number."); 
document.bookingform.phone.focus(); return false; 

}

if (document.bookingform.suburb.value == "") { 
alert("Details incorrect. Please enter your suburb"); 
document.bookingform.suburb.focus(); return false; 

}

if (document.bookingform.store.value == "") { 
alert("Details incorrect. Please enter your preferred Autobahn store"); 
document.bookingform.store.focus(); return false; 

}

if (document.bookingform.date.value == "") { 
alert("Details incorrect. Please enter your preferred Booking Date"); 
document.bookingform.date.focus(); return false; 

}

if (document.bookingform.hour.value == "null") { 
alert("Details incorrect. Please enter HOUR value for booking time"); 
document.bookingform.hour.focus(); return false; 

}

if (document.bookingform.minute.value == "null") { 
alert("Details incorrect. Please enter MINUTE value for booking time"); 
document.bookingform.minute.focus(); return false; 

}


if (document.bookingform.make.value == "") { 
alert("Details incorrect. Please enter your vehicle make"); 
document.bookingform.make.focus(); return false; 

}

if (document.bookingform.model.value == "") { 
alert("Details incorrect. Please enter your vehicle model"); 
document.bookingform.model.focus(); return false; 

}

if (document.bookingform.year.value == "") { 
alert("Details incorrect. Please enter your vehicle year"); 
document.bookingform.year.focus(); return false; 

}

else {  // if none of the fields have any errors then submit the form

document.bookingform.submit(); // In this document,  submit the form called notify

}


}

