function AdicionarAmigo(friendId) {
    $.ajax({
        url: "/Profile?handler=AddFriendship",
        data: {
            friendId: friendId,
        },
        type: "GET",
        success: function () {
            document.getElementById('remove-friend-btn').classList.remove("d-none")
            document.getElementById('add-friend-btn').classList.add("d-none")
        },
        error: function () {
            location.reload();
        }
    });
}

function RemoverAmigo(friendId) {
    $.ajax({
        url: "/Profile?handler=RemoveFriendship",
        data: {
            friendId: friendId,
        },
        type: "GET",
        success: function () {
            document.getElementById('remove-friend-btn').classList.add("d-none")
            document.getElementById('add-friend-btn').classList.remove("d-none")
        },
        error: function () {
            location.reload();
        }
    });
}

function toggleFriendships() {
    var friendshipsContent = document.getElementById("profile-friendships-content");
    var friendshipsToggle = document.getElementById("friendships-toggle");
    var friendshipsTab = document.getElementById("friendships-tab");

    if (friendshipsContent.style.display === "none" || friendshipsContent.style.display === "") {
        friendshipsContent.style.display = "block";
        friendshipsToggle.classList.remove("fa-angle-down")
        friendshipsToggle.classList.add("fa-angle-up")
        friendshipsTab.classList.remove("hr-profile-menu")
        friendshipsTab.classList.add("hr-profile-menu-selected")
    } else {
        friendshipsContent.style.display = "none";
        friendshipsToggle.classList.remove("fa-angle-up")
        friendshipsToggle.classList.add("fa-angle-down")
        friendshipsTab.classList.remove("hr-profile-menu-selected")
        friendshipsTab.classList.add("hr-profile-menu")
    }
}