function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		window.onload = func; 
	} else { 
		window.onload = function() { 
			oldonload(); 
			func(); 
		}
	} 
}

initGlobalNav = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("globalNavigation");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

addLoadEvent(initGlobalNav);

function toggleFAQAnswer(whichID) {
	var strQuestion = whichID.substr(whichID.lastIndexOf("_")+1);
	if (document.getElementById("a_" + strQuestion).style.display == "none") {
		document.getElementById("a_" + strQuestion).style.display = "block";
	} else {
		document.getElementById("a_" + strQuestion).style.display = "none";
	}
}

function showImage(whichImage) {
	//show the large version of the image in the page
	if (arrPhotos[whichImage][2] == "l") {
		document.getElementById("zoomImage").className = "l";
	} else {
		document.getElementById("zoomImage").className = "p";
	}
	document.getElementById("zoomImage").innerHTML = "<img src='../../images/upload/" + arrPhotos[whichImage][0] + "' alt='" + arrPhotos[whichImage][1] + "' /><span>" + arrPhotos[whichImage][1] + "</span>";
}



function validateForm(whichForm) {
	var boolIsValid = true;
	var strErrorMessage = "";
		
	if (whichForm.realname.value == "") {
		strErrorMessage += "Please enter your full name.\n";
		boolIsValid = false;
	}
	if (!validateEmail(whichForm.email.value)) {
		strErrorMessage += "Please enter a valid email address.\n";
		boolIsValid = false;
	}
	if (whichForm.questions_comments.value == "") {
		strErrorMessage += "Please enter your questions or comments.\n";
		boolIsValid = false;
	}
	if (!boolIsValid) {
		alert(strErrorMessage);
	}
	return boolIsValid;
}

function validateEmail(strValue) {
	var objRegExp = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	return objRegExp.test(strValue);
}