function IconedMarker(latlng, opts) {
    this.latlng_ = latlng;
    this.opts_ = opts;

    GMarker.apply(this, arguments);
}

IconedMarker.prototype = new GMarker(new GLatLng(0, 0));

IconedMarker.prototype.initialize = function(map) {
    GMarker.prototype.initialize.apply(this, arguments);

    this.map_ = map;

    this.icon_ = document.createElement("img");
    this.icon_.src = this.opts_.customIconSrc;
    this.icon_.style.position = "absolute";

    map.getPane(G_MAP_MARKER_PANE).appendChild(this.icon_);
};

IconedMarker.prototype.redraw = function(force) {
    GMarker.prototype.redraw.apply(this, arguments);

    this.redrawIcon_();
};

IconedMarker.prototype.redrawIcon_ = function() {
    // Calculate the DIV coordinates of two opposite corners of our bounds to
    // get the size and position of our rectangle
    var p = this.map_.fromLatLngToDivPixel(this.latlng_);
    var z = GOverlay.getZIndex(this.latlng_.lat());

    var iconOffset = this.opts_.icon.iconAnchor;

    // Now position our div based on the div coordinates of our bounds
    this.icon_.style.left = (p.x - iconOffset.x + this.opts_.customIconOffset) + "px";
    this.icon_.style.top = (p.y - iconOffset.y + this.opts_.customIconOffset) + "px";
    this.icon_.style.zIndex = z; // in front of the marker
};

IconedMarker.prototype.remove = function() {
    if (this.icon_.parentNode) {
        this.icon_.parentNode.removeChild(this.icon_);
    }
    this.icon_ = null;

    GMarker.prototype.remove.apply(this, arguments);
};

IconedMarker.prototype.setLatLng = function(latlng) {
    GMarker.prototype.setLatLng.apply(this, arguments);

    this.latlng_ = latlng;

    this.redrawIcon_();
};
