var scroller;

function Scroller(w, h, f, s, c) {
  this.width = w - 2;
  this.height = h;
  this.fontSize = f;
  this.speed = s;
  this.content = c.split('||');

  document.write('<div class="banners" id="scrollerContainer" style="z-index: 10; height: '+this.height+'px; overflow: hidden" onMouseOver="m.nogo()" onMouseOut="m.go()"><span id="scroller" style="position: absolute; left: 0; top: 0; text-align: left;">');
  for (var i=0; i<this.content.length; i++) document.write('<p id=p'+i+' style="padding: 0 1px 10px 1px">'+this.content[i]+'</p>');
  document.write('</span></div>');

  scroller = document.getElementById("scroller");

  scroller.style.top = this.height + 'px';

  this.scroll = scroll;
  this.go = go;
  this.nogo = nogo;
  this.run = 1;
  this.timer = 0;
}

function go() { this.run = 1; }

function nogo() { this.run = 0; clearTimeout(this.timer); }

function scroll() {
  if(this.run) {
    var offset = 0;
    for (var i=0;i<this.content.length;i++) {
      var node = document.getElementById('p'+i);
      if (node.style.top == parseInt(scroller.style.top)+offset) {
        this.nogo();
        this.timer = setTimeout("m.go()", 2000);
      }
      offset += parseInt(node.offsetHeight) - (isIE ? 1 : 0);
    }
    if(parseInt(scroller.style.top) > (-1)*parseInt(scroller.offsetHeight)) scroller.style.top = (parseInt(scroller.style.top)-this.speed)+'px';
    else scroller.style.top = this.height+'px';
  }
}

