<!--
/*                                     */
/* by Damien <damien@hotbox.ru>        */
/* tested only for vertical srcollings */
/*                                     */
      scrollers = Array();
  
      function createScroller(id, width, height, dirX, dirY, delay, content) {
        this.id = id;
        this.dirX = dirX;
        this.dirY = dirY;
        this.width = width;
//        this.width = '100%';
        this.height = height;
        this.delay = delay;
        this.content = content;
        
        this.owner = null;
        this.posX = null;
        this.posY = null;
        this.totalWidth = null;
        this.totalHeight = null;
        
        this.scroll = scroll;
        this.populate = populate;
        this.start = start;
        this.pause = pause;
        return this;
      }
      
      function populateScrollers() {
        
        for (i=0; i<scrollers.length; i++)
          scrollers[i].populate();
      }
      
      function populate() {
        content = '<div id="scroller' + this.id + '_owner" style="position: relative; width: ' + this.width + '; height: ' + this.height + '; overflow: hidden" onmouseover="scrollers[' +this.id + '].pause()" onmouseout="scrollers[' +this.id + '].start()"><div style="position: absolute; top:0; left: 0; width: 100%"></div></div>';
        document.write(content);
      }
      
      function start() {
        this.interval = setInterval('scrollers[' + this.id + '].scroll()', this.delay);
      }
      
      function pause() {
        clearInterval(this.interval);
      }
      
      
      function scroll() {
        if (this.owner==null)
          this.owner = document.getElementById? document.getElementById("scroller" + this.id + "_owner"):document.all['scroller' + this.id + '_owner'];

        if (this.owner)
          if (!(this.owner.children[0].innerHTML))
            this.owner.children[0].innerHTML = this.content;
        
        if (this.totalHeight==null) {
          this.totalHeight = this.owner.children[0].offsetHeight;
        }
        if (!this.totalHeight) { this.totalHeight = this.height; }
        
        if (this.totalWidth==null) {
          this.totalWidth = this.owner.children[0].offsetWidth;
        }
        if (this.posX==null) {
          if (this.dirX<0)
            this.posX = this.totalWidth;
          else 
            if (this.dirX>0)
              this.posX = -this.totalWidth;
            else
              this.posX = 0;
        }
        
        if (this.posY==null) {
          if (this.dirY<0)
            this.posY = this.height;
          else {
            if (this.dirY>0)
              this.posY = -this.totalHeight;
            else
              this.posY = 0;
          }
        }
        
        this.posX = this.posX+this.dirX;
        this.posY = this.posY+this.dirY;
        if (this.dirY<0) {
          if (this.posY<-this.totalHeight) {
            this.posY = this.height;
          }
        }
        else if (this.dirY>0) {
          if (this.posY>this.totalHeight-this.height)
            this.posY = -this.totalHeight;
        }
        
        if (this.dirX<0) {
          if (this.posX<-this.totalWidth)
            this.posX = this.totalWidth-this.width;
        }
        else if (this.dirX>0) {
          if (this.posX>this.totalWidth)
            this.posX = -this.totalWidth;
        }
        
        if (this.posX) this.owner.children[0].style.left = this.posX + 'px';
        if (this.posY) this.owner.children[0].style.top = this.posY + 'px';
      }
//-->
