Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.537.2.14
diff -u -F^f -r1.537.2.14 common.inc
--- includes/common.inc	18 Oct 2006 20:14:42 -0000	1.537.2.14
+++ includes/common.inc	24 Oct 2006 19:25:18 -0000
@@ -116,7 +116,7 @@ function drupal_set_html_head($data = NU
 function drupal_get_html_head() {
   $output = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
   $output .= theme('stylesheet_import', base_path() .'misc/drupal.css');
-  return $output . drupal_set_html_head();
+  return $output . drupal_get_js() . drupal_set_html_head();
 }
 
 /**
@@ -1221,24 +1221,145 @@ function drupal_add_link($attributes) {
 }
 
 /**
- * Add a JavaScript file to the output.
+ * Add a JavaScript file, setting or inline code to the page.
  *
- * The first time this function is invoked per page request,
- * it adds "misc/drupal.js" to the output. Other scripts
- * depends on the 'killswitch' inside it.
- */
-function drupal_add_js($file, $nocache = FALSE) {
-  static $sent = array();
-
-  $postfix = $nocache ? '?'. time() : '';
-  if (!isset($sent['misc/drupal.js'])) {
-    drupal_set_html_head('<script type="text/javascript" src="'. base_path() .'misc/drupal.js'. $postfix .'"></script>');
-    $sent['misc/drupal.js'] = true;
-  }
-  if (!isset($sent[$file])) {
-    drupal_set_html_head('<script type="text/javascript" src="'. check_url(base_path() . $file) . $postfix .'"></script>');
-    $sent[$file] = true;
+ * The behavior of this function depends on the parameters it is called with.
+ * Generally, it handles the addition of JavaScript to the page, either as
+ * reference to an existing file or as inline code. The following actions can be
+ * performed using this function:
+ *
+ * - Add a file ('core', 'module' and 'theme'):
+ *   Adds a reference to a JavaScript file to the page. JavaScript files
+ *   are placed in a certain order, from 'core' first, to 'module' and finally
+ *   'theme' so that files, that are added later, can override previously added
+ *   files with ease.
+ *
+ * - Add inline JavaScript code ('inline'):
+ *   Executes a piece of JavaScript code on the current page by placing the code
+ *   directly in the page. This can, for example, be useful to tell the user that
+ *   a new message arrived, by opening a pop up, alert box etc.
+ *
+ * - Add settings ('setting'):
+ *   Adds a setting to Drupal's global storage of JavaScript settings. Per-page
+ *   settings are required by some modules to function properly. The settings
+ *   will be accessible at Drupal.settings.
+ *
+ * @param $data
+ *   (optional) If given, the value depends on the $type parameter:
+ *   - 'core', 'module' or 'theme': Path to the file relative to base_path().
+ *   - 'inline': The JavaScript code that should be placed in the given scope.
+ *   - 'setting': An array with configuration options as associative array. The
+ *       array is directly placed in Drupal.settings. You might want to wrap your
+ *       actual configuration settings in another variable to prevent the pollution
+ *       of the Drupal.settings namespace.
+ * @param $type
+ *   (optional) The type of JavaScript that should be added to the page. Allowed
+ *   values are 'core', 'module', 'theme', 'inline' and 'setting'. You
+ *   can, however, specify any value. It is treated as a reference to a JavaScript
+ *   file. Defaults to 'module'.
+ * @param $scope
+ *   (optional) The location in which you want to place the script. Possible
+ *   values are 'header' and 'footer' by default. If your theme implements
+ *   different locations, however, you can also use these.
+ * @param $defer
+ *   (optional) If set to TRUE, the defer attribute is set on the <script> tag.
+ *   Defaults to FALSE. This parameter is not used with $type == 'setting'.
+ * @param $cache
+ *   (optional) If set to FALSE, the JavaScript file is loaded anew on every page
+ *   call, that means, it is not cached. Defaults to TRUE. Used only when $type
+ *   references a JavaScript file.
+ * @return
+ *   If the first parameter is NULL, the JavaScript array that has been built so
+ *   far for $scope is returned.
+ */
+function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer = FALSE, $cache = TRUE) {
+  static $settings_include;
+  
+  if (!is_null($data)) {
+    _drupal_add_js('misc/jquery.js', 'core', 'header', FALSE, $cache);
+    _drupal_add_js('misc/drupal.js', 'core', 'header', FALSE, $cache);
+
+    if (!$settings_include) {
+     _drupal_add_js(array('basePath' => base_path()), 'setting', 'header', false, true);
+     $settings_include = true; 
+    }
+  }
+  
+  return _drupal_add_js($data, $type, $scope, $defer, $cache);
+}
+
+/**
+ * Helper function for drupal_add_js().
+ */
+function _drupal_add_js($data, $type, $scope, $defer, $cache) {
+  static $javascript = array();
+
+  if (!isset($javascript[$scope])) {
+    $javascript[$scope] = array('core' => array(), 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array());
+  }
+
+  if (!isset($javascript[$scope][$type])) {
+    $javascript[$scope][$type] = array();
+  }
+
+  if (!is_null($data)) {
+    switch ($type) {
+      case 'setting':
+        $javascript[$scope][$type][] = $data;
+        break;
+      case 'inline':
+        $javascript[$scope][$type][] = array('code' => $data, 'defer' => $defer);
+        break;
+      default:
+        $javascript[$scope][$type][$data] = array('cache' => $cache, 'defer' => $defer);
+    }
   }
+
+  return $javascript[$scope];
+}
+
+/**
+ * Returns a themed presentation of all JavaScript code for the current page.
+ * References to JavaScript files are placed in a certain order: first, all
+ * 'core' files, then all 'module' and finally all 'theme' JavaScript files
+ * are added to the page. Then, all settings are output, followed by 'inline'
+ * JavaScript code.
+ *
+ * @parameter $scope
+ *   (optional) The scope for which the JavaScript rules should be returned.
+ *   Defaults to 'header'.
+ * @parameter $javascript
+ *   (optional) An array with all JavaScript code. Defaults to the default
+ *   JavaScript array for the given scope.
+ * @return
+ *   All JavaScript code segments and includes for the scope as HTML tags.
+ */
+function drupal_get_js($scope = 'header', $javascript = NULL) {
+  $output = '';
+  if (is_null($javascript)) {
+    $javascript = drupal_add_js(NULL, NULL, $scope);
+  }
+
+  foreach ($javascript as $type => $data) {
+    if (!$data) continue;
+
+    switch ($type) {
+      case 'setting':
+        $output .= '<script type="text/javascript">Drupal.extend({ settings: '. drupal_to_js(call_user_func_array('array_merge_recursive', $data)) ." });</script>\n";
+        break;
+      case 'inline':
+        foreach ($data as $info) {
+          $output .= '<script type="text/javascript"'. ($info['defer'] ? ' defer="defer"' : '') .'>'. $info['code'] ."</script>\n";
+        }
+        break;
+      default:
+        foreach ($data as $path => $info) {
+          $output .= '<script type="text/javascript"'. ($info['defer'] ? ' defer="defer"' : '') .' src="'. check_url(base_path() . $path) . ($info['cache'] ? '' : '?'. time()) ."\"></script>\n";
+        }
+    }
+  }
+
+  return $output;
 }
 
 /**
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.292.2.7
diff -u -F^f -r1.292.2.7 theme.inc
--- includes/theme.inc	5 Sep 2006 10:22:24 -0000	1.292.2.7
+++ includes/theme.inc	24 Oct 2006 19:25:19 -0000
@@ -919,7 +919,7 @@ function theme_feed_icon($url) {
  */
 function theme_closure($main = 0) {
   $footer = module_invoke_all('footer', $main);
-  return implode("\n", $footer);
+  return implode("\n", $footer) . drupal_get_js('footer');
 }
 
 /**
Index: misc/autocomplete.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/autocomplete.js,v
retrieving revision 1.11
diff -u -F^f -r1.11 autocomplete.js
--- misc/autocomplete.js	17 Apr 2006 20:48:25 -0000	1.11
+++ misc/autocomplete.js	24 Oct 2006 19:25:20 -0000
@@ -1,76 +1,51 @@
-// $Id: autocomplete.js,v 1.11 2006/04/17 20:48:25 dries Exp $
-
-// Global Killswitch
-if (isJsEnabled()) {
-  addLoadEvent(autocompleteAutoAttach);
-}
+// $Id: autocomplete.js,v 1.14 2006/10/14 02:39:48 unconed Exp $
 
 /**
  * Attaches the autocomplete behaviour to all required fields
  */
-function autocompleteAutoAttach() {
+Drupal.autocompleteAutoAttach = function () {
   var acdb = [];
-  var inputs = document.getElementsByTagName('input');
-  for (i = 0; input = inputs[i]; i++) {
-    if (input && hasClass(input, 'autocomplete')) {
-      uri = input.value;
-      if (!acdb[uri]) {
-        acdb[uri] = new ACDB(uri);
-      }
-      input = $(input.id.substr(0, input.id.length - 13));
-      input.setAttribute('autocomplete', 'OFF');
-      addSubmitEvent(input.form, autocompleteSubmit);
-      new jsAC(input, acdb[uri]);
+  $('input.autocomplete').each(function () {
+    var uri = this.value;
+    if (!acdb[uri]) {
+      acdb[uri] = new Drupal.ACDB(uri);
     }
-  }
+    var input = $('#' + this.id.substr(0, this.id.length - 13))
+      .attr('autocomplete', 'OFF')[0];
+    $(input.form).submit(Drupal.autocompleteSubmit);
+    new Drupal.jsAC(input, acdb[uri]);
+  });
 }
 
 /**
  * Prevents the form from submitting if the suggestions popup is open
+ * and closes the suggestions popup when doing so.
  */
-function autocompleteSubmit() {
-  var popup = document.getElementById('autocomplete');
-  if (popup) {
-    popup.owner.hidePopup();
-    return false;
-  }
-  return true;
+Drupal.autocompleteSubmit = function () {
+  return $('#autocomplete').each(function () {
+    this.owner.hidePopup();
+  }).size() == 0;
 }
 
-
 /**
  * An AutoComplete object
  */
-function jsAC(input, db) {
+Drupal.jsAC = function (input, db) {
   var ac = this;
   this.input = input;
   this.db = db;
-  this.input.onkeydown = function (event) { return ac.onkeydown(this, event); };
-  this.input.onkeyup = function (event) { ac.onkeyup(this, event) };
-  this.input.onblur = function () { ac.hidePopup(); ac.db.cancel(); };
-  this.popup = document.createElement('div');
-  this.popup.id = 'autocomplete';
-  this.popup.owner = this;
-};
 
-/**
- * Hides the autocomplete suggestions
- */
-jsAC.prototype.hidePopup = function (keycode) {
-  if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
-    this.input.value = this.selected.autocompleteValue;
-  }
-  if (this.popup.parentNode && this.popup.parentNode.tagName) {
-    removeNode(this.popup);
-  }
-  this.selected = false;
-}
+  $(this.input)
+    .keydown(function (event) { return ac.onkeydown(this, event); })
+    .keyup(function (event) { ac.onkeyup(this, event) })
+    .blur(function () { ac.hidePopup(); ac.db.cancel(); });
 
+};
 
 /**
  * Handler for the "keydown" event
  */
-jsAC.prototype.onkeydown = function (input, e) {
+Drupal.jsAC.prototype.onkeydown = function (input, e) {
   if (!e) {
     e = window.event;
   }
@@ -89,7 +64,7 @@ function jsAC(input, db) {
 /**
  * Handler for the "keyup" event
  */
-jsAC.prototype.onkeyup = function (input, e) {
+Drupal.jsAC.prototype.onkeyup = function (input, e) {
   if (!e) {
     e = window.event;
   }
@@ -126,21 +101,21 @@ function jsAC(input, db) {
 /**
  * Puts the currently highlighted suggestion into the autocomplete field
  */
-jsAC.prototype.select = function (node) {
+Drupal.jsAC.prototype.select = function (node) {
   this.input.value = node.autocompleteValue;
 }
 
 /**
  * Highlights the next suggestion
  */
-jsAC.prototype.selectDown = function () {
+Drupal.jsAC.prototype.selectDown = function () {
   if (this.selected && this.selected.nextSibling) {
     this.highlight(this.selected.nextSibling);
   }
   else {
-    var lis = this.popup.getElementsByTagName('li');
-    if (lis.length > 0) {
-      this.highlight(lis[0]);
+    var lis = $('li', this.popup);
+    if (lis.size() > 0) {
+      this.highlight(lis.get(0));
     }
   }
 }
@@ -148,7 +123,7 @@ function jsAC(input, db) {
 /**
  * Highlights the previous suggestion
  */
-jsAC.prototype.selectUp = function () {
+Drupal.jsAC.prototype.selectUp = function () {
   if (this.selected && this.selected.previousSibling) {
     this.highlight(this.selected.previousSibling);
   }
@@ -157,30 +132,61 @@ function jsAC(input, db) {
 /**
  * Highlights a suggestion
  */
-jsAC.prototype.highlight = function (node) {
-  removeClass(this.selected, 'selected');
-  addClass(node, 'selected');
+Drupal.jsAC.prototype.highlight = function (node) {
+  if (this.selected) {
+    $(this.selected).removeClass('selected');
+  }
+  $(node).addClass('selected');
   this.selected = node;
 }
 
 /**
  * Unhighlights a suggestion
  */
-jsAC.prototype.unhighlight = function (node) {
-  removeClass(node, 'selected');
+Drupal.jsAC.prototype.unhighlight = function (node) {
+  $(node).removeClass('selected');
+  this.selected = false;
+}
+
+/**
+ * Hides the autocomplete suggestions
+ */
+Drupal.jsAC.prototype.hidePopup = function (keycode) {
+  // Select item if the right key or mousebutton was pressed
+  if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
+    this.input.value = this.selected.autocompleteValue;
+  }
+  // Hide popup
+  var popup = this.popup;
+  if (popup) {
+    this.popup = null;
+    $(popup).fadeOut('fast', function() { $(popup).remove(); });
+  }
   this.selected = false;
 }
 
 /**
  * Positions the suggestions popup and starts a search
  */
-jsAC.prototype.populatePopup = function () {
-  var ac = this;
-  var pos = absolutePosition(this.input);
+Drupal.jsAC.prototype.populatePopup = function () {
+  // Show popup
+  if (this.popup) {
+    $(this.popup).remove();
+  }
+  var pos = Drupal.absolutePosition(this.input);
   this.selected = false;
-  this.popup.style.top   = (pos.y + this.input.offsetHeight) +'px';
-  this.popup.style.left  = pos.x +'px';
-  this.popup.style.width = (this.input.offsetWidth - 4) +'px';
+  this.popup = document.createElement('div');
+  this.popup.id = 'autocomplete';
+  this.popup.owner = this;
+  $(this.popup).css({
+    top: (pos.y + this.input.offsetHeight) +'px',
+    left: pos.x +'px',
+    width: (this.input.offsetWidth - 4) +'px',
+    display: 'none'
+  });
+  $('body').append(this.popup);
+
+  // Do search
   this.db.owner = this;
   this.db.search(this.input.value);
 }
@@ -188,41 +194,48 @@ function jsAC(input, db) {
 /**
  * Fills the suggestion popup with any matches received
  */
-jsAC.prototype.found = function (matches) {
-  while (this.popup.hasChildNodes()) {
-    this.popup.removeChild(this.popup.childNodes[0]);
-  }
-  if (!this.popup.parentNode || !this.popup.parentNode.tagName) {
-    document.getElementsByTagName('body')[0].appendChild(this.popup);
-  }
+Drupal.jsAC.prototype.found = function (matches) {
+  // Prepare matches
   var ul = document.createElement('ul');
   var ac = this;
-
   for (key in matches) {
     var li = document.createElement('li');
-    var div = document.createElement('div');
-    div.innerHTML = matches[key];
-    li.appendChild(div);
+    $(li)
+      .html('<div>'+ matches[key] +'</div>')
+      .mousedown(function () { ac.select(this); })
+      .mouseover(function () { ac.highlight(this); })
+      .mouseout(function () { ac.unhighlight(this); });
     li.autocompleteValue = key;
-    li.onmousedown = function() { ac.select(this); };
-    li.onmouseover = function() { ac.highlight(this); };
-    li.onmouseout  = function() { ac.unhighlight(this); };
-    ul.appendChild(li);
+    $(ul).append(li);
   }
 
+  // Show popup with matches, if any
   if (ul.childNodes.length > 0) {
-    this.popup.appendChild(ul);
+    $(this.popup).empty().append(ul).show();
   }
   else {
+    $(this.popup).css({visibility: 'hidden'});
     this.hidePopup();
   }
-  removeClass(this.input, 'throbbing');
+}
+
+Drupal.jsAC.prototype.setStatus = function (status) {
+  switch (status) {
+    case 'begin':
+      $(this.input).addClass('throbbing');
+      break;
+    case 'cancel':
+    case 'error':
+    case 'found':
+      $(this.input).removeClass('throbbing');
+      break;
+  }
 }
 
 /**
  * An AutoComplete DataBase object
  */
-function ACDB(uri) {
+Drupal.ACDB = function (uri) {
   this.uri = uri;
   this.delay = 300;
   this.cache = {};
@@ -231,46 +244,55 @@ function ACDB(uri) {
 /**
  * Performs a cached and delayed search
  */
-ACDB.prototype.search = function(searchString) {
+Drupal.ACDB.prototype.search = function (searchString) {
+  var db = this;
   this.searchString = searchString;
+
+  // See if this key has been searched for before
   if (this.cache[searchString]) {
     return this.owner.found(this.cache[searchString]);
   }
+
+  // Initiate delayed search
   if (this.timer) {
     clearTimeout(this.timer);
   }
-  var db = this;
   this.timer = setTimeout(function() {
-    addClass(db.owner.input, 'throbbing');
-    db.transport = HTTPGet(db.uri +'/'+ encodeURIComponent(searchString), db.receive, db);
-  }, this.delay);
-}
+    db.owner.setStatus('begin');
 
-/**
- * HTTP callback function. Passes suggestions to the autocomplete object
- */
-ACDB.prototype.receive = function(string, xmlhttp, acdb) {
-  // Note: Safari returns 'undefined' status if the request returns no data.
-  if (xmlhttp.status != 200 && typeof xmlhttp.status != 'undefined') {
-    removeClass(acdb.owner.input, 'throbbing');
-    return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ acdb.uri);
-  }
-  // Parse back result
-  var matches = parseJson(string);
-  if (typeof matches['status'] == 'undefined' || matches['status'] != 0) {
-    acdb.cache[acdb.searchString] = matches;
-    acdb.owner.found(matches);
-  }
+    // Ajax GET request for autocompletion
+    $.ajax({
+      type: "GET",
+      url: db.uri +'/'+ Drupal.encodeURIComponent(searchString),
+      success: function (data) {
+        // Parse back result
+        var matches = Drupal.parseJson(data);
+        if (typeof matches['status'] == 'undefined' || matches['status'] != 0) {
+          db.cache[searchString] = matches;
+          // Verify if these are still the matches the user wants to see
+          if (db.searchString == searchString) {
+            db.owner.found(matches);
+          }
+          db.owner.setStatus('found');
+        }
+      },
+      error: function (xmlhttp) {
+        alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ db.uri);
+      }
+    });
+  }, this.delay);
 }
 
 /**
  * Cancels the current autocomplete request
  */
-ACDB.prototype.cancel = function() {
-  if (this.owner) removeClass(this.owner.input, 'throbbing');
+Drupal.ACDB.prototype.cancel = function() {
+  if (this.owner) this.owner.setStatus('cancel');
   if (this.timer) clearTimeout(this.timer);
-  if (this.transport) {
-    this.transport.onreadystatechange = function() {};
-    this.transport.abort();
-  }
+  this.searchString = '';
+}
+
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.autocompleteAutoAttach);
 }
Index: misc/collapse.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/collapse.js,v
retrieving revision 1.6
diff -u -F^f -r1.6 collapse.js
--- misc/collapse.js	14 Apr 2006 13:48:56 -0000	1.6
+++ misc/collapse.js	24 Oct 2006 19:25:20 -0000
@@ -1,70 +1,100 @@
-// $Id: collapse.js,v 1.6 2006/04/14 13:48:56 killes Exp $
+// $Id: collapse.js,v 1.7 2006/08/31 23:31:24 unconed Exp $
 
-if (isJsEnabled()) {
-  addLoadEvent(collapseAutoAttach);
-}
-
-function collapseAutoAttach() {
-  var fieldsets = document.getElementsByTagName('fieldset');
-  var legend, fieldset;
-  for (var i = 0; fieldset = fieldsets[i]; i++) {
-    if (!hasClass(fieldset, 'collapsible')) {
-      continue;
-    }
-    legend = fieldset.getElementsByTagName('legend');
-    if (legend.length == 0) {
-      continue;
-    }
-    legend = legend[0];
+Drupal.collapseAutoAttach = function () {
+  $('fieldset.collapsible legend').each(function () {
+    // Turn the legend into clickable link
     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);
+    $(a)
+      .click(function() {
+        var fieldset = this.parentNode.parentNode;
+
+        // Prevent double animations
+        if (fieldset.animating) {
+          return false;
+        }
+        fieldset.animating = true;
+
+        if ($(fieldset).is('.collapsed')) {
+          // Open fieldset with animation
+          $(fieldset.contentWrapper).hide();
+          $(fieldset).removeClass('collapsed');
+          $(fieldset.contentWrapper).slideDown(300,
+            {
+              // Make sure we open to height auto
+              complete: function() {
+                $(fieldset.contentWrapper).css('height', 'auto');
+                Drupal.collapseScrollIntoView(fieldset);
+                fieldset.animating = false;
+              },
+              // Scroll the fieldset into view
+              step: function() {
+                Drupal.collapseScrollIntoView(fieldset);
+              }
+            }
+          );
+          if (typeof Drupal.textareaAttach != 'undefined') {
+            // Initialize resizable textareas that are now revealed
+            Drupal.textareaAttach(null, fieldset);
+          }
+        }
+        else {
+          // Collapse fieldset with animation (reverse of opening)
+          $(fieldset.contentWrapper)
+            .slideUp('medium', function () { $(fieldset).addClass('collapsed'); fieldset.animating = false; } )
+            .show();
         }
-      }
-      this.blur();
-      return false;
-    };
-    a.innerHTML = legend.innerHTML;
-    while (legend.hasChildNodes()) {
-      removeNode(legend.childNodes[0]);
+        this.blur();
+        return false;
+      })
+      .html(this.innerHTML);
+    $(this)
+      .empty()
+      .append(a);
+
+    // Wrap fieldsets contents (except for the legend) into wrapper divs for animating.
+    // div1 is used to avoid margin problems inside fieldsets,
+    // div2 is the one that is actually animated.
+    var div1 = document.createElement('div');
+    var div2 = document.createElement('div');
+    this.parentNode.contentWrapper = div2;
+    $(this).after(div1);
+    $(div1).append(div2);
+    var el = div1.nextSibling;
+    while (el != null) {
+      var next = el.nextSibling;
+      $(el).remove();
+      $(div2).append(el);
+      el = next;
     }
-    legend.appendChild(a);
-    collapseEnsureErrorsVisible(fieldset);
-  }
-}
+    // Avoid jumping around due to margins collapsing into fieldset border
+    $(div1).css('overflow', 'hidden');
 
-function collapseEnsureErrorsVisible(fieldset) {
-  if (!hasClass(fieldset, 'collapsed')) {
-    return;
-  }
-  var inputs = [];
-  inputs = inputs.concat(fieldset.getElementsByTagName('input'));
-  inputs = inputs.concat(fieldset.getElementsByTagName('textarea'));
-  inputs = inputs.concat(fieldset.getElementsByTagName('select'));
-  for (var j = 0; j<3; j++) {
-    for (var i = 0; i < inputs[j].length; i++) {
-      if (hasClass(inputs[j][i], 'error')) {
-        return removeClass(fieldset, 'collapsed');
-      }
+    // Expand if there are errors inside
+    if ($('input.error, textarea.error, select.error', this.parentNode).size() > 0) {
+      $(this.parentNode).removeClass('collapsed');
     }
-  }
+  });
 }
 
-function collapseScrollIntoView(node) {
+/**
+ * Scroll a given fieldset into view as much as possible.
+ */
+Drupal.collapseScrollIntoView = function (node) {
   var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
   var offset = self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
-  var pos = absolutePosition(node);
-  if (pos.y + node.scrollHeight > h + offset) {
-    if (node.scrollHeight > h) {
+  var pos = Drupal.absolutePosition(node);
+  var fudge = 55;
+  if (pos.y + node.offsetHeight + fudge > h + offset) {
+    if (node.offsetHeight > h) {
       window.scrollTo(0, pos.y);
     } else {
-      window.scrollTo(0, pos.y + node.scrollHeight - h);
+      window.scrollTo(0, pos.y + node.offsetHeight - h + fudge);
     }
   }
 }
+
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.collapseAutoAttach);
+}
Index: misc/drupal.css
===================================================================
RCS file: /cvs/drupal/drupal/misc/Attic/drupal.css,v
retrieving revision 1.147.2.3
diff -u -F^f -r1.147.2.3 drupal.css
--- misc/drupal.css	30 Jun 2006 00:13:45 -0000	1.147.2.3
+++ misc/drupal.css	24 Oct 2006 19:25:20 -0000
@@ -603,28 +603,6 @@ form {
 }
 
 /*
-** Progressbar styles
-*/
-.progress {
-  font-weight: bold;
-}
-.progress .bar {
-  background: #fff url(progress.gif);
-  border: 1px solid #00375a;
-  height: 1.5em;
-  margin-top: 0.2em;
-}
-.progress .filled {
-  background: #0072b9;
-  height: 1em;
-  border-bottom: 0.5em solid #004a73;
-  width: 0%;
-}
-.progress .percentage {
-  float: right;
-}
-
-/*
 ** Collapsing fieldsets
 */
 html.js fieldset.collapsed {
@@ -632,24 +610,29 @@ form {
   border-left-width: 0;
   border-right-width: 0;
   margin-bottom: 0;
+  height: 1em;
 }
 html.js fieldset.collapsed * {
   display: none;
 }
-html.js fieldset.collapsed table *,
-html.js fieldset.collapsed legend,
-html.js fieldset.collapsed legend * {
-  display: inline;
+html.js fieldset.collapsed legend {
+  display: block;
 }
 html.js fieldset.collapsible legend a {
   padding-left: 15px;
-  background: url(menu-expanded.png) 5px 50% no-repeat;
+  background: url(menu-expanded.png) 5px 75% no-repeat;
 }
 html.js fieldset.collapsed legend a {
   background-image: url(menu-collapsed.png);
+  background-position: 5px 50%;
 }
 /* Note: IE-only fix due to '* html' (breaks Konqueror otherwise). */
-* html.js fieldset.collapsible legend a {
+* html.js fieldset.collapsed legend,
+* html.js fieldset.collapsed legend *,
+* html.js fieldset.collapsed table * {
+  display: inline;
+}
+html.js fieldset.collapsible legend a {
   display: block;
 }
 
@@ -666,6 +649,32 @@ form {
   border-top-width: 0;
   cursor: s-resize;
 }
+html.js .resizable-textarea textarea {
+  margin-bottom: 0;
+  width: 100%;
+}
+
+/*
+** Progressbar styles
+*/
+.progress {
+  font-weight: bold;
+}
+.progress .bar {
+  background: #fff url(progress.gif);
+  border: 1px solid #00375a;
+  height: 1.5em;
+  margin-top: 0.2em;
+}
+.progress .filled {
+  background: #0072b9;
+  height: 1em;
+  border-bottom: 0.5em solid #004a73;
+  width: 0%;
+}
+.progress .percentage {
+  float: right;
+}
 
 /*
 ** Formatting for welcome page
Index: misc/drupal.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/drupal.js,v
retrieving revision 1.22.2.2
diff -u -F^f -r1.22.2.2 drupal.js
--- misc/drupal.js	19 Aug 2006 19:55:20 -0000	1.22.2.2
+++ misc/drupal.js	24 Oct 2006 19:25:20 -0000
@@ -1,127 +1,44 @@
-// $Id: drupal.js,v 1.22.2.2 2006/08/19 19:55:20 killes Exp $
+// $Id: drupal.js,v 1.29 2006/10/14 02:39:48 unconed Exp $
 
-/**
- * Only enable Javascript functionality if all required features are supported.
- */
-function isJsEnabled() {
-  if (typeof document.jsEnabled == 'undefined') {
-    // Note: ! casts to boolean implicitly.
-    document.jsEnabled = !(
-     !document.getElementsByTagName ||
-     !document.createElement        ||
-     !document.createTextNode       ||
-     !document.documentElement      ||
-     !document.getElementById);
-  }
-  return document.jsEnabled;
-}
-
-// Global Killswitch on the <html> element
-if (isJsEnabled()) {
-  document.documentElement.className = 'js';
-}
+var Drupal = Drupal || {};
 
 /**
- * Make IE's XMLHTTP object accessible through XMLHttpRequest()
+ * Set the variable that indicates if JavaScript behaviors should be applied
  */
-if (typeof XMLHttpRequest == 'undefined') {
-  XMLHttpRequest = function () {
-    var msxmls = ['MSXML3', 'MSXML2', 'Microsoft']
-    for (var i=0; i < msxmls.length; i++) {
-      try {
-        return new ActiveXObject(msxmls[i]+'.XMLHTTP')
-      }
-      catch (e) { }
-    }
-    throw new Error("No XML component installed!");
-  }
-}
+Drupal.jsEnabled = document.getElementsByTagName && document.createElement && document.createTextNode && document.documentElement && document.getElementById;
 
 /**
- * Creates an HTTP GET request and sends the response to the callback function.
- *
- * Note that dynamic arguments in the URI should be escaped with encodeURIComponent().
+ * Extends the current object with the parameter. Works recursively.
  */
-function HTTPGet(uri, callbackFunction, callbackParameter) {
-  var xmlHttp = new XMLHttpRequest();
-  var bAsync = true;
-  if (!callbackFunction) {
-    bAsync = false;
-  }
-
-  xmlHttp.open('GET', uri, bAsync);
-  xmlHttp.send(null);
-
-  if (bAsync) {
-    xmlHttp.onreadystatechange = function() {
-      if (xmlHttp.readyState == 4) {
-        callbackFunction(xmlHttp.responseText, xmlHttp, callbackParameter);
-      }
-    }
-    return xmlHttp;
-  }
-  else {
-    return xmlHttp.responseText;
-  }
-}
-
-/**
- * Creates an HTTP POST request and sends the response to the callback function
- *
- * Note: passing null or undefined for 'object' makes the request fail in Opera 8.
- *       Pass an empty string instead.
- */
-function HTTPPost(uri, callbackFunction, callbackParameter, object) {
-  var xmlHttp = new XMLHttpRequest();
-  var bAsync = true;
-  if (!callbackFunction) {
-    bAsync = false;
-  }
-  xmlHttp.open('POST', uri, bAsync);
-
-  var toSend = '';
-  if (typeof object == 'object') {
-    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
-    for (var i in object) {
-      toSend += (toSend ? '&' : '') + i + '=' + encodeURIComponent(object[i]);
+Drupal.extend = function(obj) {
+  for (var i in obj) {
+    if (this[i]) {
+      Drupal.extend.apply(this[i], [obj[i]]);
     }
-  }
-  else {
-    toSend = object;
-  }
-  xmlHttp.send(toSend);
-
-  if (bAsync) {
-    xmlHttp.onreadystatechange = function() {
-      if (xmlHttp.readyState == 4) {
-        callbackFunction(xmlHttp.responseText, xmlHttp, callbackParameter);
-      }
+    else {
+      this[i] = obj[i];
     }
-    return xmlHttp;
   }
-  else {
-    return xmlHttp.responseText;
-  }
-}
+};
 
 /**
  * Redirects a button's form submission to a hidden iframe and displays the result
  * in a given wrapper. The iframe should contain a call to
  * window.parent.iframeHandler() after submission.
  */
-function redirectFormButton(uri, button, handler) {
-  // (Re)create an iframe to target.
-  createIframe();
-
+Drupal.redirectFormButton = function (uri, button, handler) {
   // Trap the button
   button.onmouseover = button.onfocus = function() {
     button.onclick = function() {
+      // Create target iframe
+      Drupal.createIframe();
+
       // Prepare variables for use in anonymous function.
       var button = this;
       var action = button.form.action;
       var target = button.form.target;
 
-      // Redirect form submission
+      // Redirect form submission to iframe
       this.form.action = uri;
       this.form.target = 'redirect-target';
 
@@ -129,7 +46,7 @@ function redirectFormButton(uri, button,
 
       // Set iframe handler for later
       window.iframeHandler = function () {
-        var iframe = $('redirect-target');
+        var iframe = $('#redirect-target').get(0);
         // Restore form submission
         button.form.action = action;
         button.form.target = target;
@@ -148,16 +65,15 @@ function redirectFormButton(uri, button,
           response = null;
         }
 
-        $('redirect-target').onload = null;
-        $('redirect-target').src = 'about:blank';
-
-        response = parseJson(response);
+        response = Drupal.parseJson(response);
         // Check response code
         if (response.status == 0) {
           handler.onerror(response.data);
           return;
         }
         handler.oncomplete(response.data);
+
+        return true;
       }
 
       return true;
@@ -166,43 +82,12 @@ function redirectFormButton(uri, button,
   button.onmouseout = button.onblur = function() {
     button.onclick = null;
   }
-}
-
-/**
- * Adds a function to the window onload event
- */
-function addLoadEvent(func) {
-  var oldOnload = window.onload;
-  if (typeof window.onload != 'function') {
-    window.onload = func;
-  }
-  else {
-    window.onload = function() {
-      oldOnload();
-      func();
-    }
-  }
-}
-
-/**
- * Adds a function to a given form's submit event
- */
-function addSubmitEvent(form, func) {
-  var oldSubmit = form.onsubmit;
-  if (typeof oldSubmit != 'function') {
-    form.onsubmit = func;
-  }
-  else {
-    form.onsubmit = function() {
-      return oldSubmit() && func();
-    }
-  }
-}
+};
 
 /**
  * Retrieves the absolute position of an element on the screen
  */
-function absolutePosition(el) {
+Drupal.absolutePosition = function (el) {
   var sLeft = 0, sTop = 0;
   var isDiv = /^div$/i.test(el.tagName);
   if (isDiv && el.scrollLeft) {
@@ -213,152 +98,109 @@ function absolutePosition(el) {
   }
   var r = { x: el.offsetLeft - sLeft, y: el.offsetTop - sTop };
   if (el.offsetParent) {
-    var tmp = absolutePosition(el.offsetParent);
+    var tmp = Drupal.absolutePosition(el.offsetParent);
     r.x += tmp.x;
     r.y += tmp.y;
   }
   return r;
 };
 
-function dimensions(el) {
-  return { width: el.offsetWidth, height: el.offsetHeight };
-}
-
 /**
- * Returns true if an element has a specified class name
+ * Return the dimensions of an element on the screen
  */
-function hasClass(node, className) {
-  if (node.className == className) {
-    return true;
-  }
-  var reg = new RegExp('(^| )'+ className +'($| )')
-  if (reg.test(node.className)) {
-    return true;
-  }
-  return false;
-}
-
-/**
- * Adds a class name to an element
- */
-function addClass(node, className) {
-  if (hasClass(node, className)) {
-    return false;
-  }
-  node.className += ' '+ className;
-  return true;
-}
-
-/**
- * Removes a class name from an element
- */
-function removeClass(node, className) {
-  if (!hasClass(node, className)) {
-    return false;
-  }
-  // Replaces words surrounded with whitespace or at a string border with a space. Prevents multiple class names from being glued together.
-  node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
-  return true;
-}
-
-/**
- * Toggles a class name on or off for an element
- */
-function toggleClass(node, className) {
-  if (!removeClass(node, className) && !addClass(node, className)) {
-    return false;
-  }
-  return true;
-}
-
-/**
- * Emulate PHP's ereg_replace function in javascript
- */
-function eregReplace(search, replace, subject) {
-  return subject.replace(new RegExp(search,'g'), replace);
-}
-
-/**
- * Removes an element from the page
- */
-function removeNode(node) {
-  if (typeof node == 'string') {
-    node = $(node);
-  }
-  if (node && node.parentNode) {
-    return node.parentNode.removeChild(node);
-  }
-  else {
-    return false;
-  }
-}
+Drupal.dimensions = function (el) {
+  return { width: el.offsetWidth, height: el.offsetHeight };
+};
 
 /**
- * Prevents an event from propagating.
+ *  Returns the position of the mouse cursor based on the event object passed
  */
-function stopEvent(event) {
-  if (event.preventDefault) {
-    event.preventDefault();
-    event.stopPropagation();
-  }
-  else {
-    event.returnValue = false;
-    event.cancelBubble = true;
-  }
-}
+Drupal.mousePosition = function(e) {
+  return { x: e.clientX + document.documentElement.scrollLeft, y: e.clientY + document.documentElement.scrollTop };
+};
 
 /**
  * Parse a JSON response.
  *
  * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
  */
-function parseJson(data) {
-  if (data.substring(0,1) != '{') {
+Drupal.parseJson = function (data) {
+  if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
     return { status: 0, data: data.length ? data : 'Unspecified error' };
   }
   return eval('(' + data + ');');
-}
+};
 
 /**
  * Create an invisible iframe for form submissions.
  */
-function createIframe() {
-  // Delete any previous iframe
-  deleteIframe();
+Drupal.createIframe = function () {
+  if ($('#redirect-holder').size()) {
+    return;
+  }
   // Note: some browsers require the literal name/id attributes on the tag,
   // some want them set through JS. We do both.
   window.iframeHandler = function () {};
   var div = document.createElement('div');
   div.id = 'redirect-holder';
-  div.innerHTML = '<iframe name="redirect-target" id="redirect-target" class="redirect" onload="window.iframeHandler();"></iframe>';
+  $(div).html('<iframe name="redirect-target" id="redirect-target" class="redirect" onload="window.iframeHandler();"></iframe>');
   var iframe = div.firstChild;
-  with (iframe) {
-    name = 'redirect-target';
-    setAttribute('name', 'redirect-target');
-    id = 'redirect-target';
-  }
-  with (iframe.style) {
-    position = 'absolute';
-    height = '1px';
-    width = '1px';
-    visibility = 'hidden';
-  }
-  document.body.appendChild(div);
-}
+  $(iframe)
+    .attr({
+      name: 'redirect-target',
+      id: 'redirect-target'
+    })
+    .css({
+      position: 'absolute',
+      height: '1px',
+      width: '1px',
+      visibility: 'hidden'
+    });
+  $('body').append(div);
+};
 
 /**
- * Delete the invisible iframe for form submissions.
+ * Delete the invisible iframe
  */
-function deleteIframe() {
-  var holder = $('redirect-holder');
-  if (holder != null) {
-    removeNode(holder);
-  }
-}
+Drupal.deleteIframe = function () {
+  $('#redirect-holder').remove();
+};
+
+/**
+ * Freeze the current body height (as minimum height). Used to prevent
+ * unnecessary upwards scrolling when doing DOM manipulations.
+ */
+Drupal.freezeHeight = function () {
+  Drupal.unfreezeHeight();
+  var div = document.createElement('div');
+  $(div).css({
+    position: 'absolute',
+    top: '0px',
+    left: '0px',
+    width: '1px',
+    height: $('body').css('height')
+  }).attr('id', 'freeze-height');
+  $('body').append(div);
+};
+
+/**
+ * Unfreeze the body height
+ */
+Drupal.unfreezeHeight = function () {
+  $('#freeze-height').remove();
+};
 
 /**
- * Wrapper around document.getElementById().
+ * Wrapper to address the mod_rewrite url encoding bug
+ * (equivalent of drupal_urlencode() in PHP).
  */
-function $(id) {
-  return document.getElementById(id);
+Drupal.encodeURIComponent = function (item, uri) {
+  uri = uri || location.href;
+  item = encodeURIComponent(item).replace('%2F', '/');
+  return uri.indexOf('?q=') ? item : item.replace('%26', '%2526').replace('%23', '%2523');
+};
+
+// Global Killswitch on the <html> element
+if (Drupal.jsEnabled) {
+  document.documentElement.className = 'js';
 }
Index: misc/jquery.js
===================================================================
RCS file: misc/jquery.js
diff -N misc/jquery.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/jquery.js	24 Oct 2006 19:25:21 -0000
@@ -0,0 +1,2 @@
+// $Id: jquery.js,v 1.4 2006/10/23 19:51:35 unconed Exp $
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('l(1X 1P.6=="Q"){1P.Q=1P.Q;u 6=q(a,c){l(a&&1X a=="q"&&6.C.1V)v 6(17).1V(a);a=a||6.1l||17;l(a.3C)v 6(6.1T(a,[]));l(c&&c.3C)v 6(c).1U(a);l(1P==7)v 1h 6(a,c);l(a.N==1y){u m=/^[^<]*(<.+>)[^>]*$/.3b(a);l(m)a=6.3q([m[1]])}7.1m(a.N==2B||a.D&&!a.1Y&&a[0]!=Q&&a[0].1Y?6.1T(a,[]):6.1U(a,c));u C=1a[1a.D-1];l(C&&1X C=="q")7.T(C);v 7};l(1X $!="Q")6.44$=$;u $=6;6.C=6.8c={3C:"1.0.2",5I:q(){v 7.D},1m:q(29){l(29&&29.N==2B){7.D=0;[].1o.15(7,29);v 7}H v 29==Q?6.1T(7,[]):7[29]},T:q(C,1g){v 6.T(7,C,1g)},8h:q(12){u 2f=-1;7.T(q(i){l(7==12)2f=i});v 2f},1r:q(1N,Y,B){v 1N.N!=1y||Y!=Q?7.T(q(){l(Y==Q)I(u E 1s 1N)6.1r(B?7.1b:7,E,1N[E]);H 6.1r(B?7.1b:7,1N,Y)}):6[B||"1r"](7[0],1N)},1f:q(1N,Y){v 7.1r(1N,Y,"28")},2z:q(e){e=e||7;u t="";I(u j=0;j<e.D;j++){u r=e[j].2r;I(u i=0;i<r.D;i++)l(r[i].1Y!=8)t+=r[i].1Y!=1?r[i].4X:6.C.2z([r[i]])}v t},1Q:q(){u a=6.3q(1a);v 7.T(q(){u b=a[0].3c(R);7.1n.2O(b,7);20(b.23)b=b.23;b.3L(7)})},5g:q(){v 7.2R(1a,R,1,q(a){7.3L(a)})},5h:q(){v 7.2R(1a,R,-1,q(a){7.2O(a,7.23)})},5i:q(){v 7.2R(1a,U,1,q(a){7.1n.2O(a,7)})},4F:q(){v 7.2R(1a,U,-1,q(a){7.1n.2O(a,7.8k)})},4r:q(){v 7.1m(7.30.8l())},1U:q(t){v 7.2h(6.2w(7,q(a){v 6.1U(t,a)}),1a)},4g:q(4C){v 7.2h(6.2w(7,q(a){v a.3c(4C!=Q?4C:R)}),1a)},19:q(t){v 7.2h(t.N==2B&&6.2w(7,q(a){I(u i=0;i<t.D;i++)l(6.19(t[i],[a]).r.D)v a;v U})||t.N==8m&&(t?7.1m():[])||1X t=="q"&&6.2G(7,t)||6.19(t,7).r,1a)},2q:q(t){v 7.2h(t.N==1y?6.19(t,7,U).r:6.2G(7,q(a){v a!=t}),1a)},21:q(t){v 7.2h(6.1T(7,t.N==1y?6.1U(t):t.N==2B?t:[t]),1a)},4B:q(2t){v 2t?6.19(2t,7).r.D>0:U},2R:q(1g,2a,2Y,C){u 4g=7.5I()>1;u a=6.3q(1g);v 7.T(q(){u 12=7;l(2a&&7.2D.2b()=="8n"&&a[0].2D.2b()!="62"){u 25=7.4Q("25");l(!25.D){12=17.5O("25");7.3L(12)}H 12=25[0]}I(u i=(2Y<0?a.D-1:0);i!=(2Y<0?2Y:a.D);i+=2Y){C.15(12,[4g?a[i].3c(R):a[i]])}})},2h:q(a,1g){u C=1g&&1g[1g.D-1];u 2g=1g&&1g[1g.D-2];l(C&&C.N!=1w)C=O;l(2g&&2g.N!=1w)2g=O;l(!C){l(!7.30)7.30=[];7.30.1o(7.1m());7.1m(a)}H{u 1W=7.1m();7.1m(a);l(2g&&a.D||!2g)7.T(2g||C).1m(1W);H 7.1m(1W).T(C)}v 7}};6.1I=6.C.1I=q(12,E){l(1a.D>1&&(E===O||E==Q))v 12;l(!E){E=12;12=7}I(u i 1s E)12[i]=E[i];v 12};6.1I({5A:q(){6.65=R;6.T(6.2c.5q,q(i,n){6.C[i]=q(a){u K=6.2w(7,n);l(a&&a.N==1y)K=6.19(a,K).r;v 7.2h(K,1a)}});6.T(6.2c.2o,q(i,n){6.C[i]=q(){u a=1a;v 7.T(q(){I(u j=0;j<a.D;j++)6(a[j])[n](7)})}});6.T(6.2c.T,q(i,n){6.C[i]=q(){v 7.T(n,1a)}});6.T(6.2c.19,q(i,n){6.C[n]=q(29,C){v 7.19(":"+n+"("+29+")",C)}});6.T(6.2c.1r,q(i,n){n=n||i;6.C[i]=q(h){v h==Q?7.D?7[0][n]:O:7.1r(n,h)}});6.T(6.2c.1f,q(i,n){6.C[n]=q(h){v h==Q?(7.D?6.1f(7[0],n):O):7.1f(n,h)}})},T:q(12,C,1g){l(12.D==Q)I(u i 1s 12)C.15(12[i],1g||[i,12[i]]);H I(u i=0;i<12.D;i++)l(C.15(12[i],1g||[i,12[i]])===U)45;v 12},1i:{21:q(o,c){l(6.1i.3t(o,c))v;o.1i+=(o.1i?" ":"")+c},24:q(o,c){l(!c){o.1i=""}H{u 2J=o.1i.3d(" ");I(u i=0;i<2J.D;i++){l(2J[i]==c){2J.67(i,1);45}}o.1i=2J.60(\' \')}},3t:q(e,a){l(e.1i!=Q)e=e.1i;v 1h 43("(^|\\\\s)"+a+"(\\\\s|$)").26(e)}},4x:q(e,o,f){I(u i 1s o){e.1b["1W"+i]=e.1b[i];e.1b[i]=o[i]}f.15(e,[]);I(u i 1s o)e.1b[i]=e.1b["1W"+i]},1f:q(e,p){l(p=="1D"||p=="2k"){u 1W={},3E,3D,d=["68","6O","69","7d"];I(u i 1s d){1W["6b"+d[i]]=0;1W["6c"+d[i]+"6e"]=0}6.4x(e,1W,q(){l(6.1f(e,"1u")!="22"){3E=e.6f;3D=e.6g}H{e=6(e.3c(R)).1U(":3W").5t("2I").4r().1f({3U:"1R",2Q:"6i",1u:"2U",6j:"0",5k:"0"}).5f(e.1n)[0];u 2F=6.1f(e.1n,"2Q");l(2F==""||2F=="3R")e.1n.1b.2Q="6k";3E=e.6l;3D=e.6m;l(2F==""||2F=="3R")e.1n.1b.2Q="3R";e.1n.3r(e)}});v p=="1D"?3E:3D}v 6.28(e,p)},28:q(F,E,4G){u K;l(E==\'1j\'&&6.18.1t)v 6.1r(F.1b,\'1j\');l(E=="3I"||E=="2n")E=6.18.1t?"35":"2n";l(!4G&&F.1b[E]){K=F.1b[E]}H l(F.31){u 61=E.1A(/\\-(\\w)/g,q(m,c){v c.2b()});K=F.31[E]||F.31[61]}H l(17.3e&&17.3e.4u){l(E=="2n"||E=="35")E="3I";E=E.1A(/([A-Z])/g,"-$1").3P();u 1k=17.3e.4u(F,O);l(1k)K=1k.5N(E);H l(E==\'1u\')K=\'22\';H 6.4x(F,{1u:\'2U\'},q(){K=17.3e.4u(7,O).5N(E)})}v K},3q:q(a){u r=[];I(u i=0;i<a.D;i++){u 1E=a[i];l(1E.N==1y){u s=6.2K(1E),2d=17.5O("2d"),1Q=[0,"",""];l(!s.1c("<6v"))1Q=[1,"<3B>","</3B>"];H l(!s.1c("<6w")||!s.1c("<25"))1Q=[1,"<2a>","</2a>"];H l(!s.1c("<4t"))1Q=[2,"<2a>","</2a>"];H l(!s.1c("<6x")||!s.1c("<6z"))1Q=[3,"<2a><25><4t>","</4t></25></2a>"];2d.2V=1Q[1]+s+1Q[2];20(1Q[0]--)2d=2d.23;1E=2d.2r}l(1E.D!=Q&&!1E.1Y)I(u n=0;n<1E.D;n++)r.1o(1E[n]);H r.1o(1E.1Y?1E:17.6A(1E.6C()))}v r},2t:{"":"m[2]== \'*\'||a.2D.2b()==m[2].2b()","#":"a.3a(\'3G\')&&a.3a(\'3G\')==m[2]",":":{5X:"i<m[3]-0",5n:"i>m[3]-0",5J:"m[3]-0==i",5l:"m[3]-0==i",2m:"i==0",1O:"i==r.D-1",51:"i%2==0",52:"i%2","5J-3w":"6.1x(a,m[3]).1k","2m-3w":"6.1x(a,0).1k","1O-3w":"6.1x(a,0).1O","6D-3w":"6.1x(a).D==1",5r:"a.2r.D",5z:"!a.2r.D",5p:"6.C.2z.15([a]).1c(m[3])>=0",6E:"a.B!=\'1R\'&&6.1f(a,\'1u\')!=\'22\'&&6.1f(a,\'3U\')!=\'1R\'",1R:"a.B==\'1R\'||6.1f(a,\'1u\')==\'22\'||6.1f(a,\'3U\')==\'1R\'",6F:"!a.2E",2E:"a.2E",2I:"a.2I",3V:"a.3V || 6.1r(a, \'3V\')",2z:"a.B==\'2z\'",3W:"a.B==\'3W\'",5w:"a.B==\'5w\'",3Q:"a.B==\'3Q\'",5u:"a.B==\'5u\'",4z:"a.B==\'4z\'",5x:"a.B==\'5x\'",4y:"a.B==\'4y\'",4D:"a.B==\'4D\'",5B:"a.2D.3P().4R(/5B|3B|6L|4D/)"},".":"6.1i.3t(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z && !z.1c(m[4])","$=":"z && z.2W(z.D - m[4].D,m[4].D)==m[4]","*=":"z && z.1c(m[4])>=0","":"z"},"[":"6.1U(m[2],a).D"},3z:["\\\\.\\\\.|/\\\\.\\\\.","a.1n",">|/","6.1x(a.23)","\\\\+","6.1x(a).3y","~",q(a){u r=[];u s=6.1x(a);l(s.n>0)I(u i=s.n;i<s.D;i++)r.1o(s[i]);v r}],1U:q(t,1l){l(1l&&1l.1Y==Q)1l=O;1l=1l||6.1l||17;l(t.N!=1y)v[t];l(!t.1c("//")){1l=1l.4O;t=t.2W(2,t.D)}H l(!t.1c("/")){1l=1l.4O;t=t.2W(1,t.D);l(t.1c("/")>=1)t=t.2W(t.1c("/"),t.D)}u K=[1l];u 1J=[];u 1O=O;20(t.D>0&&1O!=t){u r=[];1O=t;t=6.2K(t).1A(/^\\/\\//i,"");u 34=U;I(u i=0;i<6.3z.D;i+=2){l(34)4Z;u 2s=1h 43("^("+6.3z[i]+")");u m=2s.3b(t);l(m){r=K=6.2w(K,6.3z[i+1]);t=6.2K(t.1A(2s,""));34=R}}l(!34){l(!t.1c(",")||!t.1c("|")){l(K[0]==1l)K.4l();1J=6.1T(1J,K);r=K=[1l];t=" "+t.2W(1,t.D)}H{u 3Z=/^([#.]?)([a-4W-9\\\\*44-]*)/i;u m=3Z.3b(t);l(m[1]=="#"){u 4h=17.5W(m[2]);r=K=4h?[4h]:[];t=t.1A(3Z,"")}H{l(!m[2]||m[1]==".")m[2]="*";I(u i=0;i<K.D;i++)r=6.1T(r,m[2]=="*"?6.40(K[i]):K[i].4Q(m[2]))}}}l(t){u 1H=6.19(t,r);K=r=1H.r;t=6.2K(1H.t)}}l(K&&K[0]==1l)K.4l();1J=6.1T(1J,K);v 1J},40:q(o,r){r=r||[];u s=o.2r;I(u i=0;i<s.D;i++)l(s[i].1Y==1){r.1o(s[i]);6.40(s[i],r)}v r},1r:q(F,1e,Y){u 2l={"I":"7v","6P":"1i","3I":6.18.1t?"35":"2n",2n:6.18.1t?"35":"2n",2V:"2V",1i:"1i",Y:"Y",2E:"2E",2I:"2I",6R:"6S"};l(1e=="1j"&&6.18.1t&&Y!=Q){F[\'6U\']=1;l(Y==1)v F["19"]=F["19"].1A(/3g\\([^\\)]*\\)/5e,"");H v F["19"]=F["19"].1A(/3g\\([^\\)]*\\)/5e,"")+"3g(1j="+Y*4S+")"}H l(1e=="1j"&&6.18.1t){v F["19"]?4d(F["19"].4R(/3g\\(1j=(.*)\\)/)[1])/4S:1}l(1e=="1j"&&6.18.2H&&Y==1)Y=0.6W;l(2l[1e]){l(Y!=Q)F[2l[1e]]=Y;v F[2l[1e]]}H l(Y==Q&&6.18.1t&&F.2D&&F.2D.2b()==\'6X\'&&(1e==\'7f\'||1e==\'7e\')){v F.70(1e).4X}H l(F.3a!=Q&&F.7b){l(Y!=Q)F.72(1e,Y);v F.3a(1e)}H{1e=1e.1A(/-([a-z])/73,q(z,b){v b.2b()});l(Y!=Q)F[1e]=Y;v F[1e]}},4V:["\\\\[ *(@)S *([!*$^=]*) *(\'?\\"?)(.*?)\\\\4 *\\\\]","(\\\\[)\\s*(.*?)\\s*\\\\]","(:)S\\\\(\\"?\'?([^\\\\)]*?)\\"?\'?\\\\)","([:.#]*)S"],19:q(t,r,2q){u g=2q!==U?6.2G:q(a,f){v 6.2G(a,f,R)};20(t&&/^[a-z[({<*:.#]/i.26(t)){u p=6.4V;I(u i=0;i<p.D;i++){u 2s=1h 43("^"+p[i].1A("S","([a-z*44-][a-4W-76-]*)"),"i");u m=2s.3b(t);l(m){l(!i)m=["",m[1],m[3],m[2],m[5]];t=t.1A(2s,"");45}}l(m[1]==":"&&m[2]=="2q")r=6.19(m[3],r,U).r;H{u f=6.2t[m[1]];l(f.N!=1y)f=6.2t[m[1]][m[2]];3J("f = q(a,i){"+(m[1]=="@"?"z=6.1r(a,m[3]);":"")+"v "+f+"}");r=g(r,f)}}v{r:r,t:t}},2K:q(t){v t.1A(/^\\s+|\\s+$/g,"")},3K:q(F){u 47=[];u 1k=F.1n;20(1k&&1k!=17){47.1o(1k);1k=1k.1n}v 47},1x:q(F,2f,2q){u 14=[];l(F){u 2j=F.1n.2r;I(u i=0;i<2j.D;i++){l(2q===R&&2j[i]==F)4Z;l(2j[i].1Y==1)14.1o(2j[i]);l(2j[i]==F)14.n=14.D-1}}v 6.1I(14,{1O:14.n==14.D-1,1k:2f=="51"&&14.n%2==0||2f=="52"&&14.n%2||14[2f]==F,4m:14[14.n-1],3y:14[14.n+1]})},1T:q(2m,3f){u 1C=[];I(u k=0;k<2m.D;k++)1C[k]=2m[k];I(u i=0;i<3f.D;i++){u 49=R;I(u j=0;j<2m.D;j++)l(3f[i]==2m[j])49=U;l(49)1C.1o(3f[i])}v 1C},2G:q(14,C,4b){l(C.N==1y)C=1h 1w("a","i","v "+C);u 1C=[];I(u i=0;i<14.D;i++)l(!4b&&C(14[i],i)||4b&&!C(14[i],i))1C.1o(14[i]);v 1C},2w:q(14,C){l(C.N==1y)C=1h 1w("a","v "+C);u 1C=[];I(u i=0;i<14.D;i++){u 1H=C(14[i],i);l(1H!==O&&1H!=Q){l(1H.N!=2B)1H=[1H];1C=6.1T(1C,1H)}}v 1C},M:{21:q(V,B,1Z){l(6.18.1t&&V.42!=Q)V=1P;l(!1Z.2y)1Z.2y=7.2y++;l(!V.1G)V.1G={};u 2M=V.1G[B];l(!2M){2M=V.1G[B]={};l(V["2T"+B])2M[0]=V["2T"+B]}2M[1Z.2y]=1Z;V["2T"+B]=7.57;l(!7.1d[B])7.1d[B]=[];7.1d[B].1o(V)},2y:1,1d:{},24:q(V,B,1Z){l(V.1G)l(B&&V.1G[B])l(1Z)56 V.1G[B][1Z.2y];H I(u i 1s V.1G[B])56 V.1G[B][i];H I(u j 1s V.1G)7.24(V,j)},1L:q(B,J,V){J=J||[];l(!V){u g=7.1d[B];l(g)I(u i=0;i<g.D;i++)7.1L(B,J,g[i])}H l(V["2T"+B]){J.58(7.2l({B:B,7i:V}));V["2T"+B].15(V,J)}},57:q(M){l(1X 6=="Q")v U;M=M||6.M.2l(1P.M);l(!M)v U;u 3j=R;u c=7.1G[M.B];u 1g=[].7j.3N(1a,1);1g.58(M);I(u j 1s c){l(c[j].15(7,1g)===U){M.4q();M.5a();3j=U}}v 3j},2l:q(M){l(M){M.4q=q(){7.3j=U};M.5a=q(){7.7m=R}}v M}}});1h q(){u b=5G.5H.3P();6.18={33:/5c/.26(b),2Z:/2Z/.26(b),1t:/1t/.26(b)&&!/2Z/.26(b),2H:/2H/.26(b)&&!/(7n|5c)/.26(b)};6.7o=!6.18.1t||17.7p=="7q"};6.2c={2o:{5f:"5g",7r:"5h",2O:"5i",7s:"4F"},1f:"2k,1D,7t,5k,2Q,3I,32,7u,7x".3d(","),19:["5l","5X","5n","5p"],1r:{1H:"Y",38:"2V",3G:O,7z:O,1e:O,7A:O,3u:O,7B:O},5q:{5r:"a.1n",7C:6.3K,3K:6.3K,3y:"6.1x(a).3y",4m:"6.1x(a).4m",2j:"6.1x(a, O, R)",7E:"6.1x(a.23)"},T:{5t:q(1N){7.7F(1N)},1B:q(){7.1b.1u=7.2x?7.2x:"";l(6.1f(7,"1u")=="22")7.1b.1u="2U"},1q:q(){7.2x=7.2x||6.1f(7,"1u");l(7.2x=="22")7.2x="2U";7.1b.1u="22"},4p:q(){6(7)[6(7).4B(":1R")?"1B":"1q"].15(6(7),1a)},7G:q(c){6.1i.21(7,c)},7H:q(c){6.1i.24(7,c)},7I:q(c){6.1i[6.1i.3t(7,c)?"24":"21"](7,c)},24:q(a){l(!a||6.19(a,[7]).r)7.1n.3r(7)},5z:q(){20(7.23)7.3r(7.23)},37:q(B,C){l(C.N==1y)C=1h 1w("e",(!C.1c(".")?"6(7)":"v ")+C);6.M.21(7,B,C)},5R:q(B,C){6.M.24(7,B,C)},1L:q(B,J){6.M.1L(B,J,7)}}};6.5A();6.C.1I({5C:6.C.4p,4p:q(a,b){v a&&b&&a.N==1w&&b.N==1w?7.5L(q(e){7.1O=7.1O==a?b:a;e.4q();v 7.1O.15(7,[e])||U}):7.5C.15(7,1a)},7M:q(f,g){q 4s(e){u p=(e.B=="3A"?e.7N:e.7O)||e.7P;20(p&&p!=7)3v{p=p.1n}3m(e){p=7};l(p==7)v U;v(e.B=="3A"?f:g).15(7,[e])}v 7.3A(4s).5P(4s)},1V:q(f){l(6.3x)f.15(17);H{6.2A.1o(f)}v 7}});6.1I({3x:U,2A:[],1V:q(){l(!6.3x){6.3x=R;l(6.2A){I(u i=0;i<6.2A.D;i++)6.2A[i].15(17);6.2A=O}l(6.18.2H||6.18.2Z)17.7R("5T",6.1V,U)}}});1h q(){u e=("7S,7T,2S,7U,7V,4A,5L,7X,"+"80,81,83,3A,5P,86,4y,3B,"+"4z,87,88,89,2i").3d(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v f?7.37(o,f):7.1L(o)};6.C["8a"+o]=q(f){v 7.5R(o,f)};6.C["8b"+o]=q(f){v 7.T(q(){u 5S=0;6.M.21(7,o,q(e){l(5S++)v R;v f.15(7,[e])})})}};l(6.18.2H||6.18.2Z){17.8d("5T",6.1V,U)}H l(6.18.1t){17.8e("<8f"+"8g 3G=5Y 8o=R "+"3u=//:><\\/27>");u 27=17.5W("5Y");27.2C=q(){l(7.3l!="1z")v;7.1n.3r(7);6.1V()};27=O}H l(6.18.33){6.3M=42(q(){l(17.3l=="63"||17.3l=="1z"){54(6.3M);6.3M=O;6.1V()}},10)}6.M.21(1P,"2S",6.1V)};l(6.18.1t)6(1P).4A(q(){u M=6.M,1d=M.1d;I(u B 1s 1d){u 3O=1d[B],i=3O.D;l(i>0)6a l(B!=\'4A\')M.24(3O[i-1],B);20(--i)}});6.C.1I({5U:6.C.1B,1B:q(11,G){v 11?7.1S({1D:"1B",2k:"1B",1j:"1B"},11,G):7.5U()},5V:6.C.1q,1q:q(11,G){v 11?7.1S({1D:"1q",2k:"1q",1j:"1q"},11,G):7.5V()},6n:q(11,G){v 7.1S({1D:"1B"},11,G)},6o:q(11,G){v 7.1S({1D:"1q"},11,G)},6p:q(11,G){v 7.T(q(){u 4H=6(7).4B(":1R")?"1B":"1q";6(7).1S({1D:4H},11,G)})},6r:q(11,G){v 7.1S({1j:"1B"},11,G)},6s:q(11,G){v 7.1S({1j:"1q"},11,G)},6t:q(11,2o,G){v 7.1S({1j:2o},11,G)},1S:q(E,11,G){v 7.1v(q(){7.2N=6.1I({},E);I(u p 1s E){u e=1h 6.2L(7,6.11(11,G),p);l(E[p].N==4M)e.36(e.1k(),E[p]);H e[E[p]](E)}})},1v:q(B,C){l(!C){C=B;B="2L"}v 7.T(q(){l(!7.1v)7.1v={};l(!7.1v[B])7.1v[B]=[];7.1v[B].1o(C);l(7.1v[B].D==1)C.15(7)})}});6.1I({5d:q(e,p){l(e.5D)v;l(p=="1D"&&e.4J!=3k(6.28(e,p)))v;l(p=="2k"&&e.4K!=3k(6.28(e,p)))v;u a=e.1b[p];u o=6.28(e,p,1);l(p=="1D"&&e.4J!=o||p=="2k"&&e.4K!=o)v;e.1b[p]=e.31?"":"5F";u n=6.28(e,p,1);l(o!=n&&n!="5F"){e.1b[p]=a;e.5D=R}},11:q(s,o){o=o||{};l(o.N==1w)o={1z:o};u 5K={6G:6H,6J:4I};o.2X=(s&&s.N==4M?s:5K[s])||5m;o.3o=o.1z;o.1z=q(){6.4P(7,"2L");l(o.3o&&o.3o.N==1w)o.3o.15(7)};v o},1v:{},4P:q(F,B){B=B||"2L";l(F.1v&&F.1v[B]){F.1v[B].4l();u f=F.1v[B][0];l(f)f.15(F)}},2L:q(F,2p,E){u z=7;z.o={2X:2p.2X||5m,1z:2p.1z,2u:2p.2u};z.W=F;u y=z.W.1b;z.a=q(){l(2p.2u)2p.2u.15(F,[z.2e]);l(E=="1j")6.1r(y,"1j",z.2e);H l(3k(z.2e))y[E]=3k(z.2e)+"5b";y.1u="2U"};z.55=q(){v 4d(6.1f(z.W,E))};z.1k=q(){u r=4d(6.28(z.W,E));v r&&r>-6Z?r:z.55()};z.36=q(41,2o){z.4f=(1h 50()).53();z.2e=41;z.a();z.4a=42(q(){z.2u(41,2o)},13)};z.1B=q(){l(!z.W.1K)z.W.1K={};z.W.1K[E]=7.1k();z.36(0,z.W.1K[E]);l(E!="1j")y[E]="77"};z.1q=q(){l(!z.W.1K)z.W.1K={};z.W.1K[E]=7.1k();z.o.1q=R;z.36(z.W.1K[E],0)};l(!z.W.4c)z.W.4c=6.1f(z.W,"32");y.32="1R";z.2u=q(4j,4i){u t=(1h 50()).53();l(t>z.o.2X+z.4f){54(z.4a);z.4a=O;z.2e=4i;z.a();z.W.2N[E]=R;u 1J=R;I(u i 1s z.W.2N)l(z.W.2N[i]!==R)1J=U;l(1J){y.32=z.W.4c;l(z.o.1q)y.1u=\'22\';l(z.o.1q){I(u p 1s z.W.2N){l(p=="1j")6.1r(y,p,z.W.1K[p]);H y[p]=z.W.1K[p]+"5b";l(p==\'1D\'||p==\'2k\')6.5d(z.W,p)}}}l(1J&&z.o.1z&&z.o.1z.N==1w)z.o.1z.15(z.W)}H{u p=(t-7.4f)/z.o.2X;z.2e=((-5o.7w(p*5o.7y)/2)+0.5)*(4i-4j)+4j;z.a()}}}});6.C.1I({7D:q(L,1M,G){7.2S(L,1M,G,1)},2S:q(L,1M,G,1F){l(L.N==1w)v 7.37("2S",L);G=G||q(){};u B="3T";l(1M){l(1M.N==1w){G=1M;1M=O}H{1M=6.2P(1M);B="4U"}}u 4n=7;6.3H(B,L,1M,q(3s,16){l(16=="2v"||!1F&&16=="5j"){4n.38(3s.3F).3X().T(G,[3s.3F,16])}H G.15(4n,[3s.3F,16])},1F);v 7},7K:q(){v 6.2P(7)},3X:q(){v 7.1U(\'27\').T(q(){l(7.3u)6.5Z(7.3u,q(){});H 3J.3N(1P,7.2z||7.7L||7.2V||"")}).4r()}});l(6.18.1t&&1X 3h=="Q")3h=q(){v 1h 7Q(5G.5H.1c("7W 5")>=0?"82.5Q":"84.5Q")};1h q(){u e="5M,5E,5y,5v,5s".3d(",");I(u i=0;i<e.D;i++)1h q(){u o=e[i];6.C[o]=q(f){v 7.37(o,f)}}};6.1I({1m:q(L,J,G,B,1F){l(J&&J.N==1w){B=G;G=J;J=O}l(J)L+=((L.1c("?")>-1)?"&":"?")+6.2P(J);6.3H("3T",L,O,q(r,16){l(G)G(6.3p(r,B),16)},1F)},8i:q(L,J,G,B){6.1m(L,J,G,B,1)},5Z:q(L,G){l(G)6.1m(L,O,G,"27");H{6.1m(L,O,O,"27")}},64:q(L,J,G){l(G)6.1m(L,J,G,"3S");H{6.1m(L,J,"3S")}},7c:q(L,J,G,B){6.3H("4U",L,6.2P(J),q(r,16){l(G)G(6.3p(r,B),16)})},1p:0,6h:q(1p){6.1p=1p},39:{},3H:q(B,L,J,K,1F){u 1d=R;u 1p=6.1p;l(!L){K=B.1z;u 2v=B.2v;u 2i=B.2i;u 4k=B.4k;u 1d=1X B.1d=="6q"?B.1d:R;u 1p=1X B.1p=="6u"?B.1p:6.1p;1F=B.1F||U;J=B.J;L=B.L;B=B.B}l(1d&&!6.4v++)6.M.1L("5M");u 48=U;u P=1h 3h();P.6B(B||"3T",L,R);l(J)P.3i("6I-6K","6M/x-6N-6Q-6T");l(1F)P.3i("6V-3Y-6Y",6.39[L]||"71, 74 75 78 46:46:46 79");P.3i("X-7a-7g","3h");l(P.7h)P.3i("7k","7l");u 2C=q(4e){l(P&&(P.3l==4||4e=="1p")){48=R;u 16=6.4E(P)&&4e!="1p"?1F&&6.4L(P,L)?"5j":"2v":"2i";l(16!="2i"){u 3n;3v{3n=P.4w("4N-3Y")}3m(e){}l(1F&&3n)6.39[L]=3n;l(2v)2v(6.3p(P,4k),16);l(1d)6.M.1L("5s")}H{l(2i)2i(P,16);l(1d)6.M.1L("5v")}l(1d)6.M.1L("5y");l(1d&&!--6.4v)6.M.1L("5E");l(K)K(P,16);P.2C=q(){};P=O}};P.2C=2C;l(1p>0)7Y(q(){l(P){P.85();l(!48)2C("1p");P=O}},1p);P.8j(J)},4v:0,4E:q(r){3v{v!r.16&&66.6d=="3Q:"||(r.16>=4I&&r.16<6y)||r.16==59||6.18.33&&r.16==Q}3m(e){}v U},4L:q(P,L){3v{u 4T=P.4w("4N-3Y");v P.16==59||4T==6.39[L]||6.18.33&&P.16==Q}3m(e){}v U},3p:q(r,B){u 4o=r.4w("7J-B");u J=!B&&4o&&4o.1c("P")>=0;J=B=="P"||J?r.7Z:r.3F;l(B=="27")3J.3N(1P,J);l(B=="3S")3J("J = "+J);l(B=="38")$("<2d>").38(J).3X();v J},2P:q(a){u s=[];l(a.N==2B||a.3C){I(u i=0;i<a.D;i++)s.1o(a[i].1e+"="+4Y(a[i].Y))}H{I(u j 1s a)s.1o(j+"="+4Y(a[j]))}v s.60("&")}})}',62,521,'||||||jQuery|this||||||||||||||if|||||function||||var|return||||||type|fn|length|prop|elem|callback|else|for|data|ret|url|event|constructor|null|xml|undefined|true||each|false|element|el||value|||speed|obj||elems|apply|status|document|browser|filter|arguments|style|indexOf|global|name|css|args|new|className|opacity|cur|context|get|parentNode|push|timeout|hide|attr|in|msie|display|queue|Function|sibling|String|complete|replace|show|result|height|arg|ifModified|events|val|extend|done|orig|trigger|params|key|last|window|wrap|hidden|animate|merge|find|ready|old|typeof|nodeType|handler|while|add|none|firstChild|remove|tbody|test|script|curCSS|num|table|toUpperCase|macros|div|now|pos|fn2|pushStack|error|siblings|width|fix|first|cssFloat|to|options|not|childNodes|re|expr|step|success|map|oldblock|guid|text|readyList|Array|onreadystatechange|nodeName|disabled|parPos|grep|mozilla|checked|classes|trim|fx|handlers|curAnim|insertBefore|param|position|domManip|load|on|block|innerHTML|substr|duration|dir|opera|stack|currentStyle|overflow|safari|foundToken|styleFloat|custom|bind|html|lastModified|getAttribute|exec|cloneNode|split|defaultView|second|alpha|XMLHttpRequest|setRequestHeader|returnValue|parseInt|readyState|catch|modRes|oldComplete|httpData|clean|removeChild|res|has|src|try|child|isReady|next|token|mouseover|select|jquery|oWidth|oHeight|responseText|id|ajax|float|eval|parents|appendChild|safariTimer|call|els|toLowerCase|file|static|json|GET|visibility|selected|radio|evalScripts|Modified|re2|getAll|from|setInterval|RegExp|_|break|00|matched|requestDone|noCollision|timer|inv|oldOverflow|parseFloat|istimeout|startTime|clone|oid|lastNum|firstNum|dataType|shift|prev|self|ct|toggle|preventDefault|end|handleHover|tr|getComputedStyle|active|getResponseHeader|swap|reset|submit|unload|is|deep|button|httpSuccess|after|force|state|200|scrollHeight|scrollWidth|httpNotModified|Number|Last|documentElement|dequeue|getElementsByTagName|match|100|xmlRes|POST|parse|z0|nodeValue|encodeURIComponent|continue|Date|even|odd|getTime|clearInterval|max|delete|handle|unshift|304|stopPropagation|px|webkit|setAuto|gi|appendTo|append|prepend|before|notmodified|left|eq|400|gt|Math|contains|axis|parent|ajaxSuccess|removeAttr|password|ajaxError|checkbox|image|ajaxComplete|empty|init|input|_toggle|notAuto|ajaxStop|auto|navigator|userAgent|size|nth|ss|click|ajaxStart|getPropertyValue|createElement|mouseout|XMLHTTP|unbind|count|DOMContentLoaded|_show|_hide|getElementById|lt|__ie_init|getScript|join|newProp|THEAD|loaded|getJSON|initDone|location|splice|Top|Right|do|padding|border|protocol|Width|offsetHeight|offsetWidth|ajaxTimeout|absolute|right|relative|clientHeight|clientWidth|slideDown|slideUp|slideToggle|boolean|fadeIn|fadeOut|fadeTo|number|opt|thead|td|300|th|createTextNode|open|toString|only|visible|enabled|slow|600|Content|fast|Type|textarea|application|www|Bottom|class|form|readonly|readOnly|urlencoded|zoom|If|9999|FORM|Since|10000|getAttributeNode|Thu|setAttribute|ig|01|Jan|9_|1px|1970|GMT|Requested|tagName|post|Left|method|action|With|overrideMimeType|target|slice|Connection|close|cancelBubble|compatible|boxModel|compatMode|CSS1Compat|prependTo|insertAfter|top|color|htmlFor|cos|background|PI|title|href|rel|ancestors|loadIfModified|children|removeAttribute|addClass|removeClass|toggleClass|content|serialize|textContent|hover|fromElement|toElement|relatedTarget|ActiveXObject|removeEventListener|blur|focus|resize|scroll|MSIE|dblclick|setTimeout|responseXML|mousedown|mouseup|Microsoft|mousemove|Msxml2|abort|change|keydown|keypress|keyup|un|one|prototype|addEventListener|write|scr|ipt|index|getIfModified|send|nextSibling|pop|Boolean|TABLE|defer'.split('|'),0,{}))
Index: misc/progress.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/progress.js,v
retrieving revision 1.10
diff -u -F^f -r1.10 progress.js
--- misc/progress.js	28 Mar 2006 09:29:23 -0000	1.10
+++ misc/progress.js	24 Oct 2006 19:25:21 -0000
@@ -1,49 +1,39 @@
-// $Id: progress.js,v 1.10 2006/03/28 09:29:23 killes Exp $
+// $Id: progress.js,v 1.12 2006/10/14 02:39:48 unconed Exp $
 
 /**
  * A progressbar object. Initialized with the given id. Must be inserted into
  * the DOM afterwards through progressBar.element.
  *
  * method is the function which will perform the HTTP request to get the
- * progress bar state. Either HTTPGet or HTTPPost.
+ * progress bar state. Either "GET" or "POST".
  *
  * e.g. pb = new progressBar('myProgressBar');
  *      some_element.appendChild(pb.element);
  */
-function progressBar(id, updateCallback, method, errorCallback) {
+Drupal.progressBar = function (id, updateCallback, method, errorCallback) {
   var pb = this;
   this.id = id;
-  this.method = method ? method : HTTPGet;
+  this.method = method || "GET";
   this.updateCallback = updateCallback;
   this.errorCallback = errorCallback;
 
   this.element = document.createElement('div');
   this.element.id = id;
   this.element.className = 'progress';
-  this.element.innerHTML = '<div class="percentage"></div>'+
-                           '<div class="message">&nbsp;</div>'+
-                           '<div class="bar"><div class="filled"></div></div>';
+  $(this.element).html('<div class="percentage"></div>'+
+                       '<div class="message">&nbsp;</div>'+
+                       '<div class="bar"><div class="filled"></div></div>');
 }
 
 /**
  * Set the percentage and status message for the progressbar.
  */
-progressBar.prototype.setProgress = function (percentage, message) {
-  var divs = this.element.getElementsByTagName('div');
-  var div;
-  for (var i = 0; div = divs[i]; ++i) {
-    if (percentage >= 0) {
-      if (hasClass(divs[i], 'filled')) {
-        divs[i].style.width = percentage + '%';
-      }
-      if (hasClass(divs[i], 'percentage')) {
-        divs[i].innerHTML = percentage + '%';
-      }
-    }
-    if (hasClass(divs[i], 'message')) {
-      divs[i].innerHTML = message;
-    }
+Drupal.progressBar.prototype.setProgress = function (percentage, message) {
+  if (percentage >= 0 && percentage <= 100) {
+    $('div.filled', this.element).css('width', percentage +'%');
+    $('div.percentage', this.element).html(percentage +'%');
   }
+  $('div.message', this.element).html(message);
   if (this.updateCallback) {
     this.updateCallback(percentage, message, this);
   }
@@ -52,7 +42,7 @@ function progressBar(id, updateCallback,
 /**
  * Start monitoring progress via Ajax.
  */
-progressBar.prototype.startMonitoring = function (uri, delay) {
+Drupal.progressBar.prototype.startMonitoring = function (uri, delay) {
   this.delay = delay;
   this.uri = uri;
   this.sendPing();
@@ -61,7 +51,7 @@ function progressBar(id, updateCallback,
 /**
  * Stop monitoring progress via Ajax.
  */
-progressBar.prototype.stopMonitoring = function () {
+Drupal.progressBar.prototype.stopMonitoring = function () {
   clearTimeout(this.timer);
   // This allows monitoring to be stopped from within the callback
   this.uri = null;
@@ -70,47 +60,44 @@ function progressBar(id, updateCallback,
 /**
  * Request progress data from server.
  */
-progressBar.prototype.sendPing = function () {
+Drupal.progressBar.prototype.sendPing = function () {
   if (this.timer) {
     clearTimeout(this.timer);
   }
   if (this.uri) {
-    this.method(this.uri, this.receivePing, this, '');
-  }
-}
-
-/**
- * HTTP callback function. Passes data back to the progressbar and sets a new
- * timer for the next ping.
- */
-progressBar.prototype.receivePing = function (string, xmlhttp, pb) {
-  if (xmlhttp.status != 200) {
-    return pb.displayError('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri);
-  }
-  // Parse response
-  var progress = parseJson(string);
-  // Display errors
-  if (progress.status == 0) {
-    pb.displayError(progress.data);
-    return;
+    var pb = this;
+    $.ajax({
+      type: this.method,
+      url: this.uri,
+      success: function (data) {
+        // Parse response
+        var progress = Drupal.parseJson(data);
+        // Display errors
+        if (progress.status == 0) {
+          pb.displayError(progress.data);
+          return;
+        }
+        // Update display
+        pb.setProgress(progress.percentage, progress.message);
+        // Schedule next timer
+        pb.timer = setTimeout(function() { pb.sendPing(); }, pb.delay);
+      },
+      error: function (xmlhttp) {
+        pb.displayError('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri);
+      }
+    });
   }
-
-  // Update display
-  pb.setProgress(progress.percentage, progress.message);
-  // Schedule next timer
-  pb.timer = setTimeout(function() { pb.sendPing(); }, pb.delay);
 }
 
 /**
  * Display errors on the page.
  */
-progressBar.prototype.displayError = function (string) {
+Drupal.progressBar.prototype.displayError = function (string) {
   var error = document.createElement('div');
   error.className = 'error';
   error.innerHTML = string;
 
-  this.element.style.display = 'none';
-  this.element.parentNode.insertBefore(error, this.element);
+  $(this.element).before(error).hide();
 
   if (this.errorCallback) {
     this.errorCallback(this);
Index: misc/textarea.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/textarea.js,v
retrieving revision 1.9
diff -u -F^f -r1.9 textarea.js
--- misc/textarea.js	14 Apr 2006 13:48:56 -0000	1.9
+++ misc/textarea.js	24 Oct 2006 19:25:21 -0000
@@ -1,122 +1,34 @@
-// $Id: textarea.js,v 1.9 2006/04/14 13:48:56 killes Exp $
+// $Id: textarea.js,v 1.11 2006/09/07 08:05:31 dries Exp $
 
-if (isJsEnabled()) {
-  addLoadEvent(textAreaAutoAttach);
-}
-
-function textAreaAutoAttach(event, parent) {
-  if (typeof parent == 'undefined') {
-    // Attach to all visible textareas.
-    textareas = document.getElementsByTagName('textarea');
-  }
-  else {
-    // Attach to all visible textareas inside parent.
-    textareas = parent.getElementsByTagName('textarea');
-  }
-  var textarea;
-  for (var i = 0; textarea = textareas[i]; ++i) {
-    if (hasClass(textarea, 'resizable') && !hasClass(textarea.nextSibling, 'grippie')) {
-      if (typeof dimensions(textarea).width != 'undefined' && dimensions(textarea).width != 0) {
-        new textArea(textarea);
-      }
+Drupal.textareaAttach = function() {
+  $('textarea.resizable:not(.processed)').each(function() {
+    var textarea = $(this).addClass('processed'), staticOffset = null;
+
+    $(this).wrap('<div class="resizable-textarea"></div>')
+      .parent().append($('<div class="grippie"></div>').mousedown(startDrag));
+
+    var grippie = $('div.grippie', $(this).parent())[0];
+    grippie.style.marginRight = (grippie.offsetWidth - $(this)[0].offsetWidth) +'px';
+
+    function startDrag(e) {
+      staticOffset = textarea.height() - Drupal.mousePosition(e).y;
+      textarea.css('opacity', 0.25);
+      $(document).mousemove(performDrag).mouseup(endDrag);
+      return false;
     }
-  }
-}
-
-function textArea(element) {
-  var ta = this;
-  this.element = element;
-  this.parent = this.element.parentNode;
-  this.dimensions = dimensions(element);
-
-  // Prepare wrapper
-  this.wrapper = document.createElement('div');
-  this.wrapper.className = 'resizable-textarea';
-  this.parent.insertBefore(this.wrapper, this.element);
-
-  // Add grippie and measure it
-  this.grippie = document.createElement('div');
-  this.grippie.className = 'grippie';
-  this.wrapper.appendChild(this.grippie);
-  this.grippie.dimensions = dimensions(this.grippie);
-  this.grippie.onmousedown = function (e) { ta.beginDrag(e); };
-
-  // Set wrapper and textarea dimensions
-  this.wrapper.style.height = this.dimensions.height + this.grippie.dimensions.height + 1 +'px';
-  this.element.style.marginBottom = '0px';
-  this.element.style.width = '100%';
-  this.element.style.height = this.dimensions.height +'px';
-
-  // Wrap textarea
-  removeNode(this.element);
-  this.wrapper.insertBefore(this.element, this.grippie);
-
-  // Measure difference between desired and actual textarea dimensions to account for padding/borders
-  this.widthOffset = dimensions(this.wrapper).width - this.dimensions.width;
-
-  // Make the grippie line up in various browsers
-  if (window.opera) {
-    // Opera
-    this.grippie.style.marginRight = '4px';
-  }
-  if (document.all && !window.opera) {
-    // IE
-    this.grippie.style.width = '100%';
-    this.grippie.style.paddingLeft = '2px';
-  }
-  // Mozilla
-  this.element.style.MozBoxSizing = 'border-box';
-
-  this.heightOffset = absolutePosition(this.grippie).y - absolutePosition(this.element).y - this.dimensions.height;
-}
-
-textArea.prototype.beginDrag = function (event) {
-  if (document.isDragging) {
-    return;
-  }
-  document.isDragging = true;
-
-  event = event || window.event;
-  // Capture mouse
-  var cp = this;
-  this.oldMoveHandler = document.onmousemove;
-  document.onmousemove = function(e) { cp.handleDrag(e); };
-  this.oldUpHandler = document.onmouseup;
-  document.onmouseup = function(e) { cp.endDrag(e); };
-
-  // Store drag offset from grippie top
-  var pos = absolutePosition(this.grippie);
-  this.dragOffset = event.clientY - pos.y;
 
-  // Make transparent
-  this.element.style.opacity = 0.5;
-
-  // Process
-  this.handleDrag(event);
-}
-
-textArea.prototype.handleDrag = function (event) {
-  event = event || window.event;
-  // Get coordinates relative to text area
-  var pos = absolutePosition(this.element);
-  var y = event.clientY - pos.y;
-
-  // Set new height
-  var height = Math.max(32, y - this.dragOffset - this.heightOffset);
-  this.wrapper.style.height = height + this.grippie.dimensions.height + 1 + 'px';
-  this.element.style.height = height + 'px';
+    function performDrag(e) {
+      textarea.height(Math.max(32, staticOffset + Drupal.mousePosition(e).y) + 'px');
+      return false;
+    }
 
-  // Avoid text selection
-  stopEvent(event);
+    function endDrag(e) {
+      $(document).unmousemove(performDrag).unmouseup(endDrag);
+      textarea.css('opacity', 1);
+    }
+  });
 }
 
-textArea.prototype.endDrag = function (event) {
-  // Uncapture mouse
-  document.onmousemove = this.oldMoveHandler;
-  document.onmouseup = this.oldUpHandler;
-
-  // Restore opacity
-  this.element.style.opacity = 1.0;
-  document.isDragging = false;
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.textareaAttach);
 }
-
Index: misc/update.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/update.js,v
retrieving revision 1.8
diff -u -F^f -r1.8 update.js
--- misc/update.js	28 Mar 2006 09:29:23 -0000	1.8
+++ misc/update.js	24 Oct 2006 19:25:21 -0000
@@ -1,12 +1,11 @@
-// $Id: update.js,v 1.8 2006/03/28 09:29:23 killes Exp $
+// $Id: update.js,v 1.9 2006/08/31 23:31:25 unconed Exp $
 
-if (isJsEnabled()) {
-  addLoadEvent(function() {
-    if ($('edit-has_js')) {
-      $('edit-has_js').value = 1;
-    }
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    $('#edit-has_js').each(function() { this.value = 1; });
+    $('#progress').each(function () {
+      var holder = this;
 
-    if ($('progress')) {
       // Success: redirect to the summary.
       var updateCallback = function (progress, status, pb) {
         if (progress == 100) {
@@ -19,15 +18,15 @@
       var errorCallback = function (pb) {
         var div = document.createElement('p');
         div.className = 'error';
-        div.innerHTML = 'An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>';
-        $('progress').insertBefore(div, $('progress').firstChild);
-        $('wait').style.display = 'none';
+        $(div).html('An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>');
+        $(holder).prepend(div);
+        $('#wait').hide();
       }
 
-      var progress = new progressBar('updateprogress', updateCallback, HTTPPost, errorCallback);
+      var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback);
       progress.setProgress(-1, 'Starting updates');
-      $('progress').appendChild(progress.element);
+      $(holder).append(progress.element);
       progress.startMonitoring('update.php?op=do_update', 0);
-    }
+    });
   });
 }
Index: misc/upload.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/upload.js,v
retrieving revision 1.8.2.1
diff -u -F^f -r1.8.2.1 upload.js
--- misc/upload.js	5 May 2006 11:57:19 -0000	1.8.2.1
+++ misc/upload.js	24 Oct 2006 19:25:21 -0000
@@ -1,75 +1,116 @@
-// $Id: upload.js,v 1.8.2.1 2006/05/05 11:57:19 killes Exp $
-
-// Global killswitch
-if (isJsEnabled()) {
-  addLoadEvent(uploadAutoAttach);
-}
+// $Id: upload.js,v 1.11 2006/08/31 23:31:25 unconed Exp $
 
 /**
  * Attaches the upload behaviour to the upload form.
  */
-function uploadAutoAttach() {
-  var inputs = document.getElementsByTagName('input');
-  for (i = 0; input = inputs[i]; i++) {
-    if (input && hasClass(input, 'upload')) {
-      var uri = input.value;
-      // Extract the button ID based on a substring of the input name: edit[foo][bar] -> foo-bar
-      var button = input.name.substr(5, input.name.length - 6).replace('][', '-');
-      var wrapper = button + '-wrapper';
-      var hide = button + '-hide';
-      var upload = new jsUpload(uri, button, wrapper, hide);
-    }
-  }
+Drupal.uploadAutoAttach = function() {
+  $('input.upload').each(function () {
+    var uri = this.value;
+    // Extract the base name from the id (edit-attach-url -> attach).
+    var base = this.id.substring(5, this.id.length - 4);
+    var button = base + '-button';
+    var wrapper = base + '-wrapper';
+    var hide = base + '-hide';
+    var upload = new Drupal.jsUpload(uri, button, wrapper, hide);
+  });
 }
 
 /**
  * JS upload object.
  */
-function jsUpload(uri, button, wrapper, hide) {
-  this.button = button;
-  this.wrapper = wrapper;
-  this.hide = hide;
-  redirectFormButton(uri, $(button), this);
+Drupal.jsUpload = function(uri, button, wrapper, hide) {
+  // Note: these elements are replaced after an upload, so we re-select them
+  // everytime they are needed.
+  this.button = '#'+ button;
+  this.wrapper = '#'+ wrapper;
+  this.hide = '#'+ hide;
+  Drupal.redirectFormButton(uri, $(this.button).get(0), this);
 }
 
 /**
  * Handler for the form redirection submission.
  */
-jsUpload.prototype.onsubmit = function () {
-  var hide = $(this.hide);
+Drupal.jsUpload.prototype.onsubmit = function () {
   // Insert progressbar and stretch to take the same space.
-  this.progress = new progressBar('uploadprogress');
+  this.progress = new Drupal.progressBar('uploadprogress');
   this.progress.setProgress(-1, 'Uploading file');
-  this.progress.element.style.width = '28em';
-  this.progress.element.style.height = hide.offsetHeight +'px';
-  hide.parentNode.insertBefore(this.progress.element, hide);
-  // Hide file form (cannot use display: none, this mysteriously aborts form
-  // submission in Konqueror)
-  hide.style.position = 'absolute';
-  hide.style.left = '-2000px';
+
+  var hide = this.hide;
+  var el = this.progress.element;
+  var offset = $(hide).get(0).offsetHeight;
+  $(el).css({
+    width: '28em',
+    height: offset +'px',
+    paddingTop: '10px',
+    display: 'none'
+  });
+  $(hide).css('position', 'absolute');
+
+  $(hide).after(el);
+  $(el).fadeIn('slow');
+  $(hide).fadeOut('slow');
 }
 
 /**
  * Handler for the form redirection completion.
  */
-jsUpload.prototype.oncomplete = function (data) {
-  // Remove progressbar
-  removeNode(this.progress.element);
-  this.progress = null;
-  // Replace form and re-attach behaviour
-  $(this.wrapper).innerHTML = data;
-  uploadAutoAttach();
+Drupal.jsUpload.prototype.oncomplete = function (data) {
+  // Remove old form
+  Drupal.freezeHeight(); // Avoid unnecessary scrolling
+  $(this.wrapper).html('');
+
+  // Place HTML into temporary div
+  var div = document.createElement('div');
+  $(div).html(data);
+
+  // If uploading the first attachment fade in everything
+  if ($('tr', div).size() == 2) {
+    // Replace form and re-attach behaviour
+    $(div).hide();
+    $(this.wrapper).append(div);
+    $(div).fadeIn('slow');
+    Drupal.uploadAutoAttach();
+  }
+  // Else fade in only the last table row
+  else {
+    // Hide form and last table row
+    $('table tr:last-of-type td', div).hide();
+
+    // Note: workaround because jQuery's #id selector does not work outside of 'document'
+    // Should be: $(this.hide, div).hide();
+    var hide = this.hide;
+    $('div', div).each(function() {
+      if (('#'+ this.id) == hide) {
+        this.style.display = 'none';
+      }
+    });
+
+    // Replace form, fade in items and re-attach behaviour
+    $(this.wrapper).append(div);
+    $('table tr:last-of-type td', div).fadeIn('slow');
+    $(this.hide, div).fadeIn('slow');
+    Drupal.uploadAutoAttach();
+  }
+  Drupal.unfreezeHeight();
 }
 
 /**
  * Handler for the form redirection error.
  */
-jsUpload.prototype.onerror = function (error) {
+Drupal.jsUpload.prototype.onerror = function (error) {
   alert('An error occurred:\n\n'+ error);
   // Remove progressbar
-  removeNode(this.progress.element);
+  $(this.progress.element).remove();
   this.progress = null;
   // Undo hide
-  $(this.hide).style.position = 'static';
-  $(this.hide).style.left = '0px';
+  $(this.hide).css({
+    position: 'static',
+    left: '0px'
+  });
+}
+
+
+// Global killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.uploadAutoAttach);
 }
Index: modules/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/Attic/upload.module,v
retrieving revision 1.100.2.9
diff -u -F^f -r1.100.2.9 upload.module
--- modules/upload.module	26 Sep 2006 14:16:38 -0000	1.100.2.9
+++ modules/upload.module	24 Oct 2006 19:25:23 -0000
@@ -696,9 +696,9 @@ function _upload_form($node) {
       '#suffix' => '</div>',
     );
     $form['new']['upload'] = array('#type' => 'file', '#title' => t('Attach new file'), '#size' => 40);
-    $form['new']['attach'] = array('#type' => 'button', '#value' => t('Attach'), '#name'=> 'attach', '#attributes' => array('id' => 'attach'));
+    $form['new']['attach'] = array('#type' => 'button', '#value' => t('Attach'), '#name'=> 'attach', '#attributes' => array('id' => 'attach-button'));
     // The class triggers the js upload behaviour.
-    $form['attach'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
+    $form['attach-url'] = array('#type' => 'hidden', '#value' => url('upload/js', NULL, NULL, TRUE), '#attributes' => array('class' => 'upload'));
   }
 
   // Needed for JS
