 				cataloged_item.collection_object_id = #collection_object_id#
 			ORDER BY sampled_from_obj_id DESC,part_name ASC
 		</cfquery>
-
-
-
-
-		<cfquery name="ctDisp" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
+		<cfquery name="ctDisp" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#" cachedwithin="#createtimespan(0,0,60,0)#">
 			select coll_obj_disposition from ctcoll_obj_disp order by coll_obj_disposition
 		</cfquery>
-		<cfquery name="thisCollectionCde" dbtype="query">
+		<cfquery name="thisCollectionCde" dbtype="query" >
 			select collection_cde from raw group by collection_cde
 		</cfquery>
-
-
-
-<cfquery name="ploan" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
+		<cfquery name="ploan" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
 			SELECT
 				loan.loan_number,
 				loan.transaction_id,

				loan_item.collection_object_id=specimen_part.collection_object_id AND
				specimen_part.derived_from_cat_item=#collection_object_id#
		</cfquery>

<cfquery name="orderedparts" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
	select
		collection_object_id part_id,
 		level,
 		part_name
	from (
 		SELECT
			SAMPLED_FROM_OBJ_ID,
			collection_object_id,
			part_name
		FROM
			specimen_part
 		where
			derived_from_cat_item=#collection_object_id#
 		)
	START WITH SAMPLED_FROM_OBJ_ID is null
	CONNECT BY PRIOR collection_object_id = SAMPLED_FROM_OBJ_ID
	ORDER SIBLINGS BY part_name
</cfquery>









<cffunction name="getChildParts"  returnType="string">
	<!---- build table row(s) for one part and any attributes ---->

	<cfargument name="pid" type="string" required="yes">
	<cfargument name="level" type="string" required="yes">
	<cfargument name="p_q" type="query" required="yes">
	<cfargument name="l_q" type="query" required="yes">
	<cfargument name="i" type="string" required="yes">




		<cfquery name="ctDisp" datasource="user_login" username="#session.dbuser#" password="#decrypt(session.epw,session.sessionKey)#">
			select coll_obj_disposition from ctcoll_obj_disp order by coll_obj_disposition
		</cfquery>


	<cfquery name="p" dbtype="query">
		select
			partID,
			part_name,
			coll_obj_disposition,
			condition,
			sampled_from_obj_id,
			collection_cde,
			lot_count,
			barcode,
			label,
			parentContainerId,
			partContainerId,
			coll_object_remarks
		from
			p_q
		where
			partID=#pid#
		group by
			partID,
			part_name,
			coll_obj_disposition,
			condition,
			sampled_from_obj_id,
			collection_cde,
			lot_count,
			barcode,
			label,
			parentContainerId,
			partContainerId,
			coll_object_remarks
	</cfquery>


	<cfsavecontent variable="r">
		<cfset pdg=level-1>



		<cfloop query="p">
			<input type="hidden" name="partID#i#" id="partID#i#"  value="#pid#">

							<tr>
								<td>
									<div style="padding-left:#pdg#em;">
									<label for="part_name#pid#">
										Part
										<span id="pid_#partID#">
											#partID#
										</span>
										<cfif len(sampled_from_obj_id) gt 0>
											<br>Subsampled from <span class="ssspn" data-pid="pid_#sampled_from_obj_id#">#sampled_from_obj_id#</span>
										</cfif>
										<br><span class="likeLink" style="font-weight:100" onClick="getCtDoc('ctspecimen_part_name')">[ Define values ]</span>

									</label>
									<input type="text" name="part_name#i#" id="part_name#i#" class="reqdClr"
										value="#p.part_name#" size="25"
										onchange="findPart(this.id,this.value,'#p.collection_cde#');"
										onkeypress="return noenter(event);">
									</div>
								</td>
								<td>
									<label for="coll_obj_disposition#i#">Disposition</label>
									<select name="coll_obj_disposition#i#" id="coll_obj_disposition#i#" size="1" class="reqdClr" style="width:150px";>
						              <cfloop query="ctDisp">
							              <option <cfif ctdisp.coll_obj_disposition is p.coll_obj_disposition> selected </cfif>value="#ctDisp.coll_obj_disposition#">#ctDisp.coll_obj_disposition#</option>
						              </cfloop>
						            </select>
								</td>
								<td>
									<label for="condition#i#">Condition&nbsp;<span class="likeLink" style="font-weight:100" onClick="chgCondition('#p.partID#')">[ History ]</span></label>
									<textarea name="condition#i#" id="condition#i#" class="reqdClr mediumtextarea">#p.condition#</textarea>
								</td>
								<td>
									<label for="lot_count#i#">##</label>
									<input type="text" id="lot_count#i#" name="lot_count#i#" value="#p.lot_count#"  class="reqdClr" size="2">
								</td>
								<td>
									<label for="label#i#">In Container Label</label>
									<span style="font-size:small">
										<cfif len(p.label) gt 0>
											#p.label#
										<cfelse>
											-NONE-
										</cfif>
									</span>
									<input type="hidden" name="label#i#" value="#p.label#">
									<input type="hidden" name="parentContainerId#i#" value="#p.parentContainerId#">
									<input type="hidden" name="partContainerId#i#" value="#p.partContainerId#">
								</td>
								<td>
									<label for="newCode#i#">Add to barcode</label>
									<input type="text" name="newCode#i#" id="newCode#i#" size="10">
								</td>
								<td>
									<label for="coll_object_remarks#i#">Remark</label>
									<textarea name="coll_object_remarks#i#" id="coll_object_remarks#i#" class="smalltextarea">#stripQuotes(p.coll_object_remarks)#</textarea>
								</td>
								<cfquery dbtype="query" name="tlp">
									select * from l_q where transaction_id is not null and collection_object_id=#p.partID#
								</cfquery>
								<td>
									<cfloop query="tlp">
										<div>
											<a href="/Loan.cfm?action=editLoan&transaction_id=#transaction_id#">#loan_number#</a>
										</div>
									</cfloop>
								</td>
								<td align="middle">
									<input type="button" value="Delete" class="delBtn"
										onclick="parts.action.value='deletePart';parts.partID.value='#p.partID#';confirmDelete('parts','#p.part_name#');">
									<input type="button"
										value="Copy"
										class="insBtn"
										onClick="newPart.part_name.value='#p.part_name#';
											newPart.lot_count.value='#p.lot_count#';
											newPart.coll_obj_disposition.value='#p.coll_obj_disposition#';
											newPart.condition.value='#p.condition#';
											newPart.coll_object_remarks.value='#p.coll_object_remarks#';">
									<input type="button"
										value="Subsample"
										class="insBtn"
										onClick="createSubsample(#i#)">
								</td>
							</tr>
							<cfquery name="pAtt" dbtype="query">
								select
									 part_attribute_id,
									 attribute_type,
									 attribute_value,
									 attribute_units,
									 determined_date,
									 determined_by_agent_id,
									 attribute_remark,
									 part_attribute_determiner agent_name
								from
									raw
								where
									part_attribute_id is not null and
									partID=#p.partID#
							</cfquery>
							<tr >
								<td colspan="8" align="center">
								<div style="padding-left:#level#em;">


									<cfif pAtt.recordcount gt 0>
									<table border>
										<tr>
											<th>Attribute</th>
											<th>Value</th>
											<th>Units</th>
											<th>Date</th>
											<th>DeterminedBy</th>
											<th>Remark</th>
										</tr>
										<cfloop query="pAtt">
											<tr>
												<td>#attribute_type#</td>
												<td>
													#attribute_value#&nbsp;
												</td>
												<td>
													#attribute_units#&nbsp;
												</td>
												<td>
													#dateformat(determined_date,"yyyy-mm-dd")#&nbsp;
												</td>
												<td>
													#agent_name#&nbsp;
												</td>
												<td>
													#attribute_remark#&nbsp;
												</td>
											</tr>
										</cfloop>
										</div>
									</td>
								</table>
								<cfelse>
									--no attributes--
								</cfif>
								<td><input type="button" value="Manage Attributes" class="savBtn"
						   			onclick="mgPartAtts(#partID#);">
								</td>
							</tr>
				</cfloop>

				<!----


		<tr>
			<td>
				<div style="padding-left:#pdg#em;">
					#p.part_name#
				</div>
			</td>
			<td>#p.part_condition#</td>
			<td>#p.part_disposition#</td>
			<td>#p.lot_count#</td>
			<cfif oneOfUs is 1>
				<td>#p.label#</td>
				<td>#p.barcode#</td>
				<td>#replace(p.FCTree,':','←<wbr>','all')#</td>
				<cfquery dbtype="query" name="tlp">
					select * from l_q where transaction_id is not null and collection_object_id=#pid#
				</cfquery>
				<td>
					<cfloop query="tlp">
						<div>
							<a href="/Loan.cfm?action=editLoan&transaction_id=#transaction_id#">#loan_number# (#LOAN_STATUS#)</a>
						</div>
					</cfloop>
				</td>
			</cfif>
			<td>#p.part_remarks#</td>
		</tr>
		<cfquery name="patt" dbtype="query">
			select
				attribute_type,
				attribute_value,
				attribute_units,
				determined_date,
				attribute_remark,
				agent_name
			from
				p_q
			where
				attribute_type is not null and
				part_id=#pid#
			group by
				attribute_type,
				attribute_value,
				attribute_units,
				determined_date,
				attribute_remark,
				agent_name
			order by
				attribute_type,
				determined_date
		</cfquery>
		<cfif patt.recordcount gt 0>
			<tr>
				<td colspan="6">
					<div style="padding-left:#level#em;">

					<table border id="patbl#pid#" class="detailCellSmall sortable">
						<tr>
							<th>
								Attribute
							</th>
							<th>
								Value
							</th>
							<th>
								Date
							</th>
							<th>
								Dtr.
							</th>
							<th>
								Rmk.
							</th>
						</tr>
						<cfloop query="patt">
							<tr>
								<td>
									#attribute_type#
								</td>
								<cfif not(oneOfUs) and attribute_type is "location" and one.encumbranceDetail contains "mask part attribute location">
									<td>masked</td>
									<td>-</td>
									<td>-</td>
									<td>-</td>
								<cfelse>
									<td>#attribute_value# <cfif len(attribute_units) gt 0>#attribute_units#</cfif></td>
									<td>#dateformat(determined_date,'yyyy-mm-dd')#</td>
									<td>#agent_name#</td>
									<td>#attribute_remark#</td>
								</cfif>
							</tr>
						</cfloop>
					</table>
					</div>
				</td>
			</tr>
		</cfif>
		---->
	</cfsavecontent>
<cfreturn r>
</cffunction>











	<b>Edit #orderedparts.recordcount# Specimen Parts</b>&nbsp;<span class="helpLink" data-helplink="parts">help</span>
		<br><a href="/findContainer.cfm?collection_object_id=#collection_object_id#">Part Locations</a>

<form name="parts" method="post" action="editParts.cfm">
			<input type="hidden" name="action" value="saveEdits">
			<input type="hidden" name="collection_object_id" value="#collection_object_id#">



			<table border>
				<cfset i=1>
				<cfloop query="orderedparts">

					<cfset i=i+1>
				</cfloop>
			</table>
			<div style="text-align:center;">
				<input type="button" value="Save All Changes" class="savBtn" onclick="parts.action.value='saveEdits';submit();">
			</div>
				<cfset numberOfParts= i-1>
				<input type="hidden" name="NumberOfParts" value="#orderedparts.recordcount#">
				<input type="hidden" name="partID">
			</table>
		</form>
		<a name="newPart"></a>
		<table class="newRec">
			<tr>
