diff --git a/core/includes/common.inc b/core/includes/common.inc
index 5a146a8..8e5edf8 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -3965,7 +3965,7 @@ function drupal_region_class($region) {
  *     to 'file'.
  *   - scope: The location in which you want to place the script. Possible
  *     values are 'header' or 'footer'. If your theme implements different
- *     regions, you can also use these. Defaults to 'header'.
+ *     regions, you can also use these. Defaults to 'footer'.
  *   - group: A number identifying the group in which to add the JavaScript.
  *     Available constants are:
  *     - JS_LIBRARY: Any libraries, settings, or jQuery plugins.
@@ -4032,6 +4032,8 @@ function drupal_region_class($region) {
  *   including Drupal defaults, anything previously added with calls to
  *   drupal_add_js(), and this function call's additions.
  *
+ * @todo Update tests in common.test.
+ *
  * @see drupal_get_js()
  */
 function drupal_add_js($data = NULL, $options = NULL) {
@@ -4070,7 +4072,7 @@ function drupal_add_js($data = NULL, $options = NULL) {
             array('pathPrefix' => empty($prefix) ? '' : $prefix),
           ),
           'type' => 'setting',
-          'scope' => 'header',
+          'scope' => 'footer',
           'group' => JS_SETTING,
           'every_page' => TRUE,
           'weight' => 0,
@@ -4079,7 +4081,7 @@ function drupal_add_js($data = NULL, $options = NULL) {
         'core/misc/drupal.js' => array(
           'data' => 'core/misc/drupal.js',
           'type' => 'file',
-          'scope' => 'header',
+          'scope' => 'footer',
           'group' => JS_LIBRARY,
           'every_page' => TRUE,
           'weight' => -1,
@@ -4097,7 +4099,7 @@ function drupal_add_js($data = NULL, $options = NULL) {
 
     switch ($options['type']) {
       case 'setting':
-        // All JavaScript settings are placed in the header of the page with
+        // All JavaScript settings are placed in the footer of the page with
         // the library weight so that inline scripts appear afterwards.
         $javascript['settings']['data'][] = $data;
         break;
@@ -4130,7 +4132,7 @@ function drupal_js_defaults($data = NULL) {
     'group' => JS_DEFAULT,
     'every_page' => FALSE,
     'weight' => 0,
-    'scope' => 'header',
+    'scope' => 'footer',
     'cache' => TRUE,
     'defer' => FALSE,
     'preprocess' => TRUE,
@@ -4157,7 +4159,7 @@ function drupal_js_defaults($data = NULL) {
  *
  * @param $scope
  *   (optional) The scope for which the JavaScript rules should be returned.
- *   Defaults to 'header'.
+ *   Defaults to 'footer'.
  * @param $javascript
  *   (optional) An array with all JavaScript code. Defaults to the default
  *   JavaScript array for the given scope.
@@ -4173,7 +4175,7 @@ function drupal_js_defaults($data = NULL) {
  * @see locale_js_alter()
  * @see drupal_js_defaults()
  */
-function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALSE) {
+function drupal_get_js($scope = 'footer', $javascript = NULL, $skip_alter = FALSE) {
   if (!isset($javascript)) {
     $javascript = drupal_add_js();
   }
@@ -4203,13 +4205,13 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
   unset($setting['ajaxPageState']['js']['settings']);
   drupal_add_js($setting, 'setting');
 
-  // If we're outputting the header scope, then this might be the final time
+  // If we're outputting the footer scope, then this might be the final time
   // that drupal_get_js() is running, so add the setting to this output as well
   // as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
   // because drupal_get_js() was intentionally passed a $javascript argument
   // stripped of settings, potentially in order to override how settings get
   // output, so in this case, do not add the setting to this output.
-  if ($scope == 'header' && isset($items['settings'])) {
+  if ($scope == 'footer' && isset($items['settings'])) {
     $items['settings']['data'][] = $setting;
   }
 
diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index d044f06..7bfcafe 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2644,14 +2644,14 @@ function template_process_html(&$variables) {
   // Render page_top and page_bottom into top level variables.
   $variables['page_top'] = drupal_render($variables['page']['page_top']);
   $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
+  $variables['page_bottom'] .= drupal_get_js();
   // Place the rendered HTML for the page body into a top level variable.
-  $variables['page']              = $variables['page']['#children'];
-  $variables['page_bottom'] .= drupal_get_js('footer');
+  $variables['page'] = $variables['page']['#children'];
 
   $variables['head']    = drupal_get_html_head();
   $variables['css']     = drupal_add_css();
   $variables['styles']  = drupal_get_css();
-  $variables['scripts'] = drupal_get_js();
+  $variables['scripts'] = drupal_get_js('header');
 }
 
 /**
diff --git a/core/modules/overlay/overlay.module b/core/modules/overlay/overlay.module
index 58dcbab..20802da 100644
--- a/core/modules/overlay/overlay.module
+++ b/core/modules/overlay/overlay.module
@@ -553,7 +553,7 @@ function overlay_page_delivery_callback_alter(&$callback) {
  * the scripts and styles necessary in order to trigger the overlay to close.
  */
 function overlay_deliver_empty_page() {
-  $empty_page = '<html><head><title></title>' . drupal_get_css() . drupal_get_js() . '</head><body class="overlay"></body></html>';
+  $empty_page = '<html><head><title></title>' . drupal_get_css() . '</head><body class="overlay">' . drupal_get_js() . '</body></html>';
   print $empty_page;
   drupal_exit();
 }
