title: Google Maps - Multiple markers - 1 InfoWindow problem
body: <p>I can't get my markers to display different infowindows. The markers always display the content of the last "contentString".</p>
  
  <p>I've read a few other posts but none of them seem to help.</p>
  
  <p>This is the code:</p>
  
  <pre><code>    function setMarkers(branches, map) {
          var bounds = new google.maps.LatLngBounds();
          var contentString = null;
          var infowindow = null;
          infowindow = new google.maps.InfoWindow();
          for (var i = 0; i &lt; branches.length; i++) {
              var marker = null;
              branch = branches[i];
              var myLatlngMarker = new google.maps.LatLng(branch[0], branch[1]);
              contentString = '&lt;p&gt;' + branch[3] + '&lt;/p&gt;';
  
              var marker = new google.maps.Marker({
                  position: myLatlngMarker,
                  map: map,
                  title: branch[2]
              });
  
              google.maps.event.addListener(marker, 'click', function () {
                  infowindow.setContent(contentString);
                  infowindow.open(map, this);
              });
  
              bounds.extend(myLatlngMarker);
          }
  
          map.fitBounds(bounds);
      }
  </code></pre>
  
  <p>Can anyone see what am I doing wrong?</p>
  
  <p>Thanks</p>