var Vspot = Class.create({
  initialize: function() {
    this.initObservings();
  },

  initObservings: function() {
    document.observe('vspot:alert', function(event) {
      this.clearAlerts();
      $('alert_'+event.memo.status).innerHTML = event.memo.message;
      $('alert_'+event.memo.status).show();
    }.bind(this));

    document.observe('vspot:clear_alerts', function(event) {
      this.clearAlerts();
    }.bind(this));
  },

  clearAlerts: function() {
    $('notifications').childElements().invoke('hide');  
  }

});
