link via image map

I'm looking to create a small icon to use in table headings, that users can use to sort by that table heading. Click on the top half and sort ascending, and click on the bottom half to sort desc.

Is there a way to neatly generate an image map via Rails. I want to create output HTML something like this:

<img src="sort.gif" usemap="#sort" border="0"> <map name="sort"> <area shape="rect" coords="0,0,50,25" href="Custom Application Development Software for Business - Salesforce.com; <area shape="rect" coords="0,50,50,50" href="Custom Application Development Software for Business - Salesforce.com; </map>

I can build my own helper method to do this, but wondered if there was already a way to do it.

As I've had no reply, I guess the answer is no - there isn't an existing method. I've thrown these helper methods together which does the job for me:

  def image_map_for_sort_link(name, field)       params_for_link = params.clone       params_for_link.delete_if{|key,value| key == 'order' or key == 'sort_by'}       output = Array.new       output << ['<map name="', name, '">'].join       output << image_map_area("0,0,20,18", url_for(:sort_by => field, :params => params_for_link, :order => 'asc'))       output << image_map_area("20,0,40,18", url_for(:sort_by => field, :params => params_for_link, :order => 'desc'))       output << '</map>'       return output.join("\n")   end

  def sort_image(field="")     map_name = "sort_#{field}"     @image_maps = Array.new unless @image_maps     @image_maps << image_map_for_sort_link(map_name, field)     image_tag('sort.png', :usemap => "##{map_name}", :class => 'image_map')   end

  private   def image_map_area(coords, url)     ['<area shape="rect" coords="', coords, '" href="', url, '" />'].join   end

The result is that adding <%= sort_image('field_name') -%> to a view adds a clickable sort image, as long as I also have <%= @image_maps %> somewhere on the page. I also have to handle params[:sort_by] and params[:order] in the controller to handle the sorting.