title: simple javascript settimeout problem
body: <pre><code>&lt;script type="text/javascript"&gt;
  
  
  
  $(document).ready(function () { initialize(); });
  
  var markerarray = [
  ['Mount Evans', 39.58108, -105.63535, 4, 'This is Mount Evans.'],
  ['Badlands National Park', 43.785890, -101.90175, 1, 'This is Badlands National Park']
  ];
  
  
  var bounds = new google.maps.LatLngBounds();
  
  function setMarkers(map, markers) {
  
      for (var i = 0; i &lt; markers.length; i++) {  setTimeout(function() {  
  
          var markerarray = markers[i];
  
          var siteLatLng = new google.maps.LatLng(markerarray[1], markerarray[2]);
  
          var marker = new google.maps.Marker({
  
              position: siteLatLng,
  
              map: map,
  
              animation: google.maps.Animation.DROP,
  
              title: markerarray[0],
  
              zIndex: markerarray[3],
  
              html: markerarray[4]
  
          }); 
  
  
          google.maps.event.addListener(marker, "click", function () {
  
              $('.info').html(this.html);
  
          });
  
          bounds.extend(siteLatLng);
  
          map.fitBounds(bounds);
  
      }  , i * 2000); } 
  
  }
  
  
      function initialize() {
  
      var myOptions = {
  
          disableDefaultUI: true,
  
          mapTypeId: google.maps.MapTypeId.ROADMAP
  
      }
  
      var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  
      setMarkers(map, markerarray);
  
  }
  </code></pre>
  
  <p></p>
  
  <p>When i use the <code>setTimeout(function() {...</code> i get a javascript error: "markerarray is undefined". But when i remove the timeout everything work as it should. But i want a delay between each marker when theyre added to the map. Did i miss something? Thanks</p>