Here's how I did it. (copied and pasted for Sunday laziness but it's simple enough to follow)
// inline javascript defines the places
allplaces = [
[
<%- @facets.each do |facet| -%>
<%- if facet.latitude && facet.longtitude -%>
['<%=h escape_javascript(facet_article(facet).title) -%>', 'be', <%= facet.latitude -%>, <%= facet.longtitude -%>, '<%= facet.photo.blank? ? "" : facet.photo.photo.url(:article) -%>', '<%=h escape_javascript(truncate(facet_article(facet).body, :length => 100, :omission => "...")) -%>', '<%=h article_url(:id => facet_article(facet)) -%>']
<%= (",") unless facet == @facets.last %>
<%- end -%>
<%- end -%>
]
];
// separate static external js file interacts with google map api
function placeMarkers() {
var shadow,
html,
k=0,
marker;
for(i=0;i<allplaces.length;i++){
places = allplaces[i];
for(j=0;j<places.length;j++){
place = places[j];
latlng = new google.maps.LatLng(place[2],place[3]);
shadow = new google.maps.MarkerImage('/images/mapicons/shadow.png',
new google.maps.Size(57,37),
new google.maps.Point(0,0),
new google.maps.Point(17,35)
);
marker = new google.maps.Marker({
position: latlng,
title: place[0],
icon: stringFormat('/images/mapicons/{0}{1}.png', place[1], j+1),
shadow: shadow,
map: map
});
markers[k] = new Object;
markers[k].marker = marker;
markers[k].category = place[1];
html = '<div class="info_window"><h3><a href=' + place[6] + '>' + place[0] +' </a></h3><div class="info_img_wrap"><img src={1} height="55px"/></div>{2}</div>';
markers[k].html = stringFormat(html, marker.title,place[4],place[5]);
markers[k].infoWindow = new google.maps.InfoWindow({
content: markers[k].html,
maxWidth: '280'
});
markers[k].openlistener = makeClosure(k, markers[k].marker);
k++;
}
}
}