var current_image_index = 1;
var next_image_index = 2;
var final_image_index = 0;

var div_to_fade_out = null;
var div_to_fade_in = null;

var rotation_delay = 7000;

var previous_image_index = 0;
function rotate_home_image() {
	div_to_fade_out = document.getElementById("home_page_image_" + current_image_index);
	div_to_fade_in = document.getElementById("home_page_image_" + next_image_index);

    // fade out objects
    Effect.Fade("home_page_image_" + current_image_index, {to: 0.01});

    // fade back in objects
    setTimeout('Effect.Appear(div_to_fade_in);', 500);

    setTimeout('rotate_home_image();', rotation_delay);

	current_image_index++;
	next_image_index++;

    if (current_image_index > final_image_index)
        current_image_index = 1;

    if (next_image_index > final_image_index)
        next_image_index = 1;
}

