var scrolling;
var scrollEnable=false;

function KScrolling(width,height){
	this.width=width;
	this.height=height;
	this.offset=0;
	if(isMSIE || isMozilla || isOpera5 || isNC4)
		this.badBrowser=false;
	else
		this.badBrowser=true;
	this.wasjoined=false;
}

KScrolling.prototype.scroll=function()
{
	if(this.badBrowser) return;
	if(!this.layer) {
		this.layer=layer("scrollDiv");
		if(isNC4){
			var l=layer("scrollDiv");
			this.layer.moveTo(this.left=l.getAbsoluteLeft(),this.top=l.getAbsoluteTop());
		}
//		this.layer.show()
	}
	if (!this.stopScrollButton)
		this.stopScrollButton = layer('stopScrollButton');
		
	if(this.layer && this.height < this.layer.getHeight())
	{
		if(this.stopScrollButton)
			this.stopScrollButton.style.visibility = 'visible';
		
		if(!this.wasjoined)
		{
			this.wasjoined = true;
			this.layer.add('<hr/>' + document.getElementById('scrollDiv').innerHTML + '<hr/>');
		}
				
		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);
		}
		if (scrollEnable)
			setTimeout("scrolling.scroll()", 50);
	}
	
}

function scrollStopStart()
{
	if (scrolling)
	{
		scrollEnable = !scrollEnable;
		if(scrollEnable)
			scrolling.scroll();
	}
}