auto import from //depot/cupcake/@137055
diff --git a/tools/droiddoc/templates/assets/android-developer-core.css b/tools/droiddoc/templates/assets/android-developer-core.css
index 5b31558..eaa1176 100644
--- a/tools/droiddoc/templates/assets/android-developer-core.css
+++ b/tools/droiddoc/templates/assets/android-developer-core.css
@@ -682,6 +682,32 @@
   height:1.8em;
 }
 
+/* search result tabs */
+
+#doc-content .gsc-control {
+  position:relative;
+}
+
+#doc-content .gsc-tabsArea {
+  position:relative;
+}
+
+#doc-content .gsc-tabHeader {
+  padding: 3px 6px;
+  position:relative;
+}
+
+#doc-content .gsc-tabHeader.gsc-tabhActive {
+  border-top: 2px solid #94B922;
+}
+
+#doc-content h2#searchTitle {
+  padding:0;
+}
+
+#doc-content .gsc-resultsbox-visible {
+  padding:1em 0 0 6px;
+}
 
 /* CAROUSEL */
 
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js
index cd9c0b3..a84d5a6 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates/assets/android-developer-docs.js
@@ -102,7 +102,7 @@
   var cookieHeight = getCookie(cookiePath+'height');
   if (cookieWidth) {
     restoreWidth(cookieWidth);
-  } else {
+  } else if ($(".side-nav-resizable").length) {
     resizeWidth();
   }
   if (cookieHeight) {
@@ -127,7 +127,8 @@
   var htmlPos = fullPageName.lastIndexOf(".html", fullPageName.length);
   var pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5);
   var link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
-  if ((link.length == 0) && (fullPageName.indexOf("/guide/") != -1)) { // if there's no match, then let's backstep through the directory until we find an index.html page that matches our ancestor directories (only for dev guide)
+  if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) || (fullPageName.indexOf("/sdk/") != -1))) { 
+// if there's no match, then let's backstep through the directory until we find an index.html page that matches our ancestor directories (only for dev guide and sdk)
     lastBackstep = pathPageName.lastIndexOf("/");
     while (link.length == 0) {
       backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
@@ -175,7 +176,9 @@
 
 function resizeAll() {
   resizeHeight();
-  resizeWidth();
+  if ($(".side-nav-resizable").length) {
+    resizeWidth();
+  }
 }
 
 function loadLast(cookiePath) {
diff --git a/tools/droiddoc/templates/assets/jquery-history.js b/tools/droiddoc/templates/assets/jquery-history.js
new file mode 100644
index 0000000..ef96ec3
--- /dev/null
+++ b/tools/droiddoc/templates/assets/jquery-history.js
@@ -0,0 +1,78 @@
+/**
+ * jQuery history event v0.1
+ * Copyright (c) 2008 Tom Rodenberg <tarodenberg gmail com>
+ * Licensed under the GPL (http://www.gnu.org/licenses/gpl.html) license.
+ */
+(function($) {
+    var currentHash, previousNav, timer, hashTrim = /^.*#/;
+
+    var msie = {
+        iframe: null,
+        getDoc: function() {
+            return msie.iframe.contentWindow.document;
+        },
+        getHash: function() {
+            return msie.getDoc().location.hash;
+        },
+        setHash: function(hash) {
+            var d = msie.getDoc();
+            d.open();
+            d.close();
+            d.location.hash = hash;
+        }
+    };
+
+    var historycheck = function() {
+        var hash = msie.iframe ? msie.getHash() : location.hash;
+        if (hash != currentHash) {
+            currentHash = hash;
+            if (msie.iframe) {
+                location.hash = currentHash;
+            }
+            var current = $.history.getCurrent();
+            $.event.trigger('history', [current, previousNav]);
+            previousNav = current;
+        }
+    };
+
+    $.history = {
+        add: function(hash) {
+            hash = '#' + hash.replace(hashTrim, '');
+            if (currentHash != hash) {
+                var previous = $.history.getCurrent();
+                location.hash = currentHash = hash;
+                if (msie.iframe) {
+                    msie.setHash(currentHash);
+                }
+                $.event.trigger('historyadd', [$.history.getCurrent(), previous]);
+            }
+            if (!timer) {
+                timer = setInterval(historycheck, 100);
+            }
+        },
+        getCurrent: function() {
+            if (currentHash) {
+              return currentHash.replace(hashTrim, '');
+            } else { 
+              return ""; 
+            }
+        }
+    };
+
+    $.fn.history = function(fn) {
+        $(this).bind('history', fn);
+    };
+
+    $.fn.historyadd = function(fn) {
+        $(this).bind('historyadd', fn);
+    };
+
+    $(function() {
+        currentHash = location.hash;
+        if ($.browser.msie) {
+            msie.iframe = $('<iframe style="display:none" src="javascript:false;"></iframe>').prependTo('body')[0];
+            msie.setHash(currentHash);
+            currentHash = msie.getHash();
+        }
+    });
+})(jQuery);
diff --git a/tools/droiddoc/templates/assets/search_autocomplete.js b/tools/droiddoc/templates/assets/search_autocomplete.js
index c9b6ff6..2e12e0f 100644
--- a/tools/droiddoc/templates/assets/search_autocomplete.js
+++ b/tools/droiddoc/templates/assets/search_autocomplete.js
@@ -107,7 +107,8 @@
     var text = search.value;
 
     // 13 = enter
-    if (kd && (e.keyCode == 13)) {
+    if (!kd && (e.keyCode == 13)) {
+        document.getElementById("search_filtered_div").className = "no-display";
         if (gSelectedIndex >= 0) {
             window.location = toroot + gMatches[gSelectedIndex].link;
             return false;
@@ -145,6 +146,7 @@
             }
         }
         sync_selection_table(toroot);
+        return true; // allow the event to bubble up to the search api
     }
 }