(function(c){c.fn.jqm=function(e){var f={overlay:80,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:b,ajaxText:"",target:b,modal:b,toTop:true,onShow:b,onHide:b,onLoad:b};return this.each(function(){if(this._jqm){return k[this._jqm].c=c.extend({},k[this._jqm].c,e)}n++;this._jqm=n;k[n]={c:c.extend(f,c.jqm.params,e),a:b,w:c(this).addClass("jqmID"+n),s:n};if(f.trigger){c(this).jqmAddTrigger(f.trigger)}})};c.fn.jqmAddClose=function(f){return l(this,f,"jqmHide")};c.fn.jqmAddTrigger=function(f){return l(this,f,"jqmShow")};c.fn.jqmShow=function(e){return this.each(function(){e=e||window.event;c.jqm.open(this._jqm,e)})};c.fn.jqmHide=function(e){return this.each(function(){e=e||window.event;c.jqm.close(this._jqm,e)})};c.jqm={hash:{},open:function(w,x){var B=k[w],q=B.c,e="."+q.closeClass,m=(parseInt(B.w.css("z-index"))),m=(m>0)?m:3000,f=c("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":m-1,opacity:q.overlay/100});if(B.a){return b}B.t=x;B.a=true;B.w.css("z-index",m);if(q.modal){if(!p[0]){h("bind")}p.push(w)}else{if(q.overlay>0){B.w.jqmAddClose(f)}else{f=b}}B.o=(f)?f.addClass(q.overlayClass).prependTo("body"):b;if(j){c("html,body").css({height:"100%",width:"100%"});if(f){f=f.css({position:"absolute"})[0];for(var i in {Top:1,Left:1}){f.style.setExpression(i.toLowerCase(),"(_=(document.documentElement.scroll"+i+" || document.body.scroll"+i+"))+'px'")}}}if(q.ajax){var v=q.target||B.w,A=q.ajax,v=(typeof v=="string")?c(v,B.w):c(v),A=(A.substr(0,1)=="@")?c(x).attr(A.substring(1)):A;v.html(q.ajaxText).load(A,function(){if(q.onLoad){q.onLoad.call(this,B)}if(e){B.w.jqmAddClose(c(e,B.w))}d(B)})}else{if(e){B.w.jqmAddClose(c(e,B.w))}}if(q.toTop&&B.o){B.w.before('<span id="jqmP'+B.w[0]._jqm+'"></span>').insertAfter(B.o)}(q.onShow)?q.onShow(B):B.w.show();d(B);return b},close:function(e){var f=k[e];if(!f.a){return b}f.a=b;if(p[0]){p.pop();if(!p[0]){h("unbind")}}if(f.c.toTop&&f.o){c("#jqmP"+f.w[0]._jqm).after(f.w).remove()}if(f.c.onHide){f.c.onHide(f)}else{f.w.hide();if(f.o){f.o.remove()}}return b},params:{}};var n=0,k=c.jqm.hash,p=[],j=c.browser.msie&&(c.browser.version=="6.0")&&!window.XMLHttpRequest,b=false,a=c('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),d=function(e){if(j){if(e.o){e.o.html('<p style="width:100%;height:100%"/>').prepend(a)}else{if(!c("iframe.jqm",e.w)[0]){e.w.prepend(a)}}}g(e)},g=function(e){try{c(":input:visible",e.w)[0].focus()}catch(f){}},h=function(e){c()[e]("keypress",o)[e]("keydown",o)[e]("mousedown",o)},o=function(m){var i=k[p[p.length-1]],f=(!c(m.target).parents(".jqmID"+i.s)[0]);if(f){g(i)}return !f},l=function(f,e,i){return f.each(function(){var m=this._jqm;c(e).each(function(){if(!this[i]){this[i]=[];c(this).click(function(){for(var r in {jqmShow:1,jqmHide:1}){for(var q in this[r]){if(k[this[r][q]]){k[this[r][q]].w[r](this)}}}return b})}this[i].push(m)})})}})(jQuery);