Index: template.php
===================================================================
--- template.php	(revision 2975)
+++ template.php	(working copy)
@@ -20,19 +20,20 @@
   $hook = 'page';
   
   // We have to go out of our way here to theme the tabs.
+  if (fb_is_fbml_canvas()) {  
+    // The code in menu.inc that themes them is complex,
+    // incomprehensible, and tangles the theme layer with the logic
+    // layer.  It doesn't help that the same theme functions are called
+    // for tabs as are called for all other menus.  So we use a global
+    // to keep track of what we're doing.
+    global $_fb_fbml_state;
+    $_fb_fbml_state = 'tabs';
+    // Why does a call to menu_tab_root_path theme the tabs?  I have no
+    // idea, but it does and caches the result.
+    menu_tab_root_path();
+    $_fb_fbml_state = NULL;
+  }
   
-  // The code in menu.inc that themes them is complex,
-  // incomprehensible, and tangles the theme layer with the logic
-  // layer.  It doesn't help that the same theme functions are called
-  // for tabs as are called for all other menus.  So we use a global
-  // to keep track of what we're doing.
-  global $_fb_fbml_state;
-  $_fb_fbml_state = 'tabs';
-  // Why does a call to menu_tab_root_path theme the tabs?  I have no
-  // idea, but it does and caches the result.
-  menu_tab_root_path();
-  $_fb_fbml_state = NULL;
-  
   template_preprocess($variables, $hook);
   template_preprocess_page($variables, $hook);
   // If any modules implement a preprocess function, they're SOL, we don't know about it.
