var currentpic = 0; // counter for the current pic

var wait = 5000; // time between fades, in milliseconds

var pics;

function swapFade(){	
	Effect.Fade(pics[currentpic], { duration:2, from:1.0, to:0.0 });
	currentpic++; // advance to the next pic
	if (currentpic == pics.length) { // are we at the end? then reset the counter
		currentpic = 0;
	}
	Effect.Appear(pics[currentpic], { duration:2, from:0.0, to:1.0 });
}

function startSlideshow(){
	pics = document.getElementById("slideshow").getElementsByTagName("img");
	nodes = $A(pics);
	nodes.each(
		function(node,index) {
			if(index > 0)
			node.style.display='none'
		}
	);
	setInterval('swapFade()',wait);	 // will call swapFade every 'wait' milliseconds
}

