function trim(stringToTrim)
{
	while ( ( stringToTrim.length > 0 ) && ( stringToTrim.indexOf(' ') == 0 ) )
	{
		stringToTrim = stringToTrim.substring( 1 );
	}
	
	while ( ( stringToTrim.length > 0 ) && ( stringToTrim.lastIndexOf(' ') == ( stringToTrim.length - 1) ) )
	{
		stringToTrim = stringToTrim.substring( 0, stringToTrim.length - 1 );
	}
		
	return ( stringToTrim );
}

function checkCharacters(value, allowedChars)
{
	var workingValue = value;
	
	if (workingValue == null)
	{
		return (false);
	}

	allowedChars = trim(allowedChars);

	var returnValue = true;

	if (allowedChars.length > 0)
	{
		for (counter = 0; counter < allowedChars.length; counter++)
		{
			while ( workingValue.indexOf( allowedChars.charAt(counter) )>-1 )
			{
				workingValue = workingValue.replace(allowedChars.charAt(counter), ' ');
			}
		}

		workingValue = trim(workingValue);

		if (workingValue.length > 0)
		{
			returnValue = false;
		}
		else
		{
			returnValue = true;
		}
	}

	return (returnValue);
}