function validateform(){
	name = document.getElementById("username").value;
	email = document.getElementById("useremail").value;
	
	valid = true;
	_errors = new Array();
	
	if(name.length == 0 || name == "Name"){
		valid = false;
		_errors.push("Name is required");
	}

	if(email.length == 0 || email == "Email"){
		valid = false;
		_errors.push("Email is required");
	} else {
		var re = new RegExp("^[\\w\\.=-]+@[\\w\\.-]+\\.[\\w\\.-]{2,4}$", "g");

		if (email.match(re) == null) {
			valid = false;
			_errors.push("Email is invalid");
		}
	}
	
	if(valid){
		return true;
	} else {
		if(_errors.length > 0){
			strHTML = "<p style=\"margin: 0px; color: #921E2B; padding-top: 10px; font-weight: bold;\">The following error has occurred:</p>";
		} else {
			strHTML = "<p style=\"margin: 0px; color: #921E2B; padding-top: 10px; font-weight: bold;\">The following errors have occurred:</p>";
		}
		
		strHTML += "<ul style=\"margin-top: 5px; margin-bottom: 5px; font-weight: bold;\">";
		
		for(a=0; a<_errors.length;a++){
			strHTML += "<li style=\"color: #921E2B;\">" + _errors[a] + "</li>";
		}
		
		strHTML += "</ul>";
	
		strHTML += "<p style=\"margin: 0px; color: #921E2B; font-weight: bold;\">Please correct and resubmit.</p>";
	
		document.getElementById("error_msg").innerHTML = strHTML;
	
		return false;
	}		
}

function showText(formItem, beforeText, afterText){
	if(formItem.value == beforeText){
		formItem.value = afterText;
	}
}