//<![CDATA[
var current_photo = 0;
var auto_switching = true;
var photos=new Array("truck", "results", "handshake", "proverbs");
var num_photos = photos.size();

function next_photo() { move_to_photo(1); };
function move_to_photo(offset) {	
	var moving_to = current_photo + offset;
	if(current_photo + offset > num_photos - 1) {
		// at end, move to beginning
		moving_to = 0;
	} else if(current_photo + offset == -1) {
		// at beginning, move to end
		moving_to = num_photos - 1;
	} 
	// hide current, show new
	new Effect.Parallel([
		new Effect.Fade("home_"+photos[current_photo],{ sync: true}),
		new Effect.Appear("home_"+photos[moving_to],{ sync: true})], {duration:4.0});
	current_photo = moving_to;
	
}

function auto_rotate_photo() {
	
	if(auto_switching) {
		next_photo(false);
		self.setTimeout('auto_rotate_photo()', 5000);
	}
}

auto_rotate_photo();

//]]>