$(function() {
  $('#fb_login_button').click(function() {
    /*FB.ensureInit(function() {
        FB.Connect.requireSession(function() {
            window.location = 'http://' + window.location.hostname + '/user_session/create';
          });
      });

    return false;*/
  });
  $('#fb-signup-button').click(function() {
    /*$button = $(this);
    FB.ensureInit(function() {
        FB.Connect.requireSession(function() {
            window.location = 'http://' + window.location.hostname +
              $button.siblings('#sign-up').attr('href');
          });
      });

    return false;*/
  });

  if ($.fn.labelify)
  {
    $('.openstudy input:text, .openstudy input:password, #get_started input:text').
      labelify({ text: 'label', labelledClass: 'default_text' });
  }
});

/**
 * Called when the user is authenticated using facebook. Ensures that the user
 * is logged in to OpenStudy as well.
 */
function facebookUserLoggedIn()
{
  openstudyLogin();
}

function openstudyLogin()
{
  window.location ='/session/facebook';
}

