This loads the map, gets new results and removes the old ones:
google.maps.event.addListener(map, 'idle', function() {
updateMap();
});
That part works great.
My trouble comes when I click on a marker to open it's InfoWindow. Opening an InfoWindow re-centers the map around the marker, which triggers the Listener from above, which then resets the map, hiding the InfoWindow.
Here is how I am creating the markers/InfoWindow:
var infowindow = new google.maps.InfoWindow({});
function makeMarker(LatLong, markerName) { //this is called from a loop
var marker = new google.maps.Marker({
position: LatLong,
map: map,
title:markerName,
content: "html for the infoWindow"
});
//Detect marker click
google.maps.event.addListener(marker, "click", function() {
infowindow.setContent(this.content);
infowindow.open(map, marker);
});
}
Any insights are greatly appreciated.