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_subject(subject,alerttxt)
{
with (subject)
{
  if (value==null||value=="")
  {
  alert(alerttxt);return false;
  }
  else
  {
  return true;
  }
}
}
function validate_url(url,alerttxt)
{
with (url)
{
  if (value==null||value=="")
  {
  alert(alerttxt);return false;
  }
  else
  {
  return true;
  }
}
} 


function validate_name(name,alerttxt)
{
with (name)
{
  if (value==null||value=="")
  {
  alert(alerttxt);return false;
  }
  else
  {
  return true;
  }
}
}
function validate_message(message,alerttxt)
{
with (message)
{
  if (value==null||value=="")
  {
  alert(alerttxt);return false;
  }
  else
  {
  return true;
  }
}
}

function validate_form(thisform)
{
with (thisform)
{
	if (validate_subject(subject,"Please fill in the subject")==false)
  {subject.focus();return false;}
if (validate_name(name,"Please fill in your name")==false)
  {name.focus();return false;}
if (validate_email(email,"Not a valid e-mail address!")==false)
  {email.focus();return false;}
if (validate_url(url,"And your website is..?")==false)
  {url.focus();return false;}
if (validate_message(message,"Nothing to say?")==false)
  {message.focus();return false;}
}
}

