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