title: Center multiple markers Google API v3
body: <p>I realize there are some examples out there of this but I can not make it work with my script. I realize you need to make a bounds but it does not want to work.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    var infowindow;
    var map;
  
    function initialize() {
      var myLatlng = new google.maps.LatLng(37.4419, -122.1419);
      var myOptions = {
        zoom: 13,
        center: myLatlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      downloadUrl("include/moredata.xml", 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"), latlng);
         }
       });
    }
  
    function createMarker(name, latlng) {
      var marker = new google.maps.Marker({position: latlng, map: map});
      google.maps.event.addListener(marker, "click", function() {
        if (infowindow) infowindow.close();
        infowindow = new google.maps.InfoWindow({content: name});
        infowindow.open(map, marker);
      });
      return marker;
    }
  
    function AutoCenter() {
      //  Create a new viewpoint bound
      var bounds = new google.maps.LatLngBounds();
      //  Go through each...
      $.each(markers, function (index, marker) {
      bounds.extend(marker.position);
      });
      //  Fit these bounds to the map
      map.fitBounds(bounds);
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>At first I thought it was because I declared a center and zoom in my options, but even after taking those out, my map did not show up. Help please??? Thank you!</p>