/* jqModal - Minimalist Modaling with jQuery  (http://dev.iceburg.net/jquery/jqModal/)
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
* $Version: 03/01/2009 +r14*/
(function (b) {
    b.fn.jqm = function (a) { var k = { overlay: 50, overlayClass: "jqmOverlay", closeClass: "jqmClose", trigger: ".jqModal", ajax: d, ajaxText: "", target: d, modal: d, toTop: d, onShow: d, onHide: d, onLoad: d }; return this.each(function () { if (this._jqm) return i[this._jqm].c = b.extend({}, i[this._jqm].c, a); g++; this._jqm = g; i[g] = { c: b.extend(k, b.jqm.params, a), a: d, w: b(this).addClass("jqmID" + g), s: g }; k.trigger && b(this).jqmAddTrigger(k.trigger) }) }; b.fn.jqmAddClose = function (a) { return n(this, a, "jqmHide") }; b.fn.jqmAddTrigger = function (a) {
        return n(this,
a,"jqmShow")};b.fn.jqmShow=function(a){return this.each(function(){a=a||window.event;b.jqm.open(this._jqm,a)})};b.fn.jqmHide=function(a){return this.each(function(){a=a||window.event;b.jqm.close(this._jqm,a)})};b.jqm={hash:{},open:function(a,k){var c=i[a],e=c.c,l="."+e.closeClass,h=parseInt(c.w.css("z-index")),h=h>0?h:3E3,f=b("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":h-1,opacity:e.overlay/100});if(c.a)return d;c.t=k;c.a=!0;c.w.css("z-index",h);e.modal?
(j[0]||o("bind"),j.push(a)):e.overlay>0?c.w.jqmAddClose(f):f=d;c.o=f?f.addClass(e.overlayClass).prependTo("body"):d;if(p&&(b("html,body").css({height:"100%",width:"100%"}),f)){var f=f.css({position:"absolute"})[0],g;for(g in{Top:1,Left:1})f.style.setExpression(g.toLowerCase(),"(_=(document.documentElement.scroll"+g+" || document.body.scroll"+g+"))+'px'")}e.ajax?(h=e.target||c.w,f=e.ajax,h=typeof h=="string"?b(h,c.w):b(h),f=f.substr(0,1)=="@"?b(k).attr(f.substring(1)):f,h.html(e.ajaxText).load(f,function(){e.onLoad&&
e.onLoad.call(this,c);l&&c.w.jqmAddClose(b(l,c.w));q(c)})):l&&c.w.jqmAddClose(b(l,c.w));e.toTop&&c.o&&c.w.before('<span id="jqmP'+c.w[0]._jqm+'"></span>').insertAfter(c.o);e.onShow?e.onShow(c):c.w.show();q(c);return d},close:function(a){a=i[a];if(!a.a)return d;a.a=d;j[0]&&(j.pop(),j[0]||o("unbind"));a.c.toTop&&a.o&&b("#jqmP"+a.w[0]._jqm).after(a.w).remove();if(a.c.onHide)a.c.onHide(a);else a.w.hide(),a.o&&a.o.remove();return d},params:{}};var g=0,i=b.jqm.hash,j=[],p=b.browser.msie&&b.browser.version==
"6.0",d=!1,r=b('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),q=function(a){p&&(a.o?a.o.html('<p style="width:100%;height:100%"/>').prepend(r):b("iframe.jqm",a.w)[0]||a.w.prepend(r));s(a)},s=function(a){try{b(":input:visible",a.w)[0].focus()}catch(d){}},o=function(a){b()[a]("keypress",m)[a]("keydown",m)[a]("mousedown",m)},m=function(a){var d=i[j[j.length-1]];(a=!b(a.target).parents(".jqmID"+d.s)[0])&&s(d);return!a},n=function(a,g,c){return a.each(function(){var a=
this._jqm;b(g).each(function(){this[c]||(this[c]=[],b(this).click(function(){for(var a in{jqmShow:1,jqmHide:1})for(var b in this[a])if(i[this[a][b]])i[this[a][b]].w[a](this);return d}));this[c].push(a)})})}})(jQuery);
