function fetchnews(year) {
	var dataString = (year) ? "year="+year : '';
	$.ajax({
		type: "GET",
		url: "services/news.php",
		data: dataString,
		success: function(msg){
			var obj = jQuery.parseJSON(msg);
			$("#foocontent").html('');
			$.each(obj, function(){
				var html = '';
				html += '<div class="item">';
				html += '<div class="date">'+this.date+' by '+this.user+'</div>';
				html += '<div class="title">'+this.topic+'</div>';
				html += '<div class="entry"><br /><br />'+this.body+'<br /><br /><a href="viewpost.php?pid='+this.id+'">View Comments</a> ('+this.numcom+')';
				html += '</div></div>';
				$("#foocontent").append(html);
			});
		}
	});
}

function fetchcomments(limit) {
	var dataString = (limit) ? "limit="+limit : '';
	$.ajax({
		type: "GET",
		url: "services/comments.php",
		data: dataString,
		success: function(msg){
			var obj = jQuery.parseJSON(msg);
			$("#latest-comments").html('<ol>');
			$.each(obj, function(){
				$("#latest-comments").append('<li><a href="viewpost.php?pid='+this.com_pid+'">'+this.com_date+'</a></li>');
			});
			$("#latest-comments").append('</ol>');
		}
	});
}
