title: Adding ID's to google map markers
body: <p>I have a script that loops and adds markers one at a time.</p>
  
  <p>I am trying to get the current marker to have an info window and and only have 5 markers on a map at a time (4 without info windows and 1 with)</p>
  
  <p>How would I add an id to each marker so that I can delete and close info windows as needed.</p>
  
  <p>This is the function I am using to set the marker:</p>
  
  <pre><code>function codeAddress(address, contentString) {
  
  var infowindow = new google.maps.InfoWindow({
    content: contentString
  });
  
  if (geocoder) {
  
    geocoder.geocode( { 'address': address}, function(results, status) {
  
      if (status == google.maps.GeocoderStatus.OK) {
  
          map.setCenter(results[0].geometry.location);
  
         var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
         });
  
         infowindow.open(map,marker);
  
        } else {
         alert("Geocode was not successful for the following reason: " + status);
        }
      });
    }
  </code></pre>
  
  <p>}</p>