jQuery(document).ready(function () {
            window.fbAsyncInit = function() {
                //document.getElementById('tab3').style.display = "none";
                document.getElementById('userLogin').style.display = "none";
                FB.init({appId: '33430d50f1791b68eada779fe84282f2', status: true, cookie: true, xfbml: true});
                $("#tabs").tabs();
                //alert(ReadCookie('oid'));

                var oid;
                oid = ReadCookie('openIdLogin');

                //alert(ReadCookie('openIdLogin'));
                if (oid > 0){
                    //alert(oid);
                    checkOpenId(oid);
                    return;
                }

                //alert(ReadCookie('fbId'));
                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    // do something with response
                    login();
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    // do something with response
                    logout();
                });

                FB.getLoginStatus(function(response) {
                        if (response.session) {
                            // logged in and connected user, someone you know
                            login();
                        }else{
                            document.getElementById('userLogin').style.display = "inline";
                            //document.getElementById('preGame').style.display = "block";
                            //document.getElementById('game').style.display = "none";
                        }
                    });
                };

                (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 login(){
                FB.api('/me', function(response) {
                    document.getElementById('userLogin').style.display = "none";
                    //document.getElementById('preGame').style.display = "none";
                    checkFP(response.name);
                    document.getElementById('userWelcome').style.display = "inline";

                    SetCookie('fbId',response.id,1000);
                    //alert(response.id);
                    wsUserStat(response.id,response.name,response.email);
                    wsBibleGame(response.id);

                    document.getElementById('pray').style.display = "block";

                    //document.getElementById('tab3').style.display = "inline";
                    //document.getElementById('tabs-3').style.display = "inline";
                });
            }

            function logout(){
                document.getElementById('login').style.display = "none";
                //document.getElementById('tab3').style.display = "none";
                //document.getElementById('tabs-3').style.display = "none";
                document.getElementById('pray').style.display = "none";
            }

            function graphStreamPublish($url){
                //alert($url);
                var body = 'I found a great site posted on GODSurfer.com that I thought I would share with my friends on Facebook!\n';
                body = body + 'For this and other Articles, Blogs and Sites visit http://www.godsurfer.com/ \n';
                body = body + 'Link: ' + $url;
                //alert(body);

                FB.api('/me/feed', 'post', { message: body }, function(response) {
                    if (!response || response.error) {
                        alert('Error occured');
                    } else {
                        alert('Post ID: ' + response.id);
                    }
                });
            }

            function checkFP(userName){
                FB.api({ method: 'pages.isFan', page_id: '468540430042' }, function(resp) {
                    if (resp) {
                       document.getElementById('userWelcome').innerHTML = "<h2 class='mem'>Welcome " + userName + "</h2> <p class='bottom2LoggedIn'></p>";
                    } else {
                       document.getElementById('userWelcome').innerHTML = "<h2 class='mem'>Welcome " + userName + "</h2> <p class='bottom2LoggedIn'></p>";
                       document.getElementById('fbFan').style.display = "inline";
                    }
                  });
                  //alert('!!' + retVar + '!!');
            }

/*
            function wallPub(){
                var publish = {
                  method: 'stream.publish',
                  message: 'getting educated about Facebook Connect',
                  attachment: {
                    name: 'Connect',
                    caption: 'The Facebook Connect JavaScript SDK',
                    description: (
                      'A small JavaScript library that allows you to harness ' +
                      'the power of Facebook, bringing the user\'s identity, ' +
                      'social graph and distribution power to your site.'
                    ),
                    href: 'http://fbrell.com/'
                  },
                  action_links: [
                    { text: 'fbrell', href: 'http://fbrell.com/' }
                  ],
                  user_prompt_message: 'Share your thoughts about RELL'
                };

                FB.ui(publish, Log.info.bind('stream.publish callback'));
            }
*/



