﻿// JScript 文件


function getWebRoot()
{
    var src = window.location.href;
    var index = src.lastIndexOf( "/");
    var root = src.substring( 0, index + 1 );
    return root;
};


var menu_url = [ "Default.aspx", "Products.aspx", "Company.aspx", "Support.aspx", "Downloads.aspx", "Customers.aspx", "About.aspx" ];

function activeMenu( ctrl, index, enable )
{
    var root = getWebRoot();
    
    var path = root + menu_url[index];
    
    location.href = path;
    
    if( enable )
        ctrl.className = "menu_active";
    else
        ctrl.className = "menu_normal";
}

function overMenu( ctrl, index )
{
    ctrl.style.cursor = "hand";
}

function setActiveMenu( index )
{
    var menu = document.getElementById( "menu" );
    for( var i=0; i<menu_url.length; i++ )
    {
        menu.cells[i].background = "#3f5fa0";
    }
    
    menu.cells[index] = "#f58000"
}

function viewProducts( catagoryID )
{
    location.href= "Products.aspx?CatagoryID=" + catagoryID;
}

function viewProductDetail( id )
{
    location.href = 'ProductDetail.aspx?ProductID=' + id;
}

function viewNewsList()
{
    location.href = "NewsList.aspx";
}

function viewNews( id )
{
    location.href= "NewsContent.aspx?NewsID=" + id;
}

function showReplyBox( showHide )
{
    var div = document.getElementById( "LayerReply" );
    if( null == div )
        return;
        
        
    if( div.style.display == "block" )
        div.style.display = "none";
    else
        div.style.display = "block";        
}

function goBack()
{
    window.history.back();
}
