// JavaScript Document
var slides= new Array('feature1', 'feature2', 'feature3', 'feature4', 'feature5', 'feature6'); 
var buttons= new Array('button1', 'button2', 'button3', 'button4', 'button5', 'button6'); 

var i = 0; var wait = 5000;
var ttvSlideshow = 0;

function slideShow() {
Effect.Fade(slides[i], { duration:.6, from:1.0, to:0.0 }); 
i++;
 if (i == slides.length) {
	 i = 0; 
 	updatebuttons(i, slides.length-1);
 } else {
	 updatebuttons(i,i-1);
 }
Effect.Appear(slides[i], { duration:.6, from:0.0, to:1.0 });
 } 
 
function goToSlide(slideNum) {
	//alert(i);
	//alert(slideNum);
	if(i == slideNum) return;
	Effect.Fade(slides[i], { duration:.6, from:1.0, to:0.0 }); 
	Effect.Appear(slides[slideNum], { duration:.6, from:0.0, to:1.0 });
	
	updatebuttons(slideNum, i);

	i = slideNum;
}

function slideClicked(slideNum) {
	clearInterval ( ttvSlideshow );
	goToSlide(slideNum);
}

function updatebuttons(newbutton, oldbutton) {
	//alert(newbutton);
	//alert(oldbutton);
	//Effect.Fade(buttons[newbutton] + '-off', { duration:.2, from:1.0, to:0.0 }); 
	Effect.Appear(buttons[newbutton] + '-on', { duration:.6, from:0.0, to:1.0 });
	
	Effect.Fade(buttons[oldbutton] + '-on', { duration:.6, from:1.0, to:0.0 }); 
	//Effect.Appear(buttons[oldbutton] + '-off', { duration:.2, from:0.0, to:1.0 });
	
}

// the onload event handler that starts the fading. 
function start_slideshow() { 
	ttvSlideshow = setInterval('slideShow()',wait); 
}
