    $(document).ready(function () {
        //动态写入 弹出层
        $('body').append("<div id='floatingLayer' class='pop_layer'></div><div id='maskLayer' class='pop_mask_layer' style='opacity:0.35; filter:alpha(opacity=35);'><iframe style='width:100%; height:100%; z-index:1; filter:mask();'></iframe></div>");
        
        if (jQuery.browser.msie && jQuery.browser.version === "6.0") {
            $(window).scroll(CaiDianDialogScroll);
            $("#floatingLayer").css("position", "absolute");
        }
        else {
            $("#floatingLayer").css("position", "fixed");
        }
    });

    function CaiDianDialogScroll() {
        $("#floatingLayer").css("top", ($(window).height() - $("#floatingLayer").height()) / 2 + parseInt(GetScrollTop() || 0));
        //document.getElementById("divCaiDianDialog").style.marginLeft = document.body.scrollLeft;
    }

    function closePopupNow() {

        $("#maskLayer").hide();
        $("#floatingLayer").hide();

    }

    function closePopup() {
        disablePopup(800, null);
    }

    //使用Jquery去除弹窗效果
    function disablePopup(fadeOut, callback) {

        $("#maskLayer").fadeOut(fadeOut);
        $("#floatingLayer").fadeOut(fadeOut, callback);

    }

    function dialog(res, obj) {

        //dialog-valid √, dialog-error ⅹ, dialog-warning !, dialog-loading …
        for (var i = 0; i < obj.length; i++) {
            var item = {
                val: obj[i].val || "",
                className: obj[i].className || "x",
                title: obj[i].title || "",
                text: obj[i].text || "",
                //hideHead: obj[i].hideHead || false,
                isPanel: obj[i].isPanel || false,
                isMaskLayerHide: obj[i].isMaskLayerHide || false,
                //hideConfirm: obj[i].hideConfirm || null,
                //hideClose: obj[i].hideClose || false,
                setTimeout: obj[i].setTimeout || 1500,
                fadeOut: obj[i].fadeOut || 800,
                returnVal: obj[i].returnVal || false,
                callback: obj[i].callback || null,
                width: obj[i].width || 300,
                top: obj[i].top || 0,
                left: obj[i].left || 0
            };

            if (res == item.val) {

                $("#floatingLayer").html("");

                if (item.isPanel) {

                    $("#floatingLayer").html(item.text);

                } else {

                    if (item.className == "l") {

                        var strAlert="    <div class=\"page_loading\">  \r\n";
                        strAlert += "        <img src=\"" + loadingImage + "\" alt=\"loading_long\" width=\"220\" height=\"19\" />  \r\n";
                        strAlert += "    </div>  \r\n";

                        $("#floatingLayer").html(strAlert);

                        item.width = 220;
                        item.fadeOut = -1;
                    }
                    else {

                        var imgClass = "pop_message_error";

                        switch (item.className) {
                            case "x":
                                imgClass = "pop_message_error";
                                break;
                            case "v":
                                imgClass = "pop_message_ok";
                                break;
                        }

                        var strAlert = "    <div class='pop_sml'>  \r\n";
                        strAlert += "        <div class='" + imgClass + "'>  \r\n";
                        strAlert += "            <strong class=\"title\">" + item.title + "</strong>  \r\n";
                        strAlert += "  \r\n";
                        strAlert += "            <div class=\"content\">  \r\n";
                        strAlert += "    " + item.text + "  \r\n";
                        strAlert += "            </div>  \r\n";
                        strAlert += "        </div>  \r\n";
                        strAlert += "  \r\n";
                        strAlert += "        <div class='pop_handle'>  \r\n";
                        strAlert += "            <a href=\"javascript:void(0);\" class=\"btn_sml\">确认</a>  \r\n";
                        strAlert += "  \r\n";
                        strAlert += "            <div class=\"clear\"></div>  \r\n";
                        strAlert += "        </div>  \r\n";
                        strAlert += "    </div>  \r\n";

                        $("#floatingLayer").html(strAlert);

                        $("#floatingLayer .btn_sml").click(function () {
                            disablePopup(item.fadeOut, item.callback);
                        });
                    }
                }

                //$("#floatingLayer").css("width", item.width);

                if (item.fadeOut != -1) {
                    window.setTimeout(function () {
                        disablePopup(item.fadeOut, item.callback);
                    }, item.setTimeout);
                }


                if (!item.isMaskLayerHide) {

                    $("#maskLayer").css({ display: "block", height: $(document).height() });
                }
                else {

                    $("#maskLayer").hide();
                }

                if (jQuery.browser.msie && jQuery.browser.version === "6.0") {
                    $("#floatingLayer").css({ top: ($(window).height() - $("#floatingLayer").height()) / 2 + parseInt(GetScrollTop() || 0), left: ($(window).width() - $("#floatingLayer").width()) / 2 + parseInt(document.documentElement.scrollLeft || 0) });
                }
                else {
                    $("#floatingLayer").css({ top: ($(window).height() - $("#floatingLayer").height()) / 2, left: ($(window).width() - $("#floatingLayer").width()) / 2 + parseInt(document.documentElement.scrollLeft || 0) });
                }

                if (item.left != 0) {

                    var left = parseInt($("#floatingLayer").css("left"));
                    left += item.left;

                    $("#floatingLayer").css("left", left + "px");
                }

                if (item.top != 0) {

                    var top = parseInt($("#floatingLayer").css("top"));
                    top += item.top;

                    $("#floatingLayer").css("top", top + "px");
                }

                $("#floatingLayer").show();

//                if (item.top != -1) {
//                    $("#floatingLayer").css("top", item.top);
//                } 

                return item.returnVal;
            }
        }
    }


    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));

    function IeTrueBody() {
        return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;
    }

    function GetScrollTop() {
        return ie ? IeTrueBody().scrollTop : window.pageYOffset;
    }

    function GetScrollLeft() {
        return ie ? IeTrueBody().scrollLeft : window.pageXOffset;
    }


