
DisplayForm();function DisplayForm(){var formCount=0;for(formCount=0;formCount<document.forms.length;formCount++){carSearchElement=document.forms[formCount].parentNode;if(carSearchElement!=null&&carSearchElement.className=="carsearch hide"){carSearchElement.className="show";}}}
function populateModel(makeDropdown,allmodels){var modelvalue=new Array();var modeldescription=new Array();var index=0;var selectedIndex=makeDropdown.options.selectedIndex;var formSearch=makeDropdown;while(formSearch.parentNode.tagName!="FORM"){formSearch=formSearch.parentNode;}
formSearch=formSearch.parentNode;var modelDropdown=formSearch.elements["modeldropdown"];if(selectedIndex==0){modelDropdown.disabled=true;if(modelDropdown.firstChild.nextSibling!=null){while(modelDropdown.firstChild.nextSibling!=null){modelDropdown.removeChild(modelDropdown.firstChild.nextSibling);}}}
else{modeldescription=allmodels[selectedIndex-1][0].split(';');modelvalue=allmodels[selectedIndex-1][1].split(';');while(modelDropdown.firstChild.nextSibling!=null){modelDropdown.removeChild(modelDropdown.firstChild.nextSibling);}
for(index=0;index<modelvalue.length;index++){var option=document.createElement("option");option.setAttribute("value",modelvalue[index]);option.appendChild(document.createTextNode(modeldescription[index]));modelDropdown.appendChild(option);}
modelDropdown.disabled=false;}
modelDropdown.style.width=modelDropdown.offsetWidth;}
function DoAction(theForm,hiddenFieldValue){try{var formElements=theForm.elements;var makeQuery=formElements["makequery"].value;var modelQuery=formElements["modelquery"].value;var makeDropdown=formElements["makedropdown"];var makeDropdownUrl=makeDropdown.options[makeDropdown.selectedIndex].value;var modelDropdown=formElements["modeldropdown"];var modelDropdownUrl=modelDropdown.options[modelDropdown.selectedIndex].value;theForm.action=theForm.action+"?"+makeQuery+"="+makeDropdownUrl+"&"+modelQuery+"="+modelDropdownUrl;for(requiredSectionIndex=3;requiredSectionIndex<=4;requiredSectionIndex++){theForm.action=theForm.action+"&"+formElements["requiredsectiondropdown"+requiredSectionIndex+"_hidden"].value+"=";var sectionValue;sectionValue=formElements["requiredsectiondropdown"+requiredSectionIndex];theForm.action=theForm.action+sectionValue.options[sectionValue.selectedIndex].value;}
for(optionalIndex1=1;optionalIndex1<=2;optionalIndex1++){var optionalSection=new Array();for(optionalIndex2=1;optionalIndex2<=4;optionalIndex2++){if(formElements["optionalsection"+optionalIndex1+"dropdown"+optionalIndex2+"_hidden"]!=null){if(formElements["optionalsection"+optionalIndex1+"dropdown"+optionalIndex2+"_hidden"].value!=null){optionalSection[optionalIndex2]=formElements["optionalsection"+optionalIndex1+"dropdown"+optionalIndex2+"_hidden"].value+"=";theForm.action=theForm.action+"&"+optionalSection[optionalIndex2];var tempValue;var optionalSectionUrl;tempValue=formElements["optionalsection"+optionalIndex1+"dropdown"+optionalIndex2];optionalSectionUrl=tempValue.options[tempValue.selectedIndex].value;theForm.action=theForm.action+optionalSectionUrl;}
else{break;}}}}
if(formElements["textfield"]!=null){var cftextPostcode=formElements["textboxvalue"].value;cftextPostcode=cftextPostcode.replace(/^\s+|\s+$/g,"");if((cfdefaultText!=null)&&(cfdefaultText.length!=0)){if((cftextPostcode==cfdefaultText)||(cftextPostcode.length==0)){try
{var cferrormsg=theForm.getElementsByTagName("span");for(i=0;i<cferrormsg.length;i++)
{if(cferrormsg[i].className=="cferrormsg")
{cferrormsg[i].innerHTML=cferrorMessage;return false;}}}
catch(e){return false;}}}
theForm.action=theForm.action+"&"+formElements["textfield"].value+"="+cftextPostcode;}
theForm.action=theForm.action+hiddenFieldValue;}
catch(e){return false;}}