jQuery.extend({historyCurrentHash:undefined,historyCallback:undefined,historyInit:function(A){jQuery.historyCallback=A;
var C=location.hash;jQuery.historyCurrentHash=C;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 B=D.contentWindow.document;B.open();B.close();B.location.hash=C;
}else{if($.browser.safari){jQuery.historyBackStack=[];jQuery.historyBackStack.length=history.length;
jQuery.historyForwardStack=[];jQuery.isFirst=true;}}jQuery.historyCallback(C.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 A=$("#jQuery_history")[0];
var B=A.contentDocument||A.contentWindow.document;var D=B.location.hash;if(D!=jQuery.historyCurrentHash){location.hash=D;
jQuery.historyCurrentHash=D;jQuery.historyCallback(D.replace(/^#/,""));}}else{if($.browser.safari){if(!jQuery.dontCheck){var E=history.length-jQuery.historyBackStack.length;
if(E){jQuery.isFirst=false;if(E<0){for(var C=0;C<Math.abs(E);C++){jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());
}}else{for(var C=0;C<E;C++){jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());
}}var F=jQuery.historyBackStack[jQuery.historyBackStack.length-1];if(F!=undefined){jQuery.historyCurrentHash=location.hash;
jQuery.historyCallback(F);}}else{if(jQuery.historyBackStack[jQuery.historyBackStack.length-1]==undefined&&!jQuery.isFirst){if(document.URL.indexOf("#")>=0){jQuery.historyCallback(document.URL.split("#")[1]);
}else{var D=location.hash;jQuery.historyCallback("");}jQuery.isFirst=true;}}}}else{var D=location.hash;
if(D!=jQuery.historyCurrentHash){jQuery.historyCurrentHash=D;jQuery.historyCallback(D.replace(/^#/,""));
}}}},historyLoad:function(E){var C;if(jQuery.browser.safari){C=E;}else{C="#"+E;location.hash=C;
}jQuery.historyCurrentHash=C;if((jQuery.browser.msie)&&(jQuery.browser.version<8)){var A=$("#jQuery_history")[0];
var B=A.contentWindow.document;B.open();B.close();B.location.hash=C;jQuery.historyCallback(E);
}else{if(jQuery.browser.safari){jQuery.dontCheck=true;this.historyAddHistory(E);var D=function(){jQuery.dontCheck=false;
};window.setTimeout(D,200);jQuery.historyCallback(E);location.hash=C;}else{jQuery.historyCallback(E);
}}}});
$(document).ready(function(){BindDocumentReady();});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).delay(20,function(){$("#kbbmanufacturer,#kbbmodel,#ddlRange").change(function(){$("#searchForm").submit();
});});}function DefaultMake(){$("#kbbmanufacturer").ncmakemodel("#kbbmodel",function(){if(selectedModel&&selectedModel.length>0){$(this).delay(1,function(){searchOptions($("#kbbmodel"),selectedModel[0].Value);
});}});if(selectedMake&&selectedMake.length>0){$(this).delay(1,function(){searchOptions($("#kbbmanufacturer"),selectedMake[0].Value);
$("#kbbmanufacturer").change();});}}var selectedVehicles=new Array();var initialLoad=true;
function addRemoveListingId(A){var B=$(A).is(":checked");var C=$(A).val();var D=($.inArray(C,selectedVehicles)!=-1);
switch($(A).is(":checked")){case true:if(selectedVehicles.length>=10&&!D){alert("Please select 10 or less vehicles.");
$(A).attr("checked",false);}else{if(!D){selectedVehicles.push(C);}}break;case false:selectedVehicles=$.grep(selectedVehicles,function(E){return(E!=C);
});break;}}function closeOverlay(A){$("#FDPQOverlayContainer").jqmHide();if(A){clearCheckBox();
}}function clearCheckBox(){selectedVehicles=new Array();$("div.inventoryCheckbox input:checkbox").attr("checked",false);
}function initCheckboxes(){$.each($("div.inventoryCheckbox input:checkbox"),function(){if($.inArray($(this).val(),selectedVehicles)!=-1){$(this).attr("checked",true);
}addRemoveListingId(this);});}function pageload(B){if(B&&B.indexOf("xpg")!=-1){var D=parseInt(B.replace("xpg",""));
var C=parseInt($(".pagerLink").attr("xtp"));var A=$(".pagerLink").attr("rel");if(C>=D){if(A.indexOf("?")==-1){A=A+"?p="+D;
}else{A=A+"&p="+D;}}getList(A);}else{if(!initialLoad){getList(location.href);}}}function getList(A){$("#InventorySearchResults #inventoryDisplay").hide();
$("#InventorySearchResults #inventoryLoading").show();try{$.ajax({type:"GET",url:A,timeout:10000,success:function(C){$("#inventoryResults, #DealerInventoryContainer .insertContent").html(C);
$("#InventorySearchResults #inventoryDisplay").show();$("#InventorySearchResults #inventoryLoading").hide();
initCheckboxes();reSubmitOmniture(s_pageName,"","");reloadLeaderboard();reloadSkyscraper();
if(!initialLoad){BindDocumentReady();}reloadLegalDisclaimer();},error:function(D,C,E){location.href=A;
}});}catch(B){location.href=A;}}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).attr("checked",true);
addRemoveListingId($(A));fdpqOverlay();}function reloadLegalDisclaimer(){if($("#iframeLegalDisclaimer")){$("#iframeLegalDisclaimer").html("");
$("#iframeLegalDisclaimer").attr("src","/NewCarInventory/LegalDisclaimer");}}
