var hintw;
function MyHintWindow(point, html) {
  this.point_ = point; this.html_ = html; this.counter_ = 0;
}
MyHintWindow.prototype = new GOverlay();
MyHintWindow.prototype.initialize = function(map) {
  var div = document.createElement("div");
  div.style.position = "absolute";
  div.innerHTML =
'<div class="ihramka1"><div class="ihramka2"><div class="ihramka3"><div class="ihramka4"><div class="ihramka5"><nobr>'+
this.html_+'</nobr></div></div></div></div></div>';

  map.getPane(G_MAP_MARKER_PANE).appendChild(div);

  this.map_ = map;
  this.div_ = div;
  this.div_.hintw = this;

  this.counter_ = 1;
  this.fix_ = 0;
  this.tmo = 0;
  this.div_.onmouseover = function () { this.IncCounter(); }.bind(this);
  this.div_.onmouseout = function () { this.DecCounter(); }.bind(this);
}

MyHintWindow.prototype.IncCounter = function() {
  window.clearTimeout(this.tmo);
  this.counter_ ++;
}
MyHintWindow.prototype.DecCounter = function() {
  window.clearTimeout(this.tmo);
  this.counter_ --;
  this.tmo = window.setTimeout(function() { HWClose(this); }.bind(this), 100);
}
MyHintWindow.prototype.Fix = function() {
  window.clearTimeout(this.tmo);
  this.fix_ = 1;
}
MyHintWindow.prototype.UnFix = function() {
  window.clearTimeout(this.tmo);
  this.fix_ = 0;
  this.tmo = window.setTimeout(function() { HWClose(this); }.bind(this), 100);
}


MyHintWindow.prototype.CloseHW = function() {
  window.clearTimeout(this.tmo);
  if ((this.counter_ <= 0) && (this.fix_ == 0)) {
    this.marker.hintw = null;
    this.map_.removeOverlay(this);
  }
}

MyHintWindow.prototype.remove = function() {
  this.div_.parentNode.removeChild(this.div_);
}

MyHintWindow.prototype.copy = function() {
  return new Rectangle(this.point_, this.html_);
}

MyHintWindow.prototype.redraw = function(force) {
  if (!force) return;
  var c1 = this.map_.fromLatLngToDivPixel(this.point_);
  this.div_.style.left = (c1.x + 16) + "px";
  this.div_.style.top = (c1.y - 16) + "px";
}

function HWClose(hw)
{
  hw.CloseHW();
}