// JavaScript Document

/* left_nav.php */
function setColor (color) {
	orangeObj = document.getElementById('orange');
	blueObj = document.getElementById('blue');
	greenObj = document.getElementById('green');

	contentObj = document.getElementById('content');
	
	contentObj.style.background = color;

	if (color == '#EF990A') {	
		orangeObj.style.display = 'block';
		blueObj.style.display = 'none';
		greenObj.style.display = 'none';
	}
	if (color == '#009EE0') {
		orangeObj.style.display = 'none';
		blueObj.style.display = 'block';
		greenObj.style.display = 'none';
	}
	if (color == '#67AB25') {
		orangeObj.style.display = 'none';
		blueObj.style.display = 'none';
		greenObj.style.display = 'block';
	}
	
}


/* ==================================== */
	
function checkForm(formObj) {
	var formOK = true;
	
	formOK = checkEmail(formObj.email.value);  // check email address

	if (formOK == true) {
		formObj.submit();
	}

}


function checkEmail(email) {
	if (email.length == 0) {
		window.alert("You must provide your e-mail address.");
		return false;
	}
	if (email.indexOf("/") > -1) {
		window.alert("E-mail address has invalid character: /");
		return false;
	}
	if (email.indexOf(":") > -1) {
		window.alert("E-mail address has invalid character: :");
		return false;
	}
	if (email.indexOf(",") > -1) {
		window.alert("E-mail address has invalid character: ,");
		return false;
	}
	if (email.indexOf(";") > -1) {
		window.alert("E-mail address has invalid character: ;");
		return false;
	}
	if (email.indexOf("@") < 0) {
		window.alert("E-mail address is missing @");
		return false;
	}
	if (email.indexOf("\.") < 0) {
		window.alert("E-mail address is missing .");
		return false;
	}
	return true;
}
	
