$(document).ready(function() {

	/**
	 * Load more posts on click.
	 */
	$('#loadMorePosts').click(function(e) {
		var link = this;
		$.get(link.href, function(data) {
			if(data == "") {
				return $(link).hide();
			}
			$('#content div.post:last').removeClass('last');
			$(link.target).before(data);
		});
		var current = parseInt(link.href.match(/page:(\d+)/)[1]);
		link.href = link.href.replace("page:"+current, "page:"+(++current));
		e.preventDefault();
	});

});
