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