Google Maps API v3 wiele znaczników Infowindow

Użyłem poniższego kodu, aby wyświetlić mapę z wieloma znacznikami i infowindows. Teraz natrafiłem na bardzo powszechny problem z ostatnim infowindowem pojawiającym się na wszystkich znacznikach. Próbowałem różnych rozwiązań, w tym:http://you.arenot.me/2010/06/29/google-maps-api-v3-0-multiple-markers-multiple-infowindows/ i tenhttp://www.robertbolton.com/blog/google-maps-v3-multiple-markers-and-infowindows-in-a-loop ale żaden z nich nie rozwiązuje problemu.

Oto mój kod:

var infowindow = null;
var geocoder;
var map; 

$(document).ready(function() {
    initialize();
});

function initialize() {

    var myOptions = {
            zoom: 8, 
            mapTypeId: google.maps.MapTypeId.ROADMAP, 
            disableDefaultUI: true, 
            scrollwheel: false 
    };

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    setMarkers(map, people);

    infowindow = new google.maps.InfoWindow({
            content: "loading..."
        });

}

    var people = [
        {"userid":"47","lastname":"lastname1","firstname":"firstname1","address":"Paris, France","phone1":"00000000000","phone2":"","email":"[email protected]"},
        {"userid":"42","lastname":"lastname2","firstname":"firstname2","address":"Versaille, France","phone1":"0","phone2":"0","email":"[email protected]"}
    ];

    function setMarkers(map, people) {

    for (var i = 0; i < people.length; i++) {
         var p = people[i];

        geocoder = new google.maps.Geocoder();

        geocoder.geocode( { 'address': p["address"] }, function(results, status) {

            if (status == google.maps.GeocoderStatus.OK) {
            map.setCenter(results[0].geometry.location);


                var marker = new google.maps.Marker({
                    position: results[0].geometry.location,
                    map: map,
                    html: p["address"]
                });

                var contentString = "Some content";

                google.maps.event.addListener(marker, "click", function () {
                    infowindow.setContent(this.html);
                    infowindow.open(map, this);
                });


            } else {
                alert("Geocode was not successful for the following reason: " + status);
            }

    });

}   

}

questionAnswers(1)

yourAnswerToTheQuestion