/* Add the operations list for the first row with
         a column span of size $frmPartElementCount */
      /* A list of operations that have been added for this part */
      if ($idx == 0) {
        print("\t<td>");
        print("Operations added:<br>");
        print("\t</td>");
      }
      if ($idx == 1) {
        print("\t<td valign=\"top\" rowspan=\"$frmPartElementCount\">");
        print("<select id = \"operationList\" size = \"$frmPartElementCount\" style=\"width:250\">\n");
        print("</select>");
	print("<br>");
	writeButton("addOperation", "Create Operation", "javascript:showAddOperation();");
	writeButton("addOperation", "Delete Operation", "javascript:deleteSelectedOperation();");
        print("\t</td>");
      }
      print("\t</tr>\n");
    }
    
    /* A hidden textbox to store the Operations for posting */
    writeTextBox("operationStore", "");
    writeTextBox("customerStore", "");
    writeTextBox("operationDeleteList", "");

    print("</table>\n");
    writeSubmit("addPart", "Add part");
    print("</form>\n");
    print("</div>\n");
?>
      } else {
        $class = "odd";
      }
      print("<tr class = \"$class\">");
      for ($paramIdx = 0; $paramIdx < $numParams; $paramIdx++) {
        if ($paramIdx == 0) {
           print("<td class = \"toolUsagePartNumber\">\n");
        } else {
           print("<td>\n");
        }
        if ($paramIdx == 1) {
	  $name = $toolUsageRows[$idx][0] . $inStoreSuffix;
	  writeTextBox($name, $toolUsageRows[$idx][$paramIdx]);
	} else if ($paramIdx == 2) {
	  $name = $toolUsageRows[$idx][0] . $inUseSuffix;
	  writeTextBox($name, $toolUsageRows[$idx][$paramIdx]);
        } else {
	  print($toolUsageRows[$idx][$paramIdx]);
        }
	print("</td>\n");
      }
      print("</tr>");
      print("\n");
    }
    print("</table>\n");

    print("<p>");
    writeSubmit("updateAll", "Update/Commit changes");
    print("</p>");

    writeHidden("toolUpdateStore", "");
    }

    for ($idx = 0; $idx < $frmHolderElementCount; $idx++) {
      print("\t<tr width = \"$holderTableRowWidth\">\n");
      print("\t<td width = $holderTableColWidth>");
      print("$frmHolderElementText[$idx]");
      print("\t</td>\n");
      print("\t<td width = \"$holderTableColWidth\">");
      $fieldName = $frmHolderElementNames[$idx];
      $fieldType = $frmHolderElementTypes[$idx];
      if (IsSet($_POST[$fieldName])) {
        $fieldValue = $_POST[$fieldName];
      } else {
        $fieldValue = "";
      }
      writeTextBox($fieldName, $fieldValue);
      print("\t</td>");
      print("\t</tr>\n");
    }

    print("\t<tr>\n");
    print("\t<td>");
    writeButton("insertHolder", "Insert Holder", "javascript:addHolderToList();");

    print("\t</td>");
    print("\t</tr>\n");
    
    print("</table>\n");
    print("</div>\n");
?>
    print("\t</td>\n");

    print("\t<tr>");
    print("\t<td valign=\"center\">");
    print("Programs added:<br>");
    print("\t</td>");
    print("\t<td valign=\"center\">");
    writeSelectMultiline("opProgramList", 10, 275);
    print("<br>");
    writeButton("createProgram", "Create Program", "javascript:showAddProgram();");
    print("\t</td>");
    print("</tr>");

    print("\t<tr>\n");
    print("\t<td>\n");
    writeButton("addOperation", "Insert Operation", "javascript:addOperationToList();");
    print("\t</td>\n");
    print("\t<td>\n");
    writeButton("addOperation", "Cancel", "javascript:clearForm();showPreviousForm();");
    print("\t</td>\n");
    writeTextBox("programStore", "");
    writeTextBox("toolHolderStore", "");
    writeTextBox("machineStore", "");
    print("\t</td>");
    print("\t<td></td>");
    print("\t</tr>\n");
    
    print("</table>\n");
    print("</div>\n");
?>