(function(e){function c(j,h,f){var i=j[h];if(e.isFunction(i)){try{return i.call(f)}catch(g){if(j.alert){alert("Error calling expose."+h+": "+g)}else{throw g}return false}}return true}var a=null;var d,b=null;e.expose={getVersion:function(){return[1,0,0]},getMask:function(){return a},getExposed:function(){return d},getConf:function(){return b},isLoaded:function(){return a&&a.is(":visible")},load:function(f,g){if(this.isLoaded()){return this}if(f){d=f;b=g}else{f=d;g=b}if(!f||!f.length){return this}if(!a){a=e('<div id="'+g.maskId+'"></div>').css({position:"absolute",top:0,left:0,width:"100%",height:e(document).height(),display:"none",opacity:0,zIndex:g.zIndex});e("body").append(a);e(document).bind("keypress.unexpose",function(h){if(h.keyCode==27){e.expose.close()}});if(g.closeOnClick){a.bind("click.unexpose",function(){e.expose.close()})}}if(c(g,"onBeforeLoad",this)===false){return this}e.each(f,function(){var h=e(this);if(!/relative|absolute/i.test(h.css("position"))){h.css("position","relative")}});f.css({zIndex:g.zIndex+1});if(g.color){a.css("backgroundColor",g.color)}if(!this.isLoaded()){a.css({opacity:0,display:"block"}).fadeTo(g.loadSpeed,g.opacity,function(){c(g,"onLoad",e.expose)})}return this},close:function(){var f=this;if(!this.isLoaded()){return f}if(c(b,"onBeforeClose",f)===false){return f}a.fadeOut(b.closeSpeed,function(){d.css({zIndex:b.zIndex-1});c(b,"onClose",f)})}};e.prototype.expose=function(f){if(!this.length){return this}var g={alert:true,maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,zIndex:29,opacity:0.8,color:"#333"};if(typeof f=="string"){f={color:f}}e.extend(g,f);e.expose.load(this,g);return this}})(jQuery);
