// A GroundOverlay 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 GroundOverlay(label,latlng, opt_weight, opt_color) {
  this.label_  = label;
  this.latlng_ = latlng;
	this.opacity_  = 70;
  this.weight_ = opt_weight || 2;
  this.color_ = opt_color || "#888888";
}
GroundOverlay.prototype = new GOverlay();

// Creates the DIV representing this GroundOverlay.
GroundOverlay.prototype.initialize = function(map) {
  // Create the DIV representing our GroundOverlay
  var div = document.createElement("div");
 // div.appendChild(document.createTextNode(this.label_));
  // Our GroundOverlay 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_ = map1;
  this.div_ = div;
}

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

// Copy our data to a new GroundOverlay
GroundOverlay.prototype.copy = function() {
  return new GroundOverlay(this.label_,this.latlng_, this.weight_, this.color_,
                       this.backgroundColor_, this.opacity_);
}

// Redraw the GroundOverlay based on the current projection and zoom level
GroundOverlay.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 GroundOverlay
  // Now position our DIV based on the DIV coordinates of our bounds
  c1=this.map_.fromLatLngToDivPixel(this.latlng_);
	z=map1.getZoom();
	addx=0;
	addy=0;
	if(z==18){
		addx=3;
	  addy=20;
	}
	if(z==16){
	  addx=-1;
	  addy=-7;
	}
	if(z==15){
	  addx=0;
	  addy=-12;
	}

	
  //this.div_.style.width = "100px";
  //this.div_.style.height = "0px";
  this.div_.style.left = ((c1.x)+addx)+"px";
  this.div_.style.top = ((c1.y)+addy)+"px";
	this.div_.style.position   = "absolute";
	this.div_.style.background = "none";
	this.div_.style.padding    = "0";
	this.div_.style.margin     = "0";
	this.div_.id="groundOverlay";
	if(z>14)
    this.div_.innerHTML= "<p>"+this.label_+"_"+z+".gif'></p>" ;
	else this.div_.innerHTML= "" ;
}