function checkForm(theform) {
	var why = "";
	why += checkName(theform.name.value);
	why += checkEmail(theform.email.value);
	why += checkQuestion(theform.question.value);
	if (why != "") {
		alert(why);
		return false;
	}
	else theform.submit();
	return true;
}


function checkName (strng) {
	var error = "";
	if (strng == "") {
		error = "You must provide a name.\n";
	}
	return error;
}

function checkQuestion (strng) {
	var error = "";
	if (strng == "") {
		error = "You must provide a question.\n";
	}
	return error;
}

function checkEmail (strng) {
	var error="";
	if (strng == "") {
   	error = "You must provide an email address.\n";
	}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "You must provide a valid email address.\n";
    }
    else {
	//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
       if (strng.match(illegalChars)) {
          error = "The email address you provided contains illegal characters.\n";
       }
    }
	return error;    
}