Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1247
diff -u -p -r1.1247 common.inc
--- includes/common.inc	28 Oct 2010 02:00:27 -0000	1.1247
+++ includes/common.inc	17 Jan 2011 09:49:08 -0000
@@ -3742,10 +3744,10 @@ function drupal_region_class($region) {
  * Calling drupal_static_reset('drupal_add_js') will clear all JavaScript added
  * so far.
  *
- * If JavaScript aggregation is enabled, all JavaScript files added with
- * $options['preprocess'] set to TRUE will be merged into one aggregate file.
- * Preprocessed inline JavaScript will not be aggregated into this single file.
- * Externally hosted JavaScripts are never aggregated.
+ * If JavaScript aggregation is enabled, all JavaScript files of the same scope
+ * added with $options['preprocess'] set to TRUE will be merged into one
+ * aggregate file. Preprocessed inline JavaScript will not be aggregated into
+ * this single file. Externally hosted JavaScripts are never aggregated.
  *
  * The reason for aggregating the files is outlined quite thoroughly here:
  * http://www.die.net/musings/page_load_time/ "Load fewer external objects. Due
@@ -3782,7 +3784,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.
@@ -3846,6 +3848,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) {
@@ -3879,7 +3883,7 @@ function drupal_add_js($data = NULL, $op
             array('basePath' => base_path()),
           ),
           'type' => 'setting',
-          'scope' => 'header',
+          'scope' => 'footer',
           'group' => JS_LIBRARY,
           'every_page' => TRUE,
           'weight' => 0,
@@ -3887,7 +3891,7 @@ function drupal_add_js($data = NULL, $op
         'misc/drupal.js' => array(
           'data' => 'misc/drupal.js',
           'type' => 'file',
-          'scope' => 'header',
+          'scope' => 'footer',
           'group' => JS_LIBRARY,
           'every_page' => TRUE,
           'weight' => -1,
@@ -3935,7 +3939,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,
@@ -3961,7 +3965,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.
@@ -3975,7 +3979,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();
   }
@@ -4031,13 +4035,13 @@ function drupal_get_js($scope = 'header'
   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 off 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;
   }
 
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.622
diff -u -p -r1.622 theme.inc
--- includes/theme.inc	30 Oct 2010 03:57:20 -0000	1.622
+++ includes/theme.inc	17 Jan 2011 09:49:14 -0000
@@ -2308,12 +2308,12 @@ function template_process_html(&$variabl
   $variables['page_bottom'] = drupal_render($variables['page']['page_bottom']);
   // 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_bottom'] .= drupal_get_js();
 
   $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');
 }
 
 /**
@@ -2481,6 +2481,7 @@ function template_process_maintenance_pa
   $variables['head']    = drupal_get_html_head();
   $variables['css']     = drupal_add_css();
   $variables['styles']  = drupal_get_css();
+  // @todo maintenance-page.tpl.php should either use html.tpl.php, or handle both drupal_get_js() and drupal_get_js('header').
   $variables['scripts'] = drupal_get_js();
 }
 
Index: modules/overlay/overlay.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay.module,v
retrieving revision 1.31
diff -u -p -r1.31 overlay.module
--- modules/overlay/overlay.module	31 Aug 2010 15:04:09 -0000	1.31
+++ modules/overlay/overlay.module	17 Jan 2011 09:49:45 -0000
@@ -402,7 +402,7 @@ function overlay_page_delivery_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();
 }
