title: Marker content (infoWindow) Google Maps
body: <p>I'm trying to add infoWindow's to multiple markers on a Google Map. The closest I have come is to get an infoWindow to display the last address you can see in the array, on all markers. The bit of code I have pasted below does not work, I get an "Uncaught TypeError: Cannot read property '4' of undefined". I'm sure this is a scope issue, but I'm going round in circles here and could do with some help:</p>
  
  <pre><code>var hotels = [
              ['ibis Birmingham Airport', 52.452656, -1.730548, 4, 'Ambassador Road&lt;br /&gt;Bickenhill&lt;br /&gt;Solihull&lt;br /&gt;Birmingham&lt;br /&gt;B26 3AW','(+44)1217805800','(+44)1217805810','info@ibisbhamairport.com','http://www.booknowaddress.com'],
              ['ETAP Birmingham Airport', 52.452527, -1.731644, 3, 'Ambassador Road&lt;br /&gt;Bickenhill&lt;br /&gt;Solihull&lt;br /&gt;Birmingham&lt;br /&gt;B26 3QL','(+44)1217805858','(+44)1217805860','info@etapbhamairport.com','http://www.booknowaddress.com'],
              ['ibis Birmingham City Centre', 52.475162, -1.897208, 2, 'Ladywell Walk&lt;br /&gt;Birmingham&lt;br /&gt;B5 4ST','(+44)1216226010','(+44)1216226020','info@ibisbhamcity.com','http://www.booknowaddress.com']
          ];
  
          for (var i = 0; i &lt; hotels.length; i++) {
              var marker = new google.maps.Marker({
                  position: new google.maps.LatLng(hotels[i][1], hotels[i][2]),
                  map: map,
                  icon: image,
                  title: hotels[i][0],
                  zIndex: hotels[i][2]
              });
  
              var infoWindow = new google.maps.InfoWindow();
  
              google.maps.event.addListener(marker, 'click', function () {
                  var markerContent = hotels[i][4];
                  infoWindow.setContent(markerContent);
                  infoWindow.open(map, this);
              });
          }
  </code></pre>
  
  <p>Thanks in anticipation.</p>