    function GetButtons() {
        $j.ajax({
            type: "POST",
            url: "/CMSPages/ActieSiteMethods.aspx/GetButtons",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                if (msg.d == "false") {
                    document.getElementById("JoinButtonDisabled").className = "joinbuttondisabled hidden";
                    document.getElementById("JoinButton").className = "joinbutton";
                    document.getElementById("DownloadButton").className = "downloadbutton hidden";
                }
                else {
                    document.getElementById("JoinButtonDisabled").className = "joinbuttondisabled hidden";
                    document.getElementById("JoinButton").className = "joinbutton hidden";
                    document.getElementById("DownloadButton").className = "downloadbutton";
                    document.getElementById("DownloadLink").href = msg.d;
                }
            }
        });
    }

    function GetRandomUserAvatar() {
        $j.ajax({
            type: "POST",
            url: "/CMSPages/ActieSiteMethods.aspx/GetRandomAvatar",
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                document.getElementById("RandomUserAvatarImage").src = msg.d[0];
            }
        });
    }

    function SetUserAvatar(userId) {
        $j.ajax({
            type: "POST",
            url: "/CMSPages/ActieSiteMethods.aspx/SetUserAvatar",
            data: "{\"userId\": \"" + userId + "\"}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                document.getElementById("RandomUserAvatarImage").src = msg.d[0];
                GetButtons();
            }
        });
    }

$j(document).ready(function() {
    //get random avatar for site
    GetRandomUserAvatar();
    //Set the button states
    GetButtons();
});
