var slideElements = 0;
var currentSlide = 1;

function startSlideShow()
{
	//Set up, hide all the slides we don't want visible
	
	//Count the slides, allow no more than 50 slides
	var i = 1;
	for(i=1; i <= 50; i++)
	{
		var el = document.getElementById("feature" + i);
		if(el == null)
		{
			//All OK
			//alert(el);
			break;
		}
		else
		{
			//Break the loop, there are no more slides
			//el.style.visibility = "hidden";
			new Effect.Opacity(el, { from: 0.1, to: 0, duration: 0.01 });
		}
	}
	
	//Final result
	slideElements = i-1;
	
	if(slideElements != 0)
	{
		new Effect.Opacity("feature1", { from: 1, to: 0.9, duration: 0.01 });
	}	
	
	var t = setTimeout('changeSlide()',3000);		
	
}

function changeSlide()
{	
	
	if(currentSlide >= slideElements)
	{				
		$('feature' + slideElements).fade({ duration: 1.0, from: 1, to: 0 });
		$('feature1').appear({ duration: 1.0, from: 0, to: 1 });	
		$('feature1').style.zIndex = 998;	
		//alert("Reached the end");
		currentSlide = 1;
	}
	else
	{
		//Fade next slide in, current slide out
		$('feature' + currentSlide).fade({ duration: 1.0, from: 1, to: 0 });
		$('feature' + (currentSlide+1)).appear({ duration: 1.0, from: 0, to: 1 });
		$('feature' + (currentSlide+1)).style.zIndex = 998;
		currentSlide++;		
	}
	
	//Reset if at the top of the stack
	
	var t = setTimeout('changeSlide()',3000);		

}

