// JavaScript Document slideshow 
addOnload(initAll);
addOnload(initMenu);


function addOnload(newFunction) {
	 var oldOnload = window.onload;
	 
	 if (typeof oldOnload == "function") {
	window.onload = function() {
		if (oldOnload) {
			oldOnload();
		} 
		newFunction();
		}
	}
	 else {
		 window.onload = newFunction; 
	 }
}




var currImg = 0;
var captionText = new Array("2009 champs Tom McCoy and Charles Gilbreath (63 net)", "Mike Denton and Dan Harrison tie 2nd place (65 net)", "Joe Cook and Joe Watson tie 2nd place (65 net)", "Bob McAllister and Lyle Sleepy Miller tie 4th place (68 net)", "Rick Faller and Tom Baird tie 4th place (68 net)","Loren Woodmansee and Carl Rowe 6th place (69 net)","Dick and Dennis Ferguson 7th place (72) net", "Marvin Wittner and Don Carver 8th place (77net)","Lee Lamp tournament  Chairman , Woody and Carl Rowe at Senior", "Dick Ferguson looks ready to go at Senior 4 ball")
							
function initAll(){
	document.getElementById("imgText").innerHTML = captionText[0];
	document.getElementById("prevLink").onclick = processPrevious;
	document.getElementById("nextLink").onclick = processNext;
}
function processPrevious() {
	newSlide(-1);	
}
function processNext() {
	newSlide(1);	
}

function newSlide(direction){
	var imgCt = captionText.length;
	
	currImg = currImg + direction;
	if (currImg <0) {
		currImg = imgCt-1;	
	}
	if (currImg == imgCt) {
		currImg = 0;	
	}
	document.getElementById("slideshow").src = "images Churn Creek Golf Club/senior4ballnet2009/slide" + currImg +".jpg";
	document.getElementById("imgText").innerHTML = captionText[currImg];
}







function initMenu() {
	var allLinks = document.getElementsByTagName("a");
	
	
	for (var i=0;i<allLinks.length; i++) {
		if (allLinks[i].className.indexOf("menuLink") > -1) {
			allLinks[i].onclick = retFalse;	
			allLinks[i].onmouseover = toggleMenu;
			 
		}
	}
}

function toggleMenu() {
	var startMenu = this.href.lastIndexOf("/")+1;
	var stopMenu = this.href.lastIndexOf(".");
	var thisMenuName = this.href.substring(startMenu,stopMenu);
	
	document.getElementById(thisMenuName).style.display = "block";
	
	this.parentNode.className = thisMenuName;
	this.parentNode.onmouseout = toggleDivOff;
	this.parentNode.onmouseover = toggleDivon;
}

function toggleDivon() {
	document.getElementById(this.className).style.display = "block";	
}

function toggleDivOff() {
	document.getElementById(this.className).style.display = "none";	
}

function retFalse() {
	return false;	
}




