 
onerror = errorHandler;
function errorHandler(errorMessage, url, line) {
//alert (errorMessage + "   " + line);
return false;
}

function HelpWindow(src)
  {
    win=window.open('helpTextServlet?helpText=' + src,'wnd','toolbar=no,location=no,menu=no,scrollbars=yes,directories=no,resizable=yes,width=300,height=300,screenX=0,screenY=0,top=0,left=0');
    win.focus();

  }

function PopUp(textKeyBody,textKeyTitle,width,height)
  {
    win=window.open('helpTextServlet?helpText='+textKeyBody+'&helpTextTitle='+textKeyTitle+'&helpTextWidth='+width+'&helpTextHeight='+height,'wnd','toolbar=no,location=no,menu=no,scrollbars=yes,directories=no,resizable=yes,width='+width+',height='+height+',screenX=0,screenY=0,top=0,left=0');
    win.focus();

  }


/*

tdArray = new Array();

function changeBg(tr) {
	var children = tr.childNodes;
	for (var i=0;i < children.length; i++) {
		tdArray[i] = tr.children[i].bgColor;
		//if (tr.children[i].innerText != '' && tr.children[i].innerText != ' ' && tr.children[i].innerText != '&nbsp;') {
			tr.children[i].bgColor='e5e5e5';
		//}
		
	}
}

function resetBg(tr) {
	var children = tr.childNodes;
	for (var i=0;i < children.length; i++) {
		tr.children[i].bgColor=tdArray[i];
	}
}
*/




originalColorArray = new Array();

function changeBg(tr) {
	if (isTrMarked(tr)) return;
	var children = tr.childNodes;
	tmpArray = new Array();
	for (var i=0;i < children.length; i++) {
		tmpArray[i] = tr.children[i].bgColor;
		tr.children[i].bgColor='cccccc';
	}
	originalColorArray[tr.rowIndex] = tmpArray;
}

function resetBg(tr) {
	if (isTrMarked(tr)) return;
	tmpArray = originalColorArray[tr.rowIndex];
	var children = tr.childNodes;
	for (var i=0;i < children.length; i++) {
		tr.children[i].bgColor=tmpArray[i];
	}	
}

function isTrMarked(tr) {
	if (tr.children[0].bgColor=='#437ca7') {
		return true;
	}
	return false;
}

function markTr(tr) {
	var children = tr.childNodes;
	var doStyle = true;
	if (isTrMarked(tr)) {
		unMarkTr(tr);
	} else {
		tmpArray = new Array();
		for (var i=0;i < children.length; i++) {
			tr.children[i].bgColor='437CA7';
			if (tr.children[i].style.color == "red") {
				tr.children[i].style.color="ffff00";
			} else {
				tr.children[i].style.color="ffffff";
			}
			if (tr.children[i].childNodes[0].nodeName == "A") {
				tr.children[i].childNodes[0].style.color="ffffff";
			}
		}
	}
}

function unMarkTr(tr) {
	var children = tr.childNodes;
	tmpArray = originalColorArray[tr.rowIndex];
	for (var i=0;i < children.length; i++) {
		tr.children[i].bgColor=tmpArray[i];
		if (tr.children[i].style.color == "#ffff00") {
			tr.children[i].style.color="red";
		} else {
			tr.children[i].style.color="000000";
		}
		if (tr.children[i].childNodes[0].nodeName == "A") {
			tr.children[i].childNodes[0].style.color="305E80";
		}		
	}
}


function getById(id) {
   return document.getElementById?document.getElementById(id):(document.all?document.all(id):null)
}

function hideDiv(id) {
   getById(id).style.visibility = "hidden";
   getById(id).style.display = "none";
}

function showDiv(id) {
   getById(id).style.visibility = "visible";
   getById(id).style.display = "inline";
}



function collapse(col) {

	var parentTd;
	var parentTr;
	if (document.all) {
		parentTd = col.parentElement;
		parentTr = parentTd.parentElement;
	} else {
		parentTd = col.parentNode;
		parentTr = parentTd.parentNode;
	}

	var children = parentTr.childNodes;
	for(var i=0;i<children.length;i++) {
		if (children[i] == parentTd) {
			if (document.all) {
				hideCol(i, parentTr.parentElement)
			} else {
				hideCol(i, parentTr.parentNode)
			}
		}
	}
}

function hideCol(colId, table) {
	tr = table.childNodes;
	for (var i=0; i<tr.length;i++) {
		td = tr[i].childNodes;
		for (var ii=0; ii<td.length; ii++) {
			if (ii == colId) {
				td[ii].style.display='none';
			}
		}
	}
}

function showCol(table) {
	table = eval(table).childNodes;
	if (document.all)
		tr = table[0].childNodes;
	else
		tr = table[1].childNodes;
	for (var i=0; i<tr.length;i++) {
		td = tr[i].childNodes;
		for (var ii=0; ii<td.length; ii++) {
			if (td[ii].style) {
				if (document.all)
					td[ii].style.display = 'block';
				else
					td[ii].style.display = 'table-cell';
			}
		}
	}
}
