(function(a){a.prettyPhoto={version:"2.5.3"};a.fn.prettyPhoto=function(c){c=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(){},opencallback:function(){}},c);if(a(".pp_overlay").size()==0)s();else{b=a(".pp_pic_holder");i=a(".ppt")}var h=true,t=false,f,b,i,q,u,l,m,j="image",e=0,n=v();a(window).scroll(function(){n=v();r();w()}); a(window).resize(function(){r();w()});a(document).keydown(function(d){if(b.is(":visible"))switch(d.keyCode){case 37:a.prettyPhoto.changePage("previous");break;case 39:a.prettyPhoto.changePage("next");break;case 27:c.modal||a.prettyPhoto.close();break}});a(this).each(function(){a(this).unbind().bind("click",function(){c.opencallback();link=this;theRel=a(this).attr("rel");galleryRegExp=/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var d=[],g=[],o=[];if(theGallery)a("a[rel*="+theGallery+"]").each(function(p){if(a(this)[0]=== a(link)[0])e=p;d.push(a(this).attr("href"));g.push(a(this).find("img").attr("alt"));o.push(a(this).attr("title"))});else{d=a(this).attr("href");g=a(this).find("img").attr("alt")?a(this).find("img").attr("alt"):"";o=a(this).attr("title")?a(this).attr("title"):""}a.prettyPhoto.open(d,g,o);return false})});a.prettyPhoto.open=function(d,g,o){a.browser.msie&&a.browser.version==6&&a("select").css("visibility","hidden");c.hideflash&&a("object,embed").css("visibility","hidden");images=a.makeArray(d);titles= a.makeArray(g);descriptions=a.makeArray(o);if(a(".pp_overlay").size()==0)s();else{b=a(".pp_pic_holder");i=a(".ppt")}b.attr("class","pp_pic_holder "+c.theme);isSet=a(images).size()>0?true:false;A(images[e]);r();B(a(images).size());a(".pp_loaderIcon").show();a("div.pp_overlay").show().fadeTo(c.animationSpeed,c.opacity,function(){b.fadeIn(c.animationSpeed,function(){b.find("p.currentTextHolder").text(e+1+c.counter_separator_label+a(images).size());descriptions[e]?b.find(".pp_description").show().html(unescape(descriptions[e])): b.find(".pp_description").hide().text("");if(titles[e]&&c.showTitle){hasTitle=true;i.html(unescape(titles[e]))}else hasTitle=false;if(j=="image"){imgPreloader=new Image;nextImage=new Image;if(isSet&&e>a(images).size())nextImage.src=images[e+1];prevImage=new Image;if(isSet&&images[e-1])prevImage.src=images[e-1];pp_typeMarkup='<img id="fullResImage" src="" />';b.find("#pp_full_res")[0].innerHTML=pp_typeMarkup;b.find(".pp_content").css("overflow","hidden");b.find("#fullResImage").attr("src",images[e]); imgPreloader.onload=function(){f=x(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.src=images[e]}else{movie_width=parseFloat(k("width",images[e]))?k("width",images[e]):"425";movie_height=parseFloat(k("height",images[e]))?k("height",images[e]):"344";if(movie_width.indexOf("%")!=-1||movie_height.indexOf("%")!=-1){movie_height=a(window).height()*parseFloat(movie_height)/100-100;movie_width=a(window).width()*parseFloat(movie_width)/100-100;t=true}movie_height=parseFloat(movie_height); movie_width=parseFloat(movie_width);if(j=="quicktime")movie_height+=15;f=x(movie_width,movie_height);if(j=="youtube")pp_typeMarkup='<object type="application/x-shockwave-flash" data="http://www.youtube.com/v/'+k("v",images[e])+'" width="'+f.width+'" height="'+f.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.youtube.com/v/'+k("v",images[e])+'" /></object>';else if(j=="quicktime")pp_typeMarkup='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+ f.height+'" width="'+f.width+'"><param name="src" value="'+images[e]+'"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="'+images[e]+'" height="'+f.height+'" width="'+f.width+'" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>';else if(j=="flash"){filename=images[e];pp_typeMarkup='<object type="application/x-shockwave-flash" data="'+filename+'" width="'+f.width+'" height="'+f.height+'" style="visibility:visible"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+ filename+'" /></object>'}else if(j=="iframe"){var p="";if(parseFloat(k("width",images[e]))==f.width&&parseFloat(k("height",images[e]))==f.height)p=' scrolling="no"';movie_url=images[e];movie_url=movie_url.substr(0,movie_url.indexOf("iframe")-1);pp_typeMarkup='<iframe src ="'+movie_url+'" width="'+f.width+'" height="'+f.height+'" frameborder="no"'+p+"></iframe>"}_showContent()}})})};a.prettyPhoto.changePage=function(d){if(d=="previous"){e--;if(e<0){e=0;return}}else{if(a(".pp_arrow_next").is(".disabled"))return; e++}h||(h=true);y();a("a.pp_expand,a.pp_contract").fadeOut(c.animationSpeed,function(){a(this).removeClass("pp_contract").addClass("pp_expand");a.prettyPhoto.open(images,titles,descriptions)})};a.prettyPhoto.close=function(){b.find("object,embed").css("visibility","hidden");a("div.pp_pic_holder,div.ppt").fadeOut(c.animationSpeed);a("div.pp_overlay").fadeOut(c.animationSpeed,function(){a("div.pp_overlay,div.pp_pic_holder,div.ppt").remove();a.browser.msie&&a.browser.version==6&&a("select").css("visibility", "visible");c.hideflash&&a("object,embed").css("visibility","visible");e=0;c.callback()});h=true};_showContent=function(){a(".pp_loaderIcon").hide();if(a.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=a(window).height();windowWidth=a(window).width()}projectedTop=n.scrollTop+(windowHeight/2-f.containerHeight/2);if(projectedTop<0)projectedTop=0+b.find(".ppt").height();b.find(".pp_content").animate({height:f.contentHeight},c.animationSpeed);b.animate({top:projectedTop, left:windowWidth/2-f.containerWidth/2,width:f.containerWidth},c.animationSpeed,function(){var d=f.width,g=f.height;if(d<200)d=200;if(g<30)g=30;b.width(f.containerWidth);b.find("#fullResImage").height(f.height).width(f.width);b.find(".pp_hoverContainer").height(g).width(d);b.find("#pp_full_res").fadeIn(c.animationSpeed);isSet&&j=="image"?b.find(".pp_hoverContainer").fadeIn(c.animationSpeed):b.find(".pp_hoverContainer").hide();b.find(".pp_details").fadeIn(c.animationSpeed);if(c.showTitle&&hasTitle){i.css({top:b.offset().top- 20,left:b.offset().left+c.padding/2,display:"none"});i.fadeIn(c.animationSpeed)}f.resized&&a("a.pp_expand,a.pp_contract").fadeIn(c.animationSpeed);if(j!="image")b.find("#pp_full_res")[0].innerHTML=pp_typeMarkup;c.changepicturecallback()})};function y(){b.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");b.find(".pp_hoverContainer,.pp_details").fadeOut(c.animationSpeed);b.find("#pp_full_res").fadeOut(c.animationSpeed,function(){a(".pp_loaderIcon").show()});i.fadeOut(c.animationSpeed)} function B(d){if(e==d-1){b.find("a.pp_next").css("visibility","hidden");b.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{b.find("a.pp_next").css("visibility","visible");b.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("next");return false})}if(e==0){b.find("a.pp_previous").css("visibility","hidden");b.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{b.find("a.pp_previous").css("visibility","visible"); b.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){a.prettyPhoto.changePage("previous");return false})}d>1?a(".pp_nav").show():a(".pp_nav").hide()}function x(d,g){hasBeenResized=false;z(d,g);imageWidth=d;imageHeight=g;windowHeight=a(window).height();windowWidth=a(window).width();if((m>windowWidth||l>windowHeight)&&h&&c.allowresize&&!t){for(notFitting=hasBeenResized=true;notFitting;){if(m>windowWidth){imageWidth=windowWidth-200;imageHeight=g/d*imageWidth}else if(l> windowHeight){imageHeight=windowHeight-200;imageWidth=d/g*imageHeight}else notFitting=false;l=imageHeight;m=imageWidth}z(imageWidth,imageHeight)}return{width:imageWidth,height:imageHeight,containerHeight:l,containerWidth:m,contentHeight:q,contentWidth:u,resized:hasBeenResized}}function z(d,g){if(d<200)d=200;if(g<100)g=100;a("#pp_fixmin_height").height(g);b.find(".pp_details").width(d).find(".pp_description").width(d-parseFloat(b.find("a.pp_close").css("width"))-10);q=g+b.find(".pp_details").height()+ parseFloat(b.find(".pp_details").css("marginTop"))+parseFloat(b.find(".pp_details").css("marginBottom"));u=d;l=q+b.find(".ppt").height()+b.find(".pp_top").height()+b.find(".pp_bottom").height();m=d+c.padding}function A(d){j=d.match(/youtube\.com\/watch/i)?"youtube":d.indexOf(".mov")!=-1?"quicktime":d.indexOf(".swf")!=-1?"flash":d.indexOf("iframe")!=-1?"iframe":"image"}function r(){if(a.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=a(window).height(); windowWidth=a(window).width()}if(h){$pHeight=b.height();$pWidth=b.width();$tHeight=i.height();projectedTop=windowHeight/2+n.scrollTop-$pHeight/2;if(projectedTop<0)projectedTop=0+$tHeight;b.css({top:projectedTop,left:windowWidth/2+n.scrollLeft-$pWidth/2});i.css({top:projectedTop-$tHeight,left:windowWidth/2+n.scrollLeft-$pWidth/2+c.padding/2})}}function v(){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 w(){a("div.pp_overlay").css({height:a(document).height(),width:a(window).width()})}function s(){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 id="pp_fixmin_height"></div></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'+ c.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>';a("body").append(toInject);a("div.pp_overlay").css("opacity",0);b=a(".pp_pic_holder").hide();i=a(".ppt");a("div.pp_overlay").css("height",a(document).height()).hide().bind("click",function(){c.modal||a.prettyPhoto.close()});a("a.pp_close").bind("click", function(){a.prettyPhoto.close();return false});a("a.pp_expand").bind("click",function(){$this=a(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");h=false}else{$this.removeClass("pp_contract").addClass("pp_expand");h=true}y();b.find(".pp_hoverContainer, .pp_details").fadeOut(c.animationSpeed);b.find("#pp_full_res").fadeOut(c.animationSpeed,function(){a.prettyPhoto.open(images,titles,descriptions)});return false});b.find(".pp_previous, .pp_arrow_previous").bind("click", function(){a.prettyPhoto.changePage("previous");return false});b.find(".pp_next, .pp_arrow_next").bind("click",function(){a.prettyPhoto.changePage("next");return false});b.find(".pp_hoverContainer").css({"margin-left":c.padding/2})}};function k(c,h){c=c.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");c="[\\?&]"+c+"=([^&#]*)";c=new RegExp(c);h=c.exec(h);return h==null?"":h[1]}})(jQuery);