(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);


