var Overlay = Class.create({
  defaultOptions: {
    opacity: 0.85
  },

  initialize: function(options) {
    options     = $H(this.defaultOptions).merge(options || {});
    var opacity = options.unset("opacity");

    this.element = new Element("div", options.toObject()).addClassName("overlay");
    this.element.setOpacity(opacity);
    this.element.observe("click", this.hide.bindAsEventListener(this));

    $$("body").first().insert(this.element);

    this.hide();
  },

  show: function(event, bubble) {
    if (event && !bubble) { event.stop(); }
    this.element.show()
  },

  hide: function(event, bubble) {
    if (event && !bubble) { event.stop(); }
    this.element.hide()
  }
});