function addFriend(authorId)
{
	$.getJSON("/users/friends/addFriend/"+authorId,
	function(result)
	{
		if(result.success)
		{
			//alertAlternative("Message:","This author has been added to your friends list");
			$("#friendButton").html('<a href="javascript:deleteFriend('+authorId+')"><img src="/assets/img/user_add.png" border="0"> Stop Following</a>');
		}
		else
		{
			loadAlert(result.error);
		}
	});
}

function deleteFriend(authorDescriptor)
{
	$.getJSON("/users/friends/deleteFriend/"+authorDescriptor,
	function(result)
	{
		if(result.success)
		{
			//alertAlternative("Message:","You are no longer following this author");
			$("#friendButton").html('<a href="javascript:addFriend('+result.authorId+')"><img src="/assets/img/user_add.png" border="0"> Follow This Author</a>');
			//window.location="/author/"+authorDescriptor;		
		}
		else
		{
			alert("An error occured");
		}
	});
}

function banAuthor(authorId)
{
	if(confirm("Are You Sure?"))
	{
		if(confirm("THIS WILL BLACKLIST THIS USER ARE YOU SURE YOU WANT TO DO THIS?"))
		{
			$.getJSON("/profile/blacklistAuthor/"+authorId,
			function(result)
			{
				loadAlert(result.message);
			});
		}
	}
}

