jQuery.fn.jqm=function(C){var B={zIndex:3000,overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:false,target:false,modal:false,toTop:false,onShow:false,onHide:false,onLoad:false};return this.each(function(){if(this._jqm){return}s++;this._jqm=s;H[s]={c:jQuery.extend(B,C),a:false,w:$(this).addClass("jqmID"+s),s:s};if(B.trigger){$(this).jqmAddTrigger(B.trigger)}})};jQuery.fn.jqmAddClose=function(B){hs(this,B,"jqmHide");return this};jQuery.fn.jqmAddTrigger=function(B){hs(this,B,"jqmShow");return this};jQuery.fn.jqmShow=function(B){return this.each(function(){if(!H[this._jqm].a){jQuery.jqm.open(this._jqm,B)}})};jQuery.fn.jqmHide=function(B){return this.each(function(){if(H[this._jqm].a){jQuery.jqm.close(this._jqm,B)}})};jQuery.jqm={hash:{},open:function(N,M){var G=H[N],I=G.c,D="."+I.closeClass,J=(/^\d+$/.test(G.w.css("z-index")))?G.w.css("z-index"):I.zIndex,C=$("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":J-1,opacity:I.overlay/100});G.t=M;G.a=true;G.w.css("z-index",J);if(I.modal){if(!A[0]){F("bind")}A.push(N);C.css("cursor","wait")}else{if(I.overlay>0){G.w.jqmAddClose(C)}else{C=false}}G.o=(C)?C.addClass(I.overlayClass).prependTo("body"):false;if(ie6){$("html,body").css({height:"100%",width:"100%"});if(C){C=C.css({position:"absolute"})[0];for(var K in {Top:1,Left:1}){C.style.setExpression(K.toLowerCase(),"(_=(document.documentElement.scroll"+K+" || document.body.scroll"+K+"))+'px'")}}}if(I.ajax){var B=I.target||G.w,L=I.ajax,B=(typeof B=="string")?$(B,G.w):$(B),L=(L.substr(0,1)=="@")?$(M).attr(L.substring(1)):L;B.load(L,function(){if(I.onLoad){I.onLoad.call(this,G)}if(D){G.w.jqmAddClose($(D,G.w))}E(G)})}else{if(D){G.w.jqmAddClose($(D,G.w))}}if(I.toTop&&G.o){G.w.before('<span id="jqmP'+G.w[0]._jqm+'"></span>').insertAfter(G.o)}(I.onShow)?I.onShow(G):G.w.show();E(G);return false},close:function(C){var B=H[C];B.a=false;if(A[0]){A.pop();if(!A[0]){F("unbind")}}if(B.c.toTop&&B.o){$("#jqmP"+B.w[0]._jqm).after(B.w).remove()}if(B.c.onHide){B.c.onHide(B)}else{B.w.hide();if(B.o){B.o.remove()}}return false}};var s=0,H=jQuery.jqm.hash,A=[],ie6=jQuery.browser.msie&&(jQuery.browser.version=="6.0"),i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),E=function(B){if(ie6){if(B.o){B.o.html('<p style="width:100%;height:100%"/>').prepend(i)}else{if(!$("iframe.jqm",B.w)[0]){B.w.prepend(i)}}}f(B)},f=function(B){try{$(":input:visible",B.w)[0].focus()}catch(C){}},F=function(B){$()[B]("keypress",m)[B]("keydown",m)[B]("mousedown",m)},m=function(D){var B=H[A[A.length-1]],C=(!$(D.target).parents(".jqmID"+B.s)[0]);if(C){f(B)}return !C},hs=function(B,D,G){var C=[];B.each(function(){C.push(this._jqm)});$(D).each(function(){if(this[G]){jQuery.extend(this[G],C)}else{this[G]=C;$(this).click(function(){for(var I in {jqmShow:1,jqmHide:1}){for(var J in this[I]){if(H[this[I][J]]){H[this[I][J]].w[I](this)}}}return false})}})};
