/* Embeddable (837) jquery.lightbox.js */ /* (c) 2008 Benjamin Arthur Lupton {@link http://www.balupton.com} @license GNU Affero General Public License - {@link http://www.gnu.org/licenses/agpl.html} @example Visit {@link http://jquery.com/plugins/project/jquerylightbox_bal} for more information. */ (function(b){"undefined"===typeof b.log&&(b.browser.safari||"undefined"===typeof window.console||"function"!==typeof window.console.log?(b.log=function(){},b.console={log:b.log,debug:b.log,warn:b.log,error:alert,trace:b.log}):(b.log=function(){for(var a=[],b=0;b');this.resizeBoxes();this.repositionBoxes();b("#lightbox,#lightbox-overlay,#lightbox-overlay-text-interact").hide();this.ie6&&this.ie6_support&&b("#lightbox-overlay").css({position:"absolute",top:"0px",left:"0px"});b.each(this.files.images,function(){var a=new Image;a.onload=function(){a=a.onload=null};a.src=this});b(window).unbind("resize").resize(function(){b.Lightbox.resizeBoxes("resized")}); "follow"===this.scroll&&b(window).scroll(function(){b.Lightbox.repositionBoxes()});b("#lightbox-nav-btnPrev").unbind().hover(function(){b(this).css({background:"url("+b.Lightbox.files.images.prev+") left 45% no-repeat"})},function(){b(this).css({background:"transparent url("+b.Lightbox.files.images.blank+") no-repeat"})}).click(function(){b.Lightbox.showImage(b.Lightbox.images.prev());return!1});b("#lightbox-nav-btnNext").unbind().hover(function(){b(this).css({background:"url("+b.Lightbox.files.images.next+ ") right 45% no-repeat"})},function(){b(this).css({background:"transparent url("+b.Lightbox.files.images.blank+") no-repeat"})}).click(function(){b.Lightbox.showImage(b.Lightbox.images.next());return!1});this.show_linkback&&b("#lightbox-overlay-text-about a").click(function(){window.open(b.Lightbox.text.about.link);return!1});b("#lightbox-overlay-text-close").unbind().hover(function(){b("#lightbox-overlay-text-interact").show()},function(){b("#lightbox-overlay-text-interact").hide()});b("#lightbox-overlay, #lightbox, #lightbox-loading-link, #lightbox-btnClose").unbind().click(function(){b.Lightbox.finish(); return!1});this.auto_relify&&this.relify();return!0},relify:function(){var a={},c=0,d=this.rel;b.each(b("[rel*="+d+"]"),function(f,e){var g=b(e).attr("rel");g===d&&(g=c);"undefined"===typeof a[g]&&(a[g]=[],c++);a[g].push(e)});b.each(a,function(a,c){b(c).lightbox()});return!0},init:function(a,c){"undefined"===typeof c&&(c=a,a=0);this.images.clear();return this.images.add(c)?this.images.empty()?(b.console.warn("WARNING","Lightbox started, but no images: ",a,c),!1):this.images.active(a)?!0:!1:!1},start:function(){this.visible= !0;"disable"===this.scroll&&b(document.body).css("overflow","hidden");b("embed, object, select").css("visibility","hidden");this.resizeBoxes("general");this.repositionBoxes({speed:0});b("#lightbox-infoFooter").hide();b("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox").hide();b("#lightbox-overlay").css("opacity",this.opacity).show(1,function(){b("#lightbox").show(1);if(!b.Lightbox.showImage(b.Lightbox.images.active()))return b.Lightbox.finish(),!1});return!0}, finish:function(){b("#lightbox").hide();b("#lightbox-overlay").hide();b("embed, object, select").css({visibility:"visible"});this.images.active(!1);"disable"===this.scroll&&b(document.body).css("overflow","visible");this.visible=!1},resizeBoxes:function(a){if("transition"!==a){var c=b(this.ie6?document.body:document);b("#lightbox-overlay").css({width:c.width(),height:c.height()});delete c}switch(a){case "general":return!0;case "resized":if(!1===this.auto_resize)return this.repositionBoxes({nHeight:f, speed:this.speed}),!0}var d=this.images.active();if(!d||!d.width||!this.visible)return!1;var c=d.width,d=d.height,f=b(window).width(),e=b(window).height();if(!1!==this.auto_resize)for(var f=Math.floor(0.8*f),e=Math.floor(0.8*e),g;c>f||d>e;)c>f&&(g=f/c,c=f,d=Math.floor(d*g)),d>e&&(g=e/d,d=e,c=Math.floor(c*g));var h=b("#lightbox-imageBox").width();g=b("#lightbox-imageBox").height();var e=c+2*this.padding,f=d+2*this.padding,h=h-e;g-=f;b("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css("height",f); b("#lightbox-infoBox").css("width",e);"transition"===a?0===h&&0===g?(this.pause(this.speed/3),this.showImage(null,3)):(b("#lightbox-image").width(c).height(d),b("#lightbox-imageBox").animate({width:e,height:f},this.speed,function(){b.Lightbox.showImage(null,3)})):(b("#lightbox-image").animate({width:c,height:d},this.speed),b("#lightbox-imageBox").animate({width:e,height:f},this.speed));this.repositionBoxes({nHeight:f,speed:this.speed});return!0},repositioning:!1,reposition_failsafe:!1,repositionBoxes:function(a){if(this.repositioning)return this.reposition_failsafe= !0,null;this.repositioning=!0;a=b.extend({},a);a.callback=a.callback;a.speed=a.speed||"fast";var c=this.getPageScroll(),d=a.nHeight||parseInt(b("#lightbox").height(),10),d=c.yScroll+(b(window).height()-d)/2.5,c={left:c.xScroll,top:d};b("#lightbox").css(c);this.reposition_failsafe?(this.repositioning=this.reposition_failsafe=!1,this.repositionBoxes(a)):this.repositioning=!1;return!0},visible:!1,showImage:function(a,c){a=this.images.get(a);if(!a)return a;c=c||1;var d=1<c&&this.images.active().src!== a.src,f=2<c&&b("#lightbox-image").attr("src")!==a.src;if(d||f)b.console.info("We wanted to skip a few steps: ",a,c,d,f),c=1;switch(c){case 1:this.KeyboardNav_Disable();b("#lightbox-loading").show();b("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox").hide();b("#lightbox-imageBox").unbind();if(!this.images.active(a))return!1;if(a.width&&a.height)this.showImage(null,2);else{var e=new Image;e.onload=function(){a.width=e.width;a.height=e.height;b.Lightbox.showImage(null, 2);e=e.onload=null};e.src=a.src}break;case 2:b("#lightbox-image").attr("src",a.src);if("undefined"===typeof this.padding||null===this.padding||isNaN(this.padding))this.padding=parseInt(b("#lightbox-imageContainer").css("padding-left"),10)||parseInt(b("#lightbox-imageContainer").css("padding"),10)||0;this.colorBlend&&b("#lightbox-overlay").css({backgroundColor:a.color});this.resizeBoxes("transition");break;case 3:b("#lightbox-loading").hide();b("#lightbox-image").show(1,function(){b.Lightbox.showImage(null, 4)});this.preloadNeighbours();null!==this.handlers.show&&this.handlers.show(a);break;case 4:d=b("#lightbox-caption-title").html(a.title||"");this.download_link&&d.attr("href",this.download_link?a.src:"");delete d;b("#lightbox-caption-seperator").html(a.description?": ":"");b("#lightbox-caption-description").html(a.description||"");1<this.images.size()?b("#lightbox-currentNumber").html(this.text.image+"&nbsp;"+(a.index+1)+"&nbsp;"+this.text.of+"&nbsp;"+this.images.size()):b("#lightbox-currentNumber").html("&nbsp;"); b("#lightbox-imageBox").unbind("mouseover").mouseover(function(){b("#lightbox-infoBox:not(:visible)").stop().show()});b("#lightbox-infoBox").unbind("mouseover").mouseover(function(){b("#lightbox-infoFooter:not(:visible)").stop().show()});!0===this.show_extended_info?(b("#lightbox-imageBox").trigger("mouseover"),b("#lightbox-infoBox").trigger("mouseover")):!0===this.show_info&&b("#lightbox-imageBox").trigger("mouseover");b("#lightbox-nav-btnPrev, #lightbox-nav-btnNext").css({background:"transparent url("+ this.files.images.blank+") no-repeat"});this.images.first(a)||b("#lightbox-nav-btnPrev").show();this.images.last(a)||b("#lightbox-nav-btnNext").show();b("#lightbox-nav").show();this.KeyboardNav_Enable();break;default:return b.console.error("Don't know what to do: ",a,c),this.showImage(a,1)}return!0},preloadNeighbours:function(){if(this.images.single()||this.images.empty())return!0;var a=this.images.active();if(!a)return a;var b=this.images.prev(a),d;b&&(d=new Image,d.src=b.src);if(a=this.images.next(a))d= new Image,d.src=a.src},KeyboardNav_Enable:function(){b(document).keydown(function(a){b.Lightbox.KeyboardNav_Action(a)})},KeyboardNav_Disable:function(){b(document).unbind("keydown")},KeyboardNav_Action:function(a){a=a||window.event;var c=a.keyCode;a=a.DOM_VK_ESCAPE||27;var d=String.fromCharCode(c).toLowerCase();return d===this.keys.close||c===a?b.Lightbox.finish():d===this.keys.prev||37===c?b.Lightbox.showImage(b.Lightbox.images.prev()):d===this.keys.next||39===c?b.Lightbox.showImage(b.Lightbox.images.next()): !0},getPageScroll:function(){var a,b;self.pageYOffset?(b=self.pageYOffset,a=self.pageXOffset):document.documentElement&&document.documentElement.scrollTop?(b=document.documentElement.scrollTop,a=document.documentElement.scrollLeft):document.body&&(b=document.body.scrollTop,a=document.body.scrollLeft);return{xScroll:a,yScroll:b}},pause:function(a){var b=new Date,d=null;do d=new Date;while(d-b<a)}});"undefined"===typeof b.Lightbox&&(b.Lightbox=new b.LightboxClass)})(jQuery);