/******************************************************************************
*	client.js
*
*	Contains application client-side script for the IRP CMS Web.
*
******************************************************************************/

// ControlKeyPress(field, e, btnId)
//	Took basic functionality of the old method, but tried to 
//	better handle the scripting DOM.
function IRPKeyPress(field, e, btnId)
{
	var keycode;
	var btn;

	if (!window.event && !e)	// just exit here
		return true;

	if (window.event)	// ie-type event capable
		keycode = window.event.keyCode;
	else
		keycode = e.which;

	if (keycode == 13)
	{
		// this is how we check for newer browser...
		if (document.getElementById)
		{
			btn = document.getElementById(btnId);

			if (btn)
			{
				btn.click();
				return false;
			}
		}
		else
		{
			// if we care about ns4, then change
			// this else clause to handle it.
		}
	}

	return true;
}

function CheckLength(field, maxLength)
{
	return (field.value.length <= maxLength);
}