/* Slimbox v1.52 - The ultimate lightweight Lightbox clone (c) 2007-2008 Christophe Beyls MIT-style license. */ var Slimbox;(function(){var G={},H=0,F,M,B,T,U,P,c,E,N,K=new Image(),L=new Image(),Y,b,Q,I,X,a,J,Z,C;window.addEvent("domready",function(){c=W.bindWithEvent();$(document.body).adopt($$([Y=new Element("div",{id:"lbOverlay"}),b=new Element("div",{id:"lbCenter"}),a=new Element("div",{id:"lbBottomContainer"})]).setStyle("display","none"));Q=new Element("div",{id:"lbImage"}).injectInside(b).adopt(I=new Element("a",{id:"lbPrevLink",href:"#"}),X=new Element("a",{id:"lbNextLink",href:"#"}));I.onclick=D;X.onclick=S;var e;J=new Element("div",{id:"lbBottom"}).injectInside(a).adopt(e=new Element("a",{id:"lbCloseLink",href:"#"}),Z=new Element("div",{id:"lbCaption"}),C=new Element("div",{id:"lbNumber"}),new Element("div",{styles:{clear:"both"}}));e.onclick=Y.onclick=O;E={overlay:Y.effect("opacity",{duration:500}).set(0),image:Q.effect("opacity",{duration:500,onComplete:A}),bottom:J.effect("margin-top",{duration:400})}});Slimbox={open:function(g,f,e){F=$extend({loop:false,overlayOpacity:0.8,resizeDuration:400,resizeTransition:false,initialWidth:250,initialHeight:250,animateCaption:true,showCounter:true,counterText:"Image {x} of {y}"},e||{});if(typeof g=="string"){g=[[g,f]];f=0}M=g;F.loop=F.loop&&(M.length>1);d();R(true);P=window.getScrollTop()+(window.getHeight()/15);E.resize=b.effects($extend({duration:F.resizeDuration,onComplete:A},F.resizeTransition?{transition:F.resizeTransition}:{}));b.setStyles({top:P,width:F.initialWidth,height:F.initialHeight,marginLeft:-(F.initialWidth/2),display:""});E.overlay.start(F.overlayOpacity);H=1;return V(f)}};Element.extend({slimbox:function(e,f){$$(this).slimbox(e,f);return this}});Elements.extend({slimbox:function(e,h,g){h=h||function(i){return[i.href,i.title]};g=g||function(){return true};var f=this;f.forEach(function(i){i.onclick=function(){var j=f.filter(g,this);return Slimbox.open(j.map(h),j.indexOf(this),e)}});return f}});function d(){Y.setStyles({top:window.getScrollTop(),height:window.getHeight()})}function R(e){["object",window.ie?"select":"embed"].forEach(function(g){$each(document.getElementsByTagName(g),function(h){if(e){G[h]=h.style.visibility}h.style.visibility=e?"hidden":G[h]})});Y.style.display=e?"":"none";var f=e?"addEvent":"removeEvent";window[f]("scroll",d)[f]("resize",d);document[f]("keydown",c)}function W(e){switch(e.code){case 27:case 88:case 67:O();break;case 37:case 80:D();break;case 39:case 78:S()}e.preventDefault()}function D(){return V(T)}function S(){return V(U)}function V(e){if((H==1)&&(e>=0)){H=2;B=e;T=((B||!F.loop)?B:M.length)-1;U=B+1;if(U==M.length){U=F.loop?0:-1}$$(I,X,Q,a).setStyle("display","none");E.bottom.stop().set(0);E.image.set(0);b.className="lbLoading";N=new Image();N.onload=A;N.src=M[e][0]}return false}function A(){switch(H++){case 2:b.className="";Q.setStyles({backgroundImage:"url("+M[B][0]+")",display:""});$$(Q,J).setStyle("width",N.width);$$(Q,I,X).setStyle("height",N.height);Z.setHTML(M[B][1]||"");C.setHTML((F.showCounter&&(M.length>1))?F.counterText.replace(/{x}/,B+1).replace(/{y}/,M.length):"");if(T>=0){K.src=M[T][0]}if(U>=0){L.src=M[U][0]}if(b.clientHeight!=Q.offsetHeight){E.resize.start({height:Q.offsetHeight});break}H++;case 3:if(b.clientWidth!=Q.offsetWidth){E.resize.start({width:Q.offsetWidth,marginLeft:-Q.offsetWidth/2});break}H++;case 4:a.setStyles({top:P+b.clientHeight,marginLeft:b.style.marginLeft,visibility:"hidden",display:""});E.image.start(1);break;case 5:if(T>=0){I.style.display=""}if(U>=0){X.style.display=""}if(F.animateCaption){E.bottom.set(-J.offsetHeight).start(0)}a.style.visibility="";H=1}}function O(){if(H){H=0;N.onload=Class.empty;for(var e in E){E[e].stop()}$$(b,a).setStyle("display","none");E.overlay.chain(R).start(0)}return false}})(); // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED) Slimbox.scanPage = function() { var links = $$("a").filter(function(el) { return el.rel && el.rel.test(/^lightbox/i); }); $$(links).slimbox({/* Put custom options here */}, null, function(el) { return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel)); }); }; window.addEvent("domready", Slimbox.scanPage);