function displayActionMessage(message)
	{
	if (message != '')
		alert(message);
	}

function checkAllCheckboxes(ownercheckbox, targetcheckbox, formname)
	{	
	var formname = eval('document.' + formname);
	var field    = formname.elements[targetcheckbox];
	var checked  = formname.elements[ownercheckbox].checked;

	if (field != null)
		{
		if (field.length == null)
			field.checked = checked;
		else
			{
			for (var i = 0; i < field.length; i++)
				{
				field[i].checked = checked;
				}
			}
		}
	}

function clearField(fieldName)	
{
	var field = document.getElementById(fieldName);
	if (field == null)
		alert("In clearField...Field " + fieldName + " does not exist.");
	else
		{
		if (field.selectedIndex != null)
			field.selectedIndex = -1;
		else
			field.value = "";
		field.checked   = false;
		field.disabled  = false;
		}
}

function goto(URL)
{
	window.location.href = URL;
	//window.navigate(URL);
}

function onMouseOverButton(strLabelName)
{
	//var lbl = document.all[strLabelName];
	var lbl = document.getElementById(strLabelName);
	if (lbl != null)
		lbl.style.color="blue";
}

function onMouseOutButton(strLabelName)
{
	//var lbl = document.all[strLabelName];
	var lbl = document.getElementById(strLabelName);
	if (lbl != null)
		lbl.style.color="white";
}

function getKey(e)
{
	if (window.event)
		return window.event.keyCode;
	else if (e)
		return e.which;
	else
		return null;
}

function goodchars(event, validKeys)
{
	var key = getKey(event);
	if (key == null) 
		return true;

	// get character
	var keychar = String.fromCharCode(key);
	keychar     = keychar.toLowerCase();
	validKeys   = validKeys.toLowerCase();

	// check goodkeys
	if (validKeys.indexOf(keychar) != -1)
		return true;

	// Allow Control keys
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
		return true;

	// Return false
	return false;
}

function hideDiv(divName)
{
	var obj = document.getElementById(divName);
	obj.style.display = "none";
}

function showDiv(divName)
{
	if (divName != null)
		{
		var obj = document.getElementById(divName);
		obj.style.display = "inline";
		}
}

/* Child Window processing */

var childWindow = null;
	
function openWindow(URL, name, attributes)
{
	var win = window.open(URL, name, attributes);
	win.focus();
	return win;
}

function openModalWindow(URL, name, attributes)
{
	if (childWindow == null || childWindow.closed)
		{
		window.loaded = null;
		 childWindow = window.open(URL, name, attributes);
	 	//When this window is opened for the first time, this function will not run the
	 	//rest of it. We use a onload event in the opening document to execute the
	 	//rest of this function.
		}
	childWindow.focus();
	return childWindow;
}

function onExit()
{
	var parent = window.parent;
	if (parent != null && parent.childWindow != null)
		parent.childWindow = null;
	window.close();
	parent.focus();
}		

function onFocus()
{
	if (childWindow != null && !childWindow.closed)
		childWindow.focus();
}
