$(function() {
  $('.error').hide();
  $("#general-contact-form").submit(function() {
	// validate and process form
	// first hide any error messages
    $('.error').hide();		
    
	var firstName = $("input#first-name").val();
	if (firstName == "") {
      $("label#first-name-error").show();
      $("input#first-name").focus();
      return false;
    }
	
	var lastName = $("input#last-name").val();
	if (lastName == "") {
      $("label#last-name-error").show();
      $("input#last-name").focus();
      return false;
    }	
	var email = $("input#email").val();
	if (email == "") {
      $("label#email-error").show();
      $("input#email").focus();
      return false;
    }
	var phone = $("input#phone").val();
    var comments = $("textarea#comments").val();
	
	//var dataString = 'name='+ firstName + '&lastName=' + lastName + '&email=' + email + '&phone=' + phone + '&comments=' + comments;
	var params = $.param($("input,textarea"));
	//alert (dataString);return false;
		
	$.ajax({
      cache: false,
      type: "POST",
      url: "/process.cfm",
      data: params,
      success: function() {
		$('#contact-wrapper span').hide();
		$('.contact-info').hide();
        $('#contact-form').html("<div id='message'></div>");
        $('#message').html("<img src='images/check.png' id='checkmark' />")
        .append("<h2>Contact Form Submitted!</h2>")
		.append("<p>We will be in touch soon.</p>")
        .hide()
        .fadeIn(1500);
      }
     });
    return false;
	});
}); 
