setInterval('checkcomments()', 60000);
var oldCount = 0;

function checkcomments(){
	$.post('/checkcomments?'+ Math.random() ,0 , onAjaxSuccess);
	//$('#temperature').load('/gettemp3?' + Math.random());
	$('#temperature').html('<img src="/cache/temperature.gif?' + Math.random()*100 + '">');
	$('#usersonline').load('/getusersonline?'+ Math.random());
}

function onAjaxSuccess(data)
{
	if (data > lastcommentid) {
		var count = data - lastcommentid;
		oldCount += count;
		document.title = "(*) " + document.title;
		if (count > 1)
			$('#msg').html('<a href="/comments#comment' + data + '">Новые комменты (' + oldCount + ')</a>');	
		else $('#msg').html('<a href="/comments#comment' + data + '">Новый коммент (' + oldCount + ')</a>');	
		lastcommentid = data;
	}
}

function toggleonlineusers()
{
// показывает/скрывает список онлайн-юзеров

}
