tags:

views:

381

answers:

0

I've looked at as many examples as I could find, and they all show me the same thing. I can't figure out what I'm doing wrong. I'm using a custom icon, placing it on the map, and adding a popup overlay to it. The custom icon will display, but the popup won't. If I don't use a custom icon, the popup and icon work fine.

        function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(43.220689, -87.974396), 11);

  var pin1 = "http://chart.apis.google.com/chart?chst=d_map_xpin_letter&chld=pin_star|1|FF0000|000000|00E5FF";
  var shadow = "http://www.google.com/mapfiles/shadow50.png";

  var Icon1 = new GIcon();
        Icon1.image = pin1;
  Icon1.shadow = shadow;
        Icon1.iconAnchor = new GPoint(6, 20);

  function createMarker(point, html) {
   var marker = new GMarker(point,{clickable:true, icon:Icon1});
   GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); });
  return marker;
  }

  var point = new GLatLng(43.308926, -87.961113); 
  var html = "Some stuff.";
  var marker = createMarker(point, html);
  map.addOverlay(marker);

        map.setUIToDefault();
      }
    }

Please help! I have no idea what else to look at. Something is causing the popup to break when the custom icon is there. But the icon shows fine, so it's formatted properly.

Thanks