function switch_action(e)
{
  if (e.value == 'Edit')
    {
      document.forms["confirm"].action = "tst.php";
    }
}

function show_props(obj, obj_name)
{
  var result = "";
  var type = "";

  // Each property in object can be a null, function, boolean, string, number, or object

  for (var i in obj)
    {
      type = typeof(obj[i]);

      // Just show basic properties for now
      if (type!="object" && type!="function")
        {
          result += obj_name + "." + i + " = " + obj[i] + "\n";
        }
    }

  alert(result);
}

function verifyform(f)
{
  var e;
  var errors = "";
  var fields = new Array();
  var equipmentchecked = 0;

	
  // The user needs to check what equipment they need.  
  // These are radio buttons and should be the only ones in the form.

  for (var i = 0; i < f.length; i++)
    {
      e = f.elements[i];

      if ( ( (e.type == "radio") || (e.type == "checkbox") ) && (e.checked) )
        {
          equipmentchecked++;
        }
    }

  if (equipmentchecked == 0)
    {
      errors += "Please select the equipment you need\n";
    }

  // key is the field name, value is the message if empty

  fields["UnitID"]              = "Please enter the Unit ID";
  fields["CurrentTerminal"]     = "Please enter the Current Terminal";
  fields["DestinationTerminal"] = "Please enter the Destination Terminal";
  fields["RequestingPerson"]    = "Please enter the Requesting Person";
  fields["Date"]                = "Please enter the Date";

  for (field in fields)
    {
      if (f.elements[field].value == "")
        {
          errors += "Please enter the " + field + "\n";
        }
    }


  if (errors != "")
    {
      alert(errors);
      return false;
    }
  else
    {
      return true;
    }

}
