      window.fbAsyncInit = function() {
        FB.init({
          appId   : '170095696356830',
          status  : true, // check login status
          cookie  : true, // enable cookies to allow the server to access the session
          xfbml   : true // parse XFBML
        });

        // whenever the user logs in, we refresh the page
/* FB.Event.subscribe('auth.login', function() {
          document.location='http://www.zapkolik.com/fbgiris.php';
        }); */
  FB.Event.subscribe('auth.login', function(response) {
    if (response.session) {
     login();
    } else {
      // The user has logged out, and the cookie has been cleared
    }
  });
  };

      (function() {
        var e = document.createElement('script');
        e.src = document.location.protocol + '//connect.facebook.net/tr_TR/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
function login() {
          		$.ajax({
						type: "POST",
						data: "gk=1", 
						url: "fbgiris.php",
						success: function(msg) {
						if (msg == "ok") $('#userbar').load('uyebar.php');
						else if (msg == "on")  {document.location='http://www.zapkolik.com/fbgiris.php';  }
						}
				});
}
