var LIGHT_BOX_LINK_CLASS="lightBoxLink";var INITIALIZE_ON_LOAD=true;var LightBox=new function(){var g=navigator.userAgent;var f=this;var c;this.center;var b=$("<div id='lightBoxShadow'></div>");b.bind("click",d);b.css({position:"absolute",top:"0px",left:"0px",backgroundColor:"#000000",opacity:0,display:"none",zIndex:99});$(function(){$("body").append(b)});this.viewLightBox=function(r,m){c=r;var i=e();var k=a();var l=h();var j={left:l.left+parseInt(k.width/2,10),top:l.top+parseInt(k.height/2,10)};f.center=j;var n=i.width>k.width?i.width:k.width;var o=i.height>k.height?i.height:k.height;var q={width:n+"px",height:o+"px",display:"block"};b.css(q);var p=0;if(m&&m.verticalAlignCenter){p=(j.top-parseInt(c.outerHeight()/2,10))}b.animate({opacity:"0.5"},function(){c.css({top:p+"px",display:"block"});if(m&&m.callback){m.callback()}})};this.closeLightBox=d;function d(){c.css("display","none");b.animate({opacity:0},"normal",function(){b.css("display","none")})}function e(){var j=document.body.offsetWidth;var i=document.body.offsetHeight;return{width:j,height:i}}function a(){isOpera=/Opera/.test(g);var i,j;if(!isOpera){i=document.documentElement.clientWidth;j=document.documentElement.clientHeight}else{i=document.body.clientWidth;j=document.body.clientHeight}return{width:i,height:j}}function h(){var j=window.pageXOffset||document.documentElement.scrollLeft;var i=window.pageYOffset||document.documentElement.scrollTop;return{left:j,top:i}}};(function(){var k;var b;var i;var g;var n;var h,m;var c,a,e;var f,l;$(function(){c=$("<div id='lightBox'><div id='lightBoxProgressBar'></div><div id='lightBoxContent' class='clearfix'><img id='lightBoxImage' alt=''/><div id='lightBoxControls'><a id='lightBoxPrev' href='#'></a><a id='lightBoxNext' href='#'></a></div><a id='lightBoxClose' href='#'></a><span id='lightBoxImageCounter'></span><br/><span id='lightBoxImageDescription'></span></div></div>");h=$("#lightBoxProgressBar",c);m=$("#lightBoxContent",c);a=$("img",m);e=$("#lightBoxControls",m);$("#lightBoxPrev",e).bind("click",function(){var o=i.eq(n>0?n-1:g-1);m.fadeOut("normal",function(){d(o.get(0))});return false});$("#lightBoxNext",e).bind("click",function(){var o=i.eq(n<g-1?n+1:0);m.fadeOut("normal",function(){d(o.get(0))});return false});$("#lightBoxClose",m).bind("click",j);f=$("#lightBoxImageCounter",m);l=$("#lightBoxImageDescription",m);c.css({display:"none",zIndex:100});m.css("display","none");$("body").append(c);k=parseInt(c.css("padding-left"),10)+parseInt(c.css("padding-right"),10);b=parseInt(c.css("padding-top"),10)+parseInt(c.css("padding-bottom"),10);if(INITIALIZE_ON_LOAD){initLightBox()}});window.initLightBox=function(){i=$("."+LIGHT_BOX_LINK_CLASS);g=i.length;if(g===1){e.css("display","none");f.css("display","none")}else{e.css("display","block");f.css("display","inline")}i.bind("click",function(p){p.preventDefault();p.stopPropagation();var o=this;LightBox.viewLightBox(c,{verticalAlignCenter:true,callback:function(){d(o)}})})};function d(p){n=i.index(p);f.text("Image "+(n+1)+" of "+g);l.text($(p).attr("title"));h.css("display","block");var q=$(p).attr("href");var o=new Image();o.onload=function(){if(c.css("display")=="none"){return}a.attr("src",o.src);a.css({width:o.width+"px",height:o.height+"px"});h.css("display","none");var u=o.width;var r=m.height();var t=-Math.round((u+k)/2);var s=LightBox.center.top-Math.round((r+b)/2);c.animate({marginLeft:t+"px",top:s+"px",width:u+"px",height:r+"px"},500,function(){m.fadeIn("normal")})};o.src=q}function j(o){o.preventDefault();o.stopPropagation();m.css("display","none");LightBox.closeLightBox()}})();