function validate_email(email,alerttxt)
{
with (email)
{
apos=value.indexOf("@")
dotpos=value.lastIndexOf(".")
if (apos<1||dotpos-apos<2) 
  {alert(alerttxt);return false}
else {return true}
}
}


function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value==""||value=="Full Name"||value=="Telephone"||value=="E-mail"||value=="Comments")
  {alert(alerttxt);return false}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(name,"Please fill in all the fields!")==false)
  {name.focus();return false}
}

with (thisform)
{
if (validate_required(phone,"Please fill in all the fields!")==false)
  {phone.focus();return false}
}

with (thisform)
{
if (validate_email(email,"Please enter a valid e-mail address!")==false)
  {email.focus();return false}
}

with (thisform)
{
if (validate_required(comments,"Please fill in all the fields!")==false)
  {comments.focus();return false}
}

}
