function hbGlobalOverlay (url, bounds, opacity)
{
  this.url = url;
  this.bounds = bounds;
  this.opacity = parseFloat (opacity);
}

hbGlobalOverlay.prototype = new GOverlay();

hbGlobalOverlay.prototype.initialize = function (map)
{
  this.map = map;

  this.img = document.createElement ("img");
  this.img.style.position = "absolute";
  this.img.style.opacity = this.opacity;
  this.img.style.MozOpacity = this.opacity;
  this.img.style.filter  = "alpha(opacity=" + this.opacity + ")";
  this.img.src = this.url;

  map.getPane (G_MAP_MAP_PANE).appendChild (this.img);
}

hbGlobalOverlay.prototype.remove = function ()
{
  if (this.img)
  {
    this.img.parentNode.removeChild (this.img);
  }
}

hbGlobalOverlay.prototype.copy = function ()
{
  return new hbGlobalOverlay (this.url, this.bounds, this.opacity);
}

hbGlobalOverlay.prototype.redraw = function (force)
{
  if (true == force)
  {
    var sw = this.map.fromLatLngToDivPixel (this.bounds.getSouthWest ());
    var ne = this.map.fromLatLngToDivPixel (this.bounds.getNorthEast ());

    this.img.style.width = Math.abs (ne.x - sw.x) + "px";
    this.img.style.height = Math.abs (ne.y - sw.y) + "px";
    this.img.style.left = Math.min (ne.x, sw.x) + "px";
    this.img.style.top = Math.min (ne.y, sw.y) + "px";
  }
}

hbGlobalOverlay.prototype.getBounds = function ()
{
  return this.bounds;
}

hbGlobalOverlay.prototype.refresh = function ()
{
  this.remove ();
  this.initialize ();
  this.redraw (true);
}
