jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyInit:function(a){jQuery.historyCallback=a;
var b=location.hash;
jQuery.historyCurrentHash=b;
if((jQuery.browser.msie)&&(jQuery.browser.version<8)){if(jQuery.historyCurrentHash==""){jQuery.historyCurrentHash="#";
}$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');
var d=$("#jQuery_history")[0];
var c=d.contentWindow.document;
c.open();
c.close();
c.location.hash=b;
}else{if($.browser.safari){jQuery.historyBackStack=[];
jQuery.historyBackStack.length=history.length;
jQuery.historyForwardStack=[];
jQuery.isFirst=true;
}}jQuery.historyCallback(b.replace(/^#/,""));
setInterval(jQuery.historyCheck,100);
},historyAddHistory:function(a){jQuery.historyBackStack.push(a);
jQuery.historyForwardStack.length=0;
this.isFirst=true;
},historyCheck:function(){if((jQuery.browser.msie)&&(jQuery.browser.version<8)){var f=$("#jQuery_history")[0];
var e=f.contentDocument||f.contentWindow.document;
var b=e.location.hash;
if(b!=jQuery.historyCurrentHash){location.hash=b;
jQuery.historyCurrentHash=b;
jQuery.historyCallback(b.replace(/^#/,""));
}}else{if($.browser.safari){if(!jQuery.dontCheck){var c=history.length-jQuery.historyBackStack.length;
if(c){jQuery.isFirst=false;
if(c<0){for(var d=0;
d<Math.abs(c);
d++){jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());
}}else{for(var d=0;
d<c;
d++){jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());
}}var a=jQuery.historyBackStack[jQuery.historyBackStack.length-1];
if(a!=undefined){jQuery.historyCurrentHash=location.hash;
jQuery.historyCallback(a);
}}else{if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(document.URL.indexOf("#")>=0){jQuery.historyCallback(document.URL.split("#")[1]);
}else{var b=location.hash;
jQuery.historyCallback("");
}jQuery.isFirst=true;
}}}}else{var b=location.hash;
if(b!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=b;
jQuery.historyCallback(b.replace(/^#/,""));
}}}},historyLoad:function(b){var e;
if(jQuery.browser.safari){e=b;
}else{e="#"+b;
location.hash=e;
}jQuery.historyCurrentHash=e;
if((jQuery.browser.msie)&&(jQuery.browser.version<8)){var d=$("#jQuery_history")[0];
var c=d.contentWindow.document;
c.open();
c.close();
c.location.hash=e;
jQuery.historyCallback(b);
}else{if(jQuery.browser.safari){jQuery.dontCheck=true;
this.historyAddHistory(b);
var a=function(){jQuery.dontCheck=false;
};
window.setTimeout(a,200);
jQuery.historyCallback(b);
location.hash=e;
}else{jQuery.historyCallback(b);
}}}});

$(document).ready(function(){BindDocumentReady();
$("#iframeLegalDisclaimer").contents().find("body").css("background-color","#fff");
});
function BindDocumentReady(){$(".makemodelDropdown").hover(function(){$(this).children("option").each(function(){if($(this).text().length*7>120){$(this).parent().css("width","auto");
}});
},function(){});
$(".makemodelDropdown").blur(function(){$(this).width(120);
});
$(".makemodelDropdown").change(function(){$(this).width(120);
});
DefaultMake();
$(this).timeout(20,function(){$("#kbbmanufacturer,#kbbmodel,#ddlRange").change(function(){$("#searchForm").submit();
});
$("#cpo").click(function(){$("#searchForm").submit();
});
});
$(".cpoSponsOverlay").jqm({modal:true,overlay:75,toTop:true});
}function showCpoSponsorOverlay(a){$(a).siblings(".cpoSponsOverlay:first").jqmShow();
}function hideCpoSponsorOverlay(){$("div.cpoSponsOverlay").jqmHide();
}function DefaultMake(){$("#kbbmanufacturer").ncmakemodel("#kbbmodel",function(){if(selectedModel&&selectedModel.length>0){$(this).timeout(1,function(){searchOptions($("#kbbmodel"),selectedModel[0].Value);
});
}});
if(selectedMake&&selectedMake.length>0){$(this).timeout(1,function(){searchOptions($("#kbbmanufacturer"),selectedMake[0].Value);
$("#kbbmanufacturer").change();
searchOptions($("#kbbmanufacturer"),selectedMake[0].Value);
$("#kbbmanufacturer").change();
});
}}var selectedVehicles=new Array();
var initialLoad=true;
function addRemoveListingId(a){var c=$(a).is(":checked");
var d=$(a).val();
var b=($.inArray(d,selectedVehicles)!=-1);
switch($(a).is(":checked")){case true:if(selectedVehicles.length>=10&&!b){alert("Please select 10 or less vehicles.");
$(a).prop("checked",false);
}else{if(!b){selectedVehicles.push(d);
}}break;
case false:selectedVehicles=$.grep(selectedVehicles,function(e){return(e!=d);
});
break;
}}function closeOverlay(a){$("#FDPQOverlayContainer").jqmHide();
if(a){clearCheckBox();
}}function clearCheckBox(){selectedVehicles=new Array();
$("div.inventoryCheckbox input:checkbox").prop("checked",false);
}function initCheckboxes(){$.each($("div.inventoryCheckbox input:checkbox"),function(){if($.inArray($(this).val(),selectedVehicles)!=-1){$(this).prop("checked",true);
}addRemoveListingId(this);
});
}function pageload(a){if(a&&a.indexOf("xpg")!=-1){var b=parseInt(a.replace("xpg",""));
var c=parseInt($(".pagerLink").attr("xtp"));
var d=$(".pagerLink").attr("rel");
if(c>=b){if(d.indexOf("?")==-1){d=d+"?p="+b;
}else{d=d+"&p="+b;
}}getList(d);
}else{if(!initialLoad){getList(location.href);
}}}function getList(b){$("#InventorySearchResults #inventoryDisplay").hide();
$("#InventorySearchResults #inventoryLoading").show();
try{$.ajax({type:"GET",url:b,timeout:10000,success:function(c){$("#inventoryResults, #DealerInventoryContainer .insertContent").html(c);
$("#InventorySearchResults #inventoryDisplay").show();
$("#InventorySearchResults #inventoryLoading").hide();
initCheckboxes();
fakerefresh();
if(!initialLoad){BindDocumentReady();
}reloadLegalDisclaimer();
},error:function(e,d,c){location.href=b;
}});
}catch(a){location.href=b;
}}initCheckboxes();
$.historyInit(pageload);
$("div.inventoryCheckbox input:checkbox").live("click",function(){addRemoveListingId(this);
});
$('a[rel="contactDealer"]').live("click",function(){if(selectedVehicles.length==0){alert("Please select one or more vehicles using the check boxes on the left");
}else{fdpqOverlay();
}return false;
});
function fdpqOverlay(){$("#FDPQOverlayContainer").jqm({modal:true,overlay:80,toTop:true,onShow:open_fdpqform,onHide:close_fdpqform});
$("#FDPQOverlayContainer").jqmShow();
$('form#formFDPQ input[name="multiVINListingIds"]').val($.map(selectedVehicles,function(b,a){return b.split(",")[0];
}).join(","));
$('form#formFDPQ input[name="multiFranchiseIds"]').val($.map(selectedVehicles,function(b,a){return b.split(",")[1];
}).join(","));
$('form#formFDPQ input[name="manufacturerNames"]').val($.map(selectedVehicles,function(b,a){return b.split(",")[2];
}).join(","));
$('form#formFDPQ input[name="modelNames"]').val($.map(selectedVehicles,function(b,a){return b.split(",")[3];
}).join(","));
$("form#formFDPQ").submit();
}$(".pagerLink").live("click",function(){initialLoad=false;
var a=$(this).attr("xpg");
$.historyLoad(a);
return false;
});
var open_fdpqform=function(a){if($(window).scrollTop()<175){$("html, body").animate({scrollTop:"165px"},0);
}$(".jqmWindow").css("top",$(window).scrollTop()+20);
$("#FDPQOverlayContainer").html("<iframe name='fdpqPopupIframe' scrolling='no' frameborder='0' allowtransparency='true' width='355' height='488'></iframe>");
a.w.show();
};
var close_fdpqform=function(a){$("#FDPQOverlayContainer").empty();
$("#FDPQOverlayContainer").hide();
a.o.remove();
};
function bindEmailDealer(b){clearCheckBox();
var a="#cblead-"+b;
$(a).prop("checked",true);
addRemoveListingId($(a));
fdpqOverlay();
}function reloadLegalDisclaimer(){if($("#iframeLegalDisclaimer")){$("#iframeLegalDisclaimer").html("");
$("#iframeLegalDisclaimer").attr("src","/NewCarInventory/LegalDisclaimer").contents().find("body").css("background-color","#fff");
}}

