jQuery(document).ready(function() {
			
	var jump = 3;
	var show = 5;

	var window = jQuery("#thumbnails");
	var width = jQuery(".thumbnail:first").width() + 20;
	var total = jQuery(".thumbnail").size();
	var offset = 0;
	var maxoffset = ((total - show) * width);
	jQuery("#thumbnails").width(total * width);

	buttons();
			
	jQuery("button.next").click(function () {
		offset += width*jump;
		jQuery(window).animate({left:-offset},"slow");
		buttons();
	});
			
	jQuery("button.prev").click(function () {
		offset -= width*jump;
		jQuery(window).animate({left:-offset},"slow");
		buttons();
	});
			
	function buttons () {
		jQuery(".controls button").hide();
		if (offset > 0)	{ jQuery(".controls button.prev").show(); }
		if (offset < maxoffset) { jQuery(".controls button.next").show(); }
	}
	
});
