   treetable_callbacks['eventRowStateChanged'] = 'treetable_eventRowChanged'; 
    function treetable_eventRowChanged(rowId, state) {
      img = document.getElementById(rowId).getElementsByTagName('td')[0].getElementsByTagName('img')[0];
      if (state == 1) {
        img.src = 'img/folder_green_open.png';
      } else {
        img.src = 'img/folder_green.png';
      }
      return (true);
    }  
 
  var ctrl = false;
  var shift = false;
  var tableStyle;//存放table各列的样式
  var ifFirst=true;//用来第一次初始化table各列的样式
  var selectNum=0;//选择行的个数，用来判断选中行的个数
  var rowI;//当前行序号
  var selectElement;//选择行对象
  
  //处理按ctrl和shift键
  document.onkeydown = function () {
   if (event.keyCode == 17) {
    ctrl = true;
   } else {
    if (event.keyCode == 16) {
     shift = true;
    }
   }
  };
  document.onkeyup = function () {
   ctrl = false;
   shift = false;
  };
    function msg(){
	alert(1);
	}
  
  //鼠标经过时
  function hilite(theTR){
   //鼠标第一次经过时初始化
   if(ifFirst){
    //遍历table所有行的样式，并放到数组tableStyle中，第一次点击的时候遍历
    tableStyle=new Array(jobtable.rows.length);
    for (var i = 0; i < jobtable.rows.length; i++) {
	if(jobtable.rows(i).className=="selected")
	  {
	     jobtable.rows(i).className="first";
         jobtable.rows(rowI).selectState = "no";
		}
     tableStyle[i]=jobtable.rows(i).className;
    }
    ifFirst=false;
   }
      if(theTR.className != "selected"){
          theTR.className = "mouseover";
      }
  }
  //鼠标离开时
  function restore(theTR){
      if(theTR.className != "selected")
          theTR.className = tableStyle[theTR.rowIndex]
  }
  function ClearSelect()
	{
	  for (var i = 1; i < jobtable.rows.length; i++) {
	  jobtable.rows(i).className = tableStyle[i];
        jobtable.rows(i).selectState = "no";	
		selectNum=0;
	 }
	   ctrl = false;
	 shift = false;
	}

	function SelectOne(line)
	{
	  if (line < jobtable.rows.length) {
	     jobtable.rows(line).className = "selected";
         jobtable.rows(line).selectState = "yes";	
		 selectNum=1;
	 }
	   ctrl = false;
	 shift = false;
	}

  //鼠标按下时
  //每行中selectState属性可以在需要的时候判断是否选中某一行或某几行
  function clickRow(theTR) {
   if (ctrl && shift) {//同时按下ctrl和shift则不操作
    return;
   }
   rowI=theTR.rowIndex;
   
   //如果选择的是复选框按钮时
   if(event.srcElement.tagName=="INPUT" && event.srcElement.type=="checkbox" &&!shift ){
    var state = event.srcElement.checked;
          if(state){
        jobtable.rows(rowI).className = "selected";
        jobtable.rows(rowI).selectState = "yes";
        selectNum++;
       }else{
        jobtable.rows(rowI).className = tableStyle[rowI];
        jobtable.rows(rowI).selectState = "no";	
        selectNum--;
       }
       
       for (var i = 1; i < jobtable.rows.length; i++) {
     if(jobtable.rows(i).selectState == "yes"){
         //赋当前操作行对象
         selectElement=jobtable.rows(i);
     }
       }
    return;
   }
    
   if (!ctrl && !shift) {//没有按ctrl或shift时
    for (var i = 1; i < jobtable.rows.length; i++) {
     try {
      jobtable.rows(i).cells(0).firstChild.checked = false;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
     jobtable.rows(i).className = tableStyle[i];
     jobtable.rows(i).selectState = "no";  
    }
	
        try {
      jobtable.rows(rowI).cells(0).firstChild.checked = true;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
    jobtable.rows(rowI).className = "selected";
    jobtable.rows(rowI).selectState = "yes";
    jobtable.currentRow = rowI;
    selectNum=1;
	return;
   }
   if (ctrl) {//按ctrl键时
       if(jobtable.rows(rowI).className == "selected"){
        try {
      jobtable.rows(rowI).cells(0).firstChild.checked = false;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
        jobtable.rows(rowI).className = tableStyle[rowI];
        jobtable.rows(rowI).selectState = "no";
        selectNum--;
       }else{
        try {
      jobtable.rows(rowI).cells(0).firstChild.checked = true;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
        jobtable.rows(rowI).className = "selected";
        jobtable.rows(rowI).selectState = "yes";
        selectNum++;
       }
   }
   if (shift) {//按shift键时
    for (var i = 1; i < jobtable.rows.length; i++) {
     try {
      jobtable.rows(i).cells(0).firstChild.checked = false;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
     jobtable.rows(i).className = tableStyle[i];
     jobtable.rows(rowI).selectState = "no";
    }
    
    if (rowI < jobtable.currentRow) {
     for (var i = rowI; i <= jobtable.currentRow; i++) {
      try {
      jobtable.rows(parseInt(i)).cells(0).firstChild.checked = true;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
      jobtable.rows(parseInt(i)).className = "selected";
      jobtable.rows(parseInt(i)).selectState = "yes";
     }
    } else {
     for (var i = jobtable.currentRow; i <= rowI; i++) {
      try {
      jobtable.rows(parseInt(i)).cells(0).firstChild.checked = true;
     } catch (e) {
      //页面中没有复选框或单选框时
     }
      jobtable.rows(parseInt(i)).className = "selected";
      jobtable.rows(parseInt(i)).selectState = "yes";
     }
    }
    
    selectNum=Math.abs(parseInt(jobtable.currentRow)-rowI)+1;
   }
   
   for (var i = 1; i < jobtable.rows.length; i++) {
    if(jobtable.rows(i).selectState == "yes"){
        //赋当前操作行对象
        selectElement=jobtable.rows(i);
    }
   }
  }


function checkAll(e, itemName)
{
  var aa = document.getElementsByName(itemName);
  for (var i=0; i<aa.length; i++)
   aa[i].checked = e.checked;
}
function checkItem(e, allName)
{
  var all = document.getElementsByName(allName)[0];
  if(!e.checked) all.checked = false;
  else
  {
    var aa = document.getElementsByName(e.name);
    for (var i=0; i<aa.length; i++)
     if(!aa[i].checked) return;
    all.checked = true;
  }
}


function GetPageScroll() {  
var x, y;  
if(window.pageYOffset) {    
// all except IE    
y = window.pageYOffset;  
//x = window.pageXOffset;  
}
else if(document.documentElement     && document.documentElement.scrollTop)
{    // IE 6 Strict  
y = document.documentElement.scrollTop; 
//x = document.documentElement.scrollLeft; 
} 
else if(document.body) {    // all other IE  
y = document.body.scrollTop;   
//x = document.body.scrollLeft;  
}  
//return {X:x, Y:y};
return y;
}
function SetPageScroll(y) {  
var y;  
if(document.documentElement     && document.documentElement.scrollTop)
{    // IE 6 Strict  
//alert(y);
//lert( document.documentElement.scrollTop);
 document.documentElement.scrollTop=y ; 
} 
else if(document.body) {    // all other IE  
document.body.scrollTop=y;   
}  
}