﻿

function wait(m) {
    var w1 = document.documentElement.scrollWidth;
    var h1 = document.documentElement.scrollHeight;
    var w = document.documentElement.clientWidth;
    var h = document.documentElement.clientHeight;
    document.getElementById("div_Wait").style.width = w1;
    document.getElementById("div_Wait").style.height = h1;


    var img = new Image();
    img.src = m
    //var mw = img.width;
    //var mh = img.height;
    var mw = 800;
    var mh = 600;

    //alert(mw + "/" + mh);
    
    if (mw > mh) {
        var cw = Math.ceil(mw / 600);
        var ch = Math.ceil(mh / 450);
        var cc = mw / mh;

        if (cw > 1) {
            while (mw > 600) {
                mh = mh - 1;
                mw = mw - cc;
            }
        }

        document.getElementById("div_Imgx").className = "div_Imgx";
    }
    else if (mw == mh) {
        var cw = Math.ceil(mw / 450);
        var ch = Math.ceil(mh / 450);

        if (cw > 1) {
            while (mw > 450) {
                mh = mh - 1;
                mw = mw - 1;
            }
        }

        document.getElementById("div_Imgx").className = "div_Imgxxx";
    }
    else {
        var cw = Math.ceil(mw / 450);
        var ch = Math.ceil(mh / 600);
        var cc = mh / mw;

        if (ch > 1) {
            while (mh > 600) {
                mw = mw - 1;
                mh = mh - cc;
            }
        }

        document.getElementById("div_Imgx").className = "div_Imgxx";
    }

    var hh = getScrollTop();

    if (mw > mh) {
        var aw = Math.ceil((w - 600) / 2);
        var ah = Math.ceil((h - 450) / 2) + hh;

        document.getElementById("imgDiv").style.marginTop = Math.ceil((450 - mh) / 2) + "px";
    }
    else if (mw == mh) {
        var aw = Math.ceil((w - 450) / 2);
        var ah = Math.ceil((h - 450) / 2) + hh;

        document.getElementById("imgDiv").style.marginTop = Math.ceil((450 - mh) / 2) + "px";
    }
    else {
        var aw = Math.ceil((w - 450) / 2);
        var ah = Math.ceil((h - 600) / 2) + hh;

        document.getElementById("imgDiv").style.marginTop = Math.ceil((600 - mh) / 2) + "px";
    }

    //alert(mw + "/" + mh);
    
    document.getElementById("imgDiv").style.width = Math.ceil(mw) + "px";
    document.getElementById("imgDiv").style.height = Math.ceil(mh) + "px";
    document.getElementById("div_Img").style.left = aw + "px";
    document.getElementById("div_Img").style.top = ah + "px";


    document.getElementById("imgDiv").src = m;
    document.getElementById("div_Wait").style.display = "block";
    document.getElementById("div_Img").style.display = "block";
}

function waitEnd() {
    document.getElementById("div_Wait").style.width = 0;
    document.getElementById("div_Wait").style.height = 0;
    document.getElementById("imgDiv").src = "";
    document.getElementById("div_Wait").style.display = "none";
    document.getElementById("div_Img").style.display = "none";
}

function getScrollTop() {
    var scrollTop = 0;
    if (document.documentElement && document.documentElement.scrollTop) {
        scrollTop = document.documentElement.scrollTop;
    }
    else if (document.body) {
        scrollTop = document.body.scrollTop;
    }
    return scrollTop;
}



function show11() {
    document.getElementById("rightBottom1").style.display = "block";
    document.getElementById("rightBottom2").style.display = "block";
    document.getElementById("rightBottom1x").style.display = "none";
    document.getElementById("rightBottom2x").style.display = "none";
}
function show22() {
    document.getElementById("rightBottom1").style.display = "none";
    document.getElementById("rightBottom2").style.display = "none";
    document.getElementById("rightBottom1x").style.display = "block";
    document.getElementById("rightBottom2x").style.display = "block";
}

function showNum() { }

/*循环播放4张图片*/
var temp = 1;
function showMe() {
    for (var j = 1; j < 5; j++) {
        if (j == temp) {
            document.getElementById("adv" + j).style.display = "block";
            document.getElementById("num" + j).className = "div2";
        }
        else {
            document.getElementById("adv" + j).style.display = "none";
            document.getElementById("num" + j).className = "div1";
        }
    }
    temp++;
    if (temp > 4) {
        temp = 1;
    }
    setTimeout("showMe()", 5000);
}
function showMeOn(num) {
    for (var j = 1; j < 5; j++) {
        if (j == num) {
            document.getElementById("adv" + j).style.display = "block";
            document.getElementById("num" + j).className = "div2";
        }
        else {
            document.getElementById("adv" + j).style.display = "none";
            document.getElementById("num" + j).className = "div1";
        }
    }
    temp = num + 1;
    if (temp > 4) {
        temp = 1;
    }
}


function pageGo() {
    var url = location.href;
    var paraString = url.substring(url.indexOf("?") + 1, url.length);
    var page = paraString.substring(paraString.indexOf("=") + 1, paraString.length);
    var news = page.substring(0, 4);
    if (page == 'add') {
        window.location.href='RechargeCenter/RechargeCenterPage.aspx';
    }
    else if (page == 'user') {
        window.location.href='UserCenter/UserCenterPage.aspx';
    }
    else if (page == 'pwd') {
        window.location.href='UserCenter/RetrievePasswordPage.aspx';
    }
    else if (page == 'help') {
        window.location.href='CustomerService/CustomerServicePage.aspx';
    }
    else if (page == '40') {
        window.location.href='Help/HelpInfoPage.aspx?gid=40';
    }
    else if (page == '41') {
        window.location.href='Help/HelpInfoPage.aspx?gid=41';
    }
    else if (page == '402') {
        window.location.href='Help/HelpInfoPage.aspx?gid=402';
    }
    else if (page == '47') {
        window.location.href='Help/HelpInfoPage.aspx?gid=47';
    }
    else if (page == '102') {
        window.location.href='Help/HelpInfoPage.aspx?gid=102';
    }
    else if (page == '100') {
        window.location.href='Help/HelpInfoPage.aspx?gid=100';
    }
    else if (page == '46') {
        window.location.href='Help/HelpInfoPage.aspx?gid=46';
    }
    else if (page == '311') {
        window.location.href='Help/HelpInfoPage.aspx?gid=311';
    }
    else if (page == 'qq') {
        window.location.href = "tencent://message/?uin=1215196559&Site=󸻺Ϸ&Menu=yes";
    }
    else if (news == 'news') {
        var id = page.substring(4);
        window.location.href='News/NewsInfoPage.aspx?uid=' + id;
    }
}


