
Effect.Scroll = Class.create();
Object.extend(Object.extend(Effect.Scroll.prototype, Effect.Base.prototype), {
  initialize: function(element) {
  	
    this.element = $(element);
    var options = Object.extend({
      x:    0,
      y:    0,
      changeLeft: false,
      changeTop:  false
    }, arguments[1] || {});
    
    this.start(options);
  },
  setup: function() {
  	
    this.originalLeft = parseFloat(this.element.scrollLeft || '0');
    this.originalTop  = parseFloat(this.element.scrollTop  || '0');
    
    this.options.changeLeft = true;

    this.options.changeTop = true;
    // Changing scrollLeft and scrollTop is relatively slow, this is supposed to make the effect faster
/*    if (this.originalLeft != this.options.x)
        this.options.changeLeft = true;
    if (this.originalTop != this.options.y)
        this.options.changeTop = true;*/
  },
  update: function(position) {
  	
  	//$('message').innerHTML = this.options.changeTop;
  	
    if (this.options.changeLeft) 
        this.element.scrollLeft = this.options.x*position + this.originalLeft;
    if (this.options.changeTop)
        this.element.scrollTop  = this.options.y*position + this.originalTop;

  }
});