function highlightColorBox(divId)
	{
		var currentDiv = document.getElementById(divId);
		
		currentDiv.style.background = '#494949';
	}
	
	function removeHighlight()
	{	
		document.getElementById("yellowBox").style.background='#ffcc00';
		document.getElementById("orangeBox").style.background='#ff9900';
		document.getElementById("redBox").style.background='#ff3300';
		document.getElementById("mergBox").style.background='#980000';
	}

function loadBio(lastName, firstName)
{

	alert(lastName+", "+firstName);
}
function validateFormOnSubmit(theForm)
{
	var reason = "";
	theForm.style.backgorund = 'Red';		
	
	reason += validateName(theForm.name);
	reason += validateEmail(theForm.email);
	reason += validateComments(theForm.Comments);
	
	if (reason != "")
	{
		alert("The following field(s) need correction(s):\n" + reason);
		return false;
	}
	
	return true;
}

function validateEmpty(fld)
{
	var error = "";
	
	if (fld.value.length == 0)
	{
		fld.style.background = 'Yellow';
		error = "The required field has not been filled in.\n"
	}
	else
	{
		fld.style.backgorund = 'White';
	}
	
	return error;
}

function validateName(fld)
{
	var error = "";
	var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	
	if (fld.value.length == "")
	{
		fld.style.background = 'Yellow';
		error = "Please enter your Name.\n"
	}
	else if ((fld.value.length < 3) || (fld.value.length > 30))
	{
		fld.style.background = 'Yellow';
		error = "The name is of wrong length.\n"
	}
	else if (illegalChars.test(fld.value))
	{
		fld.style.background = 'Yellow';
		error = "The name contains illegal characters.\n"
	}
	else
	{
		fld.style.backgorund = 'White';
	}	
	return error;
}

function trim(s)
{
	return s.replace(/^\s+|\s+$/, '');
}

function validateEmail(fld)
{
	var error = "";
	var tfld = trim(fld.value);
	var emailFilter = /^[^@]+@[^@.]+\.[^@]*\w\w$/ ;
	var illegalChars = /[\(\)\<\>\,\;\:\\\"\[\]]/ ;
	
	if (fld.value.length == "")
	{
		fld.style.background = 'Yellow';
		error = "Please enter your Email address.\n"
	}
	else if (!emailFilter.test(tfld))
	{
		fld.style.background = 'Yellow';
		error = "Please enter a valid Email address.\n"
	}
	else if (fld.value.match(illegalChars))
	{
		fld.style.background = 'Yellow';
		error = "The email address contains illegal characters.\n"
	}
	else
	{
		fld.style.backgorund = 'White';
	}	
	return error;
}

function validateComments(fld)
{
	var error = "";
	if (fld.value.length == "")
	{
		fld.style.background = 'Yellow';
		error = "Please type in some message.\n"
	}
	else if (fld.value.length < 5)
	{
		fld.style.background = 'Yellow';
		error = "Message length is too small.\n"
	}
	else if (fld.value.length > 1024)
	{
		fld.style.background = 'Yellow';
		error = "Please limit your message to 1024 characters.\n"
	}	
	else
	{
		fld.style.backgorund = 'White';
	}	
	return error;
}
