title: Google Maps v3 opens the last infoWindow when a marker is clicked
body: <p>I have a shared <code>infoWindow</code> for all my markers. It works good if I use jquery's <code>$().each(function(){})</code>, but if I change it to JavaScrips's native for or while loop, it's not working as expected. </p>
  
  <p>Whenever I click a marker, it will open the last populated marker's <code>infoWindow</code>, instead of the clicked marker's <code>infoWindow</code>.</p>
  
  <p>This works:</p>
  
  <pre><code>$(stores).each(function() {
  
     var storeId = $(this).attr('storeId');
     var address = $(this).attr('rawAddress');
     var city = $(this).attr('city');
     var state = $(this).attr('state');
     var zip = $(this).attr('zip');
     var lat = $(this).attr('lat');
     var lng = $(this).attr('lng');
     var distance = $(this).attr('distance');
  
     //create marker
     var point = new google.maps.LatLng(lat, lng);
  
     var marker = new google.maps.Marker({ position: point
       , map: InStorePickup.map
       , title: city + ' #' + storeId
     });
  
     //create infowindow content
     var infoWindowContent = '&lt;div style="font-size: 8pt;"&gt;'
       + '&lt;strong&gt;' + city + ' #' + storeId + '&lt;/strong&gt; (' + parseFloat(distance).toFixed(2) + 'mi)&lt;br /&gt;'
       + address + '&lt;br /&gt;' + city + ', ' + state + ' ' + zip
       + '&lt;/div&gt;';
  
     google.maps.event.addListener(marker, 'click', function() {
       InStorePickup.openInfoWindow(marker, infoWindowContent);
     });
  
     bounds.extend(point);
   });
  </code></pre>
  
  <p>But this does not work:</p>
  
  <pre><code>for (var i = 0; i &lt; 3; i++) {
      var store = stores[i];
  
      var storeId = $(store).attr('storeId');
      var address = $(store).attr('rawAddress');
      var city = $(store).attr('city');
      var state = $(store).attr('state');
      var zip = $(store).attr('zip');
      var lat = $(store).attr('lat');
      var lng = $(store).attr('lng');
      var distance = $(this).attr('distance');
  
      //create marker
      var point = new google.maps.LatLng(lat, lng);
  
      var marker = new google.maps.Marker({ position: point
                    , map: InStorePickup.map
                    , title: city + ' #' + storeId
      });
  
      //create infowindow content
      var infoWindowContent = '&lt;div style="font-size: 8pt;"&gt;'
                     + '&lt;strong&gt;' + city + ' #' + storeId + '&lt;/strong&gt; (' + parseFloat(distance).toFixed(2) + 'mi)&lt;br /&gt;'
                     + address + '&lt;br /&gt;' + city + ', ' + state + ' ' + zip
                     + '&lt;/div&gt;';
  
      google.maps.event.addListener(marker, 'click', function() {
          InStorePickup.openInfoWindow(marker, infoWindowContent);
      });
  
      bounds.extend(point);
  }
  </code></pre>
  
  <p>Any thoughts?</p>