// 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 Rectangle(opt_weight, opt_color, ov_color, image, imageBig, point) 
{
    //this.bounds_ = bounds;
    this.weight_ = opt_weight || 1;
    this.color_ = opt_color || "white";
    this.ov_color_ = ov_color || "red";
    this.image_ = image;
    this.point_ = point;
    this.imRootBig_ = imageBig;
}
Rectangle.prototype = new GOverlay();

// Creates the DIV representing this rectangle.
Rectangle.prototype.initialize = function(map) 
{
    // Create the DIV representing our rectangle
    var div = new Image(36,36)
    div.src = this.image_;
    div.style.width = "36px";
    div.style.height = "36px";
    

    div.style.border = this.weight_ + "px solid " + this.color_;
    div.style.position = "absolute";
    div.style.cursor = "pointer";

    var col = this.color_;
    var ov_col = this.ov_color_;
    var msg = this.imRootBig_;
    var point = this.point_;
    div.onmouseover = function mouserOverDiv()
    {
        this.style.border = "1px solid " + ov_col;
    }
    div.onmouseout = function mouserOutDiv()
    {
        this.style.border = "1px solid " + col;
    }

    div.onclick = function clickOn()
    {
        map.closeInfoWindow()
        map.openInfoWindow(point, msg);
    }

    // Our rectangle is flat against the map, so we add our selves to the
    // MAP_PANE pane, which is at the same z-index as the map itself (i.e.,
    // below the marker shadows)
    map.getPane(G_MAP_MAP_PANE).appendChild(div);

    this.map_ = map;
    this.div_ = div;
}



// Remove the main DIV from the map pane
Rectangle.prototype.remove = function() {
    if(this.div_.parentNode!=null)
    {
        //this.div_.parentNode.removeChild(this.div_);
        this.div_.parentNode.innerHTML = "";
    }
}

// Copy our data to a new Rectangle
Rectangle.prototype.copy = function() 
{
    return new Rectangle(this.bounds_, this.weight_, this.color_, this.backgroundColor_, this.opacity_);
}

// Redraw the rectangle based on the current projection and zoom level
Rectangle.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 c1 = this.map_.fromLatLngToDivPixel(this.point_);

    this.div_.style.left = c1.x + "px";
    this.div_.style.top = c1.y + "px";
}