var ApplicationClass = Class.create()

ApplicationClass.prototype =
{
  initialize: function() {

  },

  domloaded_init: function() {
    this.addObserverExternalAnchorOnClick();
  },

  addObserverExternalAnchorOnClick: function() {
    $$("a[rel=external]").each(function(link) {
      link.observe('click', function(event) {
        window.open(this.readAttribute('href'));                  /* Open link in new window */
        Event.stop(event);                                        /* Prevent default behavior, i.e. following link */
      }.bind(link));                                              /* Bind this to the link so we have the correct <a> tag context */
    });
  }
}

var app = new ApplicationClass();
document.observe('dom:loaded', function () { app.domloaded_init(); });
