I'm importing map data from an XML list and placing that in markerArray, then calling createMarkers(); The markers appear on the map ok, but clicking always goes to the last marker on the list.
All help appreciated.
function createMarkers() {
for (i=0; i<markerArray.length; i++){
var marker = new google.maps.Marker({position:markerArray[i].latlng, map:map, title:markerArray[i].label, icon:images[markerArray[i].type]});
google.maps.event.addListener(marker, 'click', function() {
map.setZoom(9);
map.setCenter(marker.getPosition());
});
}