
var tabRow = new Array;

function setRowColor(RowObj, numRow, Action, OrigColor, OverColor, ClickColor, bUseClassName){
    if (typeof(document.getElementsByTagName) != 'undefined') TheCells = RowObj.getElementsByTagName('td');
    else return false;
    if(!in_array(numRow, tabRow)){
		if(Action=='over') setColor = OverColor;
		else if(Action == 'out') setColor = OrigColor;
		else if(Action == 'click') {
			setColor = ClickColor;
			tabRow.push(numRow);
		}		
	} else if(Action == 'click'){
		tabIndex = in_array(numRow, tabRow);
		if(tabIndex>0) {
			tabRow[(tabIndex-1)] = '';
			setColor = OrigColor;
		}
	} else return;
	for(i=0 ; i<TheCells.length ; i++)
    if (bUseClassName) {
      if (bUseClassName && TheCells[i].className != setColor) 
        TheCells[i].className = setColor; 
    } else
      if (TheCells[i].style.backgroundColor != setColor)
        TheCells[i].style.backgroundColor = setColor; 
	return;
}

function in_array(needle, haystack){
	for(i=0 ; i<haystack.length ; i++) 
		if(haystack[i] == needle) return (i+1);
	return false;
}
