/* 
-------------------------------------------------------------------------------
Script to check the value of the search form.
This .js file should be linked to from all pages on the 
Bunge North America Web site.

Put any words that would cause an Index Server error message 
in the "invalidWord" array. The function checks for 0 and 1 character 
searches already, so only words with 2 or more characters are necessary.
-------------------------------------------------------------------------------
*/

var invalidWord = new Array();

invalidWord[0] = "";
invalidWord[1] = " ";
invalidWord[2] = null;
invalidWord[3] = "in";
invalidWord[4] = "for";
invalidWord[5] = "at";
invalidWord[6] = "no";
invalidWord[7] = "the";
invalidWord[8] = "it";
invalidWord[9] = "an";
invalidWord[10] = "and";
invalidWord[11] = "to";
invalidWord[12] = "be";
invalidWord[13] = "of";
invalidWord[14] = "if";
invalidWord[15] = "is";

function checkForm(theValue) {
	var isValid = true;
	
	if (theValue.toString().length == 0 || theValue.toString().length == 1) {
		isValid = false;
	} else {
		for (var i=0; i<=invalidWord.length-1; i++) {
			if (theValue.toString() == invalidWord[i]) {
				isValid = false;
			}
		}
	}
	
	if (isValid == false) {
		alert('Please enter a search term.');
		return false;
	} else {
		return true;
	}
}
