function SubmitForm() {

// check if title field is blank
if (document.eventinfo.title.value == "")
{
alert("The event name is a required field.");
document.eventinfo.title.focus();
return (false);
}

// check if starting date field is blank
if (document.eventinfo.date_start.value == "")
{
alert("The starting date is a required field.");
document.eventinfo.date_start.focus();
return (false);
}

// check if the city field is blank
if (document.eventinfo.city.value == "")
{
alert("City is a required field.");
document.eventinfo.city.focus();
return (false);
}

// check if email field is blank
if (document.eventinfo.contact_email.value == "")
{
alert("Your email address is required. If you do not have one, there are many free email services such as Yahoo.com and Hotmail.com");
document.eventinfo.contact_email.focus();
return (false);
}

// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = document.eventinfo.contact_email.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("The \"email\" field must contain an \"@\" and a \".\" and is required.");
document.eventinfo.contact_email.focus();
return (false);
}

}