title: Google Maps V3 - Loop through markers and zoom map to last marker
body: <p>I have a function that loops through an XML file of marker data.  I need to set my map so that the last marker in the loop is zoomed in.</p>
  
  <pre><code>    var image = 'images/Icon.png'
      var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      downloadUrl("phpsqlajax_genxml4.php", function(data) {
        var markers = data.documentElement.getElementsByTagName("marker");
        for (var i = 0; i &lt; markers.length; i++) {
          var latlng = new google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),
                                      parseFloat(markers[i].getAttribute("lng")));
          var marker = createMarker(markers[i].getAttribute("name"), markers[i].getAttribute("ft"), markers[i].getAttribute("inch"), markers[i].getAttribute("lbs"), markers[i].getAttribute("oz"), markers[i].getAttribute("date"), markers[i].getAttribute("pic"), latlng);
  
  
         }
       });
    function createMarker(name, ft, inch, lbs, oz, date, pic, latlng) {
      var marker = new google.maps.Marker({position: latlng, map: map, icon: image});
  
      var html = "&lt;table border='0'&gt;" + 
    "&lt;tr&gt;" + 
      "&lt;td width='150'&gt;" + "&lt;strong&gt;" + name + "&lt;br&gt;" + ft + " " + inch + " &amp;nbsp;&amp;nbsp;&amp;nbsp;" + lbs + " " + oz + "&lt;/strong&gt;&lt;br&gt;" + date + "&lt;/td&gt;" + 
      "&lt;td width='100'&gt;" + '&lt;img src="image.jpg?width=80&amp;amp;height=80&amp;amp;cropratio=1:1&amp;amp;image=' + pic +'"/&gt;' + "&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;";
      google.maps.event.addListener(marker, "click", function() {
        if (infowindow) infowindow.close();
        infowindow = new google.maps.InfoWindow({content: html});
        infowindow.open(map, marker);
      });
      return marker;
    }
  </code></pre>