title: Changing data in the info window with Google Map markers
body: <p>I've followed <a href="https://developers.google.com/maps/articles/phpsqlajax_v3">this tutorial</a> to create a custom Google Map. I've included a few other elements such as linking it up to Wordpress and clustering the markers.</p>
  
  <p>It's all working great apart from the info in the info windows on each marker. I just can't seem to change the info within each one. I thought by changing the following lines it would change it but nothing affects it:</p>
  
  <pre><code>var html = "&lt;b&gt;" + name + "&lt;/b&gt; &lt;br/&gt;" + address;
  </code></pre>
  
  <p><a href="http://www.teamworksdesign.com/clients/poh/">This is the working map</a></p>
  
  <p>Where can I put in my own custom data into the window? Also, if I could style the window on that would be even better.</p>
  
  <hr>
  
  <p>It seems the clusterer is the problem, mainly this section, how can I take the html content and place it into the info window?</p>
  
  <pre><code>function load() {
    var cluster = [];
    var map = new google.maps.Map(document.getElementById("map"), {
      center: new google.maps.LatLng(52.375599, -3.471680),
      zoom: 8,
      mapTypeId: 'roadmap'
    });
    var infowindow = new google.maps.InfoWindow();
    var min = .999999;
    var max = 1.000002;
  
    // Change this depending on the name of your PHP file
    downloadUrl("&lt;?php bloginfo('stylesheet_directory'); ?&gt;/phpsqlajax_genxml.php ", function(data) {
      var xml = data.responseXML;
      var markers = xml.documentElement.getElementsByTagName("marker");
      for (var i = 0; i &lt; markers.length; i++) {
        var name = markers[i].getAttribute("name");
        var address = markers[i].getAttribute("address");
        var type = markers[i].getAttribute("type");
  
        var offsetLat = markers[i].getAttribute("lat") * (Math.random() * (max - min) + min);
        var offsetLng = markers[i].getAttribute("lng") * (Math.random() * (max - min) + min);
  
        var point = new google.maps.LatLng(offsetLat, offsetLng);
        var html = "&lt;b&gt;" + name + "&lt;/b&gt; &lt;br/&gt;" + address;
        var icon = customIcons[type] || {};
        var marker = new google.maps.Marker({
          map: map,
          position: point,
          icon: icon.icon,
          shadow: icon.shadow
        });
        google.maps.event.addListener(marker, 'click', (function(marker, i) {
                      return function() {
                          // infowindow.setContent(markers[i].getAttribute("name"));
                          // infowindow.open(map, marker, html);
                          infowindow.setContent(html); infowindow.open(map, marker);
                      }
                  })(marker, i));
        cluster.push(marker);
      }
      var mc = new MarkerClusterer(map,cluster);
    });
  }
  </code></pre>
  
  <p>Specifically this, it's not putting the html content through the clusterer... at least this is actually changing the data in the window, just need to output the html content without breaking the clusterer:</p>
  
  <pre><code>      google.maps.event.addListener(marker, 'click', (function(marker, i) {
                      return function() {
                          infowindow.setContent(markers[i].getAttribute("name"));
                          infowindow.open(map, marker, html);
                      }
                  })(marker, i));
        cluster.push(marker);
  </code></pre>
  
  <hr>
  
  <p>The closest I have it so far is this but it shows the same info for every marker. It's showing the html content:</p>
  
  <pre><code>      google.maps.event.addListener(marker, 'click', (function(marker, i) {
                      return function() {
                          // infowindow.setContent(markers[i].getAttribute("name"));
                          // infowindow.open(map, marker, html);
                          infowindow.setContent(html); infowindow.open(map, marker);
                      }
                  })(marker, i));
        cluster.push(marker);
  </code></pre>