
//<![CDATA[
var num_photos = 8;
var current_photo = 0;
var auto_switching = true;
var photos=new Array();

for(var i=0; i<num_photos; i++){
	photos[i]=(i+1).toString();
}

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
	var x=''
	if(location.pathname !== '/' && location.pathname!=='/default' && location.pathname!=="/default/index"){x="back_";}
	new Effect.Parallel([
		new Effect.Fade(x+"home_photo_"+photos[current_photo],{ sync: true}),
		new Effect.Appear(x+"home_photo_"+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();

//]]>