var half_labelw = 70;

function jLabel(coords, text, map) {

    this.coords_ = coords;
    this.text_ = text;
    this.map_ = map;
    this.div_ = null;
    this.setMap(map);
    
  }

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

  jLabel.prototype.onAdd = function() {

    var div = document.createElement('DIV');
    div.style.borderStyle = "solid";
    div.style.borderWidth = "1px";
    div.style.position = "absolute";
    div.style.background = "#89A33B";
    div.style.fontSize = "12px";
    div.style.padding = "5px";
    div.style.color = "#000000";
    div.style.textAlign = "center";
    div.innerHTML = "<b>" + this.text_ + "</b>";

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

  jLabel.prototype.draw = function() {
    var overlayProjection = this.getProjection();
    var divcntpnt = overlayProjection.fromLatLngToDivPixel(this.coords_);

    var div = this.div_;
    div.style.left = (divcntpnt.x - half_labelw) + 'px';
    div.style.top = (divcntpnt.y -7) + 'px';
    div.style.width = half_labelw*2 + 'px';
    div.style.height = '14px';
  }

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

