﻿var customWindow = function(marker, html) {
    this.marker = marker;
    this.html = html;

}

customWindow.prototype = new GOverlay();

customWindow.prototype.initialize = function(map) {
    var div = document.createElement("div");
    div.innerHTML = this.html;
    div.id = 'custominfowindow';

    offsetX = 212;
    offsetY = 218;

    div.style.display = 'block'
    div.style.position = 'absolute';
    div.style.top = (map.fromLatLngToDivPixel(this.marker.getPoint()).y - offsetY) + 'px';
    div.style.left = (map.fromLatLngToDivPixel(this.marker.getPoint()).x - offsetX) + 'px';

    this._map = map;
    this._div = div;

    //div.onclick = closeOverlay;

    map.getPane(G_MAP_FLOAT_PANE).appendChild(div);

}

customWindow.prototype.remove = function() {
    this._div.parentNode.removeChild(this._div);

}

customWindow.prototype.redraw = function() {
    this._div.style.top = (map.fromLatLngToDivPixel(this.marker.getPoint()).y - offsetY) + 'px';
    this._div.style.left = (map.fromLatLngToDivPixel(this.marker.getPoint()).x - offsetX) + 'px';

}

