

// A Rectangle is a simple overlay that outlines a lat/lng bounds on the
// map. It has a border of the given weight and color and can optionally
// have a semi-transparent background color.
function CustomInfoWindow(point, html) {
  //this.bounds_ = bounds;
  this.html_ = html;
  this.point_ = point;
}
CustomInfoWindow.prototype = new GOverlay();

// Creates the DIV representing this rectangle.
CustomInfoWindow.prototype.initialize = function(map) {
  // Create the DIV representing our rectangle
  var div = document.createElement("div");
  div.style.background = "#FDEEB0";
  div.style.border = "solid #B2BCB6 1px";
  div.style.padding = "3px";
  div.style.whiteSpace = "nowrap";
  div.style.position = "absolute";
  div.style.zIndex = "1000";
  
  //var html=this.html_ + "<a href=\"\" onClick=\"closeCustomInfoWindow(); return false;\">X</a>";
  var html=this.html_ + " <img class=\"close\" src=\"/assets/images/remove.gif\" width=\"15\" height=\"15\" border=\"0\" align=\"absmiddle\" alt=\"Schlie&szlig;en\" title=\"Schlie&szlig;en\" onclick=\"closeCustomInfoWindow(); return false;\">";
  div.innerHTML=html;
    
  // This pane contains the info window. It is above everything else on the map.
  map.getPane(G_MAP_FLOAT_PANE).appendChild(div);
  
  this.map_ = map;
  this.div_ = div;
}

// Remove the main DIV from the map pane
CustomInfoWindow.prototype.remove = function() {
  this.div_.parentNode.removeChild(this.div_);
}

// Copy our data to a new Rectangle
CustomInfoWindow.prototype.copy = function() {
  return new CustomInfoWindow(this.point_, this.html_);
}

// Redraw the rectangle based on the current projection and zoom level
CustomInfoWindow.prototype.redraw = function(force) {
  // We only need to redraw if the coordinate system has changed
  if (!force) return;

  // Calculate the DIV coordinates of two opposite corners of our bounds to
  // get the size and position of our rectangle
  var pixel = this.map_.fromLatLngToDivPixel(this.point_);

  // Now position our DIV based on the DIV coordinates of our bounds
  //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 = (pixel.x + 10) + "px";
  this.div_.style.top = (pixel.y - 10) + "px";
}


