﻿var div;
HMOverlay.prototype = new google.maps.OverlayView();
function HMOverlay(bounds, image, map) {
    this.bounds_ = bounds;
    this.image_ = image;
    this.map_ = map;
    this.div_ = null;
    this.setMap(map);
}
HMOverlay.prototype.onAdd = function() {
    div = document.createElement('DIV');
    div.style.borderStyle = "none";
    div.style.borderWidth = "0px";
    div.style.position = "absolute";
    div.style.display = "block";
    var img = document.createElement("img");
    img.src = this.image_;
    img.style.width = "100%";
    img.style.height = "100%";
    div.appendChild(img);
    this.div_ = div;
    var panes = this.getPanes();
    panes.overlayImage.appendChild(div);
}
HMOverlay.prototype.draw = function() {
    var overlayProjection = this.getProjection();
    var sw = overlayProjection.fromLatLngToDivPixel(this.bounds_.getSouthWest());
    var ne = overlayProjection.fromLatLngToDivPixel(this.bounds_.getNorthEast());
    var divt = this.div_;
    divt.style.left = sw.x + 'px';
    divt.style.top = ne.y + 'px';
    divt.style.width = (ne.x - sw.x) + 'px';
    divt.style.height = (sw.y - ne.y) + 'px';
}
HMOverlay.prototype.onRemove = function() {
    this.div_.parentNode.removeChild(this.div_);
    this.div_ = null;
}
