var Extractor = Class.create();
Extractor.prototype = {
  initialize: function(aggregator, url) {
    this.aggregator = aggregator;
    this.url = url;
    this.aggregate();
  },
  aggregate: function() {
    var request_url = '/aggregate?url=' + encodeURIComponent(this.url) + '&aggregator=' + this.aggregator;
    var id = 'aggregator-' + this.aggregator;
    new Ajax.Request(request_url, {
      method: 'get',
      onLoading: function() {
        $(id).innerHTML = 'loading...';
      },
      onComplete: function(transport) {
        $(id).style.display = 'none';
        $(id).innerHTML = transport.responseText;
        Effect.BlindDown(id, { duration: 0.5 });
      }
    });
  }
};
