
onerror = errorHandler;
function errorHandler(errorMessage, url, line) {
//alert (errorMessage + "   " + line);
return false;
}

originalColorArray = new Array();

function changeBg(tr,colorToChange) {
	if (isTrMarked(tr)) return;
	var children = tr.childNodes;
	var str;
	tmpArray = new Array();
	if (tr.children) {
		for (var i=0;i < children.length; i++) {
			tmpArray[i] = tr.children[i].bgColor;
			str = "tr.children[i].bgColor='" + colorToChange + "'"
			eval(str);
		}
	}
	originalColorArray[tr.rowIndex] = tmpArray;
}


function changeBg_2(tr,colorToChange,startFromChild) {
	if (isTrMarked(tr)) return;
	var children = tr.childNodes;
	var str;
	tmpArray = new Array();
	if (tr.children) {
		for (var i=eval(startFromChild);i < children.length; i++) {
			tmpArray[i] = tr.children[i].bgColor;
			str = "tr.children[i].bgColor='" + colorToChange + "'"
			eval(str);
		}
	}
	originalColorArray[tr.rowIndex] = tmpArray;
}


function resetBg(tr) {
	if (isTrMarked(tr)) return;
	tmpArray = originalColorArray[tr.rowIndex];
	var children = tr.childNodes;
	if (tr.children) {
		for (var i=0;i < children.length; i++) {
			tr.children[i].bgColor=tmpArray[i];
		}
	}
}

function isTrMarked(tr) {

	if (tr.children && 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();
		if (tr.children) {
			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] != null && 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];
	if (tr.children) {
		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 doNothing() {}

function getScroll() {
	if (document.all) {
		var ieBox = document.compatMode != "CSS1Compat";
		var cont = ieBox ? document.body : document.documentElement;
		return {x:cont.scrollLeft, y:cont.scrollTop};
	} else {
		return {x:window.pageXOffset, y:window.pageYOffset};
	}
}

function hidePopBox() {
	hideDiv('popBox');
	hideDiv('popBoxShadow');
}

var timeout;
function showPopBox(e,w,h,code) {
	var x = (window.event) ? window.event.x : e.pageX;
	var y = (window.event) ? window.event.y : e.pageY;
	if (document.all) {
		var scroll = getScroll();
		y = y + scroll.y;
	}
	getById('popBox').style.width = w;
	getById('popBox').style.height = h;
	getById('popBoxShadow').style.width = w;
	getById('popBoxShadow').style.height = h;
	getById('popBox').style.top = y+10;
	getById('popBox').style.left = x;
	getById('popBoxShadow').style.top = y+13;
	getById('popBoxShadow').style.left = x+3;
	getById('popBox').innerHTML = code;
	showDiv('popBox');
	showDiv('popBoxShadow');

	timeout = setTimeout("hideDiv('popBox');hideDiv('popBoxShadow');", 3000);
}

function replace(a,b,c) {
	while (a.indexOf(b)>-1) {
		pos = a.indexOf(b);
		a = '' + (a.substring(0, pos) + c + a.substring((pos + b.length), a.length));
	}
	return a;
}

function popBoxOut(){
    timeout = setTimeout("hideDiv('popBox');hideDiv('popBoxShadow');", 0);
}