YM4R GM Javascript events?

Hi all,

I have added a GEvent to a google map with a JS calback and it works fine, but I do need to get some way of returning the values to rails, so I can add the new marker to an array.

For that, I need some kind of listener, call a ruby function, something like that.

The code is as follows:

def index    @map = GMap.new("map_div")    @map.control_init(:large_map => true)    @map.center_zoom_init ([ 59.91106, 10.72223],16)    @map.overlay_init(GMarker.new([59.91122, 10.72217], :title => "1.1"))

   @map.event_init(@map,:click,"function(overlay,point)    {      if (overlay)      {        map.removeOverlay(overlay);        document.getElementById(\"latitude\").value=null;        document.getElementById(\"longitude\").value=null;      }      else      {        map.addOverlay(new GMarker(point));        document.getElementById(\"latitude\").value=point.y;        document.getElementById(\"longitude\").value=point.x;      }    }")

end

Thanks in advance, hugo