function facebook_onlogin_reload()
{
  window.location.reload();
}

function check_client_login_state( already_logged_into_facebook )
{
  FB.ensureInit(
    function()
    {
      FB.Facebook.get_sessionWaitable().waitUntilReady(
        function( session )
        {
          var is_now_logged_into_facebook = session ? true : false;

          // if the new state is the same as the old (i.e., nothing changed)
          // then do nothing
          if ( is_now_logged_into_facebook == already_logged_into_facebook)
          {
            return;
          }

          // otherwise, refresh to pick up the state change
          window.location.reload();
        }
      );
    }
  );
}
