﻿news={
scroller:function(shell){
   var Class=function (shell){
    this.list=[];
    this.pauseTime=2000;
    this.speed=50;
    this.lineHeight=50;
    this.pauseSpace=0;
    this.dir=1;
    this.shell=document.getElementById(shell);
   };
   Class.prototype={
    add:function (x){
     if(x instanceof Array){this.list=this.list.concat(x);}
     else{this.list.push(x);}
     return this;
    }
    ,set:function (fn){fn.call(this);return this;}
    ,run:function(){
     var inner=document.createElement('UL');
     this.shell.appendChild(inner);
     for (var i=0;i<this.list.length;i++ ) {
      var li=inner.appendChild(document.createElement('LI'));
      li.innerHTML=this.list[i];
      li.style.lineHeight=this.lineHeight+'px';
     }
     this.shell.appendChild(inner.cloneNode(true));
     var Hidden=this; 
     (function (){
      with(Hidden){
       if(dir>0){
        if(++shell.scrollTop==inner.offsetHeight){shell.scrollTop=0;}
       }else{
        if(--shell.scrollTop<=0){shell.scrollTop=inner.offsetHeight;}
       }
       var interval=shell.scrollTop%pauseSpace?speed:pauseTime;     
      }
      setTimeout(arguments.callee,interval);
     })();
    }
   };
   return new Class(shell);
}
}
