(function(a){function k(c,p){c=c.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var q=(new RegExp("[\\?&]"+c+"=([^&#]*)")).exec(p);return q==null?"":q[1]}a.prettyPhoto={version:"2.5.3"};a.fn.prettyPhoto=function(c){function p(){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()});h.fadeOut(c.animationSpeed)}function q(e){if(d==
e-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(d==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})}e>1?a(".pp_nav").show():a(".pp_nav").hide()}function t(e,g){hasBeenResized=false;u(e,g);imageWidth=e;imageHeight=g;windowHeight=a(window).height();windowWidth=a(window).width();if((l>windowWidth||m>windowHeight)&&j&&c.allowresize&&!v){for(notFitting=hasBeenResized=true;notFitting;){if(l>windowWidth){imageWidth=windowWidth-200;imageHeight=g/e*imageWidth}else if(m>windowHeight){imageHeight=windowHeight-200;imageWidth=e/g*imageHeight}else notFitting=
false;m=imageHeight;l=imageWidth}u(imageWidth,imageHeight)}return{width:imageWidth,height:imageHeight,containerHeight:m,containerWidth:l,contentHeight:r,contentWidth:w,resized:hasBeenResized}}function u(e,g){b.find(".pp_details").width(e).find(".pp_description").width(e-parseFloat(b.find("a.pp_close").css("width")));r=g+b.find(".pp_details").height()+parseFloat(b.find(".pp_details").css("marginTop"))+parseFloat(b.find(".pp_details").css("marginBottom"));w=e;m=r+b.find(".ppt").height()+b.find(".pp_top").height()+
b.find(".pp_bottom").height();l=e+c.padding}function A(e){i=e.match(/youtube\.com\/watch/i)?"youtube":e.indexOf(".mov")!=-1?"quicktime":e.indexOf(".swf")!=-1?"flash":e.indexOf("iframe")!=-1?"iframe":"image"}function s(){if(a.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=a(window).height();windowWidth=a(window).width()}if(j){$pHeight=b.height();$pWidth=b.width();$tHeight=h.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});h.css({top:projectedTop-$tHeight,left:windowWidth/2+n.scrollLeft-$pWidth/2+c.padding/2})}}function x(){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 y(){a("div.pp_overlay").css({height:a(document).height(),width:a(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'+
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");h=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");j=false}else{$this.removeClass("pp_contract").addClass("pp_expand");j=true}p();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})}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(){}},c);if(a.browser.msie&&a.browser.version==6)c.theme="light_square";if(a(".pp_overlay").size()==
0)z();else{b=a(".pp_pic_holder");h=a(".ppt")}var j=true,v=false,f,b,h,r,w,m,l,i="image",d=0,n=x();a(window).scroll(function(){n=x();s();y()});a(window).resize(function(){s();y()});a(document).keydown(function(e){if(b.is(":visible"))switch(e.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).bind("click",function(){link=this;theRel=a(this).attr("rel");galleryRegExp=
/\[(?:.*)\]/;theGallery=galleryRegExp.exec(theRel);var e=[],g=[],o=[];if(theGallery)a("a[rel*="+theGallery+"]").each(function(B){if(a(this)[0]===a(link)[0])d=B;e.push(a(this).attr("href"));g.push(a(this).find("img").attr("alt"));o.push(a(this).attr("title"))});else{e=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(e,g,o);return false})});a.prettyPhoto.open=function(e,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(e);titles=a.makeArray(g);descriptions=a.makeArray(o);if(a(".pp_overlay").size()==0)z();else{b=a(".pp_pic_holder");h=a(".ppt")}b.attr("class","pp_pic_holder "+c.theme);isSet=a(images).size()>0?true:false;A(images[d]);s();q(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(d+1+c.counter_separator_label+a(images).size());descriptions[d]?b.find(".pp_description").show().html(unescape(descriptions[d])):b.find(".pp_description").hide().text("");if(titles[d]&&c.showTitle){hasTitle=true;h.html(unescape(titles[d]))}else hasTitle=false;if(i=="image"){imgPreloader=new Image;nextImage=new Image;if(isSet&&d>a(images).size())nextImage.src=images[d+1];prevImage=new Image;if(isSet&&images[d-1])prevImage.src=images[d-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[d]);imgPreloader.onload=function(){f=t(imgPreloader.width,imgPreloader.height);_showContent()};imgPreloader.src=images[d]}else{movie_width=parseFloat(k("width",images[d]))?k("width",images[d]):"425";movie_height=parseFloat(k("height",images[d]))?k("height",images[d]):"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;v=true}movie_height=parseFloat(movie_height);movie_width=parseFloat(movie_width);if(i=="quicktime")movie_height+=15;f=t(movie_width,movie_height);if(i=="youtube")pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 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[d])+'" /><embed src="http://www.youtube.com/v/'+k("v",images[d])+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+f.width+'" height="'+f.height+'"></embed></object>';else if(i=="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[d]+'"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="'+
images[d]+'" height="'+f.height+'" width="'+f.width+'" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>';else if(i=="flash"){flash_vars=images[d];flash_vars=flash_vars.substring(images[d].indexOf("flashvars")+10,images[d].length);filename=images[d];filename=filename.substring(0,filename.indexOf("?"));pp_typeMarkup='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+f.width+'" height="'+f.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="'+f.width+'" height="'+f.height+'"></embed></object>'}else if(i=="iframe"){movie_url=images[d];movie_url=movie_url.substr(0,movie_url.indexOf("iframe")-1);pp_typeMarkup='<iframe src ="'+movie_url+'" width="'+(f.width-10)+'" height="'+(f.height-10)+'" frameborder="no"></iframe>'}_showContent()}})})};a.prettyPhoto.changePage=function(e){if(e==
"previous"){d--;if(d<0){d=0;return}}else{if(a(".pp_arrow_next").is(".disabled"))return;d++}j||(j=true);p();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");d=0;c.callback()});j=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(){b.width(f.containerWidth);b.find(".pp_hoverContainer,#fullResImage").height(f.height).width(f.width);b.find("#pp_full_res").fadeIn(c.animationSpeed);isSet&&i=="image"?b.find(".pp_hoverContainer").fadeIn(c.animationSpeed):b.find(".pp_hoverContainer").hide();b.find(".pp_details").fadeIn(c.animationSpeed);if(c.showTitle&&hasTitle){h.css({top:b.offset().top-20,left:b.offset().left+
c.padding/2,display:"none"});h.fadeIn(c.animationSpeed)}f.resized&&a("a.pp_expand,a.pp_contract").fadeIn(c.animationSpeed);if(i!="image")b.find("#pp_full_res")[0].innerHTML=pp_typeMarkup;c.changepicturecallback()})}}})(jQuery);

