/*
********************************************************************
Purpose:	Checks if input value is greater than a certain length
Arguments:	pInput is a value to be tested: 
				-- can be passed as a value OR the object whose value will be tested
				-- if object, it will get focus on success		 
			(pstrMessage optional)
Returns:	boolean	
Created:	4/2000
By:			Neal Tillotson 
Supports:	Javascript 1.1 or higher

Wrappers:	inc_UW_TextValidation.js

Usage:		IsTooLong(object)
			IsTooLong(object.value, "custom message")
			IsTooLong("302-123-4567", "custom message")
				If "custom message" = 'no', don't display message
********************************************************************
*/

function IsTooLong(pInput,pstrMessage,plngMax)
{
	var strMessage;
	var strValue;
	var blnIsObject = false;

	if (typeof pInput == "object")
	{
		// object has been passed - get value
		strValue = pInput.value
		blnIsObject = true
	}
	else
	{
		// value has been passed
		strValue = pInput
	}

	// If No Message is Supplied, Use Custom Message Here
	if (!(typeof pstrMessage == "undefined" || pstrMessage == ""))
	{
		strMessage = pstrMessage;
	}
	else
	{
		strMessage = "Your text must be fewer than "+plngMax+" characters.";
	}

	if (strValue.length >= plngMax)
	{
		if (!(strMessage == "no")) {alert(strMessage)};
		if (blnIsObject)
		{
			pInput.focus();
			pInput.select();
		}
		return true;
	}
	return false;
}

