Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.225
diff -u -p -r1.225 form.inc
--- includes/form.inc	14 Sep 2007 10:40:55 -0000	1.225
+++ includes/form.inc	17 Sep 2007 18:23:15 -0000
@@ -812,7 +812,9 @@ function _form_builder_handle_input_elem
     array_unshift($form['#parents'], $name);
   }
   if (!isset($form['#id'])) {
-    $form['#id'] = form_clean_id('edit-'. implode('-', $form['#parents']));
+    // Add the form id into the element ID, so we are unlikely to collide
+    // with elements from other forms.
+    $form['#id'] = form_clean_id('edit-'. $form_id .'-'. implode('-', $form['#parents']));
   }
 
   unset($edit);
@@ -1962,7 +1964,8 @@ function _form_set_class(&$element, $cla
 }
 
 /**
- * Remove invalid characters from an HTML ID attribute string.
+ * Prepare an HTML ID attribute string by removing invalid characters and
+ * guaranteeing uniqueness.
  *
  * @param $id
  *   The ID to clean.
@@ -1970,8 +1973,19 @@ function _form_set_class(&$element, $cla
  *   The cleaned ID.
  */
 function form_clean_id($id = NULL) {
+  static $seen_ids = array(); //Maintain list of seen IDs.
   $id = str_replace(array('][', '_', ' '), '-', $id);
-  return $id;
+  //In order to guarantee uniqueness, we must check to see if we have seen
+  //this ID before. The first time we see an ID, we leave it alone. Subsequent
+  //sightings get a number appended to the end.
+  $unique = $id;
+  while(isset($seen_ids[$unique])) {
+    $seen_ids[$id]++;
+    $unique = $id.'-'.$seen_ids[$id];
+  }
+  //Track every single ID we return, so we're never tricked into issuing dupes.
+  $seen_ids[$unique] = 0;
+  return $unique;
 }
 
 /**
Index: modules/book/book.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.module,v
retrieving revision 1.442
diff -u -p -r1.442 book.module
--- modules/book/book.module	11 Sep 2007 17:35:58 -0000	1.442
+++ modules/book/book.module	17 Sep 2007 18:23:15 -0000
@@ -308,6 +308,7 @@ function book_form_alter(&$form, $form_s
       _book_add_form_elements($form, $node);
       $form['book']['pick-book'] = array(
         '#type' => 'submit',
+        '#id' => form_clean_id('edit-book-pick-book'),
         '#value' => t('Change book (update list of parents)'),
          // Submit the node form so the parent select options get updated.
          // This is typically only used when JS is disabled.  Since the parent options
@@ -432,6 +433,7 @@ function _book_add_form_elements(&$form,
     '#access' => (bool)$options,
     '#description' => t('Your page will be a part of the selected book.'),
     '#weight' => -5,
+    '#id' => form_clean_id("edit-book-bid"),
     '#attributes' => array('class' => 'book-title-select'),
   );
 }
Index: modules/color/color.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/color/color.js,v
retrieving revision 1.6
diff -u -p -r1.6 color.js
--- modules/color/color.js	12 Sep 2007 18:29:32 -0000	1.6
+++ modules/color/color.js	17 Sep 2007 18:23:15 -0000
@@ -40,7 +40,7 @@ Drupal.behaviors.color = function (conte
   }
 
   // Set up colorscheme selector
-  $('#edit-scheme', form).change(function () {
+  $('#edit-system-theme-settings-scheme', form).change(function () {
     var colors = this.options[this.selectedIndex].value;
     if (colors != '') {
       colors = colors.split(',');
@@ -173,7 +173,7 @@ Drupal.behaviors.color = function (conte
    * Reset the color scheme selector.
    */
   function resetScheme() {
-    $('#edit-scheme', form).each(function () {
+    $('#edit-system-theme-settings-scheme', form).each(function () {
       this.selectedIndex = this.options.length - 1;
     });
   }
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.2
diff -u -p -r1.2 node.pages.inc
--- modules/node/node.pages.inc	9 Sep 2007 19:52:29 -0000	1.2
+++ modules/node/node.pages.inc	17 Sep 2007 18:23:15 -0000
@@ -234,8 +234,6 @@ function node_body_field(&$node, $label,
   $form['teaser_js'] = array(
     '#type' => 'textarea',
     '#rows' => 10,
-    '#teaser' => 'edit-body',
-    '#teaser_checkbox' => 'edit-teaser-include',
     '#disabled' => TRUE);
 
   $form['teaser_include'] = array(
@@ -253,6 +251,9 @@ function node_body_field(&$node, $label,
     '#rows' => 20,
     '#required' => ($word_count > 0));
 
+  $form['teaser_js']['#teaser'] = &$form['body']['#id'];
+  $form['teaser_js']['#teaser_checkbox'] = &$form['teaser_include']['#id'];
+
   $form['format'] = filter_form($node->format);
 
   return $form;
Index: modules/user/user.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.js,v
retrieving revision 1.6
diff -u -p -r1.6 user.js
--- modules/user/user.js	12 Sep 2007 18:29:32 -0000	1.6
+++ modules/user/user.js	17 Sep 2007 18:23:15 -0000
@@ -172,7 +172,7 @@ Drupal.evaluatePasswordStrength = functi
  */
 Drupal.setDefaultTimezone = function() {
   var offset = new Date().getTimezoneOffset() * -60;
-  $("#edit-date-default-timezone, #edit-user-register-timezone").val(offset);
+  $("#edit-system-date-time-settings-date-default-timezone, #edit-user-register-timezone").val(offset);
 };
 
 /**
