﻿window.onload = function()
{
    if (window.document.getElementById("TdSysNavButton1") != null)
   {
        ShowSysNav(1);
        window.document.getElementById("TdSysNavButton1").className="TdSysNavButtonShow"; 
   } 
}

// 切换菜单
var FunNum = 0; 
var SetTick = 20;
function ShowSysNav(ListNum)
{
    var iState = 0;
    var i = 1;
    for (i = 1; i<8; i++)
    {
        if (i == ListNum)
        {
            window.document.getElementById("TdSysNavColor"+i).style.backgroundPosition = "bottom";
            if (window.document.getElementById("TdSysNavButton"+i).style.display == "none")
            {
                window.document.getElementById("TdSysNavButton"+i).style.display = "block";
                window.document.getElementById("TdSysNavButton"+i).style.width = "10px"; 
            }
            else
            {
                var objWidth = window.document.getElementById("TdSysNavButton"+i).offsetWidth;
                if (objWidth < 190)
                {
                    objWidth = objWidth+SetTick;
                    window.document.getElementById("TdSysNavButton"+i).style.width =  objWidth+"px";
                }
                else
                {
                    window.document.getElementById("TdSysNavButton"+i).style.width = "199px";
                    window.document.getElementById("TdSysNavButton"+i).className="TdSysNavButtonShow";                        
                    iState = iState+1;
                }
            }
        }
        if (window.document.getElementById("TdSysNavButton"+i) != null && i != ListNum)
        {
            window.document.getElementById("TdSysNavColor"+i).style.backgroundPosition = "top";
            if  (window.document.getElementById("TdSysNavButton"+i).style.display != "none")
            {
                window.document.getElementById("TdSysNavButton"+i).className="TdSysNavButtonHover";
                var objWidth = window.document.getElementById("TdSysNavButton"+i).offsetWidth;
                if (objWidth < SetTick)
                {
                    window.document.getElementById("TdSysNavButton"+i).style.display = "none";
                    iState = iState+1;    
                }
                else
                {        
                    objWidth = objWidth-SetTick;
                    window.document.getElementById("TdSysNavButton"+i).style.width =  objWidth + "px";
                }
            }
            else
            {
                iState = iState+1;
            }
        }
        if(window.document.getElementById("TdSysNavButton"+i) == null)
        {
                iState = iState+1;            
        }
    }
    if (iState != 7)
    {
        FunNum = self.setTimeout(function(){ShowSysNav(ListNum);}, 10);
    }
}


function PageGoTo(Url) {
    ShowLoading();
    location.href = Url;
}
function ShowLoading()
{
    var Loading = window.document.getElementById("DivLoading");
    Loading.style.display = "block";
    Loading.style.top = GetScrollY()+300+"px";
    Loading.style.left = (GetScrollX()/2-100)+"px";
}
function HiddenLoading()
{
    var Loading = window.document.getElementById("DivLoading");
    Loading.style.display = "none";
}