facebook_api.requireLogin = function()
{
	FB.ensureInit (function()
	{ 
		FB.Connect.requireSession(function()
		{
			$(document).trigger(facebook_api_events.USER_LOGGED_IN);
		},
        function()
        {
            popup.hideBackground();
            $(document).trigger(facebook_api_events.USER_CANCELED_LOGIN);
        },true);
	});
};

facebook_api.logout = function()
{
    popup.showBackground();
    
	FB.Connect.logout(function()
	{
        $(document).trigger(facebook_api_events.USER_LOGGED_OUT);
        
        popup.hideBackground();
    });
};