﻿var FriendSide = {
    PageSize: 9,
    Init: function () {
        if (VisitedUserId != '0') {
            $.getJSON('/Service/Friend/FriendshipService.svc/GetFriendshipList/' + VisitedUserId + '/0/' + this.PageSize + '/Desc' + '/' + null, LoadFriendshipControlResult);
        }

        function LoadFriendshipControlResult(results) {
            $('.list_control_friend ul').LoadTemplate({
                Data: results.Friendship,
                TemplateName: 'tmpfriendHome',
                UrlTemplate: '/Friend/AsyncTemplates/Friendship.htm',
                CallMethod: FriendSide.GetCountFriendship
            });
        }
    },
    GetCountFriendship: function () {
        if (VisitedUserId != '0')
            $.getJSON('/Service/Friend/FriendshipService.svc/GetFriendshipListCount/' + VisitedUserId, GetCountFriendshipResult);
        function GetCountFriendshipResult(results) {
            $('.countFriendship').html(results);
        }
    }
}


