﻿window.fbAsyncInit = function () {
    FB.init({ appId: '253986534635059', status: true, cookie: true,
        xfbml: true
    });

    FB.Event.subscribe('edge.create', function (response) {
        actualizaLikes(response);
    });
	FB.getLoginStatus(function (response) {
        if (response.status === 'connected') {
            // the user is logged in and connected to your
            // app, and response.authResponse supplies
            // the user's ID, a valid access token, a signed
            // request, and the time the access token 
            // and signed request each expire
            // var uid = response.authResponse.userID;
            // var accessToken = response.authResponse.accessToken;
            // console.log('conectado y autorizado');
            //$('#fbLoginButton').css("display", "none");
        } else if (response.status === 'not_authorized') {
            // the user is logged in to Facebook, 
            //but not connected to the app
            console.log('conectado pero no autorizado');
            $('#fbLoginButton').show('slow');
        } else {
            // the user isn't even logged in to Facebook.
            // console.log('no conectado');
            $('#fbLoginButton').show('slow');
        }
    });
};
(function () {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol + '//connect.facebook.net/es_LA/all.js';
    document.getElementById('fb-root').appendChild(e);
} ());
