 			</ul>
 		</p>
 	</cfif>
-	Agent Relationships:
+
 	<cfquery name="agent_relations" datasource="uam_god">
-		select AGENT_RELATIONSHIP,agent_name,RELATED_AGENT_ID
+		select
+			'is ' || AGENT_RELATIONSHIP reln,agent_name,RELATED_AGENT_ID
 		from agent_relations,preferred_agent_name
 		where
 		agent_relations.RELATED_AGENT_ID=preferred_agent_name.agent_id and
 		agent_relations.agent_id=#agent_id#
 	</cfquery>
-	<ul>
-		<cfloop query="agent_relations">
-			<li>#AGENT_RELATIONSHIP# <a href="agentActivity.cfm?agent_id=#RELATED_AGENT_ID#">#agent_name#</a></li>
-		</cfloop>
-	</ul>
-	<cfquery name="agent_relations" datasource="uam_god">
+
+
+	<cfif agent_relations.recordcount gt 0>
+		Relationships FROM #agent.preferred_agent_name#:
+		<ul>
+			<cfloop query="agent_relations">
+				<li>#AGENT_RELATIONSHIP# <a href="agent.cfm?agent_id=#RELATED_AGENT_ID#">#agent_name#</a></li>
+			</cfloop>
+		</ul>
+	</cfif>
+	<cfquery name="agent_relationsto" datasource="uam_god">
 		select AGENT_RELATIONSHIP,agent_name,preferred_agent_name.agent_id
 		from agent_relations,preferred_agent_name
 		where
 		agent_relations.agent_id=preferred_agent_name.agent_id and
 		RELATED_AGENT_ID=#agent_id#
 	</cfquery>
-	<ul>
-		<cfloop query="agent_relations">
-			<li><a href="agentActivity.cfm?agent_id=#agent_id#">#agent_name#</a> is #AGENT_RELATIONSHIP#</li>
-		</cfloop>
-	</ul>
-Groups:
+	<cfif agent_relationsto.recordcount gt 0>
+		Relationships TO #agent.preferred_agent_name#:
+		<ul>
+			<cfloop query="agent_relationsto">
+				<li><a href="agent.cfm?agent_id=#agent_id#">#agent_name#</a> is #AGENT_RELATIONSHIP#</li>
+			</cfloop>
+		</ul>
+	</cfif>
+
 	<cfquery name="group_member" datasource="uam_god">
 		select
 			agent_name,

			media_relations.media_relationship='shows cataloged_item' AND
			collector.agent_id=#agent_id#
	</cfquery>
	<ul>

		<li>
			<a href="/MediaSearch.cfm?action=search&collected_by_agent_id=#agent_id#">
				Media from #collectormedia.c# collected/prepared specimens
			</a>
		</li>
	</ul>
	<cfquery name="project_agent" datasource="uam_god">
			select
				project_name,
				project.project_id
			from
				project_agent,
				project
			where
				 project.project_id=project_agent.project_id and
				 project_agent.agent_id=#agent_id#
			group by
				project_name,
				project.project_id
		</cfquery>
		<cfif len(project_agent.project_name) gt 0>
			Projects
			<ul>
				<cfloop query="project_agent">
					<li><a href="/ProjectDetail.cfm?project_id=#project_id#">#project_name#</a></li>
				</cfloop>
			</ul>
		</cfif>
		<cfquery name="publication_agent" datasource="uam_god">
			select
				publication.PUBLICATION_ID,
				full_citation
			from
				publication,
				publication_agent
			where
				publication.publication_id=publication_agent.publication_id and
				publication_agent.agent_id=#agent_id#
			group by
				publication.PUBLICATION_ID,
				full_citation
		</cfquery>
		<cfif len(publication_agent.full_citation) gt 0>
			Publications
			<ul>
				<cfloop query="publication_agent">
					<li>
						<a href="/Publication.cfm?PUBLICATION_ID=#PUBLICATION_ID#">#full_citation#</a>
						<cfquery name="citn" datasource="uam_god">
							select count(*) c from citation where publication_id=#publication_id#
						</cfquery>
						<ul><li>#citn.c# citations</li></ul>
					</li>
				</cfloop>
			</ul>
		</cfif>

</cfoutput>
<cfinclude template = "/includes/_footer.cfm">
			collection.guid_prefix,
	        collection.collection_id
	</cfquery>
	<cfif collector.recordcount gt 0>
		Collected or Prepared specimens:
		<ul>
			<CFLOOP query="collector">
				<li>
					<a href="/SpecimenResults.cfm?collector_agent_id=#agent_id#&collection_id=#collector.collection_id#">#collector.cnt# #collector.guid_prefix#</a> specimens
				</li>
		  	</CFLOOP>
		</ul>
	</cfif>



	<cfquery name="collectormedia" datasource="uam_god">
