DateControl_activeDateControl = Panel_activePanel = Component_activeComponent = Autocompleter = null;

function Page() {
	Page.createElement = function(n, id) { n = (n != null) ? n : "DIV"; var e = document.createElement(n); e.id = id; document.getElementsByTagName("BODY")[0].appendChild(e);	return e; }
	Page.getElement = function(id) { return document.getElementById(id); }
	Page.getElementsOf = function(e, n) { return e.getElementsByTagName(n);	}
	Page.getComponent = function(event, node) {	if (node.component == null)	if (node.onmouseover != null) node.onmouseover(event); return node.component; }
	document.onmousedown = function(event) { Page.resetComponents(); } 
	Page.resetComponents = function() { 
		if (DateControl_activeDateControl != null) DateControl_activeDateControl.deactivate();
		if (Panel_activePanel != null)	Panel_activePanel.deactivate();
		if (Component_activeComponent != null) Component_activeComponent.deactivate();
		if (Autocompleter != null) Autocompleter.deactivate();
	}

	Page.show = function(eId) { var e = Page.getElement(eId); e.style.visibility = "visible"; e.style.display = "block"; e.style.position = document.all ? "fixed" : "relative"; }
	Page.hide = function(eId) {	var e = Page.getElement(eId); e.style.visibility = "hidden"; e.style.display = "none"; e.style.position = "absolute"; }
} new Page();

var selectedRowId = null;

function crsrowselect(newRowId) {
	if (selectedRowId != null) {
		document.getElementById(selectedRowId).className = "";
	}
	selectedRowId = newRowId;
	document.getElementById(selectedRowId).className = "selectedRow";
}

function rowselect(id, rowCount, bgColor) {
	for ( i=1; i<=rowCount; i++)
	{
		bgselect("row" + i + "_" + id, bgColor);
	}
}

function rowunselect(id, rowCount, bgColor) {
	for ( i=1; i<=rowCount; i++)
	{
		bgunselect("row" + i + "_" + id, bgColor);
	}
}



function bgselect(bgId, bgColor) {
	if ((bgId != null) && (document.getElementById(bgId) != null)) {
		if (bgColor != null) {
			if (document.getElementById(bgId) != null)
			{
				document.getElementById(bgId).style.backgroundColor = bgColor;
			}
		} else {
			if (document.getElementById(bgId) != null)
			{
				document.getElementById(bgId).style.backgroundColor = "#FCF9ED";
			}
		}
	}
}

function bgunselect(bgId, bgColor) {
	if ((bgId != null) && (document.getElementById(bgId) != null)) {
		if (bgColor != null) {
			if (document.getElementById(bgId) != null)
			{
				document.getElementById(bgId).style.backgroundColor = bgColor;
			}
		}else {
			if (document.getElementById(bgId) != null)
			{
				document.getElementById(bgId).style.backgroundColor = "white";
			}
		}
	}
}


function sendcmd(id, val) {
	if (!nosend) {
		activecmd = document.getElementById("_activecmd");

		if ((activecmd != null) && (activecmd.value.length > 0)) {
			document.getElementById(activecmd.value).value = "";
		}

		activecmd.value = id;
		document.getElementById(id).value = val;
	}
}

var nosend = false;

function cr(e, id, val) {
	var ev = e ? e : window.event;
	if (e.keyCode == 13) {
		if (id == "break") {
			if (e.stopPropagation) {
				e.stopPropagation(); 
			} else {
				e.cancelEvent = true;
			}
			e.returnValue = false;
			nosend = false;
		} else {
			sendcmd(id, val);
			nosend = true;
		}
	}
}

