function makeScrollbar(content,scrollbar,handle,toparrow, bottomarrow){
	var scrollSize = content.getScrollSize();
	var size = content.getSize();
	if (scrollSize.y > size.y) {
		$('scrollbar').setStyle('display', 'block');
	} else {
		$('scrollbar').setStyle('display', 'none');
		return;
	}
	var slider = new Slider(scrollbar, handle, {
		steps: content.getScrollSize().y - content.getSize().y,
		mode: 'vertical',
		onChange: function(step){
			// Scrolls the content element in x or y direction.
			var x = (0);
			var y = (step);
			content.scrollTo(x,y);
		}
	}).set(0);

	var scrollHandler = Object();
	scrollHandler.slider = slider;
	scrollHandler.startScrolling = function(direction) {
		
	}

	// Scroll the content element when the mousewheel is used within the 
	// content or the scrollbar element.
	$$(content, scrollbar).addEvent('mousewheel', function(e){	
		e = new Event(e).stop();
		var step = slider.step - e.wheel * 30;	
		slider.set(step);					
	});
	
	var scroller = {slider: slider, scrolling: false, interval: 5, scrolltimer: 100};
	scroller.startUp = function(e){
		this.scrolling = true;
		this.direction = 'up';
		this.scroll.periodical(this.scrolltimer, this);
	}
	scroller.startDown = function(e){
		this.scrolling = true;
		this.direction = 'down';
		this.scroll.periodical(this.scrolltimer, this);
	}
	scroller.scroll = function() {
		if (this.scrolling) {
			if (this.direction == 'up') {
				var step = this.slider.step - this.interval;
			} else {
				var step = this.slider.step + this.interval;
			}
			this.slider.set(step);
		} else {
			
		}
	}
	scroller.stopUp = function(e) {
		if (this.direction == 'up') {
			this.stop();
		}
	}
	scroller.stopDown = function(e) {
		if (this.direction == 'down') {
			this.stop();
		}
	}
	scroller.stop = function() {
		this.scrolling = false;
		$clear(this.timer);
	}

	$(toparrow).addEvent('mousedown', function(e){
		scroller.startUp();
	});
	$(toparrow).addEvent('mouseup', function(e){
		scroller.stopUp();
	});
	$(toparrow).addEvent('mouseleave', function(e){
		scroller.stopUp();
	});
	
	$(bottomarrow).addEvent('mousedown', function(e){
		scroller.startDown();
	});
	$(bottomarrow).addEvent('mouseup', function(e){
		scroller.stopDown();
	});
	$(bottomarrow).addEvent('mouseleave', function(e){
		scroller.stopDown();
	});

	// Stops the handle dragging process when the mouse leaves the document body.
//	$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
}

