$(function() {
	
//post guest book form via ajax
		 
		 $("input#add_guestbook").click(function() {
      // validate and process form here
	  		//alert ('hello');
	  		var name = $("input#name").val();
			if (name == "") {
    			$("label#name_error").show();
   				$("input#name").focus();
    			return false;
  			}
			
			
			var email = $("input#email").val();
			if (email == "") {
    			$("label#email_error").show();
   				$("input#email").focus();
    			return false;
  			}
			
			var comment = $("textarea#comment").val();
	  		if (comment == "") {
    			$("label#comment_error").show();
   				$("textarea#comment").focus();
    			return false;
  			}
	  		
	  		//$('#guest_book_form_container form').hide();
	  		//$('#guest_book_form_container').append('<img src="http://localhost:8888/cygne/images/ajax-loader.gif" />');
	  		
	  		
	  		var dataString = 'add_guestbook=add_guestbook' + '&name='+ name + '&email=' + email + '&comment=' + comment;
  			//alert (dataString);return false;
 			$.ajax({
    			type: "POST",
    			url: "http://www.josephpalfrey.com/cygne/add_guestbook.php",
    			data: dataString,
    			success: function() {
    				 $('#guest_book_form_container').append('<img src="http://localhost:8888/cygne/images/ajax-loader.gif" />');
      				$('#guest_book_form_container').html("<div id='message'></div>");
      				$('#message').html("<h3>Merci pour votre commentaire!</h3>")
      				.append("<p>Nous le publierions d&egrave;s que possible.</p>")
      				.hide()
      				.fadeIn(1500, function() {
        			$('#message').append("<img id='checkmark' src='images/check.png' />");
      		});
    		}
  			});
 		
		return false;
	  
    	});
	
	
	
});