setInterval("update_site_feed()", 15000);

function update_site_feed(){
	if($('form#ajax_data').hasClass('feed_index')){
		$.ajax({
			type: "post",
			url: $('form#ajax_data').attr('action'),
			dataType: "json",
			data: "&last_entry=" + $('input#last_created_on').val(),
			success: function(e) {
				if(e.code=='Success'){
					$('input#last_created_on').val(e.created_on);
					$('div.comment:last-child').fadeOut('slow', function(){
						$(this).remove();
						$('form#ajax_data').prepend(e.entry);
						$('div.comment:first-child').css('opacity', 0).slideDown('slow').animate({opacity: 1}, 'slow');
					});
				}
			}
		});
	}
	else{
		$.ajax({
			type: "post",
			url: $('form#ajax_data').attr('action'),
			dataType: "json",
			data: "&last_entry=" + $('input#last_created_on').val(),
			success: function(e) {
				if(e.code=='Success'){
					$('input#last_created_on').val(e.created_on);
					$('div#site_feed_entries div.widget_entry:last-child').fadeOut('slow', function(){
						$(this).remove();
						$('div#site_feed_entries').prepend(e.entry);
						
						$('div#site_feed_entries div.widget_entry:first-child').css('opacity', 0).slideDown('slow').animate({opacity: 1}, 'slow');
					});
				}
			}
		});
	}
}
