/*
	Slimbox v2.04 - The ultimate lightweight Lightbox clone for jQuery
	(c) 2007-2010 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/
(function(y){var H=y(window),u,e,I=-1,n,z,G,w,B,O,r,v,p,j,x,m=!window.XMLHttpRequest,s=[],l=document.documentElement,k={},t=new Image(),M=new Image(),K,A,f,L,c,J,b,D,N;y(function(){y("body").append(y([K=y('<div id="lbOverlay" />').click(F)[0],A=y('<div id="lbContainer" />')[0],J=y('<div id="lbBottomContainer" />')[0]]).css("display","none"));f=y("<img />").appendTo(A)[0];L=y('<a id="lbPrevLink" href="#" />').appendTo(A).click(E)[0];c=y('<a id="lbNextLink" href="#" />').appendTo(A).click(d)[0];b=y('<div id="lbBottom" />').appendTo(J).append([y('<a id="lbCloseLink" href="#" />').click(F)[0],D=y('<div id="lbCaption" />')[0],N=y('<div id="lbNumber" />')[0],y('<div style="clear: both;" />')[0]])[0]});y.slimbox=function(R,Q,P){u=y.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]},P);if(typeof R=="string"){R=[[R,Q]];Q=0}B=H.scrollTop()+(H.height()/2);O=u.initialWidth;v=parseInt(y(A).css("paddingLeft"))+parseInt(y(A).css("paddingRight"));j=O+v;r=u.initialHeight;p=parseInt(y(A).css("paddingTop"))+parseInt(y(A).css("paddingBottom"));x=r+p;y(A).css({top:Math.max(0,B-(x/2)),width:O,height:r,marginLeft:-j/2}).show();w=m||(K.currentStyle&&(K.currentStyle.position!="fixed"));if(w){K.style.position="absolute"}y(K).css("opacity",u.overlayOpacity).fadeIn(u.overlayFadeDuration);C();i(1);e=R;u.loop=u.loop&&(e.length>1);return a(Q)};y.fn.slimbox=function(P,S,R){S=S||function(T){return[T.href,T.title]};R=R||function(){return true};var Q=this;return Q.unbind("click").click(function(){var V=this,X=0,W,T=0,U;W=y.grep(Q,function(Z,Y){return R.call(V,Z,Y)});for(U=W.length;T<U;++T){if(W[T]==V){X=T}W[T]=S(W[T],T)}return y.slimbox(W,X,P)})};function C(){var Q=H.scrollLeft(),P=H.width();y([A,J]).css("left",Q+(P/2));if(w){y(K).css({left:Q,top:H.scrollTop(),width:P,height:H.height()})}}function i(P){if(P){y("object").add(m?"select":"embed").each(function(R,S){s[R]=[S,S.style.visibility];S.style.visibility="hidden"})}else{y.each(s,function(R,S){S[0].style.visibility=S[1]});s=[]}var Q=P?"bind":"unbind";H[Q]("scroll resize",C);y(document)[Q]("keydown",o)}function o(R){var Q=R.which,P=y.inArray;return(P(Q,u.closeKeys)>=0)?F():(P(Q,u.nextKeys)>=0)?d():(P(Q,u.previousKeys)>=0)?E():null}function E(){return a(z)}function d(){return a(G)}function a(P){if(P>=0){I=P;n=e[I][0];z=(I||(u.loop?e.length:0))-1;G=((I+1)%e.length)||(u.loop?0:-1);q();A.className="lbLoading";k=new Image();k.onload=h;k.src=n}return false}function h(){var T=k.width,P=k.height,S=k.height/k.width;if(T+v>y(window).width()||P+p+32>y(window).height()){var Q=y(window).width()-v-20,R=Q*S;if(R+p+32>y(window).height()){R=y(window).height()-p-32;Q=R/S}T=Q;P=R}A.className="";y(f).css({visibility:"hidden",display:""});f.src=k.src;f.width=T;f.height=P;y([L,c]).height(f.height);y(D).html(e[I][1]||"");y(N).html((((e.length>1)&&u.counterText)||"").replace(/{x}/,I+1).replace(/{y}/,e.length));if(z>=0){t.src=e[z][0]}if(G>=0){M.src=e[G][0]}O=f.width;j=O+v;r=f.height;x=r+p+0;var U=Math.max(0,B-(x/2)-16);if(y(A).height()!=r){y(A).animate({height:r,top:U},u.resizeDuration,u.resizeEasing)}if(y(A).width()!=O){y(A).animate({width:O,marginLeft:-(j/2)},u.resizeDuration,u.resizeEasing)}y(A).queue(function(){y(J).css({width:O,top:U+x,marginLeft:-j/2,visibility:"hidden",display:""});y(f).css({display:"none",visibility:"",opacity:""}).fadeIn(u.imageFadeDuration,g)})}function g(){if(z>=0){y(L).show()}if(G>=0){y(c).show()}y(b).css("marginTop",-b.offsetHeight).animate({marginTop:0},u.captionAnimationDuration);J.style.visibility=""}function q(){k.onload=null;k.src=t.src=M.src=n;y([A,f,b]).stop(true);y([L,c,f,J]).hide()}function F(){if(I>=0){q();I=z=G=-1;y(A).hide();y(K).stop().fadeOut(u.overlayFadeDuration,i)}return false}})(jQuery);

// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {
	jQuery(function($) {
		$("a[rel^='lightbox']").slimbox({/* Put custom options here */}, null, function(el) {
			return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
		});
	});
}