(function($) {
    function ExfJsPopup(config, id) {
        this.IsIE6 = $.browser.msie && $.browser.version == "6.0";
        this.getScroll = function() {
            var w3c = (document.getElementById) ? true : false;
            var agt = navigator.userAgent.toLowerCase();
            var ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1) && (agt.indexOf("omniweb") == -1));
            var IeTrueBody = (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
            var o = new Object();
            o.left = ie ? IeTrueBody.scrollLeft : window.pageXOffset;
            o.top = ie ? IeTrueBody.scrollTop : window.pageYOffset;
            o.width = ie ? IeTrueBody.scrollWidth : window.pageXWidth;
            o.height = ie ? IeTrueBody.scrollHeight : window.pageXHeight;
            return o;
        }
        this.config = { id: "", title: "", width: 300, height: null, ismax: true, isclose: true, ismask: true, isbuttons: false, isresize: true, ismove: true, data: null, resize: { minWidth: 0, minHeight: 0, maxWidth: 0, maxHeight: 0 }, note: { show: false, icon: "", title: "", msg: "" }, text: { cText: "\u53d6 \u6d88", eText: "\u786e \u5b9a" }, onload: null };
        this.defaultConfig = {};
        if (typeof config == "object") {
            $.extend(this.config, config);
        }
        $.extend(this.defaultConfig, this.config);
        this.id = id;
        this.onCreate();
        this.callback = null;
        this.callcancel = null;
    };
    ExfJsPopup.prototype.onCreate = function() {
        this.targetbody = $(document.body);
        this.body = $('<div class="popup-body" id="ExfPopup-' + this.id + '"><div class="popup-mask"></div><div class="popup-main"><table class="popup-table"></table></div></div>').appendTo(this.targetbody);
        this.mask = this.body.children(".popup-mask");
        this.popup = this.body.children(".popup-main");
        this.table = this.popup.children(".popup-table");
        this.popup_header = $('<tr class="popup-header"><td class="exf-left"></td><td class="exf-center" valign="top"><td class="exf-right"></td></tr>').appendTo(this.table);
        this.popup_header_title = $('<div class="title"><span></span></div>').appendTo(this.popup_header.children(".exf-center"));
        this.popup_header_tools = $('<div class="tools"></div>').appendTo(this.popup_header.children(".exf-center"));
        this.popup_header_tools_max = $('<span class="max" title="\u6700\u5927\u5316/\u8fd8\u539f"></span>').appendTo(this.popup_header_tools);
        this.popup_header_tools_close = $('<span class="close" title="\u5173\u95ed"></span>').appendTo(this.popup_header_tools);
        this.popup_content = $('<tr class="popup-content"><td class="exf-left"></td><td class="exf-center" valign="top"></td><td class="exf-right"></td></tr>').appendTo(this.table);
        this.popup_content_note = $('<div class="exf-note"><img width="32px" height="32px" /><div class="notetext"><span class="title"></span><span class="msg"></span></div></div>').appendTo(this.popup_content.children(".exf-center"));
        this.popup_content_body = $('<div class="exf-content"></div>').appendTo(this.popup_content.children(".exf-center")); this.popup_content_buttons = $('<div class="exf-buttons"><span class="button"></span><span class="button"></span></div>').appendTo(this.popup_content.children(".exf-center"));
        this.popup_content_buttons_enter = this.popup_content_buttons.children().eq(0);
        this.popup_content_buttons_close = this.popup_content_buttons.children().eq(1);
        this.popup_bottom = $('<tr class="popup-bottom"><td class="exf-left"></td><td class="exf-center"></td><td class="exf-right"></td></tr>').appendTo(this.table);
        var $this = this;

        this.popup_header_tools_max.hover(function() {
            if ($(this).data("enabled") == true) {
                $this._istoolsdown = true;
                $(this).parent().addClass("focusB");
            }
        }, function() {
            if ($(this).data("enabled") == true) {
                $this._istoolsdown = false;
                $(this).parent().removeClass("focusB");
            }
        });

        this.popup_header_tools_close.hover(function() {
            if ($(this).data("enabled") != false) {
                $this._istoolsdown = true;
                $(this).parent().addClass("focusR").parents("tr").children(":last").attr("class", "exf-rightfocus");
            }
        }, function() {
            if ($(this).data("enabled") != false) {
                $this._istoolsdown = false;
                $(this).parent().removeClass("focusR").parents("tr").children(":last").attr("class", "exf-right");
            }
        });

        this.popup_content_buttons_close.hover(function() {
            $(this).addClass("focus");
        }, function() {
            $(this).removeClass("focus");
        });

        this.popup_content_buttons_enter.hover(function() {
            $(this).addClass("focus");
        }, function() {
            $(this).removeClass("focus");
        });

        this.popup_header_tools_close.bind("click", this, function(e) {
            if ($(this).data("enabled") != false) {
                e.data.onHide(e);
            }
        });

        this.popup_content_buttons_close.bind("click", this, this.onClose);
        this.popup_content_buttons_enter.bind("click", this, this.onEnter);
        this.popup_header_tools_max.bind("click", this, this.onMax);
        this.popup_header.children(".exf-center").bind("dblclick", this, this.onMax);
        this.mask.bind("selectstart", this.onNotSelect);
        this.popup_header.bind("selectstart", this.onNotSelect);
        this.popup_content_note.bind("selectstart", this.onNotSelect);
        this.popup_content_buttons.bind("selectstart", this.onNotSelect);
        this.popup_content.children(".exf-right").bind("selectstart", this.onNotSelect);
        this.popup_bottom.bind("selectstart", this.onNotSelect);
        this.popup_bottom.children(".exf-right").bind("selectstart", this.onNotSelect);
        this.popup_bottom.children(".exf-center").bind("selectstart", this.onNotSelect);
        this.popup_content.children(".exf-right").bind("selectstart", this.onNotSelect);
        this.popup_header.children(".exf-center").bind("mousedown", this, this.onMoveStart);
        if (this.config.isresize) {
            this.popup_bottom.children(".exf-right").bind("mousedown", { obj: this, type: 0 }, function(e) {
                if (e.data.obj.config.isresize) { e.data.obj.onResizeStart(e); }
            });
            this.popup_bottom.children(".exf-center").bind("mousedown", { obj: this, type: 1 }, function(e) {
                if (e.data.obj.config.isresize) { e.data.obj.onResizeStart(e); }
            });
            this.popup_content.children(".exf-right").bind("mousedown", { obj: this, type: 2 }, function(e) {
                if (e.data.obj.config.isresize) { e.data.obj.onResizeStart(e); }
            });
        }
    };
    ExfJsPopup.prototype.onNotSelect = function() { return false; };

    ExfJsPopup.prototype.onMoveStart = function(e) {
        $this = e.data;
        if ($this.config.ismove != true) { return; }
        if ($this._ismax == true) { return; }
        if ($this._istoolsdown == true) { return; }
        $this._isdown = true;
        $this.popup_moveline = $("<div/>", { "class": "popup-moveline", css: ({ display: "none", width: $this.popup.width() - 10, height: $this.popup.height() - 10, left: $this.popup.offset().left + 10, top: $this.popup.offset().top + 10 }) }).appendTo($this.body);
        $(document).bind("selectstart", $this.onNotSelect);
        var scroll = $this.getScroll();
        var offset = $this.popup.offset();
        var obj = { obj: $this, left: e.clientX - offset.left + scroll.left, top: e.clientY - offset.top + scroll.top };
        if ($this.IsIE6) {
            obj.left -= scroll.left;
            obj.top -= scroll.top;
        }
        $(document).bind("mousemove", obj, $this.onMoveIng);
        $(document).bind("mouseup", $this, $this.onMoveEnd);
    };

    ExfJsPopup.prototype.onMoveIng = function(e) {
        $this = e.data.obj;
        if ($this._isdown != true) { return; }
        if ($this.popup_moveline.css("display") == "none") {
            $this.popup_moveline.show();
        }
        $this._ismove = true;
        var x = e.clientX - e.data.left + 5;
        var y = e.clientY - e.data.top + 5;
        $this.popup_moveline.css({ top: y, left: x });
    };

    ExfJsPopup.prototype.onMoveEnd = function(e) {
        $this = e.data;
        $(document).unbind("mousemove", $this.onMoveIng);
        $(document).unbind("mouseup", $this.onMoveEnd);
        $(document).unbind("selectstart", $this.onNotSelect);
        $this._isdown = false;
        $this.popup.stop();
        if ($this._ismove != true) { return; }
        $this._ismove = false;
        var offset = $this.popup_moveline.offset();
        $this.popup_moveline.remove();
        var scroll = $this.getScroll();
        var left = offset.left - scroll.left - 5, top = offset.top - scroll.top - 5;
        var _w = $(window).width();
        var _h = $(window).height();
        if ($this.IsIE6) {
            left += scroll.left;
            top += scroll.top;
        }
        if ($this.IsIE6) {
            _w += scroll.left;
            _h += scroll.top;
        } if (_w < left + $this.popup.width()) {
            left = _w - $this.popup.width();
        } else {
            if (left < 0) {
                left = 0;
            }
        } if (_h < top + $this.popup.height()) {
            top = _h - $this.popup.height();
        } else {
            if (top < 0) { top = 0; }
        }
        $this.popup.animate({ left: left, top: top }, 400);
    };

    ExfJsPopup.prototype.onResizeStart = function(e) {
        $this = e.data.obj;
        if ($this._ismax == true) { return; }
        $this._isresize = true;
        var offset = $this.popup.offset();
        var _l = offset.left;
        var _t = offset.top;
        if (!$this.IsIE6) {
            var scroll = $this.getScroll();
            _l -= scroll.left; _t -= scroll.top;
        }
        $this.popup_moveline = $("<div/>", { "class": "popup-moveline", css: ({ width: $this.popup.width() - 10, height: $this.popup.height() - 10, left: _l + 5, top: _t + 5 }) }).appendTo($this.body);
        var offset = $this.popup.offset();
        var obj = { obj: $this, type: e.data.type, offset: $this.popup.offset() };
        obj.w = $this.popup.width() - 10 - e.clientX;
        obj.h = $this.popup.height() - 10 - e.clientY;
        $(document).bind("mousemove", obj, $this.onResizeIng);
        $(document).bind("mouseup", $this, $this.onResizeEnd);
        $(document).bind("selectstart", $this.onNotSelect);
    };

    ExfJsPopup.prototype.onResizeIng = function(e) {
        $this = e.data.obj;
        if ($this._isresize != true) {
            return;
        }
        if ($this.popup_moveline.css("display") == "none") {
            $this.popup_moveline.show();
        }
        $this._ismove = true;
        var width = e.data.w + e.clientX;
        var height = e.data.h + e.clientY;
        var offset = e.data.offset;
        if ($this.config.resize.minWidth > 0) {
            if (width < $this.config.resize.minWidth) { width = $this.config.resize.minWidth; }
        } if ($this.config.resize.minHeight > 0) {
            if (height < $this.config.resize.minHeight) { height = $this.config.resize.minHeight; }
        } var scroll = $this.getScroll(); if ($this.config.resize.maxWidth > 0) {
            if (width > $this.config.resize.maxWidth) { width = $this.config.resize.maxWidth; }
        } else {
            if (width > $(window).width() - 10) { width = $(window).width() - 10 } else {
                if (width + offset.left > $(window).width() - 10 + scroll.left) {
                    width = $(window).width() - 10 - offset.left + scroll.left;
                }
            }
        } if ($this.config.resize.maxHeight > 0) {
            if (height > $this.config.resize.maxHeight) {
                height = $this.config.resize.maxHeight;
            }
        } else {
            if (height > $(window).height() - 10) {
                height = $(window).height() - 10;
            } else {
                if (height + offset.top > $(window).height() - 10 + scroll.top) {
                    height = $(window).height() - 10 - offset.top + scroll.top;
                }
            }
        }
        if (width < 250) { width = 250; }
        var _minheight = $this.popup_header.height() + $this.popup_bottom.height() + 4 + 7;
        if ($this.config.note.show) {
            _minheight += $this.popup_content_note.outerHeight();
        }
        if ($this.config.isbuttons) {
            _minheight += $this.popup_content_buttons.outerHeight();
        }
        if (height < _minheight) {
            height = _minheight;
        }
        switch (e.data.type) {
            case 0: $this.popup_moveline.css({ width: width, height: height }); break;
            case 1: $this.popup_moveline.css({ height: height }); break;
            case 2: $this.popup_moveline.css({ width: width }); break;
        }
    };

    ExfJsPopup.prototype.onResizeEnd = function(e) {
        $this.popup_content_body.stop();
        $this.popup.stop();
        $this = e.data;
        $(document).unbind("mousemove", $this.onResizeIng);
        $(document).unbind("mouseup", $this.onResizeEnd);
        $(document).unbind("selectstart", $this.onNotSelect);
        if ($this._ismove != true) { return; }
        var width = $this.popup_moveline.width() + 10;
        var height = $this.popup_moveline.height() + 10;
        $this.popup_moveline.remove();
        $this.popup.animate({ width: width, height: height }, 300);
        $this.popup_content_body.animate({ height: $this.getContentHeight(height) }, 300);
        $this._ismove = false;
        $this._isresize = false;
    };

    ExfJsPopup.prototype.onMax = function(e, nosave) {
        var $this = e.data;
        if ($this.config.ismax != true) { return; }
        $this.popup_content_body.stop();
        $this.popup.stop();
        if ($this._ismax == true) {
            $this._ismax = false;
            var _oldMax = $this._oldMax;
            $this._oldMax = null;
            $this.popup.animate({ left: _oldMax.l, top: _oldMax.t, width: _oldMax.w, height: _oldMax.h }, 300);
            $this.popup_content_body.animate({ height: _oldMax.h2 }, 300, function() {
                setTimeout(function() {
                    $this.rePosition(e);
                }, 1)
            });
            $this.popup_header_tools.removeClass("max");
        } else {
            var scroll = $this.getScroll();
            var _offset = $this.popup.offset();
            if (nosave != true) {
                $this._oldMax = { l: _offset.left, t: _offset.top, w: $this.popup.width(), h: $this.popup.height(), h2: $this.popup_content_body.height() };
                if (!$this.IsIE6) { $this._oldMax.l -= scroll.left; $this._oldMax.t -= scroll.top; }
            }
            var maxW = $(window).width();
            var maxH = $(window).height();
            if ($this.IsIE6) {
                $this.popup.animate({ left: scroll.left, top: scroll.top, width: maxW, height: maxH }, 300);
                $this.popup_content_body.animate({ height: $this.getContentHeight(maxH - 7) }, 300);
                $this._ismax = true;
            } else {
                $this.popup.animate({ left: -8, top: -8, width: maxW + 16, height: maxH + 16 }, 300);
                $this.popup_content_body.animate({ height: $this.getContentHeight(maxH + 16) }, 300);
                $this._ismax = true;
                $this.popup_header_tools.addClass("max");
            }
        }
    };

    ExfJsPopup.prototype.getContentHeight = function(height) {
        var h1 = height - this.popup_header.height() - this.popup_bottom.height() - 4;
        if (this.config.note.show) { h1 = h1 - this.popup_content_note.outerHeight(); }
        if (this.config.isbuttons) { h1 = h1 - this.popup_content_buttons.outerHeight(); } return h1;
    };

    ExfJsPopup.prototype.setConfig = function() {
        this.popup_header_title.children("span").html(this.config.title);
        if (this.config.ismask == true) { this.mask.show(); } else { this.mask.hide(); }
        this.popup_header_tools_max.data("enabled", this.config.ismax);
        if (this.config.isclose) {
            this.popup_header_tools_close.data("enabled", true);
            this.popup_header_tools.show();
            if (this.config.ismax) {
                this.popup_header_tools.removeClass("single");
            } else {
                this.popup_header_tools.addClass("single");
            }
        } else {
            this.popup_header_tools_close.data("enabled", false);
            if (this.config.ismax) {
                this.popup_header_tools.show();
            } else {
                this.popup_header_tools.hide();
            }
        }
        if (this.config.note.show) {
            this.popup_content_note.show();
            if (this.config.note.icon != null && this.config.note.icon.length > 0) {
                this.popup_content_note.children("img").attr("src", this.config.note.icon).show();
                this.popup_content_note.children(".notetext").css("margin-left", "0px");
            } else {
                this.popup_content_note.children("img").hide();
                this.popup_content_note.children(".notetext").css("margin-left", "10px");
            }
            this.popup_content_note.children(".notetext").children(".title").text(this.config.note.title);
            this.popup_content_note.children(".notetext").children(".msg").text(this.config.note.msg);
        } else {
            this.popup_content_note.hide();
        } if (this.config.isbuttons) {
            this.popup_content_buttons.show();
            this.popup_content_buttons_close.text(this.config.text.cText);
            this.popup_content_buttons_enter.text(this.config.text.eText);
            if (this.config.isclose) {
                this.popup_content_buttons_close.show();
            } else {
                this.popup_content_buttons_close.hide();
            }
        } else {
            this.popup_content_buttons.hide();
        }
        if (this.config.isresize) {
            this.popup_bottom.children(".exf-right").css({ cursor: "nw-resize", "-moz-user-select": "none" });
            this.popup_bottom.children(".exf-center").css({ cursor: "n-resize", "-moz-user-select": "none" });
            this.popup_content.children(".exf-right").css({ cursor: "w-resize", "-moz-user-select": "none" });
        } else {
            this.popup_bottom.children(".exf-right").removeAttr("style");
            this.popup_bottom.children(".exf-center").removeAttr("style");
            this.popup_content.children(".exf-right").removeAttr("style");
        }
    };
    ExfJsPopup.prototype.rePosition = function(v) {
    var $this = v == null ? this : v.data; 
        $this.popup.stop();
        $this.popup_content_body.stop();
        var _w = $(window).width();
        var _h = $(window).height();
        var _left = _w / 2 - $this.popup.width() / 2;
        var _top = _h / 2 - $this.popup.height() / 2;
        var scroll = $this.getScroll();
        if ($this.IsIE6) {
            $this.mask.width($(window).width() + scroll.left);
            $this.mask.height(scroll.height);
            if (v == null) {
                _left += scroll.left; _top += scroll.top;
            }
        }
        if (v != null) {
            var offset = $this.popup.offset();
            _left = offset.left;
            _top = offset.top;
            if ($this.IsIE6) {
                _w += scroll.left; _h += scroll.top
            } if ($this.IsIE6) {
                if (_w < _left + $this.popup.width()) {
                    _left = _w - $this.popup.width();
                }
                if (_h < _top + $this.popup.height()) {
                    _top = _h - $this.popup.height();
                }
            }
            if (!$this.IsIE6) {
                _left -= scroll.left;
                _top -= scroll.top;
            }
        }
        if (_left < 0) { _left = 0 } if (_top < 0) { _top = 0; }
        if (v == null) {
            $this.popup.css({ left: _left, top: _top });
        } else {
            $this.popup.animate({ left: _left, top: _top }, 400);
        }
        if ($this._ismax) {
            $this._ismax = false;
            $this.onMax({ data: $this }, true);
        }
    };
    ExfJsPopup.prototype.reSize = function(blFamer) {
        this.popup.width(this.config.width);
        if (this.config.height != null) {
            var h = this.getContentHeight(this.config.height);
            this.popup.height(this.config.height);
            this.popup_content_body.height(h);
        } else {
            this.popup.height("auto");
            if (blFamer != true) {
                this.popup_content_body.height("auto");
            }
        } if (this.popup.width() > $(window).width()) {
            this.popup.width($(window).width());
        } if (this.popup.height() > $(window).height()) {
            var h = this.getContentHeight($(window).height());
            this.popup.height($(window).height());
            this.popup_content_body.height(h);
        }
        this.rePosition();
        $(window).bind("resize", this, this.rePosition);
        if (this.IsIE6) {
            $(window).bind("scroll", this, this.onScroll);
        }
    };

    ExfJsPopup.prototype.onScroll = function(e) {
        if (e.data._ismax) {
            $this.popup.stop();
            var scroll = $this.getScroll();
            $this.popup.animate({ left: scroll.left, top: scroll.top }, 300);
        } else {
            e.data.rePosition(e);
        }
    };

    ExfJsPopup.prototype.onHide = function(e) {
        var $this = e == null ? this : e.data;
        if ($this.isopen == false) { return; }
        $this.body.hide();
        $this._ismax = false;
        $this.isopen = false;
        if ($this.IsIE6) {
            $(window).unbind("scroll", $this.onScroll);
        }
        $this.body.remove();
    };

    ExfJsPopup.prototype.onClose = function(e) {
        var $this = e == null ? this : e.data;
        if ($.isFunction($this.callcancel)) {
            if ($this.iFrame != null) {
                $this.callcancel($this.iFrame, $this.iFrame.get(0).contentWindow, $this.config.data);
            } else {
                $this.callcancel($this.config.data);
            }
        }
        $this.onHide();
    };

    ExfJsPopup.prototype.onEnter = function(e) {
        var $this = e == null ? this : e.data;
        if ($.isFunction($this.callback)) {
            var isResult = true;
            var _data = null;
            if ($.isFunction($this.config.data)) {
                _data = $this.config.data();
            } else {
                _data = $this.config.data;
            } if ($this.iFrame != null) {
                isResult = $this.callback($this.iFrame, $this.iFrame.get(0).contentWindow, _data);
            } else {
                isResult = $this.callback(_data);
            } if (isResult == false) { return false; }
        }
        $this.onHide();
    };

    ExfJsPopup.prototype.close = function() { this.onHide(); };

    $.extend({ open: function(data, config, callback, callcancel) {
        if (typeof config == "string") {
            config = { title: config };
        } if (config.id == null) {
            var id = "EJPOpen";
            if (typeof data == "string") {
                if (data.substr(0, 1) == "#") {
                    id = data.substr(1, data.length);
                }
            } else {
                if ($(data).data("exfjspopupid") == null) {
                    id = new Date().getTime().toString(16);
                    $(data).data("exfjspopupid", id);
                } else {
                    id = $(data).data("exfjspopupid");
                }
            }
            config.id = "EXF-" + id;
        }

        var EJPObject = new ExfJsPopup(config, config.id);
        EJPObject.callback = callback;
        EJPObject.callcancel = callcancel;
        if ($.isFunction(EJPObject.callback)) {
            EJPObject.config.isbuttons = true;
        } if (typeof data == "string" && data.substr(0, 1) != "#") {
            EJPObject.popup_content_body.html(data);
        } else {
            var temp = $(data).clone().show();
            EJPObject.popup_content_body.append(temp);
        }
        EJPObject.body.show();
        EJPObject.setConfig();
        EJPObject.reSize();

        if ($.isFunction(EJPObject.config.onload)) {
            EJPObject.config.onload();
        }
    }, msgbox: function(msg, msgtype, callback, callcancel, ismask) {
        if ($.isFunction(msgtype)) {
            msgtype = 1;
            if ($.isFunction(callback)) {
                callcancel = callback;
            }
            callback = msgtype;
        }
        if (typeof msgtype != "number") {
            msgtype = 1;
        }
        var config = { title: msgtype == 2 ? "\u8b66\u544a" : "\u63d0\u793a", width: 300, isbuttons: true, ismax: false, isresize: false, ismask: ismask == true, text: { cText: msgtype == 3 ? "\u5426" : "\u53d6 \u6d88", eText: msgtype == 3 ? "\u662f" : "\u786e \u5b9a"} };
        EJPMsg = new ExfJsPopup(config, "EJPMsg");
        EJPMsg.callback = callback;
        EJPMsg.callcancel = callcancel;
        $.extend(EJPMsg.config, EJPMsg.defaultConfig);
        $.extend(EJPMsg.config, config);
        EJPMsg.setConfig();
        if (msgtype == 3) {
            EJPMsg.popup_content_buttons_close.show();
        } else {
            EJPMsg.popup_content_buttons_close.hide();
        }
        EJPMsg.popup_content_body.css("margin", "10px");
        var _table = '<table><tr><td><span class="popup-icon-' + msgtype + '"></span></td><td nowarp>' + msg + "</td></tr></table>";
        EJPMsg.popup_content_body.html(_table);
        EJPMsg.body.show();
        EJPMsg.reSize();

    }, url: function(url, config, callback) {
        if (typeof config == "string") {
            config = { title: config };
        } else {
            if (config.title == null) { config.title = url; }
        }
        if (config.id == null) {
            config.id = "EXF-" + new Date().getTime().toString(16);
        }

        var EJPUrl = new ExfJsPopup(config, config.id);
        EJPUrl.popup_header_title.children("span").html("Loading...");
        EJPUrl.popup_content_note.hide();
        EJPUrl.popup_content_buttons.hide();
        EJPUrl.popup_header_tools.hide();
        EJPUrl.popup.width(300); EJPUrl.popup.height(95);
        EJPUrl.popup_content_body.height(40);
        EJPUrl.popup_content_body.html("<div class='loading'>\u6b63\u5728\u52a0\u8f7d\uff0c\u8bf7\u7a0d\u5019...</div>");
        EJPUrl.rePosition();
        EJPUrl.body.show();

        var IFRAME = $("<iframe frameBorder='0' scrolling='auto' style='width:100%;height:0;'></iframe>").appendTo(EJPUrl.popup_content_body);
        setTimeout(function() {
            IFRAME.attr("src", url);
            IFRAME.one("load", function() {
                EJPUrl.popup_content_body.children("div").remove();
                $(this).show();
                $(this).css({ width: "100%", height: "100%" });
                if (EJPUrl.config.height == null) {
                    try {
                        var frame = $(this).get().reverse()[0];
                        var height = 0;
                        if ($.browser.msie) {
                            height = $(frame.Document).height();
                        } else {
                            height = $(frame.contentDocument).height();
                        }
                        EJPUrl.popup_content_body.height(height);
                    } catch (e) {
                        EJPUrl.popup_content_body.height(EJPUrl.getContentHeight($(window).height()));
                    }
                }
                $.extend(EJPUrl.config, EJPUrl.defaultConfig);
                if ($.isFunction(callback)) {
                    config.isbuttons = true;
                    EJPUrl.callback = callback;
                }
                $.extend(EJPUrl.config, config);
                EJPUrl.setConfig();
                EJPUrl.reSize(EJPUrl.config.height == null);
                EJPUrl.iFrame = IFRAME;
                if ($.isFunction(EJPUrl.config.onload)) {
                    EJPUrl.config.onload(IFRAME, IFRAME.get(0).contentWindow);
                }
            });
        }, 500);
    }
    });
    $(document).keyup(function(event) { if (event.keyCode == 27) { if ($(".popup-body")) { $(".popup-body").remove(); } } });
})(jQuery);
function closeDialog() {
    if ($(".popup-body")) { $(".popup-body").remove();window.location.reload(); }
}