// Validate Search Form
function ValidateSearchForm(form) {
	var strMake;
	var iMakeIndex;

	iMakeIndex = form.elements["MAKE"].selectedIndex;
	strMake = form.elements["MAKE"].options[iMakeIndex].value;

	if ( isEmpty(strMake) ) {
		return(warnEmpty(form.elements["MAKE"], "Make"));
	}
	else {
		if ( isWhitespace(strMake) ) {
 			return(warnEmpty(form.elements["MAKE"], "Make"));
		}
		else {
			return(true);
		}
	}

}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

function isWhitespace (s)  {
		var whitespace = " \t\n\r";
		var i;
		if (isEmpty(s)) return true;
		for (i = 0; i < s.length; i++)
		{
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
		}
		return true;
}

function warnEmpty (theField, s)
{		var mPrefix = "You did not enter a value into the "
		var mSuffix = " field. This is a required field. Please enter it now."

		theField.focus()
	alert(mPrefix + s + mSuffix)
	return false
}

function isString(anything) {
  // Is the Arguement a String
  if(typeof(anything) == "string")
    return(true);
  else
    // Problem dealing with objects that are strings
    if(typeof(anything) == "object") {
      if(String(anything) == "undefined") {
        return(false);
      }
      else
        return(true);
    }
    // Assume that all other types can be converted
    else
      return(false);
}

