define("plugins/modal",["jquery"],function(t){var i=(new Date).getTime(),e={show:function(e){var a={};"object"==typeof e?a=e:"function"==typeof e&&(a.callback=e);var s=t("
").css({opacity:.05,background:"#000",position:"fixed",top:0,left:0,bottom:0,right:0,zIndex:100}).addClass("modalpopupmask").attr("id",i++);a.maskStyle&&s.css(a.maskStyle),this.data("maskid",s.attr("id"));var o=this;s.click(function(i){var e=t(this);i.shiftKey&&e.removeData("persistent"),e.data("persistent")||(e.stop().animate({opacity:0},750,function(){e.remove()}),a.callback&&a.callback(o),o.trigger("modalclose"),o.remove())}),t(document.body).append(s),s.stop().animate({opacity:.8},750),this.css({position:"fixed",top:"50%",left:"50%"}).addClass("modalpopup"),this.append(t("").addClass("closehandle").click(function(){s.click()}));var n=function(t){if(0==o.closest("html").length)return void clearInterval(n.timer);var i=[o.width(),o.height()],e=o.data("prevsize");if(!(Math.abs(e[0]-i[0])<5&&Math.abs(e[1]-i[1])<5)){o.data("prevsize",i);var a={marginLeft:-(i[0]/2),marginTop:-(i[1]/2)};t?o.css(a):o.stop().animate(a,250)}};return o.data("prevsize",[0,0]),n.timer=setInterval(n,100),this.css({visibility:"hidden"}),t(document.body).append(this),setTimeout(function(){n(!0),o.css({visibility:"visible"}),o.trigger("modalopen")},50),this},close:function(){return this.modal("persistent",!1),this.find(".closehandle").trigger("click"),this},persistent:function(i){return t("#"+this.data("maskid")).data("persistent",i?!0:!1),i?this.find(".closehandle").hide():this.find(".closehandle").show(),this}},a=function(t){return e[t]?e[t].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof t&&t?void 0:e.show.apply(this,arguments)};t(document).keyup(function(i){27==i.keyCode&&(i.shiftKey&&i.ctrlKey&&t(".modalpopupmask").removeData("persistent"),t(".modalpopupmask").trigger("click"))}),t.fn.modal=a});