// JavaScript Document
// test the browser to make sure it's ok
var browserName = navigator.appName;
var browserVer = parseInt(navigator.appVersion);
var browserOK = (((browserName == "Netscape") && (browserVer >= 3)) || 
	((browserName == "Microsoft Internet Explorer") && (browserVer >= 4)));

// URLs of images in slide show
var slideURL = Array("images/slideshow/the-kiss.jpg", "images/slideshow/engaged.jpg", "images/slideshow/Sonoma-Wedding-Couple-1.jpg", "images/slideshow/bride-sitting.jpg", "images/slideshow/family-environmental-portrait-1.jpg", "images/slideshow/senior-environmental.jpg", "images/slideshow/family-jumping.jpg", "images/slideshow/kenwood-wedding-laughing.jpg", "images/slideshow/kenwood-wedding-reception.jpg", "images/slideshow/senior-outdoors.jpg", "images/slideshow/family-in-vineyard.jpg", "images/slideshow/kenwood-wedding-embrace.jpg", "images/slideshow/senior-throwing-football.jpg", "images/slideshow/bagpipes-player.jpg", "images/slideshow/senior-in-vineyard.jpg", "images/slideshow/artistic-bridal-portrait.jpg", "images/slideshow/wine-cave.jpg", "images/slideshow/senior-studio.jpg", "images/slideshow/newlyweds-leaving-church.jpg");
// delay between slides (in milliseconds)
var slideDelay = 3000;
// Index of the current slide
var curSlide = -1;
// timeout id for the current setTimeout command
var curTimeout;

function showSlide() {
	if (browserOK) {
		// alert(slideURL.length);
		curSlide = ((curSlide + 1) % slideURL.length);
		// alert(curSlide);
		document.images["slideImg"].src = slideURL[curSlide];
		curTimeout = setTimeout("showSlide()", slideDelay);
	} else {
		// show an error message for older browsers
		alert("This page requires Netscape 3.0+ or IE 4.0+");
	}
}

function goNext() {
	if (browserOK) {
		clearTimeout(curTimeout);
		showSlide();
	}
}

function goPrev() {
	if (browserOK) {
		clearTimeout(curTimeout);
		curSlide = (((curSlide - 2) + slideURL.length) % slideURL.length);
		showSlide();
	}
}

