  $(function() {
    $('.error').hide();
    $(".button").click(function() {
      // validate and process form here
      
      $('.error').hide();
  	  var name = $("input#name").val();
  		if (name == "") {
        $("label#name_error").show();
        $("input#name").focus();
        return false;
      }
  	
  	var comment = $("input#comment").val();
  	
  	var dataString = 'name='+ name + '&comment=' + comment;
  	//alert (dataString);return false;
  	$.ajax({
    	type: "POST",
    	url: "../eagle_comment_form.php",
   	 	data: dataString,
    	success: function() {
    		
      		$('#contact_form').html("<div id='message'></div>");
      		$('#message').html("<h3>Comment Submitted.</h3>")
      		.append("<p>Thank You!</p>")
      		.hide()
      		.fadeIn(1500, function() {
          		$('#message').append("");
        	});
        	$("#refreshcomments").load(location.href+" #refreshcomments>*","");
    	}
  	});
  	return false;
  
  	
  	
    });
  });
  
