(function(c){c.tools=c.tools||{version:{}};c.tools.version.expose="1.0.3";function b(){var e=c(window).width();if(c.browser.mozilla){return e}var d;if(window.innerHeight&&window.scrollMaxY){d=window.innerWidth+window.scrollMaxX}else{if(document.body.scrollHeight>document.body.offsetHeight){d=document.body.scrollWidth}else{d=document.body.offsetWidth}}return d<e?d+20:e}function a(h,j){var e=this,i=null,g=false,d=0;function f(k,l){c(e).bind(k,function(m,n){if(l&&l.call(this)===false&&n){n.proceed=false}});return e}c.each(j,function(k,l){if(c.isFunction(l)){f(k,l)}});c(window).bind("resize.expose",function(){if(i){i.css({width:b(),height:c(document).height()})}});c.extend(this,{getMask:function(){return i},getExposed:function(){return h},getConf:function(){return j},isLoaded:function(){return g},load:function(){if(g){return e}d=h.eq(0).css("zIndex");if(j.maskId){i=c("#"+j.maskId)}if(!i||!i.length){i=c("<div/>").css({position:"absolute",top:0,left:0,width:b(),height:c(document).height(),display:"none",opacity:0,zIndex:j.zIndex});if(j.maskId){i.attr("id",j.maskId)}c("body").append(i);var k=i.css("backgroundColor");if(!k||k=="transparent"||k=="rgba(0, 0, 0, 0)"){i.css("backgroundColor",j.color)}if(j.closeOnEsc){c(document).bind("keydown.unexpose",function(n){if(n.keyCode==27){e.close()}})}if(j.closeOnClick){i.bind("click.unexpose",function(){e.close()})}}var m={proceed:true};c(e).trigger("onBeforeLoad",m);if(!m.proceed){return e}c.each(h,function(){var n=c(this);if(!/relative|absolute|fixed/i.test(n.css("position"))){n.css("position","relative")}});h.css({zIndex:j.zIndex+1});var l=i.height();if(!this.isLoaded()){i.css({opacity:0,display:"block"}).fadeTo(j.loadSpeed,j.opacity,function(){if(i.height()!=l){i.css("height",l)}c(e).trigger("onLoad")})}g=true;return e},close:function(){if(!g){return e}var k={proceed:true};c(e).trigger("onBeforeClose",k);if(k.proceed===false){return e}i.fadeOut(j.closeSpeed,function(){c(e).trigger("onClose");h.css({zIndex:c.browser.msie?d:null})});g=false;return e},onBeforeLoad:function(k){return f("onBeforeLoad",k)},onLoad:function(k){return f("onLoad",k)},onBeforeClose:function(k){return f("onBeforeClose",k)},onClose:function(k){return f("onClose",k)}})}c.fn.expose=function(f){var d=this.eq(typeof f=="number"?f:0).data("expose");if(d){return d}var e={maskId:null,loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,color:"#456",api:false};if(typeof f=="string"){f={color:f}}c.extend(e,f);this.each(function(){d=new a(c(this),e);c(this).data("expose",d)});return e.api?d:this}})(jQuery);