// JavaScript Document

var rotate_delay = 5000; // delay in milliseconds (5000 = 5 secs)
var current = 0;
function next() {
	if(document.slideform.slide.selectedIndex + 1 < document.slideform.slide.options.length) {	
		document.slideform.slide.selectedIndex += 1;	
		document.images.show.src = document.slideform.slide.value;
	} else first();
}

function previous() {
	if(document.slideform.slide.selectedIndex > 0) {
		document.slideform.slide.selectedIndex -= 1;	
		document.images.show.src = document.slideform.slide.value;
	} else last();
}

function first() {
	document.images.show.src = document.slideform.slide[0].value;
	document.slideform.slide.selectedIndex = 0;
}

function last() {
	var current = document.slideform.slide.options.length - 1;
	document.images.show.src = document.slideform.slide[current].value;
	document.slideform.slide.selectedIndex = current;
}

function ap() {
	obj = document.getElementById('slidebutton');
	if(obj.name == 'stop') {
		obj.src = obj.src.replace(/stop.gif/g, 'start.gif');
		obj.name = 'start';
	} else {
		obj.src = obj.src.replace(/start.gif/g, 'stop.gif');
		obj.name = 'stop';
	}
	rotate();
}

function change() {
	current = document.slideform.slide.selectedIndex;
	document.images.show.src = document.slideform.slide[current].value;
}

function rotate() {
	if(document.slideform.slidebutton.name == 'stop') {
		current = (current == document.slideform.slide.length - 1) ? 0 : current + 1;
		document.images.show.src = document.slideform.slide[current].value;
		document.slideform.slide.selectedIndex = current;
		window.setTimeout('rotate()', rotate_delay);
	}
}

