function $(p) {
	return document.getElementById(p);
}

$('submit_info_btn').onclick = do_submit;
$('reset_btn').onclick = do_reset;

function check_email(p) {
	return ((/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[a-zA-Z]{2}|com|org|net|gov|biz|info|name|aero|biz|info|jobs|museum)\b/.test(p)) ? true : false);
}

function check_empty(p) {
	try {
		return (p == null || p == '');
	} catch (ex) {
		return (true);
	}
}

function do_submit() {
	if (check_empty($('full_name').value)) {
		alert('The full name cannot be empty.  Please fill this information in and try again.');
		$('full_name').focus();
		return false;
	}
    if (!check_email($('email').value)) {
        alert('The email address that you entered does not appear to be in a valid format.  Please try again.');
        $('email').focus();
		return false;
	}
	if (check_empty($('info').value)) {
		alert('The information must be filled in.  Please fill this information in and try again.');
		$('info').focus();
		return false;
	}
	$('submission_form').submit();
	return true;
}

function do_reset() {
	$('submission_form').reset();
}