var KS=[],KScounter=0;

function KScrolling(text,width,height,speed){
if (text.length && text.join) text=text.join("<br><br>");
this.number=KScounter++;
this.width=width;
this.height=height;
this.speed=speed;
this.timer;
this.text=text+"<br><br>"+text;
KS[this.number]=this;
}

KScrolling.prototype.print = function(){
if (isMSIE || isMozilla || isOpera5) return '<div id="KSborder'+this.number+'" style="width:'+this.width+"px; height:"+this.height+'px; overflow-y:hidden"><div id="KStext'+this.number+'" style="position:relative; visibility:hidden">'+this.text+"</div></div>";
else if (isNC4) return "<ilayer name='KSNN"+this.number+"' visibility='hide'><spacer type=block width="+this.width+" height="+this.height+"></ilayer>\n"+
"<layer name='KStext"+this.number+"' clip='0 0 "+this.width+" "+this.height+"' top=0 left=0 visibility='hide'>"+this.text+"</layer>";
else {return this.text; this.badBrowser=true;}
}

KScrolling.prototype.play = function(){
this.timer=setInterval("KS["+this.number+"].scroll()",this.speed);
}

KScrolling.prototype.stop = function(){
clearInterval(this.timer);
}

KScrolling.prototype.scroll = function(){
if (this.badBrowser) return;
if (!this.layer){
this.layer=layer("KStext"+this.number);
if (isNC4){
var l=layer("KSNN"+this.number);
this.layer.moveTo(this.left=l.getAbsoluteLeft(),this.top=l.getAbsoluteTop());}
this.layer.show(); this.offset=0;}
else{
this.offset=(this.offset+1)%(this.layer.getHeight()/2);
if (isNC4) this.layer.scroll(this.left,this.top,this.width,this.height,0,this.offset);
else if(!this.badBrowser) this.layer.moveY(-this.offset);}
}