function submitform()
{
	var errorMsg = "Unable to send your feedback because :\n";  // default error message
	var errorReason = "";  // to hold actual error reasons
	var focusItem = "";   // to hold name of input to focus on

	// check user has entered a name
	if ( document.forms[0].txtName.value=="" )
	{
		errorReason += "  * You have not entered a name\n";
		focusItem = "txtName";
	}// else if (InvalidName(document.forms[0].txtName.value)) {
//	errorReason += "  * Your name may only contain letters and spaces.\n";
//		focusItem = "txtName";
//	}

	// check that the email is valid
	if (document.forms[0].txtEmail.value=="" || InvalidEmail(document.forms[0].txtEmail.value))
	{
		errorReason += "  * Your Email address is not valid\n";
		if ( focusItem == "" ) focusItem = "txtEmail";
	}

	if (document.forms[0].txtComment.value=="")
	{
		errorReason += "  * You have not entered any feedback!\n";
		if ( focusItem == "" ) focusItem = "txtComment";
	}

	// if there are any errors display them, otherwise submit the form
	if (!(errorReason=="" ))
	{
		alert(errorMsg + errorReason);
		eval("document.forms[0]." + focusItem + ".focus()");
		return false;
	} else {
		return true;
	}
}

// checks for a valid email address using regular expressions
function InvalidEmail(email)
{
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
	return !(filter.test(email));
}

/*
// checks for a valid name using regular expressions
function InvalidName (name)
{
	var filter = /^([a-zA-Z\s])+$/;
	return !(filter.test(name));
}
*/

