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

