 		
 		<cfif isdefined("media_uri") and len(media_uri) gt 0>
 			<cfset srch="#srch# AND upper(media_uri) like '%#ucase(media_uri)#%'">
+			<cfset mapurl="#mapurl#&media_uri=#media_uri#">
 		</cfif>
 		<cfif isdefined("tag") and len(tag) gt 0>
 			<cfset whr="#whr# AND media_flat.media_id IN (select media_id from tag)">
+			<cfset mapurl="#mapurl#&tag=#tag#">
 		</cfif>
 		<cfif isdefined("media_type") and len(media_type) gt 0>
 			<cfset srch="#whr# AND media_type IN (#listQualify(media_type,"'")#)">
+			<cfset mapurl="#mapurl#&media_type=#media_type#">
 		</cfif>
 		
 		<cfif isdefined("media_id") and len(#media_id#) gt 0>
 			<cfset whr="#whr# AND media_flat.media_id in (#media_id#)">
+			<cfset mapurl="#mapurl#&media_id=#media_id#">
 		</cfif>
 		<cfif isdefined("mime_type") and len(#mime_type#) gt 0>
 			<cfset srch="#whr# AND mime_type in (#listQualify(mime_type,"'")#)">
+			<cfset mapurl="#mapurl#&mime_type=#mime_type#">
 		</cfif>
 
 	<cfelse>
 
 		<cfif isdefined("media_uri") and len(media_uri) gt 0>
 			<cfset srch="#srch# AND upper(media_uri) like '%#ucase(media_uri)#%'">
+			<cfset mapurl="#mapurl#&media_uri=#media_uri#">
 		</cfif>
 		<cfif isdefined("media_type") and len(media_type) gt 0>
 			<cfset srch="#srch# AND upper(media_type) like '%#ucase(media_type)#%'">
+			<cfset mapurl="#mapurl#&media_type=#media_type#">
 		</cfif>
 		<cfif isdefined("tag") and len(tag) gt 0>
 			<cfset whr="#whr# AND media.media_id in (select media_id from tag)">
+			<cfset mapurl="#mapurl#&tag=#tag#">
 		</cfif>
 		<cfif isdefined("media_id") and len(#media_id#) gt 0>
 			<cfset whr="#whr# AND media.media_id in (#media_id#)">
+			<cfset mapurl="#mapurl#&media_id=#media_id#">
 		</cfif>
 		<cfif isdefined("mime_type") and len(#mime_type#) gt 0>
 			<cfset srch="#srch# AND mime_type = '#mime_type#'">
+			<cfset mapurl="#mapurl#&mime_type=#mime_type#">
 		</cfif>
 		
 		<cfif not isdefined("number_of_relations")>

				<cfset number_of_relations=1>
			</cfif>
		</cfif>
		
		<cfif not isdefined("number_of_labels")>
		    <cfif (isdefined("label") and len(label) gt 0) or (isdefined("label__1") and len(label__1) gt 0)>
				<cfset number_of_labels=1>
				<cfif isdefined("label") and len(label) gt 0>

				<cfset number_of_labels=0>
			</cfif>
		</cfif>
		<cfset mapurl="#mapurl#&number_of_labels=#number_of_labels#">
		
		<cfloop from="1" to="#number_of_relations#" index="n">
			<cftry>
		        <cfset thisRelationship = #evaluate("relationship__" & n)#>
