$(document).ready(function() {
	$("#frmJoin").validate({
		errorClass: "formError",
		rules: {
			txtFirstName		: "required",
			txtLastName			: "required",
			txtEmail			: {
									required: true,
									email: true
							      },
			txtUserName			: {
									required: true,
									minlength: 5
							  	  },
			txtPassword			: {
									required: true,
									minlength: 5
							  	  },
			txtConfirmPassword	: {
									required: true,
									equalTo: "#txtPassword"
							      },
			txtCaptcha			: "required"
		},
		messages: {
			txtFirstName		: "<br />First name is required",
			txtLastName			: "<br />Last Name is required",
			txtEmail			: {
									required: "<br />Email is required",
					   		   		email: "<br />Please enter a valid Email Address"
								  },
			txtUserName			: {
									required: "<br />Username is required",
					   		   		minlength: "<br />Username must be at least 5 characters long"
								  },
			txtPassword			: {
									required: "<br />Password is required",
									minlength: "<br />Password must be at least 5 characters long"
								  },
			txtConfirmPassword	: {
									required: "<br />Confirm Passwordd is required",
									equalTo: "<br />Confirm Password and Password does not match"
								  },
			txtCaptcha			: "<br />Captcha is required"
		}
	});
	
});

function funcCheckAgree()
{
	var status = true;

	if ($("input[name='optUspsOrNot']:checked").length == 0) {
		$('#spnUspsOrNot').html('Please indicate whether you are a USPS Member');
		status = false;
	}
	else
		$('#spnUspsOrNot').html('&nbsp;');



	if ($("input[name='chkCommunityInterests[]']:checked").length == 0) {
		$('#spnCommunityInterests').html('Please choose at least one interest');
		status = false;
	}
	else
		$('#spnCommunityInterests').html('&nbsp;');


	if (!$("input[name='fileProfilePhoto']").val() && !$("input[name='hiddenFileProfilePhoto']").val()) {
		$('#spnProfilePhoto').html('Please either upload your own or choose a member profile photo');
		status = false;
	}
	else
		$('#spnProfilePhoto').html('&nbsp;');



	if ($('#chkAgree').attr("checked") == false) {
		$('#spnCheck').html('Please agree the terms and conditions');
		status = false;
	} else {
		$('#spnCheck').html('&nbsp;');
	}

	return status;
}

