/*
	Slimbox v2.02 - The ultimate lightweight Lightbox clone for jQuery
	(c) 2007-2009 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/
(function(w){var E=w(window),u,g,F=-1,o,x,D,v,y,L,s,n=!window.XMLHttpRequest,e=window.opera&&(document.compatMode=="CSS1Compat")&&(w.browser.version>=9.3),m=document.documentElement,l={},t=new Image(),J=new Image(),H,a,h,q,I,d,G,c,A,K;w(function(){w("body").append(w([H=w('<div id="lbOverlay" />')[0],a=w('<div id="lbCenter" />')[0],G=w('<div id="lbBottomContainer" />')[0]]).css("display","none"));h=w('<div id="lbImage" />').appendTo(a).append(q=w('<div style="position: relative;" />').append([])[0])[0];c=w('<div id="lbBottom" />').appendTo(G).append([w('<a id="lbCloseLink" href="#" />').add(H).click(C)[0],d=w('<a id="lbNextLink" href="#" />').click(f)[0],I=w('<a id="lbPrevLink" href="#" />').click(B)[0],A=w('<div id="lbCaption" />')[0],K=w('<div id="lbNumber" />')[0],w('<div style="clear: both;" />')[0]])[0]});w.slimbox=function(O,N,M){u=w.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]},M);if(typeof O=="string"){O=[[O,N]];N=0}y=E.scrollTop()+((e?m.clientHeight:E.height())/2);L=u.initialWidth;s=u.initialHeight;w(a).css({top:Math.max(0,y-(s/2)),width:L,height:s,marginLeft:-L/2}).show();v=n||(H.currentStyle&&(H.currentStyle.position!="fixed"));if(v){H.style.position="absolute"}w(H).css("opacity",u.overlayOpacity).fadeIn(u.overlayFadeDuration);z();k(1);g=O;u.loop=u.loop&&(g.length>1);return b(N)};w.fn.slimbox=function(M,P,O){P=P||function(Q){return[Q.href,Q.title]};O=O||function(){return true};var N=this;return N.unbind("click").click(function(){var S=this,U=0,T,Q=0,R;T=w.grep(N,function(W,V){return O.call(S,W,V)});for(R=T.length;Q<R;++Q){if(T[Q]==S){U=Q}T[Q]=P(T[Q],Q)}return w.slimbox(T,U,M)})};function z(){var N=E.scrollLeft(),M=e?m.clientWidth:E.width();w([a,G]).css("left",N+(M/2));if(v){w(H).css({left:N,top:E.scrollTop(),width:M,height:E.height()})}}function k(M){w("object").add(n?"select":"embed").each(function(O,P){if(M){w.data(P,"slimbox",P.style.visibility)}P.style.visibility=M?"hidden":w.data(P,"slimbox")});var N=M?"bind":"unbind";E[N]("scroll resize",z);w(document)[N]("keydown",p)}function p(O){var N=O.keyCode,M=w.inArray;return(M(N,u.closeKeys)>=0)?C():(M(N,u.nextKeys)>=0)?f():(M(N,u.previousKeys)>=0)?B():false}function B(){return b(x)}function f(){return b(D)}function b(M){if(M>=0){F=M;o=g[F][0];x=(F||(u.loop?g.length:0))-1;D=((F+1)%g.length)||(u.loop?0:-1);r();a.className="lbLoading";l=new Image();l.onload=j;l.src=o}return false}function j(){a.className="";w(h).css({backgroundImage:"url("+o+")",visibility:"hidden",display:""});w(q).width(l.width);w([q]).height(l.height);w(A).html(g[F][1]||"");w(K).html((((g.length>1)&&u.counterText)||"").replace(/{x}/,F+1).replace(/{y}/,g.length));if(x>=0){t.src=g[x][0]}if(D>=0){J.src=g[D][0]}L=h.offsetWidth;s=h.offsetHeight;var M=Math.max(0,y-(s/2));if(a.offsetHeight!=s){w(a).animate({height:s,top:M},u.resizeDuration,u.resizeEasing)}if(a.offsetWidth!=L){w(a).animate({width:L,marginLeft:-L/2},u.resizeDuration,u.resizeEasing)}w(a).queue(function(){w(G).css({width:L,top:M+s,marginLeft:-L/2,visibility:"hidden",display:""});w(h).css({display:"none",visibility:"",opacity:""}).fadeIn(u.imageFadeDuration,i)})}function i(){if(x>=0){w(I).show()}if(D>=0){w(d).show()}w(c).css("marginTop",-c.offsetHeight).animate({marginTop:0},u.captionAnimationDuration);G.style.visibility=""}function r(){l.onload=null;l.src=t.src=J.src=o;w([a,h,c]).stop(true);w([I,d,h,G]).hide()}function C(){if(F>=0){r();F=x=D=-1;w(a).hide();w(H).stop().fadeOut(u.overlayFadeDuration,k)}return false}})(jQuery);jQuery(function(a){a("a[rel^='lightbox']").slimbox({},null,function(b){return(this==b)||((this.rel.length>8)&&(this.rel==b.rel))})});(function(g){var u,k,e,o,c,i,y,l,w,s,p,m,j,h,r,f,q,a,v,n;function b(){g([m]).css({position:"absolute",width:g(window).width(),height:g(window).height(),top:g(window).scrollTop(),left:g(window).scrollLeft()})}function d(z){if(z.keyCode==37){g(document).unbind("keydown.colorKeys");g("a#contentPrevious").click()}else{if(z.keyCode==39){g(document).unbind("keydown.colorKeys");g("a#contentNext").click()}}}function x(){if(g("#colorboxInlineTemp").length>0){g(r).children().insertAfter("#colorboxInlineTemp")}if(w){g(w).remove()}}l=function(){x();g(m).css({cursor:"auto"}).fadeOut("fast");g(s).stop(true,false).removeData("open").fadeOut("fast",function(){g(r).remove()});g(document).unbind("keydown.colorKeys");g(window).unbind("resize scroll",b)};function t(z,A){return(typeof z=="string")?(z.match(/%/)?(A/100)*parseInt(z,10):parseInt(z,10)):z}g(function(){g("body").append(g([m=g('<div id="modalBackgroundOverlay" />')[0],s=g('<div id="colorbox" />')[0]]).hide());g(s).append(g([p=g('<div id="modalWrap" />')[0]])).css("opacity",0).show();g(p).append(g([g('<div><div id="borderTopLeft"></div><div id="borderTopCenter"></div><div id="borderTopRight"></div></div>')[0],a=g('<div id="borderMiddleLeft" />')[0],h=g('<div id="modalContent" />')[0],v=g('<div id="borderMiddleRight" />')[0],g('<div><div id="borderBottomLeft"></div><div id="borderBottomCenter"></div><div id="borderBottomRight"></div></div>')[0]]));g(h).append(g([r=g('<div id="modalLoadedContent"><a id="contentPrevious" href="#"></a><a id="contentNext" href="#"></a><span id="contentCurrent"></span><br id="modalInfoBr"/><span id="contentTitle"></span><div id="preloadPrevious"></div><div id="preloadNext"></div><div id="preloadClose"></div></div>')[0],j=g('<div id="modalLoadingOverlay" />')[0],f=g('<a id="modalClose" href="#"></a>')[0]]));g(document).bind("keydown.colorClose",function(z){if(z.keyCode==27){l()}});g(f).click(function(){l();return false});q=g("#borderTopCenter")[0];n=g("#borderBottomCenter")[0];o=g(q).height()+g(n).height()+g(h).outerHeight(true)-g(h).height();c=g(a).width()+g(v).width()+g(h).outerWidth(true)-g(h).width();e=g(r).outerHeight(true);k=g(r).outerWidth(true);g(r).empty();g(s).css({"padding-bottom":o,"padding-right":c}).hide();g("#contentPrevious, #contentNext, #modalClose").live("mouseover",function(){g(this).addClass("hover")});g("#contentPrevious, #contentNext, #modalClose").live("mouseout",function(){g(this).removeClass("hover")})});g.fn.colorbox=function(E,G){function z(K,O,M,J){var I=document.documentElement.clientHeight;var L=I/2-O/2+g(window).scrollTop();var H=document.documentElement.clientWidth/2-K/2+g(window).scrollLeft();if(O>I){L-=(O-I)}if(L<0){L=0}if(H<0){H=0}K=K-c;O=O-o;function N(P){h.style.width=q.style.width=n.style.width=P.style.width;h.style.height=a.style.height=v.style.height=P.style.height}g(s).animate({height:O,width:K,top:L,left:H},{duration:M,complete:function(){if(J){J()}N(this);if(g.browser.msie&&g.browser.version<7){b()}},step:function(){N(this)}})}var D=[];function A(){if(E.preloading!==false&&y.length>1&&y[i].href.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(.*))?$/i)){var I,H;I=i>0?y[i-1].href:y[y.length-1].href;H=i<y.length-1?y[i+1].href:y[0].href;return[g("<img />").attr("src",H),g("<img />").attr("src",I)]}return false}function B(){g(j).show();if(g(this).attr("id")=="contentPrevious"){i=i>0?i-1:y.length-1}else{i=i<y.length-1?i+1:0}F(y[i].href,y[i].title)}function C(K,J){if(g(s).data("open")!==true){return false}var M=E.transition=="none"?0:E.transitionSpeed;g(r).remove();r=g(K)[0];g(r).hide().appendTo("body").css({width:(E.fixedWidth)?E.fixedWidth-k-c:g(r).width()}).css({height:(E.fixedHeight)?E.fixedHeight-e-o:g(r).height()}).attr({id:"modalLoadedContent"}).append(J).prependTo(g(h));if(g("#modalPhoto").length>0&&E.fixedHeight){var I=(parseInt(g(r)[0].style.height,10)-parseInt(g("#modalPhoto")[0].style.height,10))/2;g("#modalPhoto").css({marginTop:(I>0?I:0)})}function H(N){z(parseInt(r.style.width,10)+k+c,parseInt(r.style.height,10)+e+o,N,function(){if(g(s).data("open")!==true){return false}g(r).show();g(j).hide();g(document).bind("keydown.colorKeys",d);if(G){G()}if(E.transition==="fade"){g(s).animate({opacity:1},M)}return true})}if(E.transition=="fade"){g(s).animate({opacity:0},M,function(){H(0)})}else{H(M)}var L=A();return true}function F(I,J){x();var H="<p id='contentTitle'>"+J+"</p>";if(y.length>1){H+="<span id='contentCurrent'> "+E.contentCurrent+"</span>";H=H.replace(/\{current\}/,i+1).replace(/\{total\}/,y.length);H+="<a id='contentPrevious' href='#'>"+E.contentPrevious+"</a><a id='contentNext' href='#'>"+E.contentNext+"</a> "}if(E.inline){w=g('<div id="colorboxInlineTemp" />').hide().insertBefore(g(I)[0]);u=g(I).clone(true);C(g(I).wrapAll("<div />").parent(),H)}else{if(E.iframe){C(g("<div><iframe name='iframe_"+new Date().getTime()+" 'frameborder=0 src ="+I+"></iframe></div>"),H)}else{if(I.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(.*))?$/i)){w=new Image();w.onload=function(){w.onload=null;C(g("<div />").css({width:this.width,height:this.height}).append(g(this).css({width:this.width,height:this.height,display:"block",margin:"auto"}).attr("id","modalPhoto")),H);if(y.length>1){g(this).css({cursor:"pointer"}).click(B)}};w.src=I}else{w=g("<div />").load(I,function(K,L){if(L=="success"){C(g(this),H)}else{C(g("<p>Request unsuccessful.</p>"))}})}}}}E=g.extend({},g.fn.colorbox.settings,E);g(this).unbind("click.colorbox").bind("click.colorbox",function(){if(E.fixedWidth){E.fixedWidth=t(E.fixedWidth,document.documentElement.clientWidth)}if(E.fixedHeight){E.fixedHeight=t(E.fixedHeight,document.documentElement.clientHeight)}if(this.rel&&"nofollow"!=this.rel){y=g("a[rel='"+this.rel+"']");i=g(y).index(this)}else{y=g(this);i=0}if(g(s).data("open")!==true){g(document).bind("keydown.colorKeys",d);g(f).html(E.modalClose);g(m).css({opacity:E.bgOpacity});g(s).data("open",true).css({opacity:1});g([s,j,m]).show();z(t(E.initialWidth,document.documentElement.clientWidth),t(E.initialHeight,document.documentElement.clientHeight),0);if(g.browser.msie&&g.browser.version<7){g(window).bind("resize scroll",b)}}F(E.href?E.href:y[i].href,E.title?E.title:y[i].title);g("a#contentPrevious, a#contentNext").die().live("click",B);if(E.overlayClose!==false){g(m).css({cursor:"pointer"}).click(function(){l()})}return false});if(E.open!==false&&g(s).data("open")!==true){g(this).triggerHandler("click.colorbox")}return this.each(function(){})};g.fn.colorbox.settings={transition:"elastic",transitionSpeed:350,initialWidth:"400",initialHeight:"400",fixedWidth:false,fixedHeight:false,inline:false,iframe:false,href:false,title:false,bgOpacity:0.85,preloading:true,contentCurrent:"image {current} of {total}",contentPrevious:"previous",contentNext:"next",modalClose:"close",open:false,overlayClose:true}})(jQuery);
