﻿function CancelFollow(userId, NickName) {
    var str = '<form method="post" action="/User/DelFollowing?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要取消对“' + NickName + '”的关注吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="submit" class="inputbutton" value="确定"  />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "取消关注", 300, 150);
}



function CancelBlack(userId, NickName) {
    var str = '<form method="post" action="/User/DelBlack?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要取消对“' + NickName + '”的黑名单吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="submit" class="inputbutton" value="确定"  />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "取消黑名单", 300, 150);
}

function CancelFollower(userId, NickName) {
    var str = '<form method="post" action="/User/DelFollower?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要取消“' + NickName + '”对你的关注吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="submit" class="inputbutton" value="确定"  />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "取消关注", 300, 150);
}

function CancelFriend(userId, NickName) {
    var str = '<form method="post" action="/User/DelFriend?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要解除与“' + NickName + '”的朋友关系吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="submit" class="inputbutton" value="确定"  />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "解除朋友关系", 300, 150);
}

function DelFriend(userId, NickName) {
    var str = '<form method="post" action="/User/DelFriend?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要解除与“' + NickName + '”的朋友关系吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="button" class="inputbutton" value="确定" onclick="DelFriendDo(this,' + userId + ')" />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "解除朋友关系", 300, 150);
}


function AddFollowing(userId, NickName) {
    var str = '<form method="post" action="/User/AddFollowing?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要关注“' + NickName + '”吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="button" class="inputbutton" value="确定" onclick="AddFollowingDo(this,' + userId + ')" />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "关注", 300, 150);
}


function AddFollowingDo(obj, userId) {
    $(obj).attr("disabled", "disabled");
    $.ajax({
        type: "post",
        cache: false,
        url: "/AjaxAction/addFriend/"+userId,
        success: function (result) {
            location.href = location.href;
        }
    });
    
}


function AddFollowingNoReflash(obj, userId) {
    $(obj).attr("disabled", "disabled");
    $.ajax({
        type: "post",
        cache: false,
        url: "/AjaxAction/addFriend/" + userId,
        success: function (result) {
            var $ul = $(obj).parents("userList-ul");
            $(obj).parent().parent("li").fadeOut("slow", function () {
                $(this).remove();
                if ($("#waitedUserUl>li").size() == 0) {
                    $("#waitedUserpanel").remove();
                }
            });
        }
    });

}

function DelFriendDo(obj, userId) {
    $(obj).attr("disabled", "disabled");
    $.ajax({
        type: "post",
        cache: false,
        url: "/AjaxAction/delFriend/" + userId,
        success: function (result) {
            location.href = location.href;
        }
    });

}


function CancelFollowPop(userId, NickName) {
    var str = '<form method="post" action="/User/DelFollowing?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要取消对“' + NickName + '”的关注吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="button" class="inputbutton" value="确定" onclick="CancelFollowingDo(this,' + userId + ')" />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "取消关注", 300, 150);
}



function CancelFollowingDo(obj, userId) {
    $(obj).attr("disabled", "disabled");
    $.ajax({
        type: "post",
        cache: false,
        url: "/AjaxAction/CancelFollowing/" + userId,
        success: function (result) {
            location.href = location.href;
        }
    });

}



function AddBlackPop(userId, NickName) {
    var str = '<form method="post" action="/User/DelFollowing?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要把“' + NickName + '”拖进黑名单吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="button" class="inputbutton" value="确定" onclick="AddBlackDo(this,' + userId + ')" />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "拖进黑名单", 300, 150);
}


function AddBlackDo(obj, userId) {
    $(obj).attr("disabled", "disabled");
    $.ajax({
        type: "post",
        cache: false,
        url: "/AjaxAction/AddBlack/" + userId,
        success: function (result) {
            location.href = location.href;
        }
    });

}


function DelBlackPop(userId, NickName) {
    var str = '<form method="post" action="/User/DelFollowing?UserID=' + userId + '"><div style="text-align:center;font-size:14px;"><p>\
                确定要解除对“' + NickName + '”的黑名单吗？</p><p>&nbsp;</p>\
                <p>\
                <input type="button" class="inputbutton" value="确定" onclick="DelBlackDo(this,' + userId + ')" />\
                <input type="button" class="inputCancelbutton" value="取消" onclick="fb_dialog.close();" />\
                </p></div></form>';

    fb_dialog.openHtml(str, "解除黑名单", 300, 150);
}


function DelBlackDo(obj, userId) {
    $(obj).attr("disabled", "disabled");
    $.ajax({
        type: "post",
        cache: false,
        url: "/AjaxAction/DelBlack/" + userId,
        success: function (result) {
            location.href = location.href;
        }
    });

}
