$(function() {

	
	/* For all same-page links, slowly scroll to them */
	$('#faqQuestions a').click(function() {
		var $target = $(this.hash);
		$target = $target.length && $target
		|| $('[name=' + $(this.hash).slice(1) +']');
		if ($target.length) {
			var targetOffset = $target.offset().top;
			$('html,body')
			.animate({scrollTop: targetOffset}, 1000);
		 return false;
		}
  });

	
	/* When someone submits the form - check the fields */
	$("#dealerForm").submit( function() {
		if( 
			 ( $("input[name=zip]").val() != "" ) &&
			 ( $("input[name=zip]").val() != undefined ) 
			) {
			// Form properly submitted, continue.
		} else {
			alert("Please fill out the Postal Code / ZIP");
			return false; /* do not submit */
		}
	});
	
	/* When someone submits the form - check the fields */
	$("form[name=contactForm]").submit( function() {
		if( 
			 ( $("input[name=fName]").val() != "" ) &&
			 ( $("input[name=lName").val() != "" ) &&
			 ( $("input[name=addr1").val() != "" ) &&
			 ( $("input[name=city").val() != "" ) &&
			 ( $("input[name=stateProv").val() != "" ) &&
			 ( $("input[name=postalCode").val() != "" )
			) {
			// Form properly submitted, continue.
		} else {
			alert("Please fill out all of the required fields");
			return false; /* do not submit */
		}
	});
	
});