function validate_name(field,alerttxt)
{
with (field)
{

if (value==null||value==""||value.length<2||!value.toString().match(/[A-Za-z]$/))
  {
  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==""||value.length<6||value.length>13||!value.toString().match(/^\d+[\s]?\d+[\s]?\d+$/))
  {
  alert(alerttxt);
  return false;
  }

  else
  {
  return true;
  }
  
}
}
*/

function validate_query(field,alerttxt)
{
with (field)
{

if (value==null||value==""||value.length<5)
  {
  alert(alerttxt);
  return false;
  }

  else
  {
  return true;
  }
  
}
}


function validate_form(thisform)
{
with (thisform)
{

if (validate_name(txtName,"Please enter your name")==false)
  {
  txtName.select();
  return false;
  }

  else if (validate_email(txtEmail,"Please provide a valid email address")==false)
  {
  txtEmail.select();
  return false;
  }
  /*
  else if (validate_phone(txtPhone,"Please provide a phone number")==false)
  {
  txtPhone.select();
  return false;
  }
  */  
  else if (validate_query(txtQuery,"Please type your query")==false)
  {
  txtQuery.select();
  return false;
  }

}
}