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);
}}}});

(function($){function logw(){if(window.console&&window.console.debug){window.console.log(Array.prototype.join.call(arguments,""));
}}function log(){try{console.log(Array.prototype.join.call(arguments,""));
}catch(e){}}PhotoGalleryType={ALL:0,EXTERIOR:1,INTERIOR:2,PHOTOS:3,OEM:4};
$.fn.photogallery=function(options){var defaults={Exterior:[],Interior:[],Photos:[],Type:PhotoGalleryType.ALL,HashId:"123456789",ThumbsNumber:4,ThumbsJump:false,DotsJump:false,classControlsContainer:"controlsContainer",classControls:"slideshowControls",classFwd:"btnforward",classRew:"btnrewind",classPlay:"btnplay",classFwdDisabled:"btnforwardDisabled",classRewDisabled:"btnrewindDisabled",classPause:"btnpause",classDotsJump:"dotImageGalleryJump",classDotsJumpDisabled:"dotImageGalleryJumpDisabled",classThumbFwd:"btnSkipForward",classThumbRew:"btnSkipRewind",classThumbFwdDisabled:"btnSkipForwardDisabled",classThumbRewDisabled:"btnSkipRewindDisabled",classTxtNotActual:"txtNotActual",classImageTypeSelection:"imageTypeSelection",classCurrentImage:"currentImage",classImageMain:"imageMain",classThumbsContainer:"thumbsContainer",classThumbImageSelected:"thumbImageSelected",classTypeSelected:"typeSelected",classTypeLink:"typeLink",classPLSlideShowControls:"pLSlideShowControls",link360:"",linkVideo:"",linkOverviewPricing:"",classLinks:"mainhublinks",aboutUsDivId:"",showLinks:true,showTopLinks:false,showNumberOf:true,showNumberOfTop:false,showHubLinks:true,showNotActualText:false,showControls:true,showImageControls:false,showThumbs:true,showSwatches:false,showSpeedLinks:false,scrollThumb:false,swatches:"",timer:null,playslideshow:false,playtimeout:3000,playtimeoutslow:7000,playtimeoutmedium:5000,playtimeoutfast:3000,doAdOmnitureUpdate:true,imageCount:0,pagename:s.pageName,currentIndex:0,startIndex:0,triggerElementId:"",AdRefreshRate:0,AdRefreshRateSlow:0,AdRefreshRateMedium:0,AdRefreshRateFast:0,isShowcase:false,callPNGfix:false,showPlayButton:false,refreshOnLinks:false,refreshOnPlay:false,LogPartnerLink:false,PartnerlinkPlay:"",PartnerlinkPlayRedButton:"",PartnerlinkScroll:"",PartnerlinkViewDetail:"",exteriorHref:"javascript:void(0);",interiorHref:"javascript:void(0);",allHref:"javascript:void(0);",oemHref:"javascript:void(0);",oemText:"",oemPartnerName:"",fullScreenLink:"",thumbscontainer:"",overlayClass:"pauseSlideShow",autoPlayToLoop:-1};
var opts=$.extend(defaults,options);
if(opts.Exterior==null){opts.Exterior=[];
}if(opts.Interior==null){opts.Interior=[];
}if(opts.Photos==null){opts.Photos=[];
}return this.each(function(){init($(this),opts);
});
};
function setPhotos(opts){if(opts.Type==PhotoGalleryType.ALL){if(opts.Interior.length>0&&opts.Exterior.length>0){opts.Photos=opts.Exterior.slice(0).concat(opts.Interior);
}else{if(opts.Interior.length<=0&&opts.Exterior.length>0){opts.Photos=opts.Exterior.slice(0);
}else{if(opts.Interior.length>0&&opts.Exterior.length<=0){opts.Photos=opts.Interior.slice(0);
}}}}if(opts.Type==PhotoGalleryType.EXTERIOR){if(opts.Exterior.length>0){opts.Photos=opts.Exterior.slice(0);
}}if(opts.Type==PhotoGalleryType.INTERIOR){if(opts.Interior.length>0){opts.Photos=opts.Interior.slice(0);
}}}function triggerEvent(opts){if(opts.triggerElementId!=""&&opts.triggerElementId!=null){$("#"+opts.triggerElementId).click();
}}function resetControls(opts){if(((opts.Photos.length>1)||((opts.Exterior.length+opts.Interior.length)>1))&&(opts.showControls==true)){$("#mainControls"+opts.HashId).html('<div id="controls'+opts.HashId+'" class="'+opts.classControls+'"><a id="rew'+opts.HashId+'" class="'+opts.classRewDisabled+'" href="javascript:void(0);"><span> </span></a><a id="playpause'+opts.HashId+'" class="'+opts.classPlay+'" href="javascript:void(0);"><span> </span></a><a id="fwd'+opts.HashId+'" class="'+opts.classFwd+'" href="javascript:void(0);"><span> </span></a></div>');
setplaypause(opts);
}}function preloader(opts){if(opts.Photos.length>0){var imgbox=document.createElement("div");
$(imgbox).css({display:"none"});
$("body").append(imgbox);
$.each(opts.Photos,function(ind,item){var img=document.createElement("img");
$(img).attr("src",item.Url);
$(imgbox).append(img);
var imgt=document.createElement("img");
$(imgt).attr("src",item.ThumbUrl);
$(imgbox).append(imgt);
});
}}function init(othis,opts){opts.container=this;
setPhotos(opts);
if(opts.showTopLinks==true){ShowINTEXTLinks(opts,othis,"imageTypesTop","typeExteriorTop","typeInteriorTop","typeAllTop","typeOemTop",true);
}if(opts.Photos.length>0){othis.append('<div class="mainImageContainer" id="mainImageContainer'+opts.HashId+'"></div>');
if(opts.showImageControls&&opts.Photos.length>1){$("#mainImageContainer"+opts.HashId).append("<div class='btnPrevContainer'><a id='imageBtnPrev"+opts.HashId+"' class='"+opts.classRewDisabled+"' href='javascript:void(0);'><span></span></a></div");
}if(opts.isShowcase){if(opts.showPlayButton==true){$("#mainImageContainer"+opts.HashId).append('<div id="showcaseBanner"><span>SHOWCASE DEALER</span></div><div class="mainImageContainerInner" id="mainImageContainerInner'+opts.HashId+'"><div class="showcaseBannerSlice"></div></div>');
$("#mainImageContainerInner"+opts.HashId).append('<div id="mainImageWithButton"><img id="mainImage'+opts.HashId+'"/><div id="mainButton'+opts.HashId+'" class="mainButton play" style="display: block"><div class="play"></div><div class="pause"></div></div></div>');
if(opts.playslideshow){$("#mainButton"+opts.HashId+" .play").hide();
$("#mainButton"+opts.HashId+" .pause").hide();
}}else{$("#mainImageContainer"+opts.HashId).append('<div id="showcaseBanner"><span>SHOWCASE DEALER</span></div><div class="mainImageContainerInner" id="mainImageContainerInner'+opts.HashId+'"><div class="showcaseBannerSlice"></div></div>');
$("#mainImageContainerInner"+opts.HashId).append('<img id="mainImage'+opts.HashId+'"/>');
}}else{if(opts.showPlayButton==true){$("#mainImageContainer"+opts.HashId).append('<div id="mainImageWithButton"><img id="mainImage'+opts.HashId+'"/><div id="mainButton'+opts.HashId+'" class="mainButton play" style="display: block"><div class="play"></div><div class="pause"></div></div></div>');
if(opts.Photos.length<=1){$("#mainButton"+opts.HashId+" .play").hide();
$("#mainButton"+opts.HashId+" .pause").hide();
}if(opts.playslideshow){$("#mainButton"+opts.HashId+" .play").hide();
$("#mainButton"+opts.HashId+" .pause").hide();
}}else{$("#mainImageContainer"+opts.HashId).append('<img id="mainImage'+opts.HashId+'"/>');
}}ShowMainImage(opts,0,0);
if(opts.showImageControls&&opts.Photos.length>1){$("#mainImageContainer"+opts.HashId).append("<div class='btnNextContainer'><a id='imageBtnNext"+opts.HashId+"' class='"+opts.classFwdDisabled+"' href='javascript:void(0);'><span></span></a></div");
}}if(opts.showNotActualText){othis.append('<br><span id="txtNotActual'+opts.HashId+'" class="'+opts.classTxtNotActual+'">Not Actual Vehicle Photo</span>');
}if(opts.aboutUsDivId!=""){othis.append($("#"+opts.aboutUsDivId).html());
}othis.append("<br/>");
if(opts.Photos.length>0){$("#mainImage"+opts.HashId).addClass(opts.classImageMain).attr("meta:selectid",0).attr("meta:index",0);
}if(opts.Photos.length>1){othis.append('<div id="mainControls'+opts.HashId+'" class="'+opts.classControlsContainer+'"></div');
}$("#mainControls"+opts.HashId).html();
if(opts.showNumberOfTop){$("#mainControls"+opts.HashId).append('<div class="'+opts.classCurrentImage+'"><span id="lblCurrentImageTop'+opts.HashId+'" class="body_01"></span></div>');
}if(opts.fullScreenLink!=""){$("#mainControls"+opts.HashId).append(opts.fullScreenLink);
}if(((opts.Photos.length>1)||(opts.Type==PhotoGalleryType.OEM&&(opts.Exterior.length+opts.Interior.length)>1))&&(opts.showControls==true)){$("#mainControls"+opts.HashId).append('<div id="controls'+opts.HashId+'" class="'+opts.classControls+'"><a id="rew'+opts.HashId+'" class="'+opts.classRewDisabled+'" href="javascript:void(0);"><span> </span></a><a id="playpause'+opts.HashId+'" class="'+opts.classPlay+'" href="javascript:void(0);"><span> </span></a><a id="fwd'+opts.HashId+'" class="'+opts.classFwd+'" href="javascript:void(0);"><span> </span></a></div>');
}if(opts.showSpeedLinks&&opts.Photos.length>1){opts.playtimeout=opts.playtimeoutmedium;
$("#mainControls"+opts.HashId).append('<div id="mainSpeedControls'+opts.HashId+'" class="'+opts.classControlsContainer+'"><span>Speed: </span><a id="slow'+ +opts.HashId+'" href="javascript:void(0);"><span>Slow</span></a> | <a class="blackLabel isActive" id="medium'+ +opts.HashId+'" href="javascript:void(0);"><span>Medium</span></a> | <a id="fast'+ +opts.HashId+'" href="javascript:void(0);"><span>Fast</span></a></div>');
$("#slow"+opts.HashId).unbind("click").click(function(){opts.playtimeout=opts.playtimeoutslow;
if(opts.AdRefreshRateSlow>0){opts.AdRefreshRate=opts.AdRefreshRateSlow;
}$(this).addClass("blackLabel isActive");
$("#medium"+opts.HashId).removeClass("blackLabel").removeClass("isActive");
$("#fast"+opts.HashId).removeClass("blackLabel").removeClass("isActive");
});
$("#medium"+opts.HashId).unbind("click").click(function(){opts.playtimeout=opts.playtimeoutmedium;
if(opts.AdRefreshRateMedium>0){opts.AdRefreshRate=opts.AdRefreshRateMedium;
}$(this).addClass("blackLabel isActive");
$("#slow"+opts.HashId).removeClass("blackLabel").removeClass("isActive");
$("#fast"+opts.HashId).removeClass("blackLabel").removeClass("isActive");
});
$("#fast"+opts.HashId).unbind("click").click(function(){opts.playtimeout=opts.playtimeoutfast;
if(opts.AdRefreshRateFast>0){opts.AdRefreshRate=opts.AdRefreshRateFast;
}$(this).addClass("blackLabel isActive");
$("#slow"+opts.HashId).removeClass("blackLabel").removeClass("isActive");
$("#medium"+opts.HashId).removeClass("blackLabel").removeClass("isActive");
});
}if(opts.showSwatches){othis.append('<div id="mainSwatchesControls'+opts.HashId+'" class="'+opts.classControlsContainer+'"></div');
$("#mainSwatchesControls"+opts.HashId).html(opts.swatches);
}if(opts.showLinks){ShowINTEXTLinks(opts,othis,"imageTypes","typeExterior","typeInterior","typeAll","typeOem",false);
}if(opts.showImageControls&&opts.Photos.length<=1){opts.showNumberOf=false;
}if(opts.showNumberOf){othis.append('<div class="'+opts.classCurrentImage+'"><span id="lblCurrentImage'+opts.HashId+'" class="body_01"></span></div>');
}if(opts.playslideshow){opts.autoPlayToLoop=opts.Photos.length+1;
start(opts);
$("#mainButton"+opts.HashId).removeClass("pause").addClass("play").hide();
$("#mainButton"+opts.HashId+" .play").hide();
$("#mainButton"+opts.HashId+" .pause").show();
}if(opts.Photos.length<=1){$("#mainButton"+opts.HashId+" .play").hide();
$("#mainButton"+opts.HashId+" .pause").hide();
}if(opts.showThumbs){if(opts.Photos.length>0){othis.append("");
othis.append('<div class="'+opts.classThumbsContainer+'Header" ><div class="left"></div><div class="middle"></div><div class="right"></div></div><div id="thumbImages'+opts.HashId+'" class="'+opts.classThumbsContainer+'"></div><div class="'+opts.classThumbsContainer+'Footer" ><div class="left"></div><div class="middle"></div><div class="right"></div></div>');
var oothis;
if(opts.thumbscontainer==""){oothis=$("#thumbImages"+opts.HashId);
}else{oothis=$("#"+opts.thumbscontainer);
}$(oothis).html("");
InitThumbs(opts);
}}if(opts.showHubLinks){var olnkOverviewPricing="";
var olnkVideo="";
var olnk360="";
var cssVideoDisabled="";
var cssOverviewPricingDisabled="";
var css360Disabled="";
if(opts.linkVideo==""){olnkVideo=' disabled="disabled" ';
cssVideoDisabled=" disabled";
}else{olnkVideo=' href="'+opts.linkVideo+'"';
}if(opts.linkOverviewPricing==""){olnkOverviewPricing=' disabled="disabled" ';
cssOverviewPricingDisabled=" disabled";
}else{olnkOverviewPricing=' href="'+opts.linkOverviewPricing+'"';
}if(opts.link360==""){olnk360=' disabled="disabled" ';
css360Disabled=" disabled";
}else{olnk360=' href="'+opts.link360+'"';
}othis.append('<div class="'+opts.classLinks+'" id="links'+opts.HashId+'"><a '+olnk360+' class="link_circle_arrow_blue fL ml15'+css360Disabled+'" id="lnk360View'+opts.HashId+'">360&deg; Views</a><a '+olnkVideo+' class="link_circle_arrow_blue fL ml15'+cssVideoDisabled+'" id="lnkVideo'+opts.HashId+'">Video</a><a '+olnkOverviewPricing+' class="link_circle_arrow_blue fL ml5'+cssOverviewPricingDisabled+'" id="lnkOverviewAndPricing'+opts.HashId+'">Overview & Pricing</a></div>');
}setplaypause(opts);
if(opts.startIndex>0&&opts.Type==PhotoGalleryType.OEM&&opts.Photos.length>opts.startIndex){$("#mainImage"+opts.HashId).addClass(opts.classImageMain).attr("src",opts.Photos[opts.startIndex].Url).attr("meta:selectid",opts.startIndex).attr("meta:index",opts.startIndex);
if(opts.Photos[opts.startIndex].AlternateTxt){$("#mainImage"+opts.HashId).attr("alt",opts.Photos[opts.startIndex].AlternateTxt);
}$("#thumbImage"+opts.HashId+"_0").removeClass(opts.classThumbImageSelected);
$("#thumbImage"+opts.HashId+"_"+opts.startIndex).addClass(opts.classThumbImageSelected);
setControls(opts.startIndex,opts.startIndex,opts);
}else{setControls(0,0,opts);
}preloader(opts);
if(opts.Photos.length<=0){$("#photoSlideShow").hide();
}}function ShowMainImage(opts,idx,sid){$("#mainImage"+opts.HashId).attr("src",opts.Photos[sid].Url).attr("meta:index",idx).attr("meta:selectid",sid);
if(opts.Photos[sid].AlternateTxt){$("#mainImage"+opts.HashId).attr("alt",opts.Photos[sid].AlternateTxt);
}}function InitThumbs(opts){var oothis;
if(opts.thumbscontainer==""){oothis=$("#thumbImages"+opts.HashId);
}else{oothis=$("#"+opts.thumbscontainer);
}$(oothis).html("");
ShowPrevJump(opts,oothis);
if(opts.Type==PhotoGalleryType.PHOTOS){for(i=0;
i<opts.Photos.length;
i++){AddImage(opts,oothis,i,i);
if(((i+1)%(opts.ThumbsNumber))==0){oothis.append("<br/>");
}}}else{for(i=0;
i<opts.ThumbsNumber;
i++){if(i<opts.Photos.length){AddImage(opts,oothis,i,i);
}}}ShowNextJump(opts,oothis);
ShowDotsJump(opts,oothis);
}function ShowINTEXTLinks(opts,othis,imageTypes,typeExterior,typeInterior,typeAll,typeOem,isTop){var exteriorDisabled=' disabled="disabled"';
var interiorDisabled=' disabled="disabled"';
var allDisabled=' disabled="disabled"';
if(opts.Exterior.length>0){exteriorDisabled="";
}if(opts.Interior.length>0){interiorDisabled="";
}if(opts.Exterior.length>0||opts.Interior.length>0){allDisabled="";
}if(isTop){classImageTypeSelection="imageTypeSelection noborder";
}else{classImageTypeSelection=opts.classImageTypeSelection;
}var oemLink="";
if(opts.oemText!=""){oemLink='<span class="body_01"> | </span><a class="'+opts.classTypeLink+'" href="'+opts.oemHref+'" id="'+typeOem+opts.HashId+'">'+opts.oemText+"</a>";
$("#"+typeOem+opts.HashId).addClass(opts.classTypeSelected);
}othis.append('<div id="'+imageTypes+opts.HashId+'" class="'+classImageTypeSelection+'"><a class="'+opts.classTypeLink+" "+opts.classTypeSelected+'" href="'+opts.exteriorHref+'" id="'+typeExterior+opts.HashId+'" '+exteriorDisabled+'>Exterior</a><span class="body_01"> | </span><a class="'+opts.classTypeLink+'" href="'+opts.interiorHref+'" id="'+typeInterior+opts.HashId+'" '+interiorDisabled+'>Interior</a><span class="body_01"> | </span><a class="'+opts.classTypeLink+'" href="'+opts.allHref+'" id="'+typeAll+opts.HashId+'" '+allDisabled+">All</a>"+oemLink+"</div>");
if(opts.showTopLinks&&isTop){$("#imageTypesTop"+opts.HashId+" ."+opts.classTypeLink).bind("click",function(){$("#imageTypes"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
$("#imageTypesTop"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
return false;
});
}$("#imageTypes"+opts.HashId+" ."+opts.classTypeLink).bind("click",function(){$("#imageTypes"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#imageTypesTop"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
}return false;
});
if(opts.Exterior.length>0){if(opts.refreshOnLinks){var url=replaceQueryString(location.href,"mediaview","exterior");
url=url.replace(/&PlaySlideShow=true/i,"");
url=replaceQueryString(url,"StartIndex","");
$("#"+typeExterior+opts.HashId).unbind("click").attr("href",url);
}else{$("#"+typeExterior+opts.HashId).bind("click",function(){$("#typeExterior"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeExteriorTop"+opts.HashId).addClass(opts.classTypeSelected);
}stop(opts);
opts.currentIndex=0;
opts.Type=PhotoGalleryType.EXTERIOR;
setPhotos(opts);
resetControls(opts);
ShowSelectedImages(opts);
return false;
});
}}else{$("#"+typeExterior+opts.HashId).addClass("typeDisabled").unbind("click");
}if(opts.Interior.length>0){if(opts.refreshOnLinks){var url=replaceQueryString(location.href,"mediaview","interior");
url=url.replace(/&PlaySlideShow=true/i,"");
url=replaceQueryString(url,"StartIndex","");
$("#"+typeInterior+opts.HashId).unbind("click").attr("href",url);
}else{$("#"+typeInterior+opts.HashId).bind("click",function(){$("#typeInterior"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeInteriorTop"+opts.HashId).addClass(opts.classTypeSelected);
}stop(opts);
opts.currentIndex=0;
opts.Type=PhotoGalleryType.INTERIOR;
setPhotos(opts);
resetControls(opts);
ShowSelectedImages(opts);
return false;
});
}}else{$("#"+typeInterior+opts.HashId).addClass("typeDisabled").unbind("click");
}if(opts.Photos.length>0){if(opts.refreshOnLinks){var url=replaceQueryString(location.href,"mediaview","oem");
url=url.replace(/&PlaySlideShow=true/i,"");
url=replaceQueryString(url,"StartIndex","");
$("#"+typeOem+opts.HashId).unbind("click").attr("href",url);
}else{$("#"+typeOem+opts.HashId).bind("click",function(){$("#typeOem"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeOemTop"+opts.HashId).addClass(opts.classTypeSelected);
}opts.currentIndex=0;
opts.Type=PhotoGalleryType.OEM;
setPhotos(opts);
resetControls(opts);
ShowSelectedImages(opts);
return false;
});
}}if(allDisabled.length<=0){if(opts.refreshOnLinks){var url=replaceQueryString(location.href,"mediaview","all");
url=url.replace(/&PlaySlideShow=true/i,"");
url=replaceQueryString(url,"StartIndex","");
$("#"+typeAll+opts.HashId).unbind("click").attr("href",url);
}else{$("#"+typeAll+opts.HashId).bind("click",function(){$("#typeAll"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeAllTop"+opts.HashId).addClass(opts.classTypeSelected);
}stop(opts);
opts.currentIndex=0;
opts.Type=PhotoGalleryType.ALL;
setPhotos(opts);
resetControls(opts);
opts.currentIndex=0;
ShowSelectedImages(opts);
return false;
});
}}else{$("#"+typeAll+opts.HashId).addClass("typeDisabled").unbind("click");
}$("#typeAll"+opts.HashId).removeClass(opts.classTypeSelected);
$("#typeExterior"+opts.HashId).removeClass(opts.classTypeSelected);
$("#typeInterior"+opts.HashId).removeClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeAllTop"+opts.HashId).removeClass(opts.classTypeSelected);
$("#typeExteriorTop"+opts.HashId).removeClass(opts.classTypeSelected);
$("#typeInteriorTop"+opts.HashId).removeClass(opts.classTypeSelected);
}switch(opts.Type){case (PhotoGalleryType.OEM):$("#typeOem"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeOemTop"+opts.HashId).addClass(opts.classTypeSelected);
}break;
case (PhotoGalleryType.ALL):$("#typeAll"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeAllTop"+opts.HashId).addClass(opts.classTypeSelected);
}break;
case (PhotoGalleryType.EXTERIOR):$("#typeExterior"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeExteriorTop"+opts.HashId).addClass(opts.classTypeSelected);
}break;
case (PhotoGalleryType.INTERIOR):$("#typeInterior"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#typeInteriorTop"+opts.HashId).addClass(opts.classTypeSelected);
}break;
}if(opts.oemText!=""){$("#"+typeOem+opts.HashId).unbind("click");
}}function ShowDotsJump(opts,oothis){if(opts.DotsJump){var numDots=parseInt((opts.Photos.length-1)/opts.ThumbsNumber)+1;
if(numDots>1){oothis.append("<hr>");
for(i=0;
i<numDots;
i++){var pos=(opts.ThumbsNumber*i)-1;
var className=((pos==-1&&opts.currentIndex==0)||pos==opts.currentIndex)?opts.classDotsJumpDisabled:opts.classDotsJump;
oothis.append('<div id="dotsJump" class="'+opts.classPLSlideShowControls+'"><a class="'+className+'" href="javascript:void(0);" id="dotJump'+i+"_"+opts.HashId+'" x:pg="'+i+'">&nbsp;&nbsp;&nbsp;</a></div>');
$("#dotJump"+i+"_"+opts.HashId).bind("click",function(){stop(opts);
pageJump(opts,$(this).attr("x:pg"));
return false;
});
}}}}function ShowNextJump(opts,oothis){if(opts.ThumbsJump){oothis.append('<div id="btnThumbFwd" class="'+opts.classPLSlideShowControls+'"><a class="'+opts.classThumbFwd+'" href="javascript:void(0);" id="btnThumbForward'+opts.HashId+'"><span></span></a></div>');
$("#btnThumbForward"+opts.HashId).bind("click",function(){stop(opts);
nextJump(opts);
return false;
});
}}function ShowPrevJump(opts,oothis){if(opts.ThumbsJump){oothis.append('<div id="btnThumbRwd" class="'+opts.classPLSlideShowControls+'"><a class="'+opts.classThumbRew+'" href="javascript:void(0);" id="btnThumbRewind'+opts.HashId+'"><span></span></a></div>');
$("#btnThumbRewind"+opts.HashId).bind("click",function(){stop(opts);
prevJump(opts);
return false;
});
}}function AddImage(opts,oothis,i,nextid){var imgId="thumbImage"+opts.HashId+"_"+i;
oothis.append('<img id="'+imgId+'" src="'+opts.Photos[nextid].ThumbUrl+'"/>');
$("#"+imgId).addClass("thumbImage");
$("#"+imgId).css({opacity:0.2});
var posx=opts.currentIndex%opts.ThumbsNumber;
if((opts.Type==PhotoGalleryType.PHOTOS)&&(i==opts.currentIndex)){$("#"+imgId).addClass(opts.classThumbImageSelected);
$("#mainImage"+opts.HashId).attr("meta:index",i).attr("meta:selectid",nextid);
}else{if((i==posx)&&(opts.Type!=PhotoGalleryType.PHOTOS)){$("#"+imgId).addClass(opts.classThumbImageSelected);
$("#mainImage"+opts.HashId).attr("meta:index",i).attr("meta:selectid",nextid);
}}if(opts.Photos[nextid].AlternateTxt){$("#"+imgId).attr("alt",opts.Photos[nextid].AlternateTxt);
}if(opts.Photos[nextid].OnClientClick!=null){$("#"+imgId).attr("meta:index",i).attr("meta:selectid",nextid).attr("meta:type",opts.Photos[nextid].Type).bind("click",function(){if(opts.LogPartnerLink){$(opts.PartnerlinkViewDetail).click();
}ShowSelectedImage($(this),opts);
if(opts.playslideshow){PhotoGallerySlideShow(opts);
}LogImageClick(opts.Photos[nextid].OnClientClick);
return false;
});
}else{$("#"+imgId).attr("meta:index",i).attr("meta:selectid",nextid).attr("meta:type",opts.Photos[nextid].Type).bind("click",function(){if(opts.LogPartnerLink){$(opts.PartnerlinkViewDetail).click();
}ShowSelectedImage($(this),opts);
if(opts.playslideshow){PhotoGallerySlideShow(opts);
}return false;
});
}$("#"+imgId).animate({opacity:1},1000);
}function LogImageClick(method){eval(method);
}function ShowSelectedImages(opts){var oothis;
if(opts.thumbscontainer==""){oothis=$("#thumbImages"+opts.HashId);
}else{oothis=$("#"+opts.thumbscontainer);
}if((oothis!=undefined)&&(opts.Photos!=undefined)){$(oothis).html("");
ShowPrevJump(opts,oothis);
if(opts.Type==PhotoGalleryType.PHOTOS){for(i=0;
i<opts.Photos.length;
i++){AddImage(opts,oothis,i,i);
if(((i+1)%(opts.ThumbsNumber))==0){oothis.append("<br/>");
}}}else{for(i=0;
i<opts.ThumbsNumber;
i++){if(i<opts.Photos.length){AddImage(opts,oothis,i,i);
}}}ShowNextJump(opts,oothis);
ShowDotsJump(opts,oothis);
ShowMainImage(opts,0,0);
setControls(0,0,opts);
updateADsAndOmniture(opts);
triggerEvent(opts);
setplayhref(opts);
}}function pageJump(opts,page){var pos=(opts.ThumbsNumber*page)-1;
opts.currentIndex=pos;
next(opts,pos,0);
}function nextJump(opts){var pos=parseInt(opts.currentIndex/opts.ThumbsNumber)*opts.ThumbsNumber;
pos=pos+opts.ThumbsNumber-1;
opts.currentIndex=pos;
next(opts,pos,0);
}function prevJump(opts){var pos=parseInt(opts.currentIndex/opts.ThumbsNumber)*opts.ThumbsNumber;
opts.currentIndex=pos-opts.ThumbsNumber;
prev(opts,pos,opts.ThumbsNumber-1);
ShowSelectedImage($("#thumbImage"+opts.HashId+"_0"),opts);
}function ShowSelectedImage(obj,opts){var oothiss=$("#mainImage"+opts.HashId);
if((oothiss!=undefined)&&(opts.Photos!=undefined)){var sid=$(obj).attr("meta:selectid");
var idx=$(obj).attr("meta:index");
if(sid<opts.Photos.length){ShowMainImage(opts,idx,sid);
if(!opts.Type==PhotoGalleryType.ALL){if(opts.Photos[sid].Type==PhotoGalleryType.EXTERIOR){$("#imageTypes"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
$("#typeExterior"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#imageTypesTop"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
$("#typeExteriorTop"+opts.HashId).addClass(opts.classTypeSelected);
}}else{if(opts.Photos[sid].Type==PhotoGalleryType.INTERIOR){$("#imageTypes"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
$("#typeInterior"+opts.HashId).addClass(opts.classTypeSelected);
if(opts.showTopLinks){$("#imageTypesTop"+opts.HashId+" ."+opts.classTypeLink).removeClass(opts.classTypeSelected);
$("#typeInteriorTop"+opts.HashId).addClass(opts.classTypeSelected);
}}}}setControls(sid,idx,opts);
updateADsAndOmniture(opts);
if(opts.thumbscontainer==""){$("#thumbImages"+opts.HashId+" ."+opts.classThumbImageSelected).removeClass(opts.classThumbImageSelected);
}else{$("#"+opts.thumbscontainer+" ."+opts.classThumbImageSelected).removeClass(opts.classThumbImageSelected);
}$(obj).addClass(opts.classThumbImageSelected);
triggerEvent(opts);
setplayhref(opts);
if(opts.scrollThumb){if(opts.thumbscontainer==""){var target=$("#thumbImages"+opts.HashId+" ."+opts.classThumbImageSelected);
var paneTarget=$("#thumbImages"+opts.HashId);
paneTarget.stop().scrollTo(target,1000,{easing:"swing"});
}else{var target=$("#"+opts.thumbscontainer+" ."+opts.classThumbImageSelected);
var paneTarget=$("#"+opts.thumbscontainer);
paneTarget.stop().scrollTo(target,1000,{easing:"swing"});
}}}}}function setplayhref(opts){if(opts.refreshOnPlay&&opts.playslideshow==false&&opts.Type!=PhotoGalleryType.ALL){var url=location.href;
url=replaceQueryString(url,"PlaySlideShow","true");
var pix=$("#mainImage"+opts.HashId).attr("meta:selectid");
var id=parseInt(pix);
if(opts.Type==PhotoGalleryType.INTERIOR&&opts.Exterior.length>0){id=id+opts.Exterior.length;
}url=replaceQueryString(url,"StartIndex",id);
$("#playpause"+opts.HashId).unbind("click").bind("click",function(){if(opts.LogPartnerLink){$(opts.PartnerlinkPlayRedButton).click();
}location.href=url;
return false;
});
$("#mainButton"+opts.HashId).unbind("click").bind("click",function(){if(opts.LogPartnerLink){$(opts.PartnerlinkPlay).click();
}location.href=url;
return false;
});
}}function setplaypause(opts){if(opts.refreshOnPlay&&opts.playslideshow==false&&opts.Type!=PhotoGalleryType.ALL){setplayhref(opts);
}else{if(opts.overlayClass!=""){$("."+opts.overlayClass).unbind("click").live("click",function(){if(opts.playslideshow){PhotoGallerySlideShow(opts);
}});
}$("#playpause"+opts.HashId).unbind("click").bind("click",function(){PhotoGallerySlideShow(opts);
if(opts.playslideshow==true&&opts.LogPartnerLink){$(opts.PartnerlinkPlayRedButton).click();
}return false;
});
if(opts.showPlayButton==true){$("#mainButton"+opts.HashId).unbind("click").bind("click",function(){PhotoGallerySlideShow(opts);
if(opts.playslideshow==true&&opts.LogPartnerLink){$(opts.PartnerlinkPlay).click();
}return false;
});
}}}function setControls(currentIndex,index,opts){opts.currentIndex=parseInt(currentIndex,10);
var nopagex=parseInt((opts.Photos.length-1)/opts.ThumbsNumber);
var pagex=parseInt(opts.currentIndex/opts.ThumbsNumber);
$("#rew"+opts.HashId).removeClass(opts.classRew).removeClass(opts.classRewDisabled).addClass(opts.classRew).unbind("click").bind("click",function(){prev(opts,opts.currentIndex,index);
if(opts.LogPartnerLink){$(opts.PartnerlinkScroll).click();
}return false;
});
$("#btnThumbRewind"+opts.HashId).removeClass(opts.classThumbRew).removeClass(opts.classThumbRewDisabled).addClass(opts.classThumbRew).unbind("click").bind("click",function(){prevJump(opts);
return false;
});
$("#fwd"+opts.HashId).removeClass(opts.classFwd).removeClass(opts.classFwdDisabled).addClass(opts.classFwd).unbind("click").bind("click",function(){next(opts,opts.currentIndex,index);
if(opts.LogPartnerLink){$(opts.PartnerlinkScroll).click();
}if(opts.playslideshow){PhotoGallerySlideShow(opts);
}return false;
});
$("#btnThumbForward"+opts.HashId).removeClass(opts.classThumbFwd).removeClass(opts.classThumbFwdDisabled).addClass(opts.classThumbFwd).unbind("click").bind("click",function(){nextJump(opts);
return false;
});
$("#imageBtnPrev"+opts.HashId).removeClass(opts.classRew).removeClass(opts.classRewDisabled).addClass(opts.classRew).unbind("click").bind("click",function(){prev(opts,opts.currentIndex,index);
return false;
});
$("#imageBtnNext"+opts.HashId).removeClass(opts.classFwd).removeClass(opts.classFwdDisabled).addClass(opts.classFwd).unbind("click").bind("click",function(){next(opts,opts.currentIndex,index);
return false;
});
if((opts.Photos.length<=1)&&(opts.Type!=PhotoGalleryType.PHOTOS&&(opts.Exterior.length+opts.Interior.length)<=1)){$("#controls"+opts.HashId).hide();
}if(currentIndex==0){$("#rew"+opts.HashId).removeClass(opts.classRew).addClass(opts.classRewDisabled).unbind("click").click(function(){return false;
});
}if(currentIndex==(opts.Photos.length-1)){$("#fwd"+opts.HashId).removeClass(opts.classFwd).addClass(opts.classFwdDisabled).unbind("click").click(function(){return false;
});
}if(opts.ThumbsJump){if(currentIndex==0||pagex==0){$("#btnThumbRewind"+opts.HashId).removeClass(opts.classThumbRew).addClass(opts.classThumbRewDisabled).unbind("click").click(function(){return false;
});
}if(pagex>=nopagex){$("#btnThumbForward"+opts.HashId).removeClass(opts.classThumbFwd).addClass(opts.classThumbFwdDisabled).unbind("click").click(function(){return false;
});
}}if(opts.showNumberOf){var lblIndex=currentIndex;
$("#lblCurrentImage"+opts.HashId).html((++lblIndex)+" of "+opts.Photos.length);
}if(opts.showNumberOfTop){var lblIndex=currentIndex;
$("#lblCurrentImageTop"+opts.HashId).html((++lblIndex)+" of "+opts.Photos.length);
}if(opts.showImageControls){if(currentIndex==0){$("#imageBtnPrev"+opts.HashId).removeClass(opts.classRew).addClass(opts.classRewDisabled).unbind("click").click(function(){return false;
});
}if(currentIndex==(opts.Photos.length-1)){$("#imageBtnNext"+opts.HashId).removeClass(opts.classFwd).addClass(opts.classFwdDisabled).unbind("click").click(function(){return false;
});
}}}function next(opts,id,index){var nid=++id;
if(opts.showImageControls){ShowMainImage(opts,nid,nid);
setControls(nid,nid,opts);
}else{if((nid%opts.ThumbsNumber==0)&&((opts.Type==PhotoGalleryType.ALL)||(opts.Type==PhotoGalleryType.EXTERIOR)||(opts.Type==PhotoGalleryType.INTERIOR))){var oothis;
if(opts.thumbscontainer==""){oothis=$("#thumbImages"+opts.HashId);
}else{oothis=$("#"+opts.thumbscontainer);
}$(oothis).html("");
ShowPrevJump(opts,oothis);
for(i=0;
i<opts.ThumbsNumber;
i++){var nextid=id+i;
if(opts.Photos.length>nextid){AddImage(opts,oothis,i,nextid);
}}ShowNextJump(opts,oothis);
ShowDotsJump(opts,oothis);
ShowSelectedImage($("#thumbImage"+opts.HashId+"_0"),opts);
}else{var idx=parseInt(index,10)+1;
ShowSelectedImage($("#thumbImage"+opts.HashId+"_"+idx),opts);
}}}function prev(opts,id,index){var pid=id-1;
if(opts.showImageControls){ShowMainImage(opts,pid,pid);
setControls(pid,pid,opts);
}else{if((id%opts.ThumbsNumber==0)&&(opts.Type!=PhotoGalleryType.PHOTOS)){var oothis;
if(opts.thumbscontainer==""){oothis=$("#thumbImages"+opts.HashId);
}else{oothis=$("#"+opts.thumbscontainer);
}$(oothis).html("");
ShowPrevJump(opts,oothis);
for(i=0;
i<opts.ThumbsNumber;
i++){var previd=id-opts.ThumbsNumber+i;
AddImage(opts,oothis,i,previd);
}ShowNextJump(opts,oothis);
ShowDotsJump(opts,oothis);
var lastindex=opts.ThumbsNumber-1;
ShowSelectedImage($("#thumbImage"+opts.HashId+"_"+lastindex),opts);
}else{var idx=parseInt(index,10)-1;
ShowSelectedImage($("#thumbImage"+opts.HashId+"_"+idx),opts);
}}}function start(opts){if(opts.Photos.length>1){var ix=$("#mainImage"+opts.HashId).attr("meta:index");
var pix=$("#mainImage"+opts.HashId).attr("meta:selectid");
if(pix==opts.Photos.length-1){InitThumbs(opts);
setControls(0,0,opts);
next(opts,0,-1);
}else{next(opts,pix,ix);
}$("#playpause"+opts.HashId).removeClass(opts.classPlay).addClass(opts.classPause);
opts.playslideshow=true;
opts.autoPlayToLoop--;
createTimer(opts);
if(opts.autoPlayToLoop==0){stop(opts);
return;
}}}function stop(opts){$("#playpause"+opts.HashId).removeClass(opts.classPause).addClass(opts.classPlay);
$("#mainButton"+opts.HashId+" .pause").hide();
$("#mainButton"+opts.HashId+" .play").show();
clearTimeout(opts.timer);
opts.playslideshow=false;
opts.timer=0;
}function createTimer(opts){var vis=$("#mainImage"+opts.HashId).parent().parent().css("display");
if(vis=="block"){var partnerName="kbb";
s.products="";
if(opts.oemPartnerName!=""){partnerName=opts.oemPartnerName;
}AddPartnerClientImpression(partnerName,opts.pagename+"_autoplay","",this);
var sid=$("#mainImage"+opts.HashId).attr("meta:selectid");
var idx=$("#mainImage"+opts.HashId).attr("meta:index");
setControls(sid,idx,opts);
opts.timer=setTimeout(function(){start(opts);
},opts.playtimeout);
}else{opts.playslideshow=false;
stop(opts);
}}function PhotoGallerySlideShow(opts){if(opts.playslideshow==false){$("#playpause"+opts.HashId).removeClass(opts.classPlay).addClass(opts.classPause);
if(opts.showPlayButton==true){$("#mainButton"+opts.HashId+" .play").hide();
$("#mainButton"+opts.HashId+" .pause").show();
}opts.playslideshow=true;
clearTimeout(opts.timer);
opts.timer=0;
var oothis;
if(opts.thumbscontainer==""){oothis=$("#thumbImages"+opts.HashId);
}else{oothis=$("#"+opts.thumbscontainer);
}$(oothis).html("");
setPhotos(opts);
ShowPrevJump(opts,oothis);
var sid=$("#mainImage"+opts.HashId).attr("meta:selectid");
var idx=$("#mainImage"+opts.HashId).attr("meta:index");
if(opts.Type==PhotoGalleryType.PHOTOS){for(i=0;
i<opts.Photos.length;
i++){AddImage(opts,oothis,i,i);
if(((i+1)%(opts.ThumbsNumber))==0){oothis.append("<br/>");
}}}else{var pos=parseInt(opts.currentIndex/opts.ThumbsNumber)*opts.ThumbsNumber;
for(var i=pos,j=0;
i<parseInt(opts.ThumbsNumber)+pos;
i++,j++){if(i<opts.Photos.length){AddImage(opts,oothis,j,i);
}}}ShowNextJump(opts,oothis);
ShowDotsJump(opts,oothis);
opts.autoPlayToLoop=opts.Photos.length;
createTimer(opts);
}else{opts.playslideshow=false;
if(opts.showPlayButton==true){$("#mainButton"+opts.HashId+" .pause").hide();
$("#mainButton"+opts.HashId+" .play").show();
}stop(opts);
}}function updateADsAndOmniture(opts){if(opts.doAdOmnitureUpdate){opts.imageCount++;
if(!opts.playslideshow){updateOmniture(opts);
}if(!opts.playslideshow&&opts.showSpeedLinks&&opts.AdRefreshRateMedium>0&&opts.AdRefreshRate!=opts.AdRefreshRateMedium){opts.AdRefreshRate=opts.AdRefreshRateMedium;
}if((opts.AdRefreshRate>0)&&((opts.imageCount%opts.AdRefreshRate)==0)){try{refreshAds();
}catch(e){}}}}function updateOmniture(opts){reSubmitOmniture(opts.pagename,"","");
}$.fn.imageresize=function(options){var defaults={cropType:"full",vertical:"center",horizontal:"center"};
var opts=$.extend(defaults,options);
var resize=function(el){var ratio=$(el).height()/$(el).width();
var winh=$(window).height(),winw=$(window).width();
log("ratio:"+ratio);
switch(opts.croptype){case"fit":h=winh;
w=winw;
break;
case"height":h=winh;
w=winh/ratio;
break;
case"width":h=winw*ratio;
w=winw;
break;
case"fill_outer":if(winh/winw<=ratio){h=winw*ratio;
w=winw;
}else{h=winh;
w=winh/ratio;
}break;
case"full":default:if(winh/winw>=ratio){h=winw*ratio;
w=winw;
}else{h=winh;
w=winh/ratio;
}}h=Math.ceil(h);
w=Math.ceil(w);
switch(opts.vertical){case"top":t=0;
break;
case"bottom":t=(winh-h);
break;
case"center":default:t=(winh-h)/2;
break;
}switch(opts.horizontal){case"left":l=0;
break;
case"right":l=(winw-w);
break;
case"center":default:l=(winw-w)/2;
break;
}log("height:"+h+" | width:"+w+" | top:"+t+" | left:"+l);
$(el).css({height:h,width:w,position:"absolute",top:t,left:l});
};
return this.each(function(){if(this.nodeName==="IMG"){$(this).load(function(){resize(this);
}).attr("src",$(this).attr("src"));
}});
};
$.fn.photogalleryfs=function(options){var defaults={photos:[],currentIndex:0,thumbswidth:64,thumbsheight:43};
var opts=$.extend(defaults,options);
return this.each(function(){initfs($(this),opts);
});
};
function initfs(othis,opts){var background=$('<div id="mainbackground" class="fsBg slideshow"></div>').appendTo(document.body);
var closebutton=$('<p id="fsclose"><a target="_top" href="'+opts.returnUrl+'">close window</a></p>').appendTo(document.body);
var background2=$('<div class="fsthumbsBg slideshow"/>').appendTo(document.body);
var thumbsbackground=$('<div class="fsNav slideshow"/>').appendTo(document.body);
var wwidth=$(window).width();
var wheight=$(window).height();
$("#mainbackground").css("height",wheight);
$("#mainbackground").css("width",wwidth);
var margins=100;
var xthumbs=Math.floor(((wwidth-margins)/(opts.thumbswidth+6)));
margins=(wwidth-(xthumbs*(opts.thumbswidth+6)));
var mleft=margins/2;
var imagesarr=[];
var thumbsarr=[""];
thumbsarr.push('<ul class="fsthumbs" style="margin-left:'+mleft+'px;">');
for(var i=0;
i<opts.photos.length;
i++){imagesarr[i]=new Image();
imagesarr[i].src=opts.photos[i].ThumbUrl;
imagesarr[i]._index=i;
if(i<xthumbs){thumbsarr.push('<li xid="'+i+'" class="fsthumbs" style="width:'+(opts.thumbswidth+6)+"px;height:"+(opts.thumbsheight+2)+'px;float:left;"><img class="fsthumbsimg'+(i==0?" selected":"")+'" xid="'+i+'" src="'+imagesarr[i].src+'" alt="'+opts.photos[i].AlternateTxt+'" style="width:'+opts.thumbswidth+"px;height:"+opts.thumbsheight+'px;opacity:03"/></li>');
}else{thumbsarr.push('<li xid="'+i+'" class="fsthumbs" style="width:'+(opts.thumbswidth+6)+"px;height:"+(opts.thumbsheight+2)+'px;float:left;display:none;"><img class="fsthumbsimg" xid="'+i+'" src="'+imagesarr[i].src+'" alt="'+opts.photos[i].AlternateTxt+'" style="width:'+opts.thumbswidth+"px;height:"+opts.thumbsheight+'px;opacity:03"/></li>');
}}thumbsarr.push("</ul>");
$("#next, #prev").die("click");
$('<a id="prevDisabled" class="btnrewindDisabled" href="javascript:void(0);" ></a>').appendTo(thumbsbackground);
$('<a id="prev" class="btnrewind" xid="0" xdir="<" href="javascript:void(0);" ></a>').appendTo(thumbsbackground);
$('<a id="next" class="btnforward" xid="1" xdir=">" href="javascript:void(0);" ></a>').appendTo(thumbsbackground);
$('<a id="nextDisabled" class="btnforwardDisabled" xid="1" href="javascript:void(0);" ></a>').appendTo(thumbsbackground);
var thumbs=$(thumbsarr.join("")).appendTo(thumbsbackground);
$('<img id="mainImage" src=""/>').appendTo(background);
$("#mainImage").attr("src",opts.photos[0].Url);
if(opts.photos[0].AlternateTxt){$("#mainImage").attr("alt",opts.photos[0].AlternateTxt);
}$("#mainImage").imageresize();
$("#mainImage").show();
if($("#next").attr("xid")==opts.photos.length){$("#nextDisabled").show();
$("#next").hide();
}$(".fsthumbsimg").live("click",function(){var id=parseInt($(this).attr("xid"));
$(".fsthumbsimg").removeClass("selected");
$(this).addClass("selected");
$("#mainImage").attr("src",opts.photos[id].Url);
if(opts.photos[id].AlternateTxt){$("#mainImage").attr("alt",opts.photos[id].AlternateTxt);
}$("#mainImage").show();
$("#next").attr("xid",id<opts.photos.length-1?id+1:opts.photos.length);
$("#prev").attr("xid",id>0?id-1:-1);
if($("#next").attr("xid")==opts.photos.length){$("#nextDisabled").show();
$("#next").hide();
}else{$("#nextDisabled").hide();
$("#next").show();
}if($("#prev").attr("xid")==-1){$("#prevDisabled").show();
$("#prev").hide();
}else{$("#prevDisabled").hide();
$("#prev").show();
}});
$("#next, #prev").live("click",function(){var direction=$(this).attr("xdir");
var id=parseInt($(this).attr("xid"));
$(".fsthumbsimg").removeClass("selected");
$(".fsthumbsimg").each(function(i){var att=$(this).attr("xid");
if(att==id){$(this).addClass("selected");
if(!$(this).parent().is(":visible")){if($(".fsthumbs li:visible").length>xthumbs){}if(direction==">"){$(".fsthumbs li:visible:first").hide();
}if(direction=="<"){$(".fsthumbs li:visible:last").hide();
}$(this).parent().show();
}}});
$("#mainImage").attr("src",opts.photos[id].Url);
if(opts.photos[id].AlternateTxt){$("#mainImage").attr("alt",opts.photos[id].AlternateTxt);
}$("#next").attr("xid",id<opts.photos.length-1?id+1:opts.photos.length);
$("#prev").attr("xid",id>0?id-1:-1);
if($("#next").attr("xid")==opts.photos.length){$("#nextDisabled").show();
$("#next").hide();
}else{$("#nextDisabled").hide();
$("#next").show();
}if($("#prev").attr("xid")==-1){$("#prevDisabled").show();
$("#prev").hide();
}else{$("#prevDisabled").hide();
$("#prev").show();
}});
$(document).pngFix();
}})(jQuery);

$(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");
}}
eval(function(h,b,d,g,f,i){f=function(a){return(a<b?"":f(parseInt(a/b)))+((a=a%b)>35?String.fromCharCode(a+29):a.toString(36));
};
if(!"".replace(/^/,String)){while(d--){i[f(d)]=g[d]||f(d);
}g=[function(a){return i[a];
}];
f=function(){return"\\w+";
};
d=1;
}while(d--){if(g[d]){h=h.replace(new RegExp("\\b"+f(d)+"\\b","g"),g[d]);
}}return h;
}("(s($){3.1s.1k=s(j){j=3.1a({12:'1m.1j'},j);8 k=(n.P==\"r 10 Z\"&&U(n.v)==4&&n.v.E(\"14 5.5\")!=-1);8 l=(n.P==\"r 10 Z\"&&U(n.v)==4&&n.v.E(\"14 6.0\")!=-1);o(3.17.16&&(k||l)){3(2).L(\"1r[m$=.M]\").z(s(){3(2).7('q',3(2).q());3(2).7('p',3(2).p());8 a='';8 b='';8 c=(3(2).7('K'))?'K=\"'+3(2).7('K')+'\" ':'';8 d=(3(2).7('A'))?'A=\"'+3(2).7('A')+'\" ':'';8 e=(3(2).7('C'))?'C=\"'+3(2).7('C')+'\" ':'';8 f=(3(2).7('B'))?'B=\"'+3(2).7('B')+'\" ':'';8 g=(3(2).7('R'))?'1d:'+3(2).7('R')+';':'';8 h=(3(2).1c().7('1b'))?'19:18;':'';o(2.9.y){a+='y:'+2.9.y+';';2.9.y=''}o(2.9.t){a+='t:'+2.9.t+';';2.9.t=''}o(2.9.w){a+='w:'+2.9.w+';';2.9.w=''}8 i=(2.9.15);b+='<x '+c+d+e+f;b+='9=\"13:11;1q-1p:1o-1n;O:W-V;N:1l;'+g+h;b+='q:'+3(2).q()+'u;'+'p:'+3(2).p()+'u;';b+='J:I:H.r.G'+'(m=\\''+3(2).7('m')+'\\', D=\\'F\\');';b+=i+'\"></x>';o(a!=''){b='<x 9=\"13:11;O:W-V;'+a+h+'q:'+3(2).q()+'u;'+'p:'+3(2).p()+'u;'+'\">'+b+'</x>'}3(2).1i();3(2).1h(b)});3(2).L(\"*\").z(s(){8 a=3(2).T('N-S');o(a.E(\".M\")!=-1){8 b=a.X('1g(\"')[1].X('\")')[0];3(2).T('N-S','1f');3(2).Q(0).Y.J=\"I:H.r.G(m='\"+b+\"',D='F')\"}});3(2).L(\"1e[m$=.M]\").z(s(){8 a=3(2).7('m');3(2).Q(0).Y.J='I:H.r.G'+'(m=\\''+a+'\\', D=\\'F\\');';3(2).7('m',j.12)})}1t 3}})(3);",62,92,"||this|jQuery||||attr|var|style|||||||||||||src|navigator|if|height|width|Microsoft|function|padding|px|appVersion|margin|span|border|each|class|alt|title|sizingMethod|indexOf|scale|AlphaImageLoader|DXImageTransform|progid|filter|id|find|png|background|display|appName|get|align|image|css|parseInt|block|inline|split|runtimeStyle|Explorer|Internet|relative|blankgif|position|MSIE|cssText|msie|browser|hand|cursor|extend|href|parent|float|input|none|url|after|hide|gif|pngFix|transparent|blank|line|pre|space|white|img|fn|return".split("|"),0,{}));


