$(function() {
	var s=$("#scroll");

	if (s.length == 0) return;

	var item_h=$(".item", s).outerHeight();
	var show=3;
	var step=3;

	s.height(item_h*show);

	b_up=$('<button type="button" id="b_up">&#9650;</button>').click(function() {
		off=s.scrollTop()-item_h*step;
		s.scrollTo((off<=0?0:off), 800);
		if (off <= 0) $(this).attr('disabled', 'disabled').css('visibility', 'hidden');
		if (off + item_h*show < s.get(0).scrollHeight) b_dn.removeAttr('disabled').css('visibility', 'visible');
	});

	b_dn=$('<button type="button" id="b_dn">&#9660;</button>').click(function() {
		off=s.scrollTop()+item_h*step;
		s.scrollTo(off, 800);
		b_up.removeAttr('disabled').css('visibility', 'visible');
		if (off + item_h*show >= s.get(0).scrollHeight) $(this).attr('disabled', 'disabled').css('visibility', 'hidden');
	});

	s.before(b_up).after(b_dn);
	b_up.attr('disabled', 'disabled').css('visibility', 'hidden');
	if (s.get(0).scrollHeight <= s.height()) b_dn.attr('disabled', 'disabled').css('visibility', 'hidden');
});

