<cfsilent>
<cfparam name="ATTRIBUTES.n" type="numeric"/>
<cfset attributeList="n,sortArray"/>

<cfset img_up="arr_up.png"/>
<cfset img_dn="arr_dn.png"/>
<cfset HIGHLIGHTED_CNT=2/>

<cfif isDefined("ATTRIBUTES.sortArray")>
	<cfset i=1>
	<cfloop condition="i LE HIGHLIGHTED_CNT AND i LE arrayLen(ATTRIBUTES.sortArray)">
		<cftry>
			<cfif ATTRIBUTES.sortArray[i].fld EQ ATTRIBUTES.n>
				<cfif ATTRIBUTES.sortArray[i].asc>
					<cfset img_up="arr_up#i#.png">
				<cfelse>	
					<cfset img_dn="arr_dn#i#.png">
				</cfif>
			</cfif>
		<cfcatch type="Any"></cfcatch>
		</cftry>
		<cfset i=i+1>
	</cfloop>
</cfif>

<cfset extra_query_string=""/>
<cfloop collection=#ATTRIBUTES# item="attr">
	<cfif NOT listFindNoCase(attributeList,attr)>
		<cfset val="#structFind(ATTRIBUTES,attr)#"/>
		<cfif IsSimpleValue(val)>
			<cfset extra_query_string="#extra_query_string#&#attr#=#val#"/>
		</cfif>
	</cfif>
</cfloop>

</cfsilent><cfoutput><a href="?sort=#ATTRIBUTES.n#a#extra_query_string#" class="noprint" style="padding:2px;" title="по возрастанию"><img src="img/#img_up#" alt="по возрастанию"></a><a href="?sort=#ATTRIBUTES.n#d#extra_query_string#" title="по убыванию"><img src="img/#img_dn#" alt="по убыванию"></a></cfoutput><cfexit method="exittag"/>