<!--
function submitit() {
flag = 0;
if (document.vanquote.businessaddress.value=="") {
alert("Please enter the business address, then resubmit the"
+ " form.");
document.vanquote.businessaddress.focus();
flag = 1;
return false;
}
if (document.vanquote.businesspostcode.value=="") {
alert("Please enter the business postcode. unfortunately, we will be unable to provide a quote without a valid"
+ " postcode.");
document.vanquote.businesspostcode.focus();
flag = 1;
return false;
}
test = document.vanquote.businesspostcode.value; size = test.length
test = test.toUpperCase(); //Change to uppercase
while (test.slice(0,1) == " ") //Strip leading spaces
{test = test.substr(1,size-1);size = test.length
}
while(test.slice(size-1,size)== " ") //Strip trailing spaces
{test = test.substr(0,size-1);size = test.length
}
document.vanquote.businesspostcode.value = test; //write back to form field
if (size < 6 || size > 8){ //Code length rule
alert(test + " is not a valid postcode - wrong length");
document.vanquote.businesspostcode.focus();
return false;
}
if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
alert(test + " is not a valid postcode - cannot start with a number");
document.vanquote.businesspostcode.focus();
return false;
}
if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
alert(test + " is not a valid postcode - alpha character in wrong position");
document.vanquote.businesspostcode.focus();
return false;
}
if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
alert(test + " is not a valid postcode - number in wrong position");
document.vanquote.businesspostcode.focus();
return false;
}
if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
alert(test + " is not a valid postcode - number in wrong position");
document.vanquote.businesspostcode.focus();
return false;
}
if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
alert(test + " is not a valid postcode - no space or space in wrong position");
document.vanquote.businesspostcode.focus();
return false;
}
count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
if (count1 != count2){//only one space rule
alert(test + " is not a valid postcode - only one space allowed");
document.vanquote.businesspostcode.focus();
flag = 1;
return false;
}
if (document.vanquote.telephone.value=="") {
alert("Please enter your daytime telephone"
+ " number.");
document.vanquote.telephone.focus();
flag = 1;
return false;
}
if (document.vanquote.email.value=="") {
alert("Please enter your email address, then resubmit the"
+ " form.");
document.vanquote.email.focus();
flag = 1;
return false;
}
var testresults
var str=document.vanquote.email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address, then resubmit the form.")
document.vanquote.email.focus();
flag = 1;
testresults=false
return (testresults)
}
if (document.vanquote.make.value=="") {
alert("Please state the manufacturer of the vehicle, then resubmit the"
+ " form.");
document.vanquote.make.focus();
flag = 1;
return false;
}
if (document.vanquote.model.value=="") {
alert("Please state the model of the vehicle, then resubmit the"
+ " form.");
document.vanquote.model.focus();
flag = 1;
return false;
}
if (document.vanquote.enginesize.value=="") {
alert("Please state the engine size (c.c.) of the vehicle, then resubmit the"
+ " form.");
document.vanquote.enginesize.focus();
flag = 1;
return false;
}
if (document.vanquote.year.value=="") {
alert("Please state the year when the vehicle was manufactured, then resubmit the"
+ " form.");
document.vanquote.year.focus();
flag = 1;
return false;
}
if (document.vanquote.vehiclevalue.value=="") {
alert("Please state the value of the vehicle, then resubmit the"
+ " form.");
document.vanquote.vehiclevalue.focus();
flag = 1;
return false;
}
seatschoice = document.vanquote.seats.selectedIndex
if (document.vanquote.seats.options[seatschoice].value=="") {
alert("Please confirm the number of seats in the vehicle.");
document.vanquote.seats.focus();
flag = 1;
return false;
}
fuelchoice = document.vanquote.fueltype.selectedIndex
if (document.vanquote.fueltype.options[fuelchoice].value=="") {
alert("Please confirm the type of fuel used by the vehicle.");
document.vanquote.fueltype.focus();
flag = 1;
return false;
}
overnightchoice = document.vanquote.overnight.selectedIndex
if (document.vanquote.overnight.options[overnightchoice].value=="") {
alert("Please confirm where the vehicle is parked overnight.");
document.vanquote.overnight.focus();
flag = 1;
return false;
}
if (document.vanquote.imported[0].checked == true
 && document.vanquote.importeddetails.value=="") {
alert("Please provide details of where the vehicle has been imported from.");
document.vanquote.importeddetails.focus();
flag = 1;
return false;
}
if (document.vanquote.modified[0].checked == true
 && document.vanquote.modificationdetails.value=="") {
alert("Please provide details of the types of modifications on the vehicle.");
document.vanquote.modificationdetails.focus();
flag = 1;
return false;
}
noclaimsbonuschoice = document.vanquote.noclaimsbonus.selectedIndex
if (document.vanquote.noclaimsbonus.options[noclaimsbonuschoice].value=="") {
alert("Please select the number of years no claims bonus for the vehicle. if you do not have any no claims bonus, please select 0 years.");
document.vanquote.noclaimsbonus.focus();
flag = 1;
return false 
}
driverschoice = document.vanquote.drivers.selectedIndex
if (document.vanquote.drivers.options[driverschoice].value=="") {
alert("Please select who will drive the vehicle.");
document.vanquote.drivers.focus();
flag = 1;
return false 
}
if (document.vanquote.companypolicy[0].checked == true
 && document.vanquote.companyname.value=="") {
alert("Please confirm the name of your company.");
document.vanquote.companyname.focus();
flag = 1;
return false;
}
if (document.vanquote.firstname.value=="") {
alert("Please enter the proposers/main drivers first name, then resubmit the"
+ " form.");
document.vanquote.firstname.focus();
flag = 1;
return false; 
}
if (document.vanquote.surname.value=="") {
alert("Please enter the proposers/main drivers surname, then resubmit the"
+ " form.");
document.vanquote.surname.focus();
flag = 1;
return false; 
}
if (document.vanquote.proposersoccupation.value=="") {
alert("Please enter the proposers/main drivers occupation/job description, then resubmit the"
+ " form.");
document.vanquote.proposersoccupation.focus();
flag = 1;
return false; 
}
if (document.vanquote.dateofbirth1.value=="") {
alert("Please enter the proposers/main drivers date of birth, then resubmit the"
+ " form.");
document.vanquote.dateofbirth1.focus();
flag = 1;
return false;
}
maritalstatus1choice = document.vanquote.maritalstatus1.selectedIndex
if (document.vanquote.maritalstatus1.options[maritalstatus1choice].value=="") {
alert("Please select the proposers/main drivers marital status.");
document.vanquote.maritalstatus1.focus();
flag = 1;
return false 
}
licencetype1choice = document.vanquote.licencetype1.selectedIndex
if (document.vanquote.licencetype1.options[licencetype1choice].value=="") {
alert("Please select the licence type for the proposer/main driver of the vehicle.");
document.vanquote.licencetype1.focus();
flag = 1;
return false 
}
if (document.vanquote.licenceyears1.value=="") {
alert("Please enter the number of years that the proposer/main driver has held their licence, then resubmit the"
+ " form.");
document.vanquote.licenceyears1.focus();
flag = 1;
return false;
}
accidentoption = -1
for (i=0; i<vanquote.proposersaccidents.length; i++) {
if (vanquote.proposersaccidents[i].checked) {
accidentoption = i
}
}
if (accidentoption == -1) {
alert("Please confirm whether or not the proposer/main driver has had an accident or claim in the last 5 years.")
flag = 1;
return false;
}
convictionoption = -1
for (i=0; i<vanquote.proposersconvictions.length; i++) {
if (vanquote.proposersconvictions[i].checked) {
convictionoption = i
}
}
if (convictionoption == -1) {
alert("Please confirm whether or not the proposer/main driver has had any driving convictions.")
flag = 1;
return false;
}
disabilitiesoption = -1
for (i=0; i<vanquote.proposersdisabilities.length; i++) {
if (vanquote.proposersdisabilities[i].checked) {
disabilitiesoption = i
}
}
if (disabilitiesoption == -1) {
alert("Please confirm whether or not the proposer/main driver has any disabilities.")
flag = 1;
return false;
}
if (flag == 0) {
document.vanquote.send.value="Details being processed...";
return true; }
}
//-->

