﻿



function RunOnLoadFun() 
{

    if (typeof (SayMessage) != "undefined") 
    {
        SayMessage();
    }

    if (typeof (CB_Init) != "undefined") 
    {       
        CB_Init();
    }

}





function GetByID(o) 
{

    return document.getElementById(o);

}


function HoverItem(n, t, h) 
{
    if (h == 1) 
    {
        for (var i = 0; i < t; i++) 
        {
            if (n == 0) 
            {
                GetByID('MenuItem_' + i).className = 'HeadMenuHomeStyle';
            }
            else 
            {
                GetByID('MenuItem_' + i).className = 'HeadMenuItemStyle';
            }

            if (GetByID('MenuSubItem_' + i) != null) 
            {

                GetByID('MenuSubItem_' + i).style.display = 'none';
            }

        }

        if (n == 0) 
        {
            GetByID('MenuItem_' + n).className = 'HeadMenuHomeHover';
        }
        else 
        {
            GetByID('MenuItem_' + n).className = 'HeadMenuItemHover';
        }

        if (GetByID('MenuSubItem_' + n) != null) 
        {
            GetByID('MenuSubItem_' + n).style.display = 'block';
        }
        
    }
    else 
    {    
    
        for (var i = 0; i < t; i++) 
        {
            GetByID('MenuItem_' + i).className = 'HeadMenuItemStyle';
            
            if (GetByID('MenuSubItem_' + i) != null) 
            {
                GetByID('MenuSubItem_' + i).style.display = 'none';
            }

        }

        GetByID('MenuItem_' + n).className = 'HeadMenuItemHover';
        
        if (GetByID('MenuSubItem_' + n) != null) 
        {
            GetByID('MenuSubItem_' + n).style.display = 'block';
        }
   
    }
    
} 



function OpenNew(sWinName,intWidth,intHeight,sUrl) 
{ 
	var winWidth=intWidth;  
	var winHeight=intHeight; 
	var theWin=sWinName; 
	var intTop = ((screen.Height-winHeight)/2); 
	var intLeft = ((screen.Width-winWidth)/2);
	if (sUrl != null) 
	{
	    if (winWidth == 0 & winHeight == 0) 
	    {
	        theWin = window.open(sUrl, theWin);
	        theWin.focus();
	    }
	    else 
	    {
	        theWin = window.open(sUrl, theWin, 'scrollbars=1,top=' + intTop + ',left=' + intLeft + ',width=' + winWidth + ',height=' + winHeight);
	        theWin.focus();
	    }
	}
}



function OpenCart(sWinName, intWidth, intHeight, sUrl)
{
    var winWidth = intWidth;
    var winHeight = intHeight;
    var theWin = sWinName;
    var intTop = ((screen.Height - winHeight) / 2);
    var intLeft = ((screen.Width - winWidth) / 2);
    if (sUrl != null) 
    {       

        if (document.getElementById('_ProdCartColor') != null)
        {
            sUrl = sUrl + "&Color=" + document.getElementById('_ProdCartColor').value;
        }

        if (document.getElementById('_ProdCartSize') != null) 
        {
            sUrl = sUrl + "&Size=" + document.getElementById('_ProdCartSize').value;
        }

        if (document.getElementById('_ProdCartQuantity') != null) 
        {
            sUrl = sUrl + "&Quantity=" + document.getElementById('_ProdCartQuantity').value;
        }
    
        if (winWidth == 0 & winHeight == 0) 
		{
            theWin = window.open(sUrl, theWin);
            theWin.focus();
        }
        else 
		{
            theWin = window.open(sUrl, theWin, 'scrollbars=1,top=' + intTop + ',left=' + intLeft + ',width=' + winWidth + ',height=' + winHeight);
            theWin.focus();
        }
    }
}


function PartWrapperToggle(elementName) 
{
    var HeaderElement = null;
    var BodyElement = null;
    if (document.getElementById) 
    {
        HeaderElement = document.getElementById((elementName + 'Header'));
        BodyElement = document.getElementById((elementName + 'Body'));
        UpImage = document.getElementById((elementName + 'Up'));
        DownImage = document.getElementById((elementName + 'Down'));
        if (BodyElement != null) 
        {
            if (BodyElement.style.display == 'block') 
            {
                BodyElement.style.display = 'none';
                HeaderElement.className = 'GroupHeaderClosed';
                if (DownImage) 
                {
                    DownImage.style.display = 'block';
                }
                if (UpImage) 
                {
                    UpImage.style.display = 'none';
                }
            }
            else 
            {
                BodyElement.style.display = 'block';
                HeaderElement.className = 'GroupHeaderExpand';
                if (DownImage) 
				{
                    DownImage.style.display = 'none';
                }
				
                if (UpImage) 
				{
                    UpImage.style.display = 'block';
                }
            }
        }
    }
    window.event.cancelBubble = true;
    return false;
}


function ChangCssName(OID, CssName) 
{
    document.getElementById(OID).className = CssName;
}





function SetNewsTab(name, cursel, total) 
{
    for (i = 1; i <= total; i++) 
	{
        var cap = document.getElementById("cap_" + name + "_" + i);
        var con = document.getElementById("con_" + name + "_" + i);
      //cap.className = i == cursel ? "hover" : "";
        cap.style.display = i == cursel ? "none" : "block";
        con.style.display = i == cursel ? "block" : "none";
    }
}




function SetTabErXiao(name, cursel, n)
{
     for (i = 1; i <= n; i++)
     {
          var menu=document.getElementById("cap_"+name+"_"+i);
          var cont=document.getElementById("con_"+name+"_"+i);
          menu.className=i==cursel?"hover":"";
          cont.style.display=i==cursel?"block":"none";
     }
}
