type = 'all';

$(document).ready(function() {
	
	setInterval(function() { Timeline(timeline_limit,type); },15000);
	
	var socket = new Pusher('f1a38b55dfbd05bb7bfe', 'betaseries');
	
	socket.bind('new_event', function(msg) {
		alert(msg);
	});

});

function Timeline(nb,type) {

	$('.timeline.previously').append('<img id="loading" src="/images/loader-circle.gif" />');
	
	$.get('/ajax/timeline.php?limit='+nb+'&type='+type,function(html) {
	
		$('.timeline.previously #loading').remove();
		$('.timeline.previously .item').remove();
		$('.timeline.previously').append(html);
	
	});

}

function timelineToggle(nb) {

	if (type == 'all') {
		type = 'friends';
		Timeline(nb,type);
		$('div.fils_rss ul.rss li a').html('Tout le monde');
	} else {
		type = 'all';
		Timeline(nb,type);
		$('div.fils_rss ul.rss li a').html('Uniquement mes amis');
	}

}