function Scroller(containerName, scrollerName, speed) {
    this.container = document.getElementById(containerName);
    this.scroller = document.getElementById(scrollerName);
    this.scrollHeight = this.scroller.offsetHeight
    this.clipHeight = this.container.offsetHeight
    this.up = scrollerUp;
    this.down = scrollerDown;
    this.move = scrollerMove;
    this.start = scrollerStart;
    this.stop = scrollerStop;
    this.wheel = scrollerWheel;
    this.speed = speed;
    this.loop;
    this.x;
    this.y;
    this.timer;
    this.obj = scrollerName + 'Object';
    this.move(0, 0);
    this.container.style.visibility = 'visible';
    this.initialized = true;
    eval(this.obj + '=this') 
    return(this);
}

function scrollerMove(x, y) {
    this.x = x;
    this.y = y
    this.scroller.style.left = this.x + 'px';
    this.scroller.style.top = this.y + 'px';
}

function scrollerDown(move) {
   if (this.y > -this.scrollHeight+this.clipHeight) {
      this.move(0, this.y-move)
      if (this.loop) {
         setTimeout(this.obj+'.down('+move+')', this.speed);
      }
   }
}

function scrollerUp(move) {
   if (this.y < 0) {
      this.move(0, this.y-move)
      if (this.loop) {
         setTimeout(this.obj+'.up('+move+')', this.speed);
      }
   }
}

function scrollerStart(d) {
   if (this.initialized) {
      this.loop = true;
      if (d > 0) {
         this.down(d);
      }
      else {
         this.up(d)
      }
   }
}

function scrollerStop() {
    this.loop = false;
    if (this.timer) {
      clearTimeout(this.timer);
    }
}

function scrollerWheel() {
   if (event.wheelDelta >= 120) {
      this.start(-7);
      this.stop();
   }
   else if (event.wheelDelta <= -120) {
      this.start(7);
      this.stop();
   }
}