function toggleRow(whichRow,whichAction,totalCols) {
	out = "#efefef";
	over = "#cfcfcf";
	clicked = "#a2a788";
	rowParts = whichRow.split("td");
	rowRoot = rowParts[0];
	if (whichAction == "clicked") {
		if (getBgColor(fixElement(whichRow)) == clicked) {
			for (i=1;i<=totalCols;i++) {
				setBgColor(fixElement(rowRoot + "td" + i),over);
			}
		} else {
			for (i=1;i<=totalCols;i++) {
				setBgColor(fixElement(rowRoot + "td" + i),clicked);
			}
		}
	} else if (whichAction == "over") {
		if (getBgColor(fixElement(whichRow)) != clicked) {
			for (i=1;i<=totalCols;i++) {
				setBgColor(fixElement(rowRoot + "td" + i),over);
			}
		}
	} else if (whichAction == "out") {
		if (getBgColor(fixElement(whichRow)) != clicked) {
			for (i=1;i<=totalCols;i++) {
				setBgColor(fixElement(rowRoot + "td" + i),out);
			}
		}
	}
}

function toggleActiveRow(whichRow,whichAction,totalCols) {
	if (!totalCols) totalCols = 0; //preventative measure
	//find out which root class the table cell is currently using
	var currClass,rootClass,newClass,isClicked;
	var classParts = new Array();
	whichTd = fixElement(whichRow);
	currClass = whichTd.className;
	if (currClass.indexOf("Out") > -1) classParts = currClass.split("Out");
	if (currClass.indexOf("Over") > -1) classParts = currClass.split("Over");
	if (classParts.length > 0) rootClass = classParts[0];
	//find out if table cell is clicked
	if (currClass.indexOf("Clicked") > -1) isClicked = true;
	else isClicked = false;
	
	if (rootClass) {
		rowParts = whichRow.split("td");
		rowRoot = rowParts[0];
		
		for (i=1;i<=totalCols;i++) {
			currTd = fixElement(rowRoot + "td" + i);
			
			if (whichAction == "clicked") {
				if (isClicked) newClass = rootClass + "Over";
				else newClass = rootClass + "OverClicked";
			} else if (whichAction == "over") {
				if (isClicked) newClass = rootClass + "OverClicked";
				else newClass = rootClass + "Over";
			} else if (whichAction == "out") {
				if (isClicked) newClass = rootClass + "OutClicked";
				else newClass = rootClass + "Out";
			}
			
			currTd.className = newClass;
		}
	}
}