function register_validate(theform) {
	if (theform.username.value == "" ) {
		alert("Please input a username.");
		return false;
	} else if (theform.username.value.length > 20) {
		alert("Your username must not be more than 20 characters.");
		return false;
	} else	if (theform.email.value == "") {
		alert("Please input your email address.");
		return false;
	} else	if (theform.password.value == "") {
		alert("Please input your password.");
		return false;
	} else	if (theform.password.value != theform.password_confirm.value) {
		alert("Your password and confirm password don't match.");
		return false;
	} else if (theform.password.value.length < 6) {
		alert("Your password must be at least 6 characters.");
		return false;
	} else if (theform.password.value.length > 20) {
		alert("Your password must not be more than 20 characters.");
		return false;
	}
}

function edit_validate(theform) {
	if (theform.password.value != '') {
		if (theform.password.value != theform.password_confirm.value) {
			alert("Your password and confirm password don't match.");
			return false;
		} else if (theform.password.value.length < 6) {
			alert("Your password must be at least 6 characters.");
			return false;
		} else if (theform.password.value.length > 20) {
			alert("Your password must not be more than 20 characters.");
			return false;
		}
	}
}

