//validation function for registration form
function validateForm(email){
	if(!validate())
		return false
	if(!validateEmailAddress(email))
		return false
	return true;
}


//check that all fields with classname 'required' are filled in
function validate(){
var elems=document.getElementsByTagName('input'); 
for(var i=0;i<elems.length;i++){
	if((elems[i].className=='required')&&(elems[i].value=="")){
		alert("Please fill in all required fields");
		return false;
	}
}
return true;
}


/*** This validation function checks that an email address contains both '@' and '.' **/
function validateEmailAddress(){
var email = document.getElementById('email_address').value;
	if((email.indexOf('@')==-1)||(email.indexOf('.')==-1)){
		alert("Invalid email address");
		return false;
	}
	else
		return true;
}


function highlight(id){
	document.getElementById(id).style.backgroundColor='#29426B';
}
function unhighlight(id){
	document.getElementById(id).style.backgroundColor='transparent';
}