(function(d){d.prettyPhoto={version:"2.5.3"};d.fn.prettyPhoto=function(A){A=jQuery.extend({animationSpeed:"normal",padding:40,opacity:0.8,showTitle:true,allowresize:true,counter_separator_label:"/",theme:"light_rounded",hideflash:false,modal:false,changepicturecallback:function(){},callback:function(){}},A);if(d.browser.msie&&d.browser.version==6){A.theme="light_square"}if(d(".pp_overlay").size()==0){z()}else{F=d(".pp_pic_holder");a=d(".ppt")}var Q=true,M=false,B,F,a,A,H,G,C,y,P="image",R=0,K=O();d(window).scroll(function(){K=O();L();D()});d(window).resize(function(){L();D()});d(document).keydown(function(e){if(F.is(":visible")){switch(e.keyCode){case 37:d.prettyPhoto.changePage("previous");break;case 39:d.prettyPhoto.changePage("next");break;case 27:if(!A.modal){d.prettyPhoto.close()}break}}});d(this).each(function(){d(this).bind("click",function(){link=this;theRel=d(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var g=new Array(),e=new Array(),f=new Array();if(theGallery){d("a[rel*="+theGallery+"]").each(function(h){if(d(this)[0]===d(link)[0]){R=h}g.push(d(this).attr("href"));e.push(d(this).find("img").attr("alt"));f.push(d(this).attr("title"))})}else{g=d(this).attr("href");e=(d(this).find("img").attr("alt"))?d(this).find("img").attr("alt"):"";f=(d(this).attr("title"))?d(this).attr("title"):""}d.prettyPhoto.open(g,e,f);return false})});d.prettyPhoto.open=function(e,f,g){if(d.browser.msie&&d.browser.version==6){d("select").css("visibility","hidden")}if(A.hideflash){d("object,embed").css("visibility","hidden")}images=d.makeArray(e);titles=d.makeArray(f);descriptions=d.makeArray(g);if(d(".pp_overlay").size()==0){z()}else{F=d(".pp_pic_holder");a=d(".ppt")}F.attr("class","pp_pic_holder "+A.theme);isSet=(d(images).size()>0)?true:false;b(images[R]);L();N(d(images).size());d(".pp_loaderIcon").show();d("div.pp_overlay").show().fadeTo(A.animationSpeed,A.opacity,function(){F.fadeIn(A.animationSpeed,function(){F.find("p.currentTextHolder").text((R+1)+A.counter_separator_label+d(images).size());if(descriptions[R]){F.find(".pp_description").show().html(unescape(descriptions[R]))}else{F.find(".pp_description").hide().text("")}if(titles[R]&&A.showTitle){hasTitle=true;a.html(unescape(titles[R]))}else{hasTitle=false}if(P=="image"){imgPreloader=new Image();nextImage=new Image();if(isSet&&R>d(images).size()){nextImage.src=images[R+1]}prevImage=new Image();if(isSet&&images[R-1]){prevImage.src=images[R-1]}pp_typeMarkup='<img id="fullResImage" src="" />';F.find("#pp_full_res")[0].innerHTML=pp_typeMarkup;F.find(".pp_content").css("overflow","hidden");F.find("#fullResImage").attr("src",images[R]);imgPreloader.onload=function(){B=I(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.src=images[R]}else{movie_width=(parseFloat(c("width",images[R])))?c("width",images[R]):"425";movie_height=(parseFloat(c("height",images[R])))?c("height",images[R]):"344";if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=(d(window).height()*parseFloat(movie_height)/100)-100;movie_width=(d(window).width()*parseFloat(movie_width)/100)-100;M=true}movie_height=parseFloat(movie_height);movie_width=parseFloat(movie_width);if(P=="quicktime"){movie_height+=15}B=I(movie_width,movie_height);if(P=="youtube"){pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+B.width+'" height="'+B.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.youtube.com/v/'+c("v",images[R])+'" /><embed src="http://www.youtube.com/v/'+c("v",images[R])+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+B.width+'" height="'+B.height+'"></embed></object>'}else{if(P=="quicktime"){pp_typeMarkup='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+B.height+'" width="'+B.width+'"><param name="src" value="'+images[R]+'"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="'+images[R]+'" height="'+B.height+'" width="'+B.width+'" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>'}else{if(P=="flash"){flash_vars=images[R];flash_vars=flash_vars.substring(images[R].indexOf("flashvars")+10,images[R].length);filename=images[R];filename=filename.substring(0,filename.indexOf("?"));pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+B.width+'" height="'+B.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+filename+"?"+flash_vars+'" /><embed src="'+filename+"?"+flash_vars+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+B.width+'" height="'+B.height+'"></embed></object>'}else{if(P=="iframe"){movie_url=images[R];movie_url=movie_url.substr(0,movie_url.indexOf("iframe")-1);pp_typeMarkup='<iframe src ="'+movie_url+'" width="'+(B.width-10)+'" height="'+(B.height-10)+'" frameborder="no"></iframe>'}}}}_showContent()}})})};d.prettyPhoto.changePage=function(e){if(e=="previous"){R--;if(R<0){R=0;return}}else{if(d(".pp_arrow_next").is(".disabled")){return}R++}if(!Q){Q=true}J();d("a.pp_expand,a.pp_contract").fadeOut(A.animationSpeed,function(){d(this).removeClass("pp_contract").addClass("pp_expand");d.prettyPhoto.open(images,titles,descriptions)})};d.prettyPhoto.close=function(){F.find("object,embed").css("visibility","hidden");d("div.pp_pic_holder,div.ppt").fadeOut(A.animationSpeed);d("div.pp_overlay").fadeOut(A.animationSpeed,function(){d("div.pp_overlay,div.pp_pic_holder,div.ppt").remove();if(d.browser.msie&&d.browser.version==6){d("select").css("visibility","visible")}if(A.hideflash){d("object,embed").css("visibility","visible")}R=0;A.callback()});Q=true};_showContent=function(){d(".pp_loaderIcon").hide();if(d.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=d(window).height();windowWidth=d(window).width()}projectedTop=K.scrollTop+((windowHeight/2)-(B.containerHeight/2));if(projectedTop<0){projectedTop=0+F.find(".ppt").height()}F.find(".pp_content").animate({height:B.contentHeight},A.animationSpeed);F.animate({top:projectedTop,left:((windowWidth/2)-(B.containerWidth/2)),width:B.containerWidth},A.animationSpeed,function(){F.width(B.containerWidth);F.find(".pp_hoverContainer,#fullResImage").height(B.height).width(B.width);F.find("#pp_full_res").fadeIn(A.animationSpeed);if(isSet&&P=="image"){F.find(".pp_hoverContainer").fadeIn(A.animationSpeed)}else{F.find(".pp_hoverContainer").hide()}F.find(".pp_details").fadeIn(A.animationSpeed);if(A.showTitle&&hasTitle){a.css({top:F.offset().top-20,left:F.offset().left+(A.padding/2),display:"none"});a.fadeIn(A.animationSpeed)}if(B.resized){d("a.pp_expand,a.pp_contract").fadeIn(A.animationSpeed)}if(P!="image"){F.find("#pp_full_res")[0].innerHTML=pp_typeMarkup}A.changepicturecallback()})};function J(){F.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");F.find(".pp_hoverContainer,.pp_details").fadeOut(A.animationSpeed);F.find("#pp_full_res").fadeOut(A.animationSpeed,function(){d(".pp_loaderIcon").show()});a.fadeOut(A.animationSpeed)}function N(e){if(R==e-1){F.find("a.pp_next").css("visibility","hidden");F.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{F.find("a.pp_next").css("visibility","visible");F.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){d.prettyPhoto.changePage("next");return false})}if(R==0){F.find("a.pp_previous").css("visibility","hidden");F.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{F.find("a.pp_previous").css("visibility","visible");F.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){d.prettyPhoto.changePage("previous");return false})}if(e>1){d(".pp_nav").show()}else{d(".pp_nav").hide()}}function I(e,f){hasBeenResized=false;E(e,f);imageWidth=e;imageHeight=f;windowHeight=d(window).height();windowWidth=d(window).width();if(((y>windowWidth)||(C>windowHeight))&&Q&&A.allowresize&&!M){hasBeenResized=true;notFitting=true;while(notFitting){if((y>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(f/e)*imageWidth}else{if((C>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(e/f)*imageHeight}else{notFitting=false}}C=imageHeight;y=imageWidth}E(imageWidth,imageHeight)}return{width:imageWidth,height:imageHeight,containerHeight:C,containerWidth:y,contentHeight:H,contentWidth:G,resized:hasBeenResized}}function E(e,f){F.find(".pp_details").width(e).find(".pp_description").width(e-parseFloat(F.find("a.pp_close").css("width")));H=f+F.find(".pp_details").height()+parseFloat(F.find(".pp_details").css("marginTop"))+parseFloat(F.find(".pp_details").css("marginBottom"));G=e;C=H+F.find(".ppt").height()+F.find(".pp_top").height()+F.find(".pp_bottom").height();y=e+A.padding}function b(e){if(e.match(/youtube\.com\/watch/i)){P="youtube"}else{if(e.indexOf(".mov")!=-1){P="quicktime"}else{if(e.indexOf(".swf")!=-1){P="flash"}else{if(e.indexOf("iframe")!=-1){P="iframe"}else{P="image"}}}}}function L(){if(d.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=d(window).height();windowWidth=d(window).width()}if(Q){$pHeight=F.height();$pWidth=F.width();$tHeight=a.height();projectedTop=(windowHeight/2)+K.scrollTop-($pHeight/2);if(projectedTop<0){projectedTop=0+$tHeight}F.css({top:projectedTop,left:(windowWidth/2)+K.scrollLeft-($pWidth/2)});a.css({top:projectedTop-$tHeight,left:(windowWidth/2)+K.scrollLeft-($pWidth/2)+(A.padding/2)})}}function O(){if(self.pageYOffset){scrollTop=self.pageYOffset;scrollLeft=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){scrollTop=document.documentElement.scrollTop;scrollLeft=document.documentElement.scrollLeft}else{if(document.body){scrollTop=document.body.scrollTop;scrollLeft=document.body.scrollLeft}}}return{scrollTop:scrollTop,scrollLeft:scrollLeft}}function D(){d("div.pp_overlay").css({height:d(document).height(),width:d(window).width()})}function z(){toInject="";toInject+="<div class='pp_overlay'></div>";toInject+='<div class="pp_pic_holder"><div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div><div class="pp_content"><a href="#" class="pp_expand" title="Expand the image">Expand</a><div class="pp_loaderIcon"></div><div class="pp_hoverContainer"><a class="pp_next" href="#">next</a><a class="pp_previous" href="#">previous</a></div><div id="pp_full_res"></div><div class="pp_details clearfix"><a class="pp_close" href="#">Close</a><p class="pp_description"></p><div class="pp_nav"><a href="#" class="pp_arrow_previous">Previous</a><p class="currentTextHolder">0'+A.counter_separator_label+'0</p><a href="#" class="pp_arrow_next">Next</a></div></div></div><div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div></div>';toInject+='<div class="ppt"></div>';d("body").append(toInject);d("div.pp_overlay").css("opacity",0);F=d(".pp_pic_holder");a=d(".ppt");d("div.pp_overlay").css("height",d(document).height()).hide().bind("click",function(){if(!A.modal){d.prettyPhoto.close()}});d("a.pp_close").bind("click",function(){d.prettyPhoto.close();return false});d("a.pp_expand").bind("click",function(){$this=d(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");Q=false}else{$this.removeClass("pp_contract").addClass("pp_expand");Q=true}J();F.find(".pp_hoverContainer, .pp_details").fadeOut(A.animationSpeed);F.find("#pp_full_res").fadeOut(A.animationSpeed,function(){d.prettyPhoto.open(images,titles,descriptions)});return false});F.find(".pp_previous, .pp_arrow_previous").bind("click",function(){d.prettyPhoto.changePage("previous");return false});F.find(".pp_next, .pp_arrow_next").bind("click",function(){d.prettyPhoto.changePage("next");return false});F.find(".pp_hoverContainer").css({"margin-left":A.padding/2})}};function c(h,i){h=h.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var j="[\\?&]"+h+"=([^&#]*)";var a=new RegExp(j);var b=a.exec(i);if(b==null){return""}else{return b[1]}}})(jQuery);
