    // whitespace characters      
    var whitespace = " \t\n\r";

    // odd characters      
    var oddchars = "!,@#%$^*()=";

    function isEmpty(mystr)
    {
         return (mystr == null || mystr == "");
    }

function isValidSearch(s)
      {
           var i, numofWhitespace = 0, numofMinus = 0, numofPlus = 0, numofQuotes = 0, numofCountedChars = 0;

           for (i = 0; i < s.length; i++)
           {
                var c = s.charAt(i);

                // Check if current character is whitespace.
                if (whitespace.indexOf(c) != -1) 
                    {
                    numofWhitespace = numofWhitespace + 1;
                    continue;
                    }
                // Check if current character is an odd character.
                if (oddchars.indexOf(c) != -1) 
                    {
                    return false;
                    }
                if (c == "+")
                    {
                    numofPlus = numofPlus + 1;
                    continue;
                    }
                if (c == "-")
                    {
                    numofMinus = numofMinus + 1;
                    continue;
                    }
                numofCountedChars = numofCountedChars + 1;
           }

        if (numofCountedChars < 2) return false;
        
        return true;                        
      }

    function validatefirst()
    {
        if (isEmpty(document.formsearch.srchstr.value))
        {
            alert("Please type the word(s) to search.")
            return false;
        }
        
        if (!isValidSearch(document.formsearch.srchstr.value))
        {
            alert("You have entered invalid characters to search.\n Please check your search keywords")
            return false;
        
        }
        return true;        
    }