$(document).ready(function() {
	$("#postComment").click(function()	{
		$.post("/inc/phplib.php",{ postComment:$('#postComment'), author:$('#author').val(), comment:$('#comment').val() } ,function(data) {
		  if(data!='fail') {
	          //start fading the messagebox
		  	  $("#tagwall").fadeTo(200,0.1,function() { 
			   $(this).html(data).fadeIn(200).fadeTo(100,1);
			   $('#author').val('Your name..');
			   $('#comment').val('');
			   $('#error').fadeOut('fast');
			  });	
	      } else {
		  	  $("#error").fadeTo(200,0.1,function() { 
			   $(this).html("Fill in all fields").fadeIn(200).fadeTo(100,1);
			  });	 	
	      }
	    });
	});
	$("#sendEmail").click(function()	{
		$.post("/inc/phplib.php",{ sendEmail:$('#sendEmail').val(), email:$('#email').val(), message:$('#message').val() } ,function(data) {
		  if(data!='fail') {
	          //start fading the messagebox
		  	  $("#msg").fadeTo(200,0.1,function() { 
			   $(this).html(data).fadeIn(200).fadeTo(100,1);
			   $('#email').val('Your email..');
			   $('#message').val('');
			  });	
	      } else {
	      	
	      }
	    });
	});
});
function page(id) {
$.ajax({
   type: "GET",
   url: "/inc/phplib.php",
   data: "page=" + id,
   success: function(content){
  	  $("#tagwall").fadeTo(200,0.1,function() { 
	   $(this).html(content).fadeIn(200).fadeTo(100,1);
	  });	
   }
 });
}