function verify(fm)
{
	if (REGISTER_Form_Validator()) {
		if (fm.VAL_PASSWORD.value != fm.PASSWORD_CONFIRM.value) {
			showError("Password does not equal of password confirm");
			return false;
		}
		var myDate = new Date();
		myDate.setFullYear(fm.VAL_BIRTH_YEAR.value, fm.VAL_BIRTH_MONTH.value, fm.VAL_BIRTH_DAY.value);
		verifyDate = new Date();
		if ((Date.parse(verifyDate) - Date.parse(myDate)) < 567648000000) {
			showError("Only people over the age of 18 can sign up.");
			return false;
		}
		checkCaptcha();
	}
	return false;
}

function checkAgreement(el)
{
	jQuery('#edit_user_submit_button').attr('disabled',!el.checked);
}
function checkCaptcha()
{
	jQuery.ajax({
		url: "index.php?ACTION=register&todo=checkCaptcha",
		cache: false,

		dataType: 'json',
		data:{
			code: jQuery('#captcha').val()
		},
		success: function(j) {
			if(j.req != 1) {
				jQuery('#captcha').css({ border: '1px solid #c24949', background: '#ffbcbc' });
				showError("We can't tell if you're human.  Please type in correct code.");
				captcha.refreshCaptcha('#captchaimage');
				return false;
			}
			jQuery('#captcha').css({ border: '1px solid #49c24f', background: '#bcffbf' });
			jQuery("#mainForm").submit();
		}
	});
}
var captcha = {
	refreshCaptcha:function(sel){
		jQuery(sel)
		.attr('src',"index.php?ACTION=register&todo=captchaImage&random="+Math.random());
	}
}
