
function setYears(yearString){var years_array=yearString.split("=");var count=0;document.lookupform.years.options.length=0;document.lookupform.makes.options.length=0;document.lookupform.models.options.length=0;document.lookupform.years.options[0]=new Option("Select Year","");while(count<years_array.length-1){document.lookupform.years.options[count+1]=new Option(years_array[count],years_array[count]);count++;}}
function setMakes(makeString){var makes_array=makeString.split("=");var count=0;document.lookupform.makes.options.length=0;document.lookupform.models.options.length=0;document.lookupform.makes.options[0]=new Option("Select Make","");while(count<makes_array.length-1){document.lookupform.makes.options[count+1]=new Option(makes_array[count],makes_array[count]);count++;}}
function setModels(modelString){var models_array=modelString.split("`");var count=0;var carNVpair=null;document.lookupform.models.options.length=0;document.lookupform.models.options[0]=new Option("Select Model","");while(count<models_array.length-1){carNVpair=models_array[count].split("=");document.lookupform.models.options[count+1]=new Option(carNVpair[0],carNVpair[1]);count++;}}
function showMakes(){document.getElementById('ymmmakeload').style.display='none';document.getElementById('ymmmake').style.display='block';}
function showModels(){document.getElementById('ymmmodelload').style.display='none';document.getElementById('ymmmodel').style.display='block';}
HTTPRequest=function(){var xmlhttp=null;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(_e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(_E){}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}
return xmlhttp;}
function ask1(url){var http=new HTTPRequest();var result=null;http.open("GET",url,true);http.onreadystatechange=function(){if(http.readyState==4){result=http.responseText;if(-1!=result.search("null")){}else{setMakes(result);setTimeout('showMakes()',1000);}}};http.send(null);}
function ask2(url){var http=new HTTPRequest();var result=null;http.open("GET",url,true);http.onreadystatechange=function(){if(http.readyState==4){result=http.responseText;if(-1!=result.search("null")){}else{setModels(result);setTimeout('showModels()',1000);}}};http.send(null);}
function yearchanged(){document.getElementById('ymmmake').style.display='none';document.getElementById('ymmmakeload').style.display='block';var year=document.lookupform.years[document.lookupform.years.selectedIndex].value;if(year!=null){ask1("yearMakeMake.jsp?year="+year);}else{document.lookupform.makes.options.length=0;document.lookupform.models.options.length=0;}}
function makechanged(){document.getElementById('ymmmodel').style.display='none';document.getElementById('ymmmodelload').style.display='block';var year=document.lookupform.years[document.lookupform.years.selectedIndex].value;var make=document.lookupform.makes[document.lookupform.makes.selectedIndex].value;if(make!=null){ask2("yearMakeModel.jsp?year="+year+"&make="+make);}else{document.lookupform.models.options.length=0;}}
function modelchanged(){var model=document.lookupform.models[document.lookupform.models.selectedIndex].value;if(model!=null){var years=document.lookupform.years;var makes=document.lookupform.makes;var models=document.lookupform.models;var vehiclestring="";vehiclestring=years[years.selectedIndex].text+'!'+makes[makes.selectedIndex].text+'!'+models[models.selectedIndex].text;document.yearMakeSearchActionForm.vehicleString.value=vehiclestring;document.yearMakeSearchActionForm.vehicleID.value=model;document.getElementById('searchStatus').firstChild.nodeValue="Working, Please Wait...";document.yearMakeSearchActionForm.submit();}}
function getNewFact(){document.getElementById('homeFactsBox').style.display='none';document.getElementById('myImage').style.display='inline';ask3("factFinder.jsp?someLongParameter="+new Date().getTime());}
function ask3(url){var http=new HTTPRequest();var result=null;http.open("GET",url,true);http.onreadystatechange=function(){if(http.readyState==4){result=http.responseText;if(-1!=result.search("null")){}
else{setTimeout('setFact(\''+result+'\')',1000);}}};http.send(null);}
function setFact(fact){if(fact!=''){document.getElementById('homeFactsBox').firstChild.nodeValue=fact.replace(/!!!-!!/g,"\'");}
document.getElementById('myImage').style.display='none';document.getElementById('homeFactsBox').style.display='block';}