var Notice =
{
    pop_state : false,
    notice_state : false,
    notice_reload : false,
    showLoad : false,
    myAjax : $,
    loadPop : function(url)
    {
        Notice.myAjax.get(url,function(data)
        {
            $("#pop_notice").html(data);
            $("#alpha").show();
            $("#alpha_tm").show();
            $("#pop_notice").hide();
            $("#notice_type").hide();
            Notice.pop_state = true;
            document.documentElement.style.overflow = 'hidden';
            document.body.style.overflow = "hidden";
        });
    },
    closePop: function(reload)
    {
        $("#alpha").hide();
        $("#alpha_tm").hide();
        $("#pop_notice").hide();
        $("#notice_type").hide();
        document.documentElement.style.overflow = 'auto';
        //document.body.style.overflow = "auto";
        Notice.pop_state = false;
        if(reload)
        {
            window.location.replace(window.location.href);
        }
    },
    closeNotice : function()
    {
        $("#pop_notice").hide();
        $("#notice_type").hide();
        if(Notice.notice_reload) window.location.replace(window.location.href);
        else if(Notice.showLoad) $("#pop_notice").show();
        else
        {
            document.documentElement.style.overflow = 'auto';
            document.body.style.overflow = "auto";
            //document.body.style.overflowY = "auto "
            //document.documentElement.style.overflowY = 'auto';
            document.documentElement.scrollTop ? document.documentElement.scrollTop = _sTop: document.body.scrollTop = _sTop;
            $("#alpha").hide();
        }
        Notice.notice_state = false;
        Notice.showLoad = false;
    },
    showNotice : function(notice,state,showload,reload)
    {
        var pop_notice = document.getElementById('pop_notice');
        $("#alpha").height((document.documentElement.clientHeight || document.body.clientHeight) + (document.documentElement.scrollTop || document.body.scrollTop) + 50 + 'px');
        $("#alpha").width((document.documentElement.clientWidth || document.body.clientWeight) + (document.documentElement.scrollLeft || document.body.scrollLeft) + 300 + 'px');
        $("#alpha").show();
        document.documentElement.style.overflow = 'hidden';
        document.body.style.overflow = "hidden";
        if(state)
        {
            document.getElementById('notice_type').className = state;
            if(state == 'popGet' || state == 'popBand') 
            {
                var p_button = true; 
            }
        }
        else
        {
            document.getElementById('notice_type').className = 'popErr';  
        }
        if(p_button)
        {
            $("#notice_type").html(notice);
        }
        else
        {
            $("#notice_type").html('<span></span><h3>'+notice+'</h3><p><a class="popBtn1" onclick="Notice.closeNotice();return false;" href="javascript:void(0)" title="点击返回">点击返回</a></p>');  
        }
        $("#pop_notice").show();
        $("#notice_type").show();
        var h1 = document.body.clientHeight, h2=document.documentElement.clientHeight;
        var clientH = (h1>h2 && h2>0) ? h2 : h1;
        var w1 = document.body.clientWidth, w2=document.documentElement.clientWidth;
        var clientW = (w1>w2 && w2>0) ? w2 : w1;
        _sTop = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
        var sLeft = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft;
        var t = (clientH - pop_notice.offsetHeight)/2 + _sTop;
        pop_notice.style.top  = t > 0 ? (t+'px') : '0';
        $("#alpha_tm").height($("#pop_notice").height());
        $("#alpha_tm").width($("#pop_notice").width());
        $("#alpha_tm").show();
        Notice.notice_state = true;
        Notice.showLoad = !!showload;
        Notice.notice_reload = (reload === true);
    }
};
