title: Google Maps setMap is not a function
body: <p>i am dealing with the Problem that my google Maps Page shows me an error in Firebug.
  The clearLocations() function is fired when i search within my dealer map.
  But this error is showing up: "<strong>markers[i].setMap is not a function</strong>"</p>
  
  <p>Does anyone know how to solve that problem? I searched in several forums and groups, but i am using a google.maps.Marker array so i can't find my problem.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Code ( <strong>clearLocations()</strong> ):</p>
  
  <pre><code>function clearLocations() {
  infoWindow.close();
  for (var i = 0; i &lt; markers.length; i++) {
      markers[i].setMap(null);
  }
  markers.length = 0;
  dealers.innerHTML = "";
  </code></pre>
  
  <p>}</p>
  
  <p>Code ( <strong>load()</strong> ):</p>
  
  <pre><code>function load() {
  
  
  
  map = new google.maps.Map(document.getElementById("map_canvas"), {
      //center: new google.maps.LatLng(51.30174, 10.60824),
      zoom: 10,
      mapTypeId: 'roadmap',
      mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
  });
  infoWindow = new google.maps.InfoWindow();
  dealers = document.getElementById("dealers");
  
  infoWindow = new google.maps.InfoWindow();
  var bounds = new google.maps.LatLngBounds();
  
  for (i = 0; i &lt; markers.length; i++) {  
      marker = new google.maps.Marker({
          position: new google.maps.LatLng(markers[i][1], markers[i][2]),
          map: map
      });
  
      var pos = new google.maps.LatLng(markers[i][1], markers[i][2]);
      bounds.extend(pos);
  
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
          infowindow.setContent(markers[i][0]);
          infowindow.open(map, marker);
      }
  })(marker, i));
  }
  map.fitBounds(bounds);
  </code></pre>
  
  <p>}</p>