old_contents: function ModalBox(args) {
      self = this;
      this.view = $('<div class="modalbox"><div class="wrapper"><p></p><div class="buttons"></div></div></div>');
      this.view.find('.wrapper p').text(args.message);
  
      $.each(args.buttons, function(i, button) {
          var elem = $('<button></button>').text(button.label);
          elem.click(button.callback);
          self.view.find('.buttons').append(elem);
      });
  
      this.show = function() {
          $('body').append(this.view);
      };
  
      this.remove = function() {
          this.view.remove();
      };
  }
  
  function ReloadDialog() {
  }
  
  ReloadDialog.prototype = new ModalBox({
      message: 'Your account has been used somewhere else. Please reload the page.',
      buttons: [
          {
              label: 'Reload',
              callback: function() {
                  location.reload();
              }
          }
      ]
  });
  
  function WhatIsFlattrDialog() {
  }
  
  WhatIsFlattrDialog.prototype = new ModalBox({
      message: 'Flattr is an easy way to send micropayments. With your help we can create a sustainable way for music artists to get paid.',
      buttons: [
          {
              label: 'Connect your Flattr account',
              callback: function() {
                  location.href = '/flattrconnect';
              }
          }
      ]
  });
  
new_contents: function ModalBox() {
      this.view = $('<div class="modalbox"><div class="wrapper"><p></p><div class="buttons"></div></div></div>');
  }
  
  ModalBox.prototype.setMessage = function(message) {
      this.view.find('.wrapper p').text(message);
  };
  
  ModalBox.prototype.addButton = function(label, callback) {
      var self = this;
      var elem = $('<button></button>').text(label);
      elem.click(function() {
          callback(self)
      });
      this.view.find('.buttons').append(elem);
  };
  
  ModalBox.prototype.show = function() {
      $('body').append(this.view);
  };
  
  ModalBox.prototype.remove = function() {
      this.view.remove();
  };
  
  /* RELOAD DIALOG
   ****************************************************************************/
  
  function ReloadDialog() {
      ModalBox.call(this);
  
      this.setMessage('Your account has been used somewhere else. Please reload the page.');
  
      this.addButton('Reload', function(self) {
          location.reload();
      });
  }
  
  ReloadDialog.prototype = new ModalBox();
  ReloadDialog.prototype.constructor = ReloadDialog;
  
  /* FLATTR DIALOG
   ****************************************************************************/
  
  function WhatIsFlattrDialog() {
      ModalBox.call(this);
  
      this.setMessage('Flattr is an easy way to send micropayments. With your help we can create a sustainable way for music artists to get paid.');
  
      this.addButton('Connect your Flattr account', function(self) {
          location.href = '/flattrconnect';
      });
  
      this.addButton('Cancel', function(self) {
          self.remove();
      });
  }
  
  WhatIsFlattrDialog.prototype = new ModalBox();
  WhatIsFlattrDialog.prototype.constructor = WhatIsFlattrDialog;
  
subject: Rework the ModalBox code