
/* File: jquery.prettyPhoto-mod.min.js */
/* ------------------------------------------------------------------------
	Class: prettyPhoto
	Use: Lightbox clone for jQuery
	Author: Stephane Caron (http://www.no-margin-for-errors.com)
	Version: 2.4.2

	Aspen Digital changes: allow galleries to be defined via settings; some clean-up

------------------------------------------------------------------------- */
(function(b){var c,a;b.fn.prettyPhoto=function(G){var i=true,s=false,y,A,F,I,k="image",n,E,j,h,e={},r=false,B=false,g,L,z,v=l();b(window).scroll(function(){v=l();f()});b(window).resize(function(){f();D()});b(document).keypress(function(M){switch(M.keyCode){case 37:if(g==1){return}u("previous");break;case 39:if(g==z){return}u("next");break;case 27:t();break}});G=jQuery.extend({animationSpeed:"normal",padding:40,opacity:0.8,showTitle:true,allowresize:true,counter_separator_label:"/",theme:"light_rounded",galleries:{},callback:function(){}},G);if(b.browser.msie&&b.browser.version==6&&b.inArray(G.theme,["light_rounded","dark_rounded","dark_square"])){G.theme="light_square"}this.each(function(){var R=b(this),N=/\[(.*)\]/,P=N.exec(R.attr("rel")),M=1,S=R.find("img").attr("alt"),O=R.attr("title"),Q=[R.attr("href"),S,O];if(P){P=P[1];if(G.galleries[P]&&!e[P]){e[P]=G.galleries[P];Q=null}else{if(!e[P]){e[P]=[]}e[P].push(Q);M=e[P].length}}R.click(function(){q(Q,e[P],M);return false})});function q(O,N,M){if(typeof(N)=="undefined"){B=false}else{z=N.length;g=M;L=g-1;B=z>1;O=N[L]}h=N;m(O);H();c.find("p.currentTextHolder").text(g+G.counter_separator_label+z);f();b("#pp_full_res").hide();c.find(".pp_loaderIcon").show()}function m(M){j=M[0];k=K(j);E=M[1]||null;n=M[2]||null}showimage=function(P,M,S,R,Q,N,O){b(".pp_loaderIcon").hide();if(b.browser.opera){windowHeight=window.innerHeight;windowWidth=window.innerWidth}else{windowHeight=b(window).height();windowWidth=b(window).width()}c.find(".pp_content").animate({height:Q},G.animationSpeed);projectedTop=v.scrollTop+((windowHeight/2)-(R/2));if(projectedTop<0){projectedTop=0+c.find(".ppt").height()}c.animate({top:projectedTop,left:((windowWidth/2)-(S/2)),width:S},G.animationSpeed,function(){c.width(S);c.find(".pp_hoverContainer,#fullResImage").height(M).width(P);c.find("#pp_full_res").fadeIn(G.animationSpeed,function(){b(this).find("object,embed").css("visibility","visible")});p();if(O){b("a.pp_expand,a.pp_contract").fadeIn(G.animationSpeed)}})};function p(){if(B&&k=="image"){c.find(".pp_hoverContainer").fadeIn(G.animationSpeed)}else{c.find(".pp_hoverContainer").hide()}c.find(".pp_details").fadeIn(G.animationSpeed);if(G.showTitle&&r){a.css({top:c.offset().top-22,left:c.offset().left+(G.padding/2),display:"none"});a.fadeIn(G.animationSpeed)}}function x(){c.find(".pp_hoverContainer,.pp_details").fadeOut(G.animationSpeed);c.find("#pp_full_res object,#pp_full_res embed").css("visibility","hidden");c.find("#pp_full_res").fadeOut(G.animationSpeed,function(){b(".pp_loaderIcon").show();J()});a.fadeOut(G.animationSpeed)}function u(M){if(M=="previous"){L--;g--}else{L++;g++}if(!i){i=true}x();m(h[L]);b("a.pp_expand,a.pp_contract").fadeOut(G.animationSpeed,function(){b(this).removeClass("pp_contract").addClass("pp_expand")})}function t(){c.find("object,embed").css("visibility","hidden");b("div.pp_pic_holder,div.ppt").fadeOut(G.animationSpeed);b("div.pp_overlay").fadeOut(G.animationSpeed,function(){b("div.pp_overlay,div.pp_pic_holder,div.ppt").remove();if(b.browser.msie&&b.browser.version==6){b("select").css("visibility","visible")}G.callback()});i=true}function o(){if(g==z){c.find("a.pp_next").css("visibility","hidden");c.find("a.pp_arrow_next").addClass("disabled").unbind("click")}else{c.find("a.pp_next").css("visibility","visible");c.find("a.pp_arrow_next.disabled").removeClass("disabled").bind("click",function(){u("next");return false})}if(g==1){c.find("a.pp_previous").css("visibility","hidden");c.find("a.pp_arrow_previous").addClass("disabled").unbind("click")}else{c.find("a.pp_previous").css("visibility","visible");c.find("a.pp_arrow_previous.disabled").removeClass("disabled").bind("click",function(){u("previous");return false})}c.find("p.currentTextHolder").text(g+G.counter_separator_label+z);if(n){c.find(".pp_description").show().html(unescape(n))}else{c.find(".pp_description").hide().text("")}if(E&&G.showTitle){r=true;a.html(unescape(E))}else{r=false}}function w(S,O){var R=false,P=S,N=O,Q,T,M;C(S,O);T=b(window).height();Q=b(window).width();if(((I>Q)||(F>T))&&i&&G.allowresize&&!s){R=true;M=true;while(M){if((I>Q)){P=(Q-200);N=(O/S)*P}else{if((F>T)){N=(T-200);P=(S/O)*N}else{M=false}}F=N;I=P}C(P,N)}return{width:P,height:N,containerHeight:F,containerWidth:I,contentHeight:y,contentWidth:A,resized:R}}function C(N,M){c.find(".pp_details").width(N).find(".pp_description").width(N-parseFloat(c.find("a.pp_close").css("width")));y=M+c.find(".pp_details").height()+parseFloat(c.find(".pp_details").css("marginTop"))+parseFloat(c.find(".pp_details").css("marginBottom"));A=N;F=y+c.find(".ppt").height()+c.find(".pp_top").height()+c.find(".pp_bottom").height();I=N+G.padding}function K(M){var N;if(M.match(/youtube\.com\/watch/i)){N="youtube"}else{if(M.indexOf(".mov")!=-1){N="quicktime"}else{if(M.indexOf(".swf")!=-1){N="flash"}else{if(M.indexOf("iframe")!=-1){N="iframe"}else{N="image"}}}}return N}function f(){var O,R,M,N,P,Q;if(c){if(c.size()==0){return}}else{return}if(b.browser.opera){R=window.innerHeight;O=window.innerWidth}else{R=b(window).height();O=b(window).width()}if(i){N=c.height();M=c.width();P=a.height();Q=(R/2)+v.scrollTop-(N/2);if(Q<0){Q=0+P}c.css({top:Q,left:(O/2)+v.scrollLeft-(M/2)});a.css({top:Q-P,left:(O/2)+v.scrollLeft-(M/2)+(G.padding/2)})}}function J(){var Q,O,M,P,S,T,U,N,R,V;o();if(k=="image"){Q=new Image();if(B){if(L<z-1){O=new Image();O.src=h[L+1][0]}if(L>0){M=new Image();M.src=h[L-1][0]}}R='<img id="fullResImage" src="" />';c.find("#pp_full_res")[0].innerHTML=R;c.find(".pp_content").css("overflow","hidden");c.find("#fullResImage").attr("src",j);Q.onload=function(){var W=w(Q.width,Q.height);Q.width=W.width;Q.height=W.height;showimage(Q.width,Q.height,W.containerWidth,W.containerHeight,W.contentHeight,W.contentWidth,W.resized)};Q.src=j}else{P=(parseFloat(d("width",j)))?d("width",j):"425";S=(parseFloat(d("height",j)))?d("height",j):"344";if(P.indexOf("%")!=-1||S.indexOf("%")!=-1){S=(b(window).height()*parseFloat(S)/100)-100;P=(b(window).width()*parseFloat(P)/100)-100}else{S=parseFloat(S);P=parseFloat(P)}if(k=="quicktime"){S+=13}T=w(P,S);if(k=="youtube"){R='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+T.width+'" height="'+T.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://www.youtube.com/v/'+d("v",j)+'" /><embed src="http://www.youtube.com/v/'+d("v",j)+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+T.width+'" height="'+T.height+'"></embed></object>'}else{if(k=="quicktime"){R='<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+T.height+'" width="'+T.width+'"><param name="src" value="'+j+'"><param name="autoplay" value="true"><param name="type" value="video/quicktime"><embed src="'+j+'" height="'+T.height+'" width="'+T.width+'" autoplay="true" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>'}else{if(k=="flash"){U=j;U=U.substring(j.indexOf("flashvars")+10,j.length);N=j;N=N.substring(0,N.indexOf("?"));R='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+T.width+'" height="'+T.height+'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="'+N+"?"+U+'" /><embed src="'+N+"?"+U+'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+T.width+'" height="'+T.height+'"></embed></object>'}else{if(k=="iframe"){V=j;V=V.substr(0,V.indexOf("?"));R='<iframe src ="'+V+'" width="'+(T.width-10)+'" height="'+(T.height-10)+'" frameborder="no"></iframe>'}}}}c.find("#pp_full_res")[0].innerHTML=R;showimage(T.width,T.height,T.containerWidth,T.containerHeight,T.contentHeight,T.contentWidth,T.resized)}}function l(){var M,N;if(self.pageYOffset){M=self.pageYOffset;N=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){M=document.documentElement.scrollTop;N=document.documentElement.scrollLeft}else{if(document.body){M=document.body.scrollTop;N=document.body.scrollLeft}}}return{scrollTop:M,scrollLeft:N}}function D(){b("div.pp_overlay").css({height:b(document).height(),width:b(window).width()})}function H(){var N="",M;N+="<div class='pp_overlay'></div>";if(k=="image"){M='<img id="fullResImage" src="" />'}else{M=""}N+='<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">'+M+'</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'+G.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>';N+='<div class="ppt"></div>';b("body").append(N);c=b(".pp_pic_holder");a=b(".ppt");b("div.pp_overlay").css("height",b(document).height()).click(function(){t()});c.css({opacity:0}).addClass(G.theme);b("a.pp_close").click(function(){t();return false});b("a.pp_expand").click(function(){$this=b(this);if($this.hasClass("pp_expand")){$this.removeClass("pp_expand").addClass("pp_contract");i=false}else{$this.removeClass("pp_contract").addClass("pp_expand");i=true}x();c.find(".pp_hoverContainer, #pp_full_res, .pp_details").fadeOut(G.animationSpeed,function(){J()});return false});c.find(".pp_previous, .pp_arrow_previous").bind("click",function(){u("previous");return false});c.find(".pp_next, .pp_arrow_next").bind("click",function(){u("next");return false});c.find(".pp_hoverContainer").css({"margin-left":G.padding/2});if(!B){c.find(".pp_hoverContainer,.pp_nav").hide()}if(b.browser.msie&&b.browser.version==6){b("body").addClass("ie6");b("select").css("visibility","hidden")}b("div.pp_overlay").css("opacity",0).fadeTo(G.animationSpeed,G.opacity,function(){c.css("opacity",0).fadeIn(G.animationSpeed,function(){c.attr("style","left:"+c.css("left")+";top:"+c.css("top")+";");J()})})}};function d(g,f){g=g.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e="[\\?&]"+g+"=([^&#]*)",i=new RegExp(e),h=i.exec(f);if(h==null){return""}else{return h[1]}}})(jQuery);
