/* trimSpaces - removes leading and trailing spaces from text fields */
function trimSpaces(checkField)
{
	var nonSpaceFound = false;
	var checkField;
	
	if (checkField) 	// null field falls through as false
	{ 	// trim left
		do
		{
			if (checkField.charAt(0) != " ") 
				nonSpaceFound = true
			else
			{ 
				// shift return field left one position to eliminate leading spaces
				checkField = checkField.substr(1);
			}
		}
		while (!nonSpaceFound)
	}
	
	
	if (checkField) 	// null field falls through as false
	{	// trim right
		nonSpaceFound = false;
	
		do
		{
			if (checkField.charAt(checkField.length - 1) != " ") 
				nonSpaceFound = true
			else
			{ 
				// shift return field left one position to eliminate leading spaces
				checkField = checkField.substr(0,checkField.length - 1);
			}
		}
		while (!nonSpaceFound && checkField.length > 0)
	}
	return checkField;
}
