var bAllowRegister = false;
window.fbAsyncInit = function ()
{
    FB.init({ appId: '175957409090416', status: true, cookie: true, xfbml: true });

    /* All the events registered */
    FB.Event.subscribe('auth.login', function (response)
    {
        //             if (response.permissions)
        //             fb_register();
    });
    FB.Event.subscribe('auth.logout', function (response)
    {
        fb_logout();
    });

    FB.getLoginStatus(function (response)
    {
        if (response.session)
        {
            // logged in and connected user, someone you know
            // login();
        }
    });
};
$(function ()
{
    var e = document.createElement('script');
    e.type = 'text/javascript';
    e.src = document.location.protocol +
            '//connect.facebook.net/en_US/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e);
});
function fb_register()
{
    if (bAllowRegister)
        FB.getLoginStatus(function (response)
        {
            if (response.status === 'connected')
            {
                window.location = 'https://graph.facebook.com/oauth/authorize?client_id=175957409090416&redirect_uri=http://' + window.location.host + '/Registration.aspx';
            } 
            else
            {
            }
        });
}

function fb_logout()
{
}
