/** menuswap.js
 * --------------------------------------------------
 *  说明：
 *      移动交换式菜单处理，需配合样式定义使用。
 *
 *  构造参数：
 *      @beg: 首先显示的菜单项 ID
 *      @currName: 当前项的样式 class 名
 *      @linkName: 其它项的样式 class 名
 *      @_curr: 当前显示项
 *      @_subItem: 当前显示子项
 *
 *  @Tubz. 2009.3.23.
 * --------------------------------------------------
 */

function MenuSwap(currName, linkName, hideMenu)
{
    this._currName = currName;
    this._linkName = linkName;
    this._hideName = hideMenu;
    this._curr = null;
}

// MenuSwap.timer = null;

MenuSwap.prototype.show = function(node)
{
    if (!this._curr) this._curr = node;

    this._curr.className = this._linkName;
    node.className = this._currName;
    this._curr = node;
}

MenuSwap.prototype.hide = function(node)
{
    this._curr.className = this._hideName;
}

MenuSwap.prototype.first = function(id)
{
    var e = document.getElementById(id);
    this.show(e);
}


/*
 * 其它工具函数打包。
 */
function ShowTabs(ID)
{
    for (i = 0; i < 4; i++) {
        if (i == ID) {
            document.getElementById("TabTitle" + i).className = "titlemouseover";
            document.getElementById("Tab" + i).style.display = "";
        }
        else {
            document.getElementById("TabTitle" + i).className = "tabtitle";
            document.getElementById("Tab" + i).style.display = "none";
        }
    }
}
var curID = '1';
var curIDsub = '1';
function ShowTabs2(id)
{
    if (id != curID) {
        var old1 = document.getElementById('TabTitle' + curID);
        var new1 = document.getElementById('TabTitle' + id);
        old1.className = "main_menu_title1"
        new1.className = "main_menu_title2";
        curID = id;

        var old2 = document.getElementById('Tabs' + curIDsub);
        var new2 = document.getElementById('Tabs' + id);
        old2.style.display = "none";
        new2.style.display = "";
        curIDsub = id;
    }
}
