function makeScrollbar(content,scrollbar,handle,horizontal,ignoreMouse,up,down){
	var steps = (horizontal?(content.getScrollSize().x - content.getSize().x):(content.getScrollSize().y - content.getSize().y))
	var slider = new Slider(scrollbar, handle, {
		steps: steps,
		mode: (horizontal?'horizontal':'vertical'),
		onChange: function(step){
			// Scrolls the content element in x or y direction.
			var x = (horizontal?step:0);
			var y = (horizontal?0:step);
			content.scrollTo(x,y);
		}
	}).set(0);
	if( !(ignoreMouse) ){
		// 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 funu = function(){
				slider.set(slider.step-10);
		}
		var fund = function(){
				slider.set(slider.step+10);
		}
		var timer = null;
	if(up)
	{
		$(up).addEvent('mouseover', function(e){
			timer = funu.periodical(50);
		});
		$(up).addEvent('mouseout', function(e){
			$clear(timer);
		});

	}
	if(down)
	{
		$(down).addEvent('mouseover', function(e){
			timer = fund.periodical(50);
		});
		$(down).addEvent('mouseout', function(e){
			$clear(timer);
		});

	}
	// Stops the handle dragging process when the mouse leaves the document body.
	$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
	if(content.getScrollSize().y<=content.getSize().y)
		scrollbar.setStyle('display','none');


}

function registerNavi(main)
{
	window.addEvent('domready',function(){
		$(main).getChildren().each(function(el){
			addSubNavi(el);
		});
	});

}


function addSubNavi(el)
{
	if(el.getElement('ul'))
	{
		el.getElement('ul').fade('hide');
		el.addEvent('mouseenter',function(){
			el.getElement('ul').fade('in');
		});
		el.addEvent('mouseleave',function(){
			el.getElement('ul').fade('out');
		});
		el.getElement('ul').getChildren().each(function(ell){
			addSubNavi(ell);
		});
	}
}
function registerNaviSlide(main)
{
	window.addEvent('domready',function(){
		$(main).getChildren().each(function(el){
			addSubNaviSlide(el);
		});
	});

}


function addSubNaviSlide(el)
{
	if(el.getElement('ul'))
	{
		el.getElement('ul').slide('hide');
		el.addEvent('mouseenter',function(){
			el.getElement('ul').slide('in');
		});
		el.addEvent('mouseleave',function(){
			el.getElement('ul').slide('out');
		});
		el.getElement('ul').getChildren().each(function(ell){
			addSubNaviSlide(ell);
		});
	}
}
