(function($){if(typeof $.log==="undefined")if(!$.browser.safari&&typeof window.console!=="undefined"&&typeof window.console.log==="function"){$.log=function(){for(var b=[],a=0;a<arguments.length;a++)b.push(arguments[a]);window.console.log.apply(window.console,b)};$.console={log:$.log,debug:window.console.debug||$.log,warn:window.console.warn||$.log,error:window.console.error||$.log,trace:window.console.trace||$.log}}else{$.log=function(){};$.console={log:$.log,debug:$.log,warn:$.log,error:alert,trace:$.log}}$.params_to_json=$.params_to_json||function(params){params=String(params);params=params.substring(params.indexOf("?")+1);params=params.replace(/\+/g,"%20");if(params.substring(0,1)==="{"&&params.substring(params.length-1)==="}")return eval(decodeURIComponent(params));params=params.split(/\&|\&amp\;/);for(var json={},i=0,n=params.length;i<n;++i){var param=params[i]||null;if(param===null)continue;param=param.split("=");if(param===null)continue;var key=param[0]||null;if(key===null)continue;if(typeof param[1]==="undefined")continue;var value=param[1];key=decodeURIComponent(key);value=decodeURIComponent(value);try{value=eval(value)}catch(a){}var keys=key.split(".");if(keys.length===1)json[key]=value;else{var path="";for(ii in keys){key=keys[ii];path+="."+key;eval("json"+path+" = json"+path+" || {}")}eval("json"+path+" = value")}}return json};$.LightboxClass=function(){this.construct()};$.fn.lightbox=function(a){$.Lightbox=$.Lightbox||new $.LightboxClass;if($.Lightbox.ie6&&!$.Lightbox.ie6_support)return this;a=$.extend({start:false,events:true},a);var b=$(this);if(a.events){$(b).unbind("click").click(function(){var a=$(this);if(!$.Lightbox.init($(a)[0],b))return false;if(!$.Lightbox.start())return false;return false});$(b).addClass("lightbox-enabled")}if(a.start){var c=$(this);if(!$.Lightbox.init($(c)[0],b))return this;if(!$.Lightbox.start())return this}return this};$.extend($.LightboxClass.prototype,{images:{list:[],image:false,prev:function(a){if(typeof a==="undefined"){a=this.active();if(!a)return a}if(this.first(a))return false;return this.get(a.index-1)},next:function(a){if(typeof a==="undefined"){a=this.active();if(!a)return a}if(this.last(a))return false;return this.get(a.index+1)},first:function(a){if(typeof a==="undefined")return this.get(0);return a.index===0},last:function(a){if(typeof a==="undefined")return this.get(this.size()-1);return a.index===this.size()-1},single:function(){return this.size()===1},size:function(){return this.list.length},empty:function(){return this.size()===0},clear:function(){this.list=[];this.image=false},active:function(a){if(typeof a==="undefined")return this.image;if(a!==false){a=this.get(a);if(!a)return a}this.image=a;return true},add:function(b){if(b[0]){for(var c=0;c<b.length;c++)this.add(b[c]);return true}var a=this.create(b);if(!a)return a;a.index=this.size();this.list.push(a);return true},create:function(b){var a={src:"",title:"Untitled",description:"",name:"",index:-1,color:null,width:null,height:null,image:true};if(b.image){a.src=b.src||a.src;a.title=b.title||a.title;a.description=b.description||a.description;a.name=b.name||a.name;a.color=b.color||a.color;a.width=b.width||a.width;a.height=b.height||a.height;a.index=b.index||a.index}else if(b.tagName){b=$(b);if(b.attr("src")||b.attr("href")){a.src=b.attr("src")||b.attr("href");a.title=b.attr("title")||b.attr("alt")||a.title;a.name=b.attr("name")||"";a.color=b.css("backgroundColor");var c=a.title.indexOf(": ");if(c>0){a.description=a.title.substring(c+2)||a.description;a.title=a.title.substring(0,c)||a.title}}else a=false}else a=false;if(!a){$.console.error("We dont know what we have:",b);return false}return a},"get":function(a){if(typeof a==="undefined"||a===null)return this.active();else if(typeof a==="number")a=this.list[a]||false;else{a=this.create(a);if(!a)return false;for(var d=false,c=0;c<this.size();c++){var b=this.list[c];if(b.src===a.src&&b.title===a.title&&b.description===a.description)d=b}a=d}if(!a){$.console.error("The desired image does not exist: ",a,this.list);return false}return a},debug:function(){return $.Lightbox.debug(arguments)}},constructed:false,compressed:null,src:null,baseurl:null,files:{compressed:{js:{lightbox:"js/jquery.lightbox.min.js",colorBlend:"js/jquery.color.min.js"},css:{lightbox:"css/jquery.lightbox.css"}},uncompressed:{js:{lightbox:"js/jquery.lightbox.js",colorBlend:"js/jquery.color.js"},css:{lightbox:"css/jquery.lightbox.css"}},images:{prev:"images/prev.gif",next:"images/next.gif",blank:"images/blank.gif",loading:"images/loading.gif"}},text:{image:"Image",of:"of",close:"Close X",closeInfo:"You can also click anywhere outside the image to close.",download:"Download.",help:{close:"Click to close",interact:"Hover to interact"},about:{text:"jQuery Lightbox Plugin (balupton edition)",title:"Licenced under the GNU Affero General Public License.",link:"http://jquery.com/plugins/project/jquerylightbox_bal"}},keys:{close:"c",prev:"p",next:"n"},handlers:{show:null},opacity:.9,padding:null,speed:400,rel:"lightbox",auto_relify:true,auto_scroll:"follow",auto_resize:true,ie6:null,ie6_support:true,ie6_upgrade:true,colorBlend:null,download_link:true,show_helper_text:true,show_linkback:true,show_info:"auto",show_extended_info:"auto",options:["show_helper_text","auto_scroll","auto_resize","download_link","show_info","show_extended_info","ie6_support","ie6_upgrade","colorBlend","baseurl","files","text","show_linkback","keys","opacity","padding","speed","rel","auto_relify"],construct:function(a){var f=typeof this.constructed==="undefined"||this.constructed===false;this.constructed=true;var e=f;a=a||{};var d=function(a,c){if(typeof a==="object")for(var b in a)a[b]=d(a[b],c);else if(typeof c==="array")for(var b=0,e=a.length;b<e;++b)a[b]=d(a[b],c);else a=c+a;return a};if(f&&typeof a.files==="undefined"){this.compressed=null;var c=$("script[src*="+this.files.compressed.js.lightbox+"]:first");if(c.length!==0){$.extend(true,this.files,this.files.compressed);this.compressed=true}else{c=$("script[src*="+this.files.uncompressed.js.lightbox+"]:first");if(c.length!==0){$.extend(true,this.files,this.files.uncompressed);this.compressed=false}}if(this.compressed===null){$.console.error("Lightbox was not able to find it's javascript script tag necessary for auto-inclusion.");e=false}else{this.src=c.attr("src");this.baseurl=this.src.substring(0,this.src.indexOf(this.files.js.lightbox));this.files=d(this.files,this.baseurl);a=$.extend(a,$.params_to_json(this.src))}}else if(typeof a.files==="object")a.files=d(a.files,this.baseurl);else e=false;for(var g in this.options){var b=this.options[g];if(typeof a[b]==="object"&&typeof this[b]==="object")this[b]=$.extend(true,this[b],a[b]);else if(typeof a[b]!=="undefined")this[b]=a[b]}delete g;if(f&&navigator.userAgent.indexOf("MSIE 6")>=0)this.ie6=true;else this.ie6=false;(e||typeof a.download_link!=="undefined"||typeof a.colorBlend!=="undefined"||typeof a.files==="object"||typeof a.text==="object"||typeof a.show_linkback!=="undefined"||typeof a.scroll_with!=="undefined")&&$(function(){$.Lightbox.domReady()});return true},domReady:function(){var e=document.getElementsByTagName($.browser.safari?"head":"body")[0],d=this.files.css,c=this.files.js;if(this.colorBlend===true&&typeof $.colorBlend==="undefined")this.colorBlend=true;else{this.colorBlend=typeof $.colorBlend!=="undefined";delete c.colorBlend}for(stylesheet in d){var a=document.createElement("link");a.type="text/css";a.rel="stylesheet";a.media="screen";a.href=d[stylesheet];a.id="lightbox-stylesheet-"+stylesheet.replace(/[^a-zA-Z0-9]/g,"");$("#"+a.id).remove();e.appendChild(a)}for(script in c){var b=document.createElement("script");b.type="text/javascript";b.src=c[script];b.id="lightbox-script-"+script.replace(/[^a-zA-Z0-9]/g,"");$("#"+b.id).remove();e.appendChild(b)}delete c;delete d;delete e;$("#lightbox,#lightbox-overlay").remove();$("body").append('<div id="lightbox-overlay"><div id="lightbox-overlay-text">'+(this.show_linkback?'<p><span id="lightbox-overlay-text-about"><a href="#" title="'+this.text.about.title+'">'+this.text.about.text+"</a></span></p><p>&nbsp;</p>":"")+(this.show_helper_text?'<p><span id="lightbox-overlay-text-close">'+this.text.help.close+'</span><br/>&nbsp;<span id="lightbox-overlay-text-interact">'+this.text.help.interact+"</span></p>":"")+'</div></div><div id="lightbox"><div id="lightbox-imageBox"><div id="lightbox-imageContainer"><img id="lightbox-image" /><div id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+this.files.images.loading+'" /></a></div></div></div><div id="lightbox-infoBox"><div id="lightbox-infoContainer"><div id="lightbox-infoHeader"><span id="lightbox-caption">'+(this.download_link?'<a href="#" title="'+this.text.download+'" id="lightbox-caption-title"></a>':'<span id="lightbox-caption-title"></span>')+'<span id="lightbox-caption-seperator"></span><span id="lightbox-caption-description"></span></span></div><div id="lightbox-infoFooter"><span id="lightbox-currentNumber"></span><span id="lightbox-close"><a href="#" id="lightbox-close-button" title="'+this.text.closeInfo+'">'+this.text.close+'</a></span></div><div id="lightbox-infoContainer-clear"></div></div></div></div>');this.resizeBoxes();this.repositionBoxes();$("#lightbox,#lightbox-overlay,#lightbox-overlay-text-interact").hide();this.ie6&&this.ie6_support&&$("#lightbox-overlay").css({position:"absolute",top:"0px",left:"0px"});$.each(this.files.images,function(){var a=new Image;a.onload=function(){a.onload=null;a=null};a.src=this});$(window).unbind("resize").resize(function(){$.Lightbox.resizeBoxes("resized")});this.scroll==="follow"&&$(window).scroll(function(){$.Lightbox.repositionBoxes()});$("#lightbox-nav-btnPrev").unbind().hover(function(){$(this).css({background:"url("+$.Lightbox.files.images.prev+") left 45% no-repeat"})},function(){$(this).css({background:"transparent url("+$.Lightbox.files.images.blank+") no-repeat"})}).click(function(){$.Lightbox.showImage($.Lightbox.images.prev());return false});$("#lightbox-nav-btnNext").unbind().hover(function(){$(this).css({background:"url("+$.Lightbox.files.images.next+") right 45% no-repeat"})},function(){$(this).css({background:"transparent url("+$.Lightbox.files.images.blank+") no-repeat"})}).click(function(){$.Lightbox.showImage($.Lightbox.images.next());return false});this.show_linkback&&$("#lightbox-overlay-text-about a").click(function(){window.open($.Lightbox.text.about.link);return false});$("#lightbox-overlay-text-close").unbind().hover(function(){$("#lightbox-overlay-text-interact").fadeIn()},function(){$("#lightbox-overlay-text-interact").fadeOut()});$("#lightbox-caption-title").click(function(){window.open($(this).attr("href"));return false});$("#lightbox-overlay, #lightbox, #lightbox-loading-link, #lightbox-btnClose").unbind().click(function(){$.Lightbox.finish();return false});this.auto_relify&&this.relify();return true},relify:function(){var a={},b=0,c=this.rel;$.each($("[rel*="+c+"]"),function(f,e){var d=$(e).attr("rel");if(d===c)d=b;if(typeof a[d]==="undefined"){a[d]=[];b++}a[d].push(e)});$.each(a,function(b,a){$(a).lightbox()});return true},init:function(b,a){if(typeof a==="undefined"){a=b;b=0}this.images.clear();if(!this.images.add(a))return false;if(this.images.empty()){$.console.warn("WARNING","Lightbox started, but no images: ",b,a);return false}if(!this.images.active(b))return false;return true},start:function(){this.visible=true;this.scroll==="disable"&&$(document.body).css("overflow","hidden");$("embed, object, select").css("visibility","hidden");this.resizeBoxes("general");this.repositionBoxes({speed:0});$("#lightbox-infoFooter").hide();$("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox").hide();$("#lightbox-overlay").css("opacity",this.opacity).fadeIn(400,function(){$("#lightbox").fadeIn(300);if(!$.Lightbox.showImage($.Lightbox.images.active())){$.Lightbox.finish();return false}});return true},finish:function(){$("#lightbox").hide();$("#lightbox-overlay").fadeOut(function(){$("#lightbox-overlay").hide()});$("embed, object, select").css({visibility:"visible"});this.images.active(false);this.scroll==="disable"&&$(document.body).css("overflow","visible");this.visible=false},resizeBoxes:function(j){if(j!=="transition"){var i=$(this.ie6?document.body:document);$("#lightbox-overlay").css({width:i.width(),height:i.height()});delete i}switch(j){case "general":return true;break;case "resized":if(this.auto_resize===false){this.repositionBoxes({nHeight:c,speed:this.speed});return true}}var h=this.images.active();if(!h||!h.width||!this.visible)return false;var b=h.width,a=h.height,p=$(window).width(),m=$(window).height();if(this.auto_resize!==false){var f=Math.floor(p*(4/5)),e=Math.floor(m*(4/5)),d;while(b>f||a>e){if(b>f){d=f/b;b=f;a=Math.floor(a*d)}if(a>e){d=e/a;a=e;b=Math.floor(b*d)}}}var n=$("#lightbox-imageBox").width(),k=$("#lightbox-imageBox").height(),g=b+this.padding*2,c=a+this.padding*2,o=n-g,l=k-c;$("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css("height",c);$("#lightbox-infoBox").css("width",g);if(j==="transition")if(o===0&&l===0){this.pause(this.speed/3);this.showImage(null,3)}else{$("#lightbox-image").width(b).height(a);$("#lightbox-imageBox").animate({width:g,height:c},this.speed,function(){$.Lightbox.showImage(null,3)})}else{$("#lightbox-image").animate({width:b,height:a},this.speed);$("#lightbox-imageBox").animate({width:g,height:c},this.speed)}this.repositionBoxes({nHeight:c,speed:this.speed});return true},repositioning:false,reposition_failsafe:false,repositionBoxes:function(a){if(this.repositioning){this.reposition_failsafe=true;return null}this.repositioning=true;a=$.extend({},a);a.callback=a.callback||null;a.speed=a.speed||"slow";var b=this.getPageScroll(),d=a.nHeight||parseInt($("#lightbox").height(),10),f=b.yScroll+($(window).height()-d)/2.5,e=b.xScroll,c={left:e,top:f};if(a.speed)$("#lightbox").animate(c,"slow",function(){if($.Lightbox.reposition_failsafe){$.Lightbox.repositioning=$.Lightbox.reposition_failsafe=false;$.Lightbox.repositionBoxes(a)}else{$.Lightbox.repositioning=false;a.callback&&a.callback()}});else{$("#lightbox").css(c);if(this.reposition_failsafe){this.repositioning=this.reposition_failsafe=false;this.repositionBoxes(a)}else this.repositioning=false}return true},visible:false,showImage:function(a,b){a=this.images.get(a);if(!a)return a;b=b||1;var d=b>1&&this.images.active().src!==a.src,e=b>2&&$("#lightbox-image").attr("src")!==a.src;if(d||e){$.console.info("We wanted to skip a few steps: ",a,b,d,e);b=1}switch(b){case 1:this.KeyboardNav_Disable();$("#lightbox-loading").show();$("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox").hide();$("#lightbox-imageBox").unbind();if(!this.images.active(a))return false;if(a.width&&a.height)this.showImage(null,2);else{var c=new Image;c.onload=function(){a.width=c.width;a.height=c.height;$.Lightbox.showImage(null,2);c.onload=null;c=null};c.src=a.src}break;case 2:$("#lightbox-image").attr("src",a.src);if(typeof this.padding==="undefined"||this.padding===null||isNaN(this.padding))this.padding=parseInt($("#lightbox-imageContainer").css("padding-left"),10)||parseInt($("#lightbox-imageContainer").css("padding"),10)||0;if(this.colorBlend){$("#lightbox-overlay").animate({backgroundColor:a.color},this.speed*2);$("#lightbox-imageBox").css("borderColor",a.color)}this.resizeBoxes("transition");break;case 3:$("#lightbox-loading").hide();$("#lightbox-image").fadeIn(this.speed*1.5,function(){$.Lightbox.showImage(null,4)});this.preloadNeighbours();this.handlers.show!==null&&this.handlers.show(a);break;case 4:var f=$("#lightbox-caption-title").html(a.title||"Untitled");this.download_link&&f.attr("href",this.download_link?a.src:"");delete f;$("#lightbox-caption-seperator").html(a.description?": ":"");$("#lightbox-caption-description").html(a.description||"&nbsp;");if(this.images.size()>1)$("#lightbox-currentNumber").html(this.text.image+"&nbsp;"+(a.index+1)+"&nbsp;"+this.text.of+"&nbsp;"+this.images.size());else $("#lightbox-currentNumber").html("&nbsp;");$("#lightbox-imageBox").unbind("mouseover").mouseover(function(){$("#lightbox-infoBox:not(:visible)").stop().slideDown("fast")});$("#lightbox-infoBox").unbind("mouseover").mouseover(function(){$("#lightbox-infoFooter:not(:visible)").stop().slideDown("fast")});if(this.show_extended_info===true){$("#lightbox-imageBox").trigger("mouseover");$("#lightbox-infoBox").trigger("mouseover")}else this.show_info===true&&$("#lightbox-imageBox").trigger("mouseover");$("#lightbox-nav-btnPrev, #lightbox-nav-btnNext").css({background:"transparent url("+this.files.images.blank+") no-repeat"});!this.images.first(a)&&$("#lightbox-nav-btnPrev").show();!this.images.last(a)&&$("#lightbox-nav-btnNext").show();$("#lightbox-nav").show();this.KeyboardNav_Enable();break;default:$.console.error("Don't know what to do: ",a,b);return this.showImage(a,1)}return true},preloadNeighbours:function(){if(this.images.single()||this.images.empty())return true;var b=this.images.active();if(!b)return b;var d=this.images.prev(b),a;if(d){a=new Image;a.src=d.src}var c=this.images.next(b);if(c){a=new Image;a.src=c.src}},KeyboardNav_Enable:function(){$(document).keydown(function(a){$.Lightbox.KeyboardNav_Action(a)})},KeyboardNav_Disable:function(){$(document).unbind("keydown")},KeyboardNav_Action:function(a){a=a||window.event;var b=a.keyCode,d=a.DOM_VK_ESCAPE||27,c=String.fromCharCode(b).toLowerCase();if(c===this.keys.close||b===d)return $.Lightbox.finish();if(c===this.keys.prev||b===37)return $.Lightbox.showImage($.Lightbox.images.prev());if(c===this.keys.next||b===39)return $.Lightbox.showImage($.Lightbox.images.next());return true},getPageScroll:function(){var a,b;if(self.pageYOffset){b=self.pageYOffset;a=self.pageXOffset}else if(document.documentElement&&document.documentElement.scrollTop){b=document.documentElement.scrollTop;a=document.documentElement.scrollLeft}else if(document.body){b=document.body.scrollTop;a=document.body.scrollLeft}var c={xScroll:a,yScroll:b};return c},pause:function(c){var b=new Date,a=null;do a=new Date;while(a-b<c)}});if(typeof $.Lightbox==="undefined")$.Lightbox=new $.LightboxClass})(jQuery);