    JUST_LIKED = null;
    HAS_LIKED = false;

    window.fbAsyncInit = function() {

      FB.init({appId: APP_ID, status: true, cookie: true, xfbml: true});
      FB.XFBML.parse();
      FB.getLoginStatus();

      var fb_redirect = function() {
        if ($.cookie('_scope_cntaskd') != '1') {
          $.cookie('_scope_cntaskd', '1', { expires: 7, path: '/' });
          var url = 'https://graph.facebook.com/oauth/authorize?client_id=' + APP_ID + '&redirect_uri=' + SITE_ROOT + 'like_redirect%3Ftype=' + fb_cbk_info['type'] + '%26id=' + fb_cbk_info['id'] + '&scope=email&display=page';
          window.location.href = url;
        } else { 
          //stop bugging me
        }

        return null;
      };

      FB.Event.subscribe('edge.create', function(response) {
          if (typeof fb_cbk_info == 'undefined') {
            return;
          }
          var ajax_callback = function(t) {
            $.ajax({
                url: '/ajax/liked',
                data: {type: fb_cbk_info.type, id: fb_cbk_info.id, k: fb_cbk_info.k, t: t},
                type: 'POST'
            }); 
          };

          HAS_LIKED = true;

          FB.getLoginStatus(function(response) {
            if (response.status == 'connected') {
              // logged in and connected user, someone you know
              ajax_callback(response.session['access_token']);
            } else if (response.status == 'unknown') {
              JUST_LIKED = ajax_callback;
            } else if (response.status == 'notConnected') {
              return fb_redirect();
            } else {
              // wut?
            }
            FB.getLoginStatus();
          });

      });

      FB.Event.subscribe('auth.statusChange', function(response) {
         
        if (HAS_LIKED) {
          if (response.status == 'notConnected') {
            // besoin de l'autorisation!!!
            return fb_redirect();
          }
          if (JUST_LIKED) {
            JUST_LIKED(response.session['access_token']);
          }
          window.location.reload();
        }

      });

      FB.Event.subscribe('auth.login', function(response) {
        if ( ! HAS_LIKED) window.location.reload();

      });

    };
    (function() {
      var e = document.createElement('script'); e.async = true;
      e.src = document.location.protocol +
        '//connect.facebook.net/fr_CA/all.js';
      document.getElementById('fb-root').appendChild(e);
    }());


