var switchtime = 7500; // Time (in milliseconds) that each image is displayed for
var fadetime = 1000; // Time (in milliseconds) that the fade transition lasts for

var image_count;
var current_image=0;

$(document).ready(function(){
	image_count = $("#homegallery img").hide().size();
	$("#homegallery img:eq("+current_image+")").show();
	
	$("#homegallery").everyTime(switchtime,function() {
		old_image = current_image;
		current_image ++;
		if (current_image > (image_count-1)) { current_image = 0; }
	
		$("#homegallery img:eq(" + current_image + ")").fadeIn(fadetime, function() {
			$("#homegallery img:eq(" + old_image + ")").fadeOut(fadetime);
		});
	});
});
