// JScript source code
//===============================================================================
//   Viweei  2007-1-25   Email: Viweei@126.com
//
//   Table ??????
//===============================================================================
function CWable(SelectBmp,UnSelectBmp,UpdateFunction,TableCount,Table_name){

       this.SelectImg   = SelectBmp;                                         
       this.UnSelectImg = UnSelectBmp;
       this.Update = UpdateFunction;
       this.NTable = TableCount;
       this.SelectTable = 1;
       this.TableName = Table_name;
       
       this.getObject = function(objectId) {
            if(document.getElementById && document.getElementById(objectId)) {
                return document.getElementById(objectId);
            } else if (document.all && document.all(objectId)) {
                return document.all(objectId);
            } else if (document.layers && document.layers[objectId]) {
             return document.layers[objectId];
            } else {
             return false;
            }
        }

        this.focusTab = function(n) {
            for(var i=1;i<=this.NTable;i++){
                if (i==n){
                    var tf = document.getElementById(this.TableName+i);
                    tf.style.color = '#FFFFFF';               
                    tf.background = this.SelectImg;
                    if(n != this.SelectTable){
						this.Update(i);
						this.SelectTable = n;
					}					
	            }else {
                    var tf = document.getElementById(this.TableName+i);
                    tf.background = '';   
                    tf.style.color = '#003399';   
                }
            }
        } 
 }