    // isWhitespace - Check to see if a string consists soley of whitespace characters
    function isWhitespace(s)
    {
      var i;
      var whitespace = " \t\n\r";
      if (isEmpty(s)) return true;
      for (i = 0; i < s.length; i++)
      {
        // Check that current character is not whitespace.
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
      }
      // All characters are whitespace.
      return true;
    }

