function votePub(id, score)
{
	if (current_tip) $(current_tip).hide(); // убираем tip
	var loadingElement = $('#vote_block');
	var loadingCode = loadingElement.html();
	loadingElement.html('<img src="/images/loading.gif" />');
	
	$.post('/vote_pub/', { 'id': id, 'score': score }, function(res)
	{
		if (!res) return;
		var obj = $.evalJSON(res);
		
		if (obj.status == 'error')
		{
			loadingElement.html(obj.message).delay(2000)
		    .queue(function(){
		        $(this).html(loadingCode);
		        loadData();
		        $(this).dequeue();		        
		    });
		}
		
		else
		{
			loadingElement.html(obj.message);
		}
		
		loadData(); // обновляем все загрузки
	});
}

function voteComment(id, score)
{
	var loadingElement = $('#vote_block_' + id);
	var loadingCode = loadingElement.html();
	loadingElement.html('<img src="/images/icons/loading_small.gif" class="loading" />');
	
	$.post('/vote_comment/', { 'id': id, 'score': score }, function(res)
	{
		if (!res) return;
		var obj = $.evalJSON(res);
		
		if (obj.status == 'error')
		{
			loadingElement.html(obj.message).delay(2000)
		    .queue(function(){
		        $(this).html(loadingCode);
		        $(this).dequeue();
		    });
		}
		
		else
		{
			loadingElement.html(obj.message);
		}
	});
}
