title: Google Maps API v3 - infoWindows all have same content
body: <p>I've been having problems with the infoWindows and Google Maps API v3.
  Initially, I've ran into the problem that everyone else has of closing infoWindows when opening a new one.
  I thought to have solved the problem by defining "infowindow" beforehand. Now they close when I click on a new marker, but the content is the same. 
  How should I re-structure my code to make sure the content is the right one each time - and only one infoWindow is open at a given time?</p>
  
  <p>Thank you!</p>
  
  <p>Paul</p>
  
  <pre><code>var allLatLngs = new Array();
  var last = 0;
  var infowindow;
  
  function displayResults(start, count){
      if(start === undefined){
          start = last;
      }
      if(count === undefined){
          count = 20;
      }
      jQuery.each(jsresults, function(index, value) {
          if(index &gt;= start &amp;&amp; index &lt; start+count){
              var obj = jQuery.parseJSON(value);
          $("#textresults").append(index + ": &lt;strong&gt;" + obj.name + "&lt;/strong&gt; " + Math.round(obj.distanz*100)/100 + " km entfernt" + "&lt;br/&gt;");
  
              var myLatlng = new google.maps.LatLng(obj.geo_lat, obj.geo_lon);
              allLatLngs.push(myLatlng);
  
          var contentString = '&lt;strong&gt;'+obj.name+'&lt;/strong&gt;';
  
          infowindow = new google.maps.InfoWindow({
              content: contentString
          });
  
  
              var marker = new google.maps.Marker({
                    position: myLatlng,
                    //title:"Hello World!"
                });
              marker.setMap(map);
  
              google.maps.event.addListener(marker, 'click', function() {
              if (infowindow) { infowindow.close(map,marker); }
                infowindow.open(map,marker);
              });
          }
      });
  
      last = start+count;  
  </code></pre>