window.onload = initAll;
window.onunload = function() {}

function initAll() {
	var showAddDiv = document.getElementById('showadd');
	var addEventDiv = document.getElementById('addevent');
	if (showAddDiv) {	//	if the calendar addEvents page is there, click the button to show the addEvent form
		showAddDiv.childNodes[0].onclick = function() {visibleAndHidden(addEventDiv, showAddDiv);}
	}
	/*
	var showPhotosDiv = document.getElementById('showphotos');
	var photosDiv = document.getElementById('photos');
	if (showPhotosDiv) {	//	if the photos/results page is there, click the button to show the photos
		showPhotosDiv.childNodes[0].onclick = function() {visibleAndHidden(photosDiv, showPhotosDiv);}
	}
	*/
	var showResultsDiv = document.getElementById('showresults');
	var resultsDiv = document.getElementById('results');
	if (showResultsDiv) {	//	if the photos/results page is there, click the button to show the results
		showResultsDiv.childNodes[0].onclick = function() {
			visibleAndHidden(resultsDiv, showResultsDiv);
			return false;
		}
	}
	
	if (document.getElementById('captchaFail')) {	//	look to see if Captcha failed
		alert("The reCAPTCHA wasn't entered correctly!  Please try again.");
	}
}

function showPhotos() {
	document.getElementById('photos').className = 'visible';
	document.getElementById('showphotos').className = 'hidden';
	return false;
}

function showResults() {
	document.getElementById('results').className = 'visible';
	document.getElementById('showresults').className = 'hidden';
	return false;
}

function visibleAndHidden(visElement, hidElement) {
	visElement.className = 'visible';
	hidElement.className = 'hidden';
}

