var arrayOfRolloverClasses = new Array();
var activeRow = false;
var clickedRow = false;

function highlightTableRow() {
	var tableObj = this.parentNode;
	if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

	if(this!=activeRow){
		this.setAttribute('origCl',this.className);
		this.origCl = this.className;
	}
	this.className = arrayOfRolloverClasses[tableObj.id];

	activeRow = this;	
}

function clickedTableRow() {
	var tableObj = this.parentNode;
	if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

	if(this!=clickedRow){
		this.setAttribute('origCl',this.className);
		this.origCl = this.className;
	}
	this.className = arrayOfRolloverClasses[tableObj.id];

	clickedRow = this;	
}

function resetRowStyle() {
	var origCl = this.getAttribute('origCl');
	if(!origCl)origCl = this.origCl;
	this.className=origCl;
}

function highlightRow(tableID, rowID ) {

	var tableObj = document.getElementById(tableID);
	var tBody = tableObj.getElementsByTagName('TBODY');
	if(tBody){
		var rows = tBody[0].getElementsByTagName('TR');
	}else{
		var rows = tableObj.getElementsByTagName('TR');
	}

	for(var no=0;no<rows.length;no++){
		var cols = rows[no].getElementsByTagName('TD');
		if ( rows[no].id == rowID ) {
			cols[0].style
			cols[0].innerHTML = "<strong>" + cols[0].innerHTML + "</strong>"
		} else {
			html = cols[0].innerHTML;
			html = html.replace(/<strong>/ig, "")
			html = html.replace(/<\/strong>/ig, "")
			cols[0].innerHTML = html;
		}
	}

}

function addTableRolloverEffect(tableId,whichClass) {
	arrayOfRolloverClasses[tableId] = whichClass;

	var tableObj = document.getElementById(tableId);
	if ( tableObj ) {
		var tBody = tableObj.getElementsByTagName('TBODY');
		if(tBody){
			var rows = tBody[0].getElementsByTagName('TR');
		}else{
			var rows = tableObj.getElementsByTagName('TR');
		}
		for(var no=0;no<rows.length;no++){

			if ( rows[no].className == "highlightThisRow" ) {
				rows[no].onmouseover = highlightTableRow;
				rows[no].onmouseout = resetRowStyle;
			}
		}
	}
}
