		// whitespace characters
		var whitespace = " \t\n\r";


		// Check whether string s is empty.
		function isEmpty(s)
		{   return ((s == null) || (s.length == 0))
		}


		function isWhitespace (s)

		{   var i;

		    // Is s empty?
		    if (isEmpty(s)) return true;

		    // Search through string's characters one by one
		    // until we find a non-whitespace character.
		    // When we do, return false; if we don't, return true.

		    for (i = 0; i < s.length; i++)
		    {   
		        // Check that current character isn't whitespace.
		        var c = s.charAt(i);

		        if (whitespace.indexOf(c) == -1) return false;
		    }

		    // All characters are whitespace.
		    return true;
		}


		// Notify user that contents of field theField are invalid.
		// String s describes expected contents of theField.value.
		// Put select theField, pu focus in it, and return false.

		function warnInvalid (theField, s)
		{   theField.focus()
		    theField.select()
		    alert(s)
		    return false
		}


		// Notify user that required field theField is empty.
		// String s describes expected contents of theField.value.
		// Put focus in theField and return false.

		function warnEmpty (theField, s)
		{   theField.focus()
		    alert(s)
		    return false
		}

		// checkString (TEXTFIELD theField, STRING s, [, BOOLEAN emptyOK==false])
		//
		// Check that string theField.value is not all whitespace.
		//
		// For explanation of optional argument emptyOK,
		// see comments of function isInteger.

		function checkString (theField, s, emptyOK)
		{   // Next line is needed on NN3 to avoid "undefined is not a number" error
		    // in equality comparison below.
		    if (checkString.arguments.length == 2) emptyOK = true;
		    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
		    if (isWhitespace(theField.value)) 
		       return warnEmpty (theField, s);
		    else return true;
		}


