function Validator(theForm)
{
  if (theForm.OrdNo.value == "")
  {
    alert("Please enter Order Reference part 1.");
    theForm.OrdNo.focus();
    return (false);
  }
  if (theForm.OrdNo.value.length < 6)
  {
    alert("Please enter 6 digits in Order Reference part 1.");
    theForm.OrdNo.focus();
    return (false);
  }
  var checkOK = "0123456789";
  var checkStr = theForm.OrdNo.value;
  var allValid = 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 numbers in the \"Order Reference\" field.");
    theForm.OrdNo.focus();
    return (false);
  }
  if (theForm.OrdLine.value == "")
  {
    alert("Please enter order reference part 2.");
    theForm.OrdLine.focus();
    return (false);
  }
  if (theForm.OrdLine.value.length < 3)
  {
    alert("Please enter 3 digits in order reference part 2.");
    theForm.OrdLine.focus();
    return (false);
  }
  var checkOK = "0123456789";
  var checkStr = theForm.OrdLine.value;
  var allValid = 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 numbers in the \"Order Reference\" field.");
    theForm.OrdLine.focus();
    return (false);
  }
  if (theForm.PinNr.value == "")
  {
    alert("Please enter PIN number.");
    theForm.PinNr.focus();
    return (false);
  }
  if (theForm.PinNr.value.length < 4)
  {
    alert("Please enter a 4 digit PIN number.");
    theForm.PinNr.focus();
    return (false);
  }
  var checkOK = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var checkStr = theForm.PinNr.value;
  var allValid = 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 numbers and capital letters in the \"PIN Number\" field.");
    theForm.PinNr.focus();
    return (false);
  }
  return (true);
}
