var b24Hr = false;

function displayWarning (sWarning, bPrompt)
{
var oElement;

	oElement = document.getElementById("tmStatus");
	if (oElement)
		oElement.innerHTML = sWarning;
	else
		window.status = sWarning;

	if (bPrompt)
		alert(sWarning);
}

function enableBtn(btn, enable)
{
var oElement;

	oElement = document.getElementById(btn);
	if (!oElement)
		return;
		
	if (enable)
		oElement.className = oElement.className.substr(0, 8);
	else
		oElement.className = oElement.className.substr(0, 8) + 'dis';
}

function padZero (num, rpt)
{
	while (num.length < rpt) {
		num = "0" + num;
	}
	return num;
}

function makeZero(iValue)
{
	if (iValue < 0)
		return 0;
	else
		return iValue;
}

function showAudit(sTable, sKey)
{
	if (!sTable || !sKey)
		return;

	window.open ("/cgi-bin/auditPopup.pl?sTable=" + sTable + "&sKey=" + sKey,
				 "auditPopup", 
				 "left=150,top=100,screenX=150,screenY=100,width=300,height=200");
}

function focusOnFirst ()
{
var iForm;
var iElement;

	for (iForm = 0; iForm < document.forms.length; iForm++)
	{
		for (iElement = 0; iElement < document.forms[iForm].elements.length; iElement++)
		{
			if ((document.forms[iForm].elements[iElement].type == "text" ||
				 document.forms[iForm].elements[iElement].type == "select-one") &&
				document.forms[iForm].elements[iElement].value == "")
			{
				document.forms[iForm].elements[iElement].focus();
				return;
			}
		}
	}
}
