(function () {
	$("#contacts").submit(function() {
		if (!SB.Validator.validate(contact_config, 'contact')) {
			$('#contacts').show();
			$('#contact_process').hide();
			$('#contact_thanks').hide();
			$('#contact_error').html('Please correct the errors highlighted below');
			location.hash = '#contact';
		} else {
			$('#contact_error').html('');
			$('#contacts').hide();
			$('#contact_process').show();
			$('#contact_thanks').hide();

			$.ajax({
				type: "POST",
				url: "/Systems/ContactProcess.aspx",
				data: $('#contacts').serialize(),
				success: function() {
					$('#contacts').hide();
					$('#contact_process').hide();
					$('#contact_thanks').show();
					pageTracker._trackPageview('/ContactThanks.aspx');
				}
			});
		}

		return false;
	});

	SB.Validator.setupValidateOnBlur(contact_config2, 'contact');
})();

function typeSwitch(value) {
	if (value == "do_not_contact") {
		contact_config = contact_config2;
		document.getElementById("NoContactMsg").className = "doNotCallMessage";
		document.getElementById("ContactAddress").className = "";
		document.getElementById("ContactCity").className = "";
		document.getElementById("ContactState").className = "";
		document.getElementById("ContactZip").className = "";
	} else {
		contact_config = contact_config1;
		document.getElementById("NoContactMsg").className = "doNotCallMessage hidden";
		document.getElementById("ContactAddress").className = "hidden";
		document.getElementById("ContactCity").className = "hidden";
		document.getElementById("ContactState").className = "hidden";
		document.getElementById("ContactZip").className = "hidden";
	}
}
