/*!
	Slimbox v2.04 - The ultimate lightweight Lightbox clone for jQuery
	(c) 2007-2010 Christophe Beyls <http://www.digitalia.be>
	MIT-style license.
*/
// (function(F){var O=F(window),B,h,P=-1,t,G,N,C,H,Y,x,r=!window.XMLHttpRequest,y=[],q=document.documentElement,o={},z=new Image(),V=new Image(),R,f,A,n,U,X,s,D,S,b,j,v,T,e,Q,c,L,W;F(function(){F("body").append(F([S=F('<div id="sbOverlay" />')[0],b=F('<div id="sbCenter" />')[0],Q=F('<div id="sbBottomContainer" />')[0]]).css("display","none"));j=F('<div id="sbImage" />').appendTo(b).append(v=F('<div style="position: relative;" />').append([T=F('<a id="prevLink" href="#" />').click(J)[0],e=F('<a id="nextLink" href="#" />').click(g)[0]])[0])[0];c=F('<div id="sbBottom" />').appendTo(Q).append([F('<a id="closeLink" href="#" />').add(S).click(M)[0],X=F('<a id="playLink" href="#" />').click(E)[0],s=F('<a id="pauseLink" href="#" />').click(d)[0],D=F('<a id="saveLink" href="#" target="_blank" />')[0],L=F('<div id="sbCaption" />')[0],W=F('<div id="sbNumber" />')[0],R=F('<div id="sbPresent" />')[0],F('<div style="clear: both;" />')[0]])[0]});F.slimbox=function(ab,aa,Z){B=F.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],slideshowKeys:[83],allowSave:false,slideshowAutoplay:false,slideshowInterval:3000,slideshowAutoclose:true},Z);if(typeof ab=="string"){ab=[[ab,aa]];aa=0}H=O.scrollTop()+(O.height()/2);Y=B.initialWidth;x=B.initialHeight;F(b).css({top:Math.max(0,H-(x/2)),width:Y,height:x,marginLeft:-Y/2}).show();C=r||(S.currentStyle&&(S.currentStyle.position!="fixed"));if(C){S.style.position="absolute"}F(S).css("opacity",B.overlayOpacity).fadeIn(B.overlayFadeDuration);K();m(1);h=ab;B.loop=B.loop&&(h.length>1);n=B.slideshowAutoplay&&A;return a(aa)};F.fn.slimbox=function(Z,ac,ab){ac=ac||function(ad){ad.rel.match(/present.+/)?f=true:f=false;ad.rel.match(/slideshow.+/)?A=true:A=false;return[ad.href,ad.title]};ab=ab||function(){return true};var aa=this;return aa.unbind("click").click(function(){var af=this,ah=0,ag,ad=0,ae;ag=F.grep(aa,function(aj,ai){return ab.call(af,aj,ai)});for(ae=ag.length;ad<ae;++ad){if(ag[ad]==af){ah=ad}ag[ad]=ac(ag[ad],ad)}return F.slimbox(ag,ah,Z)})};function p(Z){return parseInt(Z.replace(/\D/g,""))}function K(){var aa=O.scrollLeft(),Z=O.width();F([b,Q]).css("left",aa+(Z/2));if(C){F(S).css({left:aa,top:O.scrollTop(),width:Z,height:O.height()})}}function m(Z){if(Z){F("object").add(r?"select":"embed").each(function(ab,ac){y[ab]=[ac,ac.style.visibility];ac.style.visibility="hidden"})}else{F.each(y,function(ab,ac){ac[0].style.visibility=ac[1]});y=[]}var aa=Z?"bind":"unbind";O[aa]("scroll resize",K);F(document)[aa]("keydown",u)}function u(ab){var aa=ab.keyCode,Z=F.inArray;return(Z(aa,B.closeKeys)>=0)?M():(Z(aa,B.nextKeys)>=0)?g():(Z(aa,B.previousKeys)>=0)?J():(Z(aa,B.slideshowKeys)>=0)?I():false}function J(){return a(G)}function g(){return a(N)}function a(Z){if(Z>=0){P=Z;t=h[P][0];G=(P||(B.loop?h.length:0))-1;N=((P+1)%h.length)||(B.loop?0:-1);w();b.className="sbLoading";o=new Image();o.onload=l;o.src=t}return false}function l(){b.className="";F(j).css({backgroundImage:"url("+t+")",visibility:"hidden",display:""});F(v).width(o.width);F([v,T,e]).height(o.height);F(L).html(h[P][1]||"");F(W).html((((h.length>1)&&B.counterText)||"").replace(/###x###/,P+1).replace(/###y###/,h.length));if(f){F(W).css("display","none");F(R).html("").css("display","");for(i=0;i<h.length;i++){var aa=P==i?"act":"no";var Z=F('<a id="pmi'+(i+1)+'" href="#" class="'+aa+'"></a>').click(function(){var ac=p(F(this).attr("id"))-1;d();return a(ac)});i<9?Z.html("0"+(i+1)):Z.html(i+1);Z.appendTo(R)}}else{F(W).css("display","");F(R).html("").css("display","none")}if(G>=0){z.src=h[G][0]}if(N>=0){V.src=h[N][0]}Y=j.offsetWidth;x=j.offsetHeight;var ab=Math.max(0,H-(x/2));if(b.offsetHeight!=x){F(b).animate({height:x,top:ab},B.resizeDuration,B.resizeEasing)}if(b.offsetWidth!=Y){F(b).animate({width:Y,marginLeft:-Y/2},B.resizeDuration,B.resizeEasing)}F(b).queue(function(){F(Q).css({width:Y,top:ab+x,marginLeft:-Y/2,visibility:"hidden",display:""});F(j).css({display:"none",visibility:"",opacity:""}).fadeIn(B.imageFadeDuration,k)})}function k(){if(G>=0){F(T).show()}if(N>=0){F(e).show()}F(c).css("marginTop",-c.offsetHeight).animate({marginTop:0},B.captionAnimationDuration);Q.style.visibility="";F(X).css("display","none");F(s).css("display","none");if(A){clearTimeout(U);if(n){F(s).css("display","");if(P!=(h.length-1)){U=setTimeout(g,B.slideshowInterval)}else{if(B.slideshowAutoclose){U=setTimeout(M,B.slideshowInterval)}else{if(B.loop){U=setTimeout(a,B.slideshowInterval,0)}else{d()}}}}else{F(X).css("display","")}}B.allowSave?F(D).attr("href",h[P][0]).css("display",""):F(D).css("display","none")}function I(){if(n){d()}else{E()}return false}function E(){n=true;if(P!=(h.length-1)){g()}else{if(B.slideshowAutoclose&&!B.loop){U=setTimeout(M,0)}else{if(B.loop){a(0)}else{}}}return false}function d(){n=false;clearTimeout(U);F(X).css("display","");F(s).css("display","none");return false}function w(){o.onload=null;o.src=z.src=V.src=t;F([b,j,c]).stop(true);F([T,e,j,Q]).hide()}function M(){if(P>=0){d();w();P=G=N=-1;F(b).hide();F(S).stop().fadeOut(B.overlayFadeDuration,m);clearTimeout(U)}return false}})(jQuery);var SlimboxOptions=jQuery.extend({},window.SlimboxOptions||{});if(!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)){jQuery(function(a){a("a[rel^='lightbox']").slimbox(SlimboxOptions,null,function(b){return(this==b)||((this.rel.length>8)&&(this.rel==b.rel))})})};

(function($){var win=$(window),options,images,activeImage=-1,activeURL,prevImage,nextImage,compatibleOverlay,middle,centerWidth,centerHeight,ie6=!window.XMLHttpRequest,hiddenElements=[],documentElement=document.documentElement,preload={},preloadPrev=new Image(),preloadNext=new Image(),present,presentationMode,slideshowMode,slideshowActive,slideshowTimer,playLink,pauseLink,saveLink,overlay,center,image,sizer,prevLink,nextLink,bottomContainer,bottom,caption,number;$(function(){$('body').append($([overlay=$('<div id="sbOverlay" />')[0],center=$('<div id="sbCenter" />')[0],bottomContainer=$('<div id="sbBottomContainer" />')[0]]).css('display','none'));image=$('<div id="sbImage" />').appendTo(center).append(sizer=$('<div style="position: relative;" />').append([prevLink=$('<a id="prevLink" href="#" />').click(previous)[0],nextLink=$('<a id="nextLink" href="#" />').click(next)[0]])[0])[0];bottom=$('<div id="sbBottom" />').appendTo(bottomContainer).append([$('<a id="closeLink" href="#" />').add(overlay).click(close)[0],playLink=$('<a id="playLink" href="#" />').click(play)[0],pauseLink=$('<a id="pauseLink" href="#" />').click(pause)[0],saveLink=$('<a id="saveLink" href="#" target="_blank" />')[0],caption=$('<div id="sbCaption" />')[0],number=$('<div id="sbNumber" />')[0],present=$('<div id="sbPresent" />')[0],$('<div style="clear: both;" />')[0]])[0]});$.slimbox=function(_images,startImage,_options){options=$.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],slideshowKeys:[83],allowSave:false,slideshowAutoplay:false,slideshowInterval:3000,slideshowAutoclose:true},_options);if(typeof _images=='string'){_images=[[_images,startImage]];startImage=0}middle=win.scrollTop()+(win.height()/2);centerWidth=options.initialWidth;centerHeight=options.initialHeight;$(center).css({top:Math.max(0,middle-(centerHeight/2)),width:centerWidth,height:centerHeight,marginLeft:-centerWidth/2}).show();compatibleOverlay=ie6||(overlay.currentStyle&&(overlay.currentStyle.position!='fixed'));if(compatibleOverlay)overlay.style.position='absolute';$(overlay).css('opacity',options.overlayOpacity).fadeIn(options.overlayFadeDuration);position();setup(1);images=_images;options.loop=options.loop&&(images.length>1);slideshowActive=options.slideshowAutoplay&&slideshowMode;return changeImage(startImage)};$.fn.slimbox=function(_options,linkMapper,linksFilter){linkMapper=linkMapper||function(el){el.rel.match(/present.+/)?presentationMode=true:presentationMode=false;el.rel.match(/slideshow.+/)?slideshowMode=true:slideshowMode=false;return[el.href,el.title]};linksFilter=linksFilter||function(){return true};var links=this;return links.unbind('click').click(function(){var link=this,startIndex=0,filteredLinks,i=0,length;filteredLinks=$.grep(links,function(el,i){return linksFilter.call(link,el,i)});for(length=filteredLinks.length;i<length;++i){if(filteredLinks[i]==link)startIndex=i;filteredLinks[i]=linkMapper(filteredLinks[i],i)}return $.slimbox(filteredLinks,startIndex,_options)})};function toInt(s){return parseInt(s.replace(/\D/g,''))}function position(){var l=win.scrollLeft(),w=win.width();$([center,bottomContainer]).css('left',l+(w/2));if(compatibleOverlay)$(overlay).css({left:l,top:win.scrollTop(),width:w,height:win.height()})}function setup(open){if(open){trackPageImpression();_gaq.push(['_trackPageview']);try{impTrack.track()}catch(e){}$('object').add(ie6?'select':'embed').each(function(index,el){hiddenElements[index]=[el,el.style.visibility];el.style.visibility='hidden'})}else{$.each(hiddenElements,function(index,el){el[0].style.visibility=el[1]});hiddenElements=[]}var fn=open?'bind':'unbind';win[fn]('scroll resize',position);$(document)[fn]('keydown',keyDown)}function keyDown(event){var code=event.keyCode,fn=$.inArray;return(fn(code,options.closeKeys)>=0)?close():(fn(code,options.nextKeys)>=0)?next():(fn(code,options.previousKeys)>=0)?previous():(fn(code,options.slideshowKeys)>=0)?togglePlayPause():false}function previous(){trackPageImpression();_gaq.push(['_trackPageview']);try{impTrack.track()}catch(e){}return changeImage(prevImage)}function next(){trackPageImpression();_gaq.push(['_trackPageview']);try{impTrack.track()}catch(e){}return changeImage(nextImage)}function changeImage(imageIndex){if(imageIndex>=0){activeImage=imageIndex;activeURL=images[activeImage][0];prevImage=(activeImage||(options.loop?images.length:0))-1;nextImage=((activeImage+1)%images.length)||(options.loop?0:-1);stop();center.className='sbLoading';preload=new Image();preload.onload=animateBox;preload.src=activeURL}return false}function animateBox(){center.className='';$(image).css({backgroundImage:'url('+activeURL+')',visibility:'hidden',display:''});$(sizer).width(preload.width);$([sizer,prevLink,nextLink]).height(preload.height);$(caption).html(images[activeImage][1]||'');$(number).html((((images.length>1)&&options.counterText)||'').replace(/###x###/,activeImage+1).replace(/###y###/,images.length));if(presentationMode){$(number).css('display','none');$(present).html('').css('display','');for(i=0;i<images.length;i++){var className=activeImage==i?'act':'no';var shortcut=$('<a id="pmi'+(i+1)+'" href="#" class="'+className+'"></a>').click(function(){var index=toInt($(this).attr('id'))-1;pause();return changeImage(index)});i<9?shortcut.html('0'+(i+1)):shortcut.html(i+1);shortcut.appendTo(present)}}else{$(number).css('display','');$(present).html('').css('display','none')}if(prevImage>=0)preloadPrev.src=images[prevImage][0];if(nextImage>=0)preloadNext.src=images[nextImage][0];centerWidth=image.offsetWidth;centerHeight=image.offsetHeight;var top=Math.max(0,middle-(centerHeight/2));if(center.offsetHeight!=centerHeight){$(center).animate({height:centerHeight,top:top},options.resizeDuration,options.resizeEasing)}if(center.offsetWidth!=centerWidth){$(center).animate({width:centerWidth,marginLeft:-centerWidth/2},options.resizeDuration,options.resizeEasing)}$(center).queue(function(){$(bottomContainer).css({width:centerWidth,top:top+centerHeight,marginLeft:-centerWidth/2,visibility:'hidden',display:''});$(image).css({display:'none',visibility:'',opacity:''}).fadeIn(options.imageFadeDuration,animateCaption)})}function animateCaption(){if(prevImage>=0)$(prevLink).show();if(nextImage>=0)$(nextLink).show();$(bottom).css('marginTop',-bottom.offsetHeight).animate({marginTop:0},options.captionAnimationDuration);bottomContainer.style.visibility='';$(playLink).css('display','none');$(pauseLink).css('display','none');if(slideshowMode){clearTimeout(slideshowTimer);if(slideshowActive){$(pauseLink).css('display','');if(activeImage!=(images.length-1)){slideshowTimer=setTimeout(next,options.slideshowInterval)}else{if(options.slideshowAutoclose){slideshowTimer=setTimeout(close,options.slideshowInterval)}else if(options.loop){slideshowTimer=setTimeout(changeImage,options.slideshowInterval,0)}else{pause()}}}else{$(playLink).css('display','')}}options.allowSave?$(saveLink).attr('href',images[activeImage][0]).css('display',''):$(saveLink).css('display','none')}function togglePlayPause(){if(slideshowActive){pause()}else{play()}return false}function play(){slideshowActive=true;if(activeImage!=(images.length-1)){next()}else{if(options.slideshowAutoclose&&!options.loop){slideshowTimer=setTimeout(close,0)}else if(options.loop){changeImage(0)}else{}}return false}function pause(){slideshowActive=false;clearTimeout(slideshowTimer);$(playLink).css('display','');$(pauseLink).css('display','none');return false}function stop(){preload.onload=null;preload.src=preloadPrev.src=preloadNext.src=activeURL;$([center,image,bottom]).stop(true);$([prevLink,nextLink,image,bottomContainer]).hide()}function close(){if(activeImage>=0){pause();stop();activeImage=prevImage=nextImage=-1;$(center).hide();$(overlay).stop().fadeOut(options.overlayFadeDuration,setup);clearTimeout(slideshowTimer)}return false}})(jQuery);var SlimboxOptions=jQuery.extend({},window.SlimboxOptions||{});if(!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)){jQuery(function($){$("a[rel^='lightbox']").slimbox(SlimboxOptions,null,function(el){return(this==el)||((this.rel.length>8)&&(this.rel==el.rel))})})}
