Index: fb_devel.js
===================================================================
--- fb_devel.js	(revision 4146)
+++ fb_devel.js	(working copy)
@@ -8,17 +8,19 @@
 FB_Devel = function(){};
 
 FB_Devel.sanityCheck = function() {
-  if (typeof(FB) != 'undefined' &&
-      (!Drupal.settings.fb || FB._apiKey != Drupal.settings.fb.fb_init_settings.appId)) {
 
-    // There is a <script> tag initializing Facebook's Javascript
-    // before fb.js has a chance to initilize it!  To fix: use browser
-    // to view page source, find all <script> tags that include all.js
-    // and get rid of them.
-    // NOTE: this seems to get triggered sometimes, even when set up correctly.  Race condition?
-    debugger; // not verbose.
-    if (Drupal.settings.fb_devel.verbose) {
-      alert("fb_devel.js: Facebook JS SDK initialized witout app id!"); // verbose
+  if (Drupal.settings.fb_devel.verbose == 'extreme') { // Expensive test, only when extreme.
+    if (typeof(FB) != 'undefined' &&
+        FB.getAccessToken() && // Unfortunately, we can only check when access token known (user logged in.)
+        Drupal.settings.fb.fb_init_settings.appId) {
+      // Test, was FB initialized with the right app id?
+      FB.api('/app', function(response) {
+        if (response.id != Drupal.settings.fb.fb_init_settings.appId) {
+          alert("fb_devel.js: Facebook JS SDK initialized with app id: " + response.id + ".  Expected " + Drupal.settings.fb.fb_init_settings.appId + "!");
+          debugger;
+          // If you're here, you probably have multiple facebook modules installed, and they are competing to initialize facebook's javascript API.
+        }
+      });
     }
   }
 
Index: fb.js
===================================================================
--- fb.js	(revision 4146)
+++ fb.js	(working copy)
@@ -7,22 +7,15 @@
     FB.init(Drupal.settings.fb.fb_init_settings);
   }
 
-  if (FB._apiKey) {
-    // Check the login status.  If offline_access granted, this
-    // is the only whay to know if user has logged out of facebook.
-    FB.getLoginStatus(function(response) {
-      // Note this callback is often not called, due to bugs in facebook's JS SDK.
-      FB_JS.initFinal(response);
-    });
+  // Check the login status.  If offline_access granted, this
+  // is the only whay to know if user has logged out of facebook.
+  FB.getLoginStatus(function(response) {
+    // Note this callback is often not called, due to bugs in facebook's JS SDK.
+    FB_JS.initFinal(response);
+  });
 
-    // getLoginStatus is broken and may never call its callback!
-    setTimeout("FB_JS.initFinal({'session' : null})", 500);
-  }
-  else {
-    // No application.  Not safe to call FB.getLoginStatus().
-    // We still want to initialize XFBML, third-party modules, etc.
-    FB_JS.initFinal({'session' : null});
-  }
+  // getLoginStatus is broken and may never call its callback!
+  setTimeout("FB_JS.initFinal({'session' : null})", 5000); // 5000 = 5 seconds
 
 };
 
@@ -90,7 +83,7 @@
 FB_JS.reload = function(destination) {
   // Determine url hash.
   var auth = FB.getAuthResponse();
-
+  debugger;
   var fbhash;
   if (auth != null)
     fbhash = auth.signedRequest; // Use sig rather than compute a new hash.
@@ -148,6 +141,9 @@
 
 // Facebook pseudo-event handlers.
 FB_JS.authResponseChange = function(response) {
+  // Remember the current status.
+  FB_JS.authResponse = response;
+
   //debugger;
   if (response.status == 'unknown') {
     // @TODO can we test if third-party cookies are disabled?
@@ -177,7 +173,6 @@
     // Sometimes Facebook's invalid cookies are left around.  Let's try to clean up their crap.
     // Can get left behind when third-party cookies disabled.
     // @TODO: Still needed with new oauth??? Have cookies been renamed (fbsr_...)???
-    FB_JS.deleteCookie('fbs_' + FB._apiKey, '/', '');
     FB_JS.deleteCookie('fbs_' + Drupal.settings.fb.apikey, '/', '');
   }
 
@@ -226,12 +221,10 @@
       request_data.fb_js_page_type = Drupal.settings.fb_page_type;
     }
 
-    // FB._apikey might be an apikey or might be an appid!
-    if (FB._apiKey == Drupal.settings.fb.fb_init_settings.appId ||
-        FB._apiKey == Drupal.settings.fb.fb_init_settings.apiKey) {
-      request_data.apikey = Drupal.settings.fb.fb_init_settings.apiKey; // deprecated
-      request_data.appId = Drupal.settings.fb.fb_init_settings.appId;
-    }
+    // Historically, we pass appId to ajax events.
+    // This data no longer present in JS API, so may be removed soon.
+    // In other words, deprecated!
+    request_data.appId = Drupal.settings.fb.fb_init_settings.appId;
 
     // Other values to pass to ajax handler.
     if (Drupal.settings.fb.controls) {
Index: fb_connect.js
===================================================================
--- fb_connect.js	(revision 4146)
+++ fb_connect.js	(working copy)
@@ -56,7 +56,6 @@
     // Facebook's invalid cookies persist if third-party cookies disabled.
     // Let's try to clean up the mess.
     // @TODO: is this still needed with newer oauth SDK???
-    FB_JS.deleteCookie('fbs_' + FB._apiKey, '/', ''); // app id
     FB_JS.deleteCookie('fbs_' + Drupal.settings.fb.apikey, '/', ''); // apikey
   }
   if (FB.getUser()) { // @TODO: still needed with newer oauth SDK???
