
	// Returns true if string s is English letters (A .. Z, a..z) only.
	function isAlphabetic(s)	
	{
   		var i;
		// Search through string's characters one by one until we find
		// a non-alphabetic character. When we do, return false; if we
		// don't, return true.
		for (i = 0; i < s.length; i++)
    	{   
        	// Check that current character is letter.
        	var c = s.charAt(i);
			if (!isLetter(c) && !isSpace(c) && !isValidPunctuation(c))
       	 	{
				return false;
			}
	    }
		// All characters are letters and spaces
    	return true;
	}

	// Returns true if character c is a digit (0 .. 9).
	function isDigit (c)
	{
  		return ((c >= "0") && (c <= "9"))
	}		
	
	function isEmpty(s)
	{
		var cnt = 0;
		for (i = 0; i < s.length; i++)
    	{   
        	// Check that current character is letter.
        	var c = s.charAt(i);

        	if (isSpace(c))
       	 	{
				cnt++;
			}
	    }
		return ((s == null) || (s.length == 0) || (s.length == cnt))
	}

	function isLetter (c)
	{
		return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
	}
	
	// Returns true if s is the required length.
	function isCorrectLength(s, requiredLength)
	{
		var stringLength = s.length;
		if (s.length == requiredLength)
		{
			return true;
		}
		return false;
	}
   
   function isNumeric(s)
	{
  		var i;
  		if (isEmpty(s)) 
  		{
    		if (isNumeric.arguments.length == 1) return true;
    		else return (isNumeric.arguments[1] == true);
  		}
  		// Search through string's characters one by one until we find
		// a non-numeric character. When we do, return false; if we
		// don't, return true.
  		for (i = 0; i < s.length; i++)
  		{   
    		// Check that current character is number.
    		var c = s.charAt(i);
    		if (!isDigit(c))
     			return false;
  		}
  		// All characters are numbers.
  		return true;
	}
	
	function isSpace(c)
	{
		return (c == " ");
	}
   
	function isValidPunctuation(c)
	{
		return ((c == ".") || (c == ","));
	}

	function isAlphaNumericOrSpace(s)
	{
   		var i;
		// Search through string's characters one by one until we find
		// a non-alphanumeric or white space character. When we do, return false;
		// if we don't, return true.
		for (i = 0; i < s.length; i++)
    	{   
        	// Check that current character is letter.
        	var c = s.charAt(i);
			if ( !(isLetter(c) || isDigit(c) || isSpace(c) || isValidPunctuation(c)) )
       	 	{
				return false;
			}
	    }
		// All characters are letters and spaces
    	return true;
	}
