//  General variables
var reWhitespace = /^\s+$/;
var defaultEmptyOK = false;

function chnCase(ctl)
{
    ctl.value = ctl.value.toUpperCase();
}

// Check whether string s is empty.
function isEmpty(s)
{   return ((s == null) || (s.length == 0));
}


// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace (s)
{   // Is s empty?
    return (isEmpty(s) || reWhitespace.test(s));
}

// checkString (TEXTFIELD theField, STRING s, [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is not all whitespace.
function checkString (theField, s, emptyOK)
{   // Next line is needed on NN3 to avoid "undefined is not a number" error
    // in equality comparison below.
    if (checkString.arguments.length == 2) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    if (isWhitespace(theField.value)) 
       // not used for this form return warnEmpty (theField, s);
       return false;
    else return true;
}
// Validates data entered on the form.
function ValidateForm(form)
{
	var valid = true;

	if (checkString(form.elements["Name"],"Name") == false)
	{
		valid = false;
		alert("Please enter your name!");
		form.elements["Name"].focus();
		return false;
	}

	if (checkString(form.elements["email"],"Email") == false)
	{
		valid = false;
		alert("Please tell us how you can be contacted.\nEnter your e-mail address.");
		form.elements["email"].focus();
		return false;
	}

//	if (checkString(form.elements["contact"],"Contact") == false)
//	{
//		valid = false;
//		alert("Please tell us how you can be contacted.\nEnter your phone number or your e-mail address");
//		form.elements["contact"].focus();
//		return false;
//	}

	if (checkString(form.elements["question"],"Name") == false)
	{
		valid = false;
		alert("Please type a question or comment!");
		form.elements["question"].focus();
		return false;
	}

  	if (valid == true)
	  { return true; }
	  else
	  { return false;}
	}

