Hi,
First off, insert this line after your downloadUrl call, within the
closure function(data) { :
var markersForManager = []; // a addMarkers() Call expects an Array
of Markers, initialize it
Within your "for(var i = 0 ; i < markers.length; i++)", and after your
"var marker = createMarker(markers[i].getAttribute("name"), latlng);
", try adding this :
markersForManager.push(marker); // Add the marker object to the
array
After your "for(var i = 0 ; i < markers.length; i++)", add this :
mgr.addMarkers(markersForManager, 1, 22); // 1 is minimum zoom, 22
is maximum zoom, read MarkerManager documentation for more info. You
can add more of these calls, for various zoom levels.
mgr.refresh(); // This should place your markers on the map
Finally, wrap all your logic with downloadUrl("...") and its closure
within an event (which is triggered after MarkerManager is ready to
go) :
google.maps.event.addListener(mgr, "loaded",
function()
{
// Your downloadUrl() logic goes here.
}
);
Hope it works !