function validate_form(theForm)
{

  if (theForm.fname.value == "")
  {
    alert("The First Name field is required.");
    theForm.fname.focus();
    return (false);
  }

  if (theForm.lname.value == "")
  {
    alert("The Last Name field is required.");
    theForm.lname.focus();
    return (false);
  }

  if (theForm.baddress.value == "")
  {
    alert("The Address field is required.");
    theForm.baddress.focus();
    return (false);
  }

  if (theForm.bcity.value == "")
  {
    alert("The City field is required..");
    theForm.bcity.focus();
    return (false);
  }

  if (theForm.bstate.value == "")
  {
    alert("The State field is required..");
    theForm.bstate.focus();
    return (false);
  }

  if (theForm.bzip.value == "")
  {
    alert("The ZipCode field is required..");
    theForm.bzip.focus();
    return (false);
  }

  if (theForm.bzip.value.length < 5)
  {
    alert("ZipCode should be at least 5 characters.");
    theForm.bzip.focus();
    return (false);
  }

  var checkOK = "0123456789-";
  var checkStr = theForm.bzip.value;
  var allValid = 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 digits in the ZipCode field.");
    theForm.bzip.focus();
    return (false);
  }

if (theForm.email.value == "")
  {
    alert("The Email field is required..");
    theForm.email.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@,_,.";
  var checkStr = theForm.email.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 letter, digit and \"@,_,.\" characters in the \"Email\" field.");
    theForm.email.focus();
    return (false);
  }

if (theForm.phone.value == "")
  {
    alert("The Phone field is required..");
    theForm.phone.focus();
    return (false);
  }

  if (theForm.phone.value.length < 10)
  {
    alert("Phone Number should be at least 10 characters.");
    theForm.phone.focus();
    return (false);
  }

  var checkOK = "0123456789--)( \t\r\n\f";
  var checkStr = theForm.phone.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 digit, whitespace and \"-)(\" characters in the \"Phone\" field.");
    theForm.phone.focus();
    return (false);
  }

  if (theForm.amount.value == "")
  {
    alert("Please enter a Gift Certificate Amount.");
    theForm.amount.focus();
    return (false);
  }

  if (theForm.amount.value.length < 2)
  {
    alert("Gift Certificate Amount should be at least $50.00.");
    theForm.amount.focus();
    return (false);
  }

  var checkOK = "0123456789-.,";
  var checkStr = theForm.amount.value;
  var allValid = 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;
    }
    if (ch == ".")
    {
      allNum += ".";
      decPoints++;
    }
    else if (ch != ",")
      allNum += ch;
  }
  if (!allValid)
  {
    alert("Please enter only digits in the Gift Certificate Amount field.");
    theForm.amount.focus();
    return (false);
  }

  if (decPoints > 1)
  {
    alert("Please enter a valid number in the Gift Certificate Amount field.");
    theForm.amount.focus();
    return (false);
  }

  var chkVal = allNum;
  var prsVal = parseFloat(allNum);
  if (chkVal != "" && !(prsVal >= "50" && prsVal <= "500"))
  {
    alert("Gift Certificate Amount should be greater than or equal to $50.00 and less than or equal to $500.00");
    theForm.amount.focus();
    return (false);
  }

  var radioSelected = false;
  for (i = 0;  i < theForm.ship.length;  i++)
  {
    if (theForm.ship[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)

  {
    alert("Please select a delivery method.");
    return (false);
  }

  return (true);
}