// CROSSBROWSER SCROLLING
// (c) Kruglov S. A. 2002
// http://www.kruglov.ru

// requires KLayers V 2.7 (http://www.kruglov.ru/klayers/)

var KS=[]
var KScounter=0

function KScrolling(text,width,height,speed){
	if(text.length && text.join){
		text=text.join("<br>")
	}

	this.number=KScounter++
	this.width=width
	this.height=height
	this.speed=speed
	//this.text="<table cellspacing=0 cellpadding=0 border=0 width="+this.width+"><tr><td>"+text+"<br>"+text+"</td></tr></table>";
	this.text=text+"<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: hidden'><div id='KStext"+this.number+"' style='position: relative; top: 0px; left: 0px;'>"+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.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.move(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)
		}
	}
	setTimeout("KS["+this.number+"].scroll()",this.speed)
}

