function validatesignup() {
	firstname = document.getElementById('firstname').value.trim();
	lastname = document.getElementById('lastname').value.trim();
	email = document.getElementById('email').value.trim();
	errors = '';
	if (firstname == '') {
		errors += "- your first name\n";
	}
	if (lastname == '') {
		errors += "- your last name\n";
	}
	if (email == '') {
		errors += "- your email address\n";
	} else if (!isemail(email)) {
		errors += "- a valid email address\n";
	}
	if (errors == '') {
		ahah("/!php/mailsignup.php?firstname="+encodeURIComponent(firstname)+"&lastname="+encodeURIComponent(lastname)+"&email="+encodeURIComponent(email),"updates");
	} else {
		alert ("Unable to complete signup at this time.\nThe following information is missing:\n\n"+errors);
	}
	return false;
}

function isemail(text) {
	//does this match the form of a valid email address? check will be "null" if not
	pat = /([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})/;
	check = text.match(pat);
	if (check == null) {
		return false;
	} else {
		return true;
	}
}
String.prototype.trim = function () {
	return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
}
