
/*
 * Workaround for an IE bug
 */
var getCellIndex = function (c) {
	if (document.all) {
		var aoRowTds = c.parentNode.getElementsByTagName("th");
  		for (var i = 0; aoRowTds[i] != c && i < aoRowTds.length; i++);
  		return i;
	}
	else {
		return c.cellIndex;
	}
};


/*
 * function:	findEnclosing
 * description: Finds an enclosing tag
 * parameters:	oStart - the node to start with
 *              tagName - the name of the tag to find
 * return:      The tag node, if one has been found
 *
 */

var findEnclosing	= function(oStart, tagName)
{
	while (	oStart.tagName
			&&	oStart.tagName.toLowerCase() 
					!= tagName.toLowerCase()) {
		oStart	= oStart.parentNode;
	}
	return oStart;
}

/*
 * function:	switchRow
 * description: Hides a Table row
 * parameters:	oEl - An element contained inside a td/th tag
 *				bShow - boolean show/hide the row
 *
 */

switchRow	= function(oEl, bShow)
{
	//	find enclosing table header 
	var	oRowEl	= findEnclosing(oEl, "th");
	var iCol	= getCellIndex(oRowEl);

	//	find enclosing table
	var	oTable	= findEnclosing(oRowEl.parentNode, "table");
	for (var i=0; i<oTable.rows.length;i++) {
		if (oTable.rows[i].cells[iCol]) {
			with(oTable.rows[i].cells[iCol]){
				if (!bShow && className!="nohide") {
					style.display		= "none";
				}
				else {
					style.display		= "";
				}
			}
		}
	}
}

/*
 * function:	showAll
 * description: Unhides all table cells
 * parameters:	oEl - An element contained inside the table tag
 *
 */

showAll	= function(oEl)
{
	var	oTable	= findEnclosing(oEl.parentNode, "table");
	for (var i=0; i<oTable.rows.length;i++) {
		for (var j=0; j<oTable.rows[i].cells.length;j++) {
			if (oTable.rows[i].cells[j]) {
				oTable.rows[i].cells[j].style.display	= "";
			}
		}
	}
}






