/*
    Document   : jquery.gim.pagemask
    Created on : 2010-2-10, 9:38:27
    Author     : lib
    Description: pagemask
*/
(function($) {
    $.extend($.fn, {
        showMask: function(noclose) {
            var msgobj = this;
            if (this.length == 0) {
                //传入对象为空或为字符串
                msgobj = $("<span>").text(this.selector);
            }
            $.removeMask();
            bodywidth = $("body").width();
            bodyheight = Math.max($(document).height() - 30, $("body").height());
            closestr = !noclose ? "<div class='c'><a class='mask_content_close' href='#?' style='position:absolute;top:5px;right:5px;' onclick='$.removeMask();'><img src=/image/tb_delete.gif border=0 /></a>" : "";
            $("<iframe id=mask_iframe scrolling=no frameborder=0/>").width(bodywidth + "px").height(20 + bodyheight + "px").appendTo("body");
            $("<div></div>").attr("id", "mask").width(bodywidth + "px").height(20 + bodyheight + "px").appendTo("body");
            $("<div></div>").attr("id", "mask_content").html(closestr).prepend(msgobj.show()).appendTo("body")
        .css("left", (bodywidth - msgobj.width()) / 2 + "px").width(msgobj.width() + 10 + "px")
        .css("top", (window.screen.height - msgobj.height() - 150) / 2 + document.body.scrollTop + document.documentElement.scrollTop + "px");
        }
    });
    $.removeMask = function() {
        $("#mask_content").children().hide().appendTo($("#mask_content").parent());
        $("#mask,#mask_iframe,#mask_content").remove();
    };
})(jQuery);



