(function($){ $.fn.lightBox=function(_1){ _1=jQuery.extend({overlayBgColor:"#000",overlayOpacity:0.8,fixedNavigation:false,imageLoading:"themes/vivaliteTheme/images/5034.gif",imageBtnPrev:"themes/vivaliteTheme/images/sb_prevlabel.gif",imageBtnNext:"themes/vivaliteTheme/images/sb_nextlabel.gif",imageBtnClose:"themes/vivaliteTheme/images/sb_closelabel.gif",imageBlank:"themes/vivaliteTheme/images/5039.gif",containerBorderSize:10,containerResizeSpeed:400,txtImage:"Image",txtOf:"of",keyToClose:"c",keyToPrev:"p",keyToNext:"n",imageArray:[],activeImage:0},_1); var _2=this; function _3(){ _4(this,_2); return false; }; function _4(_5,_6){ $("embed, object, select").css({"visibility":"hidden"}); _7(); _1.imageArray.length=0; _1.activeImage=0; if(_6.length==1){ _1.imageArray.push(new Array(_5.getAttribute("href"),_5.getAttribute("title"))); }else{ for(var i=0;i<_6.length;i++){ _1.imageArray.push(new Array(_6[i].getAttribute("href"),_6[i].getAttribute("title"))); } } while(_1.imageArray[_1.activeImage][0]!=_5.getAttribute("href")){ _1.activeImage++; } _8(); }; function _7(){ $("body").append("<div id=\"jquery-overlay\"></div><div id=\"jquery-lightbox\"><div id=\"lightbox-container-image-box\"><a href=\"#\" id=\"lightbox-top-btnClose\"><img src=\""+_1.imageBtnClose+"\"></a><div id=\"lightbox-container-image\"><img id=\"lightbox-image\"><div style=\"\" 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=\""+_1.imageLoading+"\"></a></div></div></div><div id=\"lightbox-container-image-data-box\"><div id=\"lightbox-container-image-data\"><div id=\"lightbox-image-details\"><span id=\"lightbox-image-details-caption\"></span><span id=\"lightbox-image-details-currentNumber\"></span></div><div id=\"lightbox-secNav\"><a href=\"#\" id=\"lightbox-secNav-btnClose\"><img src=\""+_1.imageBtnClose+"\"></a></div></div></div></div>"); var _9=_a(); $("#jquery-overlay").css({opacity:_1.overlayOpacity,width:_9[0],height:_9[1]}).fadeIn(); var _b=_c(); $("#jquery-lightbox").css({top:_b[1]+(_9[3]/10),left:_b[0],position:"absolute"}).show(); $("#lightbox-loading-link,#lightbox-secNav-btnClose,#lightbox-top-btnClose").click(function(){ _23(); return false; }); $(window).resize(function(){ var _d=_a(); $("#jquery-overlay").css({width:_d[0],height:_d[1]}); var _e=_c(); $("#jquery-lightbox").css({top:_e[1]+(_d[3]/10),left:_e[0],position:"absolute"}); }); }; function _8(){ $("#lightbox-loading").show(); if(_1.fixedNavigation){ $("#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber").hide(); }else{ $("#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber").hide(); } var _f=new Image(); _f.onload=function(){ $("#lightbox-image").attr("src",_1.imageArray[_1.activeImage][0]); _10(_f.width,_f.height); _f.onload=function(){ }; }; _f.src=_1.imageArray[_1.activeImage][0]; }; function _10(_11,_12){ var _13=$("#lightbox-container-image-box").width(); var _14=$("#lightbox-container-image-box").height(); var _15=(_11+(_1.containerBorderSize*2)); var _16=(_12+(_1.containerBorderSize*2)); var _17=_13-_15; var _18=_14-_16; $("#lightbox-container-image-box").animate({width:_15,height:_16},_1.containerResizeSpeed,function(){ _19(); }); if((_17==0)&&(_18==0)){ if($.browser.msie){ _1a(250); }else{ _1a(100); } } if($.browser.msie){ $("#lightbox-container-image-data-box").css({width:_15}); }else{ $("#lightbox-container-image-data-box").css({width:_11}); } }; function _19(){ $("#lightbox-loading").hide(); $("#lightbox-image").fadeIn(function(){ _1b(); _1c(); }); _1d(); }; function _1b(){ $("#lightbox-container-image-data-box").slideDown("fast"); $("#lightbox-image-details-caption").hide(); if(_1.imageArray[_1.activeImage][1]){ $("#lightbox-image-details-caption").html(_1.imageArray[_1.activeImage][1]).show(); } if(_1.imageArray.length>1){ $("#lightbox-image-details-currentNumber").html(_1.txtImage+" "+(_1.activeImage+1)+" "+_1.txtOf+" "+_1.imageArray.length).show(); } }; function _1c(){ $("#lightbox-nav").show(); $("#lightbox-nav-btnPrev,#lightbox-nav-btnNext").css({"background":"transparent url("+_1.imageBlank+") no-repeat"}); if(_1.activeImage!=0){ if(_1.fixedNavigation){ $("#lightbox-nav-btnPrev").css({"background":"url("+_1.imageBtnPrev+") no-repeat scroll left 0%","height":$("#lightbox-image")[0].offsetHeight+"px"}).unbind().bind("click",function(){ _1.activeImage=_1.activeImage-1; _8(); return false; }); }else{ $("#lightbox-nav-btnPrev").unbind().hover(function(){ $(this).css({"background":"url("+_1.imageBtnPrev+")  no-repeat scroll left 0%","height":$("#lightbox-image")[0].offsetHeight+"px"}); },function(){ $(this).css({"background":"transparent url("+_1.imageBlank+") no-repeat"}); }).show().bind("click",function(){ _1.activeImage=_1.activeImage-1; _8(); return false; }); } } if(_1.activeImage!=(_1.imageArray.length-1)){ if(_1.fixedNavigation){ $("#lightbox-nav-btnNext").css({"background":"url("+_1.imageBtnNext+") no-repeat scroll right 0%","height":$("#lightbox-image")[0].offsetHeight+"px"}).unbind().bind("click",function(){ _1.activeImage=_1.activeImage+1; _8(); return false; }); }else{ $("#lightbox-nav-btnNext").unbind().hover(function(){ $(this).css({"background":"url("+_1.imageBtnNext+") no-repeat scroll right 0%","height":$("#lightbox-image")[0].offsetHeight+"px"}); },function(){ $(this).css({"background":"transparent url("+_1.imageBlank+") no-repeat"}); }).show().bind("click",function(){ _1.activeImage=_1.activeImage+1; _8(); return false; }); } } _1e(); }; function _1e(){ $(document).keydown(function(_1f){ _20(_1f); }); }; function _21(){ $(document).unbind(); }; function _20(_22){ if(_22==null){ keycode=event.keyCode; escapeKey=27; }else{ keycode=_22.keyCode; escapeKey=_22.DOM_VK_ESCAPE; } key=String.fromCharCode(keycode).toLowerCase(); if((key==_1.keyToClose)||(key=="x")||(keycode==escapeKey)){ _23(); } if((key==_1.keyToPrev)||(keycode==37)){ if(_1.activeImage!=0){ _1.activeImage=_1.activeImage-1; _8(); _21(); } } if((key==_1.keyToNext)||(keycode==39)){ if(_1.activeImage!=(_1.imageArray.length-1)){ _1.activeImage=_1.activeImage+1; _8(); _21(); } } }; function _1d(){ if((_1.imageArray.length-1)>_1.activeImage){ objNext=new Image(); objNext.src=_1.imageArray[_1.activeImage+1][0]; } if(_1.activeImage>0){ objPrev=new Image(); objPrev.src=_1.imageArray[_1.activeImage-1][0]; } }; function _23(){ $("#jquery-lightbox").remove(); $("#jquery-overlay").fadeOut(function(){ $("#jquery-overlay").remove(); }); $("embed, object, select").css({"visibility":"visible"}); }; function _a(){ var _24,_25; if(window.innerHeight&&window.scrollMaxY){ _24=window.innerWidth+window.scrollMaxX; _25=window.innerHeight+window.scrollMaxY; }else{ if(document.body.scrollHeight>document.body.offsetHeight){ _24=document.body.scrollWidth; _25=document.body.scrollHeight; }else{ _24=document.body.offsetWidth; _25=document.body.offsetHeight; } } var _26,_27; if(self.innerHeight){ if(document.documentElement.clientWidth){ _26=document.documentElement.clientWidth; }else{ _26=self.innerWidth; } _27=self.innerHeight; }else{ if(document.documentElement&&document.documentElement.clientHeight){ _26=document.documentElement.clientWidth; _27=document.documentElement.clientHeight; }else{ if(document.body){ _26=document.body.clientWidth; _27=document.body.clientHeight; } } } if(_25<_27){ pageHeight=_27; }else{ pageHeight=_25; } if(_24<_26){ pageWidth=_24; }else{ pageWidth=_26; } arrayPageSize=new Array(pageWidth,pageHeight,_26,_27); return arrayPageSize; }; function _c(){ var _28,_29; if(self.pageYOffset){ _29=self.pageYOffset; _28=self.pageXOffset; }else{ if(document.documentElement&&document.documentElement.scrollTop){ _29=document.documentElement.scrollTop; _28=document.documentElement.scrollLeft; }else{ if(document.body){ _29=document.body.scrollTop; _28=document.body.scrollLeft; } } } arrayPageScroll=new Array(_28,_29); return arrayPageScroll; }; function _1a(ms){ var _2a=new Date(); _2b=null; do{ var _2b=new Date(); }while(_2b-_2a<ms); }; return this.unbind("click").click(_3); }; })(jQuery);