function Popup(){}Popup.prototype.Show=function(o,p,t){var n={width:460,offsetY:150,height:void 0,addClass:"",onAjaxData:function(o){return o},onAjaxLoaded:function(){},onClose:function(){return!0},canClose:!0,canCloseByClickingBackground:!0};Popup.prototype.opts=$.extend({},n,t),this.Hide();var e=$("
").attr("class","popup_container").attr("id","popup").html('");e.find(".popup").addClass(this.opts.addClass).css("width",this.opts.width).css("top",$(window).scrollTop()+this.opts.offsetY),$("body").append(e),popup.SetCanClose(this.opts.canClose),void 0!=this.opts.height&&e.find("#popup_content").css("height",this.opts.height),$(document).on("keypress.popup",function(o){27==o.keyCode&&popup.TryHide()}),$(document).on("mouseup.popup",function(o){var p=$(".popup_container");Popup.prototype.opts.canCloseByClickingBackground&&(p.is(o.target)||0!==p.has(o.target).length||popup.TryHide())})},Popup.prototype.ShowIFrame=function(o,p,t){this.Show(o,"
",t),$.ajax({url:p,cache:!1}).done(function(o){o=Popup.prototype.opts.onAjaxData(o),$("#popup_content").html(o),Popup.prototype.opts.onAjaxLoaded()})},Popup.prototype.IsOpen=function(){return 0!=$("#popup").length},Popup.prototype.SetCanClose=function(o){this.opts.canClose=o,this.opts.canClose?$("#popup h2 div").show():$("#popup h2 div").hide()},Popup.prototype.TryHide=function(){0!=this.IsOpen()&&0!=this.opts.canClose&&0!=this.opts.onClose()&&this.Hide()},Popup.prototype.Hide=function(){$(document).off("keypress.popup"),$(document).off("moouseup.popup"),$("#popup iframe").attr("src","about:blank"),$("#popup").remove()};var popup=new Popup;