//total_posts
var x_delta = 570;
var current_index = 1;

function show_posts(direction) {
	var max_index = Math.ceil(total_posts / 3);
	
	var next_index = current_index + direction;
	
	if (next_index <= max_index && next_index >= 1) {
		current_index = next_index;
		var position = (next_index - 1) * -x_delta;

		$("table.recent_posts").animate({'left': position + 'px'}, 500);
	}
	
	if (current_index < max_index) {
		$("#btnNextPosts").fadeIn();	
	} else {
		$("#btnNextPosts").fadeOut();	
	}
	if (current_index > 1) {
		$("#btnPreviousPosts").fadeIn();	
	} else {
		$("#btnPreviousPosts").fadeOut();
	}
}
