function MapImage(bounds, opt_weight, opt_color, imgSrc) {
  this.bounds_ = bounds;
  this.weight_ = opt_weight || 2;
  this.color_ = opt_color || "#000";
  this.imgSrc = imgSrc || 'arm.png'
  this.getPixelBounds = function(){
    var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());
    var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());
    return [c1,c2];
  }
  this.getBounds = function(){
    return bounds;
  }
  this.hide = function(){
    this.div_.style.visibility = 'hidden'
  }
  this.show = function(){
    this.div_.style.visibility = 'visible'
  }
  this.setImage = function(imgSrc){
    this.imgSrc= imgSrc
    this.div_.src = this.imgSrc;
  }
}

MapImage.prototype = new GOverlay();

MapImage.prototype.initialize = function(map) {
  var div = document.createElement("img");
  div.style.border = this.weight_ + "px solid " + this.color_;
  div.style.position = "absolute";
  div.src = this.imgSrc;
  map.getPane(G_MAP_MAP_PANE).appendChild(div);
  this.map_ = map;
  this.div_ = div;
}

MapImage.prototype.remove = function() {
  this.div_.parentNode.removeChild(this.div_);
}

MapImage.prototype.copy = function() {
  return new MapImage(this.bounds_, this.weight_, this.color_,this.backgroundColor_, this.opacity_);
}

MapImage.prototype.redraw = function(force) {
  if (!force) return;
  var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest());
  var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast());
  this.div_.style.width = Math.abs(c2.x - c1.x) + "px";
  this.div_.style.height = Math.abs(c2.y - c1.y) + "px";
  this.div_.style.left = (Math.min(c2.x, c1.x) - this.weight_) + "px";
  this.div_.style.top = (Math.min(c2.y, c1.y) - this.weight_) + "px";
}
    
