 	</script>
 <cfoutput>
 		<cfquery name="thisRec" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
-			select * from ctspecimen_part_list_order order by
-			list_order,partname
-		</cfquery>
+			select * from ctspecimen_part_list_order order by list_order,partname
+		</cfquery>
+
 		<cfquery name="ctspecimen_part_name" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
-			select collection_cde, part_name partname from ctspecimen_part_name
-		</cfquery>
-		<cfquery name="mo" dbtype="query">
-			select max(list_order) +1 maxNum from thisRec
+			select  part_name from ctspecimen_part_name where part_name not in (select partname from ctspecimen_part_list_order)
 		</cfquery>
 		<p>
 			This application sets the order part names appear in certain reports and forms.
-			Nothing prevents you from making several parts the same
-			order, and doing so will just cause them to not be ordered. You don't have to order things you don't care about.
+			 You don't have to order things you don't care about.
 		</p>
-		Create part ordering
+		Add part to order. New insertions will go to the bottom; drag to re-order.
 		<table class="newRec" border>
 			<tr>
 				<th>Part Name</th>
-				<th>List Order</th>
 				<th></th>
 			</tr>
 			<form name="newPart" method="post" action="CodeTableEditor.cfm">

		.dragger {
			cursor:move;
		}
		.isterm {
			font-weight:bold;
			font-style:italics;
		}
		.warningDiv {color:red;font-size:x-small;}
	</style>
	<script>
		// copy this with create classification
		$(function() {
			$( "#sortable" ).sortable({
				handle: '.dragger'
			});

			//guessAtDisplayName();
		});

		function submitForm() {


							<td>
								<cfset thisPart = #thisRec.partname#>
								<select name="partname_#thisrowinc#" id="partname__#thisrowinc#" size="1">
									<option value="remove">REMOVE</option>
									<cfloop query="ctspecimen_part_name">
									<option
									<cfif #thisPart# is "#ctspecimen_part_name.partname#"> selected </cfif>value="#ctspecimen_part_name.partname#">#ctspecimen_part_name.partname#</option>
									</cfloop>
								</select>
							</td>
						</tr>

