
function reloadform(){document.quote_form.submit();}
function changeCountry(destination_id){if(destination_id!=0){view_ajax('/phpscripts/pick_up_loc.php?destination_id='+destination_id,'location_cell',false,'center');document.quote_form.input_location_id.disabled=0;var location_id=document.quote_form.input_location_id.value;changeLocation(0);}else{document.quote_form.input_location_id.disabled=1;document.quote_form.input_location_id.innerHTML="<option selected=\"selected\" value=\"0\">&nbsp;</option>";document.quote_form.input_location_id2.disabled=1;document.quote_form.input_location_id2.innerHTML="<option selected=\"selected\" value=\"0\">&nbsp;</option>";document.quote_form.input_vehicle_category.disabled=1;document.quote_form.input_vehicle_category.innerHTML="<option selected=\"selected\" value=\"0\">&nbsp;</option>";}}
function changeLocation(location_id){if(location_id!=0){view_ajax('/phpscripts/drop_off_loc.php?location_id='+location_id,'location2_cell',false,'center');document.quote_form.input_location_id2.disabled=0;changeVehicle(location_id,location_id);}else{document.quote_form.input_location_id2.disabled=1;document.quote_form.input_location_id2.innerHTML="<option selected=\"selected\" value=\"0\">&nbsp;</option>";document.quote_form.input_vehicle_category.disabled=1;document.quote_form.input_vehicle_category.innerHTML="<option selected=\"selected\" value=\"0\">&nbsp;</option>";}}
function changeVehicle(location_id,location_id2){view_ajax('/phpscripts/vehicles.php?location_id='+location_id+'&location_id2='+location_id2,'vehicle_cell',false,'center');document.quote_form.input_vehicle_category.disabled=0;}
function checkForm(theForm){var input_country=theForm.input_country.value;var input_location_id=theForm.input_location_id.value;var input_location_id2=theForm.input_location_id2.value;var input_start_date=theForm.date1.value;var start_date_array=input_start_date.split("/");var input_start_day=start_date_array[0];var input_start_month=start_date_array[1]-1;var input_start_year=start_date_array[2];if(input_start_year&&input_start_year.length==2){input_start_year="20"+input_start_year;}
var input_start_hour=theForm.input_start_hour.value;var input_start_minute=theForm.input_start_minute.value;var start_timestamp=new Date(input_start_year,input_start_month,input_start_day,input_start_hour,input_start_minute,0,0);var input_end_date=theForm.date2.value;var end_date_array=input_end_date.split("/");var input_end_day=end_date_array[0];var input_end_month=end_date_array[1]-1;var input_end_year=end_date_array[2];if(input_end_year&&input_end_year.length==2){input_end_year="20"+input_end_year;}
var end_timestamp=new Date(input_end_year,input_end_month,input_end_day);var input_drivers_age=theForm.input_drivers_age.value;var ValidNumChars="0123456789";var IsNumber=true;for(i=0;i<input_drivers_age.length&&IsNumber==true;i++){Char=input_drivers_age.charAt(i);if(ValidNumChars.indexOf(Char)==-1){IsNumber=false;}}
if(input_country!=0){if(input_location_id>0){if(input_location_id2>0){if(input_start_date!="dd/mm/yyyy"){if(input_start_date!=""){if(start_date_array&&start_date_array.length==3){if(input_start_day>0&&input_start_day<32){if(input_start_month>-1&&input_start_month<13){if(input_start_year>2005){if(input_end_date!="dd/mm/yyyy"){if(input_end_date!=""){if(end_date_array&&end_date_array.length==3){if(input_end_day>0&&input_end_day<32){if(input_end_month>-1&&input_end_month<13){if(input_end_year>2005){if(start_timestamp>=timestamp){if(start_timestamp<end_timestamp){if(input_drivers_age!=""&&IsNumber==true){return true;}else{alert("Please enter a valid drivers age");theForm.input_drivers_age.focus();return false;}}else{alert("The end date must be after the start date");theForm.date2.focus();return false;}}else{if(today=="Sat"||today=="Sun"){if(today=="Sat"){alert("A minimum of 54 hours notice is required to make a booking online on Saturdays.\nPlease adjust your dates or call 0845 450 0877");}
if(today=="Sun"){alert("A minimum of 48 hours notice is required to make a booking online on Sundays.\nPlease adjust your dates or call 0845 450 0877");}
theForm.date1.focus();return false;}else{alert("A minimum of 24 hours notice is required to make a booking.\nPlease adjust your dates or call 0845 450 0877");theForm.date1.focus();return false;}}}else{alert("End Date must be in the format dd/mm/yyyy");theForm.date2.focus();return false;}}else{alert("End Date must be in the format dd/mm/yyyy");theForm.date2.focus();return false;}}else{alert("End Date must be in the format dd/mm/yyyy");theForm.date2.focus();return false;}}else{alert("End Date must be in the format dd/mm/yyyy");theForm.date2.focus();return false;}}else{alert("Please enter an end date");theForm.date2.focus();return false;}}else{alert("Please enter an end date");theForm.date2.focus();return false;}}else{alert("Invalid start year");theForm.date1.focus();return false;}}else{alert("Invalid start month");theForm.date1.focus();return false;}}else{alert("Invalid start day");theForm.date1.focus();return false;}}else{alert("Start Date must be in the format dd/mm/yyyy");theForm.date1.focus();return false;}}else{alert("Please enter a start date");theForm.date1.focus();return false;}}else{alert("Please enter a start date");theForm.date1.focus();return false;}}else{alert("You must choose a return location");theForm.input_location_id2.focus();return false;}}else{alert("You must choose a location");theForm.input_location_id.focus();return false;}}else{alert("You must choose a destination country");theForm.input_country.focus();return false;}}
function checkQuote(theForm){var quote_ref=theForm.ref.value;var quote=quote_ref.substring(3);var ValidNumChars="0123456789";var IsQuoteNumber=true;for(i=0;i<quote.length&&IsQuoteNumber==true;i++){Char=quote.charAt(i);if(ValidNumChars.indexOf(Char)==-1){IsQuoteNumber=false;}}
if(quote!=""&&quote.length>5){if(IsQuoteNumber==true){return true;}else{alert("The Quote must be 'OLQ' followed by 6 or more numbers");theForm.ref.focus();return false;}}else{alert("The Quote must be 'OLQ' followed by 6 or more numbers");theForm.ref.focus();return false;}}