﻿//n第几个　d　DIV数量　　p DIV表前缀　T　按钮前缀　O原样式　C　新样式　
function _ts(n,d,p,t,o,c){
	 
		for(var id = 1;id<=d;id++)
		{
		    var s = "";
			if(id==n)
			{
			    s = "block";
			 	
			 	document.getElementById(t+id).className=o;
			 	
			}
			else
			{
			    s = "none";
			 	document.getElementById(t+id).className=c;
			}
		
			document.getElementById(p+id).style.display = s;
		}
		
	}
        function MessageTab(aa,n,itemname,obj)
		{
		    this.id = "current";
			var objp = obj.parentNode.parentNode;

			for (var i = 1; i <= n; i++) {
			    if (aa == i) {
			        objp.getElementsByTagName("li")[i - 1].childNodes[0].id = "current";
			        document.getElementById(itemname + i).style.display = "";
			    }
			    else {
			        objp.getElementsByTagName("li")[i - 1].childNodes[0].id = "";
			        document.getElementById(itemname + i).style.display = "none";
			    }
			}
			
 		}
 		
 		function ShowTab(aa,n,obj)
		{

		  
			this.id="current";
			var objp = obj.parentNode.parentNode;
			 
			for(i = 1 ; i<=n ;i++)
			{
				if(aa==i)
					{//document.getElementById(itemname + i ).style.display=""	;
					
					objp.childNodes[i-1].childNodes[0].id = "current";
					//document.getElementById(itemname+i).parentNode[0].childNodes[i-1].childNodes[0].id = "current";
					}
				else{
					//document.getElementById(itemname + i ).style.display="none";	 
					objp.childNodes[i-1].childNodes[0].id = "";
					}
					
			}
			
 		}



var row_marked = Array();
var row_over_color;
var row_marked_color;

function onRowOver(row, rowNo){

  if(row_marked[rowNo]==null||!row_marked[rowNo]){
    // use row.bgColor save ori color since it has no effect if has style backgroundColor
    row.bgColor=row.style.backgroundColor;
    row.style.backgroundColor=row_over_color!=null?row_over_color:'#D6DFF7';
  }
}
function onRowOut(row, rowNo){
  if(row_marked[rowNo]==null||!row_marked[rowNo]){
    row.style.backgroundColor=row.bgColor;
    row.bgColor='';
  }
}

function onRowClicked(row, rowNo){
  // FIXME: following several lines only works on IE
//  alert(event.srcElement);
//  whichIt = event.srcElement;
//	while (whichIt.tagName != "A") {
//		whichIt = whichIt.parentElement;
//		if (whichIt == null){
//			// no link clicked, passed
//			break;
//		}
//	}
//	if (whichIt != null){
//	  return;
//	}
	if(row_marked[rowNo]==null||!row_marked[rowNo]){
	  row_marked[rowNo]=true;
	  row.style.backgroundColor = row_marked_color!=null?row_marked_color:'orange';
	}
	else{
	  row_marked[rowNo]=false;
	  row.style.backgroundColor = row_over_color!=null?row_over_color:'#cccccc';
	}
}
