// rotate divs for itf

var divs = "#rotate";   // divs to rotate are contained in this parent div
var div_array = new Array();
var current_div = 0;
var delay = 5000;  // delay in milliseconds

$(document).ready(function() {
	$(divs).children().each(function() {
		div_array.push("#rotate div." + $(this).attr("class"));   // add all child divs to array
	});
	$(div_array[0]).show();  // show first div by default
	setTimeout('rotate()', delay);  // start rotation
});

// rotate images on homepage
function rotate() {
	var next_div = (current_div + 1) % div_array.length;  // increment
	$(div_array[current_div]).fadeOut("slow", function() {
		$(div_array[next_div]).fadeIn("slow");  // fade in next div
	});
	current_div = next_div;
	setTimeout('rotate()', delay);  // next rotation after a delay
}

