jQuery(document).ready(function(){prettyPhoto.init()});prettyPhoto={options:{animationSpeed:"fast",padding:40,opacity:0.35,showTitle:true},init:function(){prettyPhoto.imagesArray=[];jQuery("a[rel^='lightbox']").each(function(){prettyPhoto.imagesArray[prettyPhoto.imagesArray.length]=this;jQuery(this).bind("click",function(){prettyPhoto.open(this);return false})});jQuery(window).scroll(function(){prettyPhoto.centerPicture()});jQuery(window).resize(function(){prettyPhoto.centerPicture();prettyPhoto.resizeOverlay()})},open:function(A){prettyPhoto.caller=A;theRel=jQuery(A).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);prettyPhoto.setCount=0;prettyPhoto.setPosition=0;prettyPhoto.arrayPosition=0;prettyPhoto.isSet=false;for(i=0;i<prettyPhoto.imagesArray.length;i++){if(jQuery(prettyPhoto.imagesArray[i]).attr("rel").indexOf(theGallery)!=-1){prettyPhoto.setCount++;if(prettyPhoto.setCount>1){prettyPhoto.isSet=true}if(jQuery(prettyPhoto.imagesArray[i]).attr("href")==jQuery(A).attr("href")){prettyPhoto.setPosition=prettyPhoto.setCount;prettyPhoto.arrayPosition=i}}}prettyPhoto.buildOverlay(prettyPhoto.isSet);jQuery("div.pictureHolder span.currentText").html("<span>"+prettyPhoto.setPosition+"</span>/"+prettyPhoto.setCount);prettyPhoto.centerPicture();jQuery("div.pictureHolder #fullResImageContainer").hide();jQuery(".loaderIcon").show();prettyPhoto.preload()},next:function(){prettyPhoto.arrayPosition++;prettyPhoto.setPosition++;jQuery("div.pictureHolder #fullResImageContainer").fadeOut(prettyPhoto.options.animationSpeed,function(){jQuery(".loaderIcon").show();prettyPhoto.preload()});prettyPhoto.hideTitle();jQuery("div.pictureHolder .hoverContainer").fadeOut(prettyPhoto.options.animationSpeed);jQuery("div.pictureHolder .details").fadeOut(prettyPhoto.options.animationSpeed,function(){prettyPhoto.checkPosition()})},previous:function(){prettyPhoto.arrayPosition--;prettyPhoto.setPosition--;jQuery("div.pictureHolder #fullResImageContainer").fadeOut(prettyPhoto.options.animationSpeed,function(){jQuery(".loaderIcon").show();prettyPhoto.preload()});prettyPhoto.hideTitle();jQuery("div.pictureHolder .hoverContainer").fadeOut(prettyPhoto.options.animationSpeed);jQuery("div.pictureHolder .details").fadeOut(prettyPhoto.options.animationSpeed,function(){prettyPhoto.checkPosition()})},checkPosition:function(){(prettyPhoto.setPosition==prettyPhoto.setCount)?jQuery("div.pictureHolder a.next").hide():jQuery("div.pictureHolder a.next").show();(prettyPhoto.setPosition==1)?jQuery("div.pictureHolder a.previous").hide():jQuery("div.pictureHolder a.previous").show();jQuery("div.pictureHolder span.currentText span").text(prettyPhoto.setPosition);if(prettyPhoto.isSet){if(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr("title")){jQuery("div.pictureHolder .description").html(unescape(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr("title")))}else{jQuery("div.pictureHolder .description").text("")}if(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).find("img").attr("alt")&&prettyPhoto.options.showTitle){prettyPhoto.hasTitle=true;jQuery("div.prettyPhotoTitle .prettyPhotoTitleContent").html(unescape(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).find("img").attr("alt")))}else{prettyPhoto.hasTitle=false}}else{if(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr("title")){jQuery("div.pictureHolder .description").html(unescape(jQuery(prettyPhoto.caller).attr("title")))}else{jQuery("div.pictureHolder .description").text("")}if(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).find("img").attr("alt")&&prettyPhoto.options.showTitle){prettyPhoto.hasTitle=true;jQuery("div.prettyPhotoTitle .prettyPhotoTitleContent").html(unescape(jQuery(prettyPhoto.caller).find("img").attr("alt")))}else{prettyPhoto.hasTitle=false}}},centerPicture:function(){if(jQuery("div.pictureHolder").size()>0){var A=prettyPhoto.getScroll();if(jQuery.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=jQuery(window).height();windowWidth=jQuery(window).width()}jQuery("div.pictureHolder").css({top:(windowHeight/2)+A.scrollTop-(jQuery("div.pictureHolder").height()/2),left:(windowWidth/2)+A.scrollLeft-(jQuery("div.pictureHolder").width()/2)});jQuery("div.prettyPhotoTitle").css({top:jQuery("div.pictureHolder").offset().top-22,left:jQuery("div.pictureHolder").offset().left+(prettyPhoto.options.padding/2)})}},preload:function(){prettyPhoto.checkPosition();imgPreloader=new Image();nextImage=new Image();if(prettyPhoto.isSet){nextImage.src=jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition+1]).attr("href")}prevImage=new Image();if(prettyPhoto.isSet&&prettyPhoto.imagesArray[prettyPhoto.arrayPosition-1]){prevImage.src=jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition-1]).attr("href")}jQuery("div.pictureHolder .content").css("overflow","hidden");(prettyPhoto.isSet)?jQuery("div.pictureHolder #fullResImage").attr("src",jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr("href")):jQuery("div.pictureHolder #fullResImage").attr("src",jQuery(prettyPhoto.caller).attr("href"));imgPreloader.onload=function(){var A=prettyPhoto.resize(imgPreloader.width,imgPreloader.height);imgPreloader.width=A.width;imgPreloader.height=A.height;setTimeout("prettyPhoto.showimage(imgPreloader.width,imgPreloader.height,"+A.containerWidth+","+A.containerHeight+","+A.contentWidth+")",500)};(prettyPhoto.isSet)?imgPreloader.src=jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr("href"):imgPreloader.src=jQuery(prettyPhoto.caller).attr("href")},showimage:function(C,A,E,D,B){jQuery(".loaderIcon").hide();jQuery("div.pictureHolder .content").animate({height:contentHeight},prettyPhoto.options.animationSpeed);var F=prettyPhoto.getScroll();if(jQuery.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=jQuery(window).height();windowWidth=jQuery(window).width()}jQuery("div.pictureHolder").animate({top:F.scrollTop+((windowHeight/2)-(D/2)),left:((windowWidth/2)-(E/2)),width:E},prettyPhoto.options.animationSpeed,function(){jQuery("#fullResImage").attr({width:C,height:A});prettyPhoto.shownav();jQuery("div.pictureHolder .hoverContainer").height(A).width(C);jQuery("div.pictureHolder #fullResImageContainer").fadeIn(prettyPhoto.options.animationSpeed)})},shownav:function(){if(prettyPhoto.isSet){jQuery("div.pictureHolder .hoverContainer").fadeIn(prettyPhoto.options.animationSpeed)}jQuery("div.pictureHolder .details").fadeIn(prettyPhoto.options.animationSpeed);prettyPhoto.showTitle()},showTitle:function(){if(prettyPhoto.options.showTitle&&prettyPhoto.hasTitle){jQuery("div.prettyPhotoTitle").css({top:jQuery("div.pictureHolder").offset().top,left:jQuery("div.pictureHolder").offset().left+(prettyPhoto.options.padding/2),display:"block"});jQuery("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width","auto");if(jQuery("div.prettyPhotoTitle").width()>jQuery("div.pictureHolder").width()){jQuery("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width",jQuery("div.pictureHolder").width()-(prettyPhoto.options.padding*2))}else{jQuery("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width","")}jQuery("div.prettyPhotoTitle").animate({top:(jQuery("div.pictureHolder").offset().top-22)},prettyPhoto.options.animationSpeed)}},hideTitle:function(){jQuery("div.prettyPhotoTitle").animate({top:(jQuery("div.pictureHolder").offset().top)},prettyPhoto.options.animationSpeed,function(){jQuery(this).css("display","none")})},buildOverlay:function(){backgroundDiv="<div class='prettyPhotoOverlay'></div>";jQuery("body").append(backgroundDiv);jQuery("div.prettyPhotoOverlay").css("height",jQuery(document).height());jQuery(".prettyPhotoOverlay").bind("click",function(){prettyPhoto.close()});pictureHolder='<div class="pictureHolder"><div class="top"><div class="left"></div><div class="middle"></div><div class="right"></div></div><div class="content"><div class="loaderIcon"></div><div class="hoverContainer"><a class="next" href="#">next</a><a class="previous" href="#">previous</a></div><div id="fullResImageContainer"><img id="fullResImage" src="" /></div><div class="details clearfix"><a class="close" href="#">Close</a><p class="description"></p><p class="currentTextHolder"><span class="currentText"><span>0</span>/<span class="total">0</span></span></p></div></div><div class="bottom"><div class="left"></div><div class="middle"></div><div class="right"></div></div></div>';titleHolder='<div class="prettyPhotoTitle"><div class="prettyPhotoTitleLeft"></div><div class="prettyPhotoTitleContent"></div><div class="prettyPhotoTitleRight"></div></div>';jQuery("body").append(pictureHolder).append(titleHolder);jQuery(".pictureHolder,.titleHolder").css({opacity:0});jQuery("a.close").bind("click",function(){prettyPhoto.close();return false});jQuery(".pictureHolder .previous").bind("click",function(){prettyPhoto.previous();return false});jQuery(".pictureHolder .next").bind("click",function(){prettyPhoto.next();return false});jQuery(".hoverContainer").css({"margin-left":prettyPhoto.options.padding/2,"margin-right":prettyPhoto.options.padding/2});if(!prettyPhoto.isSet){jQuery(".hoverContainer").hide();jQuery(".currentTextHolder").hide()}if(jQuery.browser.msie&&jQuery.browser.version==6){jQuery("select").css("visibility","hidden")}jQuery("div.prettyPhotoOverlay").css("opacity",0);jQuery("div.prettyPhotoOverlay").fadeTo(prettyPhoto.options.animationSpeed,prettyPhoto.options.opacity,function(){jQuery("div.pictureHolder").fadeTo(prettyPhoto.options.animationSpeed,1,function(){jQuery("div.pictureHolder").attr("style","left:"+jQuery("div.pictureHolder").css("left")+";top:"+jQuery("div.pictureHolder").css("top")+";")})})},resize:function(E,B){jQuery("div.pictureHolder .details").width(E);jQuery("div.pictureHolder .details p.description").width(E-parseFloat(jQuery("div.pictureHolder a.close").css("width")));contentHeight=parseFloat(jQuery("div.pictureHolder .details").height())+parseFloat(jQuery("div.pictureHolder .details").css("margin-top"))+parseFloat(jQuery("div.pictureHolder .details").css("margin-bottom"));containerHeight=contentHeight+parseFloat(jQuery("div.pictureHolder .top").height())+parseFloat(jQuery("div.pictureHolder .bottom").height());containerWidth=parseFloat(jQuery("div.pictureHolder .content").css("padding-left"))+parseFloat(jQuery("div.pictureHolder .content").css("padding-right"))+prettyPhoto.options.padding;var F=E;var D=B;if(prettyPhoto.options.showTitle){containerHeight-=22}if(jQuery.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=jQuery(window).height();windowWidth=jQuery(window).width()}if((containerWidth+E)>windowWidth||(containerHeight+B)>windowHeight){var C=(E+containerWidth+100)/windowWidth;var A=(B+containerHeight+100)/windowHeight;if(A>C){F=Math.round(E*(1/A));D=Math.round(B*(1/A))}else{F=Math.round(E*(1/C));D=Math.round(B*(1/C))}}containerHeight+=D;contentHeight+=D;containerWidth+=F;jQuery("div.pictureHolder .details").width(F);jQuery("div.pictureHolder .details p.description").width(F-parseFloat(jQuery("div.pictureHolder a.close").css("width")));return{width:F,height:D,containerHeight:containerHeight,containerWidth:containerWidth,contentHeight:contentHeight}},resizeOverlay:function(){jQuery("div.prettyPhotoOverlay").css({height:jQuery(document).height(),width:jQuery(window).width()})},getScroll:function(){scrollTop=window.pageYOffset||document.documentElement.scrollTop||0;scrollLeft=window.pageXOffset||document.documentElement.scrollLeft||0;return{scrollTop:scrollTop,scrollLeft:scrollLeft}},close:function(){jQuery("div.pictureHolder,div.prettyPhotoTitle").fadeTo(prettyPhoto.options.animationSpeed,0,function(){jQuery("div.prettyPhotoOverlay").fadeTo(prettyPhoto.options.animationSpeed,0,function(){jQuery("div.prettyPhotoOverlay").remove();jQuery("div.pictureHolder").remove();if(jQuery.browser.msie&&jQuery.browser.version==6){jQuery("select").css("visibility","visible")}})})}};