title: Change Google Maps marker icon when clicking on other
body: <p>I have created a Google Maps Multiple locations page,
  using Advanced Custom Fields Google Map field.</p>
  
  <p>I have managed to make the marker icon change when clicked on, but I want it to be changed back when clicking on other icons.</p>
  
  <p>here is an example of the code:</p>
  
  <pre><code>    for (i = 0; i &lt; locations.length; i++) {  
    marker = new google.maps.Marker({
      position: new google.maps.LatLng(locations[i][1], locations[i][2]),
      map: map,
      icon: iconBase + 'Stock%20Index%20Up.png'
    });
  
    google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
        infowindow.setContent(locations[i][0], locations[i][6]);
        infowindow.open(map, marker);
        marker.setIcon("https://cdn3.iconfinder.com/data/icons/musthave/24/Stock%20Index%20Down.png");
      }
    })(marker, i));
  </code></pre>
  
  <p>Better look of the working code here:
  <a href="http://jsfiddle.net/gargiguy/s8vgxp3g" rel="noreferrer">http://jsfiddle.net/gargiguy/s8vgxp3g</a></p>