function FillModels(f,a,b,k,d,l,h){if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){try{http_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(g){}}}}for(j=d.length;j>=0;j--){d.options[j]=null}d.options[0]=new Option("Loading...","0");var c=f+"dealers-web/Ajax/MakeModelAjax.aspx?request="+h+"&year="+a+"&make="+b+"&makeID="+k;http_request.onreadystatechange=function(){alertContents_models(http_request,d)};if(l=="Microsoft Internet Explorer"){l="ie"}if(l=="ie"){http_request.open("POST",c,true)}else{http_request.open("GET",c,true)}http_request.send(null)}function alertContents_models(g,f){if(g.readyState==4){if(g.status==200){try{f.disabled=false;for(j=f.length;j>=0;j--){f.options[j]=null}var a=g.responseText.split("@");for(i=0;i<a.length;i++){arr_=a[i].split("|");var c=document.createElement("option");c.text=arr_[0];c.value=arr_[1];try{f.add(c,null)}catch(b){f.add(c)}}}catch(d){alert("Exception name is "+d.name+" and Message is "+d.message)}}}};function EnterKeyValidateRedirect(c,f,b,g,d,a){if(!c){c=window.event||event}if(c.keyCode==13||c.which==13){return ValidateRedirect(f,b,g,d,a)}}function ValidateRedirect(d,b,e,c,a){if(e.value=="0"){alert("Make not selected");return false}else{if(c.length<1){alert("Model not selected");return false}else{if(c.options[c.selectedIndex].text=="--Select Model--"){alert("Model not selected");return false}else{if(c.value=="0"){alert("Model not selected");return false}else{if(a.value==""||a.value=="enter zip"){alert("Please enter valid zip code");a.value="";a.focus();return false}else{if(a.value>0){return Redirect(d,b,e.options[e.selectedIndex].text,c.options[c.selectedIndex].text,a.value)}else{alert("Please enter valid zip code");a.value="";a.focus();return false}}}}}}}function Redirect(f,e,b,d,c){if(c>0){var a=ValidateZip(c,f,e,b,d);if(a!="false"){location.href=a;return false}else{alert("Please enter valid zip code");return false}}else{alert("Please enter valid zip code");return false}return false}function EnterKeyRedirect(f,g,d,a,c,b){if(!f){f=window.event||event}if(f.keyCode==13){return Redirect(g,d,a,c,b)}};function addText(a){if(a.value==""){a.value="Zip Code"}}function clearText(a){if(!(a.value>0)){a.value=""}};function ValidateZip(f,g,d,a,c){var i=false;if(window.XMLHttpRequest){i=new XMLHttpRequest();if(i.overrideMimeType){i.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{i=new ActiveXObject("Msxml2.XMLHTTP")}catch(h){try{i=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){}}}}c=c.replace("&",".and.");var b=g+"dealers-web/ajax/ProcessStep2.aspx?request=validatezip&zipcode="+f+"&Make="+a+"&Model="+c;if(d=="ie"){i.open("POST",b,false)}else{i.open("GET",b,false)}i.send(null);return alertContentsValidateZipYear(i)}function alertContentsValidateZipYear(b){if(b.readyState==4){if(b.status==200){try{return b.responseText}catch(a){}}}}function ValidateZipOnlyRequest(c,d,b){var g=false;if(window.XMLHttpRequest){g=new XMLHttpRequest();if(g.overrideMimeType){g.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{g=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{g=new ActiveXObject("Microsoft.XMLHTTP")}catch(f){}}}}var a=d+"dealers-web/ajax/ValidateZip.aspx?returnUrl=false&zip="+c;if(b=="Microsoft Internet Explorer"){b="ie"}if(b=="ie"){g.open("POST",a,false)}else{g.open("GET",a,false)}g.send(null);return ValidateZipOnlyResponse(g)}function ValidateZipOnlyResponse(b){if(b.readyState==4){if(b.status==200){try{if(b.responseText.toLowerCase()!="false"){return"true"}else{return"false"}}catch(a){alert("INVALID ZIPCODE!");return false}}}}function ValidateDealerZip(c,d,b){if(c.value==""||c.value=="enter zip"){alert("Please enter valid zip code");return false}else{if(c.length<5){alert("Please enter valid zip code");return false}else{var a=ValidateZipOnlyRequest(c,d,b);if(a=="true"){return true}else{alert("Please enter valid zip code");return false}}}}function ValidateZipOnEnter(d,b,c,a){if(!d){d=window.event||event}if(d.keyCode==13||d.which==13){return ValidateDealerZip(b,c,a)}};function EnterKeygetUrl(d,c,g,f,a,b){if(!d){d=window.event||event}if(d.keyCode==13){return getUrl(c,g,f,a,b)}}function getUrl(d,g,e,b,c){if(g.value=="0"){alert("Make not selected");return false}else{if(e.length<1){alert("Model not selected");return false}else{if(e.options[e.selectedIndex].text=="--Select Model--"){alert("Model not selected");return false}else{if(e.value=="0"){alert("Model not selected");return false}else{if(b.value==""||b.value=="enter zip"){alert("Please enter valid zip code");b.value="";b.focus();return false}else{if(b.value>0){var a=ValidateZipOnlyRequest(b.value,d,c);if(a=="true"){var f=e.options[e.selectedIndex].text.replace(" & ",".And.");window.location=d+"cars/used/result.aspx?ddlMake="+g.options[g.selectedIndex].text+"&ddlModel="+f+"&ddlDistance=50&ddlPrice=All&zipCode="+b.value;return false}else{alert("Please enter valid zip code");b.value="";b.focus();return false}}else{alert("Please enter valid zip code");b.value="";b.focus();return false}}}}}}};function open_win(a){window.open(a,"welcome","width=595,height=500")}function open_window(c){var b=navigator.appName.toLowerCase();var d=600;var a=700;var f=(screen.width-d)/2;var e=(screen.height-a)/2;var g="width="+d+", height="+a;g+=", top="+e+", left="+f;if(b=="Microsoft Internet Explorer".toLowerCase()){newwin=window.open(c,"welcome",g+",status=yes,scrollbars=yes,resizable=yes");return false}else{window.open(c,"welcome",g+",status=1,scrollbars=1,resizable=1");return false}return false};function CollapsePanel(a){var b=document.getElementById(a);if(b.style.display==""){b.style.display="none"}else{b.style.display=""}};function ValidateOnKeyUp(b,a,c){if(!c){c=window.event||event}if(c.keyCode==13){return ValidateZIPCode(b,a)}}function ValidateZIPCode(c,b){var g=false;if(window.XMLHttpRequest){g=new XMLHttpRequest();if(g.overrideMimeType){g.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{g=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{g=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){}}}}if(!g){}var a=document.getElementById("zipcode").value;if(a==null||a==""||trim(a)==""){alert("Please enter zip code.");return false}if(document.getElementById("ddlMake").value=="none"){alert("Please select a car make");return false}if(document.getElementById("ddlModel").value=="none"){alert("Please select a car model");return false}var f=b;b=b+"dealers-web/Ajax/Server.aspx?request=validatezip&zipcode="+a;if(c=="IE"){g.open("POST",b,false)}else{g.open("GET",b,false)}g.send(null);return alertContents(g,f,a,document.getElementById("ddlMake").value,document.getElementById("ddlModel").value)}function trim(a){return a.replace(/^\s+|\s+$/g,"")}function alertContents(e,d,c,a,b){if(e.readyState==4){if(e.status==200){if(e.responseText=="False"){alert("INVALID ZIPCODE!");return false}else{window.parent.location.href=d+ReplaceSpaceForQuote(a)+"/"+ReplaceSpaceForQuote(b)+"/"+c+"/quote.html";return true}}}}function CastVote(j,c,g,f,d,i,b){var a=false;if(window.XMLHttpRequest){a=new XMLHttpRequest();if(a.overrideMimeType){a.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(h){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(h){}}}}if(!a){}if(i!=null&&i!=""){c=c+"dealers-web/Ajax/Server.aspx?request=cast_vote&dealerId="+j+"&operationType="+f+"&zipcode="+i+"&make="+b}else{if(d!=""&&d!=null){c=c+"dealers-web/Ajax/Server.aspx?request=cast_vote&dealerId="+j+"&operationType="+f+"&city="+d+"&make="+b}}a.onreadystatechange=function(){alertContents_(a)};if(g=="IE"){a.open("POST",c,true)}else{a.open("GET",c,true)}a.send(null)}function alertContents_(b){if(b.readyState==4){if(b.status==200){if(b.responseText=="false"){return false}else{var a=b.responseText.split("@");document.getElementById("spnTabVote").innerHTML=a[0]+"&nbsp;";document.getElementById("spanTopDealers").innerHTML=(a[1]=="")?"":a[1];return true}}}}function ReplaceSpace(c){try{c=c.toLowerCase();var a=c.indexOf(" ");while(a!=-1){c=c.replace(" ","-");a=c.indexOf(" ")}a=c.indexOf(".");while(a!=-1){c=c.replace(".","-");a=c.indexOf(" ")}a=c.indexOf("&");while(a!=-1){c=c.replace("&","And");a=c.indexOf("&")}a=c.indexOf("/");while(a!=-1){c=c.replace("/","-");a=c.indexOf("/")}}catch(b){}return c}function ReplaceSpaceForQuote(c){try{var a=c.indexOf(" ");while(a!=-1){c=c.replace(" ","-");a=c.indexOf(" ")}a=c.indexOf("&");while(a!=-1){c=c.replace("&","And");a=c.indexOf("&")}}catch(b){}return c}function DecodeDealer(b){try{index=b.indexOf("#");while(index!=-1){b=b.replace("####","'");index=b.indexOf("#")}}catch(a){}return b}function trimAll(a){while(a.substring(0,1)==" "){a=a.substring(1,a.length)}while(a.substring(a.length-1,a.length)==" "){a=a.substring(0,a.length-1)}return a}function AddRemarks(g,b,a,c){if(document.getElementById("txtRemarks").value==""){alert("Please write the remarks to add.");return false}else{if(document.getElementById("txtRemarks").value.length<10){alert("Not enough text for remarks.");return false}else{if(document.getElementById("txtRemarks").value.length>=1000){alert("More than 1000 characters are not allowed for remarks.");return false}}}var f=false;if(window.XMLHttpRequest){f=new XMLHttpRequest();if(f.overrideMimeType){f.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{f=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{f=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){}}}}if(!f){}b=b+"dealers-web/Ajax/Server.aspx?request=add_remarks&editUrl="+c+"&dealerId="+g+"&remarks="+escape(document.getElementById("txtRemarks").value);f.onreadystatechange=function(){AddRemarksResponse(f)};if(a=="IE"){f.open("POST",b,true)}else{f.open("GET",b,true)}f.send(null)}function AddRemarksResponse(b){if(b.readyState==4){if(b.status==200){if(b.responseText!="false"){var a=document.getElementById("dealership-testimonials");if(b.responseText==""){alert("You have already added reviews.");return false}a.innerHTML="";a.innerHTML=b.responseText;document.getElementById("txtRemarks").value="";return true}else{document.getElementById("txtRemarks").value="";return false}}}}function openGMapPopup(c){var b=navigator.appName.toLowerCase();var d=455;var a=350;var f=(screen.width-d)/2;var e=(screen.height-a)/2;var g="width="+d+", height="+a;g+=", top="+e+", left="+f;if(b=="Microsoft Internet Explorer".toLowerCase()){newwin=window.open(c,null,g+",height=350,width=455,status=yes,toolbar=no,menubar=no,location=no");if(window.focus){newwin.focus()}}else{window.open(c,null,g+",height=350,width=455,status=1,toolbar=0,menubar=0,location=0");if(window.focus){newwin.focus()}}return false}function GoToDealerPage(d,h,c,f,l,g,b,k,i){var a=false;if(window.XMLHttpRequest){a=new XMLHttpRequest();if(a.overrideMimeType){a.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(j){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(j){}}}}if(!a){}if(l!=null&&g!=""){d=d+"dealers-web/Ajax/Server.aspx?request=GoToDealerPage&state="+c+"&city="+f+"&dealerId="+l+"&dealerName="+DecodeDealer(g)+"&make="+b+"&carAuto="+k+"&newUsed="+i}a.onreadystatechange=function(){DealerPageConfirmed(a)};if(h=="IE"){a.open("POST",d,true)}else{a.open("GET",d,true)}a.send(null)}function DealerPageConfirmed(a){if(a.readyState==4){if(a.status==200){window.location.href=a.responseText;return true}}}function DeleteRemark(c,h,b,f){var a=window.confirm("Are you sure you want to delete this remark?");if(!a){return}var g=false;if(window.XMLHttpRequest){g=new XMLHttpRequest();if(g.overrideMimeType){g.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{g=new ActiveXObject("Msxml2.XMLHTTP")}catch(d){try{g=new ActiveXObject("Microsoft.XMLHTTP")}catch(d){}}}}if(!g){}url=f+"dealers-web/Ajax/Server.aspx?request=delete_remark&remarkId="+c+"&dealerId="+h;g.onreadystatechange=function(){DeleteRemarkResponse(g)};if(b=="IE"){g.open("POST",url,true)}else{g.open("GET",url,true)}g.send(null)}function DeleteRemarkResponse(a){if(a.readyState==4){if(a.status==200){if(a.responseText!="false"){return true}else{document.getElementById("txtRemarks").value="";return false}}}};function PageControler(c,b,r,l,f,d,q){var j=strRecords.split("^");if(j==null||j.length==0||j[0]==""){document.getElementById(q).innerHTML="<div class='T-table' style='padding-left: 10px;'><div class='T-tr'><div class='T-td'><b>No dealer is available in this area.</b></div></div></div>";return}var p=null;var h="";var m=null;pageContainer=new Array();var e=0;var a=0;var o=ReplaceSpace(c);var k=ReplaceSpace(b);var c="";if(o!=null&&o.length>0){c=o+"/"}var n="";if(r!=null&r.length>0){n=r+"/"}if(l!=null&l.length>0){n=l+"/"}for(var g=0;g<j.length;g++){m=String.fromCharCode(65+e);p=j[g].split("@");if(e<PAGE_SIZE-1){e++;if(p[5]==1){h+="<div><img src="+d+'spacer.jpg alt="" width="320" height="5"/></div><div style="padding-left: 5px;"><div style="width: 30px; float:left; padding-top: 15px;"><img alt="" height="38" src="http://maps.google.com/mapfiles/icon'+m+'.png"width="24" style="border: 0 none" id="marker_'+m+'" onmouseover="javascript:this.style.cursor=\'pointer\';" /></div><div style="width:282px; border:1px solid; border-color:#000000; float:left;"><div style="background-color:#ffc804; padding: 8px 5px 8px 5px;"><span class="text007">Featured 5 Star Dealer</span></div> <div style="background-color:#FFFFFF; padding: 5px 5px 0px 5px;"><a  class="fivestarLINK" href="'+f+"car-dealers/"+ReplaceSpace(p[1])+"-"+p[0]+'/">'+p[1]+'</a></div><div style="background-color:#FFFFFF; padding: 5px 5px 5px 5px;"><span class="text008">'+p[2]+", "+p[3]+", "+p[4]+"</span></div></div></div>"}else{h+="<div><img src="+d+'spacer.jpg alt="" width="320" height="5"/></div><div style="padding-bottom: 5px; padding-left: 5px;"><div style="width: 30px; float:left; padding-top: 15px;"><img alt="" height="38" src="http://maps.google.com/mapfiles/icon'+m+'.png"width="24" style="border: 0 none" id="marker_'+m+'" onmouseover="javascript:this.style.cursor=\'pointer\';" /></div><div style="width:282px; float:left;"><div style="background-color:#FFFFFF; padding: 5px 5px 0px 5px;"><a class="fivestarLINK" href="'+f+"car-dealers/"+ReplaceSpace(p[1])+"-"+p[0]+'/">'+p[1]+'</a></div><div style="background-color:#FFFFFF; padding: 5px 5px 5px 5px;"><span class="text008">'+p[2]+", "+p[3]+", "+p[4]+"</span></div></div></div>"}}else{h+="<div><img src="+d+'spacer.jpg alt="" width="320" height="5"/></div><div style="padding-bottom: 5px; padding-left: 5px;"><div style="width: 30px; float:left; padding-top: 15px;"><img alt="" height="38" src="http://maps.google.com/mapfiles/icon'+m+'.png"width="24" style="border: 0 none" id="marker_'+m+'" onmouseover="javascript:this.style.cursor=\'pointer\';" /></div><div style="width:282px; float:left;"><div style="background-color:#FFFFFF; padding: 5px 5px 0px 5px;"><a class="fivestarLINK" href="'+f+"car-dealers/"+ReplaceSpace(p[1])+"-"+p[0]+'/">'+p[1]+'</a></div><div style="background-color:#FFFFFF; padding: 5px 5px 5px 5px;"><span class="text008">'+p[2]+", "+p[3]+", "+p[4]+"</span></div></div></div>";pageContainer[a++]=h;e=0;h=""}}if(e>0&&e<PAGE_SIZE){pageContainer[a++]=h;e=0;h=""}document.getElementById(q).innerHTML=PageManager()}var PAGE_SIZE=8;var pageContainer=new Array();var currentPageIndex=0;function PrevPage(){if(currentPageIndex>0){currentPageIndex=currentPageIndex-1;MoveToPage();SetNextButton();if(currentPageIndex==0){UnsetPrevButton()}}else{UnsetPrevButton()}}function NextPage(){if(currentPageIndex<pageContainer.length-1){currentPageIndex=currentPageIndex+1;MoveToPage();SetPrevButton();if(currentPageIndex==pageContainer.length-1){UnsetNextButton()}}else{UnsetNextButton()}}function MoveToPage(){document.getElementById("GridLocation").innerHTML=pageContainer[currentPageIndex];ShowPageNumber();UpdateHiddendField()}function SetPrevButton(){document.getElementById("aPrev").setAttribute("href","javascript:PrevPage();")}function SetNextButton(){document.getElementById("aNext").setAttribute("href","javascript:NextPage();")}function UnsetPrevButton(){document.getElementById("aPrev").attributes.removeNamedItem("href")}function UnsetNextButton(){document.getElementById("aNext").attributes.removeNamedItem("href")}function ResetIndex(){currentPageIndex=0}function ShowPageNumber(){document.getElementById("PageNoDisplay").innerHTML="( "+(currentPageIndex+1)+" out of "+pageContainer.length+" ) "}function PageManager(){ResetIndex();var b="<div style='text-align:left;height:200px;'>";if(pageContainer[currentPageIndex]!=null&&pageContainer[currentPageIndex]!="undefined"){b+="<div id='GridLocation'>"+pageContainer[currentPageIndex]+"</div>";if(pageContainer.length>1){var a=document.getElementById("hdnFPGlobalImageUrl").value;b+="<img src='"+a+'spacer.jpg\' width="320" height="5"  />';b+="<div id='pageControler' name='pageControler' style='background-color:#F0F0F0; border:thin solid #E1E1E1;text-align:center;'>";b+="<a id='aPrev' name='aPrev' href='javascript:PrevPage();'><< Previous</a>&nbsp;&nbsp;<span id='PageNoDisplay'>( 1 out of "+pageContainer.length+" )</span>&nbsp;&nbsp;<a id='aNext' name='aNext' href='javascript:NextPage();'>Next >></a>";b+="</div>"}}else{}b+="</div>";return b}function UpdateHiddendField(){document.getElementById("hdnCurrentPage").value=currentPageIndex;if(null!=document.getElementById("ddlMake")){document.getElementById("iFrameMap").src=document.getElementById("hdnUrl").value+"GMap.aspx?city="+document.getElementById("hdnCity").value+"&make="+document.getElementById("ddlMake").value}else{document.getElementById("iFrameMap").src=document.getElementById("hdnUrl").value+"GMap.aspx?city="+document.getElementById("hdnCity").value}};function setIframe(a,b){if(document.getElementById("hdnDealersIds").value==""){return}document.getElementById("iFrameMap").src=a+"dealership/GMap.aspx?city="+b+"&make="+document.getElementById("ddlMake").value}function MakeChanged(g,h,d,b,c){var i=false;if(window.XMLHttpRequest){i=new XMLHttpRequest();if(i.overrideMimeType){i.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{i=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{i=new ActiveXObject("Microsoft.XMLHTTP")}catch(f){}}}}if(!i){}document.getElementById("hdnMake").value=g.value;var a=c+"dealers-web/Ajax/Server.aspx?request=dealers_city&city="+h+"&short_state="+d+"&make="+g.value;if(b=="IE"){i.open("POST",a,false)}else{i.open("GET",a,false)}i.send(null);return alertContents_(i)}function alertContents_(b){if(b.readyState==4){if(b.status==200){if(b.responseText=="false"){return false}else{var a=b.responseText.split("|");if(a.length>=4){document.getElementById("hdnDealersIds").value=a[0];document.getElementById("hdnAddress").value=a[1];strRecords=a[2];document.getElementById("tdFullPanel").innerHTML=a[3]}else{document.getElementById("hdnDealersIds").value=""}return true}}}}function onMakeChanged(f,b,d,k,g,h,c,j){if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(i){try{http_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}}}var a=g+"dealers-web/Ajax/Server.aspx?request=GetURL&make="+f.value+"&state="+b+"&city="+d+"&carstyle="+h+"&newused="+c+"&carauto="+j;http_request.onreadystatechange=function(){alertContents_GetURL(http_request)};if(k=="Microsoft Internet Explorer"){k="ie"}if(k=="ie"){http_request.open("POST",a,true)}else{http_request.open("GET",a,true)}http_request.send(null)}function alertContents_GetURL(b){if(b.readyState==4){if(b.status==200){try{document.location.href=b.responseText}catch(a){alert("Exception name is "+a.name+" and Message is "+a.message)}}}}function ReplaceSpace(c){try{var a=c.indexOf(" ");while(a!=-1){c=c.replace(" ","-");a=c.indexOf(" ")}a=c.indexOf("&");while(a!=-1){c=c.replace("&","And");a=c.indexOf("&")}}catch(b){}return c};