 	</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">


							<td>
								<cfset thisPart = #thisRec.partname#>
								<select name="partname" size="1">
									<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>
							<td>
								<cfset thisLO = #thisRec.list_order#>
								<select name="list_order" size="1">
									<cfloop from="1" to="#mo.maxNum#" index="n">
										<option <cfif #thisLO# is "#n#"> selected </cfif>value="#n#">#n#</option>
									</cfloop>
								</select>
							</td>
							<td >
hi

							</td>
						</tr>


				<input type="hidden" name="tbl" value="#tbl#">
				<tr>
					<td>
						<select name="partname" size="1">
							<cfloop query="ctspecimen_part_name">
							<option
							value="#ctspecimen_part_name.partname#">#ctspecimen_part_name.part_name#</option>
							</cfloop>
						</select>
					</td>

					<td colspan="3">
						<input type="submit" value="Create" class="insBtn">
					</td>
				</tr>
			</form>
