var dealersArray = new Array; function AddCarToArray(carId, dealerId) { dealersArray['' + carId + ''] = '' + dealerId + ''; } function ShowFilters() { el = document.getElementById("FiltersBox"); if (el.style.display == "none") { el.style.display= "block"; } else { el.style.display = "none"; } } function showVehicle(url) { window.location = url; } var xmlHttp var xmlHttpIns var xmlHttpInsList var xmlHttpEmail function ShowFinance(did, finStr, fp, fd, fm) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("This browser does not support AJAX.") return } //alert(finStr); var url="getfinanceinfo.asp" dealerId = did; //alert(url); xmlHttp.onreadystatechange=stateChanged xmlHttp.open("Post",url,true) xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttp.setRequestHeader("Content-length", 2); xmlHttp.setRequestHeader("Connection", "close"); xmlHttp.send('did='+did+'&finStr='+finStr+'&fp='+fp+'&fd='+fd+'&fm='+fm+'&mode=vertical'); } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { var divId; var divContent; //alert(xmlHttp.responseText); var xmlDoc=xmlHttp.responseXML.documentElement; var text = xmlDoc.getElementsByTagName("car"); var typApr = xmlDoc.getElementsByTagName("typicalApr")[0].firstChild.nodeValue; for (i = 0; i < text.length; i++) { divId = text[i].getElementsByTagName("divId")[0].firstChild.nodeValue; divContent = text[i].getElementsByTagName("financeText")[0].firstChild.nodeValue; document.getElementById('loading.' + divId).style.display = 'none'; if (divContent.substring(0,3) != "---") {document.getElementById('financeText' + divId).innerHTML = "" + divContent.replace(/###/g,"<").replace(/@@@/g,">") + "";document.getElementById('finance' + divId).className = 'financeVehicle'; //" } else {document.getElementById('financeText' + divId).innerHTML = 'Sorry this package is not available on this vehicle';document.getElementById('finance' + divId).className = "financeVehicleNone";} //document.getElementById('insurance' + divId.replace("HP","").replace("LEASE_PURCHASE","").replace("PCP","")).style.display = 'block'; } document.getElementById("typicalAPR").innerHTML= 'APR: '+typApr+'% Typical'; MakeClassesVisible('finance1'); MakeClassesVisible('finance2'); } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function ShowInsuranceForm() { el = document.getElementById("insuranceBackGround"); el.style.display= "block"; el = document.getElementById("insuranceFormBG"); el.style.display= "block"; HideDropDowns(); window.scrollTo(0,0); } function HideInsurance() { el = document.getElementById("insuranceBackGround"); el.style.display = "none"; el = document.getElementById("insuranceFormBG"); el.style.display = "none"; ShowDropDowns(); } function HideDropDowns() { var x=document.getElementsByTagName("select"); for (i = 0; i < x.length; i++) { if (x[i].id != 'insTitle' && x[i].id != 'insDobDay' && x[i].id != 'insDobMonth' && x[i].id != 'insDobYear' && x[i].id != 'insMileage' && x[i].id != 'insCoverType' && x[i].id != 'insNoClaimsDiscount') { x[i].style.display = 'none'; } } } function ShowDropDowns() { var x=document.getElementsByTagName("select"); for (i = 0; i < x.length; i++) { x[i].style.display = ''; } } function ShowLoadingImg() { if (ValidateInsuranceForm()) { var el = document.getElementById("editingImgDiv"); el.style.display = 'block'; } } function ShowInsurance(capId, year, carId, price, reg, mileage) { if (document.getElementById("insurancesel").innerHTML.indexOf("loading...") > - 1) { xmlHttpIns=GetXmlHttpObjectIns() if (xmlHttpIns==null) { alert ("This browser does not support AJAX.") return } var url="getvehicleinsurancedata.asp?capid="+capId+"&year="+year+"&carid="+carId+"&price="+price+"®="+reg+"&mileage="+mileage+"&sid="+Math.random(); xmlHttpIns.onreadystatechange=stateChangedIns xmlHttpIns.open("get",url,true) xmlHttpIns.send(null) } } function stateChangedIns() { if (xmlHttpIns.readyState==4 || xmlHttpIns.readyState=="complete") { //alert(xmlHttpIns.responseText); document.getElementById("insurancesel").innerHTML= xmlHttpIns.responseText; } } function GetXmlHttpObjectIns() { var xmlHttpIns=null; try { // Firefox, Opera 8.0+, Safari xmlHttpIns=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttpIns=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttpIns=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttpIns; } function ShowInsuranceList(vehiclesList) { //alert(vehiclesList); xmlHttpInsList=GetXmlHttpObjectInsList() if (xmlHttpInsList==null) { alert ("This browser does not support AJAX.") return } var url="getvehicleslistinsurancedata.asp" xmlHttpInsList.onreadystatechange=stateChangedInsList xmlHttpInsList.open("Post",url,true) xmlHttpInsList.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlHttpInsList.setRequestHeader("Content-length", 2); xmlHttpInsList.setRequestHeader("Connection", "close"); xmlHttpInsList.send('vl='+vehiclesList); } function stateChangedInsList() { if (xmlHttpInsList.readyState==4 || xmlHttpInsList.readyState=="complete") { var divId; //alert(xmlHttpInsList.responseText); var xmlDocInsList=xmlHttpInsList.responseXML.documentElement; var text = xmlDocInsList.getElementsByTagName("car"); if (text.length > 0) { for (i = 0; i < text.length; i++) { carId = text[i].getElementsByTagName("carId")[0].firstChild.nodeValue; minIns = text[i].getElementsByTagName("minIns")[0].firstChild.nodeValue; minInsFixedLen = minIns.substring(minIns, minIns.indexOf('.'), minIns.length).length; if (minInsFixedLen == 2) { minIns = String(minIns) + '0'; } minInsCompany = text[i].getElementsByTagName("minInsCompany")[0].firstChild.nodeValue; if ((minIns) == "not available") { document.getElementById('insuranceVehicle' + carId).innerHTML = '