title: Google maps Icon
body: <p>I'm trying to set a google maps Icon depending on a integer. I.E. if the variable is 3 it will set the icon to be a brown image marker. I've followed the tutorial found here <a href="https://developers.google.com/maps/documentation/javascript/examples/icon-simple" rel="nofollow noreferrer">https://developers.google.com/maps/documentation/javascript/examples/icon-simple</a> and here<br>
  <a href="https://stackoverflow.com/questions/2472957/how-can-i-change-the-color-of-a-google-maps-marker">How can I change the color of a Google Maps marker?</a></p>
  
  <p>This is my code, my images are located in the same directory but when I load the page I get an error saying Unexpected identifier at icon: image. Whats the problem?  </p>
  
  <pre><code>function getlocations(){
      var data = &lt;?php echo getjson(); ?&gt;;
      var i = 0;
      var locations = new Array();
      for(i; i &lt; data.length; i++){
          var dataholder = [data[i].misc, parseFloat(data[i].lat), parseFloat(data[i].lng), parseInt(data[i].status)];
          locations.push(dataholder);
      }
      return locations;
  }
  
  function createmap() {
  
      var locations = getlocations();
  
      var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 13,
          center: new google.maps.LatLng(47.624561, -122.356445),
          mapTypeId: google.maps.MapTypeId.ROADMAP
      });
  
      var infowindow = new google.maps.InfoWindow();
  
      var marker, i;
      var markers = new Array();
      var image;
  
      for (i = 0; i &lt; locations.length; i++) {
  
          if (locations[i][3] == 3) {
              image = 'brown_MarkerA.png';
          } else if (locations[i][3] == 4) {
              image = 'brown_MarkerB.png';
          } else {
              image = 'brown_MarkerC.png';
          }
  
          marker = new google.maps.Marker({
              position: new google.maps.LatLng(locations[i][1], locations[i][2]),
              map: map
              icon: image
          });
  
          markers.push(marker);
  
          google.maps.event.addListener(marker, 'click', (function (marker, i) {
              return function () {
                  infowindow.setContent(locations[i][0]);
                  infowindow.open(map, marker);
              }
          })(marker, i));
      }
  
      function AutoCenter() {
          var bounds = new google.maps.LatLngBounds();
          $.each(markers, function (index, marker) {
              bounds.extend(marker.position);
          });
          map.fitBounds(bounds);
      }
      AutoCenter();
  }
  </code></pre>