
function FrontPage_Form1_Validator(theForm)
{

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

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

if (theForm.Width.value.length > 4)
{
  alert("Please enter at most 4 characters in the \"Width\" field.");
  theForm.Width.focus();
  return (false);
}

var checkOK = "0123456789-";
var checkStr = theForm.Width.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
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;
  }
  allNum += ch;
}
if (!allValid)
{
  alert("Please enter only digit characters in the \"Width\" field.");
  theForm.Width.focus();
  return (false);
}

var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= "900" && prsVal <= "7200"))
{
  alert("Please enter a value greater than or equal to \"900\" and less than or equal to \"7200\" in the \"Width\" field.");
  theForm.Width.focus();
  return (false);
}

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

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

if (theForm.Height.value.length > 4)
{
  alert("Please enter at most 4 characters in the \"Height\" field.");
  theForm.Height.focus();
  return (false);
}

var checkOK = "0123456789-";
var checkStr = theForm.Height.value;
var allValid = true;
var validGroups = true;
var decPoints = 0;
var allNum = "";
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;
  }
  allNum += ch;
}
if (!allValid)
{
  alert("Please enter only digit characters in the \"Height\" field.");
  theForm.Height.focus();
  return (false);
}

var chkVal = allNum;
var prsVal = parseInt(allNum);
if (chkVal != "" && !(prsVal >= "1000" && prsVal <= "2500"))
{
  alert("Please enter a value greater than or equal to \"1000\" and less than or equal to \"2500\" in the \"Height\" field.");
  theForm.Height.focus();
  return (false);
}

if (theForm.Location.selectedIndex < 0)
{
  alert("Please select one of the \"Location\" options.");
  theForm.Location.focus();
  return (false);
}

if (theForm.Location.selectedIndex == 0)
{
  alert("The first \"Location\" option is not a valid selection.  Please choose one of the other options.");
  theForm.Location.focus();
  return (false);
}

if (theForm.Colour.selectedIndex < 0)
{
  alert("Please select one of the \"Colour\" options.");
  theForm.Colour.focus();
  return (false);
}

if (theForm.Colour.selectedIndex == 0)
{
  alert("The first \"Colour\" option is not a valid selection.  Please choose one of the other options.");
  theForm.Colour.focus();
  return (false);
}

if (theForm.Handles.selectedIndex < 0)
{
  alert("Please select one of the \"Handles\" options.");
  theForm.Handles.focus();
  return (false);
}

if (theForm.Handles.selectedIndex == 0)
{
  alert("The first \"Handles\" option is not a valid selection.  Please choose one of the other options.");
  theForm.Handles.focus();
  return (false);
}

if (theForm.Hinges.selectedIndex < 0)
{
  alert("Please select one of the \"Hinges\" options.");
  theForm.Hinges.focus();
  return (false);
}

if (theForm.Hinges.selectedIndex == 0)
{
  alert("The first \"Hinges\" option is not a valid selection.  Please choose one of the other options.");
  theForm.Hinges.focus();
  return (false);
}

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

if (theForm.Name.value.length > 256)
{
  alert("Please enter at most 256 characters in the \"Name\" field.");
  theForm.Name.focus();
  return (false);
}

var chkVal = theForm.Name.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "Your Name (Required)"))
{
  alert("Please enter a value not equal to \"Your Name (Required)\" in the \"Name\" field.");
  theForm.Name.focus();
  return (false);
}

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

if (theForm.Address.value.length > 256)
{
  alert("Please enter at most 256 characters in the \"Address\" field.");
  theForm.Address.focus();
  return (false);
}

var chkVal = theForm.Address.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "Address (Required)"))
{
  alert("Please enter a value not equal to \"Address (Required)\" in the \"Address\" field.");
  theForm.Address.focus();
  return (false);
}

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

if (theForm.email.value.length > 256)
{
  alert("Please enter at most 256 characters in the \"email\" field.");
  theForm.email.focus();
  return (false);
}

var chkVal = theForm.email.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "Your email address (Required)"))
{
  alert("Please enter a value not equal to \"Your email address (Required)\" in the \"email\" field.");
  theForm.email.focus();
  return (false);
}

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

if (theForm.Town.value.length > 256)
{
  alert("Please enter at most 256 characters in the \"Town\" field.");
  theForm.Town.focus();
  return (false);
}

var chkVal = theForm.Town.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "Town (Required)"))
{
  alert("Please enter a value not equal to \"Town (Required)\" in the \"Town\" field.");
  theForm.Town.focus();
  return (false);
}

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

if (theForm.Telephone.value.length > 256)
{
  alert("Please enter at most 256 characters in the \"Telephone\" field.");
  theForm.Telephone.focus();
  return (false);
}

var chkVal = theForm.Telephone.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "Your telephone no. (Required)"))
{
  alert("Please enter a value not equal to \"Your telephone no. (Required)\" in the \"Telephone\" field.");
  theForm.Telephone.focus();
  return (false);
}

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

if (theForm.County.value.length > 256)
{
  alert("Please enter at most 256 characters in the \"Town\" field.");
  theForm.County.focus();
  return (false);
}

var chkVal = theForm.County.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "County (Required)"))
{
  alert("Please enter a value not equal to \"County (Required)\" in the \"Town\" field.");
  theForm.County.focus();
  return (false);
}

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

if (theForm.Postcode.value.length > 9)
{
  alert("Please enter at most 9 characters in the \"PostCode\" field.");
  theForm.Postcode.focus();
  return (false);
}

var chkVal = theForm.Postcode.value;
var prsVal = chkVal;
if (chkVal != "" && !(prsVal != "Postcode (Required)"))
{
  alert("Please enter a value not equal to \"Postcode (Required)\" in the \"PostCode\" field.");
  theForm.Postcode.focus();
  return (false);
}
return (true);
}
