/* 
 * @author David Galvis
 */
var Member = {
   
   /**
    * When clicking on the button to see an anonymous user, this is overridden on headerfile
    */
   isShowContribDialog : 1,

    /**
     * Show the profile of an anounymous user
     */
    showAnonymousMemberProfile : function(uid)
    {
        JQ.post('/application/ajax/contributionSeeProfile.php',
            {
                mid : uid,
                type : 'user_profile'
            },
            function(response){
                if (response.statusCode == 200){
                    JQ(".user_" + uid + " .feed-user-anonymous-content").prepend("<div>" + response.name + "</div>");
                    JQ(".user_" + uid + " .feed-user-anonymous-img").html(response.photo);
                    JQ(".user_" + uid + " .memberMatchPhoto").html(response.photo);
                    JQ(".user_" + uid + " .feed-user-anonymous-button-container").hide();
                    JQ.nyroModalRemove();
                } else if (response.statusCode == 403){
                    JQ.nyroModalManual({
                        url : "/application/nyroPayContribution.php?mid=" + uid + '&type=user_profile'
                    });
                }
            },
            'json'
        )
    },
    /**
     * Enables members anonymous navigation
     */
    protectProfile : function(active)
    {
        JQ.post('/application/ajax/contributionProtectProfile.php',
            {active : active},
            function(response){
                if (response.statusCode == 200){
                    JQ.nyroModalRemove();
                } else if (response.statusCode == 403){
                    /*JQ.nyroModalManual({
                        url : "/application/nyroPayContribution.php?mid=" + uid + '&type=user_profile'
                    });*/
                }
            },
            'json'
        )
    }
}

