function validateForm() 
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  if (yname.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter your name.")
    yname.focus()
  }

  if (yemail.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter your email address.")
    yemail.focus()
  }
  
  var foundAt = yemail.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid email address.")
    yemail.focus()
  }

  if (fname.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter your friend name.")
    fname.focus()
  }

  if (femail.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Please enter your friend email address.")
    femail.focus()
  }
  
  var foundAt = femail.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Please enter a valid friend email address.")
    femail.focus()
  }

  if (okSoFar==true)  submit();
 }
}