﻿///////////////////////////////////////////////////////////////////////////////////
// 文件名 ：    xwin.js
//
// 定义对象xTabPage等
//
// 版  本 ：    1.0
//
// 编写者 ：    zxh
//
// 日  期 ：    2004/4/21
//
// 运行环境：   IE5.5 以上  ??offsetHeight
//
///////////////////////////////////////////////////////////////////////////////////


///////////////////////////////////////////////////////////////////////////////////
//
// 功  能 ：创建一个“标签页控件”，该控件由一个“面板”和多个“页面”
//          以及对应的“页签”组成，每个“页面”中又包含一组“录入框”。
//          点击某个“页签”，就会显示相应的“页面”，
//          也可以使用 Alt + 数字 组合键快速切换页面。
//
///////////////////////////////////////////////////////////////////////////////////

var EDIT_CLASSNAME    = "edit";           // 录入框的 className
var LABE_CLASSLNAME   = "label";          // 录入框标题的 className
var COL_LABEL_NORMAL  = "#000000";        // 普通项标题
var COL_LABEL_MUST    = "dodgerblue";     // 必录项标题

var tab_iArrowWidth   = 14;               // 箭头图片的宽度
var tab_iArrowHeight  = 14;               // 箭头图片的宽度
var tab_iTabWidth     = 250;               // 标签按钮的宽度
var tab_iLineWidth    = 67;               // “面板”右上端的边框线的长度


///////////////////////////////////////////////////////////////////////////////////
// 创建一个“标签页控件”的“面板”
//
// el : HTMLElement     创建“面板”的 HTML 元素
//
function tch_TabPane(el) {
    //if (!hasSupport() || el == null) return;

    this.element = el;
    this.element.tabPane = this;
    this.pages = [];
    this.selectedIndex = el.selectedIndex ? el.selectedIndex :
        (el.selectedindex ? el.selectedindex : 0);

    this.onselect = null;       // 选择事件

    this.init();
}

tch_TabPane.prototype = {

    //+------------------------------------
    // Public 属性和方法
    //-------------------------------------

    element: null,              // 创建“面板”的 HTML 元素
    pages: [],                  // 标签页控件包含的“页面”数组
    selectedIndex: 0,           // 选中的“页面”的索引
    indexFocus: -1,             // 焦点索引

    // 选中指定的“页面”
    setSelectedIndex: function (n) {
        if (this.selectedIndex != n) {
            if (this.selectedIndex != null && this.pages[this.selectedIndex] != null)
                this.pages[this.selectedIndex].hide();

            var oldIndex = this.selectedIndex;
            this.selectedIndex = n;

            var oThis = this;
            if (this.onselect){
                eval("oThis.onselect()");
            }

            this.pages[this.selectedIndex].show();
            this.indexFocus = -1;

            return oldIndex;
        }
    },

    // 获得选中的“页面”索引
    getSelectedIndex: function () {
        return this.selectedIndex;
    },

    //获取某“页面”的索引值    
    getPageIndex: function(oElement){
    	for(var i=0;i<this.pages.length;i++){
    	   if(this.pages[i] == oElement.tabPage)
    	     return i;
        }	
    },
    	
    // 为“标签页控件”增加一个“页面”和“页签”
    addTabPage: function (oElement) {
    	//alert(oElement.id);
    	///alert(this.element.childNodes[3].id);
        if (oElement.tabPage == this)   // 已加入
        {

           return oElement.tabPage;
            
        }
        

        if (oElement.style.display!="none"){//tab-page页签中，display=none者不显示
        	
        var n = this.pages.length;
        
        var tp = this.pages[n] = new tch_TabPage(oElement, this, n);
        tp.tabPane = this;

        // 设置该“页面”对应的“页签”
        
        this.tabBtnLayer.appendChild(tp.tab);

        if (n == this.selectedIndex)
            tp.show();
        else
            tp.hide();
            
        }//end if display!="none"
        return tp;
    },

    removeTabPage: function (oElement) {
      
    },

    //+------------------------------------
    // Private 属性和方法
    //-------------------------------------

    classNameTag:   "tchsoft-tab-page", // className 前缀
    tabCortrol: null,                   // 控制层
    tabBtnLayer: null,                  // 按钮层
    tabBtnScroll: null,                 // 按钮卷动控制层
    tabScrollBar: null,                 // 滚动栏

    _iTimer: null,                      // 定时器 Id
    _scrollSpeed: 5,                    // 页签按钮层卷动的速度


    // 初始化“面板”
    init: function () {
        var tabPages = [];      // 临时保存子节点
        var nMaxHeight = 0;     // 保存最大的那个“页面”的高度
        var el = this.element;
        var cs = el.childNodes;
        
        if (el.style.display == "none")
            el.style.display = "block";

        // 设置元素的 className
        
        el.className = this.classNameTag + " " + this.element.className;
        /*
        if (g_iWidth){
          if (g_iWidth!="")
            el.style.width = g_iWidth;
        }    
        else
        */		
          el.style.width = el.offsetWidth;  
          	   
        //el.style.width = ((twidth)&&(twidth!="")) ? twidth : el.offsetWidth;  //twidth未定义
 
        // 设置“标签页控件”中的每个“页面”的高度设为一致，使它们等于最大的那个“页面”的高度
        for (var i = 0; i < cs.length; i++) {
            if (cs[i].nodeType == 1 && cs[i].className == "tab-page") {
                tabPages[tabPages.length] = cs[i];
                if (cs[i].style.display!="none") {
                  if (cs[i].scrollHeight > nMaxHeight) {  //cs[i].offsetHeight
                    nMaxHeight = cs[i].scrollHeight;    //cs[i].offsetHeight

                  }
                }     
            }
        }


        // 滚动栏      
        this.tabScrollBar = new tch_xScrollBar(640,50,nMaxHeight - 30, null);
        this.tabScrollBar.hidden();

        // 控制层，用于摆放页签按钮层和卷动控制按钮
        var tabCortrol = document.createElement("DIV");
        this.tabCortrol = tabCortrol;
        tabCortrol.className = "tab-cortrol";
        tabCortrol.style.width = el.offsetWidth; // - 40;
        el.insertBefore(tabCortrol, el.firstChild);

        // 页签按钮层
        var tabBtnLayer = document.createElement("DIV");
        this.tabBtnLayer = tabBtnLayer;
        tabBtnLayer.className = "tab-btn";
        tabBtnLayer.style.width = (tabPages.length + 1) * tab_iTabWidth;
        tabCortrol.insertBefore(tabBtnLayer, tabCortrol.firstChild);
        
        
        if (tabPages.length * tab_iTabWidth > tabCortrol.clientWidth) {
            // 如果标签按钮过多，则加入卷动控制
            
            var tabBtnScroll = document.createElement("DIV");
            this.tabBtnScroll = tabBtnScroll;
            with (tabBtnScroll.style) {
                position = "absolute";
                background = "transparent";
                top = tabCortrol.offsetHeight - tab_iArrowHeight - 5;
                top = el.style.top ? parseInt(el.style.top) + top : top;
                left = el.offsetWidth - tab_iArrowWidth * 3;
                width = tab_iArrowWidth * 2 + 8;
                height = tab_iArrowHeight;
                border = "0px";
                zIndex = 4;
            }
            el.insertBefore(tabBtnScroll, el.firstChild);

            // 左滚箭头
            var imgLeft = document.createElement("IMG");
            with (imgLeft) {
                name = "L";
                className = "tab-arrow";
                src = g_sImgPath + "tab_left.gif";
                
                border = 1;
                width = tab_iArrowWidth;
                height = tab_iArrowHeight;
            }
            tabBtnScroll.appendChild(imgLeft);

            // 右滚箭头
            var imgRight = document.createElement("IMG");
            with (imgRight) {
                name = "R";
                className = "tab-arrow";
                src = g_sImgPath + "tab_right.gif";
                border = 1;
                width = tab_iArrowWidth;
                height = tab_iArrowHeight;
            }

            tabBtnScroll.appendChild(imgRight);

            // 设置卷动控制的事件处理
            var oThis = this;

            imgLeft.onmousedown = function () { oThis.startScroll(); };
            imgLeft.onmouseup   = function () { oThis.endScroll(); };
            imgLeft.onmouseover = function ()
                { imgLeft.src = g_sImgPath + "tab_left_over.gif"; };
            imgLeft.onmouseout  = function ()
                { imgLeft.src = g_sImgPath + "tab_left.gif"; };

            imgRight.onmousedown    = function () { oThis.startScroll(); };
            imgRight.onmouseup  = function () { oThis.endScroll(); };
            imgRight.onmouseover    = function ()
                { imgRight.src = g_sImgPath + "tab_right_over.gif"; };
            imgRight.onmouseout = function ()
                { imgRight.src = g_sImgPath + "tab_right.gif"; };
        }
        else {
            tab_iLineWidth = el.offsetWidth - tabPages.length * (tab_iTabWidth - 8);
        }

        // 画一条水平线，用于补齐“面板”右上端的边框线
/*
        var line = document.createElement("DIV");
        line.className = "tab-line";

        with (line.style) {
            top = el.style.top + tabCortrol.offsetHeight - 3;
            left = el.offsetWidth - (tab_iLineWidth + 2);
            width = tab_iLineWidth;
        }

        with (line.style) {
            top = el.style.top - 3;
            left = el.offsetWidth - (tab_iLineWidth + 2);
            width = tab_iLineWidth;
        }
        el.insertBefore(line, el.firstChild);
*/
        // 加入“页面”和“页签”

        for (i = 0; i < tabPages.length; i++) {		
            tabPages[i].style.height = nMaxHeight;// + 10;
            this.addTabPage(tabPages[i]);
        }

        this.setup();
    },

    // 初始化设置
    setup: function () {
        var oThis = this;
        this.selectedIndex = this.selectedIndex > this.pages.length-1 ?
            this.pages.length-1 : (this.selectedIndex < 0 ? 0 : this.selectedIndex);

        this.setSelectedIndex(this.selectedIndex);

    },

    // 标签按钮层开始卷动
    startScroll: function () {
        tch_TabPane.oImg = event.srcElement;
        tch_TabPane.oThis = this;
        //this._iTimer = window.setInterval(tch_TabPane.doScroll, 50);
    },

    // 标签按钮层停止卷动
    endScroll: function () {
        var obj = event.srcElement;
        if (obj.name == "L")
            obj.src =  g_sImgPath + "tab_left.gif";
        else
            obj.src =  g_sImgPath + "tab_right.gif";

        window.clearInterval(this._iTimer);
        this._iTimer = null;
    },

    // 焦点上移
    movePrev: function () {
        var edits = this.pages[this.selectedIndex].edits;
        var n = this.indexFocus;
        var bSwitch;

        for (;;) {
            try {
                n--;
                if (n > -1) {
                    edits[n].focus();
                }
                else {
                    bSwitch = false;

                    if (this.selectedIndex > 0){
                        bSwitch = true;
                    }

                    if (edits[n+1].last == "true"){
                        bSwitch = false;
                    }

                    if (bSwitch) {
                        this.setSelectedIndex(parseInt(this.selectedIndex) - 1);
                    }
                    else {
                        if (g_frmPost) {
                            g_frmPost.cmdSubmit.focus();
                            g_xDic.hidden();
                        }
                    }
                }
                return;
            }
            catch (e) {}
        }
    },

    // 焦点下移
    moveNext: function () {
        var edits = this.pages[this.selectedIndex].edits;
        var n = this.indexFocus;
        var bSwitch;

        for (;;) {
            try {
                n++;
                if (n < edits.length) {
                    edits[n].focus();
                }
                else {
                    bSwitch = false;

                    if (this.selectedIndex < this.pages.length - 1){
                        bSwitch = true;
                    }

                    if (edits[n-1].last == "true"){
                        bSwitch = false;
                    }

                    if (bSwitch) {
                        this.setSelectedIndex(parseInt(this.selectedIndex) + 1);
                    }
                    else {
                        if (g_frmPost) {
                            g_frmPost.cmdSubmit.focus();
                            g_xDic.hidden();
                        }
                    }
                }
                return;
            }
            catch (e) {}
        }
    },


    // 处理录入框的键盘事件(INPUT)
    keyDown: function() {
        try {
            var src = event.srcElement;
            var keyCode = event.keyCode;
            var isDic = src.kind.toLowerCase() == "dic" ? true : false;
            window.event.cancelBubble = true;

            switch (keyCode) {
                case 33:    // PageUp
                    if (isDic)
                        g_xDic.prev();
                    break;

                case 34:    // PageDown
                    if (isDic)
                        g_xDic.next();
                    break;

                case 35:    // End
                    if (isDic)
                        g_xDic.last();
                    break;

                case 36:    // Home
                    if (isDic)
                        g_xDic.first();
                    break;

                case 38:    // Up
                    if (isDic) {
                        if (g_xDic.items > 0) {
                            if (src.value != "" && g_xDic.currentCode != "")
                                SetContent();
                        }
                        else {
                            SetContentBase('', '');
                        }
                    }
                    this.movePrev();
                    break;

                case 13:    // Enter
                case 40:    // Down
                case 108:   // Enter(小键盘上)
                    if (isDic) {
                        if (g_xDic.items > 0) {
                            if (src.value != "" && g_xDic.currentCode != "")
                                SetContent();
                        }
                        else
                            SetContentBase('', '');
                    }
                    if(src.jump=="true")
                    document.frmInput.cmdunit.click()
                    else
                    this.moveNext();
                    break;

                case 229:   // 打开了输入法
                    if (isDic){
                        //event.returnValue = false;
                    }
                    break;

                default:
                    break;
            }
            return false;
        }
        catch (e) {
            return false;
        }
    },

    // 处理录入框的键盘事件(TEXTAREA)
    ta_keyDown: function () {
        try {
            var src = event.srcElement;
            var keyCode = event.keyCode;
            window.event.cancelBubble = true;

            switch (keyCode) {
                case 27:    // Esc
                    if (parent.g_xQuery) {
                        // 查询窗口隐藏
                        parent.g_xQuery.hidden();
                    }
                    if (parent.g_xPucker) {
                        // 折叠窗口隐藏
                        parent.g_xPucker.hidden();
                    }
                    break;

                case 38:    // Up
                    if (window.event.ctrlKey || src.readOnly) {
                        this.movePrev();
                        return false;
                    }
                    break;

                case 13:    // Enter
                case 40:    // Down
                case 108:   // Enter(小键盘上)
                    if (window.event.ctrlKey || src.readOnly) {
                        this.moveNext();
                        return false;
                    }
                    break;

                default:
                    break;
            }
            return true;
        }
        catch (e) {
            return false;
        }
    },

    // 处理提交区按钮的键盘事件
    cmdKeyDown: function () {
        var obj = event.srcElement;
        var len = this.pages[this.selectedIndex].edits.length;

        switch (event.keyCode) {
            case 37:    // 左
                if (obj.name != "cmdSubmit")
                    g_frmPost.cmdSubmit.focus();
                break;

            case 38:    // 上
                if (g_layerPic) // 是否有图片层
                    g_layerPic.focus();
                else {
                    this.indexFocus = len;
                    this.movePrev();
                }
                break;

            case 39:    // 右
                if (obj.name == "cmdSubmit") {
                    if (typeof(g_frmPost.cmdReset) != "undefined")
                        g_frmPost.cmdReset.focus();
                    else if (typeof(g_frmPost.cmdCancel) != "undefined")
                        g_frmPost.cmdCancel.focus();
                }
                break;

            case 40:    // 下
                this.indexFocus = -1;
                this.moveNext();
                break;
        }
        return false;
    }
    
}


tch_TabPane.oImg = null;
tch_TabPane.oThis = null;

tch_TabPane.doScroll = function () {
    // 标签按钮层卷动
    with (tch_TabPane) {
        var tabCortrol = oThis.tabCortrol;
        var nScrollSpeed = oThis._scrollSpeed;  // 卷动速度(初始为 5，最大为 60)

        if (oImg.name == "L") {
            oImg.src = g_sImgPath + "tab_left_down.gif";
            tabCortrol.scrollLeft -= nScrollSpeed;          
        }
        else {
            oImg.src = g_sImgPath + "tab_right_down.gif";
            if (tabCortrol.scrollLeft < tabCortrol.scrollWidth - tabCortrol.offsetWidth - 40){
                tabCortrol.scrollLeft += nScrollSpeed;
               
            }
            else{
                tabCortrol.scrollLeft = tabCortrol.scrollWidth - tabCortrol.offsetWidth - 40;
            }    
        }
        oThis._scrollSpeed = nScrollSpeed > 60 ? 60 : nScrollSpeed + 1;
    }
   
}




///////////////////////////////////////////////////////////////////////////////////
// 创建一个“标签页控件”的“页面”
// 在 tch_TabPage.addTabPage 的方法调用
//
// el : HTMLElement         创建该“页面”的 HTML 元素
// tabPane : tchSoft_TabPane        该“页面”的所归属的“面板”
// nIndex : Integer         索引值
//
function tch_TabPage(el, tabPane, nIndex) {
    if (!hasSupport() || el == null) return;

    this.element = el;
    this.tabPane = tabPane;
    this.element.tabPage = this;
    this.index = nIndex;
    
    this.init();
}

tch_TabPage.prototype = {

    //+------------------------------------
    // Public 属性和方法
    //-------------------------------------

    element: null,              // 创建该“页面”的 HTML 元素
    index: null,                // 页面的索引
    edits: null,                // 页面包含的录入框
    labels: null,               // 录入框的标题

    // 设置提示信息
    setHint: function (sMsg) {
        this.hintArea.innerHTML = sMsg;
    },

    // 显示该“页面”
    show: function () {
        var el = this.tab;
        var s = el.className + " selected";
        s = s.replace(/ +/g, " ");
        el.className = s;

        this.element.style.display = "block";

        var cs = this.element.childNodes;

        if (!this.tabPane.tabScrollBar) {
            this.tabPane.tabScrollBar.setObj(null);
        }

        for (var i = 0; i < cs.length; i++) {
            if (cs[i].nodeType == 1 && cs[i].className == "tab-layout") {
                this.tabPane.tabScrollBar.setObj(cs[i]);
                break;
            }
        }

        var n = 0;
        setFollowHint();
        while (this.edits.length > n) {
            try {
                this.edits[n].select();
                this.tabPane.indexFocus = this.edits[n].index;
                //setFollowHint(this.edits[n]);
                if (this.edits[n].kind.toLowerCase() == "dic") {
                    g_xDic.show(this.edits[n]);
                }
                return;
            }
            catch (e) {n++;}
        }

    },

    // 隐藏该“页面”
    hide: function () {
        var el = this.tab;
        var s = el.className;
        s = s.replace(/ selected/g, "");
        el.className = s;

        this.element.style.display = "none";
    },

    // 选中该“页面”
    select: function () {
        this.tabPane.setSelectedIndex(this.index);
    },


    //+------------------------------------
    // Private 属性和方法
    //-------------------------------------

    hintArea: null,             // 提示区

    // 初始化“页面”
    init: function () {
        var oThis = this;
        var el = this.element;
        var cs = el.childNodes;
        // 设置对应的“页签”
        for (var i = 0; i < cs.length; i++) {
            if (cs[i].nodeType == 1 && cs[i].className == "tab") {
                this.tab = cs[i];
                // 长标题的处理
                var sTitle = this.tab.innerText.replace(/(\\n)/g, "<br>");
                //var sTitle = this.tab.innerText;
                //alert(sTitle.length);
                var span = document.createElement("SPAN");
                span.appendChild(this.tab.firstChild);
                this.tab.appendChild(span);
                if (sTitle.lenB() > 10)
                    span.className = "tab-title";
                span.innerHTML = sTitle;
                break;
            }
        }

        // 加入键盘控制导航, Alt + 数字
        var a = document.createElement("A");
        //a.href = "javascript:;";//
        a.hideFocus = true;
        a.accessKey = this.tab.accessKey ? this.tab.accessKey : this.index + 1;
        this.tab.accessKey = "";
        a.onfocus = function () { oThis.select(); };
        while (this.tab.hasChildNodes()) {
            a.appendChild(this.tab.firstChild);
        }
        this.tab.appendChild(a);

        // 增加提示层
        
        //this.addHintLayer();  

        var oChildNode;
        if (/msie 5\.[0123456789]/i.test(navigator.userAgent)) {
            oChildNode = el.all;
        }
        else {
            oChildNode = el.getElementsByTagName("*");
        }

        // 获得包含的录入框
        this.edits = [];
        for (var i = 0; i < oChildNode.length; i++) {
            if (oChildNode[i].className.toLowerCase() == EDIT_CLASSNAME) {
                oChildNode[i].index = this.edits.length; // 焦点索引
                oChildNode[i].tabPage = this;
                this.edits[this.edits.length] = oChildNode[i];
                /*
                if (oChildNode[i].must == "true") {
                    var asterisk = document.createElement("SPAN");
                    with (asterisk.style) {
                        fontSize = "7pt";
                        color = "red";
                        width = 7;
                        paddingLeft = "2px";
                    }
                    asterisk.innerText = "*";
                    oChildNode[i].parentElement.appendChild(asterisk);
                }
                */
                if (oChildNode[i].tagName == "INPUT"
                  && (oChildNode[i].type == "text" || oChildNode[i].type == "password") && (oChildNode[i].kind!="zd") ) {
                    oChildNode[i].onkeydown = function () { this.tabPage.tabPane.keyDown(); };
                }
                /*
                else if (oChildNode[i].tagName == "TEXTAREA") {
                    oChildNode[i].onkeydown = function () { return this.tabPage.tabPane.ta_keyDown(); };
                    oChildNode[i].onfocus = function () {
                        this.tabPage.tabPane.indexFocus = this.index;
                        if (this.readOnly) {
                            this.select();
                        }
//                        g_xDic.hidden();
                    };
                }*/
            }
        }

        // 获得录入框的标题
        var n;
        this.labels = [];
        for (var i = 0; i < oChildNode.length; i++) {
            if (oChildNode[i].className.toLowerCase() == LABE_CLASSLNAME) {
                n = this.labels.length;
                this.labels[n] = oChildNode[i];
                this.labels[n].style.color = oChildNode[i].must == "true" ?
                    COL_LABEL_MUST : COL_LABEL_NORMAL;
            }
        }

        // 保持焦点
        this.element.onclick = function () {
            try {
                event.cancelBubble = true;
                if (event.srcElement.tagName == "DIV" ||
                    event.srcElement.tagName == "TD") {
                    oThis.edits[oThis.tabPane.indexFocus].focus();
                }
            }
            catch (e) {}
        };

        // 事件处理
        this.tab.onclick = function () { oThis.select(); };
        this.tab.onmouseover = function () { oThis.tabOver(); };
        this.tab.onmouseout = function () { oThis.tabOut(); };
        this.tab.onselectstart = function () { oThis.tabCancelSelect(); };
    },

    // 增加提示层
    addHintLayer: function () {
        var bHidden = false;
        if (typeof(this.tabPane.element.hiddeHint) != "undefined") bHidden = true;
        if (typeof(this.tabPane.element.hiddehint) != "undefined") bHidden = true;

        var layer = document.createElement("DIV");
        with (layer.style) {
            fontSize = "9pt";
            lineHeight = "9pt";
            paddingBottom = "2px";
            display = "block";
        }
        this.element.insertBefore(layer, this.element.firstChild);

        var oTable = document.createElement("TABLE");
        oTable.width = "100%";
        layer.appendChild(oTable);

        var oTr = oTable.insertRow();
        with (oTable) {
            width = "100%";
            height = "18px";
            border = 0;
            cellPadding = 0;
            cellSpacing = 0;
        }

        var oTd1 = oTr.insertCell();
        oTd1.noWrap = true;
        with (oTd1.style) {
            width = oTr.offsetWidth - 150;
            height = "100%";
        }

        var info = document.createElement("SPAN");
        info.style.fontFamily = "webdings";
        info.innerText = "i";
        with (info.style) {
            width = 18;
            color = "royalblue";
            paddingLeft = "4px";
            fontSize = "10pt";
            fontFamily = "webdings";
            visibility = bHidden ? "hidden" : "visible";
        }
        oTd1.appendChild(info);

        // 加入对必录项的提示
        var oTd2 = oTr.insertCell();
        oTd2.noWrap = true;
        oTd2.innerHTML = "说明：标有 " +
            "<span style='font-Size:7pt;color:red;width:4pt;'>*</span> 号的项目必填";
        with (oTd2.style) {
            width = oTr.clientWidth - oTd1.offsetWidth;
            height = "100%";
            fontSize = "9pt";
            color = "dimgray";
            visibility = bHidden ? "hidden" : "visible";
        }

        // 提示信息层
        var hintArea = document.createElement("SPAN");
        this.hintArea = hintArea;
        with (hintArea.style) {
            width = oTd1.clientWidth - 22;
            color = "midnightblue";
            fontSize = "9pt";
            textAlign = "left";
            paddingLeft = "6px";
            whiteSpace = "nowrap";
            overflow = "hidden";
        }
        oTd1.appendChild(hintArea);
    },

    // 取消拖拽选择
    tabCancelSelect: function () {
        window.event.cancelBubble = true;
        window.event.returnValue = false;
        return false;
    },

    // 处理鼠标滑过“页签”
    tabOver: function () {
        var el = this.tab;
        var s = el.className + " hover";
        s = s.replace(/ +/g, " ");
        el.className = s;
    },

    // 处理鼠标滑出“页签”
    tabOut: function () {
        var el = this.tab;
        var s = el.className;
        s = s.replace(/ hover/g, "");
        el.className = s;
    }
}
