Index: misc/collapse.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/collapse.js,v
retrieving revision 1.6
diff -u -r1.6 collapse.js
--- misc/collapse.js	14 Apr 2006 13:48:56 -0000	1.6
+++ misc/collapse.js	29 Aug 2006 08:12:12 -0000
@@ -16,26 +16,30 @@
       continue;
     }
     legend = legend[0];
-    var a = document.createElement('a');
-    a.href = '#';
-    a.onclick = function() {
-      toggleClass(this.parentNode.parentNode, 'collapsed');
-      if (!hasClass(this.parentNode.parentNode, 'collapsed')) {
-        collapseScrollIntoView(this.parentNode.parentNode);
-        if (typeof textAreaAutoAttach != 'undefined') {
-          // Add the grippie to a textarea in a collapsed fieldset.
-          textAreaAutoAttach(null, this.parentNode.parentNode);
+    
+    if (legend.getElementsByTagName('a').length == 0) {
+      var a = document.createElement('a');
+      a.href = '#';
+      a.onclick = function() {
+        toggleClass(this.parentNode.parentNode, 'collapsed');
+        if (!hasClass(this.parentNode.parentNode, 'collapsed')) {
+          collapseScrollIntoView(this.parentNode.parentNode);
+          if (typeof textAreaAutoAttach != 'undefined') {
+            // Add the grippie to a textarea in a collapsed fieldset.
+            textAreaAutoAttach(null, this.parentNode.parentNode);
+          }
         }
+        this.blur();
+        return false;
       }
-      this.blur();
-      return false;
-    };
-    a.innerHTML = legend.innerHTML;
-    while (legend.hasChildNodes()) {
-      removeNode(legend.childNodes[0]);
+
+      a.innerHTML = legend.innerHTML;
+      while (legend.hasChildNodes()) {
+        removeNode(legend.childNodes[0]);
+      }
+      legend.appendChild(a);
+      collapseEnsureErrorsVisible(fieldset);
     }
-    legend.appendChild(a);
-    collapseEnsureErrorsVisible(fieldset);
   }
 }
 
