var Popup = Class.create({	
  initialize: function(popupId) {
		this.popup = $(popupId);
		this.show();
  },

  show: function() {
		this.hideOtherBalloons();
    new Effect.Appear(this.popup, {duration:0.1});
		Event.observe(document, 'click', function(event) {
	    var el = Event.element(event);
			if (el!=this.popup) {
				this.popup.hide();
			}
		}.bind(this));
  },
	
	hideOtherBalloons: function() {
		Element.extend(document.body);
		$($(document).body).select('.balloon').each(function(e) {
			if (e!=this.popup) e.hide();
		}, this);
		Event.stopObserving(document, 'click');
	}
});

