$(function(){
	$('.error').hide();
	$(".button").click(function(){
		// validate and process form
		
			var name = $("input#name").val();
			if(name == ""){
				$("input#name").focus();
				return false;
			}
			
			var email = $("input#email").val();
			if(email == ""){
				$("input#email").focus();
				return false;
			}
			
			var phone = $("input#phone").val();
			if(phone == ""){
				$("input#phone").focus();
				return false;
			}
			
			var comments = $("textarea#comments").val();
			if(comments == ""){
				$("textarea#comments").focus();
				return false;
			}
			
			var dataString = 'name=' + name + '&phone=' + phone + '&email=' + email + '&comments=' + comments;

			$.ajax({
				type: "POST",
				url: "bin/process2.php",
				data: dataString,
				success: function() {
					$('#form').html("<div id='contactMessage'></div>");
					$('#contactMessage').html("<h3>Thank you for signing up!</h3>")
					.hide()
					.fadeIn(1500, function() {
				  });
				}
			  });
			  return false;  
  
			
	});
});