/* Rev:$Revision$ */


            (function($) {
 
                $(document).ready(function() {
                if(tId.length>0){
                    var $pictureUrl = $('#picture-url');

                    $('#authLink').multiAuth({
                        devId: 'ao1WIog-XTcCQyXQ',
                        getTokenCallback: function(json) {

                            var $elem = $(this.authLink),
                            
                            response = json.response,

                            userAttr;
          
                            if (response.statusCode === 200) {

                                userAttr = response.data.userData.attributes;

                                $elem.html('Signed in as: ' + userAttr.displayName);
                                      
                        
                                if (userAttr.pictureUrl) {
                                    $pictureUrl.html('<img src="' + userAttr.pictureUrl + '/>');
                                }

                               $('#gcp_comments').comments('auth', {devId : 'ao1WIog-XTcCQyXQ', authToken : response.data.token.a});

                            } else {
                                $elem.html('');
                                $elem.html('<span></span>');
                                $pictureUrl.html('');
                                $('#gcp_comments').comments('unauth');
                            }

                        }
                    });

                    var config = {
                        channel_id : 2, 
                        topic_id : tId, 
                        topic_title : document.title, 
                        permalink : document.URL, 
                        topic_description: document.title,
                        sort  : 'new',
                       authType: 'sns',
                        count: 10};
            

                    $('#gcp_comments').comments(config);
                }});
            })(jQuery);

