//Set image position display for user
function setImgPos() { 
	document.getElementById("currentPosition").innerHTML = currentPosition;
}
//Tell user they don't have to click, if they click
function confirmClick(action) {
	if (action == "next") {
		window.alert("You only need to hover over the link to see the next image");
	} else if (action == "prev") {
		window.alert("You only need to hover over the link to see the previous image");
	}
}
//Swap Images, text, photo number
function swapThis(action) {
	//Hide old text
	if (document.getElementById(curPos)) {
	document.getElementById(curPos).style.display = "none";
	}
	//Set new position
	curPos += (action == 'next')?1:- 1;
	//Show new text
	if (document.getElementById(curPos)) {
	document.getElementById(curPos).style.display = "block";
	document.getElementById("captionRow").style.display = "block";
	} else {
	document.getElementById("captionRow").style.display = "none";
	}
	//Set new Image
	document.getElementById("swapImg").src = imagesHidden[curPos].src;
	//Set image position display for user
	curImgNum = parseInt(curPos) + 1;
	currentPosition = curImgNum + " of " + totalImgNum;
	document.getElementById("currentPosition").innerHTML = currentPosition;
	//Ensure Link Visibility
	if (curPos == 0) {
	document.getElementById("prevLink").style.visibility = "hidden";
	document.getElementById("nextLink").style.visibility = "visible";
	} else if (curPos >= swapThese.length - 1) {
	document.getElementById("prevLink").style.visibility = "visible";
	document.getElementById("nextLink").style.visibility = "hidden";	
	} else {
	document.getElementById("prevLink").style.visibility = "visible";
	document.getElementById("nextLink").style.visibility = "visible";	
	}
}
//Show or Hide User Tools
function showHide(userTool) {
	var curState = document.getElementById(userTool).style.display;	
	reqState = (curState == "none")?"block":"none";
	document.getElementById(userTool).style.display = reqState;
}
function checkLength() {
	var commentField = document.getElementById("comment").value;
	if (commentField.length > 300) {
		var errorMsg = "You entered " + commentField.length + " characters. The maximum characters allowed are 300. Please revise your comment and resubmit.";
		window.alert(errorMsg);
		return false;
	} else if (commentField.length == 0) {
		window.alert("Please enter a comment to submit");
		return false;
	} else return true;
}