title: Changing KML Placemark icons on click in Google Maps API V3
body: <p>I am trying to change the KML placemark icons of a KML overlay in a sample Maps application that I am working on. </p>
  
  <p>Here's the sample code -</p>
  
  <pre><code>function seekml() {
  
  var myLatlng = new google.maps.LatLng(40.65, -73.95);
  var myOptions = {
      zoom: 14,
      mapTypeControl: true,
      center: myLatlng,
      mapTypeControlOptions: {
          style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
       position: google.maps.ControlPosition.TOP_RIGHT
      },
      navigationControl: true,
      navigationControlOptions: {
          style: google.maps.NavigationControlStyle.SMALL
      },
      mapTypeId: google.maps.MapTypeId.ROADMAP
  };
  url_end = "?nocache=" + (new Date()).valueOf(); //For No KML Caching 
  myKML = "http://kmlscribe.googlepages.com/SamplesInMaps.kml" + url_end
  
  gMap = new google.maps.Map(document.getElementById("map"), myOptions);
  var ctaLayer = new google.maps.KmlLayer(myKML,{suppressInfoWindows: true});
  ctaLayer.setMap(gMap);
  
  google.maps.event.addListener(ctaLayer, 'click', function(event) {              
      this.setIcon(gYellowIcon);
    });
  }
  </code></pre>
  
  <p>gYellowIcon has been defined in my code before -</p>
  
  <pre><code>var gYellowIcon = new google.maps.MarkerImage(
    "image url",
    new google.maps.Size(31, 31),
    new google.maps.Point(0, 0),
    new google.maps.Point(6, 20));
  </code></pre>
  
  <p>I want to change the KML overlay placemarks, when the user clicks on any of the placemarks shown on the KML overlay. The above code doesn't work.</p>