
var num_recent_posts = 4;
var current_recent_post = 0;
var auto_switching = true;
function next_recent_post(stop_auto) { move_to_recent_post(1);auto_switching = !stop_auto; };
function prev_recent_post(stop_auto) { move_to_recent_post(-1);auto_switching = !stop_auto; };
function move_to_recent_post(offset) {
	var moving_to = current_recent_post + offset;
	if(current_recent_post + offset > num_recent_posts - 1) {
		// at end, move to beginning
		moving_to = 0;
	} else if(current_recent_post + offset == -1) {
		// at beginning, move to end
		moving_to = num_recent_posts - 1;
	} 
	// hide current, show new
	new Effect.Parallel([
				new Effect.Fade("recentquote_"+current_recent_post,{ sync: true, duration: 16 }),
				new Effect.Appear("recentquote_"+moving_to,{ sync: true, duration: 16 })
			]);
	//if($("recent_post_"+current_recent_post)) { Element.hide("recent_post_"+current_recent_post); };
	//if($("recent_post_"+moving_to)) { Element.hide("recent_post_"+moving_to); };
	current_recent_post = moving_to;
	//if($("recent_post_"+moving_to)) { Element.show("recent_post_"+moving_to); };
	// if($("recent_post_current_num")) { $("recent_post_current_num").innerHTML = (moving_to+1); };
}
function auto_rotate_recent_post() {
	if(auto_switching) {
		next_recent_post(false);
		self.setTimeout('auto_rotate_recent_post()', 5000);
	}
}
self.setTimeout('auto_rotate_recent_post()', 5000);

