(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);

jQuery.ui||(function(a){var b=a.fn.remove,h=a.browser.mozilla&&(parseFloat(a.browser.version)<1.9);
a.ui={version:"1.7.1",plugin:{add:function(k,l,n){var m=a.ui[k].prototype;
for(var j in n){m.plugins[j]=m.plugins[j]||[];
m.plugins[j].push([l,n[j]]);
}},call:function(l,m,j){var n=l.plugins[m];
if(!n||!l.element[0].parentNode){return;
}for(var k=0;
k<n.length;
k++){if(l.options[n[k][0]]){n[k][1].apply(l.element,j);
}}}},contains:function(j,k){return document.compareDocumentPosition?j.compareDocumentPosition(k)&16:j!==k&&j.contains(k);
},hasScroll:function(k,j){if(a(k).css("overflow")=="hidden"){return false;
}var m=(j&&j=="left")?"scrollLeft":"scrollTop",l=false;
if(k[m]>0){return true;
}k[m]=1;
l=(k[m]>0);
k[m]=0;
return l;
},isOverAxis:function(l,j,k){return(l>j)&&(l<(j+k));
},isOver:function(o,n,l,k,j,m){return a.ui.isOverAxis(o,l,j)&&a.ui.isOverAxis(n,k,m);
},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};
if(h){var f=a.attr,i=a.fn.removeAttr,c="http://www.w3.org/2005/07/aaa",e=/^aria-/,d=/^wairole:/;
a.attr=function(j,k,m){var l=m!==undefined;
return(k=="role"?(l?f.call(this,j,k,"wairole:"+m):(f.apply(this,arguments)||"").replace(d,"")):(e.test(k)?(l?j.setAttributeNS(c,k.replace(e,"aaa:"),m):f.call(this,j,k.replace(e,"aaa:"))):f.apply(this,arguments)));
};
a.fn.removeAttr=function(j){return(e.test(j)?this.each(function(){this.removeAttributeNS(c,j.replace(e,""));
}):i.call(this,j));
};
}a.fn.extend({remove:function(){a("*",this).add(this).each(function(){a(this).triggerHandler("remove");
});
return b.apply(this,arguments);
},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui");
},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false;
});
},scrollParent:function(){var j;
if((a.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(a.curCSS(this,"position",1))&&(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1));
}).eq(0);
}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(a.curCSS(this,"overflow",1)+a.curCSS(this,"overflow-y",1)+a.curCSS(this,"overflow-x",1));
}).eq(0);
}return(/fixed/).test(this.css("position"))||!j.length?a(document):j;
}});
a.extend(a.expr[":"],{data:function(j,k,l){return !!a.data(j,l[3]);
},focusable:function(j){var k=j.nodeName.toLowerCase(),l=a.attr(j,"tabindex");
return(/input|select|textarea|button|object/.test(k)?!j.disabled:"a"==k||"area"==k?j.href||!isNaN(l):!isNaN(l))&&!a(j)["area"==k?"parents":"closest"](":hidden").length;
},tabbable:function(j){var k=a.attr(j,"tabindex");
return(isNaN(k)||k>=0)&&a(j).is(":focusable");
}});
function g(n,o,l,j){function k(q){var p=a[n][o][q]||[];
return(typeof p=="string"?p.split(/,?\s+/):p);
}var m=k("getter");
if(j.length==1&&typeof j[0]=="string"){m=m.concat(k("getterSetter"));
}return(a.inArray(l,m)!=-1);
}a.widget=function(j,l){var k=j.split(".")[0];
j=j.split(".")[1];
a.fn[j]=function(p){var o=(typeof p=="string"),m=Array.prototype.slice.call(arguments,1);
if(o&&p.substring(0,1)=="_"){return this;
}if(o&&g(k,j,p,m)){var n=a.data(this[0],j);
return(n?n[p].apply(n,m):undefined);
}return this.each(function(){var q=a.data(this,j);
(!q&&!o&&a.data(this,j,new a[k][j](this,p))._init());
(q&&o&&a.isFunction(q[p])&&q[p].apply(q,m));
});
};
a[k]=a[k]||{};
a[k][j]=function(m,n){var o=this;
this.namespace=k;
this.widgetName=j;
this.widgetEventPrefix=a[k][j].eventPrefix||j;
this.widgetBaseClass=k+"-"+j;
this.options=a.extend({},a.widget.defaults,a[k][j].defaults,a.metadata&&a.metadata.get(m)[j],n);
this.element=a(m).bind("setData."+j,function(p,q,r){if(p.target==m){return o._setData(q,r);
}}).bind("getData."+j,function(p,q){if(p.target==m){return o._getData(q);
}}).bind("remove",function(){return o.destroy();
});
};
a[k][j].prototype=a.extend({},a.widget.prototype,l);
a[k][j].getterSetter="option";
};
a.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled");
},option:function(j,m){var k=j,l=this;
if(typeof j=="string"){if(m===undefined){return this._getData(j);
}k={};
k[j]=m;
}a.each(k,function(n,o){l._setData(n,o);
});
},_getData:function(j){return this.options[j];
},_setData:function(j,k){this.options[j]=k;
if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k);
}},enable:function(){this._setData("disabled",false);
},disable:function(){this._setData("disabled",true);
},_trigger:function(p,l,k){var j=this.options[p],m=(p==this.widgetEventPrefix?p:this.widgetEventPrefix+p);
l=a.Event(l);
l.type=m;
if(l.originalEvent){for(var n=a.event.props.length,o;
n;
){o=a.event.props[--n];
l[o]=l.originalEvent[o];
}}this.element.trigger(l,k);
return !(a.isFunction(j)&&j.call(this.element[0],l,k)===false||l.isDefaultPrevented());
}};
a.widget.defaults={disabled:false};
a.ui.mouse={_mouseInit:function(){var j=this;
this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k);
}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;
k.stopImmediatePropagation();
return false;
}});
if(a.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");
this.element.attr("unselectable","on");
}this.started=false;
},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);
(a.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable));
},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};
if(l.originalEvent.mouseHandled){return;
}(this._mouseStarted&&this._mouseUp(l));
this._mouseDownEvent=l;
var m=this,j=(l.which==1),k=(typeof this.options.cancel=="string"?a(l.target).parents().add(l.target).filter(this.options.cancel).length:false);
if(!j||k||!this._mouseCapture(l)){return true;
}this.mouseDelayMet=!this.options.delay;
if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){m.mouseDelayMet=true;
},this.options.delay);
}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);
if(!this._mouseStarted){l.preventDefault();
return true;
}}this._mouseMoveDelegate=function(n){return m._mouseMove(n);
};
this._mouseUpDelegate=function(n){return m._mouseUp(n);
};
a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
(a.browser.safari||l.preventDefault());
l.originalEvent.mouseHandled=true;
return true;
},_mouseMove:function(j){if(a.browser.msie&&!j.button){return this._mouseUp(j);
}if(this._mouseStarted){this._mouseDrag(j);
return j.preventDefault();
}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);
(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j));
}return !this._mouseStarted;
},_mouseUp:function(j){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;
this._preventClickEvent=(j.target==this._mouseDownEvent.target);
this._mouseStop(j);
}return false;
},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance);
},_mouseDelayMet:function(j){return this.mouseDelayMet;
},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true;
}};
a.ui.mouse.defaults={cancel:null,distance:1,delay:0};
})(jQuery);

(function(a){a.widget("ui.slider",a.extend({},a.ui.mouse,{_init:function(){var c=this,b=this.options;
this._keySliding=false;
this._handleIndex=null;
this._detectOrientation();
this._mouseInit();
this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");
this.range=a([]);
if(b.range){if(b.range===true){this.range=a("<div></div>");
if(!b.values){b.values=[this._valueMin(),this._valueMin()];
}if(b.values.length&&b.values.length!=2){b.values=[b.values[0],b.values[0]];
}}else{this.range=a("<div></div>");
}this.range.appendTo(this.element).addClass("ui-slider-range");
if(b.range=="min"||b.range=="max"){this.range.addClass("ui-slider-range-"+b.range);
}this.range.addClass("ui-widget-header");
}if(a(".ui-slider-handle",this.element).length==0){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle");
}if(b.values&&b.values.length){while(a(".ui-slider-handle",this.element).length<b.values.length){a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle");
}}this.handles=a(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");
this.handle=this.handles.eq(0);
this.handles.add(this.range).filter("a").click(function(d){d.preventDefault();
}).hover(function(){a(this).addClass("ui-state-hover");
},function(){a(this).removeClass("ui-state-hover");
}).focus(function(){a(".ui-slider .ui-state-focus").removeClass("ui-state-focus");
a(this).addClass("ui-state-focus");
}).blur(function(){a(this).removeClass("ui-state-focus");
});
this.handles.each(function(d){a(this).data("index.ui-slider-handle",d);
});
this.handles.keydown(function(e){var h=true;
var f=a(this).data("index.ui-slider-handle");
if(c.options.disabled){return;
}switch(e.keyCode){case a.ui.keyCode.HOME:case a.ui.keyCode.END:case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:h=false;
if(!c._keySliding){c._keySliding=true;
a(this).addClass("ui-state-active");
c._start(e,f);
}break;
}var d,g,i=c._step();
if(c.options.values&&c.options.values.length){d=g=c.values(f);
}else{d=g=c.value();
}switch(e.keyCode){case a.ui.keyCode.HOME:g=c._valueMin();
break;
case a.ui.keyCode.END:g=c._valueMax();
break;
case a.ui.keyCode.UP:case a.ui.keyCode.RIGHT:if(d==c._valueMax()){return;
}g=d+i;
break;
case a.ui.keyCode.DOWN:case a.ui.keyCode.LEFT:if(d==c._valueMin()){return;
}g=d-i;
break;
}c._slide(e,f,g);
return h;
}).keyup(function(d){var e=a(this).data("index.ui-slider-handle");
if(c._keySliding){c._stop(d,e);
c._change(d,e);
c._keySliding=false;
a(this).removeClass("ui-state-active");
}});
this._refreshValue();
},destroy:function(){this.handles.remove();
this.range.remove();
this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy();
},_mouseCapture:function(d){var h=this.options;
if(h.disabled){return false;
}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};
this.elementOffset=this.element.offset();
var j={x:d.pageX,y:d.pageY};
var g=this._normValueFromMouse(j);
var c=this._valueMax()-this._valueMin()+1,b;
var k=this,e;
this.handles.each(function(l){var m=Math.abs(g-k.values(l));
if(c>m){c=m;
b=a(this);
e=l;
}});
if(h.range==true&&this.values(1)==h.min){b=a(this.handles[++e]);
}this._start(d,e);
k._handleIndex=e;
b.addClass("ui-state-active").focus();
var i=b.offset();
var f=!a(d.target).parents().andSelf().is(".ui-slider-handle");
this._clickOffset=f?{left:0,top:0}:{left:d.pageX-i.left-(b.width()/2),top:d.pageY-i.top-(b.height()/2)-(parseInt(b.css("borderTopWidth"),10)||0)-(parseInt(b.css("borderBottomWidth"),10)||0)+(parseInt(b.css("marginTop"),10)||0)};
g=this._normValueFromMouse(j);
this._slide(d,e,g);
return true;
},_mouseStart:function(b){return true;
},_mouseDrag:function(b){var d={x:b.pageX,y:b.pageY};
var c=this._normValueFromMouse(d);
this._slide(b,this._handleIndex,c);
return false;
},_mouseStop:function(b){this.handles.removeClass("ui-state-active");
this._stop(b,this._handleIndex);
this._change(b,this._handleIndex);
this._handleIndex=null;
this._clickOffset=null;
return false;
},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal";
},_normValueFromMouse:function(f){var e,d;
if("horizontal"==this.orientation){e=this.elementSize.width;
d=f.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0);
}else{e=this.elementSize.height;
d=f.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0);
}var c=(d/e);
if(c>1){c=1;
}if(c<0){c=0;
}if("vertical"==this.orientation){c=1-c;
}var i=this._valueMax()-this._valueMin(),g=c*i,h=g%this.options.step,b=this._valueMin()+g-h;
if(h>(this.options.step/2)){b+=this.options.step;
}return parseFloat(b.toFixed(5));
},_start:function(b,c){var d={handle:this.handles[c],value:this.value()};
if(this.options.values&&this.options.values.length){d.value=this.values(c);
d.values=this.values();
}this._trigger("start",b,d);
},_slide:function(c,e,f){var d=this.handles[e];
if(this.options.values&&this.options.values.length){var h=this.values(e?0:1);
if((e==0&&f>=h)||(e==1&&f<=h)){f=h;
}if(f!=this.values(e)){var g=this.values();
g[e]=f;
var b=this._trigger("slide",c,{handle:this.handles[e],value:f,values:g});
var h=this.values(e?0:1);
if(b!==false){this.values(e,f,(c.type=="mousedown"&&this.options.animate),true);
}}}else{if(f!=this.value()){var b=this._trigger("slide",c,{handle:this.handles[e],value:f});
if(b!==false){this._setData("value",f,(c.type=="mousedown"&&this.options.animate));
}}}},_stop:function(b,c){var d={handle:this.handles[c],value:this.value()};
if(this.options.values&&this.options.values.length){d.value=this.values(c);
d.values=this.values();
}this._trigger("stop",b,d);
},_change:function(b,c){var d={handle:this.handles[c],value:this.value()};
if(this.options.values&&this.options.values.length){d.value=this.values(c);
d.values=this.values();
}this._trigger("change",b,d);
},value:function(b){if(arguments.length){this._setData("value",b);
this._change(null,0);
}return this._value();
},values:function(c,d,b,e){if(arguments.length>1){this.options.values[c]=d;
this._refreshValue(b);
if(!e){this._change(null,c);
}}if(arguments.length){if(this.options.values&&this.options.values.length){return this._values(c);
}else{return this.value();
}}else{return this._values();
}},_setData:function(c,d,b){a.widget.prototype._setData.apply(this,arguments);
switch(c){case"orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);
this._refreshValue(b);
break;
case"value":this._refreshValue(b);
break;
}},_step:function(){var b=this.options.step;
return b;
},_value:function(){var b=this.options.value;
if(b<this._valueMin()){b=this._valueMin();
}if(b>this._valueMax()){b=this._valueMax();
}return b;
},_values:function(b){if(arguments.length){var c=this.options.values[b];
if(c<this._valueMin()){c=this._valueMin();
}if(c>this._valueMax()){c=this._valueMax();
}return c;
}else{return this.options.values;
}},_valueMin:function(){var b=this.options.min;
return b;
},_valueMax:function(){var b=this.options.max;
return b;
},_refreshValue:function(c){var e=this.options.range,d=this.options,f=this;
if(this.options.values&&this.options.values.length){var k,l;
this.handles.each(function(n,o){var p=(f.values(n)-f._valueMin())/(f._valueMax()-f._valueMin())*100;
var m={};
m[f.orientation=="horizontal"?"left":"bottom"]=p+"%";
a(this).stop(1,1)[c?"animate":"css"](m,d.animate);
if(f.options.range===true){if(f.orientation=="horizontal"){(n==0)&&f.range.stop(1,1)[c?"animate":"css"]({left:p+"%"},d.animate);
(n==1)&&f.range[c?"animate":"css"]({width:(p-lastValPercent)+"%"},{queue:false,duration:d.animate});
}else{(n==0)&&f.range.stop(1,1)[c?"animate":"css"]({bottom:(p)+"%"},d.animate);
(n==1)&&f.range[c?"animate":"css"]({height:(p-lastValPercent)+"%"},{queue:false,duration:d.animate});
}}lastValPercent=p;
});
}else{var h=this.value(),j=this._valueMin(),i=this._valueMax(),g=i!=j?(h-j)/(i-j)*100:0;
var b={};
b[f.orientation=="horizontal"?"left":"bottom"]=g+"%";
this.handle.stop(1,1)[c?"animate":"css"](b,d.animate);
(e=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[c?"animate":"css"]({width:g+"%"},d.animate);
(e=="max")&&(this.orientation=="horizontal")&&this.range[c?"animate":"css"]({width:(100-g)+"%"},{queue:false,duration:d.animate});
(e=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[c?"animate":"css"]({height:g+"%"},d.animate);
(e=="max")&&(this.orientation=="vertical")&&this.range[c?"animate":"css"]({height:(100-g)+"%"},{queue:false,duration:d.animate});
}}}));
a.extend(a.ui.slider,{getter:"value values",version:"1.7.1",eventPrefix:"slide",defaults:{animate:false,delay:0,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null}});
})(jQuery);


