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