var down, up;

(function($) {

$.fn.navigation = function(id) {
	return this.each(function() {     
		var  $this = $(this);
		var accHeight = 0;
		
		$('#'+id).children().each(function(){
			accHeight += $(this).height();
		});
		
		if (accHeight<=$('#'+id).height()){
			
			$this.children('.up, .down').hide();
			
		} else {
		
			$this.children('.up').mouseover(function(){
				scrollup(id);
				clearTimeout(down);
			});
	
			$this.children('.up').mouseout(function(){
				clearTimeout(up);
			});
			
			$this.children('.down').mouseover(function(){
				scrolldown(id);
				clearTimeout(up);
			});
	
			$this.children('.down').mouseout(function(){
				clearTimeout(down);
			});
		
		}
	});

};
})(jQuery);


function scrollup(id){
	jQuery('#'+id).scrollTop((jQuery('#'+id).scrollTop()-1));
	up=setTimeout("scrollup('"+id+"')",10);
}

function scrolldown(id){
	jQuery('#'+id).scrollTop( (jQuery('#'+id).scrollTop()+1));
	down=setTimeout("scrolldown('"+id+"')",10);
}
