(function(a){a.fn.lightbox_me=function(k){return this.each(function(){function i(){var f=c[0].style;b.destroyOnClose?c.add(d).remove():c.add(d).hide();b.parentLightbox&&b.parentLightbox.fadeIn(200);h.remove();c.undelegate(b.closeSelector,"click");a(window).unbind("reposition",j);a(window).unbind("reposition",e);a(window).unbind("scroll",e);a(window).unbind("keyup.lightbox_me");g&&f.removeExpression("top");b.onClose()}function j(){a(window).height()<a(document).height()?(d.css({height:a(document).height()+
"px"}),h.css({height:a(document).height()+"px"})):(d.css({height:"100%"}),g&&(a("html,body").css("height","100%"),h.css("height","100%")))}function e(){var f=c[0].style;c.css({left:"50%",marginLeft:-1*(c.outerWidth()/2),zIndex:b.zIndex+3});if(c.height()+80>=a(window).height()&&("absolute"!=c.css("position")||g)){var d=a(document).scrollTop()+40;c.css({position:"absolute",top:d+"px",marginTop:0});g&&f.removeExpression("top")}else c.height()+80<a(window).height()&&(g?(f.position="absolute",b.centered?
(f.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"'),f.marginTop=0):(d=b.modalCSS&&b.modalCSS.top?parseInt(b.modalCSS.top):0,f.setExpression("top","((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+d+') + "px"'))):b.centered?c.css({position:"fixed",top:"50%",
marginTop:-1*(c.outerHeight()/2)}):c.css({position:"fixed"}).css(b.modalCSS))}var b=a.extend({},a.fn.lightbox_me.defaults,k),d=a(),c=a(this),h=a('<iframe id="foo" style="z-index: '+(b.zIndex+1)+';border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0; filter: mask();"/>'),g=a.browser.msie&&7>a.browser.version;b.showOverlay&&(d=0<a(".js_lb_overlay:visible").length?a('<div class="lb_overlay_clear js_lb_overlay"/>'):a('<div class="'+b.classPrefix+'_overlay js_lb_overlay"/>'));
if(g){var l=/^https/i.test(window.location.href||"")?"javascript:false":"about:blank";h.attr("src",l);a("body").append(h)}a("body").append(c.hide()).append(d);b.showOverlay&&(j(),d.css({position:"absolute",width:"100%",top:0,left:0,right:0,bottom:0,zIndex:b.zIndex+2,display:"none"}),d.hasClass("lb_overlay_clear")||d.css(b.overlayCSS));b.showOverlay?d.fadeIn(b.overlaySpeed,function(){e();c[b.appearEffect](b.lightboxSpeed,function(){j();e();b.onLoad()})}):(e(),c[b.appearEffect](b.lightboxSpeed,function(){b.onLoad()}));
b.parentLightbox&&b.parentLightbox.fadeOut(200);a(window).resize(j).resize(e).scroll(e);a(window).bind("keyup.lightbox_me",function(a){(27==a.keyCode||27==a.DOM_VK_ESCAPE&&0==a.which)&&b.closeEsc&&i()});b.closeClick&&d.click(function(a){i();a.preventDefault});c.delegate(b.closeSelector,"click",function(a){i();a.preventDefault()});c.bind("close",i);c.bind("reposition",e)})};a.fn.lightbox_me.defaults={appearEffect:"fadeIn",appearEase:"",overlaySpeed:250,lightboxSpeed:300,closeSelector:".close",closeClick:!0,
closeEsc:!0,destroyOnClose:!1,showOverlay:!0,parentLightbox:!1,onLoad:function(){},onClose:function(){},classPrefix:"lb",zIndex:999,centered:!1,modalCSS:{top:"40px"},overlayCSS:{background:"black",opacity:0.3}}})(jQuery);
