function subscribePub(id, type)
{
	displayLoading('on');
	
	if (current_tip) $(current_tip).hide(); // убираем tip
	
	$.post('/subscribe_pub/', { 'id': id, 'type': type }, function(res)
	{
		displayLoading('off');
		
		if (!res) return;
		var obj = $.evalJSON(res);
		
		if (obj.status == 'error')
		{
			displayMessage('error', obj.message);
			return;
		}
		
		else
		{
			if (type == 'delete') $('#pub_id_' + id).remove();
			else $('#subscribeId').remove();
			displayMessage('ok', obj.message);
		}
	});
}

function pubInTop(id)
{
	displayLoading('on');
	
	if (current_tip) $(current_tip).hide(); // убираем tip
	
	$.post('/pub_in_top/', { 'id': id }, function(res)
	{
		displayLoading('off');
		
		if (!res) return;
		var obj = $.evalJSON(res);
		
		if (obj.status == 'error')
		{
			displayMessage('error', obj.message);
			return;
		}
		
		else
		{
			displayMessage('ok', obj.message);
		}
	});
}

function buyPub(id, type)
{
	displayLoading('on');
	
	if (current_tip) $(current_tip).hide(); // убираем tip
	
	$.post('/buy_pub/', { 'id': id, 'type': type }, function(res)
	{
		displayLoading('off');
		
		if (!res) return;
		var obj = $.evalJSON(res);
		
		if (obj.status == 'error') displayMessage('error', obj.message);		
		else window.location = obj.location;
	});
}
