﻿var debug = false ;
	function switchTab (tab)
	{	event.returnValue = false ;	 
		var tabName = getTabGroupName (tab.id) ;
		if (tabName == '')
		{	alert ("No tabName for tab [" + tab.id + "]") ;
			return ;
		}
		var index = 1 ;
		while (true)
		{	var tabTitle = eval ("document.all ('" + tabName + '_' + index + "')") ;
			if (tabTitle == undefined)
				break ;
			deactiveTabTitle (tabTitle , tabName) ;
			var tabContent = eval ("document.all ('" + tabName + '_' + index + '_content' + "')") ;
			if (tabContent != undefined)
				tabContent.style.display = "NONE" ;
			index ++ ;
		}
		if (debug)
			alert ("Find " + (index - 1) + " tab title(s) for TabName [" + tabName + "]") ;
		activeTabTitle (tab , tabName) ;
		var tabContent = eval ("document.all ('" + tab.id + '_content' + "')") ;
		if (tabContent != undefined)
			tabContent.style.display = "BLOCK" ;
	}	
	function getTabGroupName (tabId)
	{
		if (tabId == '' || tabId == undefined)
		{
			alert ("tabId is NULL! [" + tabId + "]") ;
			return ;
		}
		var i = tabId.lastIndexOf ('_') ;
		if (i <= 1)
			return '' ;
		return tabId.substr (0 , i) ;
	}
	function deactiveTabTitle (tab , tabName)
	{		tab.className = tabName + "_off" ;
	}
	
	function activeTabTitle (tab , tabName)
	{		tab.className = tabName + "_on" ;
	}
	
	var mousemovecolor="#D4D4D4";
var selectcolor ="#FFEDB5";
var oldcolor;
var num=0;
var DocID = new Array();
function GetRow(oElem)
{
	while (oElem)
	{
		if (oElem.tagName.toLowerCase() == "tr"
		    && oElem.parentElement.tagName.toLowerCase() == "tbody") 
		    return oElem;
		if (oElem.tagName.toLowerCase() == "table" || oElem.tagName.toLowerCase() == "th") return false;
		oElem = oElem.parentElement;
	}
}

function MouseOver1()
{
	var trstyle = GetRow( window.event.srcElement );
	if( !trstyle )
		return false;
	if (trstyle.style.backgroundColor.toLowerCase() == selectcolor.toLowerCase()) return false;
	oldcolor = trstyle.style.backgroundColor;
	trstyle.style.backgroundColor = '#FFE495';
	/* mousemovecolor; */
	
	trstyle.style.color='#FF0000';
	//trstyle.style.cursor = "hand";
}

function MouseOut1()
{
	var trstyle = GetRow( window.event.srcElement );
	if( !trstyle )
		return false
	if (trstyle.style.backgroundColor.toLowerCase() ==selectcolor.toLowerCase()) return false;
	trstyle.style.backgroundColor = oldcolor;
	trstyle.style.color='black';
}