
var thread_id = 0;
var num_slides = 12;
var current_slide = 0;
var slideshow_speed = 5000; //(seconds * 1000)
var looping = false;

function start_slideshow(){
	next_slide();
	thread_id=setInterval("next_slide()",slideshow_speed);
}
function stop_slideshow(){
	clearTimeout(thread_id);
}
function next_slide(){
	current_slide++;
	if(current_slide>=num_slides){
		if(!looping){stop_slideshow();return;}
		current_slide=0;
	}
	goto_slide(current_slide);
}
function prev_slide(){
	current_slide--;
	if(current_slide<0){current_slide=num_slides-1;}
	goto_slide(current_slide);
}
function goto_slide(id){
	if(id>-1 && id<num_slides){
		show_item(id);
	}
}
function autostart_slideshow(){
	current_slide = -1;
	start_slideshow();
}

// Stop the slideshow when the mouse is clicked
window.captureEvents(Event.CLICK);
window.onclick= handle;
function handle(e) {
	stop_slideshow();
	return true;
}

// Auto-start the slideshow
//window.onload = autostart_slideshow();

