function getNews(page, count) {
	$.ajax({async: false, type: "GET", url: "php/getNews.php", data: "c="+count+"&p="+page, success: function(data) {
		$('#newsContainer').html(data);
	}});
}
function initNews() {
	var count = 3;
	var currPage = 1;
	getNews(currPage, count);
	var total = $('#newsCount').html();
	var pageCount = Math.ceil(total/count);
	$('#backButton').click(function() {
			if (currPage > 1) {
				getNews(currPage - 1, count);
				currPage -= 1;
			}
	});
	$('#forwardButton').click(function() {
		if (currPage < pageCount) {
			getNews(currPage + 1, count);	
			currPage += 1;
		}
	});
	$('#firstButton').click(function() {
		getNews(1, count);	
		currPage = 1;
	});
	$('#lastButton').click(function() {
		getNews(pageCount, count);	
		currPage = pageCount;
	});
}

