function remove(self, friend_id)
{
	$.ajax({type:'POST',url:base_dir+'friends/remove',data: 'friend_id='+friend_id+'&json=1', dataType:'json',
		success:function(json){
			if(json.success)
			{
				$('#friendCount').html(json.friendCount);
				$('#friend_'+friend_id).parent().remove();
			}
			else makePopUp("Whoops!", json.error);}});
	return false
}

//mode = 'confirm'|'deny'
function setFriendConfirmation(friend_id, mode)
{
		//TODO: toggle AJAX hourglass.
		$.ajax({type:'POST', url:base_dir+'friends/'+mode, data:'user_id='+friend_id+'&json=1', dataType:'json', success: function(json)
		{
			if (json.success) {
				requestCount--;
				$('#confirmDeny_'+friend_id).hide();
				$('#requestText_'+friend_id).hide();
				if (requestCount == 0) $('#pendingFriendRequests').html("<h3>No more pending friend requests</h3>");

				//If a friend is being added, update the friends list.
				//TODO: Make sure the friend isn't already in my friends list.
				if (mode == 'confirm') {
					var eleFriendCount = $('#friendCount');
					eleFriendCount.html(parseInt(eleFriendCount.html()) + 1);
					$('#friendsList').load(base_dir + "users/viewFriendTiles/user_id/" + user_id); //TODO: add the friend client-side instead of using a heavy server call.
				}
			} else {
				makePopUp("Whoops!", json.error);
			}
		}});
}