// 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("je naam ontbreekt.");
    document.frmMain.poster_name.focus();
  }
  else if (!IsValidEmail(document.frmMain.email.value))
  {
    document.getElementById("idEmailStar").style.color = "Red";
    alert("je e-mailadres klopt niet.");
    document.frmMain.email.focus();
  }
  else if (document.frmMain.body.value.length < 5)
  {
    document.getElementById("idBodyStar").style.color = "Red";
    alert("er is nog geen bericht ingevuld.");
    document.frmMain.body.focus();
  }
  else
  {
    document.frmMain.submit();
  }
}
