
var rotate_delay = 4000; // delay in milliseconds (5000 = 5 secs)


current = 0;
function next()
{
	if (document.slideform.slide.length!=1)
	{
		if (document.slideform.slide[current+1]) {
			document.images.show.src = document.slideform.slide[current+1].value;
			document.getElementById('image_link').href = document.slideform.albumlink[current+1].value;
			document.slideform.slide.selectedIndex = ++current;
		}
	}
	else first();
}
function previous()
{
	if (document.slideform.slide.length!=1)
	{
		if (current-1 >= 0) {
			document.images.show.src = document.slideform.slide[current-1].value;
			document.getElementById('image_link').href = document.slideform.albumlink[current-1].value;
			document.slideform.slide.selectedIndex = --current;
		}
	}
	else last();
}
function first()
{
	current = 0;
	document.images.show.src = document.slideform.slide[0].value;
	document.getElementById('image_link').href = document.slideform.albumlink[0].value;
	document.slideform.slide.selectedIndex = 0;
}
function last()
{

	current = document.slideform.slide.length-1;
	document.images.show.src = document.slideform.slide[current].value;
	document.getElementById('image_link').href = document.slideform.albumlink[current].value;
	document.slideform.slide.selectedIndex = current;
}
function ap(text)
{
	document.slideform.slidebutton.value = (text == "Stop") ? "AutoPlay" : "Stop";

	//alert(document.slideform.slide.length);
	if (document.slideform.slide.length!=1 && document.slideform.slide.length!=undefined)
	{
		rotate();
	}

}
function change()
{
	if (document.slideform.slide.length!=1)
	{
		current = document.slideform.slide.selectedIndex;
		document.images.show.src = document.slideform.slide[current].value;
		document.getElementById('image_link').href = document.slideform.albumlink[current].value;
	}
}
function rotate()
{
	if (document.slideform.slide.length!=1)
	{
		if (document.slideform.slidebutton.value == "Stop") {
			current = (current == document.slideform.slide.length-1) ? 0 : current+1;
			document.images.show.src = document.slideform.slide[current].value;
			document.getElementById('image_link').href = document.slideform.albumlink[current].value;
			document.slideform.slide.selectedIndex = current;
			window.setTimeout("rotate()", rotate_delay);
		}
	}
}