function animate(itemId, current) {
	$("#"+itemId).hide();
	total = window.files.length - 1;
	if (current > total) {
		current = 1;
	}
	var previous = current - 1;
	if (current == 1) {
		previous = total;
	}
	swap(itemId, window.files[current]);
	$("#"+itemId).fadeIn("slow");
	current++;
	var tInt = setTimeout("animate('"+itemId+"', '"+current+"')", 4000);
}

function swap(imgId, file) {
	var img = document.getElementById(imgId);
	img.src = file;
}