Event.observe(window, "load", init_slides);

var curidx;
var totalslides;

function init_slides() {
	curidx = 1;
	totalslides = 4;
	setInterval(switch_slides, 4000);
}

function switch_slides() {
	newidx = curidx+1;
	if (newidx>totalslides) newidx=1;
	for (i=1; i<=totalslides; i++) {
		if (i==newidx) {
			$("slideshow"+i).setStyle({zIndex:11});
			$("slideshow"+i).appear({duration: 0.7});
		} else if (i==curidx) {
			$("slideshow"+i).setStyle({zIndex:10});
		} else {
			$("slideshow"+i).setStyle({zIndex:1});
			$("slideshow"+i).setOpacity(0);
		}
	}
	curidx = newidx;
}

