function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}

function validate_email(field,alerttxt)
{
with (field)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false;}
else {return true;}
}
}

function validate_phone(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
  {alert(alerttxt);return false;}
else {return true}
}
}

function validate_form(thisform)
{
with (thisform)
{
if 
  	(validate_required(name,"Please enter a name")==false)
  	{name.focus();return false;}
}
with (thisform)
{
if
	(validate_email(email,"Please enter a valid email address")==false)
  	{email.focus();return false;}
}
with (thisform)
{
if
	(validate_phone(phone,"Please enter a phone number")==false)
  	{phone.focus();return false;}
}
with (thisform)
{
if
	(validate_required(message,"Please enter a message")==false)
  	{message.focus();return false;} 
}
}