<!--
//
//  Desc: form validation
//  Author: Kubarski Vladimir, e-mail: vk1981@mail.ru
//  Ver: v04 2002-05-28 + 2 functions for numeric and e-mail validation
//

function VK_validate_form (strAlr, objForm)
{
  for (arg = 2; arg < arguments.length; arg++)
    if (!objForm.elements[arguments[arg]].value)
    {
      objForm.elements[arguments[arg]].focus ();

      if (strAlr != "")
        alert (strAlr);

      return false;
    }
  return true;
}

function VK_validate_email (strEmail)
{

  if (strEmail == "")
  {
    return false;
  }

  bad_chars = ";:/,' \"\\";
  c = bad_chars.length;
  for (i = 0; i < c; i ++)
  {
    bad_char = bad_chars.charAt (i);

    if (strEmail.indexOf (bad_char, 0) != -1)
    {
      return false;
    }
  }

  at_pos = strEmail.indexOf ("@", 1);

  if (at_pos == -1)
  {
    return false;
  }

  if (strEmail.indexOf ("@",at_pos + 1) != -1)
  {
    return false;
  }

  period_pos = strEmail.indexOf (".", at_pos);

  if (period_pos == -1)
  {
    return false;
  }

  if (period_pos + 2 > strEmail.length)
  {
    return false;
  }

  return true
}

function VK_is_numeric (value)
{
  c = value.length;
  for (i = 0; i < c; i ++)
  {
    if ((value.charAt (i) != "0") && (!parseFloat (value.charAt (i))))
    {
      return false;
    }
  }
  return true;
}
//-->


