//Include all jquery plugins into closure to avoid any janky plugin causing issues
(function($){

/*
* $ lightbox_me
* By: Buck Wilson
* Version : 2.2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


(function($){$.fn.lightbox_me=function(options){return this.each(function(){var opts=$.extend({},$.fn.lightbox_me.defaults,options),$overlay=$("div."+opts.classPrefix+"_overlay"),$self=$(this),$iframe=$("iframe#lb_iframe"),ie6=($.browser.msie&&$.browser.version<7);if($overlay.length>0){$overlay[0].removeModal()}else{$overlay=$('<div class="'+opts.classPrefix+'_overlay" style="display:none;"/>')}$iframe=($iframe.length>0)?$iframe:$iframe=$('<iframe id="lb_iframe" style="z-index: '+(opts.zIndex+1)+'; display: none; border: none; margin: 0; padding: 0; position: absolute; width: 100%; height: 100%; top: 0; left: 0;"/>');if(ie6){var src=/^https/i.test(window.location.href||"")?"javascript:false":"about:blank";$iframe.attr("src",src);$("body").append($iframe)}$("body").append($self).append($overlay);setSelfPosition();$self.css({left:"50%",marginLeft:($self.outerWidth()/2)*-1,zIndex:(opts.zIndex+3)});setOverlayHeight();$overlay.css({position:"absolute",width:"100%",top:0,left:0,right:0,bottom:0,zIndex:(opts.zIndex+2)}).css(opts.overlayCSS);if($overlay.is(":hidden")){$overlay.fadeIn(opts.overlaySpeed,function(){$self[opts.appearEffect](opts.lightboxSpeed,function(){setOverlayHeight();opts.onLoad()})})}else{$self[opts.appearEffect](opts.lightboxSpeed,function(){setOverlayHeight();opts.onLoad()})}$(window).resize(setOverlayHeight).resize(setSelfPosition).scroll(setSelfPosition).keydown(observeEscapePress);$self.find(opts.closeSelector).click(function(){removeModal(true);return false});$overlay.click(function(){if(opts.closeClick){removeModal(true);return false}});$self.bind("close",function(){removeModal(true)});$self.bind("resize",setSelfPosition);$overlay[0].removeModal=removeModal;function removeModal(removeO){$self[opts.disappearEffect](opts.lightboxDisappearSpeed,function(){if(removeO){removeOverlay()}opts.destroyOnClose?$self.remove():$self.hide();$self.find(opts.closeSelector).unbind("click");$self.unbind("close");$self.unbind("resize");$(window).unbind("scroll",setSelfPosition);$(window).unbind("resize",setSelfPosition)})}function removeOverlay(){$overlay.fadeOut(opts.overlayDisappearSpeed,function(){$(window).unbind("resize",setOverlayHeight);$overlay.remove();$overlay.unbind("click");opts.onClose()})}function observeEscapePress(e){if((e.keyCode==27||(e.DOM_VK_ESCAPE==27&&e.which==0))&&opts.closeEsc){removeModal(true)}}function setOverlayHeight(){if($(window).height()<$(document).height()){$overlay.css({height:$(document).height()+"px"})}else{$overlay.css({height:"100%"});if(ie6){$("html,body").css("height","100%")}}}function setSelfPosition(){var s=$self[0].style;if(($self.height()+80>=$(window).height())&&($self.css("position")!="absolute"||ie6)){var topOffset=$(document).scrollTop()+40;$self.css({position:"absolute",top:topOffset+"px",marginTop:0});if(ie6){s.removeExpression("top")}}else{if($self.height()+80<$(window).height()){if(ie6){s.position="absolute";if(opts.centered){s.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"');s.marginTop=0}else{var top=(opts.modalCSS&&opts.modalCSS.top)?parseInt(opts.modalCSS.top):0;s.setExpression("top","((blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+top+') + "px"')}}else{if(opts.centered){$self.css({position:"fixed",top:"50%",marginTop:($self.outerHeight()/2)*-1})}else{$self.css({position:"fixed"}).css(opts.modalCSS)}}}}}})};$.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);

	
})(window.jQuery);

