

function collapseCol(table, col, nrOfRows) {
	for (var i=0; i<nrOfRows;i++) {
		getById("t_"+table+"_"+col+"_"+(i)).style.display='none';
		getById("t_"+table+"_"+col+"_"+(i)+"_h").style.display=getHiddenCellStyleName();
	}
}

function expandCol(table, col, nrOfRows) {
	for (var i=0; i<nrOfRows;i++) {
		getById("t_"+table+"_"+col+"_"+(i)).style.display='block';
		getById("t_"+table+"_"+col+"_"+(i)+"_h").style.display='none';
	}
}

function collapseRow(table, row, td) {
	getById("t_"+table+"_tr_"+row).style.display='none';
	markRow(td.parentNode.parentNode);
	rebuildColorTable("t_"+table);
}

function expandAllRows(table, nrOfRows) {
	for(var i=0;i<nrOfRows;i++) {
		getById("t_"+table+"_tr_"+i).style.display=getHiddenCellStyleName();
	}
	rebuildColorTable("t_"+table);
}

function collapseManyRows(table, rowStart, rowEnd) {
	for (var i=rowStart;i<=rowEnd;i++) {
		//getById("t_"+table+"_tr_"+i).style.display='none';
		getById("t_"+table+"_tr_"+i).className = "hiddenRow";
	}
}

function expandManyRows(table, rowStart, rowEnd) {
	for (var i=rowStart;i<=rowEnd;i++) {
		//getById("t_"+table+"_tr_"+i).style.display=getHiddenCellStyleName();
		getById("t_"+table+"_tr_"+i).className = "";
	}
}

function expandOrCollapseManyRows(table, row, rowStart, rowEnd) {
    // getById("t_"+table+"_tr_"+rowStart).style.display == '' || getById("t_"+table+"_tr_"+rowStart).style.display == getHiddenCellStyleName()
	if(getById("t_"+table+"_tr_"+rowStart).className == "hiddenRow") {
        expandManyRows(table, rowStart, rowEnd);
		eval("document.expandCollapseImg_"+table+"_"+row).src="/pan/images/minus.gif";
	} else {
	    collapseManyRows(table, rowStart, rowEnd);
		eval("document.expandCollapseImg_"+table+"_"+row).src="/pan/images/plus.gif";
	}
}

function getHiddenCellStyleName() {
	return document.all?"block":"table-cell";
}




function rebuildColorTable(t) {
	var tbody = first_child(getById(t));
	var tr = first_child(tbody);
	var td = null;
	var odd = true;
	while (tr != null) {
		odd?color="f5f5f5":color="ffffff";
		td = first_child(tr);
		if (tr.style.display != "none") {
			odd = !odd;
		}
		while (td != null) {
			td.bgColor = color;
			td = node_after(td);
		}
		tr = node_after(tr);
	}
}

function clickReportLink(a,isBorderCell) {
	markRow(a.parentNode.parentNode, isBorderCell);
}

function markRow(tr,isBorderCell) {
	var td = first_child(tr);
	var first = true;
	while (td != null) {
		if (td.className == "report2markedCell" || td.className == "report2markedBorderCell") {
			// Row is marked. Unmark it.
			if (first) {
				td.className = "";
				first = false;
			} else {
				if (isBorderCell) {
					td.className = "report2borderCell";
				} else {
					td.className = "";
				}
			}
			var i = first_child(td);
			while (i != null) {
				if (i.nodeName == 'A') {
					i.style.color="305E80";
				}
				i = node_after(i);
			}
			if (td.style != null && (td.style.color == "#ffff00" || td.style.color == "rgb(255,255,0)")) {
				td.style.color="red";
			}
		} else {
			// Row is unmarked. Mark it.
			if (first) {
				td.className = "report2markedCell";
				first = false;
			} else {
				if (isBorderCell) {
					td.className = "report2markedBorderCell";
				} else {
					td.className = "report2markedCell";
				}
			}
			var i = first_child(td);
			while (i != null) {
				if (i.nodeName == 'A') {
					i.style.color="ffffff";
				}
				i = node_after(i);
			}
			if (td.style != null && td.style.color == "red") {
				td.style.color="ffff00";
			}
		}
		td = node_after(td);
	}
}



