//  Function for validation of Realname, Email, Subject and Message fields

function Request_Form_Validator(theForm)
{

  if (theForm.realname.value == "")
  {
    alert("Please enter a value for the \"Your name\" field.");
    theForm.realname.focus();
    return (false);
  }

  if (theForm.realname.value.length < 2)
  {
    alert("Please enter at least 2 characters in the \"Your name\" field.");
    theForm.realname.focus();
    return (false);
  }

  if (theForm.email.value == "")
  {
    alert("Please enter a value for the \"email address\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.email.value.length < 8)
  {
    alert("Please enter at least 8 characters in the \"email address\" field.");
    theForm.email.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@-._";
  var checkStr = theForm.email.value;
  var allValid = true;
  var validGroups = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and \"@-._\" characters in the \"email address\" field.");
    theForm.email.focus();
    return (false);
  }

  if (theForm.subject.value == "")
  {
    alert("Please enter a value for the \"Subject\" field.");
    theForm.subject.focus();
    return (false);
  }

  if (theForm.message.value == "")
  {
    alert("Please enter a value for the \"message\" field.");
    theForm.message.focus();
    return (false);
  }
  return (true);
}
