var TextScroll = {
	scrollCursor: 0,
	speed: 5,
	timeoutID: 0,
	div_obj: null,
	
	register: function(){
		if(El.getElementsByClassName('scroll')[0]){
			TextScroll.div_obj = El.getElementsByClassName('scroll')[0];
			Event.add($('scrollup'), 'mouseover', TextScroll.scrollUp);
			Event.add($('scrollup'), 'mouseout', TextScroll.stopScroll);
			Event.add($('scrolldown'), 'mouseover', TextScroll.scrollDown);
			Event.add($('scrolldown'), 'mouseout', TextScroll.stopScroll);		
		}
	},

	stopScroll: function(){
		clearTimeout(TextScroll.timeoutID);
	},
	scrollUp: function(){
		TextScroll.scrollCursor = (TextScroll.scrollCursor-TextScroll.speed)<0? 0:TextScroll.scrollCursor - TextScroll.speed;
		TextScroll.div_obj.scrollTop = TextScroll.scrollCursor;
		TextScroll.timeoutID = setTimeout("TextScroll.scrollUp()", 60);
	},
	scrollDown: function(){
		TextScroll.scrollCursor += TextScroll.speed;
		TextScroll.div_obj.scrollTop = TextScroll.scrollCursor;
		if (TextScroll.div_obj.scrollTop == TextScroll.scrollCursor){
			TextScroll.timeoutID = setTimeout("TextScroll.scrollDown()", 60);
		}else{
			TextScroll.scrollCursor = TextScroll.div_obj.scrollTop;
		}
	},
	resetScroll: function(){
		TextScroll.div_obj.scrollTop = 0;
		TextScroll.scrollCursor = 0;
	}
}

Event.add(window, 'load', TextScroll.register);
