function Monument(map, image, point, anchor, imgsize, scale) {
    this.map_ = map;
    this.image_ = image;
    this.point_ = point;
    this.anchor_ = anchor;
    this.imgsize_ = imgsize;
    this.scale_ = scale*2;

    this.div_ = null;

    this.setMap(map);
}

Monument.prototype = new google.maps.OverlayView();

Monument.prototype.onAdd = function() {
    var div = document.createElement('DIV');
    $(div).css({
        "position": "absolute"
    });

    var img = document.createElement("img");
    $(img).attr("src", this.image_);
    $(img).css({
        "width": "100%",
        "height": "100%"
    });
    $(div).append(img);
    
    var divSize = new google.maps.Size(0, 0);
    if(img.width != 0 && img.height != 0) {
        divSize = new google.maps.Size(img.width, img.height);
    } else if(this.imgsize_) {
        divSize = this.imgsize_;
    }
    $(div).css({
        "width": divSize.width + "px",
        "height": divSize.height + "px"
    });

    var overlayProjection = this.getProjection();
    var point = overlayProjection.fromLatLngToDivPixel(this.point_);
    var scale = this.scale_;
    var anchor = this.anchor_;
    if(scale == null)
        scale = 1;
    if(anchor == null)
        anchor = new google.maps.Size(divSize.width/2, divSize.height);
    
    swPoint = new google.maps.Point();
    nePoint = new google.maps.Point();
    if(!anchor) {
        swPoint.x = point.x - scale*divSize.width/2;
        swPoint.y = point.y + scale*divSize.height/2;
        nePoint.x = point.x + scale*divSize.width/2;
        nePoint.y = point.y - scale*divSize.height/2;
    } else {
        swPoint.x = point.x - scale*anchor.x;
        swPoint.y = point.y + scale*divSize.height - scale*anchor.y;
        nePoint.x = point.x + scale*divSize.width - scale*anchor.x;
        nePoint.y = point.y - scale*anchor.y;
    }
    swBound = overlayProjection.fromDivPixelToLatLng(swPoint);
    neBound = this.getProjection().fromDivPixelToLatLng(nePoint);
    this.bounds_ = new google.maps.LatLngBounds(swBound, neBound);

    this.div_ = div;

    var panes = this.getPanes();
    panes.overlayLayer.appendChild(div);
}

Monument.prototype.draw = function() {
    var overlayProjection = this.getProjection();

    var sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest());
    var ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast());

    var div = this.div_;
    $(div).css("left", sw.x + 'px');
    $(div).css("top", ne.y + 'px');
    $(div).css("width", (ne.x - sw.x) + 'px');
    $(div).css("height", (sw.y - ne.y) + 'px');
}

Monument.prototype.onRemove = function() {
    this.div_.parentNode.removeChild(this.div_);
    this.div_ = null;
}
