/*
********************************************************************
Purpose:	Checks if input value is blank
Arguments:	pInput is a value to be tested: 
				-- can be passed as a string value 
					(NOTE: JS reads all input values as type "string") 
					OR the object whose value will be tested
				-- if object, it will get focus on success		 
			(pstrMessage optional)
Returns:	boolean	
Created:	4/2000
By:			Kevin P. Gillespie, Neal Tillotson 
Supports:	Javascript 1.1 or higher

Wrappers:	inc_UW_TextValidation.js

Usage:		IsBlank(object, "custom message")
			IsBlank(object.value, "custom message")
			IsBlank("MyStringValue", "custom message")
				If "custom message" = 'no', don't display message
********************************************************************
*/

function IsBlank(pInput,pstrMessage)
{
	var blnBlank = true;
	var strMessage;
	var strValue;
	var blnIsObject = false;

	if (!(typeof pstrMessage == "undefined" || pstrMessage == ""))
	{
		strMessage = pstrMessage;
	}
	else
	{
		strMessage = "Please enter some information.";
	}

	if (typeof pInput == "object")
	{
		// object has been passed - get value
		strValue = pInput.value
		blnIsObject = true
	}
	else
	{
		// value has been passed
		strValue = pInput
	}

	for (var i=0;i<strValue.length;i++)
	{
		var c = strValue.charAt(i);
		if ((c != ' ') && (c != '\n')  && (c != '\t') && (c != '\r')) 
		{
			blnBlank = false;
			break;
		}
	}

	if (blnBlank)
	{
		// If input is blank, and the message is not disabled via "no", show message.
		if (!(strMessage == "no")) {alert(strMessage)};
		if (blnIsObject)
		{
			pInput.focus();
			pInput.select();
		}
		return true;
	}

	return false;
}



