$.fn.prettyPhoto=function(t){var p=false;var q=0;var b=0;var x=0;var g=false;var o=0;var c=true;var m=[];$(window).scroll(function(){a()});$(window).resize(function(){a();r()});$(document).keyup(function(y){switch(y.keyCode){case 37:if(b==1){return}l("previous");break;case 39:if(b==q){return}l("next");break;case 27:k();break}});t=jQuery.extend({animationSpeed:"normal",padding:40,opacity:0.35,showTitle:true,allowresize:true,counter_separator_label:"/"},t);$(this).each(function(){m[m.length]=this;$(this).bind("click",function(){h(this);return false})});function h(y){o=$(y);theRel=$(o).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);contentType="image";if($(o).attr("href").indexOf(".swf")>0){g=false;contentType="flash"}p=false;q=0;for(i=0;i1){p=true}if($(m[i]).attr("href")==$(y).attr("href")){b=q;x=i}}}u(p);$("div.pictureHolder p.currentTextHolder").text(b+t.counter_separator_label+q);a();$("div.pictureHolder #fullResImageContainer").hide();$(".loaderIcon").show();(contentType=="image")?v():f()}showimage=function(B,y,E,D,C,z,A){$(".loaderIcon").hide();var F=e();if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()}$("div.pictureHolder .content").animate({height:C,width:E},t.animationSpeed);projectedTop=F.scrollTop+((windowHeight/2)-(D/2));if(projectedTop<0){projectedTop=0+$("div.prettyPhotoTitle").height()}$("div.pictureHolder").animate({top:projectedTop,left:((windowWidth/2)-(E/2)),width:E},t.animationSpeed,function(){$("#fullResImage").attr({width:B,height:y});$("div.pictureHolder").width(E);$("div.pictureHolder .hoverContainer").height(y).width(B);d();$("div.pictureHolder #fullResImageContainer").fadeIn(t.animationSpeed);if(A){$("a.expand,a.contract").fadeIn(t.animationSpeed)}})};function l(y){if(y=="previous"){x--;b--}else{x++;b++}if(!c){c=true}$("div.pictureHolder .hoverContainer,div.pictureHolder .details").fadeOut(t.animationSpeed);$("div.pictureHolder #fullResImageContainer").fadeOut(t.animationSpeed,function(){$(".loaderIcon").show();v()});w();$("a.expand,a.contract").fadeOut(t.animationSpeed,function(){$(this).removeClass("contract").addClass("expand")})}function k(){$("div.pictureHolder,div.prettyPhotoTitle").fadeOut(t.animationSpeed,function(){$("div.prettyPhotoOverlay").fadeOut(t.animationSpeed,function(){$("div.prettyPhotoOverlay,div.pictureHolder,div.prettyPhotoTitle").remove();if($.browser.msie&&$.browser.version==6){$("select").css("visibility","visible")}})})}function j(){if(b==q){$("div.pictureHolder a.next").css("visibility","hidden");$("div.pictureHolder a.arrow_next").addClass("disabled").unbind("click")}else{$("div.pictureHolder a.next").css("visibility","visible");$("div.pictureHolder a.arrow_next.disabled").removeClass("disabled").bind("click",function(){l("next");return false})}if(b==1){$("div.pictureHolder a.previous").css("visibility","hidden");$("div.pictureHolder a.arrow_previous").addClass("disabled").unbind("click")}else{$("div.pictureHolder a.previous").css("visibility","visible");$("div.pictureHolder a.arrow_previous.disabled").removeClass("disabled").bind("click",function(){l("previous");return false})}$("div.pictureHolder p.currentTextHolder").text(b+t.counter_separator_label+q);(p)?$c=$(m[x]):$c=$(o);if($c.attr("title")){$("div.pictureHolder .description").show().html(unescape($c.attr("title")))}else{$("div.pictureHolder .description").hide().text("")}if($c.find("img").attr("alt")&&t.showTitle){g=true;$("div.prettyPhotoTitle .prettyPhotoTitleContent").html(unescape($c.find("img").attr("alt")))}else{g=false}}function n(B,z){hasBeenResized=false;$("div.pictureHolder .details").width(B);$("div.pictureHolder .details p.description").width(B-parseFloat($("div.pictureHolder a.close").css("width")));contentHeight=z+parseFloat($("div.pictureHolder .details").height())+parseFloat($("div.pictureHolder .details").css("margin-top"))+parseFloat($("div.pictureHolder .details").css("margin-bottom"));contentWidth=B;containerHeight=z+parseFloat($("div.prettyPhotoTitle").height())+parseFloat($("div.pictureHolder .top").height())+parseFloat($("div.pictureHolder .bottom").height());containerWidth=B+t.padding;imageWidth=B;imageHeight=z;if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()}if(((containerWidth>windowWidth)||(containerHeight>windowHeight))&&c&&t.allowresize){hasBeenResized=true;if((containerWidth>windowWidth)&&(containerHeight>windowHeight)){var A=(containerWidth+200)/windowWidth;var y=(containerHeight+200)/windowHeight}else{var A=windowWidth/containerWidth;var y=windowHeight/containerHeight}if(y>A){imageWidth=Math.round(B*(1/y));imageHeight=Math.round(z*(1/y))}else{imageWidth=Math.round(B*(1/A));imageHeight=Math.round(z*(1/A))}contentHeight=imageHeight+parseFloat($("div.pictureHolder .details").height())+parseFloat($("div.pictureHolder .details").css("margin-top"))+parseFloat($("div.pictureHolder .details").css("margin-bottom"));contentWidth=imageWidth;containerHeight=imageHeight+parseFloat($("div.prettyPhotoTitle").height())+parseFloat($("div.pictureHolder .top").height())+parseFloat($("div.pictureHolder .bottom").height());containerWidth=imageWidth+t.padding;$("div.pictureHolder .details").width(contentWidth);$("div.pictureHolder .details p.description").width(contentWidth-parseFloat($("div.pictureHolder a.close").css("width")))}return{width:imageWidth,height:imageHeight,containerHeight:containerHeight,containerWidth:containerWidth,contentHeight:contentHeight,contentWidth:contentWidth,resized:hasBeenResized}}function a(){if($("div.pictureHolder").size()>0){var y=e();if($.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=$(window).height();windowWidth=$(window).width()}if(c){projectedTop=(windowHeight/2)+y.scrollTop-($("div.pictureHolder").height()/2);if(projectedTop<0){projectedTop=0+$("div.prettyPhotoTitle").height()}$("div.pictureHolder").css({top:projectedTop,left:(windowWidth/2)+y.scrollLeft-($("div.pictureHolder").width()/2)});$("div.prettyPhotoTitle").css({top:$("div.pictureHolder").offset().top-$("div.prettyPhotoTitle").height(),left:$("div.pictureHolder").offset().left+(t.padding/2)})}}}function d(){if(p){$("div.pictureHolder .hoverContainer").fadeIn(t.animationSpeed)}$("div.pictureHolder .details").fadeIn(t.animationSpeed);s()}function s(){if(t.showTitle&&g){$("div.prettyPhotoTitle").css({top:$("div.pictureHolder").offset().top,left:$("div.pictureHolder").offset().left+(t.padding/2),display:"block"});$("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width","auto");if($("div.prettyPhotoTitle").width()>$("div.pictureHolder").width()){$("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width",$("div.pictureHolder").width()-(t.padding*2))}else{$("div.prettyPhotoTitle div.prettyPhotoTitleContent").css("width","")}$("div.prettyPhotoTitle").animate({top:($("div.pictureHolder").offset().top-22)},t.animationSpeed)}}function w(){$("div.prettyPhotoTitle").animate({top:($("div.pictureHolder").offset().top)},t.animationSpeed,function(){$(this).css("display","none")})}function v(){j();imgPreloader=new Image();nextImage=new Image();if(p){nextImage.src=$(m[x+1]).attr("href")}prevImage=new Image();if(p&&m[x-1]){prevImage.src=$(m[x-1]).attr("href")}$("div.pictureHolder .content").css("overflow","hidden");if(p){$("div.pictureHolder #fullResImage").attr("src",$(m[x]).attr("href"))}else{$("div.pictureHolder #fullResImage").attr("src",$(o).attr("href"))}imgPreloader.onload=function(){var y=n(imgPreloader.width,imgPreloader.height);imgPreloader.width=y.width;imgPreloader.height=y.height;setTimeout("showimage(imgPreloader.width,imgPreloader.height,"+y.containerWidth+","+y.containerHeight+","+y.contentHeight+","+y.contentWidth+","+y.resized+")",500)};(p)?imgPreloader.src=$(m[x]).attr("href"):imgPreloader.src=$(o).attr("href")}function e(){scrollTop=window.pageYOffset||document.documentElement.scrollTop||0;scrollLeft=window.pageXOffset||document.documentElement.scrollLeft||0;return{scrollTop:scrollTop,scrollLeft:scrollLeft}}function r(){$("div.prettyPhotoOverlay").css({height:$(document).height(),width:$(window).width()})}function f(){flashParams=$(o).attr("rel").split(";");$(flashParams).each(function(y){if(flashParams[y].indexOf("width")>=0){flashWidth=flashParams[y].substring(flashParams[y].indexOf("width")+6,flashParams[y].length)}if(flashParams[y].indexOf("height")>=0){flashHeight=flashParams[y].substring(flashParams[y].indexOf("height")+7,flashParams[y].length)}if(flashParams[y].indexOf("flashvars")>=0){flashVars=flashParams[y].substring(flashParams[y].indexOf("flashvars")+10,flashParams[y].length)}});$(".pictureHolder #fullResImageContainer").append('');$("#fullResImage").hide();contentHeight=parseFloat(flashHeight)+parseFloat($("div.pictureHolder .details").height())+parseFloat($("div.pictureHolder .details").css("margin-top"))+parseFloat($("div.pictureHolder .details").css("margin-bottom"));contentWidth=parseFloat(flashWidth)+parseFloat($("div.pictureHolder .details").width())+parseFloat($("div.pictureHolder .details").css("margin-left"))+parseFloat($("div.pictureHolder .details").css("margin-right"));containerHeight=contentHeight+parseFloat($("div.pictureHolder .top").height())+parseFloat($("div.pictureHolder .bottom").height());containerWidth=parseFloat(flashWidth)+parseFloat($("div.pictureHolder .content").css("padding-left"))+parseFloat($("div.pictureHolder .content").css("padding-right"))+t.padding;setTimeout("showimage("+flashWidth+","+flashHeight+","+containerWidth+","+containerHeight+","+contentHeight+","+contentWidth+")",500)}function u(){backgroundDiv="
";$("body").append(backgroundDiv);$("div.prettyPhotoOverlay").css("height",$(document).height()).bind("click",function(){k()});pictureHolder='
Expand
Close

';titleHolder='
';$("body").append(pictureHolder).append(titleHolder);$(".pictureHolder,.titleHolder").css({opacity:0});$("a.close").bind("click",function(){k();return false});$("a.expand").bind("click",function(){if($(this).hasClass("expand")){$(this).removeClass("expand").addClass("contract");c=false}else{$(this).removeClass("contract").addClass("expand");c=true}w();$("div.pictureHolder .hoverContainer,div.pictureHolder #fullResImageContainer").fadeOut(t.animationSpeed);$("div.pictureHolder .details").fadeOut(t.animationSpeed,function(){v()});return false});$(".pictureHolder .previous,.pictureHolder .arrow_previous").bind("click",function(){l("previous");return false});$(".pictureHolder .next,.pictureHolder .arrow_next").bind("click",function(){l("next");return false});$(".hoverContainer").css({"margin-left":t.padding/2});if(!p){$(".hoverContainer,.nav").hide()}if($.browser.msie&&$.browser.version==6){$("select").css("visibility","hidden")}$("div.prettyPhotoOverlay").css("opacity",0).fadeTo(t.animationSpeed,t.opacity,function(){$("div.pictureHolder").css("opacity",0).fadeIn(t.animationSpeed,function(){$("div.pictureHolder").attr("style","left:"+$("div.pictureHolder").css("left")+";top:"+$("div.pictureHolder").css("top")+";")})})}};