// Copyright Basement.nl, 2009

function Init()
{
  document.frmMain.poster_name.focus();
}

function IsValidEmail(email)
{
  var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  return (filter.test(email));
}

function btnSubmitClick()
{
  if (document.frmMain.poster_name.value.length < 2)
  {
    document.getElementById("idPosterNameStar").style.color = "Red";
    alert("your name is missing.");
    document.frmMain.poster_name.focus();
  }
  else if (!IsValidEmail(document.frmMain.email.value))
  {
    document.getElementById("idEmailStar").style.color = "Red";
    alert("your email address is not valid.");
    document.frmMain.email.focus();
  }
  else if (document.frmMain.body.value.length < 5)
  {
    document.getElementById("idBodyStar").style.color = "Red";
    alert("you didn't enter a message.");
    document.frmMain.body.focus();
  }
  else
    document.frmMain.submit();
}
