/*
 Slimbox v2.02 - The ultimate lightweight Lightbox clone for jQuery
 (c) 2007-2009 Christophe Beyls <http://www.digitalia.be>
 MIT-style license.
*/
(function(a){function u(){var b=k.scrollLeft(),d=D?E.clientWidth:k.width();a([e,p]).css("left",b+d/2);F&&a(h).css({left:b,top:k.scrollTop(),width:d,height:k.height()})}function G(b){a("object").add(H?"select":"embed").each(function(q,l){b&&a.data(l,"slimbox",l.style.visibility);l.style.visibility=b?"hidden":a.data(l,"slimbox")});var d=b?"bind":"unbind";k[d]("scroll resize",u);a(document)[d]("keydown",S)}function S(b){b=b.keyCode;var d=a.inArray;return d(b,c.closeKeys)>=0?I():d(b,c.nextKeys)>=0?J():
d(b,c.previousKeys)>=0?K():false}function K(){return A(r)}function J(){return A(s)}function A(b){if(b>=0){i=b;w=f[i][0];r=(i||(c.loop?f.length:0))-1;s=(i+1)%f.length||(c.loop?0:-1);L();e.className="lbLoading";m=new Image;m.onload=T;m.src=w}return false}function T(){e.className="";a(n).css({backgroundImage:"url("+w+")",visibility:"hidden",display:""});a(B).width(m.width);a([B,x,y]).height(m.height);a(M).html(f[i][1]||"");a(N).html((f.length>1&&c.counterText||"").replace(/{x}/,i+1).replace(/{y}/,f.length));
if(r>=0)O.src=f[r][0];if(s>=0)P.src=f[s][0];g=n.offsetWidth;j=n.offsetHeight;var b=Math.max(0,C-j/2);e.offsetHeight!=j&&a(e).animate({height:j,top:b},c.resizeDuration,c.resizeEasing);e.offsetWidth!=g&&a(e).animate({width:g,marginLeft:-g/2},c.resizeDuration,c.resizeEasing);a(e).queue(function(){a(p).css({width:g,top:b+j,marginLeft:-g/2,visibility:"hidden",display:""});a(n).css({display:"none",visibility:"",opacity:""}).fadeIn(c.imageFadeDuration,U)})}function U(){r>=0&&a(x).show();s>=0&&a(y).show();
a(z).css("marginTop",-z.offsetHeight).animate({marginTop:0},c.captionAnimationDuration);p.style.visibility=""}function L(){m.onload=null;m.src=O.src=P.src=w;a([e,n,z]).stop(true);a([x,y,n,p]).hide()}function I(){if(i>=0){L();i=r=s=-1;a(e).hide();a(h).stop().fadeOut(c.overlayFadeDuration,G)}return false}var k=a(window),c,f,i=-1,w,r,s,F,C,g,j,H=!window.XMLHttpRequest,D=window.opera&&document.compatMode=="CSS1Compat"&&a.browser.version>=9.3,E=document.documentElement,m={},O=new Image,P=new Image,h,e,
n,B,x,y,p,z,M,N;a(function(){a("body").append(a([h=a('<div id="lbOverlay" />')[0],e=a('<div id="lbCenter" />')[0],p=a('<div id="lbBottomContainer" />')[0]]).css("display","none"));n=a('<div id="lbImage" />').appendTo(e).append(B=a('<div style="position: relative;" />').append([x=a('<a id="lbPrevLink" href="#" />').click(K)[0],y=a('<a id="lbNextLink" href="#" />').click(J)[0]])[0])[0];z=a('<div id="lbBottom" />').appendTo(p).append([a('<a id="lbCloseLink" href="#" />').add(h).click(I)[0],M=a('<div id="lbCaption" />')[0],
N=a('<div id="lbNumber" />')[0],a('<div style="clear: both;" />')[0]])[0]});a.slimbox=function(b,d,q){c=a.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:"Image {x} of {y}",closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},q);if(typeof b=="string"){b=[[b,d]];d=0}C=k.scrollTop()+(D?E.clientHeight:k.height())/2;g=c.initialWidth;j=c.initialHeight;
a(e).css({top:Math.max(0,C-j/2),width:g,height:j,marginLeft:-g/2}).show();if(F=H||h.currentStyle&&h.currentStyle.position!="fixed")h.style.position="absolute";a(h).css("opacity",c.overlayOpacity).fadeIn(c.overlayFadeDuration);u();G(1);f=b;c.loop=c.loop&&f.length>1;return A(d)};a.fn.slimbox=function(b,d,q){d=d||function(v){return[v.href,v.title]};q=q||function(){return true};var l=this;return l.unbind("click").click(function(){var v=this,Q=0,t,o=0,R;t=a.grep(l,function(V,W){return q.call(v,V,W)});
for(R=t.length;o<R;++o){if(t[o]==v)Q=o;t[o]=d(t[o],o)}return a.slimbox(t,Q,b)})}})(jQuery);jQuery(function(a){a("a[rel^='lightbox']").slimbox({},null,function(u){return this==u||this.rel.length>8&&this.rel==u.rel})});

