$(document).ready(function() {
	$('#form span').hide();		// hide all error messages
	$("#form p").addClass("idle");
	$("#form input, #regform textarea").focus(function(){
		$(this).parent("p").addClass("activeField").removeClass("idle");
	}).blur(function(){
		$(this).parent("p").removeClass("activeField").addClass("idle");
	});
	
	$("#submit").click(function() {
		$('#regform span').hide();		// hide all error messages

		if (!$("input#reg_first_name").val()) {
			$("input#reg_first_name").focus().next("span").show();
			return false;
		}
		if (!$("input#reg_last_name").val()) {
			$("input#reg_last_name").focus().next("span").show();
			return false;
		}
		if (!$("input#reg_email").val()) {
			$("input#reg_email").focus().next("span").show();
			return false;
		}
		if (!$("input#reg_phone").val()) {
			$("input#reg_phone").focus().next("span").show();
			return false;
		}

		if (!$("input#reg_address").val()) {
			$("input#reg_address").focus().next("span").show();
			return false;
		}
		if (!$("input#reg_city").val()) {
			$("input#reg_city").focus().next("span").show();
			return false;
		}
		if (!$("input#reg_state").val()) {
			$("input#reg_state").focus().next("span").show();
			return false;
		}
		if (!$("input#reg_zip").val()) {
			$("input#reg_zip").focus().next("span").show();
			return false;
		}
		return true;
	});
});
