var scroll_handler = 0;
var scroll_start = function(){ if(!scroll_handler) { scroll_handler = window.setInterval(scroll_step,360); } }
var scroll_stop  = function(){ if(scroll_handler) { window.clearInterval(scroll_handler); scroll_handler = 0; } }
var scroll_step  = function() {
	if (!scroll_handler) return;
	var avail_height = jQuery("#scroll")[0].scrollHeight;
	var child_height = jQuery("#scroll .scroll_content")[0].scrollHeight;
	var d = jQuery("#scroll .scroll_content");
	var offset = parseInt( d.css("margin-top") );
	if (child_height + offset + 24 > avail_height) { d.css({ marginTop: offset - 1 }); } else scroll_stop();
}

jQuery(function(){
	if (jQuery("#arrows .scroll_content").html() != 0){
		jQuery("#arrows #scroll_top").show();
		jQuery("#arrows #scroll_down").show();
		jQuery("#scroll .scroll_content").css({marginTop:0});
		jQuery("#scroll_top").mousedown(function(){ jQuery("#scroll .scroll_content").css({marginTop:0}); });
		jQuery("#scroll_down").mouseup(scroll_stop).mouseout(scroll_stop).mousedown(scroll_start);
	}
});

