function GoLogin()
{
	var oForm = document.formLogin
	if(ValidString(oForm.sUsername.value) && ValidString(oForm.sPassword.value))
		oForm.submit()
	else
		alert("Please enter your username and password before attempting to login")
}

function CheckForReturn(evt)
{
	if(window.event.keyCode == 13)
		GoLogin()
}

function ToggleDesc(oDiv)
{
	var bNS = (window.Event) ? 1 : 0;
	if(!bNS)
	{
		// Show or hide the description
		if(oDiv.style.display == "none")
			oDiv.style.display = "block";
		else
			oDiv.style.display = "none";	
	}
}

function SetSelectBoxOption(oSelect, sValue)
{
	if(oSelect.options)
	{
		for(var lCount=0; lCount<oSelect.options.length; lCount++)
			if(oSelect.options[lCount].value == sValue)
			{
				oSelect.options[lCount].selected = true;
				return;	
			}
	}
}

function URLEncode(sVal)
{
	// Use regular expressions to replace problem characters
	var regExpr
	// Replace "&"
	regExpr = /&/g
	sVal = sVal.replace(regExpr, "%26")
	// Replace "#"
	regExpr = /#/g
	sVal = sVal.replace(regExpr, "%23")
	// Replace " "
	regExpr = / /g
	sVal = sVal.replace(regExpr, "%20")
	return sVal;
}

function checkBrowser()
{
	// Requires IE 5.0 or higher
	if(window.navigator.appVersion.substr(0, 1) < 4)
		top.location = "browser.asp";
}	

function DimensionArray(lRecs, lAtts)
{
	var arr = new Array(lRecs);
	for(var lCount=0;lCount<lAtts;lCount++)
		arr[lCount] = new Array();
	return arr;
}

function ReplaceSpace(sVal)
{
	var bSpace=true;
	
	while(bSpace == true)
		{
			sVal = sVal.replace(" ","%20");
			if(sVal.indexOf(" ")>0)
				bSpace=true;
			else
				bSpace=false;
		}
	return sVal;
}

function StripSpecial(sString)
{
	return sString.replace(/[!@#$%^&*()_+-=<>?:;'"{}\\\/]/g, "")
}

function SetClass(oLink)
{
	if(oLink)
		oLink.className = "titleLinksSelect";
}

function PopUpWin(sPage, lWidth, lHeight)
{
	if(!lWidth)
		lWidth = 600;
	if(!lHeight)
		lHeight = 400;
	mywin = open(sPage,'PopUp','width=' + lWidth + ',height=' + lHeight + ',scrollbars=yes,toolbar=yes,location=no,status=no,resizable=yes,menubar=no');
}

function PopUpLarge(sPage, lWidth, lHeight, bShowToolbar, bAdmin)
{
	if(!lWidth)
		lWidth = 450;
	if(!lHeight)
		lHeight = 350;
	if(bShowToolbar)
		var sToolbar = "yes"
	else
		var sToolbar = "no"
	mywin = open(sPage,'PopUp','width=' + lWidth + ',height=' + lHeight + ',scrollbars=yes,toolbar=' + sToolbar + ',location=no,status=no,resizable=yes,menubar=no');
}

function TabForward(oCurrBox, oFwdBox, lLength)
{
	if(oCurrBox.value.length == lLength && window.event.keyCode != 9)
		oFwdBox.focus();
}

function SetRowFocus(sClientID, sControlID)
{
  try
  {
    eval("document.all." + sClientID + "_" + sControlID + ".focus()");
  }
  catch(e)
  {
    // Do nothing (no biggie if it does not focus)
  }
}
