<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12557] trunk/wp-includes: Update Prototype.js to 1.6.
 1 and remove the second copy of it from wp-includes/js/scriptaculous,
  update Scriptaculous.js to 1.8.3, props Simek, fixes #11041</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12557">12557</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2009-12-27 22:30:58 +0000 (Sun, 27 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Update Prototype.js to 1.6.1 and remove the second copy of it from wp-includes/js/scriptaculous, update Scriptaculous.js to 1.8.3, props Simek, fixes <a href="http://trac.wordpress.org/ticket/11041">#11041</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsprototypejs">trunk/wp-includes/js/prototype.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculousMITLICENSE">trunk/wp-includes/js/scriptaculous/MIT-LICENSE</a></li>
<li><a href="#trunkwpincludesjsscriptaculousbuilderjs">trunk/wp-includes/js/scriptaculous/builder.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculouscontrolsjs">trunk/wp-includes/js/scriptaculous/controls.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculousdragdropjs">trunk/wp-includes/js/scriptaculous/dragdrop.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculouseffectsjs">trunk/wp-includes/js/scriptaculous/effects.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculousscriptaculousjs">trunk/wp-includes/js/scriptaculous/scriptaculous.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculoussliderjs">trunk/wp-includes/js/scriptaculous/slider.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculoussoundjs">trunk/wp-includes/js/scriptaculous/sound.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculousunittestjs">trunk/wp-includes/js/scriptaculous/unittest.js</a></li>
<li><a href="#trunkwpincludesjsscriptaculouswpscriptaculousjs">trunk/wp-includes/js/scriptaculous/wp-scriptaculous.js</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpincludesjsscriptaculousprototypejs">trunk/wp-includes/js/scriptaculous/prototype.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesjsprototypejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/prototype.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/prototype.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/prototype.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><del>-/*  Prototype JavaScript framework, version 1.6.0
- *  (c) 2005-2007 Sam Stephenson
</del><ins>+/*  Prototype JavaScript framework, version 1.6.1
+ *  (c) 2005-2009 Sam Stephenson
</ins><span class="cx">  *
</span><span class="cx">  *  Prototype is freely distributable under the terms of an MIT-style license.
</span><span class="cx">  *  For details, see the Prototype web site: http://www.prototypejs.org/
</span><span class="lines">@@ -7,23 +7,43 @@
</span><span class="cx">  *--------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="cx"> var Prototype = {
</span><del>-  Version: '1.6.0',
</del><ins>+  Version: '1.6.1',
</ins><span class="cx"> 
</span><del>-  Browser: {
-    IE:     !!(window.attachEvent &amp;&amp; !window.opera),
-    Opera:  !!window.opera,
-    WebKit: navigator.userAgent.indexOf('AppleWebKit/') &gt; -1,
-    Gecko:  navigator.userAgent.indexOf('Gecko') &gt; -1 &amp;&amp; navigator.userAgent.indexOf('KHTML') == -1,
-    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
-  },
</del><ins>+  Browser: (function(){
+    var ua = navigator.userAgent;
+    var isOpera = Object.prototype.toString.call(window.opera) == '[object Opera]';
+    return {
+      IE:             !!window.attachEvent &amp;&amp; !isOpera,
+      Opera:          isOpera,
+      WebKit:         ua.indexOf('AppleWebKit/') &gt; -1,
+      Gecko:          ua.indexOf('Gecko') &gt; -1 &amp;&amp; ua.indexOf('KHTML') === -1,
+      MobileSafari:   /Apple.*Mobile.*Safari/.test(ua)
+    }
+  })(),
</ins><span class="cx"> 
</span><span class="cx">   BrowserFeatures: {
</span><span class="cx">     XPath: !!document.evaluate,
</span><del>-    ElementExtensions: !!window.HTMLElement,
-    SpecificElementExtensions:
-      document.createElement('div').__proto__ &amp;&amp;
-      document.createElement('div').__proto__ !==
-        document.createElement('form').__proto__
</del><ins>+    SelectorsAPI: !!document.querySelector,
+    ElementExtensions: (function() {
+      var constructor = window.Element || window.HTMLElement;
+      return !!(constructor &amp;&amp; constructor.prototype);
+    })(),
+    SpecificElementExtensions: (function() {
+      if (typeof window.HTMLDivElement !== 'undefined')
+        return true;
+
+      var div = document.createElement('div');
+      var form = document.createElement('form');
+      var isSupported = false;
+
+      if (div['__proto__'] &amp;&amp; (div['__proto__'] !== form['__proto__'])) {
+        isSupported = true;
+      }
+
+      div = form = null;
+
+      return isSupported;
+    })()
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   ScriptFragment: '&lt;script[^&gt;]*&gt;([\\S\\s]*?)&lt;\/script&gt;',
</span><span class="lines">@@ -36,12 +56,31 @@
</span><span class="cx"> if (Prototype.Browser.MobileSafari)
</span><span class="cx">   Prototype.BrowserFeatures.SpecificElementExtensions = false;
</span><span class="cx"> 
</span><del>-if (Prototype.Browser.WebKit)
-  Prototype.BrowserFeatures.XPath = false;
</del><span class="cx"> 
</span><ins>+var Abstract = { };
+
+
+var Try = {
+  these: function() {
+    var returnValue;
+
+    for (var i = 0, length = arguments.length; i &lt; length; i++) {
+      var lambda = arguments[i];
+      try {
+        returnValue = lambda();
+        break;
+      } catch (e) { }
+    }
+
+    return returnValue;
+  }
+};
+
</ins><span class="cx"> /* Based on Alex Arnell's inheritance implementation. */
</span><del>-var Class = {
-  create: function() {
</del><ins>+
+var Class = (function() {
+  function subclass() {};
+  function create() {
</ins><span class="cx">     var parent = null, properties = $A(arguments);
</span><span class="cx">     if (Object.isFunction(properties[0]))
</span><span class="cx">       parent = properties.shift();
</span><span class="lines">@@ -55,7 +94,6 @@
</span><span class="cx">     klass.subclasses = [];
</span><span class="cx"> 
</span><span class="cx">     if (parent) {
</span><del>-      var subclass = function() { };
</del><span class="cx">       subclass.prototype = parent.prototype;
</span><span class="cx">       klass.prototype = new subclass;
</span><span class="cx">       parent.subclasses.push(klass);
</span><span class="lines">@@ -68,58 +106,67 @@
</span><span class="cx">       klass.prototype.initialize = Prototype.emptyFunction;
</span><span class="cx"> 
</span><span class="cx">     klass.prototype.constructor = klass;
</span><del>-
</del><span class="cx">     return klass;
</span><span class="cx">   }
</span><del>-};
</del><span class="cx"> 
</span><del>-Class.Methods = {
-  addMethods: function(source) {
</del><ins>+  function addMethods(source) {
</ins><span class="cx">     var ancestor   = this.superclass &amp;&amp; this.superclass.prototype;
</span><span class="cx">     var properties = Object.keys(source);
</span><span class="cx"> 
</span><del>-    if (!Object.keys({ toString: true }).length)
-      properties.push(&quot;toString&quot;, &quot;valueOf&quot;);
</del><ins>+    if (!Object.keys({ toString: true }).length) {
+      if (source.toString != Object.prototype.toString)
+        properties.push(&quot;toString&quot;);
+      if (source.valueOf != Object.prototype.valueOf)
+        properties.push(&quot;valueOf&quot;);
+    }
</ins><span class="cx"> 
</span><span class="cx">     for (var i = 0, length = properties.length; i &lt; length; i++) {
</span><span class="cx">       var property = properties[i], value = source[property];
</span><span class="cx">       if (ancestor &amp;&amp; Object.isFunction(value) &amp;&amp;
</span><span class="cx">           value.argumentNames().first() == &quot;$super&quot;) {
</span><del>-        var method = value, value = Object.extend((function(m) {
-          return function() { return ancestor[m].apply(this, arguments) };
-        })(property).wrap(method), {
-          valueOf:  function() { return method },
-          toString: function() { return method.toString() }
-        });
</del><ins>+        var method = value;
+        value = (function(m) {
+          return function() { return ancestor[m].apply(this, arguments); };
+        })(property).wrap(method);
+
+        value.valueOf = method.valueOf.bind(method);
+        value.toString = method.toString.bind(method);
</ins><span class="cx">       }
</span><span class="cx">       this.prototype[property] = value;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return this;
</span><span class="cx">   }
</span><del>-};
</del><span class="cx"> 
</span><del>-var Abstract = { };
</del><ins>+  return {
+    create: create,
+    Methods: {
+      addMethods: addMethods
+    }
+  };
+})();
+(function() {
</ins><span class="cx"> 
</span><del>-Object.extend = function(destination, source) {
-  for (var property in source)
-    destination[property] = source[property];
-  return destination;
-};
</del><ins>+  var _toString = Object.prototype.toString;
</ins><span class="cx"> 
</span><del>-Object.extend(Object, {
-  inspect: function(object) {
</del><ins>+  function extend(destination, source) {
+    for (var property in source)
+      destination[property] = source[property];
+    return destination;
+  }
+
+  function inspect(object) {
</ins><span class="cx">     try {
</span><del>-      if (object === undefined) return 'undefined';
</del><ins>+      if (isUndefined(object)) return 'undefined';
</ins><span class="cx">       if (object === null) return 'null';
</span><del>-      return object.inspect ? object.inspect() : object.toString();
</del><ins>+      return object.inspect ? object.inspect() : String(object);
</ins><span class="cx">     } catch (e) {
</span><span class="cx">       if (e instanceof RangeError) return '...';
</span><span class="cx">       throw e;
</span><span class="cx">     }
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toJSON: function(object) {
</del><ins>+  function toJSON(object) {
</ins><span class="cx">     var type = typeof object;
</span><span class="cx">     switch (type) {
</span><span class="cx">       case 'undefined':
</span><span class="lines">@@ -130,127 +177,181 @@
</span><span class="cx"> 
</span><span class="cx">     if (object === null) return 'null';
</span><span class="cx">     if (object.toJSON) return object.toJSON();
</span><del>-    if (Object.isElement(object)) return;
</del><ins>+    if (isElement(object)) return;
</ins><span class="cx"> 
</span><span class="cx">     var results = [];
</span><span class="cx">     for (var property in object) {
</span><del>-      var value = Object.toJSON(object[property]);
-      if (value !== undefined)
</del><ins>+      var value = toJSON(object[property]);
+      if (!isUndefined(value))
</ins><span class="cx">         results.push(property.toJSON() + ': ' + value);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return '{' + results.join(', ') + '}';
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toQueryString: function(object) {
</del><ins>+  function toQueryString(object) {
</ins><span class="cx">     return $H(object).toQueryString();
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toHTML: function(object) {
</del><ins>+  function toHTML(object) {
</ins><span class="cx">     return object &amp;&amp; object.toHTML ? object.toHTML() : String.interpret(object);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  keys: function(object) {
-    var keys = [];
</del><ins>+  function keys(object) {
+    var results = [];
</ins><span class="cx">     for (var property in object)
</span><del>-      keys.push(property);
-    return keys;
-  },
</del><ins>+      results.push(property);
+    return results;
+  }
</ins><span class="cx"> 
</span><del>-  values: function(object) {
-    var values = [];
</del><ins>+  function values(object) {
+    var results = [];
</ins><span class="cx">     for (var property in object)
</span><del>-      values.push(object[property]);
-    return values;
-  },
</del><ins>+      results.push(object[property]);
+    return results;
+  }
</ins><span class="cx"> 
</span><del>-  clone: function(object) {
-    return Object.extend({ }, object);
-  },
</del><ins>+  function clone(object) {
+    return extend({ }, object);
+  }
</ins><span class="cx"> 
</span><del>-  isElement: function(object) {
-    return object &amp;&amp; object.nodeType == 1;
-  },
</del><ins>+  function isElement(object) {
+    return !!(object &amp;&amp; object.nodeType == 1);
+  }
</ins><span class="cx"> 
</span><del>-  isArray: function(object) {
-    return object &amp;&amp; object.constructor === Array;
-  },
</del><ins>+  function isArray(object) {
+    return _toString.call(object) == &quot;[object Array]&quot;;
+  }
</ins><span class="cx"> 
</span><del>-  isHash: function(object) {
</del><ins>+
+  function isHash(object) {
</ins><span class="cx">     return object instanceof Hash;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  isFunction: function(object) {
-    return typeof object == &quot;function&quot;;
-  },
</del><ins>+  function isFunction(object) {
+    return typeof object === &quot;function&quot;;
+  }
</ins><span class="cx"> 
</span><del>-  isString: function(object) {
-    return typeof object == &quot;string&quot;;
-  },
</del><ins>+  function isString(object) {
+    return _toString.call(object) == &quot;[object String]&quot;;
+  }
</ins><span class="cx"> 
</span><del>-  isNumber: function(object) {
-    return typeof object == &quot;number&quot;;
-  },
</del><ins>+  function isNumber(object) {
+    return _toString.call(object) == &quot;[object Number]&quot;;
+  }
</ins><span class="cx"> 
</span><del>-  isUndefined: function(object) {
-    return typeof object == &quot;undefined&quot;;
</del><ins>+  function isUndefined(object) {
+    return typeof object === &quot;undefined&quot;;
</ins><span class="cx">   }
</span><del>-});
</del><span class="cx"> 
</span><del>-Object.extend(Function.prototype, {
-  argumentNames: function() {
-    var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(&quot;,&quot;).invoke(&quot;strip&quot;);
</del><ins>+  extend(Object, {
+    extend:        extend,
+    inspect:       inspect,
+    toJSON:        toJSON,
+    toQueryString: toQueryString,
+    toHTML:        toHTML,
+    keys:          keys,
+    values:        values,
+    clone:         clone,
+    isElement:     isElement,
+    isArray:       isArray,
+    isHash:        isHash,
+    isFunction:    isFunction,
+    isString:      isString,
+    isNumber:      isNumber,
+    isUndefined:   isUndefined
+  });
+})();
+Object.extend(Function.prototype, (function() {
+  var slice = Array.prototype.slice;
+
+  function update(array, args) {
+    var arrayLength = array.length, length = args.length;
+    while (length--) array[arrayLength + length] = args[length];
+    return array;
+  }
+
+  function merge(array, args) {
+    array = slice.call(array, 0);
+    return update(array, args);
+  }
+
+  function argumentNames() {
+    var names = this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1]
+      .replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g, '')
+      .replace(/\s+/g, '').split(',');
</ins><span class="cx">     return names.length == 1 &amp;&amp; !names[0] ? [] : names;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  bind: function() {
-    if (arguments.length &lt; 2 &amp;&amp; arguments[0] === undefined) return this;
-    var __method = this, args = $A(arguments), object = args.shift();
</del><ins>+  function bind(context) {
+    if (arguments.length &lt; 2 &amp;&amp; Object.isUndefined(arguments[0])) return this;
+    var __method = this, args = slice.call(arguments, 1);
</ins><span class="cx">     return function() {
</span><del>-      return __method.apply(object, args.concat($A(arguments)));
</del><ins>+      var a = merge(args, arguments);
+      return __method.apply(context, a);
</ins><span class="cx">     }
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  bindAsEventListener: function() {
-    var __method = this, args = $A(arguments), object = args.shift();
</del><ins>+  function bindAsEventListener(context) {
+    var __method = this, args = slice.call(arguments, 1);
</ins><span class="cx">     return function(event) {
</span><del>-      return __method.apply(object, [event || window.event].concat(args));
</del><ins>+      var a = update([event || window.event], args);
+      return __method.apply(context, a);
</ins><span class="cx">     }
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  curry: function() {
</del><ins>+  function curry() {
</ins><span class="cx">     if (!arguments.length) return this;
</span><del>-    var __method = this, args = $A(arguments);
</del><ins>+    var __method = this, args = slice.call(arguments, 0);
</ins><span class="cx">     return function() {
</span><del>-      return __method.apply(this, args.concat($A(arguments)));
</del><ins>+      var a = merge(args, arguments);
+      return __method.apply(this, a);
</ins><span class="cx">     }
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  delay: function() {
-    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
</del><ins>+  function delay(timeout) {
+    var __method = this, args = slice.call(arguments, 1);
+    timeout = timeout * 1000
</ins><span class="cx">     return window.setTimeout(function() {
</span><span class="cx">       return __method.apply(__method, args);
</span><span class="cx">     }, timeout);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  wrap: function(wrapper) {
</del><ins>+  function defer() {
+    var args = update([0.01], arguments);
+    return this.delay.apply(this, args);
+  }
+
+  function wrap(wrapper) {
</ins><span class="cx">     var __method = this;
</span><span class="cx">     return function() {
</span><del>-      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
</del><ins>+      var a = update([__method.bind(this)], arguments);
+      return wrapper.apply(this, a);
</ins><span class="cx">     }
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  methodize: function() {
</del><ins>+  function methodize() {
</ins><span class="cx">     if (this._methodized) return this._methodized;
</span><span class="cx">     var __method = this;
</span><span class="cx">     return this._methodized = function() {
</span><del>-      return __method.apply(null, [this].concat($A(arguments)));
</del><ins>+      var a = update([this], arguments);
+      return __method.apply(null, a);
</ins><span class="cx">     };
</span><span class="cx">   }
</span><del>-});
</del><span class="cx"> 
</span><del>-Function.prototype.defer = Function.prototype.delay.curry(0.01);
</del><ins>+  return {
+    argumentNames:       argumentNames,
+    bind:                bind,
+    bindAsEventListener: bindAsEventListener,
+    curry:               curry,
+    delay:               delay,
+    defer:               defer,
+    wrap:                wrap,
+    methodize:           methodize
+  }
+})());
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx"> Date.prototype.toJSON = function() {
</span><span class="cx">   return '&quot;' + this.getUTCFullYear() + '-' +
</span><span class="cx">     (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
</span><span class="lines">@@ -260,30 +361,12 @@
</span><span class="cx">     this.getUTCSeconds().toPaddedString(2) + 'Z&quot;';
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-var Try = {
-  these: function() {
-    var returnValue;
</del><span class="cx"> 
</span><del>-    for (var i = 0, length = arguments.length; i &lt; length; i++) {
-      var lambda = arguments[i];
-      try {
-        returnValue = lambda();
-        break;
-      } catch (e) { }
-    }
-
-    return returnValue;
-  }
-};
-
</del><span class="cx"> RegExp.prototype.match = RegExp.prototype.test;
</span><span class="cx"> 
</span><span class="cx"> RegExp.escape = function(str) {
</span><span class="cx">   return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
</span><span class="cx"> };
</span><del>-
-/*--------------------------------------------------------------------------*/
-
</del><span class="cx"> var PeriodicalExecuter = Class.create({
</span><span class="cx">   initialize: function(callback, frequency) {
</span><span class="cx">     this.callback = callback;
</span><span class="lines">@@ -312,8 +395,10 @@
</span><span class="cx">       try {
</span><span class="cx">         this.currentlyExecuting = true;
</span><span class="cx">         this.execute();
</span><del>-      } finally {
</del><span class="cx">         this.currentlyExecuting = false;
</span><ins>+      } catch(e) {
+        this.currentlyExecuting = false;
+        throw e;
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">   }
</span><span class="lines">@@ -332,11 +417,26 @@
</span><span class="cx">   }
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-Object.extend(String.prototype, {
-  gsub: function(pattern, replacement) {
</del><ins>+Object.extend(String.prototype, (function() {
+
+  function prepareReplacement(replacement) {
+    if (Object.isFunction(replacement)) return replacement;
+    var template = new Template(replacement);
+    return function(match) { return template.evaluate(match) };
+  }
+
+  function gsub(pattern, replacement) {
</ins><span class="cx">     var result = '', source = this, match;
</span><del>-    replacement = arguments.callee.prepareReplacement(replacement);
</del><ins>+    replacement = prepareReplacement(replacement);
</ins><span class="cx"> 
</span><ins>+    if (Object.isString(pattern))
+      pattern = RegExp.escape(pattern);
+
+    if (!(pattern.length || pattern.source)) {
+      replacement = replacement('');
+      return replacement + source.split('').join(replacement) + replacement;
+    }
+
</ins><span class="cx">     while (source.length &gt; 0) {
</span><span class="cx">       if (match = source.match(pattern)) {
</span><span class="cx">         result += source.slice(0, match.index);
</span><span class="lines">@@ -347,69 +447,64 @@
</span><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     return result;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  sub: function(pattern, replacement, count) {
-    replacement = this.gsub.prepareReplacement(replacement);
-    count = count === undefined ? 1 : count;
</del><ins>+  function sub(pattern, replacement, count) {
+    replacement = prepareReplacement(replacement);
+    count = Object.isUndefined(count) ? 1 : count;
</ins><span class="cx"> 
</span><span class="cx">     return this.gsub(pattern, function(match) {
</span><span class="cx">       if (--count &lt; 0) return match[0];
</span><span class="cx">       return replacement(match);
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  scan: function(pattern, iterator) {
</del><ins>+  function scan(pattern, iterator) {
</ins><span class="cx">     this.gsub(pattern, iterator);
</span><span class="cx">     return String(this);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  truncate: function(length, truncation) {
</del><ins>+  function truncate(length, truncation) {
</ins><span class="cx">     length = length || 30;
</span><del>-    truncation = truncation === undefined ? '...' : truncation;
</del><ins>+    truncation = Object.isUndefined(truncation) ? '...' : truncation;
</ins><span class="cx">     return this.length &gt; length ?
</span><span class="cx">       this.slice(0, length - truncation.length) + truncation : String(this);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  strip: function() {
</del><ins>+  function strip() {
</ins><span class="cx">     return this.replace(/^\s+/, '').replace(/\s+$/, '');
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  stripTags: function() {
-    return this.replace(/&lt;\/?[^&gt;]+&gt;/gi, '');
-  },
</del><ins>+  function stripTags() {
+    return this.replace(/&lt;\w+(\s+(&quot;[^&quot;]*&quot;|'[^']*'|[^&gt;])+)?&gt;|&lt;\/\w+&gt;/gi, '');
+  }
</ins><span class="cx"> 
</span><del>-  stripScripts: function() {
</del><ins>+  function stripScripts() {
</ins><span class="cx">     return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  extractScripts: function() {
</del><ins>+  function extractScripts() {
</ins><span class="cx">     var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
</span><span class="cx">     var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
</span><span class="cx">     return (this.match(matchAll) || []).map(function(scriptTag) {
</span><span class="cx">       return (scriptTag.match(matchOne) || ['', ''])[1];
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  evalScripts: function() {
</del><ins>+  function evalScripts() {
</ins><span class="cx">     return this.extractScripts().map(function(script) { return eval(script) });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  escapeHTML: function() {
-    var self = arguments.callee;
-    self.text.data = this;
-    return self.div.innerHTML;
-  },
</del><ins>+  function escapeHTML() {
+    return this.replace(/&amp;/g,'&amp;amp;').replace(/&lt;/g,'&amp;lt;').replace(/&gt;/g,'&amp;gt;');
+  }
</ins><span class="cx"> 
</span><del>-  unescapeHTML: function() {
-    var div = new Element('div');
-    div.innerHTML = this.stripTags();
-    return div.childNodes[0] ? (div.childNodes.length &gt; 1 ?
-      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
-      div.childNodes[0].nodeValue) : '';
-  },
</del><ins>+  function unescapeHTML() {
+    return this.stripTags().replace(/&amp;lt;/g,'&lt;').replace(/&amp;gt;/g,'&gt;').replace(/&amp;amp;/g,'&amp;');
+  }
</ins><span class="cx"> 
</span><del>-  toQueryParams: function(separator) {
</del><ins>+
+  function toQueryParams(separator) {
</ins><span class="cx">     var match = this.strip().match(/([^?#]*)(#.*)?$/);
</span><span class="cx">     if (!match) return { };
</span><span class="cx"> 
</span><span class="lines">@@ -427,22 +522,22 @@
</span><span class="cx">       }
</span><span class="cx">       return hash;
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toArray: function() {
</del><ins>+  function toArray() {
</ins><span class="cx">     return this.split('');
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  succ: function() {
</del><ins>+  function succ() {
</ins><span class="cx">     return this.slice(0, this.length - 1) +
</span><span class="cx">       String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  times: function(count) {
</del><ins>+  function times(count) {
</ins><span class="cx">     return count &lt; 1 ? '' : new Array(count + 1).join(this);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  camelize: function() {
</del><ins>+  function camelize() {
</ins><span class="cx">     var parts = this.split('-'), len = parts.length;
</span><span class="cx">     if (len == 1) return parts[0];
</span><span class="cx"> 
</span><span class="lines">@@ -454,100 +549,118 @@
</span><span class="cx">       camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
</span><span class="cx"> 
</span><span class="cx">     return camelized;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  capitalize: function() {
</del><ins>+  function capitalize() {
</ins><span class="cx">     return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  underscore: function() {
-    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
-  },
</del><ins>+  function underscore() {
+    return this.replace(/::/g, '/')
+               .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
+               .replace(/([a-z\d])([A-Z])/g, '$1_$2')
+               .replace(/-/g, '_')
+               .toLowerCase();
+  }
</ins><span class="cx"> 
</span><del>-  dasherize: function() {
-    return this.gsub(/_/,'-');
-  },
</del><ins>+  function dasherize() {
+    return this.replace(/_/g, '-');
+  }
</ins><span class="cx"> 
</span><del>-  inspect: function(useDoubleQuotes) {
-    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
-      var character = String.specialChar[match[0]];
-      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
</del><ins>+  function inspect(useDoubleQuotes) {
+    var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
+      if (character in String.specialChar) {
+        return String.specialChar[character];
+      }
+      return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
</ins><span class="cx">     });
</span><span class="cx">     if (useDoubleQuotes) return '&quot;' + escapedString.replace(/&quot;/g, '\\&quot;') + '&quot;';
</span><span class="cx">     return &quot;'&quot; + escapedString.replace(/'/g, '\\\'') + &quot;'&quot;;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toJSON: function() {
</del><ins>+  function toJSON() {
</ins><span class="cx">     return this.inspect(true);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  unfilterJSON: function(filter) {
-    return this.sub(filter || Prototype.JSONFilter, '#{1}');
-  },
</del><ins>+  function unfilterJSON(filter) {
+    return this.replace(filter || Prototype.JSONFilter, '$1');
+  }
</ins><span class="cx"> 
</span><del>-  isJSON: function() {
-    var str = this.replace(/\\./g, '@').replace(/&quot;[^&quot;\\\n\r]*&quot;/g, '');
</del><ins>+  function isJSON() {
+    var str = this;
+    if (str.blank()) return false;
+    str = this.replace(/\\./g, '@').replace(/&quot;[^&quot;\\\n\r]*&quot;/g, '');
</ins><span class="cx">     return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  evalJSON: function(sanitize) {
</del><ins>+  function evalJSON(sanitize) {
</ins><span class="cx">     var json = this.unfilterJSON();
</span><span class="cx">     try {
</span><span class="cx">       if (!sanitize || json.isJSON()) return eval('(' + json + ')');
</span><span class="cx">     } catch (e) { }
</span><span class="cx">     throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  include: function(pattern) {
</del><ins>+  function include(pattern) {
</ins><span class="cx">     return this.indexOf(pattern) &gt; -1;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  startsWith: function(pattern) {
</del><ins>+  function startsWith(pattern) {
</ins><span class="cx">     return this.indexOf(pattern) === 0;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  endsWith: function(pattern) {
</del><ins>+  function endsWith(pattern) {
</ins><span class="cx">     var d = this.length - pattern.length;
</span><span class="cx">     return d &gt;= 0 &amp;&amp; this.lastIndexOf(pattern) === d;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  empty: function() {
</del><ins>+  function empty() {
</ins><span class="cx">     return this == '';
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  blank: function() {
</del><ins>+  function blank() {
</ins><span class="cx">     return /^\s*$/.test(this);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  interpolate: function(object, pattern) {
</del><ins>+  function interpolate(object, pattern) {
</ins><span class="cx">     return new Template(this, pattern).evaluate(object);
</span><span class="cx">   }
</span><del>-});
</del><span class="cx"> 
</span><del>-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
-  escapeHTML: function() {
-    return this.replace(/&amp;/g,'&amp;amp;').replace(/&lt;/g,'&amp;lt;').replace(/&gt;/g,'&amp;gt;');
-  },
-  unescapeHTML: function() {
-    return this.replace(/&amp;amp;/g,'&amp;').replace(/&amp;lt;/g,'&lt;').replace(/&amp;gt;/g,'&gt;');
-  }
-});
</del><ins>+  return {
+    gsub:           gsub,
+    sub:            sub,
+    scan:           scan,
+    truncate:       truncate,
+    strip:          String.prototype.trim ? String.prototype.trim : strip,
+    stripTags:      stripTags,
+    stripScripts:   stripScripts,
+    extractScripts: extractScripts,
+    evalScripts:    evalScripts,
+    escapeHTML:     escapeHTML,
+    unescapeHTML:   unescapeHTML,
+    toQueryParams:  toQueryParams,
+    parseQuery:     toQueryParams,
+    toArray:        toArray,
+    succ:           succ,
+    times:          times,
+    camelize:       camelize,
+    capitalize:     capitalize,
+    underscore:     underscore,
+    dasherize:      dasherize,
+    inspect:        inspect,
+    toJSON:         toJSON,
+    unfilterJSON:   unfilterJSON,
+    isJSON:         isJSON,
+    evalJSON:       evalJSON,
+    include:        include,
+    startsWith:     startsWith,
+    endsWith:       endsWith,
+    empty:          empty,
+    blank:          blank,
+    interpolate:    interpolate
+  };
+})());
</ins><span class="cx"> 
</span><del>-String.prototype.gsub.prepareReplacement = function(replacement) {
-  if (Object.isFunction(replacement)) return replacement;
-  var template = new Template(replacement);
-  return function(match) { return template.evaluate(match) };
-};
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-Object.extend(String.prototype.escapeHTML, {
-  div:  document.createElement('div'),
-  text: document.createTextNode('')
-});
-
-with (String.prototype.escapeHTML) div.appendChild(text);
-
</del><span class="cx"> var Template = Class.create({
</span><span class="cx">   initialize: function(template, pattern) {
</span><span class="cx">     this.template = template.toString();
</span><span class="lines">@@ -555,21 +668,22 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   evaluate: function(object) {
</span><del>-    if (Object.isFunction(object.toTemplateReplacements))
</del><ins>+    if (object &amp;&amp; Object.isFunction(object.toTemplateReplacements))
</ins><span class="cx">       object = object.toTemplateReplacements();
</span><span class="cx"> 
</span><span class="cx">     return this.template.gsub(this.pattern, function(match) {
</span><del>-      if (object == null) return '';
</del><ins>+      if (object == null) return (match[1] + '');
</ins><span class="cx"> 
</span><span class="cx">       var before = match[1] || '';
</span><span class="cx">       if (before == '\\') return match[2];
</span><span class="cx"> 
</span><span class="cx">       var ctx = object, expr = match[3];
</span><del>-      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
</del><ins>+      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
+      match = pattern.exec(expr);
</ins><span class="cx">       if (match == null) return before;
</span><span class="cx"> 
</span><span class="cx">       while (match != null) {
</span><del>-        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
</del><ins>+        var comp = match[1].startsWith('[') ? match[2].replace(/\\\\]/g, ']') : match[1];
</ins><span class="cx">         ctx = ctx[comp];
</span><span class="cx">         if (null == ctx || '' == match[3]) break;
</span><span class="cx">         expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
</span><span class="lines">@@ -577,101 +691,98 @@
</span><span class="cx">       }
</span><span class="cx"> 
</span><span class="cx">       return before + String.interpret(ctx);
</span><del>-    }.bind(this));
</del><ins>+    });
</ins><span class="cx">   }
</span><span class="cx"> });
</span><span class="cx"> Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
</span><span class="cx"> 
</span><span class="cx"> var $break = { };
</span><span class="cx"> 
</span><del>-var Enumerable = {
-  each: function(iterator, context) {
</del><ins>+var Enumerable = (function() {
+  function each(iterator, context) {
</ins><span class="cx">     var index = 0;
</span><del>-    iterator = iterator.bind(context);
</del><span class="cx">     try {
</span><span class="cx">       this._each(function(value) {
</span><del>-        iterator(value, index++);
</del><ins>+        iterator.call(context, value, index++);
</ins><span class="cx">       });
</span><span class="cx">     } catch (e) {
</span><span class="cx">       if (e != $break) throw e;
</span><span class="cx">     }
</span><span class="cx">     return this;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  eachSlice: function(number, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function eachSlice(number, iterator, context) {
</ins><span class="cx">     var index = -number, slices = [], array = this.toArray();
</span><ins>+    if (number &lt; 1) return array;
</ins><span class="cx">     while ((index += number) &lt; array.length)
</span><span class="cx">       slices.push(array.slice(index, index+number));
</span><span class="cx">     return slices.collect(iterator, context);
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  all: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function all(iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var result = true;
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      result = result &amp;&amp; !!iterator(value, index);
</del><ins>+      result = result &amp;&amp; !!iterator.call(context, value, index);
</ins><span class="cx">       if (!result) throw $break;
</span><span class="cx">     });
</span><span class="cx">     return result;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  any: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function any(iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var result = false;
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      if (result = !!iterator(value, index))
</del><ins>+      if (result = !!iterator.call(context, value, index))
</ins><span class="cx">         throw $break;
</span><span class="cx">     });
</span><span class="cx">     return result;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  collect: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function collect(iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var results = [];
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      results.push(iterator(value, index));
</del><ins>+      results.push(iterator.call(context, value, index));
</ins><span class="cx">     });
</span><span class="cx">     return results;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  detect: function(iterator, context) {
-    iterator = iterator.bind(context);
</del><ins>+  function detect(iterator, context) {
</ins><span class="cx">     var result;
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      if (iterator(value, index)) {
</del><ins>+      if (iterator.call(context, value, index)) {
</ins><span class="cx">         result = value;
</span><span class="cx">         throw $break;
</span><span class="cx">       }
</span><span class="cx">     });
</span><span class="cx">     return result;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  findAll: function(iterator, context) {
-    iterator = iterator.bind(context);
</del><ins>+  function findAll(iterator, context) {
</ins><span class="cx">     var results = [];
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      if (iterator(value, index))
</del><ins>+      if (iterator.call(context, value, index))
</ins><span class="cx">         results.push(value);
</span><span class="cx">     });
</span><span class="cx">     return results;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  grep: function(filter, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function grep(filter, iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var results = [];
</span><span class="cx"> 
</span><span class="cx">     if (Object.isString(filter))
</span><del>-      filter = new RegExp(filter);
</del><ins>+      filter = new RegExp(RegExp.escape(filter));
</ins><span class="cx"> 
</span><span class="cx">     this.each(function(value, index) {
</span><span class="cx">       if (filter.match(value))
</span><del>-        results.push(iterator(value, index));
</del><ins>+        results.push(iterator.call(context, value, index));
</ins><span class="cx">     });
</span><span class="cx">     return results;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  include: function(object) {
</del><ins>+  function include(object) {
</ins><span class="cx">     if (Object.isFunction(this.indexOf))
</span><span class="cx">       if (this.indexOf(object) != -1) return true;
</span><span class="cx"> 
</span><span class="lines">@@ -683,96 +794,96 @@
</span><span class="cx">       }
</span><span class="cx">     });
</span><span class="cx">     return found;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  inGroupsOf: function(number, fillWith) {
-    fillWith = fillWith === undefined ? null : fillWith;
</del><ins>+  function inGroupsOf(number, fillWith) {
+    fillWith = Object.isUndefined(fillWith) ? null : fillWith;
</ins><span class="cx">     return this.eachSlice(number, function(slice) {
</span><span class="cx">       while(slice.length &lt; number) slice.push(fillWith);
</span><span class="cx">       return slice;
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  inject: function(memo, iterator, context) {
-    iterator = iterator.bind(context);
</del><ins>+  function inject(memo, iterator, context) {
</ins><span class="cx">     this.each(function(value, index) {
</span><del>-      memo = iterator(memo, value, index);
</del><ins>+      memo = iterator.call(context, memo, value, index);
</ins><span class="cx">     });
</span><span class="cx">     return memo;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  invoke: function(method) {
</del><ins>+  function invoke(method) {
</ins><span class="cx">     var args = $A(arguments).slice(1);
</span><span class="cx">     return this.map(function(value) {
</span><span class="cx">       return value[method].apply(value, args);
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  max: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function max(iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var result;
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      value = iterator(value, index);
-      if (result == undefined || value &gt;= result)
</del><ins>+      value = iterator.call(context, value, index);
+      if (result == null || value &gt;= result)
</ins><span class="cx">         result = value;
</span><span class="cx">     });
</span><span class="cx">     return result;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  min: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function min(iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var result;
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      value = iterator(value, index);
-      if (result == undefined || value &lt; result)
</del><ins>+      value = iterator.call(context, value, index);
+      if (result == null || value &lt; result)
</ins><span class="cx">         result = value;
</span><span class="cx">     });
</span><span class="cx">     return result;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  partition: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
</del><ins>+  function partition(iterator, context) {
+    iterator = iterator || Prototype.K;
</ins><span class="cx">     var trues = [], falses = [];
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      (iterator(value, index) ?
</del><ins>+      (iterator.call(context, value, index) ?
</ins><span class="cx">         trues : falses).push(value);
</span><span class="cx">     });
</span><span class="cx">     return [trues, falses];
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  pluck: function(property) {
</del><ins>+  function pluck(property) {
</ins><span class="cx">     var results = [];
</span><span class="cx">     this.each(function(value) {
</span><span class="cx">       results.push(value[property]);
</span><span class="cx">     });
</span><span class="cx">     return results;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  reject: function(iterator, context) {
-    iterator = iterator.bind(context);
</del><ins>+  function reject(iterator, context) {
</ins><span class="cx">     var results = [];
</span><span class="cx">     this.each(function(value, index) {
</span><del>-      if (!iterator(value, index))
</del><ins>+      if (!iterator.call(context, value, index))
</ins><span class="cx">         results.push(value);
</span><span class="cx">     });
</span><span class="cx">     return results;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  sortBy: function(iterator, context) {
-    iterator = iterator.bind(context);
</del><ins>+  function sortBy(iterator, context) {
</ins><span class="cx">     return this.map(function(value, index) {
</span><del>-      return {value: value, criteria: iterator(value, index)};
</del><ins>+      return {
+        value: value,
+        criteria: iterator.call(context, value, index)
+      };
</ins><span class="cx">     }).sort(function(left, right) {
</span><span class="cx">       var a = left.criteria, b = right.criteria;
</span><span class="cx">       return a &lt; b ? -1 : a &gt; b ? 1 : 0;
</span><span class="cx">     }).pluck('value');
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toArray: function() {
</del><ins>+  function toArray() {
</ins><span class="cx">     return this.map();
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  zip: function() {
</del><ins>+  function zip() {
</ins><span class="cx">     var iterator = Prototype.K, args = $A(arguments);
</span><span class="cx">     if (Object.isFunction(args.last()))
</span><span class="cx">       iterator = args.pop();
</span><span class="lines">@@ -781,352 +892,424 @@
</span><span class="cx">     return this.map(function(value, index) {
</span><span class="cx">       return iterator(collections.pluck(index));
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  size: function() {
</del><ins>+  function size() {
</ins><span class="cx">     return this.toArray().length;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  inspect: function() {
</del><ins>+  function inspect() {
</ins><span class="cx">     return '#&lt;Enumerable:' + this.toArray().inspect() + '&gt;';
</span><span class="cx">   }
</span><del>-};
</del><span class="cx"> 
</span><del>-Object.extend(Enumerable, {
-  map:     Enumerable.collect,
-  find:    Enumerable.detect,
-  select:  Enumerable.findAll,
-  filter:  Enumerable.findAll,
-  member:  Enumerable.include,
-  entries: Enumerable.toArray,
-  every:   Enumerable.all,
-  some:    Enumerable.any
-});
</del><ins>+
+
+
+
+
+
+
+
+  return {
+    each:       each,
+    eachSlice:  eachSlice,
+    all:        all,
+    every:      all,
+    any:        any,
+    some:       any,
+    collect:    collect,
+    map:        collect,
+    detect:     detect,
+    findAll:    findAll,
+    select:     findAll,
+    filter:     findAll,
+    grep:       grep,
+    include:    include,
+    member:     include,
+    inGroupsOf: inGroupsOf,
+    inject:     inject,
+    invoke:     invoke,
+    max:        max,
+    min:        min,
+    partition:  partition,
+    pluck:      pluck,
+    reject:     reject,
+    sortBy:     sortBy,
+    toArray:    toArray,
+    entries:    toArray,
+    zip:        zip,
+    size:       size,
+    inspect:    inspect,
+    find:       detect
+  };
+})();
</ins><span class="cx"> function $A(iterable) {
</span><span class="cx">   if (!iterable) return [];
</span><del>-  if (iterable.toArray) return iterable.toArray();
-  var length = iterable.length, results = new Array(length);
</del><ins>+  if ('toArray' in Object(iterable)) return iterable.toArray();
+  var length = iterable.length || 0, results = new Array(length);
</ins><span class="cx">   while (length--) results[length] = iterable[length];
</span><span class="cx">   return results;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if (Prototype.Browser.WebKit) {
-  function $A(iterable) {
-    if (!iterable) return [];
-    if (!(Object.isFunction(iterable) &amp;&amp; iterable == '[object NodeList]') &amp;&amp;
-        iterable.toArray) return iterable.toArray();
-    var length = iterable.length, results = new Array(length);
-    while (length--) results[length] = iterable[length];
-    return results;
-  }
</del><ins>+function $w(string) {
+  if (!Object.isString(string)) return [];
+  string = string.strip();
+  return string ? string.split(/\s+/) : [];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Array.from = $A;
</span><span class="cx"> 
</span><del>-Object.extend(Array.prototype, Enumerable);
</del><span class="cx"> 
</span><del>-if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
</del><ins>+(function() {
+  var arrayProto = Array.prototype,
+      slice = arrayProto.slice,
+      _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available
</ins><span class="cx"> 
</span><del>-Object.extend(Array.prototype, {
-  _each: function(iterator) {
</del><ins>+  function each(iterator) {
</ins><span class="cx">     for (var i = 0, length = this.length; i &lt; length; i++)
</span><span class="cx">       iterator(this[i]);
</span><del>-  },
</del><ins>+  }
+  if (!_each) _each = each;
</ins><span class="cx"> 
</span><del>-  clear: function() {
</del><ins>+  function clear() {
</ins><span class="cx">     this.length = 0;
</span><span class="cx">     return this;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  first: function() {
</del><ins>+  function first() {
</ins><span class="cx">     return this[0];
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  last: function() {
</del><ins>+  function last() {
</ins><span class="cx">     return this[this.length - 1];
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  compact: function() {
</del><ins>+  function compact() {
</ins><span class="cx">     return this.select(function(value) {
</span><span class="cx">       return value != null;
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  flatten: function() {
</del><ins>+  function flatten() {
</ins><span class="cx">     return this.inject([], function(array, value) {
</span><del>-      return array.concat(Object.isArray(value) ?
-        value.flatten() : [value]);
</del><ins>+      if (Object.isArray(value))
+        return array.concat(value.flatten());
+      array.push(value);
+      return array;
</ins><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  without: function() {
-    var values = $A(arguments);
</del><ins>+  function without() {
+    var values = slice.call(arguments, 0);
</ins><span class="cx">     return this.select(function(value) {
</span><span class="cx">       return !values.include(value);
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  reverse: function(inline) {
</del><ins>+  function reverse(inline) {
</ins><span class="cx">     return (inline !== false ? this : this.toArray())._reverse();
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  reduce: function() {
-    return this.length &gt; 1 ? this : this[0];
-  },
-
-  uniq: function(sorted) {
</del><ins>+  function uniq(sorted) {
</ins><span class="cx">     return this.inject([], function(array, value, index) {
</span><span class="cx">       if (0 == index || (sorted ? array.last() != value : !array.include(value)))
</span><span class="cx">         array.push(value);
</span><span class="cx">       return array;
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  intersect: function(array) {
</del><ins>+  function intersect(array) {
</ins><span class="cx">     return this.uniq().findAll(function(item) {
</span><span class="cx">       return array.detect(function(value) { return item === value });
</span><span class="cx">     });
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  clone: function() {
-    return [].concat(this);
-  },
</del><span class="cx"> 
</span><del>-  size: function() {
</del><ins>+  function clone() {
+    return slice.call(this, 0);
+  }
+
+  function size() {
</ins><span class="cx">     return this.length;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  inspect: function() {
</del><ins>+  function inspect() {
</ins><span class="cx">     return '[' + this.map(Object.inspect).join(', ') + ']';
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  toJSON: function() {
</del><ins>+  function toJSON() {
</ins><span class="cx">     var results = [];
</span><span class="cx">     this.each(function(object) {
</span><span class="cx">       var value = Object.toJSON(object);
</span><del>-      if (value !== undefined) results.push(value);
</del><ins>+      if (!Object.isUndefined(value)) results.push(value);
</ins><span class="cx">     });
</span><span class="cx">     return '[' + results.join(', ') + ']';
</span><span class="cx">   }
</span><del>-});
</del><span class="cx"> 
</span><del>-// use native browser JS 1.6 implementation if available
-if (Object.isFunction(Array.prototype.forEach))
-  Array.prototype._each = Array.prototype.forEach;
</del><ins>+  function indexOf(item, i) {
+    i || (i = 0);
+    var length = this.length;
+    if (i &lt; 0) i = length + i;
+    for (; i &lt; length; i++)
+      if (this[i] === item) return i;
+    return -1;
+  }
</ins><span class="cx"> 
</span><del>-if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
-  i || (i = 0);
-  var length = this.length;
-  if (i &lt; 0) i = length + i;
-  for (; i &lt; length; i++)
-    if (this[i] === item) return i;
-  return -1;
-};
</del><ins>+  function lastIndexOf(item, i) {
+    i = isNaN(i) ? this.length : (i &lt; 0 ? this.length + i : i) + 1;
+    var n = this.slice(0, i).reverse().indexOf(item);
+    return (n &lt; 0) ? n : i - n - 1;
+  }
</ins><span class="cx"> 
</span><del>-if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
-  i = isNaN(i) ? this.length : (i &lt; 0 ? this.length + i : i) + 1;
-  var n = this.slice(0, i).reverse().indexOf(item);
-  return (n &lt; 0) ? n : i - n - 1;
-};
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string) {
-  if (!Object.isString(string)) return [];
-  string = string.strip();
-  return string ? string.split(/\s+/) : [];
-}
-
-if (Prototype.Browser.Opera){
-  Array.prototype.concat = function() {
-    var array = [];
-    for (var i = 0, length = this.length; i &lt; length; i++) array.push(this[i]);
</del><ins>+  function concat() {
+    var array = slice.call(this, 0), item;
</ins><span class="cx">     for (var i = 0, length = arguments.length; i &lt; length; i++) {
</span><del>-      if (Object.isArray(arguments[i])) {
-        for (var j = 0, arrayLength = arguments[i].length; j &lt; arrayLength; j++)
-          array.push(arguments[i][j]);
</del><ins>+      item = arguments[i];
+      if (Object.isArray(item) &amp;&amp; !('callee' in item)) {
+        for (var j = 0, arrayLength = item.length; j &lt; arrayLength; j++)
+          array.push(item[j]);
</ins><span class="cx">       } else {
</span><del>-        array.push(arguments[i]);
</del><ins>+        array.push(item);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     return array;
</span><del>-  };
-}
-Object.extend(Number.prototype, {
-  toColorPart: function() {
-    return this.toPaddedString(2, 16);
-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  succ: function() {
-    return this + 1;
-  },
</del><ins>+  Object.extend(arrayProto, Enumerable);
</ins><span class="cx"> 
</span><del>-  times: function(iterator) {
-    $R(0, this, true).each(iterator);
-    return this;
-  },
</del><ins>+  if (!arrayProto._reverse)
+    arrayProto._reverse = arrayProto.reverse;
</ins><span class="cx"> 
</span><del>-  toPaddedString: function(length, radix) {
-    var string = this.toString(radix || 10);
-    return '0'.times(length - string.length) + string;
-  },
</del><ins>+  Object.extend(arrayProto, {
+    _each:     _each,
+    clear:     clear,
+    first:     first,
+    last:      last,
+    compact:   compact,
+    flatten:   flatten,
+    without:   without,
+    reverse:   reverse,
+    uniq:      uniq,
+    intersect: intersect,
+    clone:     clone,
+    toArray:   clone,
+    size:      size,
+    inspect:   inspect,
+    toJSON:    toJSON
+  });
</ins><span class="cx"> 
</span><del>-  toJSON: function() {
-    return isFinite(this) ? this.toString() : 'null';
-  }
-});
</del><ins>+  var CONCAT_ARGUMENTS_BUGGY = (function() {
+    return [].concat(arguments)[0][0] !== 1;
+  })(1,2)
</ins><span class="cx"> 
</span><del>-$w('abs round ceil floor').each(function(method){
-  Number.prototype[method] = Math[method].methodize();
-});
</del><ins>+  if (CONCAT_ARGUMENTS_BUGGY) arrayProto.concat = concat;
+
+  if (!arrayProto.indexOf) arrayProto.indexOf = indexOf;
+  if (!arrayProto.lastIndexOf) arrayProto.lastIndexOf = lastIndexOf;
+})();
</ins><span class="cx"> function $H(object) {
</span><span class="cx">   return new Hash(object);
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> var Hash = Class.create(Enumerable, (function() {
</span><del>-  if (function() {
-    var i = 0, Test = function(value) { this.key = value };
-    Test.prototype.key = 'foo';
-    for (var property in new Test('bar')) i++;
-    return i &gt; 1;
-  }()) {
-    function each(iterator) {
-      var cache = [];
-      for (var key in this._object) {
-        var value = this._object[key];
-        if (cache.include(key)) continue;
-        cache.push(key);
-        var pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
</del><ins>+  function initialize(object) {
+    this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
+  }
+
+  function _each(iterator) {
+    for (var key in this._object) {
+      var value = this._object[key], pair = [key, value];
+      pair.key = key;
+      pair.value = value;
+      iterator(pair);
</ins><span class="cx">     }
</span><del>-  } else {
-    function each(iterator) {
-      for (var key in this._object) {
-        var value = this._object[key], pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
-    }
</del><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  function set(key, value) {
+    return this._object[key] = value;
+  }
+
+  function get(key) {
+    if (this._object[key] !== Object.prototype[key])
+      return this._object[key];
+  }
+
+  function unset(key) {
+    var value = this._object[key];
+    delete this._object[key];
+    return value;
+  }
+
+  function toObject() {
+    return Object.clone(this._object);
+  }
+
+  function keys() {
+    return this.pluck('key');
+  }
+
+  function values() {
+    return this.pluck('value');
+  }
+
+  function index(value) {
+    var match = this.detect(function(pair) {
+      return pair.value === value;
+    });
+    return match &amp;&amp; match.key;
+  }
+
+  function merge(object) {
+    return this.clone().update(object);
+  }
+
+  function update(object) {
+    return new Hash(object).inject(this, function(result, pair) {
+      result.set(pair.key, pair.value);
+      return result;
+    });
+  }
+
</ins><span class="cx">   function toQueryPair(key, value) {
</span><span class="cx">     if (Object.isUndefined(value)) return key;
</span><span class="cx">     return key + '=' + encodeURIComponent(String.interpret(value));
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-  return {
-    initialize: function(object) {
-      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
-    },
</del><ins>+  function toQueryString() {
+    return this.inject([], function(results, pair) {
+      var key = encodeURIComponent(pair.key), values = pair.value;
</ins><span class="cx"> 
</span><del>-    _each: each,
</del><ins>+      if (values &amp;&amp; typeof values == 'object') {
+        if (Object.isArray(values))
+          return results.concat(values.map(toQueryPair.curry(key)));
+      } else results.push(toQueryPair(key, values));
+      return results;
+    }).join('&amp;');
+  }
</ins><span class="cx"> 
</span><del>-    set: function(key, value) {
-      return this._object[key] = value;
-    },
</del><ins>+  function inspect() {
+    return '#&lt;Hash:{' + this.map(function(pair) {
+      return pair.map(Object.inspect).join(': ');
+    }).join(', ') + '}&gt;';
+  }
</ins><span class="cx"> 
</span><del>-    get: function(key) {
-      return this._object[key];
-    },
</del><ins>+  function toJSON() {
+    return Object.toJSON(this.toObject());
+  }
</ins><span class="cx"> 
</span><del>-    unset: function(key) {
-      var value = this._object[key];
-      delete this._object[key];
-      return value;
-    },
</del><ins>+  function clone() {
+    return new Hash(this);
+  }
</ins><span class="cx"> 
</span><del>-    toObject: function() {
-      return Object.clone(this._object);
-    },
</del><ins>+  return {
+    initialize:             initialize,
+    _each:                  _each,
+    set:                    set,
+    get:                    get,
+    unset:                  unset,
+    toObject:               toObject,
+    toTemplateReplacements: toObject,
+    keys:                   keys,
+    values:                 values,
+    index:                  index,
+    merge:                  merge,
+    update:                 update,
+    toQueryString:          toQueryString,
+    inspect:                inspect,
+    toJSON:                 toJSON,
+    clone:                  clone
+  };
+})());
</ins><span class="cx"> 
</span><del>-    keys: function() {
-      return this.pluck('key');
-    },
</del><ins>+Hash.from = $H;
+Object.extend(Number.prototype, (function() {
+  function toColorPart() {
+    return this.toPaddedString(2, 16);
+  }
</ins><span class="cx"> 
</span><del>-    values: function() {
-      return this.pluck('value');
-    },
</del><ins>+  function succ() {
+    return this + 1;
+  }
</ins><span class="cx"> 
</span><del>-    index: function(value) {
-      var match = this.detect(function(pair) {
-        return pair.value === value;
-      });
-      return match &amp;&amp; match.key;
-    },
</del><ins>+  function times(iterator, context) {
+    $R(0, this, true).each(iterator, context);
+    return this;
+  }
</ins><span class="cx"> 
</span><del>-    merge: function(object) {
-      return this.clone().update(object);
-    },
</del><ins>+  function toPaddedString(length, radix) {
+    var string = this.toString(radix || 10);
+    return '0'.times(length - string.length) + string;
+  }
</ins><span class="cx"> 
</span><del>-    update: function(object) {
-      return new Hash(object).inject(this, function(result, pair) {
-        result.set(pair.key, pair.value);
-        return result;
-      });
-    },
</del><ins>+  function toJSON() {
+    return isFinite(this) ? this.toString() : 'null';
+  }
</ins><span class="cx"> 
</span><del>-    toQueryString: function() {
-      return this.map(function(pair) {
-        var key = encodeURIComponent(pair.key), values = pair.value;
</del><ins>+  function abs() {
+    return Math.abs(this);
+  }
</ins><span class="cx"> 
</span><del>-        if (values &amp;&amp; typeof values == 'object') {
-          if (Object.isArray(values))
-            return values.map(toQueryPair.curry(key)).join('&amp;');
-        }
-        return toQueryPair(key, values);
-      }).join('&amp;');
-    },
</del><ins>+  function round() {
+    return Math.round(this);
+  }
</ins><span class="cx"> 
</span><del>-    inspect: function() {
-      return '#&lt;Hash:{' + this.map(function(pair) {
-        return pair.map(Object.inspect).join(': ');
-      }).join(', ') + '}&gt;';
-    },
</del><ins>+  function ceil() {
+    return Math.ceil(this);
+  }
</ins><span class="cx"> 
</span><del>-    toJSON: function() {
-      return Object.toJSON(this.toObject());
-    },
</del><ins>+  function floor() {
+    return Math.floor(this);
+  }
</ins><span class="cx"> 
</span><del>-    clone: function() {
-      return new Hash(this);
-    }
-  }
</del><ins>+  return {
+    toColorPart:    toColorPart,
+    succ:           succ,
+    times:          times,
+    toPaddedString: toPaddedString,
+    toJSON:         toJSON,
+    abs:            abs,
+    round:          round,
+    ceil:           ceil,
+    floor:          floor
+  };
</ins><span class="cx"> })());
</span><span class="cx"> 
</span><del>-Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
-Hash.from = $H;
-var ObjectRange = Class.create(Enumerable, {
-  initialize: function(start, end, exclusive) {
</del><ins>+function $R(start, end, exclusive) {
+  return new ObjectRange(start, end, exclusive);
+}
+
+var ObjectRange = Class.create(Enumerable, (function() {
+  function initialize(start, end, exclusive) {
</ins><span class="cx">     this.start = start;
</span><span class="cx">     this.end = end;
</span><span class="cx">     this.exclusive = exclusive;
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  _each: function(iterator) {
</del><ins>+  function _each(iterator) {
</ins><span class="cx">     var value = this.start;
</span><span class="cx">     while (this.include(value)) {
</span><span class="cx">       iterator(value);
</span><span class="cx">       value = value.succ();
</span><span class="cx">     }
</span><del>-  },
</del><ins>+  }
</ins><span class="cx"> 
</span><del>-  include: function(value) {
</del><ins>+  function include(value) {
</ins><span class="cx">     if (value &lt; this.start)
</span><span class="cx">       return false;
</span><span class="cx">     if (this.exclusive)
</span><span class="cx">       return value &lt; this.end;
</span><span class="cx">     return value &lt;= this.end;
</span><span class="cx">   }
</span><del>-});
</del><span class="cx"> 
</span><del>-var $R = function(start, end, exclusive) {
-  return new ObjectRange(start, end, exclusive);
-};
</del><ins>+  return {
+    initialize: initialize,
+    _each:      _each,
+    include:    include
+  };
+})());
</ins><span class="cx"> 
</span><ins>+
+
</ins><span class="cx"> var Ajax = {
</span><span class="cx">   getTransport: function() {
</span><span class="cx">     return Try.these(
</span><span class="lines">@@ -1172,7 +1355,6 @@
</span><span class="cx">   onCreate:   function() { Ajax.activeRequestCount++ },
</span><span class="cx">   onComplete: function() { Ajax.activeRequestCount-- }
</span><span class="cx"> });
</span><del>-
</del><span class="cx"> Ajax.Base = Class.create({
</span><span class="cx">   initialize: function(options) {
</span><span class="cx">     this.options = {
</span><span class="lines">@@ -1187,11 +1369,13 @@
</span><span class="cx">     Object.extend(this.options, options || { });
</span><span class="cx"> 
</span><span class="cx">     this.options.method = this.options.method.toLowerCase();
</span><ins>+
</ins><span class="cx">     if (Object.isString(this.options.parameters))
</span><span class="cx">       this.options.parameters = this.options.parameters.toQueryParams();
</span><ins>+    else if (Object.isHash(this.options.parameters))
+      this.options.parameters = this.options.parameters.toObject();
</ins><span class="cx">   }
</span><span class="cx"> });
</span><del>-
</del><span class="cx"> Ajax.Request = Class.create(Ajax.Base, {
</span><span class="cx">   _complete: false,
</span><span class="cx"> 
</span><span class="lines">@@ -1207,7 +1391,6 @@
</span><span class="cx">     var params = Object.clone(this.options.parameters);
</span><span class="cx"> 
</span><span class="cx">     if (!['get', 'post'].include(this.method)) {
</span><del>-      // simulate other verbs over post
</del><span class="cx">       params['_method'] = this.method;
</span><span class="cx">       this.method = 'post';
</span><span class="cx">     }
</span><span class="lines">@@ -1215,7 +1398,6 @@
</span><span class="cx">     this.parameters = params;
</span><span class="cx"> 
</span><span class="cx">     if (params = Object.toQueryString(params)) {
</span><del>-      // when GET, append parameters to URL
</del><span class="cx">       if (this.method == 'get')
</span><span class="cx">         this.url += (this.url.include('?') ? '&amp;' : '?') + params;
</span><span class="cx">       else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
</span><span class="lines">@@ -1274,7 +1456,6 @@
</span><span class="cx">             headers['Connection'] = 'close';
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // user-defined headers
</del><span class="cx">     if (typeof this.options.requestHeaders == 'object') {
</span><span class="cx">       var extras = this.options.requestHeaders;
</span><span class="cx"> 
</span><span class="lines">@@ -1315,7 +1496,7 @@
</span><span class="cx"> 
</span><span class="cx">       var contentType = response.getHeader('Content-type');
</span><span class="cx">       if (this.options.evalJS == 'force'
</span><del>-          || (this.options.evalJS &amp;&amp; contentType
</del><ins>+          || (this.options.evalJS &amp;&amp; this.isSameOrigin() &amp;&amp; contentType
</ins><span class="cx">           &amp;&amp; contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
</span><span class="cx">         this.evalResponse();
</span><span class="cx">     }
</span><span class="lines">@@ -1328,15 +1509,23 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (state == 'Complete') {
</span><del>-      // avoid memory leak in MSIE: clean up
</del><span class="cx">       this.transport.onreadystatechange = Prototype.emptyFunction;
</span><span class="cx">     }
</span><span class="cx">   },
</span><span class="cx"> 
</span><ins>+  isSameOrigin: function() {
+    var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
+    return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
+      protocol: location.protocol,
+      domain: document.domain,
+      port: location.port ? ':' + location.port : ''
+    }));
+  },
+
</ins><span class="cx">   getHeader: function(name) {
</span><span class="cx">     try {
</span><del>-      return this.transport.getResponseHeader(name);
-    } catch (e) { return null }
</del><ins>+      return this.transport.getResponseHeader(name) || null;
+    } catch (e) { return null; }
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   evalResponse: function() {
</span><span class="lines">@@ -1356,6 +1545,13 @@
</span><span class="cx"> Ajax.Request.Events =
</span><span class="cx">   ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
</span><span class="cx"> 
</span><ins>+
+
+
+
+
+
+
</ins><span class="cx"> Ajax.Response = Class.create({
</span><span class="cx">   initialize: function(request){
</span><span class="cx">     this.request = request;
</span><span class="lines">@@ -1371,12 +1567,13 @@
</span><span class="cx"> 
</span><span class="cx">     if(readyState == 4) {
</span><span class="cx">       var xml = transport.responseXML;
</span><del>-      this.responseXML  = xml === undefined ? null : xml;
</del><ins>+      this.responseXML  = Object.isUndefined(xml) ? null : xml;
</ins><span class="cx">       this.responseJSON = this._getResponseJSON();
</span><span class="cx">     }
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   status:      0,
</span><ins>+
</ins><span class="cx">   statusText: '',
</span><span class="cx"> 
</span><span class="cx">   getStatus: Ajax.Request.prototype.getStatus,
</span><span class="lines">@@ -1408,7 +1605,8 @@
</span><span class="cx">     if (!json) return null;
</span><span class="cx">     json = decodeURIComponent(escape(json));
</span><span class="cx">     try {
</span><del>-      return json.evalJSON(this.request.options.sanitizeJSON);
</del><ins>+      return json.evalJSON(this.request.options.sanitizeJSON ||
+        !this.request.isSameOrigin());
</ins><span class="cx">     } catch (e) {
</span><span class="cx">       this.request.dispatchException(e);
</span><span class="cx">     }
</span><span class="lines">@@ -1417,10 +1615,12 @@
</span><span class="cx">   _getResponseJSON: function() {
</span><span class="cx">     var options = this.request.options;
</span><span class="cx">     if (!options.evalJSON || (options.evalJSON != 'force' &amp;&amp;
</span><del>-      !(this.getHeader('Content-type') || '').include('application/json')))
-        return null;
</del><ins>+      !(this.getHeader('Content-type') || '').include('application/json')) ||
+        this.responseText.blank())
+          return null;
</ins><span class="cx">     try {
</span><del>-      return this.transport.responseText.evalJSON(options.sanitizeJSON);
</del><ins>+      return this.responseText.evalJSON(options.sanitizeJSON ||
+        !this.request.isSameOrigin());
</ins><span class="cx">     } catch (e) {
</span><span class="cx">       this.request.dispatchException(e);
</span><span class="cx">     }
</span><span class="lines">@@ -1434,11 +1634,11 @@
</span><span class="cx">       failure: (container.failure || (container.success ? null : container))
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    options = options || { };
</del><ins>+    options = Object.clone(options);
</ins><span class="cx">     var onComplete = options.onComplete;
</span><del>-    options.onComplete = (function(response, param) {
</del><ins>+    options.onComplete = (function(response, json) {
</ins><span class="cx">       this.updateContent(response.responseText);
</span><del>-      if (Object.isFunction(onComplete)) onComplete(response, param);
</del><ins>+      if (Object.isFunction(onComplete)) onComplete(response, json);
</ins><span class="cx">     }).bind(this);
</span><span class="cx"> 
</span><span class="cx">     $super(url, options);
</span><span class="lines">@@ -1460,10 +1660,6 @@
</span><span class="cx">       }
</span><span class="cx">       else receiver.update(responseText);
</span><span class="cx">     }
</span><del>-
-    if (this.success()) {
-      if (this.onComplete) this.onComplete.bind(this).defer();
-    }
</del><span class="cx">   }
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="lines">@@ -1507,6 +1703,9 @@
</span><span class="cx">     this.updater = new Ajax.Updater(this.container, this.url, this.options);
</span><span class="cx">   }
</span><span class="cx"> });
</span><ins>+
+
+
</ins><span class="cx"> function $(element) {
</span><span class="cx">   if (arguments.length &gt; 1) {
</span><span class="cx">     for (var i = 0, elements = [], length = arguments.length; i &lt; length; i++)
</span><span class="lines">@@ -1534,7 +1733,6 @@
</span><span class="cx"> if (!window.Node) var Node = { };
</span><span class="cx"> 
</span><span class="cx"> if (!Node.ELEMENT_NODE) {
</span><del>-  // DOM level 2 ECMAScript Language Binding
</del><span class="cx">   Object.extend(Node, {
</span><span class="cx">     ELEMENT_NODE: 1,
</span><span class="cx">     ATTRIBUTE_NODE: 2,
</span><span class="lines">@@ -1551,13 +1749,30 @@
</span><span class="cx">   });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-(function() {
-  var element = this.Element;
-  this.Element = function(tagName, attributes) {
</del><ins>+
+(function(global) {
+
+  var SETATTRIBUTE_IGNORES_NAME = (function(){
+    var elForm = document.createElement(&quot;form&quot;);
+    var elInput = document.createElement(&quot;input&quot;);
+    var root = document.documentElement;
+    elInput.setAttribute(&quot;name&quot;, &quot;test&quot;);
+    elForm.appendChild(elInput);
+    root.appendChild(elForm);
+    var isBuggy = elForm.elements
+      ? (typeof elForm.elements.test == &quot;undefined&quot;)
+      : null;
+    root.removeChild(elForm);
+    elForm = elInput = null;
+    return isBuggy;
+  })();
+
+  var element = global.Element;
+  global.Element = function(tagName, attributes) {
</ins><span class="cx">     attributes = attributes || { };
</span><span class="cx">     tagName = tagName.toLowerCase();
</span><span class="cx">     var cache = Element.cache;
</span><del>-    if (Prototype.Browser.IE &amp;&amp; attributes.name) {
</del><ins>+    if (SETATTRIBUTE_IGNORES_NAME &amp;&amp; attributes.name) {
</ins><span class="cx">       tagName = '&lt;' + tagName + ' name=&quot;' + attributes.name + '&quot;&gt;';
</span><span class="cx">       delete attributes.name;
</span><span class="cx">       return Element.writeAttribute(document.createElement(tagName), attributes);
</span><span class="lines">@@ -1565,10 +1780,12 @@
</span><span class="cx">     if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
</span><span class="cx">     return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
</span><span class="cx">   };
</span><del>-  Object.extend(this.Element, element || { });
-}).call(window);
</del><ins>+  Object.extend(global.Element, element || { });
+  if (element) global.Element.prototype = element.prototype;
+})(this);
</ins><span class="cx"> 
</span><span class="cx"> Element.cache = { };
</span><ins>+Element.idCounter = 1;
</ins><span class="cx"> 
</span><span class="cx"> Element.Methods = {
</span><span class="cx">   visible: function(element) {
</span><span class="lines">@@ -1581,13 +1798,16 @@
</span><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx">   hide: function(element) {
</span><del>-    $(element).style.display = 'none';
</del><ins>+    element = $(element);
+    element.style.display = 'none';
</ins><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   show: function(element) {
</span><del>-    $(element).style.display = '';
</del><ins>+    element = $(element);
+    element.style.display = '';
</ins><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -1597,16 +1817,90 @@
</span><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  update: function(element, content) {
-    element = $(element);
-    if (content &amp;&amp; content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-    content = Object.toHTML(content);
-    element.innerHTML = content.stripScripts();
-    content.evalScripts.bind(content).defer();
-    return element;
-  },
</del><ins>+  update: (function(){
</ins><span class="cx"> 
</span><ins>+    var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
+      var el = document.createElement(&quot;select&quot;),
+          isBuggy = true;
+      el.innerHTML = &quot;&lt;option value=\&quot;test\&quot;&gt;test&lt;/option&gt;&quot;;
+      if (el.options &amp;&amp; el.options[0]) {
+        isBuggy = el.options[0].nodeName.toUpperCase() !== &quot;OPTION&quot;;
+      }
+      el = null;
+      return isBuggy;
+    })();
+
+    var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
+      try {
+        var el = document.createElement(&quot;table&quot;);
+        if (el &amp;&amp; el.tBodies) {
+          el.innerHTML = &quot;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&quot;;
+          var isBuggy = typeof el.tBodies[0] == &quot;undefined&quot;;
+          el = null;
+          return isBuggy;
+        }
+      } catch (e) {
+        return true;
+      }
+    })();
+
+    var SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING = (function () {
+      var s = document.createElement(&quot;script&quot;),
+          isBuggy = false;
+      try {
+        s.appendChild(document.createTextNode(&quot;&quot;));
+        isBuggy = !s.firstChild ||
+          s.firstChild &amp;&amp; s.firstChild.nodeType !== 3;
+      } catch (e) {
+        isBuggy = true;
+      }
+      s = null;
+      return isBuggy;
+    })();
+
+    function update(element, content) {
+      element = $(element);
+
+      if (content &amp;&amp; content.toElement)
+        content = content.toElement();
+
+      if (Object.isElement(content))
+        return element.update().insert(content);
+
+      content = Object.toHTML(content);
+
+      var tagName = element.tagName.toUpperCase();
+
+      if (tagName === 'SCRIPT' &amp;&amp; SCRIPT_ELEMENT_REJECTS_TEXTNODE_APPENDING) {
+        element.text = content;
+        return element;
+      }
+
+      if (SELECT_ELEMENT_INNERHTML_BUGGY || TABLE_ELEMENT_INNERHTML_BUGGY) {
+        if (tagName in Element._insertionTranslations.tags) {
+          while (element.firstChild) {
+            element.removeChild(element.firstChild);
+          }
+          Element._getContentFromAnonymousElement(tagName, content.stripScripts())
+            .each(function(node) {
+              element.appendChild(node)
+            });
+        }
+        else {
+          element.innerHTML = content.stripScripts();
+        }
+      }
+      else {
+        element.innerHTML = content.stripScripts();
+      }
+
+      content.evalScripts.bind(content).defer();
+      return element;
+    }
+
+    return update;
+  })(),
+
</ins><span class="cx">   replace: function(element, content) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     if (content &amp;&amp; content.toElement) content = content.toElement();
</span><span class="lines">@@ -1628,25 +1922,29 @@
</span><span class="cx">         Object.isElement(insertions) || (insertions &amp;&amp; (insertions.toElement || insertions.toHTML)))
</span><span class="cx">           insertions = {bottom:insertions};
</span><span class="cx"> 
</span><del>-    var content, t, range;
</del><ins>+    var content, insert, tagName, childNodes;
</ins><span class="cx"> 
</span><del>-    for (position in insertions) {
</del><ins>+    for (var position in insertions) {
</ins><span class="cx">       content  = insertions[position];
</span><span class="cx">       position = position.toLowerCase();
</span><del>-      t = Element._insertionTranslations[position];
</del><ins>+      insert = Element._insertionTranslations[position];
</ins><span class="cx"> 
</span><span class="cx">       if (content &amp;&amp; content.toElement) content = content.toElement();
</span><span class="cx">       if (Object.isElement(content)) {
</span><del>-        t.insert(element, content);
</del><ins>+        insert(element, content);
</ins><span class="cx">         continue;
</span><span class="cx">       }
</span><span class="cx"> 
</span><span class="cx">       content = Object.toHTML(content);
</span><span class="cx"> 
</span><del>-      range = element.ownerDocument.createRange();
-      t.initializeRange(element, range);
-      t.insert(element, range.createContextualFragment(content.stripScripts()));
</del><ins>+      tagName = ((position == 'before' || position == 'after')
+        ? element.parentNode : element).tagName.toUpperCase();
</ins><span class="cx"> 
</span><ins>+      childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
+
+      if (position == 'top' || position == 'after') childNodes.reverse();
+      childNodes.each(insert.curry(element));
+
</ins><span class="cx">       content.evalScripts.bind(content).defer();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1686,11 +1984,11 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   ancestors: function(element) {
</span><del>-    return $(element).recursivelyCollect('parentNode');
</del><ins>+    return Element.recursivelyCollect(element, 'parentNode');
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   descendants: function(element) {
</span><del>-    return $A($(element).getElementsByTagName('*')).each(Element.extend);
</del><ins>+    return Element.select(element, &quot;*&quot;);
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   firstDescendant: function(element) {
</span><span class="lines">@@ -1707,16 +2005,17 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   previousSiblings: function(element) {
</span><del>-    return $(element).recursivelyCollect('previousSibling');
</del><ins>+    return Element.recursivelyCollect(element, 'previousSibling');
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   nextSiblings: function(element) {
</span><del>-    return $(element).recursivelyCollect('nextSibling');
</del><ins>+    return Element.recursivelyCollect(element, 'nextSibling');
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   siblings: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    return element.previousSiblings().reverse().concat(element.nextSiblings());
</del><ins>+    return Element.previousSiblings(element).reverse()
+      .concat(Element.nextSiblings(element));
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   match: function(element, selector) {
</span><span class="lines">@@ -1728,51 +2027,51 @@
</span><span class="cx">   up: function(element, expression, index) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     if (arguments.length == 1) return $(element.parentNode);
</span><del>-    var ancestors = element.ancestors();
-    return expression ? Selector.findElement(ancestors, expression, index) :
-      ancestors[index || 0];
</del><ins>+    var ancestors = Element.ancestors(element);
+    return Object.isNumber(expression) ? ancestors[expression] :
+      Selector.findElement(ancestors, expression, index);
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   down: function(element, expression, index) {
</span><span class="cx">     element = $(element);
</span><del>-    if (arguments.length == 1) return element.firstDescendant();
-    var descendants = element.descendants();
-    return expression ? Selector.findElement(descendants, expression, index) :
-      descendants[index || 0];
</del><ins>+    if (arguments.length == 1) return Element.firstDescendant(element);
+    return Object.isNumber(expression) ? Element.descendants(element)[expression] :
+      Element.select(element, expression)[index || 0];
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   previous: function(element, expression, index) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
</span><del>-    var previousSiblings = element.previousSiblings();
-    return expression ? Selector.findElement(previousSiblings, expression, index) :
-      previousSiblings[index || 0];
</del><ins>+    var previousSiblings = Element.previousSiblings(element);
+    return Object.isNumber(expression) ? previousSiblings[expression] :
+      Selector.findElement(previousSiblings, expression, index);
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   next: function(element, expression, index) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
</span><del>-    var nextSiblings = element.nextSiblings();
-    return expression ? Selector.findElement(nextSiblings, expression, index) :
-      nextSiblings[index || 0];
</del><ins>+    var nextSiblings = Element.nextSiblings(element);
+    return Object.isNumber(expression) ? nextSiblings[expression] :
+      Selector.findElement(nextSiblings, expression, index);
</ins><span class="cx">   },
</span><span class="cx"> 
</span><del>-  select: function() {
-    var args = $A(arguments), element = $(args.shift());
</del><ins>+
+  select: function(element) {
+    var args = Array.prototype.slice.call(arguments, 1);
</ins><span class="cx">     return Selector.findChildElements(element, args);
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  adjacent: function() {
-    var args = $A(arguments), element = $(args.shift());
</del><ins>+  adjacent: function(element) {
+    var args = Array.prototype.slice.call(arguments, 1);
</ins><span class="cx">     return Selector.findChildElements(element.parentNode, args).without(element);
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   identify: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    var id = element.readAttribute('id'), self = arguments.callee;
</del><ins>+    var id = Element.readAttribute(element, 'id');
</ins><span class="cx">     if (id) return id;
</span><del>-    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
-    element.writeAttribute('id', id);
</del><ins>+    do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
+    Element.writeAttribute(element, 'id', id);
</ins><span class="cx">     return id;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -1795,10 +2094,11 @@
</span><span class="cx">     var attributes = { }, t = Element._attributeTranslations.write;
</span><span class="cx"> 
</span><span class="cx">     if (typeof name == 'object') attributes = name;
</span><del>-    else attributes[name] = value === undefined ? true : value;
</del><ins>+    else attributes[name] = Object.isUndefined(value) ? true : value;
</ins><span class="cx"> 
</span><span class="cx">     for (var attr in attributes) {
</span><del>-      var name = t.names[attr] || attr, value = attributes[attr];
</del><ins>+      name = t.names[attr] || attr;
+      value = attributes[attr];
</ins><span class="cx">       if (t.values[attr]) name = t.values[attr](element, value);
</span><span class="cx">       if (value === false || value === null)
</span><span class="cx">         element.removeAttribute(name);
</span><span class="lines">@@ -1810,11 +2110,11 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   getHeight: function(element) {
</span><del>-    return $(element).getDimensions().height;
</del><ins>+    return Element.getDimensions(element).height;
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   getWidth: function(element) {
</span><del>-    return $(element).getDimensions().width;
</del><ins>+    return Element.getDimensions(element).width;
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   classNames: function(element) {
</span><span class="lines">@@ -1830,7 +2130,7 @@
</span><span class="cx"> 
</span><span class="cx">   addClassName: function(element, className) {
</span><span class="cx">     if (!(element = $(element))) return;
</span><del>-    if (!element.hasClassName(className))
</del><ins>+    if (!Element.hasClassName(element, className))
</ins><span class="cx">       element.className += (element.className ? ' ' : '') + className;
</span><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="lines">@@ -1844,11 +2144,10 @@
</span><span class="cx"> 
</span><span class="cx">   toggleClassName: function(element, className) {
</span><span class="cx">     if (!(element = $(element))) return;
</span><del>-    return element[element.hasClassName(className) ?
-      'removeClassName' : 'addClassName'](className);
</del><ins>+    return Element[Element.hasClassName(element, className) ?
+      'removeClassName' : 'addClassName'](element, className);
</ins><span class="cx">   },
</span><span class="cx"> 
</span><del>-  // removes whitespace-only text node children
</del><span class="cx">   cleanWhitespace: function(element) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     var node = element.firstChild;
</span><span class="lines">@@ -1871,24 +2170,18 @@
</span><span class="cx">     if (element.compareDocumentPosition)
</span><span class="cx">       return (element.compareDocumentPosition(ancestor) &amp; 8) === 8;
</span><span class="cx"> 
</span><del>-    if (element.sourceIndex &amp;&amp; !Prototype.Browser.Opera) {
-      var e = element.sourceIndex, a = ancestor.sourceIndex,
-       nextAncestor = ancestor.nextSibling;
-      if (!nextAncestor) {
-        do { ancestor = ancestor.parentNode; }
-        while (!(nextAncestor = ancestor.nextSibling) &amp;&amp; ancestor.parentNode);
-      }
-      if (nextAncestor) return (e &gt; a &amp;&amp; e &lt; nextAncestor.sourceIndex);
-    }
</del><ins>+    if (ancestor.contains)
+      return ancestor.contains(element) &amp;&amp; ancestor !== element;
</ins><span class="cx"> 
</span><span class="cx">     while (element = element.parentNode)
</span><span class="cx">       if (element == ancestor) return true;
</span><ins>+
</ins><span class="cx">     return false;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   scrollTo: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    var pos = element.cumulativeOffset();
</del><ins>+    var pos = Element.cumulativeOffset(element);
</ins><span class="cx">     window.scrollTo(pos[0], pos[1]);
</span><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="lines">@@ -1897,7 +2190,7 @@
</span><span class="cx">     element = $(element);
</span><span class="cx">     style = style == 'float' ? 'cssFloat' : style.camelize();
</span><span class="cx">     var value = element.style[style];
</span><del>-    if (!value) {
</del><ins>+    if (!value || value == 'auto') {
</ins><span class="cx">       var css = document.defaultView.getComputedStyle(element, null);
</span><span class="cx">       value = css ? css[style] : null;
</span><span class="cx">     }
</span><span class="lines">@@ -1921,7 +2214,7 @@
</span><span class="cx">       if (property == 'opacity') element.setOpacity(styles[property]);
</span><span class="cx">       else
</span><span class="cx">         elementStyle[(property == 'float' || property == 'cssFloat') ?
</span><del>-          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
</del><ins>+          (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
</ins><span class="cx">             property] = styles[property];
</span><span class="cx"> 
</span><span class="cx">     return element;
</span><span class="lines">@@ -1936,18 +2229,17 @@
</span><span class="cx"> 
</span><span class="cx">   getDimensions: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    var display = $(element).getStyle('display');
</del><ins>+    var display = Element.getStyle(element, 'display');
</ins><span class="cx">     if (display != 'none' &amp;&amp; display != null) // Safari bug
</span><span class="cx">       return {width: element.offsetWidth, height: element.offsetHeight};
</span><span class="cx"> 
</span><del>-    // All *Width and *Height properties give 0 on elements with display none,
-    // so enable the element temporarily
</del><span class="cx">     var els = element.style;
</span><span class="cx">     var originalVisibility = els.visibility;
</span><span class="cx">     var originalPosition = els.position;
</span><span class="cx">     var originalDisplay = els.display;
</span><span class="cx">     els.visibility = 'hidden';
</span><del>-    els.position = 'absolute';
</del><ins>+    if (originalPosition != 'fixed') // Switching fixed to absolute causes issues in Safari
+      els.position = 'absolute';
</ins><span class="cx">     els.display = 'block';
</span><span class="cx">     var originalWidth = element.clientWidth;
</span><span class="cx">     var originalHeight = element.clientHeight;
</span><span class="lines">@@ -1963,9 +2255,7 @@
</span><span class="cx">     if (pos == 'static' || !pos) {
</span><span class="cx">       element._madePositioned = true;
</span><span class="cx">       element.style.position = 'relative';
</span><del>-      // Opera returns the offset relative to the positioning context, when an
-      // element is position relative but top and left have not been defined
-      if (window.opera) {
</del><ins>+      if (Prototype.Browser.Opera) {
</ins><span class="cx">         element.style.top = 0;
</span><span class="cx">         element.style.left = 0;
</span><span class="cx">       }
</span><span class="lines">@@ -2020,9 +2310,9 @@
</span><span class="cx">       valueL += element.offsetLeft || 0;
</span><span class="cx">       element = element.offsetParent;
</span><span class="cx">       if (element) {
</span><del>-        if (element.tagName == 'BODY') break;
</del><ins>+        if (element.tagName.toUpperCase() == 'BODY') break;
</ins><span class="cx">         var p = Element.getStyle(element, 'position');
</span><del>-        if (p == 'relative' || p == 'absolute') break;
</del><ins>+        if (p !== 'static') break;
</ins><span class="cx">       }
</span><span class="cx">     } while (element);
</span><span class="cx">     return Element._returnOffset(valueL, valueT);
</span><span class="lines">@@ -2030,10 +2320,9 @@
</span><span class="cx"> 
</span><span class="cx">   absolutize: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    if (element.getStyle('position') == 'absolute') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
</del><ins>+    if (Element.getStyle(element, 'position') == 'absolute') return element;
</ins><span class="cx"> 
</span><del>-    var offsets = element.positionedOffset();
</del><ins>+    var offsets = Element.positionedOffset(element);
</ins><span class="cx">     var top     = offsets[1];
</span><span class="cx">     var left    = offsets[0];
</span><span class="cx">     var width   = element.clientWidth;
</span><span class="lines">@@ -2054,8 +2343,7 @@
</span><span class="cx"> 
</span><span class="cx">   relativize: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    if (element.getStyle('position') == 'relative') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
</del><ins>+    if (Element.getStyle(element, 'position') == 'relative') return element;
</ins><span class="cx"> 
</span><span class="cx">     element.style.position = 'relative';
</span><span class="cx">     var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
</span><span class="lines">@@ -2097,7 +2385,6 @@
</span><span class="cx">       valueT += element.offsetTop  || 0;
</span><span class="cx">       valueL += element.offsetLeft || 0;
</span><span class="cx"> 
</span><del>-      // Safari fix
</del><span class="cx">       if (element.offsetParent == document.body &amp;&amp;
</span><span class="cx">         Element.getStyle(element, 'position') == 'absolute') break;
</span><span class="cx"> 
</span><span class="lines">@@ -2105,7 +2392,7 @@
</span><span class="cx"> 
</span><span class="cx">     element = forElement;
</span><span class="cx">     do {
</span><del>-      if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
</del><ins>+      if (!Prototype.Browser.Opera || (element.tagName &amp;&amp; (element.tagName.toUpperCase() == 'BODY'))) {
</ins><span class="cx">         valueT -= element.scrollTop  || 0;
</span><span class="cx">         valueL -= element.scrollLeft || 0;
</span><span class="cx">       }
</span><span class="lines">@@ -2124,28 +2411,22 @@
</span><span class="cx">       offsetLeft: 0
</span><span class="cx">     }, arguments[2] || { });
</span><span class="cx"> 
</span><del>-    // find page position of source
</del><span class="cx">     source = $(source);
</span><del>-    var p = source.viewportOffset();
</del><ins>+    var p = Element.viewportOffset(source);
</ins><span class="cx"> 
</span><del>-    // find coordinate system to use
</del><span class="cx">     element = $(element);
</span><span class="cx">     var delta = [0, 0];
</span><span class="cx">     var parent = null;
</span><del>-    // delta [0,0] will do fine with position: fixed elements,
-    // position:absolute needs offsetParent deltas
</del><span class="cx">     if (Element.getStyle(element, 'position') == 'absolute') {
</span><del>-      parent = element.getOffsetParent();
-      delta = parent.viewportOffset();
</del><ins>+      parent = Element.getOffsetParent(element);
+      delta = Element.viewportOffset(parent);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // correct by body offsets (fixes Safari)
</del><span class="cx">     if (parent == document.body) {
</span><span class="cx">       delta[0] -= document.body.offsetLeft;
</span><span class="cx">       delta[1] -= document.body.offsetTop;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // set position
</del><span class="cx">     if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
</span><span class="cx">     if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
</span><span class="cx">     if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
</span><span class="lines">@@ -2154,10 +2435,9 @@
</span><span class="cx">   }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-Element.Methods.identify.counter = 1;
-
</del><span class="cx"> Object.extend(Element.Methods, {
</span><span class="cx">   getElementsBySelector: Element.Methods.select,
</span><ins>+
</ins><span class="cx">   childElements: Element.Methods.immediateDescendants
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="lines">@@ -2171,72 +2451,72 @@
</span><span class="cx">   }
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+if (Prototype.Browser.Opera) {
+  Element.Methods.getStyle = Element.Methods.getStyle.wrap(
+    function(proceed, element, style) {
+      switch (style) {
+        case 'left': case 'top': case 'right': case 'bottom':
+          if (proceed(element, 'position') === 'static') return null;
+        case 'height': case 'width':
+          if (!Element.visible(element)) return null;
</ins><span class="cx"> 
</span><del>-if (!document.createRange || Prototype.Browser.Opera) {
-  Element.Methods.insert = function(element, insertions) {
-    element = $(element);
</del><ins>+          var dim = parseInt(proceed(element, style), 10);
</ins><span class="cx"> 
</span><del>-    if (Object.isString(insertions) || Object.isNumber(insertions) ||
-        Object.isElement(insertions) || (insertions &amp;&amp; (insertions.toElement || insertions.toHTML)))
-          insertions = { bottom: insertions };
</del><ins>+          if (dim !== element['offset' + style.capitalize()])
+            return dim + 'px';
</ins><span class="cx"> 
</span><del>-    var t = Element._insertionTranslations, content, position, pos, tagName;
-
-    for (position in insertions) {
-      content  = insertions[position];
-      position = position.toLowerCase();
-      pos      = t[position];
-
-      if (content &amp;&amp; content.toElement) content = content.toElement();
-      if (Object.isElement(content)) {
-        pos.insert(element, content);
-        continue;
</del><ins>+          var properties;
+          if (style === 'height') {
+            properties = ['border-top-width', 'padding-top',
+             'padding-bottom', 'border-bottom-width'];
+          }
+          else {
+            properties = ['border-left-width', 'padding-left',
+             'padding-right', 'border-right-width'];
+          }
+          return properties.inject(dim, function(memo, property) {
+            var val = proceed(element, property);
+            return val === null ? memo : memo - parseInt(val, 10);
+          }) + 'px';
+        default: return proceed(element, style);
</ins><span class="cx">       }
</span><ins>+    }
+  );
</ins><span class="cx"> 
</span><del>-      content = Object.toHTML(content);
-      tagName = ((position == 'before' || position == 'after')
-        ? element.parentNode : element).tagName.toUpperCase();
-
-      if (t.tags[tagName]) {
-        var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-        if (position == 'top' || position == 'after') fragments.reverse();
-        fragments.each(pos.insert.curry(element));
-      }
-      else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
-
-      content.evalScripts.bind(content).defer();
</del><ins>+  Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
+    function(proceed, element, attribute) {
+      if (attribute === 'title') return element.title;
+      return proceed(element, attribute);
</ins><span class="cx">     }
</span><del>-
-    return element;
-  };
</del><ins>+  );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-if (Prototype.Browser.Opera) {
-  Element.Methods._getStyle = Element.Methods.getStyle;
-  Element.Methods.getStyle = function(element, style) {
-    switch(style) {
-      case 'left':
-      case 'top':
-      case 'right':
-      case 'bottom':
-        if (Element._getStyle(element, 'position') == 'static') return null;
-      default: return Element._getStyle(element, style);
</del><ins>+else if (Prototype.Browser.IE) {
+  Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
+    function(proceed, element) {
+      element = $(element);
+      try { element.offsetParent }
+      catch(e) { return $(document.body) }
+      var position = element.getStyle('position');
+      if (position !== 'static') return proceed(element);
+      element.setStyle({ position: 'relative' });
+      var value = proceed(element);
+      element.setStyle({ position: position });
+      return value;
</ins><span class="cx">     }
</span><del>-  };
-  Element.Methods._readAttribute = Element.Methods.readAttribute;
-  Element.Methods.readAttribute = function(element, attribute) {
-    if (attribute == 'title') return element.title;
-    return Element._readAttribute(element, attribute);
-  };
-}
</del><ins>+  );
</ins><span class="cx"> 
</span><del>-else if (Prototype.Browser.IE) {
-  $w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
</del><ins>+  $w('positionedOffset viewportOffset').each(function(method) {
</ins><span class="cx">     Element.Methods[method] = Element.Methods[method].wrap(
</span><span class="cx">       function(proceed, element) {
</span><span class="cx">         element = $(element);
</span><ins>+        try { element.offsetParent }
+        catch(e) { return Element._returnOffset(0,0) }
</ins><span class="cx">         var position = element.getStyle('position');
</span><del>-        if (position != 'static') return proceed(element);
</del><ins>+        if (position !== 'static') return proceed(element);
+        var offsetParent = element.getOffsetParent();
+        if (offsetParent &amp;&amp; offsetParent.getStyle('position') === 'fixed')
+          offsetParent.setStyle({ zoom: 1 });
</ins><span class="cx">         element.setStyle({ position: 'relative' });
</span><span class="cx">         var value = proceed(element);
</span><span class="cx">         element.setStyle({ position: position });
</span><span class="lines">@@ -2245,6 +2525,14 @@
</span><span class="cx">     );
</span><span class="cx">   });
</span><span class="cx"> 
</span><ins>+  Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
+    function(proceed, element) {
+      try { element.offsetParent }
+      catch(e) { return Element._returnOffset(0,0) }
+      return proceed(element);
+    }
+  );
+
</ins><span class="cx">   Element.Methods.getStyle = function(element, style) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
</span><span class="lines">@@ -2286,39 +2574,98 @@
</span><span class="cx">     return element;
</span><span class="cx">   };
</span><span class="cx"> 
</span><del>-  Element._attributeTranslations = {
-    read: {
-      names: {
-        'class': 'className',
-        'for':   'htmlFor'
-      },
-      values: {
-        _getAttr: function(element, attribute) {
-          return element.getAttribute(attribute, 2);
</del><ins>+  Element._attributeTranslations = (function(){
+
+    var classProp = 'className';
+    var forProp = 'for';
+
+    var el = document.createElement('div');
+
+    el.setAttribute(classProp, 'x');
+
+    if (el.className !== 'x') {
+      el.setAttribute('class', 'x');
+      if (el.className === 'x') {
+        classProp = 'class';
+      }
+    }
+    el = null;
+
+    el = document.createElement('label');
+    el.setAttribute(forProp, 'x');
+    if (el.htmlFor !== 'x') {
+      el.setAttribute('htmlFor', 'x');
+      if (el.htmlFor === 'x') {
+        forProp = 'htmlFor';
+      }
+    }
+    el = null;
+
+    return {
+      read: {
+        names: {
+          'class':      classProp,
+          'className':  classProp,
+          'for':        forProp,
+          'htmlFor':    forProp
</ins><span class="cx">         },
</span><del>-        _getAttrNode: function(element, attribute) {
-          var node = element.getAttributeNode(attribute);
-          return node ? node.value : &quot;&quot;;
-        },
-        _getEv: function(element, attribute) {
-          var attribute = element.getAttribute(attribute);
-          return attribute ? attribute.toString().slice(23, -2) : null;
-        },
-        _flag: function(element, attribute) {
-          return $(element).hasAttribute(attribute) ? attribute : null;
-        },
-        style: function(element) {
-          return element.style.cssText.toLowerCase();
-        },
-        title: function(element) {
-          return element.title;
</del><ins>+        values: {
+          _getAttr: function(element, attribute) {
+            return element.getAttribute(attribute);
+          },
+          _getAttr2: function(element, attribute) {
+            return element.getAttribute(attribute, 2);
+          },
+          _getAttrNode: function(element, attribute) {
+            var node = element.getAttributeNode(attribute);
+            return node ? node.value : &quot;&quot;;
+          },
+          _getEv: (function(){
+
+            var el = document.createElement('div');
+            el.onclick = Prototype.emptyFunction;
+            var value = el.getAttribute('onclick');
+            var f;
+
+            if (String(value).indexOf('{') &gt; -1) {
+              f = function(element, attribute) {
+                attribute = element.getAttribute(attribute);
+                if (!attribute) return null;
+                attribute = attribute.toString();
+                attribute = attribute.split('{')[1];
+                attribute = attribute.split('}')[0];
+                return attribute.strip();
+              };
+            }
+            else if (value === '') {
+              f = function(element, attribute) {
+                attribute = element.getAttribute(attribute);
+                if (!attribute) return null;
+                return attribute.strip();
+              };
+            }
+            el = null;
+            return f;
+          })(),
+          _flag: function(element, attribute) {
+            return $(element).hasAttribute(attribute) ? attribute : null;
+          },
+          style: function(element) {
+            return element.style.cssText.toLowerCase();
+          },
+          title: function(element) {
+            return element.title;
+          }
</ins><span class="cx">         }
</span><span class="cx">       }
</span><span class="cx">     }
</span><del>-  };
</del><ins>+  })();
</ins><span class="cx"> 
</span><span class="cx">   Element._attributeTranslations.write = {
</span><del>-    names: Object.clone(Element._attributeTranslations.read.names),
</del><ins>+    names: Object.extend({
+      cellpadding: 'cellPadding',
+      cellspacing: 'cellSpacing'
+    }, Element._attributeTranslations.read.names),
</ins><span class="cx">     values: {
</span><span class="cx">       checked: function(element, value) {
</span><span class="cx">         element.checked = !!value;
</span><span class="lines">@@ -2333,15 +2680,15 @@
</span><span class="cx">   Element._attributeTranslations.has = {};
</span><span class="cx"> 
</span><span class="cx">   $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
</span><del>-      'encType maxLength readOnly longDesc').each(function(attr) {
</del><ins>+      'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
</ins><span class="cx">     Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
</span><span class="cx">     Element._attributeTranslations.has[attr.toLowerCase()] = attr;
</span><span class="cx">   });
</span><span class="cx"> 
</span><span class="cx">   (function(v) {
</span><span class="cx">     Object.extend(v, {
</span><del>-      href:        v._getAttr,
-      src:         v._getAttr,
</del><ins>+      href:        v._getAttr2,
+      src:         v._getAttr2,
</ins><span class="cx">       type:        v._getAttr,
</span><span class="cx">       action:      v._getAttrNode,
</span><span class="cx">       disabled:    v._flag,
</span><span class="lines">@@ -2368,6 +2715,26 @@
</span><span class="cx">       onchange:    v._getEv
</span><span class="cx">     });
</span><span class="cx">   })(Element._attributeTranslations.read.values);
</span><ins>+
+  if (Prototype.BrowserFeatures.ElementExtensions) {
+    (function() {
+      function _descendants(element) {
+        var nodes = element.getElementsByTagName('*'), results = [];
+        for (var i = 0, node; node = nodes[i]; i++)
+          if (node.tagName !== &quot;!&quot;) // Filter out comment nodes.
+            results.push(node);
+        return results;
+      }
+
+      Element.Methods.down = function(element, expression, index) {
+        element = $(element);
+        if (arguments.length == 1) return element.firstDescendant();
+        return Object.isNumber(expression) ? _descendants(element)[expression] :
+          Element.select(element, expression)[index || 0];
+      }
+    })();
+  }
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> else if (Prototype.Browser.Gecko &amp;&amp; /rv:1\.8\.0/.test(navigator.userAgent)) {
</span><span class="lines">@@ -2386,7 +2753,7 @@
</span><span class="cx">       (value &lt; 0.00001) ? 0 : value;
</span><span class="cx"> 
</span><span class="cx">     if (value == 1)
</span><del>-      if(element.tagName == 'IMG' &amp;&amp; element.width) {
</del><ins>+      if(element.tagName.toUpperCase() == 'IMG' &amp;&amp; element.width) {
</ins><span class="cx">         element.width++; element.width--;
</span><span class="cx">       } else try {
</span><span class="cx">         var n = document.createTextNode(' ');
</span><span class="lines">@@ -2397,9 +2764,6 @@
</span><span class="cx">     return element;
</span><span class="cx">   };
</span><span class="cx"> 
</span><del>-  // Safari returns margins on body which is incorrect if the child is absolutely
-  // positioned.  For performance reasons, redefine Position.cumulativeOffset for
-  // KHTML/WebKit only.
</del><span class="cx">   Element.Methods.cumulativeOffset = function(element) {
</span><span class="cx">     var valueT = 0, valueL = 0;
</span><span class="cx">     do {
</span><span class="lines">@@ -2415,30 +2779,7 @@
</span><span class="cx">   };
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-if (Prototype.Browser.IE || Prototype.Browser.Opera) {
-  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
-  Element.Methods.update = function(element, content) {
-    element = $(element);
-
-    if (content &amp;&amp; content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-
-    content = Object.toHTML(content);
-    var tagName = element.tagName.toUpperCase();
-
-    if (tagName in Element._insertionTranslations.tags) {
-      $A(element.childNodes).each(function(node) { element.removeChild(node) });
-      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
-        .each(function(node) { element.appendChild(node) });
-    }
-    else element.innerHTML = content.stripScripts();
-
-    content.evalScripts.bind(content).defer();
-    return element;
-  };
-}
-
-if (document.createElement('div').outerHTML) {
</del><ins>+if ('outerHTML' in document.documentElement) {
</ins><span class="cx">   Element.Methods.replace = function(element, content) {
</span><span class="cx">     element = $(element);
</span><span class="cx"> 
</span><span class="lines">@@ -2476,45 +2817,25 @@
</span><span class="cx"> 
</span><span class="cx"> Element._getContentFromAnonymousElement = function(tagName, html) {
</span><span class="cx">   var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
</span><del>-  div.innerHTML = t[0] + html + t[1];
-  t[2].times(function() { div = div.firstChild });
</del><ins>+  if (t) {
+    div.innerHTML = t[0] + html + t[1];
+    t[2].times(function() { div = div.firstChild });
+  } else div.innerHTML = html;
</ins><span class="cx">   return $A(div.childNodes);
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Element._insertionTranslations = {
</span><del>-  before: {
-    adjacency: 'beforeBegin',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element);
-    },
-    initializeRange: function(element, range) {
-      range.setStartBefore(element);
-    }
</del><ins>+  before: function(element, node) {
+    element.parentNode.insertBefore(node, element);
</ins><span class="cx">   },
</span><del>-  top: {
-    adjacency: 'afterBegin',
-    insert: function(element, node) {
-      element.insertBefore(node, element.firstChild);
-    },
-    initializeRange: function(element, range) {
-      range.selectNodeContents(element);
-      range.collapse(true);
-    }
</del><ins>+  top: function(element, node) {
+    element.insertBefore(node, element.firstChild);
</ins><span class="cx">   },
</span><del>-  bottom: {
-    adjacency: 'beforeEnd',
-    insert: function(element, node) {
-      element.appendChild(node);
-    }
</del><ins>+  bottom: function(element, node) {
+    element.appendChild(node);
</ins><span class="cx">   },
</span><del>-  after: {
-    adjacency: 'afterEnd',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element.nextSibling);
-    },
-    initializeRange: function(element, range) {
-      range.setStartAfter(element);
-    }
</del><ins>+  after: function(element, node) {
+    element.parentNode.insertBefore(node, element.nextSibling);
</ins><span class="cx">   },
</span><span class="cx">   tags: {
</span><span class="cx">     TABLE:  ['&lt;table&gt;',                '&lt;/table&gt;',                   1],
</span><span class="lines">@@ -2526,19 +2847,19 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> (function() {
</span><del>-  this.bottom.initializeRange = this.top.initializeRange;
-  Object.extend(this.tags, {
-    THEAD: this.tags.TBODY,
-    TFOOT: this.tags.TBODY,
-    TH:    this.tags.TD
</del><ins>+  var tags = Element._insertionTranslations.tags;
+  Object.extend(tags, {
+    THEAD: tags.TBODY,
+    TFOOT: tags.TBODY,
+    TH:    tags.TD
</ins><span class="cx">   });
</span><del>-}).call(Element._insertionTranslations);
</del><ins>+})();
</ins><span class="cx"> 
</span><span class="cx"> Element.Methods.Simulated = {
</span><span class="cx">   hasAttribute: function(element, attribute) {
</span><span class="cx">     attribute = Element._attributeTranslations.has[attribute] || attribute;
</span><span class="cx">     var node = $(element).getAttributeNode(attribute);
</span><del>-    return node &amp;&amp; node.specified;
</del><ins>+    return !!(node &amp;&amp; node.specified);
</ins><span class="cx">   }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -2546,41 +2867,81 @@
</span><span class="cx"> 
</span><span class="cx"> Object.extend(Element, Element.Methods);
</span><span class="cx"> 
</span><del>-if (!Prototype.BrowserFeatures.ElementExtensions &amp;&amp;
-    document.createElement('div').__proto__) {
-  window.HTMLElement = { };
-  window.HTMLElement.prototype = document.createElement('div').__proto__;
-  Prototype.BrowserFeatures.ElementExtensions = true;
-}
</del><ins>+(function(div) {
</ins><span class="cx"> 
</span><ins>+  if (!Prototype.BrowserFeatures.ElementExtensions &amp;&amp; div['__proto__']) {
+    window.HTMLElement = { };
+    window.HTMLElement.prototype = div['__proto__'];
+    Prototype.BrowserFeatures.ElementExtensions = true;
+  }
+
+  div = null;
+
+})(document.createElement('div'))
+
</ins><span class="cx"> Element.extend = (function() {
</span><del>-  if (Prototype.BrowserFeatures.SpecificElementExtensions)
</del><ins>+
+  function checkDeficiency(tagName) {
+    if (typeof window.Element != 'undefined') {
+      var proto = window.Element.prototype;
+      if (proto) {
+        var id = '_' + (Math.random()+'').slice(2);
+        var el = document.createElement(tagName);
+        proto[id] = 'x';
+        var isBuggy = (el[id] !== 'x');
+        delete proto[id];
+        el = null;
+        return isBuggy;
+      }
+    }
+    return false;
+  }
+
+  function extendElementWith(element, methods) {
+    for (var property in methods) {
+      var value = methods[property];
+      if (Object.isFunction(value) &amp;&amp; !(property in element))
+        element[property] = value.methodize();
+    }
+  }
+
+  var HTMLOBJECTELEMENT_PROTOTYPE_BUGGY = checkDeficiency('object');
+
+  if (Prototype.BrowserFeatures.SpecificElementExtensions) {
+    if (HTMLOBJECTELEMENT_PROTOTYPE_BUGGY) {
+      return function(element) {
+        if (element &amp;&amp; typeof element._extendedByPrototype == 'undefined') {
+          var t = element.tagName;
+          if (t &amp;&amp; (/^(?:object|applet|embed)$/i.test(t))) {
+            extendElementWith(element, Element.Methods);
+            extendElementWith(element, Element.Methods.Simulated);
+            extendElementWith(element, Element.Methods.ByTag[t.toUpperCase()]);
+          }
+        }
+        return element;
+      }
+    }
</ins><span class="cx">     return Prototype.K;
</span><ins>+  }
</ins><span class="cx"> 
</span><span class="cx">   var Methods = { }, ByTag = Element.Methods.ByTag;
</span><span class="cx"> 
</span><span class="cx">   var extend = Object.extend(function(element) {
</span><del>-    if (!element || element._extendedByPrototype ||
</del><ins>+    if (!element || typeof element._extendedByPrototype != 'undefined' ||
</ins><span class="cx">         element.nodeType != 1 || element == window) return element;
</span><span class="cx"> 
</span><span class="cx">     var methods = Object.clone(Methods),
</span><del>-      tagName = element.tagName, property, value;
</del><ins>+        tagName = element.tagName.toUpperCase();
</ins><span class="cx"> 
</span><del>-    // extend methods for specific tags
</del><span class="cx">     if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
</span><span class="cx"> 
</span><del>-    for (property in methods) {
-      value = methods[property];
-      if (Object.isFunction(value) &amp;&amp; !(property in element))
-        element[property] = value.methodize();
-    }
</del><ins>+    extendElementWith(element, methods);
</ins><span class="cx"> 
</span><span class="cx">     element._extendedByPrototype = Prototype.emptyFunction;
</span><span class="cx">     return element;
</span><span class="cx"> 
</span><span class="cx">   }, {
</span><span class="cx">     refresh: function() {
</span><del>-      // extend methods for all tags (Safari doesn't need this)
</del><span class="cx">       if (!Prototype.BrowserFeatures.ElementExtensions) {
</span><span class="cx">         Object.extend(Methods, Element.Methods);
</span><span class="cx">         Object.extend(Methods, Element.Methods.Simulated);
</span><span class="lines">@@ -2659,14 +3020,18 @@
</span><span class="cx">     klass = 'HTML' + tagName.capitalize() + 'Element';
</span><span class="cx">     if (window[klass]) return window[klass];
</span><span class="cx"> 
</span><del>-    window[klass] = { };
-    window[klass].prototype = document.createElement(tagName).__proto__;
-    return window[klass];
</del><ins>+    var element = document.createElement(tagName);
+    var proto = element['__proto__'] || element.constructor.prototype;
+    element = null;
+    return proto;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><ins>+  var elementPrototype = window.HTMLElement ? HTMLElement.prototype :
+   Element.prototype;
+
</ins><span class="cx">   if (F.ElementExtensions) {
</span><del>-    copy(Element.Methods, HTMLElement.prototype);
-    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
</del><ins>+    copy(Element.Methods, elementPrototype);
+    copy(Element.Methods.Simulated, elementPrototype, true);
</ins><span class="cx">   }
</span><span class="cx"> 
</span><span class="cx">   if (F.SpecificElementExtensions) {
</span><span class="lines">@@ -2684,48 +3049,187 @@
</span><span class="cx">   Element.cache = { };
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> document.viewport = {
</span><ins>+
</ins><span class="cx">   getDimensions: function() {
</span><del>-    var dimensions = { };
-    $w('width height').each(function(d) {
-      var D = d.capitalize();
-      dimensions[d] = self['inner' + D] ||
-       (document.documentElement['client' + D] || document.body['client' + D]);
-    });
-    return dimensions;
</del><ins>+    return { width: this.getWidth(), height: this.getHeight() };
</ins><span class="cx">   },
</span><span class="cx"> 
</span><del>-  getWidth: function() {
-    return this.getDimensions().width;
</del><ins>+  getScrollOffsets: function() {
+    return Element._returnOffset(
+      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
+      window.pageYOffset || document.documentElement.scrollTop  || document.body.scrollTop);
+  }
+};
+
+(function(viewport) {
+  var B = Prototype.Browser, doc = document, element, property = {};
+
+  function getRootElement() {
+    if (B.WebKit &amp;&amp; !doc.evaluate)
+      return document;
+
+    if (B.Opera &amp;&amp; window.parseFloat(window.opera.version()) &lt; 9.5)
+      return document.body;
+
+    return document.documentElement;
+  }
+
+  function define(D) {
+    if (!element) element = getRootElement();
+
+    property[D] = 'client' + D;
+
+    viewport['get' + D] = function() { return element[property[D]] };
+    return viewport['get' + D]();
+  }
+
+  viewport.getWidth  = define.curry('Width');
+
+  viewport.getHeight = define.curry('Height');
+})(document.viewport);
+
+
+Element.Storage = {
+  UID: 1
+};
+
+Element.addMethods({
+  getStorage: function(element) {
+    if (!(element = $(element))) return;
+
+    var uid;
+    if (element === window) {
+      uid = 0;
+    } else {
+      if (typeof element._prototypeUID === &quot;undefined&quot;)
+        element._prototypeUID = [Element.Storage.UID++];
+      uid = element._prototypeUID[0];
+    }
+
+    if (!Element.Storage[uid])
+      Element.Storage[uid] = $H();
+
+    return Element.Storage[uid];
</ins><span class="cx">   },
</span><span class="cx"> 
</span><del>-  getHeight: function() {
-    return this.getDimensions().height;
</del><ins>+  store: function(element, key, value) {
+    if (!(element = $(element))) return;
+
+    if (arguments.length === 2) {
+      Element.getStorage(element).update(key);
+    } else {
+      Element.getStorage(element).set(key, value);
+    }
+
+    return element;
</ins><span class="cx">   },
</span><span class="cx"> 
</span><del>-  getScrollOffsets: function() {
-    return Element._returnOffset(
-      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
-      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
</del><ins>+  retrieve: function(element, key, defaultValue) {
+    if (!(element = $(element))) return;
+    var hash = Element.getStorage(element), value = hash.get(key);
+
+    if (Object.isUndefined(value)) {
+      hash.set(key, defaultValue);
+      value = defaultValue;
+    }
+
+    return value;
+  },
+
+  clone: function(element, deep) {
+    if (!(element = $(element))) return;
+    var clone = element.cloneNode(deep);
+    clone._prototypeUID = void 0;
+    if (deep) {
+      var descendants = Element.select(clone, '*'),
+          i = descendants.length;
+      while (i--) {
+        descendants[i]._prototypeUID = void 0;
+      }
+    }
+    return Element.extend(clone);
</ins><span class="cx">   }
</span><del>-};
-/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
</del><ins>+});
+/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
</ins><span class="cx">  * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
</span><span class="cx">  * license.  Please see http://www.yui-ext.com/ for more information. */
</span><span class="cx"> 
</span><span class="cx"> var Selector = Class.create({
</span><span class="cx">   initialize: function(expression) {
</span><span class="cx">     this.expression = expression.strip();
</span><del>-    this.compileMatcher();
</del><ins>+
+    if (this.shouldUseSelectorsAPI()) {
+      this.mode = 'selectorsAPI';
+    } else if (this.shouldUseXPath()) {
+      this.mode = 'xpath';
+      this.compileXPathMatcher();
+    } else {
+      this.mode = &quot;normal&quot;;
+      this.compileMatcher();
+    }
+
</ins><span class="cx">   },
</span><span class="cx"> 
</span><ins>+  shouldUseXPath: (function() {
+
+    var IS_DESCENDANT_SELECTOR_BUGGY = (function(){
+      var isBuggy = false;
+      if (document.evaluate &amp;&amp; window.XPathResult) {
+        var el = document.createElement('div');
+        el.innerHTML = '&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;';
+
+        var xpath = &quot;.//*[local-name()='ul' or local-name()='UL']&quot; +
+          &quot;//*[local-name()='li' or local-name()='LI']&quot;;
+
+        var result = document.evaluate(xpath, el, null,
+          XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
+
+        isBuggy = (result.snapshotLength !== 2);
+        el = null;
+      }
+      return isBuggy;
+    })();
+
+    return function() {
+      if (!Prototype.BrowserFeatures.XPath) return false;
+
+      var e = this.expression;
+
+      if (Prototype.Browser.WebKit &amp;&amp;
+       (e.include(&quot;-of-type&quot;) || e.include(&quot;:empty&quot;)))
+        return false;
+
+      if ((/(\[[\w-]*?:|:checked)/).test(e))
+        return false;
+
+      if (IS_DESCENDANT_SELECTOR_BUGGY) return false;
+
+      return true;
+    }
+
+  })(),
+
+  shouldUseSelectorsAPI: function() {
+    if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
+
+    if (Selector.CASE_INSENSITIVE_CLASS_NAMES) return false;
+
+    if (!Selector._div) Selector._div = new Element('div');
+
+    try {
+      Selector._div.querySelector(this.expression);
+    } catch(e) {
+      return false;
+    }
+
+    return true;
+  },
+
</ins><span class="cx">   compileMatcher: function() {
</span><del>-    // Selectors with namespaced attributes can't use the XPath version
-    if (Prototype.BrowserFeatures.XPath &amp;&amp; !(/(\[[\w-]*?:|:checked)/).test(this.expression))
-      return this.compileXPathMatcher();
-
</del><span class="cx">     var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
</span><del>-        c = Selector.criteria, le, p, m;
</del><ins>+        c = Selector.criteria, le, p, m, len = ps.length, name;
</ins><span class="cx"> 
</span><span class="cx">     if (Selector._cache[e]) {
</span><span class="cx">       this.matcher = Selector._cache[e];
</span><span class="lines">@@ -2737,11 +3241,12 @@
</span><span class="cx"> 
</span><span class="cx">     while (e &amp;&amp; le != e &amp;&amp; (/\S/).test(e)) {
</span><span class="cx">       le = e;
</span><del>-      for (var i in ps) {
-        p = ps[i];
</del><ins>+      for (var i = 0; i&lt;len; i++) {
+        p = ps[i].re;
+        name = ps[i].name;
</ins><span class="cx">         if (m = e.match(p)) {
</span><del>-          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
-                  new Template(c[i]).evaluate(m));
</del><ins>+          this.matcher.push(Object.isFunction(c[name]) ? c[name](m) :
+            new Template(c[name]).evaluate(m));
</ins><span class="cx">           e = e.replace(m[0], '');
</span><span class="cx">           break;
</span><span class="cx">         }
</span><span class="lines">@@ -2755,7 +3260,7 @@
</span><span class="cx"> 
</span><span class="cx">   compileXPathMatcher: function() {
</span><span class="cx">     var e = this.expression, ps = Selector.patterns,
</span><del>-        x = Selector.xpath, le, m;
</del><ins>+        x = Selector.xpath, le, m, len = ps.length, name;
</ins><span class="cx"> 
</span><span class="cx">     if (Selector._cache[e]) {
</span><span class="cx">       this.xpath = Selector._cache[e]; return;
</span><span class="lines">@@ -2764,10 +3269,11 @@
</span><span class="cx">     this.matcher = ['.//*'];
</span><span class="cx">     while (e &amp;&amp; le != e &amp;&amp; (/\S/).test(e)) {
</span><span class="cx">       le = e;
</span><del>-      for (var i in ps) {
-        if (m = e.match(ps[i])) {
-          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
-            new Template(x[i]).evaluate(m));
</del><ins>+      for (var i = 0; i&lt;len; i++) {
+        name = ps[i].name;
+        if (m = e.match(ps[i].re)) {
+          this.matcher.push(Object.isFunction(x[name]) ? x[name](m) :
+            new Template(x[name]).evaluate(m));
</ins><span class="cx">           e = e.replace(m[0], '');
</span><span class="cx">           break;
</span><span class="cx">         }
</span><span class="lines">@@ -2780,29 +3286,43 @@
</span><span class="cx"> 
</span><span class="cx">   findElements: function(root) {
</span><span class="cx">     root = root || document;
</span><del>-    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
-    return this.matcher(root);
</del><ins>+    var e = this.expression, results;
+
+    switch (this.mode) {
+      case 'selectorsAPI':
+        if (root !== document) {
+          var oldId = root.id, id = $(root).identify();
+          id = id.replace(/([\.:])/g, &quot;\\$1&quot;);
+          e = &quot;#&quot; + id + &quot; &quot; + e;
+        }
+
+        results = $A(root.querySelectorAll(e)).map(Element.extend);
+        root.id = oldId;
+
+        return results;
+      case 'xpath':
+        return document._getElementsByXPath(this.xpath, root);
+      default:
+       return this.matcher(root);
+    }
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   match: function(element) {
</span><span class="cx">     this.tokens = [];
</span><span class="cx"> 
</span><span class="cx">     var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
</span><del>-    var le, p, m;
</del><ins>+    var le, p, m, len = ps.length, name;
</ins><span class="cx"> 
</span><span class="cx">     while (e &amp;&amp; le !== e &amp;&amp; (/\S/).test(e)) {
</span><span class="cx">       le = e;
</span><del>-      for (var i in ps) {
-        p = ps[i];
</del><ins>+      for (var i = 0; i&lt;len; i++) {
+        p = ps[i].re;
+        name = ps[i].name;
</ins><span class="cx">         if (m = e.match(p)) {
</span><del>-          // use the Selector.assertions methods unless the selector
-          // is too complex.
-          if (as[i]) {
-            this.tokens.push([i, Object.clone(m)]);
</del><ins>+          if (as[name]) {
+            this.tokens.push([name, Object.clone(m)]);
</ins><span class="cx">             e = e.replace(m[0], '');
</span><span class="cx">           } else {
</span><del>-            // reluctantly do a document-wide search
-            // and look for a match in the array
</del><span class="cx">             return this.findElements(document).include(element);
</span><span class="cx">           }
</span><span class="cx">         }
</span><span class="lines">@@ -2829,6 +3349,21 @@
</span><span class="cx">   }
</span><span class="cx"> });
</span><span class="cx"> 
</span><ins>+if (Prototype.BrowserFeatures.SelectorsAPI &amp;&amp;
+ document.compatMode === 'BackCompat') {
+  Selector.CASE_INSENSITIVE_CLASS_NAMES = (function(){
+    var div = document.createElement('div'),
+     span = document.createElement('span');
+
+    div.id = &quot;prototype_test_id&quot;;
+    span.className = 'Test';
+    div.appendChild(span);
+    var isIgnored = (div.querySelector('#prototype_test_id .test') !== null);
+    div = span = null;
+    return isIgnored;
+  })();
+}
+
</ins><span class="cx"> Object.extend(Selector, {
</span><span class="cx">   _cache: { },
</span><span class="cx"> 
</span><span class="lines">@@ -2844,8 +3379,12 @@
</span><span class="cx">     },
</span><span class="cx">     className:    &quot;[contains(concat(' ', @class, ' '), ' #{1} ')]&quot;,
</span><span class="cx">     id:           &quot;[@id='#{1}']&quot;,
</span><del>-    attrPresence: &quot;[@#{1}]&quot;,
</del><ins>+    attrPresence: function(m) {
+      m[1] = m[1].toLowerCase();
+      return new Template(&quot;[@#{1}]&quot;).evaluate(m);
+    },
</ins><span class="cx">     attr: function(m) {
</span><ins>+      m[1] = m[1].toLowerCase();
</ins><span class="cx">       m[3] = m[5] || m[6];
</span><span class="cx">       return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
</span><span class="cx">     },
</span><span class="lines">@@ -2868,20 +3407,21 @@
</span><span class="cx">       'first-child': '[not(preceding-sibling::*)]',
</span><span class="cx">       'last-child':  '[not(following-sibling::*)]',
</span><span class="cx">       'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
</span><del>-      'empty':       &quot;[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]&quot;,
</del><ins>+      'empty':       &quot;[count(*) = 0 and (count(text()) = 0)]&quot;,
</ins><span class="cx">       'checked':     &quot;[@checked]&quot;,
</span><del>-      'disabled':    &quot;[@disabled]&quot;,
-      'enabled':     &quot;[not(@disabled)]&quot;,
</del><ins>+      'disabled':    &quot;[(@disabled) and (@type!='hidden')]&quot;,
+      'enabled':     &quot;[not(@disabled) and (@type!='hidden')]&quot;,
</ins><span class="cx">       'not': function(m) {
</span><span class="cx">         var e = m[6], p = Selector.patterns,
</span><del>-            x = Selector.xpath, le, m, v;
</del><ins>+            x = Selector.xpath, le, v, len = p.length, name;
</ins><span class="cx"> 
</span><span class="cx">         var exclusion = [];
</span><span class="cx">         while (e &amp;&amp; le != e &amp;&amp; (/\S/).test(e)) {
</span><span class="cx">           le = e;
</span><del>-          for (var i in p) {
-            if (m = e.match(p[i])) {
-              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
</del><ins>+          for (var i = 0; i&lt;len; i++) {
+            name = p[i].name
+            if (m = e.match(p[i].re)) {
+              v = Object.isFunction(x[name]) ? x[name](m) : new Template(x[name]).evaluate(m);
</ins><span class="cx">               exclusion.push(&quot;(&quot; + v.substring(1, v.length - 1) + &quot;)&quot;);
</span><span class="cx">               e = e.replace(m[0], '');
</span><span class="cx">               break;
</span><span class="lines">@@ -2931,13 +3471,13 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   criteria: {
</span><del>-    tagName:      'n = h.tagName(n, r, &quot;#{1}&quot;, c);   c = false;',
-    className:    'n = h.className(n, r, &quot;#{1}&quot;, c); c = false;',
-    id:           'n = h.id(n, r, &quot;#{1}&quot;, c);        c = false;',
-    attrPresence: 'n = h.attrPresence(n, r, &quot;#{1}&quot;); c = false;',
</del><ins>+    tagName:      'n = h.tagName(n, r, &quot;#{1}&quot;, c);      c = false;',
+    className:    'n = h.className(n, r, &quot;#{1}&quot;, c);    c = false;',
+    id:           'n = h.id(n, r, &quot;#{1}&quot;, c);           c = false;',
+    attrPresence: 'n = h.attrPresence(n, r, &quot;#{1}&quot;, c); c = false;',
</ins><span class="cx">     attr: function(m) {
</span><span class="cx">       m[3] = (m[5] || m[6]);
</span><del>-      return new Template('n = h.attr(n, r, &quot;#{1}&quot;, &quot;#{3}&quot;, &quot;#{2}&quot;); c = false;').evaluate(m);
</del><ins>+      return new Template('n = h.attr(n, r, &quot;#{1}&quot;, &quot;#{3}&quot;, &quot;#{2}&quot;, c); c = false;').evaluate(m);
</ins><span class="cx">     },
</span><span class="cx">     pseudo: function(m) {
</span><span class="cx">       if (m[6]) m[6] = m[6].replace(/&quot;/g, '\\&quot;');
</span><span class="lines">@@ -2949,24 +3489,20 @@
</span><span class="cx">     laterSibling: 'c = &quot;laterSibling&quot;;'
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  patterns: {
-    // combinators must be listed first
-    // (and descendant needs to be last combinator)
-    laterSibling: /^\s*~\s*/,
-    child:        /^\s*&gt;\s*/,
-    adjacent:     /^\s*\+\s*/,
-    descendant:   /^\s/,
</del><ins>+  patterns: [
+    { name: 'laterSibling', re: /^\s*~\s*/ },
+    { name: 'child',        re: /^\s*&gt;\s*/ },
+    { name: 'adjacent',     re: /^\s*\+\s*/ },
+    { name: 'descendant',   re: /^\s/ },
</ins><span class="cx"> 
</span><del>-    // selectors follow
-    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
-    id:           /^#([\w\-\*]+)(\b|$)/,
-    className:    /^\.([\w\-\*]+)(\b|$)/,
-    pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
-    attrPresence: /^\[([\w]+)\]/,
-    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['&quot;])([^\4]*?)\4|([^'&quot;][^\]]*?)))?\]/
-  },
</del><ins>+    { name: 'tagName',      re: /^\s*(\*|[\w\-]+)(\b|$)?/ },
+    { name: 'id',           re: /^#([\w\-\*]+)(\b|$)/ },
+    { name: 'className',    re: /^\.([\w\-\*]+)(\b|$)/ },
+    { name: 'pseudo',       re: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~&gt;]))/ },
+    { name: 'attrPresence', re: /^\[((?:[\w-]+:)?[\w-]+)\]/ },
+    { name: 'attr',         re: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['&quot;])([^\4]*?)\4|([^'&quot;][^\]]*?)))?\]/ }
+  ],
</ins><span class="cx"> 
</span><del>-  // for Selector.match and Element#match
</del><span class="cx">   assertions: {
</span><span class="cx">     tagName: function(element, matches) {
</span><span class="cx">       return matches[1].toUpperCase() == element.tagName.toUpperCase();
</span><span class="lines">@@ -2986,61 +3522,74 @@
</span><span class="cx"> 
</span><span class="cx">     attr: function(element, matches) {
</span><span class="cx">       var nodeValue = Element.readAttribute(element, matches[1]);
</span><del>-      return Selector.operators[matches[2]](nodeValue, matches[3]);
</del><ins>+      return nodeValue &amp;&amp; Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
</ins><span class="cx">     }
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   handlers: {
</span><del>-    // UTILITY FUNCTIONS
-    // joins two collections
</del><span class="cx">     concat: function(a, b) {
</span><span class="cx">       for (var i = 0, node; node = b[i]; i++)
</span><span class="cx">         a.push(node);
</span><span class="cx">       return a;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    // marks an array of nodes for counting
</del><span class="cx">     mark: function(nodes) {
</span><ins>+      var _true = Prototype.emptyFunction;
</ins><span class="cx">       for (var i = 0, node; node = nodes[i]; i++)
</span><del>-        node._counted = true;
</del><ins>+        node._countedByPrototype = _true;
</ins><span class="cx">       return nodes;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    unmark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = undefined;
-      return nodes;
-    },
</del><ins>+    unmark: (function(){
</ins><span class="cx"> 
</span><del>-    // mark each child node with its position (for nth calls)
-    // &quot;ofType&quot; flag indicates whether we're indexing for nth-of-type
-    // rather than nth-child
</del><ins>+      var PROPERTIES_ATTRIBUTES_MAP = (function(){
+        var el = document.createElement('div'),
+            isBuggy = false,
+            propName = '_countedByPrototype',
+            value = 'x'
+        el[propName] = value;
+        isBuggy = (el.getAttribute(propName) === value);
+        el = null;
+        return isBuggy;
+      })();
+
+      return PROPERTIES_ATTRIBUTES_MAP ?
+        function(nodes) {
+          for (var i = 0, node; node = nodes[i]; i++)
+            node.removeAttribute('_countedByPrototype');
+          return nodes;
+        } :
+        function(nodes) {
+          for (var i = 0, node; node = nodes[i]; i++)
+            node._countedByPrototype = void 0;
+          return nodes;
+        }
+    })(),
+
</ins><span class="cx">     index: function(parentNode, reverse, ofType) {
</span><del>-      parentNode._counted = true;
</del><ins>+      parentNode._countedByPrototype = Prototype.emptyFunction;
</ins><span class="cx">       if (reverse) {
</span><span class="cx">         for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i &gt;= 0; i--) {
</span><span class="cx">           var node = nodes[i];
</span><del>-          if (node.nodeType == 1 &amp;&amp; (!ofType || node._counted)) node.nodeIndex = j++;
</del><ins>+          if (node.nodeType == 1 &amp;&amp; (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
</ins><span class="cx">         }
</span><span class="cx">       } else {
</span><span class="cx">         for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
</span><del>-          if (node.nodeType == 1 &amp;&amp; (!ofType || node._counted)) node.nodeIndex = j++;
</del><ins>+          if (node.nodeType == 1 &amp;&amp; (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
</ins><span class="cx">       }
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    // filters out duplicates and extends all nodes
</del><span class="cx">     unique: function(nodes) {
</span><span class="cx">       if (nodes.length == 0) return nodes;
</span><span class="cx">       var results = [], n;
</span><span class="cx">       for (var i = 0, l = nodes.length; i &lt; l; i++)
</span><del>-        if (!(n = nodes[i])._counted) {
-          n._counted = true;
</del><ins>+        if (typeof (n = nodes[i])._countedByPrototype == 'undefined') {
+          n._countedByPrototype = Prototype.emptyFunction;
</ins><span class="cx">           results.push(Element.extend(n));
</span><span class="cx">         }
</span><span class="cx">       return Selector.handlers.unmark(results);
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    // COMBINATOR FUNCTIONS
</del><span class="cx">     descendant: function(nodes) {
</span><span class="cx">       var h = Selector.handlers;
</span><span class="cx">       for (var i = 0, results = [], node; node = nodes[i]; i++)
</span><span class="lines">@@ -3051,7 +3600,7 @@
</span><span class="cx">     child: function(nodes) {
</span><span class="cx">       var h = Selector.handlers;
</span><span class="cx">       for (var i = 0, results = [], node; node = nodes[i]; i++) {
</span><del>-        for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
</del><ins>+        for (var j = 0, child; child = node.childNodes[j]; j++)
</ins><span class="cx">           if (child.nodeType == 1 &amp;&amp; child.tagName != '!') results.push(child);
</span><span class="cx">       }
</span><span class="cx">       return results;
</span><span class="lines">@@ -3074,7 +3623,7 @@
</span><span class="cx"> 
</span><span class="cx">     nextElementSibling: function(node) {
</span><span class="cx">       while (node = node.nextSibling)
</span><del>-              if (node.nodeType == 1) return node;
</del><ins>+        if (node.nodeType == 1) return node;
</ins><span class="cx">       return null;
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -3084,13 +3633,11 @@
</span><span class="cx">       return null;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    // TOKEN FUNCTIONS
</del><span class="cx">     tagName: function(nodes, root, tagName, combinator) {
</span><del>-      tagName = tagName.toUpperCase();
</del><ins>+      var uTagName = tagName.toUpperCase();
</ins><span class="cx">       var results = [], h = Selector.handlers;
</span><span class="cx">       if (nodes) {
</span><span class="cx">         if (combinator) {
</span><del>-          // fastlane for ordinary descendant combinators
</del><span class="cx">           if (combinator == &quot;descendant&quot;) {
</span><span class="cx">             for (var i = 0, node; node = nodes[i]; i++)
</span><span class="cx">               h.concat(results, node.getElementsByTagName(tagName));
</span><span class="lines">@@ -3099,15 +3646,26 @@
</span><span class="cx">           if (tagName == &quot;*&quot;) return nodes;
</span><span class="cx">         }
</span><span class="cx">         for (var i = 0, node; node = nodes[i]; i++)
</span><del>-          if (node.tagName.toUpperCase() == tagName) results.push(node);
</del><ins>+          if (node.tagName.toUpperCase() === uTagName) results.push(node);
</ins><span class="cx">         return results;
</span><span class="cx">       } else return root.getElementsByTagName(tagName);
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     id: function(nodes, root, id, combinator) {
</span><span class="cx">       var targetNode = $(id), h = Selector.handlers;
</span><del>-      if (!targetNode) return [];
-      if (!nodes &amp;&amp; root == document) return [targetNode];
</del><ins>+
+      if (root == document) {
+        if (!targetNode) return [];
+        if (!nodes) return [targetNode];
+      } else {
+        if (!root.sourceIndex || root.sourceIndex &lt; 1) {
+          var nodes = root.getElementsByTagName('*');
+          for (var j = 0, node; node = nodes[j]; j++) {
+            if (node.id === id) return [node];
+          }
+        }
+      }
+
</ins><span class="cx">       if (nodes) {
</span><span class="cx">         if (combinator) {
</span><span class="cx">           if (combinator == 'child') {
</span><span class="lines">@@ -3146,16 +3704,18 @@
</span><span class="cx">       return results;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    attrPresence: function(nodes, root, attr) {
</del><ins>+    attrPresence: function(nodes, root, attr, combinator) {
</ins><span class="cx">       if (!nodes) nodes = root.getElementsByTagName(&quot;*&quot;);
</span><ins>+      if (nodes &amp;&amp; combinator) nodes = this[combinator](nodes);
</ins><span class="cx">       var results = [];
</span><span class="cx">       for (var i = 0, node; node = nodes[i]; i++)
</span><span class="cx">         if (Element.hasAttribute(node, attr)) results.push(node);
</span><span class="cx">       return results;
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    attr: function(nodes, root, attr, value, operator) {
</del><ins>+    attr: function(nodes, root, attr, value, operator, combinator) {
</ins><span class="cx">       if (!nodes) nodes = root.getElementsByTagName(&quot;*&quot;);
</span><ins>+      if (nodes &amp;&amp; combinator) nodes = this[combinator](nodes);
</ins><span class="cx">       var handler = Selector.operators[operator], results = [];
</span><span class="cx">       for (var i = 0, node; node = nodes[i]; i++) {
</span><span class="cx">         var nodeValue = Element.readAttribute(node, attr);
</span><span class="lines">@@ -3217,7 +3777,6 @@
</span><span class="cx">       return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    // handles the an+b logic
</del><span class="cx">     getIndices: function(a, b, total) {
</span><span class="cx">       if (a == 0) return b &gt; 0 ? [b] : [];
</span><span class="cx">       return $R(1, total).inject([], function(memo, i) {
</span><span class="lines">@@ -3226,7 +3785,6 @@
</span><span class="cx">       });
</span><span class="cx">     },
</span><span class="cx"> 
</span><del>-    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
</del><span class="cx">     nth: function(nodes, formula, root, reverse, ofType) {
</span><span class="cx">       if (nodes.length == 0) return [];
</span><span class="cx">       if (formula == 'even') formula = '2n+0';
</span><span class="lines">@@ -3234,7 +3792,7 @@
</span><span class="cx">       var h = Selector.handlers, results = [], indexed = [], m;
</span><span class="cx">       h.mark(nodes);
</span><span class="cx">       for (var i = 0, node; node = nodes[i]; i++) {
</span><del>-        if (!node.parentNode._counted) {
</del><ins>+        if (!node.parentNode._countedByPrototype) {
</ins><span class="cx">           h.index(node.parentNode, reverse, ofType);
</span><span class="cx">           indexed.push(node.parentNode);
</span><span class="cx">         }
</span><span class="lines">@@ -3260,8 +3818,7 @@
</span><span class="cx"> 
</span><span class="cx">     'empty': function(nodes, value, root) {
</span><span class="cx">       for (var i = 0, results = [], node; node = nodes[i]; i++) {
</span><del>-        // IE treats comments as element nodes
-        if (node.tagName == '!' || (node.firstChild &amp;&amp; !node.innerHTML.match(/^\s*$/))) continue;
</del><ins>+        if (node.tagName == '!' || node.firstChild) continue;
</ins><span class="cx">         results.push(node);
</span><span class="cx">       }
</span><span class="cx">       return results;
</span><span class="lines">@@ -3272,14 +3829,15 @@
</span><span class="cx">       var exclusions = new Selector(selector).findElements(root);
</span><span class="cx">       h.mark(exclusions);
</span><span class="cx">       for (var i = 0, results = [], node; node = nodes[i]; i++)
</span><del>-        if (!node._counted) results.push(node);
</del><ins>+        if (!node._countedByPrototype) results.push(node);
</ins><span class="cx">       h.unmark(exclusions);
</span><span class="cx">       return results;
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="cx">     'enabled': function(nodes, value, root) {
</span><span class="cx">       for (var i = 0, results = [], node; node = nodes[i]; i++)
</span><del>-        if (!node.disabled) results.push(node);
</del><ins>+        if (!node.disabled &amp;&amp; (!node.type || node.type !== 'hidden'))
+          results.push(node);
</ins><span class="cx">       return results;
</span><span class="cx">     },
</span><span class="cx"> 
</span><span class="lines">@@ -3299,18 +3857,27 @@
</span><span class="cx">   operators: {
</span><span class="cx">     '=':  function(nv, v) { return nv == v; },
</span><span class="cx">     '!=': function(nv, v) { return nv != v; },
</span><del>-    '^=': function(nv, v) { return nv.startsWith(v); },
-    '$=': function(nv, v) { return nv.endsWith(v); },
-    '*=': function(nv, v) { return nv.include(v); },
</del><ins>+    '^=': function(nv, v) { return nv == v || nv &amp;&amp; nv.startsWith(v); },
+    '$=': function(nv, v) { return nv == v || nv &amp;&amp; nv.endsWith(v); },
+    '*=': function(nv, v) { return nv == v || nv &amp;&amp; nv.include(v); },
</ins><span class="cx">     '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
</span><del>-    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
</del><ins>+    '|=': function(nv, v) { return ('-' + (nv || &quot;&quot;).toUpperCase() +
+     '-').include('-' + (v || &quot;&quot;).toUpperCase() + '-'); }
</ins><span class="cx">   },
</span><span class="cx"> 
</span><ins>+  split: function(expression) {
+    var expressions = [];
+    expression.scan(/(([\w#:.~&gt;+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
+      expressions.push(m[1].strip());
+    });
+    return expressions;
+  },
+
</ins><span class="cx">   matchElements: function(elements, expression) {
</span><del>-    var matches = new Selector(expression).findElements(), h = Selector.handlers;
</del><ins>+    var matches = $$(expression), h = Selector.handlers;
</ins><span class="cx">     h.mark(matches);
</span><span class="cx">     for (var i = 0, results = [], element; element = elements[i]; i++)
</span><del>-      if (element._counted) results.push(element);
</del><ins>+      if (element._countedByPrototype) results.push(element);
</ins><span class="cx">     h.unmark(matches);
</span><span class="cx">     return results;
</span><span class="cx">   },
</span><span class="lines">@@ -3323,10 +3890,7 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   findChildElements: function(element, expressions) {
</span><del>-    var exprs = expressions.join(','), expressions = [];
-    exprs.scan(/(([\w#:.~&gt;+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
-      expressions.push(m[1].strip());
-    });
</del><ins>+    expressions = Selector.split(expressions.join(','));
</ins><span class="cx">     var results = [], h = Selector.handlers;
</span><span class="cx">     for (var i = 0, l = expressions.length, selector; i &lt; l; i++) {
</span><span class="cx">       selector = new Selector(expressions[i].strip());
</span><span class="lines">@@ -3336,27 +3900,38 @@
</span><span class="cx">   }
</span><span class="cx"> });
</span><span class="cx"> 
</span><ins>+if (Prototype.Browser.IE) {
+  Object.extend(Selector.handlers, {
+    concat: function(a, b) {
+      for (var i = 0, node; node = b[i]; i++)
+        if (node.tagName !== &quot;!&quot;) a.push(node);
+      return a;
+    }
+  });
+}
+
</ins><span class="cx"> function $$() {
</span><span class="cx">   return Selector.findChildElements(document, $A(arguments));
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> var Form = {
</span><span class="cx">   reset: function(form) {
</span><del>-    $(form).reset();
</del><ins>+    form = $(form);
+    form.reset();
</ins><span class="cx">     return form;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   serializeElements: function(elements, options) {
</span><span class="cx">     if (typeof options != 'object') options = { hash: !!options };
</span><del>-    else if (options.hash === undefined) options.hash = true;
</del><ins>+    else if (Object.isUndefined(options.hash)) options.hash = true;
</ins><span class="cx">     var key, value, submitted = false, submit = options.submit;
</span><span class="cx"> 
</span><span class="cx">     var data = elements.inject({ }, function(result, element) {
</span><span class="cx">       if (!element.disabled &amp;&amp; element.name) {
</span><span class="cx">         key = element.name; value = $(element).getValue();
</span><del>-        if (value != null &amp;&amp; (element.type != 'submit' || (!submitted &amp;&amp;
</del><ins>+        if (value != null &amp;&amp; element.type != 'file' &amp;&amp; (element.type != 'submit' || (!submitted &amp;&amp;
</ins><span class="cx">             submit !== false &amp;&amp; (!submit || key == submit) &amp;&amp; (submitted = true)))) {
</span><span class="cx">           if (key in result) {
</span><del>-            // a key is already present; construct an array of values
</del><span class="cx">             if (!Object.isArray(result[key])) result[key] = [result[key]];
</span><span class="cx">             result[key].push(value);
</span><span class="cx">           }
</span><span class="lines">@@ -3376,13 +3951,18 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   getElements: function(form) {
</span><del>-    return $A($(form).getElementsByTagName('*')).inject([],
-      function(elements, child) {
-        if (Form.Element.Serializers[child.tagName.toLowerCase()])
-          elements.push(Element.extend(child));
-        return elements;
-      }
-    );
</del><ins>+    var elements = $(form).getElementsByTagName('*'),
+        element,
+        arr = [ ],
+        serializers = Form.Element.Serializers;
+    for (var i = 0; element = elements[i]; i++) {
+      arr.push(element);
+    }
+    return arr.inject([], function(elements, child) {
+      if (serializers[child.tagName.toLowerCase()])
+        elements.push(Element.extend(child));
+      return elements;
+    })
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   getInputs: function(form, typeName, name) {
</span><span class="lines">@@ -3422,7 +4002,7 @@
</span><span class="cx">     }).sortBy(function(element) { return element.tabIndex }).first();
</span><span class="cx"> 
</span><span class="cx">     return firstByIndex ? firstByIndex : elements.find(function(element) {
</span><del>-      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
</del><ins>+      return /^(?:input|select|textarea)$/i.test(element.tagName);
</ins><span class="cx">     });
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -3453,6 +4033,7 @@
</span><span class="cx"> 
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> Form.Element = {
</span><span class="cx">   focus: function(element) {
</span><span class="cx">     $(element).focus();
</span><span class="lines">@@ -3466,6 +4047,7 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Form.Element.Methods = {
</span><ins>+
</ins><span class="cx">   serialize: function(element) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     if (!element.disabled &amp;&amp; element.name) {
</span><span class="lines">@@ -3506,7 +4088,7 @@
</span><span class="cx">     try {
</span><span class="cx">       element.focus();
</span><span class="cx">       if (element.select &amp;&amp; (element.tagName.toLowerCase() != 'input' ||
</span><del>-          !['button', 'reset', 'submit'].include(element.type)))
</del><ins>+          !(/^(?:button|reset|submit)$/i.test(element.type))))
</ins><span class="cx">         element.select();
</span><span class="cx">     } catch (e) { }
</span><span class="cx">     return element;
</span><span class="lines">@@ -3514,7 +4096,6 @@
</span><span class="cx"> 
</span><span class="cx">   disable: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    element.blur();
</del><span class="cx">     element.disabled = true;
</span><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="lines">@@ -3529,6 +4110,7 @@
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="cx"> var Field = Form.Element;
</span><ins>+
</ins><span class="cx"> var $F = Form.Element.Methods.getValue;
</span><span class="cx"> 
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><span class="lines">@@ -3545,31 +4127,31 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   inputSelector: function(element, value) {
</span><del>-    if (value === undefined) return element.checked ? element.value : null;
</del><ins>+    if (Object.isUndefined(value)) return element.checked ? element.value : null;
</ins><span class="cx">     else element.checked = !!value;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   textarea: function(element, value) {
</span><del>-    if (value === undefined) return element.value;
</del><ins>+    if (Object.isUndefined(value)) return element.value;
</ins><span class="cx">     else element.value = value;
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  select: function(element, index) {
-    if (index === undefined)
</del><ins>+  select: function(element, value) {
+    if (Object.isUndefined(value))
</ins><span class="cx">       return this[element.type == 'select-one' ?
</span><span class="cx">         'selectOne' : 'selectMany'](element);
</span><span class="cx">     else {
</span><del>-      var opt, value, single = !Object.isArray(index);
</del><ins>+      var opt, currentValue, single = !Object.isArray(value);
</ins><span class="cx">       for (var i = 0, length = element.length; i &lt; length; i++) {
</span><span class="cx">         opt = element.options[i];
</span><del>-        value = this.optionValue(opt);
</del><ins>+        currentValue = this.optionValue(opt);
</ins><span class="cx">         if (single) {
</span><del>-          if (value == index) {
</del><ins>+          if (currentValue == value) {
</ins><span class="cx">             opt.selected = true;
</span><span class="cx">             return;
</span><span class="cx">           }
</span><span class="cx">         }
</span><del>-        else opt.selected = index.include(value);
</del><ins>+        else opt.selected = value.include(currentValue);
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">   },
</span><span class="lines">@@ -3591,13 +4173,13 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   optionValue: function(opt) {
</span><del>-    // extend element because hasAttribute may not be native
</del><span class="cx">     return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
</span><span class="cx">   }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
</span><span class="cx">   initialize: function($super, element, frequency, callback) {
</span><span class="cx">     $super(callback, frequency);
</span><span class="lines">@@ -3679,321 +4261,441 @@
</span><span class="cx">     return Form.serialize(this.element);
</span><span class="cx">   }
</span><span class="cx"> });
</span><del>-if (!window.Event) var Event = { };
</del><ins>+(function() {
</ins><span class="cx"> 
</span><del>-Object.extend(Event, {
-  KEY_BACKSPACE: 8,
-  KEY_TAB:       9,
-  KEY_RETURN:   13,
-  KEY_ESC:      27,
-  KEY_LEFT:     37,
-  KEY_UP:       38,
-  KEY_RIGHT:    39,
-  KEY_DOWN:     40,
-  KEY_DELETE:   46,
-  KEY_HOME:     36,
-  KEY_END:      35,
-  KEY_PAGEUP:   33,
-  KEY_PAGEDOWN: 34,
-  KEY_INSERT:   45,
</del><ins>+  var Event = {
+    KEY_BACKSPACE: 8,
+    KEY_TAB:       9,
+    KEY_RETURN:   13,
+    KEY_ESC:      27,
+    KEY_LEFT:     37,
+    KEY_UP:       38,
+    KEY_RIGHT:    39,
+    KEY_DOWN:     40,
+    KEY_DELETE:   46,
+    KEY_HOME:     36,
+    KEY_END:      35,
+    KEY_PAGEUP:   33,
+    KEY_PAGEDOWN: 34,
+    KEY_INSERT:   45,
</ins><span class="cx"> 
</span><del>-  cache: { },
</del><ins>+    cache: {}
+  };
</ins><span class="cx"> 
</span><del>-  relatedTarget: function(event) {
-    var element;
-    switch(event.type) {
-      case 'mouseover': element = event.fromElement; break;
-      case 'mouseout':  element = event.toElement;   break;
-      default: return null;
-    }
-    return Element.extend(element);
-  }
-});
</del><ins>+  var docEl = document.documentElement;
+  var MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED = 'onmouseenter' in docEl
+    &amp;&amp; 'onmouseleave' in docEl;
</ins><span class="cx"> 
</span><del>-Event.Methods = (function() {
-  var isButton;
-
</del><ins>+  var _isButton;
</ins><span class="cx">   if (Prototype.Browser.IE) {
</span><span class="cx">     var buttonMap = { 0: 1, 1: 4, 2: 2 };
</span><del>-    isButton = function(event, code) {
-      return event.button == buttonMap[code];
</del><ins>+    _isButton = function(event, code) {
+      return event.button === buttonMap[code];
</ins><span class="cx">     };
</span><del>-
</del><span class="cx">   } else if (Prototype.Browser.WebKit) {
</span><del>-    isButton = function(event, code) {
</del><ins>+    _isButton = function(event, code) {
</ins><span class="cx">       switch (code) {
</span><span class="cx">         case 0: return event.which == 1 &amp;&amp; !event.metaKey;
</span><span class="cx">         case 1: return event.which == 1 &amp;&amp; event.metaKey;
</span><span class="cx">         default: return false;
</span><span class="cx">       }
</span><span class="cx">     };
</span><del>-
</del><span class="cx">   } else {
</span><del>-    isButton = function(event, code) {
</del><ins>+    _isButton = function(event, code) {
</ins><span class="cx">       return event.which ? (event.which === code + 1) : (event.button === code);
</span><span class="cx">     };
</span><span class="cx">   }
</span><span class="cx"> 
</span><del>-  return {
-    isLeftClick:   function(event) { return isButton(event, 0) },
-    isMiddleClick: function(event) { return isButton(event, 1) },
-    isRightClick:  function(event) { return isButton(event, 2) },
</del><ins>+  function isLeftClick(event)   { return _isButton(event, 0) }
</ins><span class="cx"> 
</span><del>-    element: function(event) {
-      var node = Event.extend(event).target;
-      return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
-    },
</del><ins>+  function isMiddleClick(event) { return _isButton(event, 1) }
</ins><span class="cx"> 
</span><del>-    findElement: function(event, expression) {
-      var element = Event.element(event);
-      return element.match(expression) ? element : element.up(expression);
-    },
</del><ins>+  function isRightClick(event)  { return _isButton(event, 2) }
</ins><span class="cx"> 
</span><del>-    pointer: function(event) {
-      return {
-        x: event.pageX || (event.clientX +
-          (document.documentElement.scrollLeft || document.body.scrollLeft)),
-        y: event.pageY || (event.clientY +
-          (document.documentElement.scrollTop || document.body.scrollTop))
-      };
-    },
</del><ins>+  function element(event) {
+    event = Event.extend(event);
</ins><span class="cx"> 
</span><del>-    pointerX: function(event) { return Event.pointer(event).x },
-    pointerY: function(event) { return Event.pointer(event).y },
</del><ins>+    var node = event.target, type = event.type,
+     currentTarget = event.currentTarget;
</ins><span class="cx"> 
</span><del>-    stop: function(event) {
-      Event.extend(event);
-      event.preventDefault();
-      event.stopPropagation();
-      event.stopped = true;
</del><ins>+    if (currentTarget &amp;&amp; currentTarget.tagName) {
+      if (type === 'load' || type === 'error' ||
+        (type === 'click' &amp;&amp; currentTarget.tagName.toLowerCase() === 'input'
+          &amp;&amp; currentTarget.type === 'radio'))
+            node = currentTarget;
</ins><span class="cx">     }
</span><ins>+
+    if (node.nodeType == Node.TEXT_NODE)
+      node = node.parentNode;
+
+    return Element.extend(node);
+  }
+
+  function findElement(event, expression) {
+    var element = Event.element(event);
+    if (!expression) return element;
+    var elements = [element].concat(element.ancestors());
+    return Selector.findElement(elements, expression, 0);
+  }
+
+  function pointer(event) {
+    return { x: pointerX(event), y: pointerY(event) };
+  }
+
+  function pointerX(event) {
+    var docElement = document.documentElement,
+     body = document.body || { scrollLeft: 0 };
+
+    return event.pageX || (event.clientX +
+      (docElement.scrollLeft || body.scrollLeft) -
+      (docElement.clientLeft || 0));
+  }
+
+  function pointerY(event) {
+    var docElement = document.documentElement,
+     body = document.body || { scrollTop: 0 };
+
+    return  event.pageY || (event.clientY +
+       (docElement.scrollTop || body.scrollTop) -
+       (docElement.clientTop || 0));
+  }
+
+
+  function stop(event) {
+    Event.extend(event);
+    event.preventDefault();
+    event.stopPropagation();
+
+    event.stopped = true;
+  }
+
+  Event.Methods = {
+    isLeftClick: isLeftClick,
+    isMiddleClick: isMiddleClick,
+    isRightClick: isRightClick,
+
+    element: element,
+    findElement: findElement,
+
+    pointer: pointer,
+    pointerX: pointerX,
+    pointerY: pointerY,
+
+    stop: stop
</ins><span class="cx">   };
</span><del>-})();
</del><span class="cx"> 
</span><del>-Event.extend = (function() {
</del><ins>+
</ins><span class="cx">   var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
</span><span class="cx">     m[name] = Event.Methods[name].methodize();
</span><span class="cx">     return m;
</span><span class="cx">   });
</span><span class="cx"> 
</span><span class="cx">   if (Prototype.Browser.IE) {
</span><ins>+    function _relatedTarget(event) {
+      var element;
+      switch (event.type) {
+        case 'mouseover': element = event.fromElement; break;
+        case 'mouseout':  element = event.toElement;   break;
+        default: return null;
+      }
+      return Element.extend(element);
+    }
+
</ins><span class="cx">     Object.extend(methods, {
</span><span class="cx">       stopPropagation: function() { this.cancelBubble = true },
</span><span class="cx">       preventDefault:  function() { this.returnValue = false },
</span><del>-      inspect: function() { return &quot;[object Event]&quot; }
</del><ins>+      inspect: function() { return '[object Event]' }
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    return function(event) {
</del><ins>+    Event.extend = function(event, element) {
</ins><span class="cx">       if (!event) return false;
</span><span class="cx">       if (event._extendedByPrototype) return event;
</span><span class="cx"> 
</span><span class="cx">       event._extendedByPrototype = Prototype.emptyFunction;
</span><span class="cx">       var pointer = Event.pointer(event);
</span><ins>+
</ins><span class="cx">       Object.extend(event, {
</span><del>-        target: event.srcElement,
-        relatedTarget: Event.relatedTarget(event),
</del><ins>+        target: event.srcElement || element,
+        relatedTarget: _relatedTarget(event),
</ins><span class="cx">         pageX:  pointer.x,
</span><span class="cx">         pageY:  pointer.y
</span><span class="cx">       });
</span><ins>+
</ins><span class="cx">       return Object.extend(event, methods);
</span><span class="cx">     };
</span><del>-
</del><span class="cx">   } else {
</span><del>-    Event.prototype = Event.prototype || document.createEvent(&quot;HTMLEvents&quot;).__proto__;
</del><ins>+    Event.prototype = window.Event.prototype || document.createEvent('HTMLEvents').__proto__;
</ins><span class="cx">     Object.extend(Event.prototype, methods);
</span><del>-    return Prototype.K;
</del><ins>+    Event.extend = Prototype.K;
</ins><span class="cx">   }
</span><del>-})();
</del><span class="cx"> 
</span><del>-Object.extend(Event, (function() {
-  var cache = Event.cache;
</del><ins>+  function _createResponder(element, eventName, handler) {
+    var registry = Element.retrieve(element, 'prototype_event_registry');
</ins><span class="cx"> 
</span><del>-  function getEventID(element) {
-    if (element._eventID) return element._eventID;
-    arguments.callee.id = arguments.callee.id || 1;
-    return element._eventID = ++arguments.callee.id;
-  }
</del><ins>+    if (Object.isUndefined(registry)) {
+      CACHE.push(element);
+      registry = Element.retrieve(element, 'prototype_event_registry', $H());
+    }
</ins><span class="cx"> 
</span><del>-  function getDOMEventName(eventName) {
-    if (eventName &amp;&amp; eventName.include(':')) return &quot;dataavailable&quot;;
-    return eventName;
-  }
</del><ins>+    var respondersForEvent = registry.get(eventName);
+    if (Object.isUndefined(respondersForEvent)) {
+      respondersForEvent = [];
+      registry.set(eventName, respondersForEvent);
+    }
</ins><span class="cx"> 
</span><del>-  function getCacheForID(id) {
-    return cache[id] = cache[id] || { };
-  }
</del><ins>+    if (respondersForEvent.pluck('handler').include(handler)) return false;
</ins><span class="cx"> 
</span><del>-  function getWrappersForEventName(id, eventName) {
-    var c = getCacheForID(id);
-    return c[eventName] = c[eventName] || [];
-  }
</del><ins>+    var responder;
+    if (eventName.include(&quot;:&quot;)) {
+      responder = function(event) {
+        if (Object.isUndefined(event.eventName))
+          return false;
</ins><span class="cx"> 
</span><del>-  function createWrapper(element, eventName, handler) {
-    var id = getEventID(element);
-    var c = getWrappersForEventName(id, eventName);
-    if (c.pluck(&quot;handler&quot;).include(handler)) return false;
-
-    var wrapper = function(event) {
-      if (!Event || !Event.extend ||
-        (event.eventName &amp;&amp; event.eventName != eventName))
</del><ins>+        if (event.eventName !== eventName)
</ins><span class="cx">           return false;
</span><span class="cx"> 
</span><del>-      Event.extend(event);
-      handler.call(element, event)
-    };
</del><ins>+        Event.extend(event, element);
+        handler.call(element, event);
+      };
+    } else {
+      if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED &amp;&amp;
+       (eventName === &quot;mouseenter&quot; || eventName === &quot;mouseleave&quot;)) {
+        if (eventName === &quot;mouseenter&quot; || eventName === &quot;mouseleave&quot;) {
+          responder = function(event) {
+            Event.extend(event, element);
</ins><span class="cx"> 
</span><del>-    wrapper.handler = handler;
-    c.push(wrapper);
-    return wrapper;
-  }
</del><ins>+            var parent = event.relatedTarget;
+            while (parent &amp;&amp; parent !== element) {
+              try { parent = parent.parentNode; }
+              catch(e) { parent = element; }
+            }
</ins><span class="cx"> 
</span><del>-  function findWrapper(id, eventName, handler) {
-    var c = getWrappersForEventName(id, eventName);
-    return c.find(function(wrapper) { return wrapper.handler == handler });
-  }
</del><ins>+            if (parent === element) return;
</ins><span class="cx"> 
</span><del>-  function destroyWrapper(id, eventName, handler) {
-    var c = getCacheForID(id);
-    if (!c[eventName]) return false;
-    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
</del><ins>+            handler.call(element, event);
+          };
+        }
+      } else {
+        responder = function(event) {
+          Event.extend(event, element);
+          handler.call(element, event);
+        };
+      }
+    }
+
+    responder.handler = handler;
+    respondersForEvent.push(responder);
+    return responder;
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-  function destroyCache() {
-    for (var id in cache)
-      for (var eventName in cache[id])
-        cache[id][eventName] = null;
</del><ins>+  function _destroyCache() {
+    for (var i = 0, length = CACHE.length; i &lt; length; i++) {
+      Event.stopObserving(CACHE[i]);
+      CACHE[i] = null;
+    }
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-  if (window.attachEvent) {
-    window.attachEvent(&quot;onunload&quot;, destroyCache);
</del><ins>+  var CACHE = [];
+
+  if (Prototype.Browser.IE)
+    window.attachEvent('onunload', _destroyCache);
+
+  if (Prototype.Browser.WebKit)
+    window.addEventListener('unload', Prototype.emptyFunction, false);
+
+
+  var _getDOMEventName = Prototype.K;
+
+  if (!MOUSEENTER_MOUSELEAVE_EVENTS_SUPPORTED) {
+    _getDOMEventName = function(eventName) {
+      var translations = { mouseenter: &quot;mouseover&quot;, mouseleave: &quot;mouseout&quot; };
+      return eventName in translations ? translations[eventName] : eventName;
+    };
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-  return {
-    observe: function(element, eventName, handler) {
-      element = $(element);
-      var name = getDOMEventName(eventName);
</del><ins>+  function observe(element, eventName, handler) {
+    element = $(element);
</ins><span class="cx"> 
</span><del>-      var wrapper = createWrapper(element, eventName, handler);
-      if (!wrapper) return element;
</del><ins>+    var responder = _createResponder(element, eventName, handler);
</ins><span class="cx"> 
</span><del>-      if (element.addEventListener) {
-        element.addEventListener(name, wrapper, false);
-      } else {
-        element.attachEvent(&quot;on&quot; + name, wrapper);
</del><ins>+    if (!responder) return element;
+
+    if (eventName.include(':')) {
+      if (element.addEventListener)
+        element.addEventListener(&quot;dataavailable&quot;, responder, false);
+      else {
+        element.attachEvent(&quot;ondataavailable&quot;, responder);
+        element.attachEvent(&quot;onfilterchange&quot;, responder);
</ins><span class="cx">       }
</span><ins>+    } else {
+      var actualEventName = _getDOMEventName(eventName);
</ins><span class="cx"> 
</span><del>-      return element;
-    },
</del><ins>+      if (element.addEventListener)
+        element.addEventListener(actualEventName, responder, false);
+      else
+        element.attachEvent(&quot;on&quot; + actualEventName, responder);
+    }
</ins><span class="cx"> 
</span><del>-    stopObserving: function(element, eventName, handler) {
-      element = $(element);
-      var id = getEventID(element), name = getDOMEventName(eventName);
</del><ins>+    return element;
+  }
</ins><span class="cx"> 
</span><del>-      if (!handler &amp;&amp; eventName) {
-        getWrappersForEventName(id, eventName).each(function(wrapper) {
-          element.stopObserving(eventName, wrapper.handler);
-        });
-        return element;
</del><ins>+  function stopObserving(element, eventName, handler) {
+    element = $(element);
</ins><span class="cx"> 
</span><del>-      } else if (!eventName) {
-        Object.keys(getCacheForID(id)).each(function(eventName) {
-          element.stopObserving(eventName);
-        });
-        return element;
-      }
</del><ins>+    var registry = Element.retrieve(element, 'prototype_event_registry');
</ins><span class="cx"> 
</span><del>-      var wrapper = findWrapper(id, eventName, handler);
-      if (!wrapper) return element;
</del><ins>+    if (Object.isUndefined(registry)) return element;
</ins><span class="cx"> 
</span><del>-      if (element.removeEventListener) {
-        element.removeEventListener(name, wrapper, false);
-      } else {
-        element.detachEvent(&quot;on&quot; + name, wrapper);
-      }
</del><ins>+    if (eventName &amp;&amp; !handler) {
+      var responders = registry.get(eventName);
</ins><span class="cx"> 
</span><del>-      destroyWrapper(id, eventName, handler);
</del><ins>+      if (Object.isUndefined(responders)) return element;
</ins><span class="cx"> 
</span><ins>+      responders.each( function(r) {
+        Element.stopObserving(element, eventName, r.handler);
+      });
</ins><span class="cx">       return element;
</span><del>-    },
</del><ins>+    } else if (!eventName) {
+      registry.each( function(pair) {
+        var eventName = pair.key, responders = pair.value;
</ins><span class="cx"> 
</span><del>-    fire: function(element, eventName, memo) {
-      element = $(element);
-      if (element == document &amp;&amp; document.createEvent &amp;&amp; !element.dispatchEvent)
-        element = document.documentElement;
</del><ins>+        responders.each( function(r) {
+          Element.stopObserving(element, eventName, r.handler);
+        });
+      });
+      return element;
+    }
</ins><span class="cx"> 
</span><del>-      if (document.createEvent) {
-        var event = document.createEvent(&quot;HTMLEvents&quot;);
-        event.initEvent(&quot;dataavailable&quot;, true, true);
-      } else {
-        var event = document.createEventObject();
-        event.eventType = &quot;ondataavailable&quot;;
-      }
</del><ins>+    var responders = registry.get(eventName);
</ins><span class="cx"> 
</span><del>-      event.eventName = eventName;
-      event.memo = memo || { };
</del><ins>+    if (!responders) return;
</ins><span class="cx"> 
</span><del>-      if (document.createEvent) {
-        element.dispatchEvent(event);
-      } else {
-        element.fireEvent(event.eventType, event);
</del><ins>+    var responder = responders.find( function(r) { return r.handler === handler; });
+    if (!responder) return element;
+
+    var actualEventName = _getDOMEventName(eventName);
+
+    if (eventName.include(':')) {
+      if (element.removeEventListener)
+        element.removeEventListener(&quot;dataavailable&quot;, responder, false);
+      else {
+        element.detachEvent(&quot;ondataavailable&quot;, responder);
+        element.detachEvent(&quot;onfilterchange&quot;,  responder);
</ins><span class="cx">       }
</span><ins>+    } else {
+      if (element.removeEventListener)
+        element.removeEventListener(actualEventName, responder, false);
+      else
+        element.detachEvent('on' + actualEventName, responder);
+    }
</ins><span class="cx"> 
</span><del>-      return event;
</del><ins>+    registry.set(eventName, responders.without(responder));
+
+    return element;
+  }
+
+  function fire(element, eventName, memo, bubble) {
+    element = $(element);
+
+    if (Object.isUndefined(bubble))
+      bubble = true;
+
+    if (element == document &amp;&amp; document.createEvent &amp;&amp; !element.dispatchEvent)
+      element = document.documentElement;
+
+    var event;
+    if (document.createEvent) {
+      event = document.createEvent('HTMLEvents');
+      event.initEvent('dataavailable', true, true);
+    } else {
+      event = document.createEventObject();
+      event.eventType = bubble ? 'ondataavailable' : 'onfilterchange';
</ins><span class="cx">     }
</span><del>-  };
-})());
</del><span class="cx"> 
</span><del>-Object.extend(Event, Event.Methods);
</del><ins>+    event.eventName = eventName;
+    event.memo = memo || { };
</ins><span class="cx"> 
</span><del>-Element.addMethods({
-  fire:          Event.fire,
-  observe:       Event.observe,
-  stopObserving: Event.stopObserving
-});
</del><ins>+    if (document.createEvent)
+      element.dispatchEvent(event);
+    else
+      element.fireEvent(event.eventType, event);
</ins><span class="cx"> 
</span><del>-Object.extend(document, {
-  fire:          Element.Methods.fire.methodize(),
-  observe:       Element.Methods.observe.methodize(),
-  stopObserving: Element.Methods.stopObserving.methodize()
-});
</del><ins>+    return Event.extend(event);
+  }
</ins><span class="cx"> 
</span><ins>+
+  Object.extend(Event, Event.Methods);
+
+  Object.extend(Event, {
+    fire:          fire,
+    observe:       observe,
+    stopObserving: stopObserving
+  });
+
+  Element.addMethods({
+    fire:          fire,
+
+    observe:       observe,
+
+    stopObserving: stopObserving
+  });
+
+  Object.extend(document, {
+    fire:          fire.methodize(),
+
+    observe:       observe.methodize(),
+
+    stopObserving: stopObserving.methodize(),
+
+    loaded:        false
+  });
+
+  if (window.Event) Object.extend(window.Event, Event);
+  else window.Event = Event;
+})();
+
</ins><span class="cx"> (function() {
</span><span class="cx">   /* Support for the DOMContentLoaded event is based on work by Dan Webb,
</span><del>-     Matthias Miller, Dean Edwards and John Resig. */
</del><ins>+     Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
</ins><span class="cx"> 
</span><del>-  var timer, fired = false;
</del><ins>+  var timer;
</ins><span class="cx"> 
</span><span class="cx">   function fireContentLoadedEvent() {
</span><del>-    if (fired) return;
-    if (timer) window.clearInterval(timer);
-    document.fire(&quot;dom:loaded&quot;);
-    fired = true;
</del><ins>+    if (document.loaded) return;
+    if (timer) window.clearTimeout(timer);
+    document.loaded = true;
+    document.fire('dom:loaded');
</ins><span class="cx">   }
</span><span class="cx"> 
</span><del>-  if (document.addEventListener) {
-    if (Prototype.Browser.WebKit) {
-      timer = window.setInterval(function() {
-        if (/loaded|complete/.test(document.readyState))
-          fireContentLoadedEvent();
-      }, 0);
</del><ins>+  function checkReadyState() {
+    if (document.readyState === 'complete') {
+      document.stopObserving('readystatechange', checkReadyState);
+      fireContentLoadedEvent();
+    }
+  }
</ins><span class="cx"> 
</span><del>-      Event.observe(window, &quot;load&quot;, fireContentLoadedEvent);
-
-    } else {
-      document.addEventListener(&quot;DOMContentLoaded&quot;,
-        fireContentLoadedEvent, false);
</del><ins>+  function pollDoScroll() {
+    try { document.documentElement.doScroll('left'); }
+    catch(e) {
+      timer = pollDoScroll.defer();
+      return;
</ins><span class="cx">     }
</span><ins>+    fireContentLoadedEvent();
+  }
</ins><span class="cx"> 
</span><ins>+  if (document.addEventListener) {
+    document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
</ins><span class="cx">   } else {
</span><del>-    document.write(&quot;&lt;script id=__onDOMContentLoaded defer src=//:&gt;&lt;\/script&gt;&quot;);
-    $(&quot;__onDOMContentLoaded&quot;).onreadystatechange = function() {
-      if (this.readyState == &quot;complete&quot;) {
-        this.onreadystatechange = null;
-        fireContentLoadedEvent();
-      }
-    };
</del><ins>+    document.observe('readystatechange', checkReadyState);
+    if (window == top)
+      timer = pollDoScroll.defer();
</ins><span class="cx">   }
</span><ins>+
+  Event.observe(window, 'load', fireContentLoadedEvent);
</ins><span class="cx"> })();
</span><ins>+
+Element.addMethods();
+
</ins><span class="cx"> /*------------------------------- DEPRECATED -------------------------------*/
</span><span class="cx"> 
</span><span class="cx"> Hash.toQueryString = Object.toQueryString;
</span><span class="lines">@@ -4022,16 +4724,9 @@
</span><span class="cx"> 
</span><span class="cx"> var $continue = new Error('&quot;throw $continue&quot; is deprecated, use &quot;return&quot; instead');
</span><span class="cx"> 
</span><del>-// This should be moved to script.aculo.us; notice the deprecated methods
-// further below, that map to the newer Element methods.
</del><span class="cx"> var Position = {
</span><del>-  // set to true if needed, warning: firefox performance problems
-  // NOT neeeded for page scrolling, only if draggable contained in
-  // scrollable elements
</del><span class="cx">   includeScrollOffsets: false,
</span><span class="cx"> 
</span><del>-  // must be called before calling withinIncludingScrolloffset, every time the
-  // page is scrolled
</del><span class="cx">   prepare: function() {
</span><span class="cx">     this.deltaX =  window.pageXOffset
</span><span class="cx">                 || document.documentElement.scrollLeft
</span><span class="lines">@@ -4043,7 +4738,6 @@
</span><span class="cx">                 || 0;
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  // caches x/y coordinate pair to use with overlap
</del><span class="cx">   within: function(element, x, y) {
</span><span class="cx">     if (this.includeScrollOffsets)
</span><span class="cx">       return this.withinIncludingScrolloffsets(element, x, y);
</span><span class="lines">@@ -4070,7 +4764,6 @@
</span><span class="cx">             this.xcomp &lt;  this.offset[0] + element.offsetWidth);
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  // within must be called directly before
</del><span class="cx">   overlap: function(mode, element) {
</span><span class="cx">     if (!mode) return 0;
</span><span class="cx">     if (mode == 'vertical')
</span><span class="lines">@@ -4081,7 +4774,6 @@
</span><span class="cx">         element.offsetWidth;
</span><span class="cx">   },
</span><span class="cx"> 
</span><del>-  // Deprecation layer -- use newer Element methods now (1.5.2).
</del><span class="cx"> 
</span><span class="cx">   cumulativeOffset: Element.Methods.cumulativeOffset,
</span><span class="cx"> 
</span><span class="lines">@@ -4180,5 +4872,3 @@
</span><span class="cx"> Object.extend(Element.ClassNames.prototype, Enumerable);
</span><span class="cx"> 
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><del>-
-Element.addMethods();
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculousMITLICENSE"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/MIT-LICENSE (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/MIT-LICENSE        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/MIT-LICENSE        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</del><ins>+Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</ins><span class="cx"> 
</span><span class="cx"> Permission is hereby granted, free of charge, to any person obtaining
</span><span class="cx"> a copy of this software and associated documentation files (the
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculousbuilderjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/builder.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/builder.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/builder.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>-// script.aculo.us builder.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us builder.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</ins><span class="cx"> //
</span><span class="cx"> // script.aculo.us is freely distributable under the terms of an MIT-style license.
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx">   //       due to a Firefox bug
</span><span class="cx">   node: function(elementName) {
</span><span class="cx">     elementName = elementName.toUpperCase();
</span><del>-    
</del><ins>+
</ins><span class="cx">     // try innerHTML approach
</span><span class="cx">     var parentTag = this.NODEMAP[elementName] || 'div';
</span><span class="cx">     var parentElement = document.createElement(parentTag);
</span><span class="lines">@@ -34,14 +34,14 @@
</span><span class="cx">       parentElement.innerHTML = &quot;&lt;&quot; + elementName + &quot;&gt;&lt;/&quot; + elementName + &quot;&gt;&quot;;
</span><span class="cx">     } catch(e) {}
</span><span class="cx">     var element = parentElement.firstChild || null;
</span><del>-      
</del><ins>+
</ins><span class="cx">     // see if browser added wrapping tags
</span><span class="cx">     if(element &amp;&amp; (element.tagName.toUpperCase() != elementName))
</span><span class="cx">       element = element.getElementsByTagName(elementName)[0];
</span><del>-    
</del><ins>+
</ins><span class="cx">     // fallback to createElement approach
</span><span class="cx">     if(!element) element = document.createElement(elementName);
</span><del>-    
</del><ins>+
</ins><span class="cx">     // abort if nothing could be created
</span><span class="cx">     if(!element) return;
</span><span class="cx"> 
</span><span class="lines">@@ -62,19 +62,19 @@
</span><span class="cx">             // workaround firefox 1.0.X bug
</span><span class="cx">             if(!element) {
</span><span class="cx">               element = document.createElement(elementName);
</span><del>-              for(attr in arguments[1]) 
</del><ins>+              for(attr in arguments[1])
</ins><span class="cx">                 element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
</span><span class="cx">             }
</span><span class="cx">             if(element.tagName.toUpperCase() != elementName)
</span><span class="cx">               element = parentElement.getElementsByTagName(elementName)[0];
</span><span class="cx">           }
</span><del>-        } 
</del><ins>+        }
</ins><span class="cx"> 
</span><span class="cx">     // text, or array of children
</span><span class="cx">     if(arguments[2])
</span><span class="cx">       this._children(element, arguments[2]);
</span><span class="cx"> 
</span><del>-     return element;
</del><ins>+     return $(element);
</ins><span class="cx">   },
</span><span class="cx">   _text: function(text) {
</span><span class="cx">      return document.createTextNode(text);
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx">     if(typeof children=='object') { // array can hold nodes and text
</span><span class="cx">       children.flatten().each( function(e) {
</span><span class="cx">         if(typeof e=='object')
</span><del>-          element.appendChild(e)
</del><ins>+          element.appendChild(e);
</ins><span class="cx">         else
</span><span class="cx">           if(Builder._isStringOrNumber(e))
</span><span class="cx">             element.appendChild(Builder._text(e));
</span><span class="lines">@@ -117,20 +117,20 @@
</span><span class="cx">     $(element).update(html.strip());
</span><span class="cx">     return element.down();
</span><span class="cx">   },
</span><del>-  dump: function(scope) { 
-    if(typeof scope != 'object' &amp;&amp; typeof scope != 'function') scope = window; //global scope 
-  
</del><ins>+  dump: function(scope) {
+    if(typeof scope != 'object' &amp;&amp; typeof scope != 'function') scope = window; //global scope
+
</ins><span class="cx">     var tags = (&quot;A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY &quot; +
</span><span class="cx">       &quot;BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET &quot; +
</span><span class="cx">       &quot;FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX &quot;+
</span><span class="cx">       &quot;KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P &quot;+
</span><span class="cx">       &quot;PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD &quot;+
</span><span class="cx">       &quot;TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR&quot;).split(/\s+/);
</span><del>-  
-    tags.each( function(tag){ 
-      scope[tag] = function() { 
-        return Builder.node.apply(Builder, [tag].concat($A(arguments)));  
-      } 
</del><ins>+
+    tags.each( function(tag){
+      scope[tag] = function() {
+        return Builder.node.apply(Builder, [tag].concat($A(arguments)));
+      };
</ins><span class="cx">     });
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculouscontrolsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/controls.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/controls.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/controls.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,24 +1,24 @@
</span><del>-// script.aculo.us controls.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-//           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//           (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
+//           (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
</ins><span class="cx"> // Contributors:
</span><span class="cx"> //  Richard Livsey
</span><span class="cx"> //  Rahul Bhargava
</span><span class="cx"> //  Rob Wills
</span><del>-// 
</del><ins>+//
</ins><span class="cx"> // script.aculo.us is freely distributable under the terms of an MIT-style license.
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="cx"> 
</span><del>-// Autocompleter.Base handles all the autocompletion functionality 
</del><ins>+// Autocompleter.Base handles all the autocompletion functionality
</ins><span class="cx"> // that's independent of the data source for autocompletion. This
</span><span class="cx"> // includes drawing the autocompletion menu, observing keyboard
</span><span class="cx"> // and mouse events, and similar.
</span><span class="cx"> //
</span><del>-// Specific autocompleters need to provide, at the very least, 
</del><ins>+// Specific autocompleters need to provide, at the very least,
</ins><span class="cx"> // a getUpdatedChoices function that will be invoked every time
</span><del>-// the text inside the monitored textbox changes. This method 
</del><ins>+// the text inside the monitored textbox changes. This method
</ins><span class="cx"> // should get the text for which to provide autocompletion by
</span><span class="cx"> // invoking this.getToken(), NOT by directly accessing
</span><span class="cx"> // this.element.value. This is to allow incremental tokenized
</span><span class="lines">@@ -32,23 +32,23 @@
</span><span class="cx"> // will incrementally autocomplete with a comma as the token.
</span><span class="cx"> // Additionally, ',' in the above example can be replaced with
</span><span class="cx"> // a token array, e.g. { tokens: [',', '\n'] } which
</span><del>-// enables autocompletion on multiple tokens. This is most 
-// useful when one of the tokens is \n (a newline), as it 
</del><ins>+// enables autocompletion on multiple tokens. This is most
+// useful when one of the tokens is \n (a newline), as it
</ins><span class="cx"> // allows smart autocompletion after linebreaks.
</span><span class="cx"> 
</span><span class="cx"> if(typeof Effect == 'undefined')
</span><span class="cx">   throw(&quot;controls.js requires including script.aculo.us' effects.js library&quot;);
</span><span class="cx"> 
</span><del>-var Autocompleter = { }
</del><ins>+var Autocompleter = { };
</ins><span class="cx"> Autocompleter.Base = Class.create({
</span><span class="cx">   baseInitialize: function(element, update, options) {
</span><del>-    element          = $(element)
-    this.element     = element; 
-    this.update      = $(update);  
-    this.hasFocus    = false; 
-    this.changed     = false; 
-    this.active      = false; 
-    this.index       = 0;     
</del><ins>+    element          = $(element);
+    this.element     = element;
+    this.update      = $(update);
+    this.hasFocus    = false;
+    this.changed     = false;
+    this.active      = false;
+    this.index       = 0;
</ins><span class="cx">     this.entryCount  = 0;
</span><span class="cx">     this.oldElementValue = this.element.value;
</span><span class="cx"> 
</span><span class="lines">@@ -61,42 +61,42 @@
</span><span class="cx">     this.options.tokens       = this.options.tokens || [];
</span><span class="cx">     this.options.frequency    = this.options.frequency || 0.4;
</span><span class="cx">     this.options.minChars     = this.options.minChars || 1;
</span><del>-    this.options.onShow       = this.options.onShow || 
-      function(element, update){ 
</del><ins>+    this.options.onShow       = this.options.onShow ||
+      function(element, update){
</ins><span class="cx">         if(!update.style.position || update.style.position=='absolute') {
</span><span class="cx">           update.style.position = 'absolute';
</span><span class="cx">           Position.clone(element, update, {
</span><del>-            setHeight: false, 
</del><ins>+            setHeight: false,
</ins><span class="cx">             offsetTop: element.offsetHeight
</span><span class="cx">           });
</span><span class="cx">         }
</span><span class="cx">         Effect.Appear(update,{duration:0.15});
</span><span class="cx">       };
</span><del>-    this.options.onHide = this.options.onHide || 
</del><ins>+    this.options.onHide = this.options.onHide ||
</ins><span class="cx">       function(element, update){ new Effect.Fade(update,{duration:0.15}) };
</span><span class="cx"> 
</span><del>-    if(typeof(this.options.tokens) == 'string') 
</del><ins>+    if(typeof(this.options.tokens) == 'string')
</ins><span class="cx">       this.options.tokens = new Array(this.options.tokens);
</span><span class="cx">     // Force carriage returns as token delimiters anyway
</span><span class="cx">     if (!this.options.tokens.include('\n'))
</span><span class="cx">       this.options.tokens.push('\n');
</span><span class="cx"> 
</span><span class="cx">     this.observer = null;
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.element.setAttribute('autocomplete','off');
</span><span class="cx"> 
</span><span class="cx">     Element.hide(this.update);
</span><span class="cx"> 
</span><span class="cx">     Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
</span><del>-    Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this));
</del><ins>+    Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   show: function() {
</span><span class="cx">     if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
</span><del>-    if(!this.iefix &amp;&amp; 
</del><ins>+    if(!this.iefix &amp;&amp;
</ins><span class="cx">       (Prototype.Browser.IE) &amp;&amp;
</span><span class="cx">       (Element.getStyle(this.update, 'position')=='absolute')) {
</span><del>-      new Insertion.After(this.update, 
</del><ins>+      new Insertion.After(this.update,
</ins><span class="cx">        '&lt;iframe id=&quot;' + this.update.id + '_iefix&quot; '+
</span><span class="cx">        'style=&quot;display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);&quot; ' +
</span><span class="cx">        'src=&quot;javascript:false;&quot; frameborder=&quot;0&quot; scrolling=&quot;no&quot;&gt;&lt;/iframe&gt;');
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     }
</span><span class="cx">     if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   fixIEOverlapping: function() {
</span><span class="cx">     Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
</span><span class="cx">     this.iefix.style.zIndex = 1;
</span><span class="lines">@@ -144,23 +144,23 @@
</span><span class="cx">        case Event.KEY_UP:
</span><span class="cx">          this.markPrevious();
</span><span class="cx">          this.render();
</span><del>-         if(Prototype.Browser.WebKit) Event.stop(event);
</del><ins>+         Event.stop(event);
</ins><span class="cx">          return;
</span><span class="cx">        case Event.KEY_DOWN:
</span><span class="cx">          this.markNext();
</span><span class="cx">          this.render();
</span><del>-         if(Prototype.Browser.WebKit) Event.stop(event);
</del><ins>+         Event.stop(event);
</ins><span class="cx">          return;
</span><span class="cx">       }
</span><del>-     else 
-       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN || 
</del><ins>+     else
+       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
</ins><span class="cx">          (Prototype.Browser.WebKit &gt; 0 &amp;&amp; event.keyCode == 0)) return;
</span><span class="cx"> 
</span><span class="cx">     this.changed = true;
</span><span class="cx">     this.hasFocus = true;
</span><span class="cx"> 
</span><span class="cx">     if(this.observer) clearTimeout(this.observer);
</span><del>-      this.observer = 
</del><ins>+      this.observer =
</ins><span class="cx">         setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -172,35 +172,35 @@
</span><span class="cx"> 
</span><span class="cx">   onHover: function(event) {
</span><span class="cx">     var element = Event.findElement(event, 'LI');
</span><del>-    if(this.index != element.autocompleteIndex) 
</del><ins>+    if(this.index != element.autocompleteIndex)
</ins><span class="cx">     {
</span><span class="cx">         this.index = element.autocompleteIndex;
</span><span class="cx">         this.render();
</span><span class="cx">     }
</span><span class="cx">     Event.stop(event);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   onClick: function(event) {
</span><span class="cx">     var element = Event.findElement(event, 'LI');
</span><span class="cx">     this.index = element.autocompleteIndex;
</span><span class="cx">     this.selectEntry();
</span><span class="cx">     this.hide();
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   onBlur: function(event) {
</span><span class="cx">     // needed to make click events working
</span><span class="cx">     setTimeout(this.hide.bind(this), 250);
</span><span class="cx">     this.hasFocus = false;
</span><del>-    this.active = false;     
-  }, 
-  
</del><ins>+    this.active = false;
+  },
+
</ins><span class="cx">   render: function() {
</span><span class="cx">     if(this.entryCount &gt; 0) {
</span><span class="cx">       for (var i = 0; i &lt; this.entryCount; i++)
</span><del>-        this.index==i ? 
-          Element.addClassName(this.getEntry(i),&quot;selected&quot;) : 
</del><ins>+        this.index==i ?
+          Element.addClassName(this.getEntry(i),&quot;selected&quot;) :
</ins><span class="cx">           Element.removeClassName(this.getEntry(i),&quot;selected&quot;);
</span><del>-      if(this.hasFocus) { 
</del><ins>+      if(this.hasFocus) {
</ins><span class="cx">         this.show();
</span><span class="cx">         this.active = true;
</span><span class="cx">       }
</span><span class="lines">@@ -209,27 +209,27 @@
</span><span class="cx">       this.hide();
</span><span class="cx">     }
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   markPrevious: function() {
</span><del>-    if(this.index &gt; 0) this.index--
</del><ins>+    if(this.index &gt; 0) this.index--;
</ins><span class="cx">       else this.index = this.entryCount-1;
</span><span class="cx">     this.getEntry(this.index).scrollIntoView(true);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   markNext: function() {
</span><del>-    if(this.index &lt; this.entryCount-1) this.index++
</del><ins>+    if(this.index &lt; this.entryCount-1) this.index++;
</ins><span class="cx">       else this.index = 0;
</span><span class="cx">     this.getEntry(this.index).scrollIntoView(false);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   getEntry: function(index) {
</span><span class="cx">     return this.update.firstChild.childNodes[index];
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   getCurrentEntry: function() {
</span><span class="cx">     return this.getEntry(this.index);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   selectEntry: function() {
</span><span class="cx">     this.active = false;
</span><span class="cx">     this.updateElement(this.getCurrentEntry());
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">       if(nodes.length&gt;0) value = Element.collectTextNodes(nodes[0], this.options.select);
</span><span class="cx">     } else
</span><span class="cx">       value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
</span><del>-    
</del><ins>+
</ins><span class="cx">     var bounds = this.getTokenBounds();
</span><span class="cx">     if (bounds[0] != -1) {
</span><span class="cx">       var newValue = this.element.value.substr(0, bounds[0]);
</span><span class="lines">@@ -259,7 +259,7 @@
</span><span class="cx">     }
</span><span class="cx">     this.oldElementValue = this.element.value;
</span><span class="cx">     this.element.focus();
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (this.options.afterUpdateElement)
</span><span class="cx">       this.options.afterUpdateElement(this.element, selectedElement);
</span><span class="cx">   },
</span><span class="lines">@@ -271,20 +271,20 @@
</span><span class="cx">       Element.cleanWhitespace(this.update.down());
</span><span class="cx"> 
</span><span class="cx">       if(this.update.firstChild &amp;&amp; this.update.down().childNodes) {
</span><del>-        this.entryCount = 
</del><ins>+        this.entryCount =
</ins><span class="cx">           this.update.down().childNodes.length;
</span><span class="cx">         for (var i = 0; i &lt; this.entryCount; i++) {
</span><span class="cx">           var entry = this.getEntry(i);
</span><span class="cx">           entry.autocompleteIndex = i;
</span><span class="cx">           this.addObservers(entry);
</span><span class="cx">         }
</span><del>-      } else { 
</del><ins>+      } else {
</ins><span class="cx">         this.entryCount = 0;
</span><span class="cx">       }
</span><span class="cx"> 
</span><span class="cx">       this.stopIndicator();
</span><span class="cx">       this.index = 0;
</span><del>-      
</del><ins>+
</ins><span class="cx">       if(this.entryCount==1 &amp;&amp; this.options.autoSelect) {
</span><span class="cx">         this.selectEntry();
</span><span class="cx">         this.hide();
</span><span class="lines">@@ -300,7 +300,7 @@
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   onObserverEvent: function() {
</span><del>-    this.changed = false;   
</del><ins>+    this.changed = false;
</ins><span class="cx">     this.tokenBounds = null;
</span><span class="cx">     if(this.getToken().length&gt;=this.options.minChars) {
</span><span class="cx">       this.getUpdatedChoices();
</span><span class="lines">@@ -353,16 +353,16 @@
</span><span class="cx"> 
</span><span class="cx">   getUpdatedChoices: function() {
</span><span class="cx">     this.startIndicator();
</span><del>-    
-    var entry = encodeURIComponent(this.options.paramName) + '=' + 
</del><ins>+
+    var entry = encodeURIComponent(this.options.paramName) + '=' +
</ins><span class="cx">       encodeURIComponent(this.getToken());
</span><span class="cx"> 
</span><span class="cx">     this.options.parameters = this.options.callback ?
</span><span class="cx">       this.options.callback(this.element, entry) : entry;
</span><span class="cx"> 
</span><del>-    if(this.options.defaultParams) 
</del><ins>+    if(this.options.defaultParams)
</ins><span class="cx">       this.options.parameters += '&amp;' + this.options.defaultParams;
</span><del>-    
</del><ins>+
</ins><span class="cx">     new Ajax.Request(this.url, this.options);
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -384,7 +384,7 @@
</span><span class="cx"> // - choices - How many autocompletion choices to offer
</span><span class="cx"> //
</span><span class="cx"> // - partialSearch - If false, the autocompleter will match entered
</span><del>-//                    text only at the beginning of strings in the 
</del><ins>+//                    text only at the beginning of strings in the
</ins><span class="cx"> //                    autocomplete array. Defaults to true, which will
</span><span class="cx"> //                    match text at the beginning of any *word* in the
</span><span class="cx"> //                    strings in the autocomplete array. If you want to
</span><span class="lines">@@ -401,7 +401,7 @@
</span><span class="cx"> // - ignoreCase - Whether to ignore case when autocompleting.
</span><span class="cx"> //                 Defaults to true.
</span><span class="cx"> //
</span><del>-// It's possible to pass in a custom function as the 'selector' 
</del><ins>+// It's possible to pass in a custom function as the 'selector'
</ins><span class="cx"> // option, if you prefer to write your own autocompletion logic.
</span><span class="cx"> // In that case, the other options above will not apply unless
</span><span class="cx"> // you support them.
</span><span class="lines">@@ -429,20 +429,20 @@
</span><span class="cx">         var entry     = instance.getToken();
</span><span class="cx">         var count     = 0;
</span><span class="cx"> 
</span><del>-        for (var i = 0; i &lt; instance.options.array.length &amp;&amp;  
-          ret.length &lt; instance.options.choices ; i++) { 
</del><ins>+        for (var i = 0; i &lt; instance.options.array.length &amp;&amp;
+          ret.length &lt; instance.options.choices ; i++) {
</ins><span class="cx"> 
</span><span class="cx">           var elem = instance.options.array[i];
</span><del>-          var foundPos = instance.options.ignoreCase ? 
-            elem.toLowerCase().indexOf(entry.toLowerCase()) : 
</del><ins>+          var foundPos = instance.options.ignoreCase ?
+            elem.toLowerCase().indexOf(entry.toLowerCase()) :
</ins><span class="cx">             elem.indexOf(entry);
</span><span class="cx"> 
</span><span class="cx">           while (foundPos != -1) {
</span><del>-            if (foundPos == 0 &amp;&amp; elem.length != entry.length) { 
-              ret.push(&quot;&lt;li&gt;&lt;strong&gt;&quot; + elem.substr(0, entry.length) + &quot;&lt;/strong&gt;&quot; + 
</del><ins>+            if (foundPos == 0 &amp;&amp; elem.length != entry.length) {
+              ret.push(&quot;&lt;li&gt;&lt;strong&gt;&quot; + elem.substr(0, entry.length) + &quot;&lt;/strong&gt;&quot; +
</ins><span class="cx">                 elem.substr(entry.length) + &quot;&lt;/li&gt;&quot;);
</span><span class="cx">               break;
</span><del>-            } else if (entry.length &gt;= instance.options.partialChars &amp;&amp; 
</del><ins>+            } else if (entry.length &gt;= instance.options.partialChars &amp;&amp;
</ins><span class="cx">               instance.options.partialSearch &amp;&amp; foundPos != -1) {
</span><span class="cx">               if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
</span><span class="cx">                 partial.push(&quot;&lt;li&gt;&quot; + elem.substr(0, foundPos) + &quot;&lt;strong&gt;&quot; +
</span><span class="lines">@@ -452,14 +452,14 @@
</span><span class="cx">               }
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            foundPos = instance.options.ignoreCase ? 
-              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) : 
</del><ins>+            foundPos = instance.options.ignoreCase ?
+              elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
</ins><span class="cx">               elem.indexOf(entry, foundPos + 1);
</span><span class="cx"> 
</span><span class="cx">           }
</span><span class="cx">         }
</span><span class="cx">         if (partial.length)
</span><del>-          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
</del><ins>+          ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
</ins><span class="cx">         return &quot;&lt;ul&gt;&quot; + ret.join('') + &quot;&lt;/ul&gt;&quot;;
</span><span class="cx">       }
</span><span class="cx">     }, options || { });
</span><span class="lines">@@ -476,7 +476,7 @@
</span><span class="cx">   setTimeout(function() {
</span><span class="cx">     Field.activate(field);
</span><span class="cx">   }, 1);
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Ajax.InPlaceEditor = Class.create({
</span><span class="cx">   initialize: function(element, url, options) {
</span><span class="lines">@@ -606,7 +606,7 @@
</span><span class="cx">     this.triggerCallback('onEnterHover');
</span><span class="cx">   },
</span><span class="cx">   getText: function() {
</span><del>-    return this.element.innerHTML;
</del><ins>+    return this.element.innerHTML.unescapeHTML();
</ins><span class="cx">   },
</span><span class="cx">   handleAJAXFailure: function(transport) {
</span><span class="cx">     this.triggerCallback('onFailure', transport);
</span><span class="lines">@@ -782,7 +782,7 @@
</span><span class="cx">       onSuccess: function(transport) {
</span><span class="cx">         var js = transport.responseText.strip();
</span><span class="cx">         if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
</span><del>-          throw 'Server returned an invalid collection representation.';
</del><ins>+          throw('Server returned an invalid collection representation.');
</ins><span class="cx">         this._collection = eval(js);
</span><span class="cx">         this.checkForExternalText();
</span><span class="cx">       }.bind(this),
</span><span class="lines">@@ -939,7 +939,7 @@
</span><span class="cx">   loadingCollectionText: 'Loading options...'
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-// Delayed observer, like Form.Element.Observer, 
</del><ins>+// Delayed observer, like Form.Element.Observer,
</ins><span class="cx"> // but waits for delay after last key input
</span><span class="cx"> // Ideal for live-search fields
</span><span class="cx"> 
</span><span class="lines">@@ -949,7 +949,7 @@
</span><span class="cx">     this.element   = $(element);
</span><span class="cx">     this.callback  = callback;
</span><span class="cx">     this.timer     = null;
</span><del>-    this.lastValue = $F(this.element); 
</del><ins>+    this.lastValue = $F(this.element);
</ins><span class="cx">     Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
</span><span class="cx">   },
</span><span class="cx">   delayedListener: function(event) {
</span><span class="lines">@@ -962,4 +962,4 @@
</span><span class="cx">     this.timer = null;
</span><span class="cx">     this.callback(this.element, $F(this.element));
</span><span class="cx">   }
</span><del>-});
</del><ins>+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculousdragdropjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/dragdrop.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/dragdrop.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/dragdrop.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,8 +1,7 @@
</span><del>-// script.aculo.us dragdrop.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-// 
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
</ins><span class="cx"> // script.aculo.us is freely distributable under the terms of an MIT-style license.
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="cx"> 
</span><span class="lines">@@ -34,7 +33,7 @@
</span><span class="cx">         options._containers.push($(containment));
</span><span class="cx">       }
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(options.accept) options.accept = [options.accept].flatten();
</span><span class="cx"> 
</span><span class="cx">     Element.makePositioned(element); // fix IE
</span><span class="lines">@@ -42,34 +41,34 @@
</span><span class="cx"> 
</span><span class="cx">     this.drops.push(options);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   findDeepestChild: function(drops) {
</span><span class="cx">     deepest = drops[0];
</span><del>-      
</del><ins>+
</ins><span class="cx">     for (i = 1; i &lt; drops.length; ++i)
</span><span class="cx">       if (Element.isParent(drops[i].element, deepest.element))
</span><span class="cx">         deepest = drops[i];
</span><del>-    
</del><ins>+
</ins><span class="cx">     return deepest;
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   isContained: function(element, drop) {
</span><span class="cx">     var containmentNode;
</span><span class="cx">     if(drop.tree) {
</span><del>-      containmentNode = element.treeNode; 
</del><ins>+      containmentNode = element.treeNode;
</ins><span class="cx">     } else {
</span><span class="cx">       containmentNode = element.parentNode;
</span><span class="cx">     }
</span><span class="cx">     return drop._containers.detect(function(c) { return containmentNode == c });
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   isAffected: function(point, element, drop) {
</span><span class="cx">     return (
</span><span class="cx">       (drop.element!=element) &amp;&amp;
</span><span class="cx">       ((!drop._containers) ||
</span><span class="cx">         this.isContained(element, drop)) &amp;&amp;
</span><span class="cx">       ((!drop.accept) ||
</span><del>-        (Element.classNames(element).detect( 
</del><ins>+        (Element.classNames(element).detect(
</ins><span class="cx">           function(v) { return drop.accept.include(v) } ) )) &amp;&amp;
</span><span class="cx">       Position.within(drop.element, point[0], point[1]) );
</span><span class="cx">   },
</span><span class="lines">@@ -89,12 +88,12 @@
</span><span class="cx">   show: function(point, element) {
</span><span class="cx">     if(!this.drops.length) return;
</span><span class="cx">     var drop, affected = [];
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.drops.each( function(drop) {
</span><span class="cx">       if(Droppables.isAffected(point, element, drop))
</span><span class="cx">         affected.push(drop);
</span><span class="cx">     });
</span><del>-        
</del><ins>+
</ins><span class="cx">     if(affected.length&gt;0)
</span><span class="cx">       drop = Droppables.findDeepestChild(affected);
</span><span class="cx"> 
</span><span class="lines">@@ -103,7 +102,7 @@
</span><span class="cx">       Position.within(drop.element, point[0], point[1]);
</span><span class="cx">       if(drop.onHover)
</span><span class="cx">         drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
</span><del>-      
</del><ins>+
</ins><span class="cx">       if (drop != this.last_active) Droppables.activate(drop);
</span><span class="cx">     }
</span><span class="cx">   },
</span><span class="lines">@@ -114,8 +113,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
</span><span class="cx">       if (this.last_active.onDrop) {
</span><del>-        this.last_active.onDrop(element, this.last_active.element, event); 
-        return true; 
</del><ins>+        this.last_active.onDrop(element, this.last_active.element, event);
+        return true;
</ins><span class="cx">       }
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -123,25 +122,25 @@
</span><span class="cx">     if(this.last_active)
</span><span class="cx">       this.deactivate(this.last_active);
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> var Draggables = {
</span><span class="cx">   drags: [],
</span><span class="cx">   observers: [],
</span><del>-  
</del><ins>+
</ins><span class="cx">   register: function(draggable) {
</span><span class="cx">     if(this.drags.length == 0) {
</span><span class="cx">       this.eventMouseUp   = this.endDrag.bindAsEventListener(this);
</span><span class="cx">       this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
</span><span class="cx">       this.eventKeypress  = this.keyPress.bindAsEventListener(this);
</span><del>-      
</del><ins>+
</ins><span class="cx">       Event.observe(document, &quot;mouseup&quot;, this.eventMouseUp);
</span><span class="cx">       Event.observe(document, &quot;mousemove&quot;, this.eventMouseMove);
</span><span class="cx">       Event.observe(document, &quot;keypress&quot;, this.eventKeypress);
</span><span class="cx">     }
</span><span class="cx">     this.drags.push(draggable);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   unregister: function(draggable) {
</span><span class="cx">     this.drags = this.drags.reject(function(d) { return d==draggable });
</span><span class="cx">     if(this.drags.length == 0) {
</span><span class="lines">@@ -150,24 +149,24 @@
</span><span class="cx">       Event.stopObserving(document, &quot;keypress&quot;, this.eventKeypress);
</span><span class="cx">     }
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   activate: function(draggable) {
</span><del>-    if(draggable.options.delay) { 
-      this._timeout = setTimeout(function() { 
-        Draggables._timeout = null; 
-        window.focus(); 
-        Draggables.activeDraggable = draggable; 
-      }.bind(this), draggable.options.delay); 
</del><ins>+    if(draggable.options.delay) {
+      this._timeout = setTimeout(function() {
+        Draggables._timeout = null;
+        window.focus();
+        Draggables.activeDraggable = draggable;
+      }.bind(this), draggable.options.delay);
</ins><span class="cx">     } else {
</span><span class="cx">       window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
</span><span class="cx">       this.activeDraggable = draggable;
</span><span class="cx">     }
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   deactivate: function() {
</span><span class="cx">     this.activeDraggable = null;
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   updateDrag: function(event) {
</span><span class="cx">     if(!this.activeDraggable) return;
</span><span class="cx">     var pointer = [Event.pointerX(event), Event.pointerY(event)];
</span><span class="lines">@@ -175,36 +174,36 @@
</span><span class="cx">     // the same coordinates, prevent needless redrawing (moz bug?)
</span><span class="cx">     if(this._lastPointer &amp;&amp; (this._lastPointer.inspect() == pointer.inspect())) return;
</span><span class="cx">     this._lastPointer = pointer;
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.activeDraggable.updateDrag(event, pointer);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   endDrag: function(event) {
</span><del>-    if(this._timeout) { 
-      clearTimeout(this._timeout); 
-      this._timeout = null; 
</del><ins>+    if(this._timeout) {
+      clearTimeout(this._timeout);
+      this._timeout = null;
</ins><span class="cx">     }
</span><span class="cx">     if(!this.activeDraggable) return;
</span><span class="cx">     this._lastPointer = null;
</span><span class="cx">     this.activeDraggable.endDrag(event);
</span><span class="cx">     this.activeDraggable = null;
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   keyPress: function(event) {
</span><span class="cx">     if(this.activeDraggable)
</span><span class="cx">       this.activeDraggable.keyPress(event);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   addObserver: function(observer) {
</span><span class="cx">     this.observers.push(observer);
</span><span class="cx">     this._cacheObserverCallbacks();
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   removeObserver: function(element) {  // element instead of observer fixes mem leaks
</span><span class="cx">     this.observers = this.observers.reject( function(o) { return o.element==element });
</span><span class="cx">     this._cacheObserverCallbacks();
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
</span><span class="cx">     if(this[eventName+'Count'] &gt; 0)
</span><span class="cx">       this.observers.each( function(o) {
</span><span class="lines">@@ -212,7 +211,7 @@
</span><span class="cx">       });
</span><span class="cx">     if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   _cacheObserverCallbacks: function() {
</span><span class="cx">     ['onStart','onEnd','onDrag'].each( function(eventName) {
</span><span class="cx">       Draggables[eventName+'Count'] = Draggables.observers.select(
</span><span class="lines">@@ -220,7 +219,7 @@
</span><span class="cx">       ).length;
</span><span class="cx">     });
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><span class="lines">@@ -236,12 +235,12 @@
</span><span class="cx">       },
</span><span class="cx">       endeffect: function(element) {
</span><span class="cx">         var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
</span><del>-        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity, 
</del><ins>+        new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
</ins><span class="cx">           queue: {scope:'_draggable', position:'end'},
</span><del>-          afterFinish: function(){ 
-            Draggable._dragging[element] = false 
</del><ins>+          afterFinish: function(){
+            Draggable._dragging[element] = false
</ins><span class="cx">           }
</span><del>-        }); 
</del><ins>+        });
</ins><span class="cx">       },
</span><span class="cx">       zindex: 1000,
</span><span class="cx">       revert: false,
</span><span class="lines">@@ -252,57 +251,57 @@
</span><span class="cx">       snap: false,  // false, or xy or [x,y] or function(x,y){ return [x,y] }
</span><span class="cx">       delay: 0
</span><span class="cx">     };
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
</span><span class="cx">       Object.extend(defaults, {
</span><span class="cx">         starteffect: function(element) {
</span><span class="cx">           element._opacity = Element.getOpacity(element);
</span><span class="cx">           Draggable._dragging[element] = true;
</span><del>-          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7}); 
</del><ins>+          new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
</ins><span class="cx">         }
</span><span class="cx">       });
</span><del>-    
</del><ins>+
</ins><span class="cx">     var options = Object.extend(defaults, arguments[1] || { });
</span><span class="cx"> 
</span><span class="cx">     this.element = $(element);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(options.handle &amp;&amp; Object.isString(options.handle))
</span><span class="cx">       this.handle = this.element.down('.'+options.handle, 0);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(!this.handle) this.handle = $(options.handle);
</span><span class="cx">     if(!this.handle) this.handle = this.element;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(options.scroll &amp;&amp; !options.scroll.scrollTo &amp;&amp; !options.scroll.outerHTML) {
</span><span class="cx">       options.scroll = $(options.scroll);
</span><span class="cx">       this._isScrollChild = Element.childOf(this.element, options.scroll);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Element.makePositioned(this.element); // fix IE    
</del><ins>+    Element.makePositioned(this.element); // fix IE
</ins><span class="cx"> 
</span><span class="cx">     this.options  = options;
</span><del>-    this.dragging = false;   
</del><ins>+    this.dragging = false;
</ins><span class="cx"> 
</span><span class="cx">     this.eventMouseDown = this.initDrag.bindAsEventListener(this);
</span><span class="cx">     Event.observe(this.handle, &quot;mousedown&quot;, this.eventMouseDown);
</span><del>-    
</del><ins>+
</ins><span class="cx">     Draggables.register(this);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   destroy: function() {
</span><span class="cx">     Event.stopObserving(this.handle, &quot;mousedown&quot;, this.eventMouseDown);
</span><span class="cx">     Draggables.unregister(this);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   currentDelta: function() {
</span><span class="cx">     return([
</span><span class="cx">       parseInt(Element.getStyle(this.element,'left') || '0'),
</span><span class="cx">       parseInt(Element.getStyle(this.element,'top') || '0')]);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   initDrag: function(event) {
</span><span class="cx">     if(!Object.isUndefined(Draggable._dragging[this.element]) &amp;&amp;
</span><span class="cx">       Draggable._dragging[this.element]) return;
</span><del>-    if(Event.isLeftClick(event)) {    
</del><ins>+    if(Event.isLeftClick(event)) {
</ins><span class="cx">       // abort on form elements, fixes a Firefox issue
</span><span class="cx">       var src = Event.element(event);
</span><span class="cx">       if((tag_name = src.tagName.toUpperCase()) &amp;&amp; (
</span><span class="lines">@@ -311,34 +310,34 @@
</span><span class="cx">         tag_name=='OPTION' ||
</span><span class="cx">         tag_name=='BUTTON' ||
</span><span class="cx">         tag_name=='TEXTAREA')) return;
</span><del>-        
</del><ins>+
</ins><span class="cx">       var pointer = [Event.pointerX(event), Event.pointerY(event)];
</span><del>-      var pos     = Position.cumulativeOffset(this.element);
</del><ins>+      var pos     = this.element.cumulativeOffset();
</ins><span class="cx">       this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
</span><del>-      
</del><ins>+
</ins><span class="cx">       Draggables.activate(this);
</span><span class="cx">       Event.stop(event);
</span><span class="cx">     }
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   startDrag: function(event) {
</span><span class="cx">     this.dragging = true;
</span><span class="cx">     if(!this.delta)
</span><span class="cx">       this.delta = this.currentDelta();
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.zindex) {
</span><span class="cx">       this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
</span><span class="cx">       this.element.style.zIndex = this.options.zindex;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.ghosting) {
</span><span class="cx">       this._clone = this.element.cloneNode(true);
</span><del>-      this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
-      if (!this.element._originallyAbsolute)
</del><ins>+      this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
+      if (!this._originallyAbsolute)
</ins><span class="cx">         Position.absolutize(this.element);
</span><span class="cx">       this.element.parentNode.insertBefore(this._clone, this.element);
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.scroll) {
</span><span class="cx">       if (this.options.scroll == window) {
</span><span class="cx">         var where = this._getWindowScroll(this.options.scroll);
</span><span class="lines">@@ -349,28 +348,28 @@
</span><span class="cx">         this.originalScrollTop = this.options.scroll.scrollTop;
</span><span class="cx">       }
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     Draggables.notify('onStart', this, event);
</span><del>-        
</del><ins>+
</ins><span class="cx">     if(this.options.starteffect) this.options.starteffect(this.element);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   updateDrag: function(event, pointer) {
</span><span class="cx">     if(!this.dragging) this.startDrag(event);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(!this.options.quiet){
</span><span class="cx">       Position.prepare();
</span><span class="cx">       Droppables.show(pointer, this.element);
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     Draggables.notify('onDrag', this, event);
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.draw(pointer);
</span><span class="cx">     if(this.options.change) this.options.change(this);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.scroll) {
</span><span class="cx">       this.stopScrolling();
</span><del>-      
</del><ins>+
</ins><span class="cx">       var p;
</span><span class="cx">       if (this.options.scroll == window) {
</span><span class="cx">         with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
</span><span class="lines">@@ -388,16 +387,16 @@
</span><span class="cx">       if(pointer[1] &gt; (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
</span><span class="cx">       this.startScrolling(speed);
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     // fix AppleWebKit rendering
</span><span class="cx">     if(Prototype.Browser.WebKit) window.scrollBy(0,0);
</span><del>-    
</del><ins>+
</ins><span class="cx">     Event.stop(event);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   finishDrag: function(event, success) {
</span><span class="cx">     this.dragging = false;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.quiet){
</span><span class="cx">       Position.prepare();
</span><span class="cx">       var pointer = [Event.pointerX(event), Event.pointerY(event)];
</span><span class="lines">@@ -405,24 +404,24 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if(this.options.ghosting) {
</span><del>-      if (!this.element._originallyAbsolute)
</del><ins>+      if (!this._originallyAbsolute)
</ins><span class="cx">         Position.relativize(this.element);
</span><del>-      delete this.element._originallyAbsolute;
</del><ins>+      delete this._originallyAbsolute;
</ins><span class="cx">       Element.remove(this._clone);
</span><span class="cx">       this._clone = null;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    var dropped = false; 
-    if(success) { 
-      dropped = Droppables.fire(event, this.element); 
-      if (!dropped) dropped = false; 
</del><ins>+    var dropped = false;
+    if(success) {
+      dropped = Droppables.fire(event, this.element);
+      if (!dropped) dropped = false;
</ins><span class="cx">     }
</span><span class="cx">     if(dropped &amp;&amp; this.options.onDropped) this.options.onDropped(this.element);
</span><span class="cx">     Draggables.notify('onEnd', this, event);
</span><span class="cx"> 
</span><span class="cx">     var revert = this.options.revert;
</span><span class="cx">     if(revert &amp;&amp; Object.isFunction(revert)) revert = revert(this.element);
</span><del>-    
</del><ins>+
</ins><span class="cx">     var d = this.currentDelta();
</span><span class="cx">     if(revert &amp;&amp; this.options.reverteffect) {
</span><span class="cx">       if (dropped == 0 || revert != 'failure')
</span><span class="lines">@@ -435,67 +434,67 @@
</span><span class="cx">     if(this.options.zindex)
</span><span class="cx">       this.element.style.zIndex = this.originalZ;
</span><span class="cx"> 
</span><del>-    if(this.options.endeffect) 
</del><ins>+    if(this.options.endeffect)
</ins><span class="cx">       this.options.endeffect(this.element);
</span><del>-      
</del><ins>+
</ins><span class="cx">     Draggables.deactivate(this);
</span><span class="cx">     Droppables.reset();
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   keyPress: function(event) {
</span><span class="cx">     if(event.keyCode!=Event.KEY_ESC) return;
</span><span class="cx">     this.finishDrag(event, false);
</span><span class="cx">     Event.stop(event);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   endDrag: function(event) {
</span><span class="cx">     if(!this.dragging) return;
</span><span class="cx">     this.stopScrolling();
</span><span class="cx">     this.finishDrag(event, true);
</span><span class="cx">     Event.stop(event);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   draw: function(point) {
</span><del>-    var pos = Position.cumulativeOffset(this.element);
</del><ins>+    var pos = this.element.cumulativeOffset();
</ins><span class="cx">     if(this.options.ghosting) {
</span><span class="cx">       var r   = Position.realOffset(this.element);
</span><span class="cx">       pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     var d = this.currentDelta();
</span><span class="cx">     pos[0] -= d[0]; pos[1] -= d[1];
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.scroll &amp;&amp; (this.options.scroll != window &amp;&amp; this._isScrollChild)) {
</span><span class="cx">       pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
</span><span class="cx">       pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
</span><span class="cx">     }
</span><del>-    
-    var p = [0,1].map(function(i){ 
-      return (point[i]-pos[i]-this.offset[i]) 
</del><ins>+
+    var p = [0,1].map(function(i){
+      return (point[i]-pos[i]-this.offset[i])
</ins><span class="cx">     }.bind(this));
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.snap) {
</span><span class="cx">       if(Object.isFunction(this.options.snap)) {
</span><span class="cx">         p = this.options.snap(p[0],p[1],this);
</span><span class="cx">       } else {
</span><span class="cx">       if(Object.isArray(this.options.snap)) {
</span><span class="cx">         p = p.map( function(v, i) {
</span><del>-          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
</del><ins>+          return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
</ins><span class="cx">       } else {
</span><span class="cx">         p = p.map( function(v) {
</span><del>-          return (v/this.options.snap).round()*this.options.snap }.bind(this))
</del><ins>+          return (v/this.options.snap).round()*this.options.snap }.bind(this));
</ins><span class="cx">       }
</span><span class="cx">     }}
</span><del>-    
</del><ins>+
</ins><span class="cx">     var style = this.element.style;
</span><span class="cx">     if((!this.options.constraint) || (this.options.constraint=='horizontal'))
</span><span class="cx">       style.left = p[0] + &quot;px&quot;;
</span><span class="cx">     if((!this.options.constraint) || (this.options.constraint=='vertical'))
</span><span class="cx">       style.top  = p[1] + &quot;px&quot;;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(style.visibility==&quot;hidden&quot;) style.visibility = &quot;&quot;; // fix gecko rendering
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   stopScrolling: function() {
</span><span class="cx">     if(this.scrollInterval) {
</span><span class="cx">       clearInterval(this.scrollInterval);
</span><span class="lines">@@ -503,14 +502,14 @@
</span><span class="cx">       Draggables._lastScrollPointer = null;
</span><span class="cx">     }
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   startScrolling: function(speed) {
</span><span class="cx">     if(!(speed[0] || speed[1])) return;
</span><span class="cx">     this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
</span><span class="cx">     this.lastScrolled = new Date();
</span><span class="cx">     this.scrollInterval = setInterval(this.scroll.bind(this), 10);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   scroll: function() {
</span><span class="cx">     var current = new Date();
</span><span class="cx">     var delta = current - this.lastScrolled;
</span><span class="lines">@@ -526,7 +525,7 @@
</span><span class="cx">       this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
</span><span class="cx">       this.options.scroll.scrollTop  += this.scrollSpeed[1] * delta / 1000;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     Position.prepare();
</span><span class="cx">     Droppables.show(Draggables._lastPointer, this.element);
</span><span class="cx">     Draggables.notify('onDrag', this);
</span><span class="lines">@@ -540,10 +539,10 @@
</span><span class="cx">         Draggables._lastScrollPointer[1] = 0;
</span><span class="cx">       this.draw(Draggables._lastScrollPointer);
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(this.options.change) this.options.change(this);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   _getWindowScroll: function(w) {
</span><span class="cx">     var T, L, W, H;
</span><span class="cx">     with (w.document) {
</span><span class="lines">@@ -562,7 +561,7 @@
</span><span class="cx">         H = documentElement.clientHeight;
</span><span class="cx">       } else {
</span><span class="cx">         W = body.offsetWidth;
</span><del>-        H = body.offsetHeight
</del><ins>+        H = body.offsetHeight;
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     return { top: T, left: L, width: W, height: H };
</span><span class="lines">@@ -579,11 +578,11 @@
</span><span class="cx">     this.observer  = observer;
</span><span class="cx">     this.lastValue = Sortable.serialize(this.element);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   onStart: function() {
</span><span class="cx">     this.lastValue = Sortable.serialize(this.element);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   onEnd: function() {
</span><span class="cx">     Sortable.unmark();
</span><span class="cx">     if(this.lastValue != Sortable.serialize(this.element))
</span><span class="lines">@@ -593,11 +592,11 @@
</span><span class="cx"> 
</span><span class="cx"> var Sortable = {
</span><span class="cx">   SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
</span><del>-  
</del><ins>+
</ins><span class="cx">   sortables: { },
</span><del>-  
</del><ins>+
</ins><span class="cx">   _findRootElement: function(element) {
</span><del>-    while (element.tagName.toUpperCase() != &quot;BODY&quot;) {  
</del><ins>+    while (element.tagName.toUpperCase() != &quot;BODY&quot;) {
</ins><span class="cx">       if(element.id &amp;&amp; Sortable.sortables[element.id]) return element;
</span><span class="cx">       element = element.parentNode;
</span><span class="cx">     }
</span><span class="lines">@@ -608,22 +607,23 @@
</span><span class="cx">     if(!element) return;
</span><span class="cx">     return Sortable.sortables[element.id];
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   destroy: function(element){
</span><del>-    var s = Sortable.options(element);
-    
</del><ins>+    element = $(element);
+    var s = Sortable.sortables[element.id];
+
</ins><span class="cx">     if(s) {
</span><span class="cx">       Draggables.removeObserver(s.element);
</span><span class="cx">       s.droppables.each(function(d){ Droppables.remove(d) });
</span><span class="cx">       s.draggables.invoke('destroy');
</span><del>-      
</del><ins>+
</ins><span class="cx">       delete Sortable.sortables[s.element.id];
</span><span class="cx">     }
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   create: function(element) {
</span><span class="cx">     element = $(element);
</span><del>-    var options = Object.extend({ 
</del><ins>+    var options = Object.extend({
</ins><span class="cx">       element:     element,
</span><span class="cx">       tag:         'li',       // assumes li children, override with tag: 'tagname'
</span><span class="cx">       dropOnEmpty: false,
</span><span class="lines">@@ -637,17 +637,17 @@
</span><span class="cx">       delay:       0,
</span><span class="cx">       hoverclass:  null,
</span><span class="cx">       ghosting:    false,
</span><del>-      quiet:       false, 
</del><ins>+      quiet:       false,
</ins><span class="cx">       scroll:      false,
</span><span class="cx">       scrollSensitivity: 20,
</span><span class="cx">       scrollSpeed: 15,
</span><span class="cx">       format:      this.SERIALIZE_RULE,
</span><del>-      
-      // these take arrays of elements or ids and can be 
</del><ins>+
+      // these take arrays of elements or ids and can be
</ins><span class="cx">       // used for better initialization performance
</span><span class="cx">       elements:    false,
</span><span class="cx">       handles:     false,
</span><del>-      
</del><ins>+
</ins><span class="cx">       onChange:    Prototype.emptyFunction,
</span><span class="cx">       onUpdate:    Prototype.emptyFunction
</span><span class="cx">     }, arguments[1] || { });
</span><span class="lines">@@ -684,24 +684,24 @@
</span><span class="cx">     if(options.zindex)
</span><span class="cx">       options_for_draggable.zindex = options.zindex;
</span><span class="cx"> 
</span><del>-    // build options for the droppables  
</del><ins>+    // build options for the droppables
</ins><span class="cx">     var options_for_droppable = {
</span><span class="cx">       overlap:     options.overlap,
</span><span class="cx">       containment: options.containment,
</span><span class="cx">       tree:        options.tree,
</span><span class="cx">       hoverclass:  options.hoverclass,
</span><span class="cx">       onHover:     Sortable.onHover
</span><del>-    }
-    
</del><ins>+    };
+
</ins><span class="cx">     var options_for_tree = {
</span><span class="cx">       onHover:      Sortable.onEmptyHover,
</span><span class="cx">       overlap:      options.overlap,
</span><span class="cx">       containment:  options.containment,
</span><span class="cx">       hoverclass:   options.hoverclass
</span><del>-    }
</del><ins>+    };
</ins><span class="cx"> 
</span><span class="cx">     // fix for gecko engine
</span><del>-    Element.cleanWhitespace(element); 
</del><ins>+    Element.cleanWhitespace(element);
</ins><span class="cx"> 
</span><span class="cx">     options.draggables = [];
</span><span class="cx">     options.droppables = [];
</span><span class="lines">@@ -714,14 +714,14 @@
</span><span class="cx"> 
</span><span class="cx">     (options.elements || this.findElements(element, options) || []).each( function(e,i) {
</span><span class="cx">       var handle = options.handles ? $(options.handles[i]) :
</span><del>-        (options.handle ? $(e).select('.' + options.handle)[0] : e); 
</del><ins>+        (options.handle ? $(e).select('.' + options.handle)[0] : e);
</ins><span class="cx">       options.draggables.push(
</span><span class="cx">         new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
</span><span class="cx">       Droppables.add(e, options_for_droppable);
</span><span class="cx">       if(options.tree) e.treeNode = element;
</span><del>-      options.droppables.push(e);      
</del><ins>+      options.droppables.push(e);
</ins><span class="cx">     });
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(options.tree) {
</span><span class="cx">       (Sortable.findTreeElements(element, options) || []).each( function(e) {
</span><span class="cx">         Droppables.add(e, options_for_tree);
</span><span class="lines">@@ -731,7 +731,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // keep reference
</span><del>-    this.sortables[element.id] = options;
</del><ins>+    this.sortables[element.identify()] = options;
</ins><span class="cx"> 
</span><span class="cx">     // for onupdate
</span><span class="cx">     Draggables.addObserver(new SortableObserver(element, options.onUpdate));
</span><span class="lines">@@ -743,7 +743,7 @@
</span><span class="cx">     return Element.findChildren(
</span><span class="cx">       element, options.only, options.tree ? true : false, options.tag);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   findTreeElements: function(element, options) {
</span><span class="cx">     return Element.findChildren(
</span><span class="cx">       element, options.only, options.tree ? true : false, options.treeTag);
</span><span class="lines">@@ -760,7 +760,7 @@
</span><span class="cx">         var oldParentNode = element.parentNode;
</span><span class="cx">         element.style.visibility = &quot;hidden&quot;; // fix gecko rendering
</span><span class="cx">         dropon.parentNode.insertBefore(element, dropon);
</span><del>-        if(dropon.parentNode!=oldParentNode) 
</del><ins>+        if(dropon.parentNode!=oldParentNode)
</ins><span class="cx">           Sortable.options(oldParentNode).onChange(element);
</span><span class="cx">         Sortable.options(dropon.parentNode).onChange(element);
</span><span class="cx">       }
</span><span class="lines">@@ -771,26 +771,26 @@
</span><span class="cx">         var oldParentNode = element.parentNode;
</span><span class="cx">         element.style.visibility = &quot;hidden&quot;; // fix gecko rendering
</span><span class="cx">         dropon.parentNode.insertBefore(element, nextElement);
</span><del>-        if(dropon.parentNode!=oldParentNode) 
</del><ins>+        if(dropon.parentNode!=oldParentNode)
</ins><span class="cx">           Sortable.options(oldParentNode).onChange(element);
</span><span class="cx">         Sortable.options(dropon.parentNode).onChange(element);
</span><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   onEmptyHover: function(element, dropon, overlap) {
</span><span class="cx">     var oldParentNode = element.parentNode;
</span><span class="cx">     var droponOptions = Sortable.options(dropon);
</span><del>-        
</del><ins>+
</ins><span class="cx">     if(!Element.isParent(dropon, element)) {
</span><span class="cx">       var index;
</span><del>-      
</del><ins>+
</ins><span class="cx">       var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
</span><span class="cx">       var child = null;
</span><del>-            
</del><ins>+
</ins><span class="cx">       if(children) {
</span><span class="cx">         var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
</span><del>-        
</del><ins>+
</ins><span class="cx">         for (index = 0; index &lt; children.length; index += 1) {
</span><span class="cx">           if (offset - Element.offsetSize (children[index], droponOptions.overlap) &gt;= 0) {
</span><span class="cx">             offset -= Element.offsetSize (children[index], droponOptions.overlap);
</span><span class="lines">@@ -803,9 +803,9 @@
</span><span class="cx">           }
</span><span class="cx">         }
</span><span class="cx">       }
</span><del>-      
</del><ins>+
</ins><span class="cx">       dropon.insertBefore(element, child);
</span><del>-      
</del><ins>+
</ins><span class="cx">       Sortable.options(oldParentNode).onChange(element);
</span><span class="cx">       droponOptions.onChange(element);
</span><span class="cx">     }
</span><span class="lines">@@ -818,34 +818,34 @@
</span><span class="cx">   mark: function(dropon, position) {
</span><span class="cx">     // mark on ghosting only
</span><span class="cx">     var sortable = Sortable.options(dropon.parentNode);
</span><del>-    if(sortable &amp;&amp; !sortable.ghosting) return; 
</del><ins>+    if(sortable &amp;&amp; !sortable.ghosting) return;
</ins><span class="cx"> 
</span><span class="cx">     if(!Sortable._marker) {
</span><del>-      Sortable._marker = 
</del><ins>+      Sortable._marker =
</ins><span class="cx">         ($('dropmarker') || Element.extend(document.createElement('DIV'))).
</span><span class="cx">           hide().addClassName('dropmarker').setStyle({position:'absolute'});
</span><span class="cx">       document.getElementsByTagName(&quot;body&quot;).item(0).appendChild(Sortable._marker);
</span><del>-    }    
-    var offsets = Position.cumulativeOffset(dropon);
</del><ins>+    }
+    var offsets = dropon.cumulativeOffset();
</ins><span class="cx">     Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(position=='after')
</span><del>-      if(sortable.overlap == 'horizontal') 
</del><ins>+      if(sortable.overlap == 'horizontal')
</ins><span class="cx">         Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
</span><span class="cx">       else
</span><span class="cx">         Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
</span><del>-    
</del><ins>+
</ins><span class="cx">     Sortable._marker.show();
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   _tree: function(element, options, parent) {
</span><span class="cx">     var children = Sortable.findElements(element, options) || [];
</span><del>-  
</del><ins>+
</ins><span class="cx">     for (var i = 0; i &lt; children.length; ++i) {
</span><span class="cx">       var match = children[i].id.match(options.format);
</span><span class="cx"> 
</span><span class="cx">       if (!match) continue;
</span><del>-      
</del><ins>+
</ins><span class="cx">       var child = {
</span><span class="cx">         id: encodeURIComponent(match ? match[1] : null),
</span><span class="cx">         element: element,
</span><span class="lines">@@ -853,16 +853,16 @@
</span><span class="cx">         children: [],
</span><span class="cx">         position: parent.children.length,
</span><span class="cx">         container: $(children[i]).down(options.treeTag)
</span><del>-      }
-      
</del><ins>+      };
+
</ins><span class="cx">       /* Get the element containing the children and recurse over it */
</span><span class="cx">       if (child.container)
</span><del>-        this._tree(child.container, options, child)
-      
</del><ins>+        this._tree(child.container, options, child);
+
</ins><span class="cx">       parent.children.push (child);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return parent; 
</del><ins>+    return parent;
</ins><span class="cx">   },
</span><span class="cx"> 
</span><span class="cx">   tree: function(element) {
</span><span class="lines">@@ -875,15 +875,15 @@
</span><span class="cx">       name: element.id,
</span><span class="cx">       format: sortableOptions.format
</span><span class="cx">     }, arguments[1] || { });
</span><del>-    
</del><ins>+
</ins><span class="cx">     var root = {
</span><span class="cx">       id: null,
</span><span class="cx">       parent: null,
</span><span class="cx">       children: [],
</span><span class="cx">       container: element,
</span><span class="cx">       position: 0
</span><del>-    }
-    
</del><ins>+    };
+
</ins><span class="cx">     return Sortable._tree(element, options, root);
</span><span class="cx">   },
</span><span class="cx"> 
</span><span class="lines">@@ -899,7 +899,7 @@
</span><span class="cx">   sequence: function(element) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     var options = Object.extend(this.options(element), arguments[1] || { });
</span><del>-    
</del><ins>+
</ins><span class="cx">     return $(this.findElements(element, options) || []).map( function(item) {
</span><span class="cx">       return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
</span><span class="cx">     });
</span><span class="lines">@@ -908,14 +908,14 @@
</span><span class="cx">   setSequence: function(element, new_sequence) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     var options = Object.extend(this.options(element), arguments[2] || { });
</span><del>-    
</del><ins>+
</ins><span class="cx">     var nodeMap = { };
</span><span class="cx">     this.findElements(element, options).each( function(n) {
</span><span class="cx">         if (n.id.match(options.format))
</span><span class="cx">             nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
</span><span class="cx">         n.parentNode.removeChild(n);
</span><span class="cx">     });
</span><del>-   
</del><ins>+
</ins><span class="cx">     new_sequence.each(function(ident) {
</span><span class="cx">       var n = nodeMap[ident];
</span><span class="cx">       if (n) {
</span><span class="lines">@@ -924,16 +924,16 @@
</span><span class="cx">       }
</span><span class="cx">     });
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   serialize: function(element) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     var options = Object.extend(Sortable.options(element), arguments[1] || { });
</span><span class="cx">     var name = encodeURIComponent(
</span><span class="cx">       (arguments[1] &amp;&amp; arguments[1].name) ? arguments[1].name : element.id);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (options.tree) {
</span><span class="cx">       return Sortable.tree(element, arguments[1]).children.map( function (item) {
</span><del>-        return [name + Sortable._constructIndex(item) + &quot;[id]=&quot; + 
</del><ins>+        return [name + Sortable._constructIndex(item) + &quot;[id]=&quot; +
</ins><span class="cx">                 encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
</span><span class="cx">       }).flatten().join('&amp;');
</span><span class="cx">     } else {
</span><span class="lines">@@ -942,16 +942,16 @@
</span><span class="cx">       }).join('&amp;');
</span><span class="cx">     }
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> // Returns true if child is contained within element
</span><span class="cx"> Element.isParent = function(child, element) {
</span><span class="cx">   if (!child.parentNode || child == element) return false;
</span><span class="cx">   if (child.parentNode == element) return true;
</span><span class="cx">   return Element.isParent(child.parentNode, element);
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><del>-Element.findChildren = function(element, only, recursive, tagName) {   
</del><ins>+Element.findChildren = function(element, only, recursive, tagName) {
</ins><span class="cx">   if(!element.hasChildNodes()) return null;
</span><span class="cx">   tagName = tagName.toUpperCase();
</span><span class="cx">   if(only) only = [only].flatten();
</span><span class="lines">@@ -967,8 +967,8 @@
</span><span class="cx">   });
</span><span class="cx"> 
</span><span class="cx">   return (elements.length&gt;0 ? elements.flatten() : []);
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Element.offsetSize = function (element, type) {
</span><span class="cx">   return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
</span><del>-}
</del><ins>+};
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculouseffectsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/effects.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/effects.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/effects.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,50 +1,50 @@
</span><del>-// script.aculo.us effects.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</ins><span class="cx"> // Contributors:
</span><span class="cx"> //  Justin Palmer (http://encytemedia.com/)
</span><span class="cx"> //  Mark Pilgrim (http://diveintomark.org/)
</span><span class="cx"> //  Martin Bialasinki
</span><del>-// 
</del><ins>+//
</ins><span class="cx"> // script.aculo.us is freely distributable under the terms of an MIT-style license.
</span><del>-// For details, see the script.aculo.us web site: http://script.aculo.us/ 
</del><ins>+// For details, see the script.aculo.us web site: http://script.aculo.us/
</ins><span class="cx"> 
</span><del>-// converts rgb() and #xxx to #xxxxxx format,  
-// returns self (or first argument) if not convertable  
-String.prototype.parseColor = function() {  
</del><ins>+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable
+String.prototype.parseColor = function() {
</ins><span class="cx">   var color = '#';
</span><del>-  if (this.slice(0,4) == 'rgb(') {  
-    var cols = this.slice(4,this.length-1).split(',');  
-    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i&lt;3);  
-  } else {  
-    if (this.slice(0,1) == '#') {  
-      if (this.length==4) for(var i=1;i&lt;4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();  
-      if (this.length==7) color = this.toLowerCase();  
-    }  
-  }  
-  return (color.length==7 ? color : (arguments[0] || this));  
</del><ins>+  if (this.slice(0,4) == 'rgb(') {
+    var cols = this.slice(4,this.length-1).split(',');
+    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i&lt;3);
+  } else {
+    if (this.slice(0,1) == '#') {
+      if (this.length==4) for(var i=1;i&lt;4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
+      if (this.length==7) color = this.toLowerCase();
+    }
+  }
+  return (color.length==7 ? color : (arguments[0] || this));
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> /*--------------------------------------------------------------------------*/
</span><span class="cx"> 
</span><del>-Element.collectTextNodes = function(element) {  
</del><ins>+Element.collectTextNodes = function(element) {
</ins><span class="cx">   return $A($(element).childNodes).collect( function(node) {
</span><del>-    return (node.nodeType==3 ? node.nodeValue : 
</del><ins>+    return (node.nodeType==3 ? node.nodeValue :
</ins><span class="cx">       (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
</span><span class="cx">   }).flatten().join('');
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-Element.collectTextNodesIgnoreClass = function(element, className) {  
</del><ins>+Element.collectTextNodesIgnoreClass = function(element, className) {
</ins><span class="cx">   return $A($(element).childNodes).collect( function(node) {
</span><del>-    return (node.nodeType==3 ? node.nodeValue : 
-      ((node.hasChildNodes() &amp;&amp; !Element.hasClassName(node,className)) ? 
</del><ins>+    return (node.nodeType==3 ? node.nodeValue :
+      ((node.hasChildNodes() &amp;&amp; !Element.hasClassName(node,className)) ?
</ins><span class="cx">         Element.collectTextNodesIgnoreClass(node, className) : ''));
</span><span class="cx">   }).flatten().join('');
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Element.setContentZoom = function(element, percent) {
</span><del>-  element = $(element);  
-  element.setStyle({fontSize: (percent/100) + 'em'});   
</del><ins>+  element = $(element);
+  element.setStyle({fontSize: (percent/100) + 'em'});
</ins><span class="cx">   if (Prototype.Browser.WebKit) window.scrollBy(0,0);
</span><span class="cx">   return element;
</span><span class="cx"> };
</span><span class="lines">@@ -72,28 +72,23 @@
</span><span class="cx">   Transitions: {
</span><span class="cx">     linear: Prototype.K,
</span><span class="cx">     sinoidal: function(pos) {
</span><del>-      return (-Math.cos(pos*Math.PI)/2) + 0.5;
</del><ins>+      return (-Math.cos(pos*Math.PI)/2) + .5;
</ins><span class="cx">     },
</span><span class="cx">     reverse: function(pos) {
</span><span class="cx">       return 1-pos;
</span><span class="cx">     },
</span><span class="cx">     flicker: function(pos) {
</span><del>-      var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
</del><ins>+      var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
</ins><span class="cx">       return pos &gt; 1 ? 1 : pos;
</span><span class="cx">     },
</span><span class="cx">     wobble: function(pos) {
</span><del>-      return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
</del><ins>+      return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
</ins><span class="cx">     },
</span><del>-    pulse: function(pos, pulses) { 
-      pulses = pulses || 5; 
-      return (
-        ((pos % (1/pulses)) * pulses).round() == 0 ? 
-              ((pos * pulses * 2) - (pos * pulses * 2).floor()) : 
-          1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
-        );
</del><ins>+    pulse: function(pos, pulses) {
+      return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
</ins><span class="cx">     },
</span><del>-    spring: function(pos) { 
-      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6)); 
</del><ins>+    spring: function(pos) {
+      return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
</ins><span class="cx">     },
</span><span class="cx">     none: function(pos) {
</span><span class="cx">       return 0;
</span><span class="lines">@@ -114,14 +109,14 @@
</span><span class="cx">   tagifyText: function(element) {
</span><span class="cx">     var tagifyStyle = 'position:relative';
</span><span class="cx">     if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
</span><del>-    
</del><ins>+
</ins><span class="cx">     element = $(element);
</span><span class="cx">     $A(element.childNodes).each( function(child) {
</span><span class="cx">       if (child.nodeType==3) {
</span><span class="cx">         child.nodeValue.toArray().each( function(character) {
</span><span class="cx">           element.insertBefore(
</span><span class="cx">             new Element('span', {style: tagifyStyle}).update(
</span><del>-              character == ' ' ? String.fromCharCode(160) : character), 
</del><ins>+              character == ' ' ? String.fromCharCode(160) : character),
</ins><span class="cx">               child);
</span><span class="cx">         });
</span><span class="cx">         Element.remove(child);
</span><span class="lines">@@ -130,13 +125,13 @@
</span><span class="cx">   },
</span><span class="cx">   multiple: function(element, effect) {
</span><span class="cx">     var elements;
</span><del>-    if (((typeof element == 'object') || 
-        Object.isFunction(element)) &amp;&amp; 
</del><ins>+    if (((typeof element == 'object') ||
+        Object.isFunction(element)) &amp;&amp;
</ins><span class="cx">        (element.length))
</span><span class="cx">       elements = element;
</span><span class="cx">     else
</span><span class="cx">       elements = $(element).childNodes;
</span><del>-      
</del><ins>+
</ins><span class="cx">     var options = Object.extend({
</span><span class="cx">       speed: 0.1,
</span><span class="cx">       delay: 0.0
</span><span class="lines">@@ -152,14 +147,13 @@
</span><span class="cx">     'blind':  ['BlindDown','BlindUp'],
</span><span class="cx">     'appear': ['Appear','Fade']
</span><span class="cx">   },
</span><del>-  toggle: function(element, effect) {
</del><ins>+  toggle: function(element, effect, options) {
</ins><span class="cx">     element = $(element);
</span><del>-    effect = (effect || 'appear').toLowerCase();
-    var options = Object.extend({
</del><ins>+    effect  = (effect || 'appear').toLowerCase();
+    
+    return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
</ins><span class="cx">       queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
</span><del>-    }, arguments[2] || { });
-    Effect[element.visible() ? 
-      Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
</del><ins>+    }, options || {}));
</ins><span class="cx">   }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -170,20 +164,20 @@
</span><span class="cx"> Effect.ScopedQueue = Class.create(Enumerable, {
</span><span class="cx">   initialize: function() {
</span><span class="cx">     this.effects  = [];
</span><del>-    this.interval = null;    
</del><ins>+    this.interval = null;
</ins><span class="cx">   },
</span><span class="cx">   _each: function(iterator) {
</span><span class="cx">     this.effects._each(iterator);
</span><span class="cx">   },
</span><span class="cx">   add: function(effect) {
</span><span class="cx">     var timestamp = new Date().getTime();
</span><del>-    
-    var position = Object.isString(effect.options.queue) ? 
</del><ins>+
+    var position = Object.isString(effect.options.queue) ?
</ins><span class="cx">       effect.options.queue : effect.options.queue.position;
</span><del>-    
</del><ins>+
</ins><span class="cx">     switch(position) {
</span><span class="cx">       case 'front':
</span><del>-        // move unstarted effects after this effect  
</del><ins>+        // move unstarted effects after this effect
</ins><span class="cx">         this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
</span><span class="cx">             e.startOn  += effect.finishOn;
</span><span class="cx">             e.finishOn += effect.finishOn;
</span><span class="lines">@@ -197,13 +191,13 @@
</span><span class="cx">         timestamp = this.effects.pluck('finishOn').max() || timestamp;
</span><span class="cx">         break;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     effect.startOn  += timestamp;
</span><span class="cx">     effect.finishOn += timestamp;
</span><span class="cx"> 
</span><span class="cx">     if (!effect.options.queue.limit || (this.effects.length &lt; effect.options.queue.limit))
</span><span class="cx">       this.effects.push(effect);
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (!this.interval)
</span><span class="cx">       this.interval = setInterval(this.loop.bind(this), 15);
</span><span class="cx">   },
</span><span class="lines">@@ -216,7 +210,7 @@
</span><span class="cx">   },
</span><span class="cx">   loop: function() {
</span><span class="cx">     var timePos = new Date().getTime();
</span><del>-    for(var i=0, len=this.effects.length;i&lt;len;i++) 
</del><ins>+    for(var i=0, len=this.effects.length;i&lt;len;i++)
</ins><span class="cx">       this.effects[i] &amp;&amp; this.effects[i].loop(timePos);
</span><span class="cx">   }
</span><span class="cx"> });
</span><span class="lines">@@ -225,7 +219,7 @@
</span><span class="cx">   instances: $H(),
</span><span class="cx">   get: function(queueName) {
</span><span class="cx">     if (!Object.isString(queueName)) return queueName;
</span><del>-    
</del><ins>+
</ins><span class="cx">     return this.instances.get(queueName) ||
</span><span class="cx">       this.instances.set(queueName, new Effect.ScopedQueue());
</span><span class="cx">   }
</span><span class="lines">@@ -235,12 +229,6 @@
</span><span class="cx"> Effect.Base = Class.create({
</span><span class="cx">   position: null,
</span><span class="cx">   start: function(options) {
</span><del>-    function codeForEvent(options,eventName){
-      return (
-        (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
-        (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
-      );
-    }
</del><span class="cx">     if (options &amp;&amp; options.transition === false) options.transition = Effect.Transitions.linear;
</span><span class="cx">     this.options      = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
</span><span class="cx">     this.currentFrame = 0;
</span><span class="lines">@@ -250,23 +238,35 @@
</span><span class="cx">     this.fromToDelta  = this.options.to-this.options.from;
</span><span class="cx">     this.totalTime    = this.finishOn-this.startOn;
</span><span class="cx">     this.totalFrames  = this.options.fps*this.options.duration;
</span><del>-    
-    eval('this.render = function(pos){ '+
-      'if (this.state==&quot;idle&quot;){this.state=&quot;running&quot;;'+
-      codeForEvent(this.options,'beforeSetup')+
-      (this.setup ? 'this.setup();':'')+ 
-      codeForEvent(this.options,'afterSetup')+
-      '};if (this.state==&quot;running&quot;){'+
-      'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
-      'this.position=pos;'+
-      codeForEvent(this.options,'beforeUpdate')+
-      (this.update ? 'this.update(pos);':'')+
-      codeForEvent(this.options,'afterUpdate')+
-      '}}');
-    
</del><ins>+
+    this.render = (function() {
+      function dispatch(effect, eventName) {
+        if (effect.options[eventName + 'Internal'])
+          effect.options[eventName + 'Internal'](effect);
+        if (effect.options[eventName])
+          effect.options[eventName](effect);
+      }
+
+      return function(pos) {
+        if (this.state === &quot;idle&quot;) {
+          this.state = &quot;running&quot;;
+          dispatch(this, 'beforeSetup');
+          if (this.setup) this.setup();
+          dispatch(this, 'afterSetup');
+        }
+        if (this.state === &quot;running&quot;) {
+          pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
+          this.position = pos;
+          dispatch(this, 'beforeUpdate');
+          if (this.update) this.update(pos);
+          dispatch(this, 'afterUpdate');
+        }
+      };
+    })();
+
</ins><span class="cx">     this.event('beforeStart');
</span><span class="cx">     if (!this.options.sync)
</span><del>-      Effect.Queues.get(Object.isString(this.options.queue) ? 
</del><ins>+      Effect.Queues.get(Object.isString(this.options.queue) ?
</ins><span class="cx">         'global' : this.options.queue.scope).add(this);
</span><span class="cx">   },
</span><span class="cx">   loop: function(timePos) {
</span><span class="lines">@@ -275,9 +275,9 @@
</span><span class="cx">         this.render(1.0);
</span><span class="cx">         this.cancel();
</span><span class="cx">         this.event('beforeFinish');
</span><del>-        if (this.finish) this.finish(); 
</del><ins>+        if (this.finish) this.finish();
</ins><span class="cx">         this.event('afterFinish');
</span><del>-        return;  
</del><ins>+        return;
</ins><span class="cx">       }
</span><span class="cx">       var pos   = (timePos - this.startOn) / this.totalTime,
</span><span class="cx">           frame = (pos * this.totalFrames).round();
</span><span class="lines">@@ -289,7 +289,7 @@
</span><span class="cx">   },
</span><span class="cx">   cancel: function() {
</span><span class="cx">     if (!this.options.sync)
</span><del>-      Effect.Queues.get(Object.isString(this.options.queue) ? 
</del><ins>+      Effect.Queues.get(Object.isString(this.options.queue) ?
</ins><span class="cx">         'global' : this.options.queue.scope).remove(this);
</span><span class="cx">     this.state = 'finished';
</span><span class="cx">   },
</span><span class="lines">@@ -327,10 +327,10 @@
</span><span class="cx"> Effect.Tween = Class.create(Effect.Base, {
</span><span class="cx">   initialize: function(object, from, to) {
</span><span class="cx">     object = Object.isString(object) ? $(object) : object;
</span><del>-    var args = $A(arguments), method = args.last(), 
</del><ins>+    var args = $A(arguments), method = args.last(),
</ins><span class="cx">       options = args.length == 5 ? args[3] : null;
</span><span class="cx">     this.method = Object.isFunction(method) ? method.bind(object) :
</span><del>-      Object.isFunction(object[method]) ? object[method].bind(object) : 
</del><ins>+      Object.isFunction(object[method]) ? object[method].bind(object) :
</ins><span class="cx">       function(value) { object[method] = value };
</span><span class="cx">     this.start(Object.extend({ from: from, to: to }, options || { }));
</span><span class="cx">   },
</span><span class="lines">@@ -394,7 +394,7 @@
</span><span class="cx"> 
</span><span class="cx"> // for backwards compatibility
</span><span class="cx"> Effect.MoveBy = function(element, toTop, toLeft) {
</span><del>-  return new Effect.Move(element, 
</del><ins>+  return new Effect.Move(element,
</ins><span class="cx">     Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -416,15 +416,15 @@
</span><span class="cx">   setup: function() {
</span><span class="cx">     this.restoreAfterFinish = this.options.restoreAfterFinish || false;
</span><span class="cx">     this.elementPositioning = this.element.getStyle('position');
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.originalStyle = { };
</span><span class="cx">     ['top','left','width','height','fontSize'].each( function(k) {
</span><span class="cx">       this.originalStyle[k] = this.element.style[k];
</span><span class="cx">     }.bind(this));
</span><del>-      
</del><ins>+
</ins><span class="cx">     this.originalTop  = this.element.offsetTop;
</span><span class="cx">     this.originalLeft = this.element.offsetLeft;
</span><del>-    
</del><ins>+
</ins><span class="cx">     var fontSize = this.element.getStyle('font-size') || '100%';
</span><span class="cx">     ['em','px','%','pt'].each( function(fontSizeType) {
</span><span class="cx">       if (fontSize.indexOf(fontSizeType)&gt;0) {
</span><span class="lines">@@ -432,9 +432,9 @@
</span><span class="cx">         this.fontSizeType = fontSizeType;
</span><span class="cx">       }
</span><span class="cx">     }.bind(this));
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.dims = null;
</span><span class="cx">     if (this.options.scaleMode=='box')
</span><span class="cx">       this.dims = [this.element.offsetHeight, this.element.offsetWidth];
</span><span class="lines">@@ -509,17 +509,16 @@
</span><span class="cx"> 
</span><span class="cx"> Effect.ScrollTo = function(element) {
</span><span class="cx">   var options = arguments[1] || { },
</span><del>-    scrollOffsets = document.viewport.getScrollOffsets(),
-    elementOffsets = $(element).cumulativeOffset(),
-    max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();  
</del><ins>+  scrollOffsets = document.viewport.getScrollOffsets(),
+  elementOffsets = $(element).cumulativeOffset();
</ins><span class="cx"> 
</span><span class="cx">   if (options.offset) elementOffsets[1] += options.offset;
</span><span class="cx"> 
</span><span class="cx">   return new Effect.Tween(null,
</span><span class="cx">     scrollOffsets.top,
</span><del>-    elementOffsets[1] &gt; max ? max : elementOffsets[1],
</del><ins>+    elementOffsets[1],
</ins><span class="cx">     options,
</span><del>-    function(p){ scrollTo(scrollOffsets.left, p.round()) }
</del><ins>+    function(p){ scrollTo(scrollOffsets.left, p.round()); }
</ins><span class="cx">   );
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -531,9 +530,9 @@
</span><span class="cx">   var options = Object.extend({
</span><span class="cx">     from: element.getOpacity() || 1.0,
</span><span class="cx">     to:   0.0,
</span><del>-    afterFinishInternal: function(effect) { 
</del><ins>+    afterFinishInternal: function(effect) {
</ins><span class="cx">       if (effect.options.to!=0) return;
</span><del>-      effect.element.hide().setStyle({opacity: oldOpacity}); 
</del><ins>+      effect.element.hide().setStyle({opacity: oldOpacity});
</ins><span class="cx">     }
</span><span class="cx">   }, arguments[1] || { });
</span><span class="cx">   return new Effect.Opacity(element,options);
</span><span class="lines">@@ -549,15 +548,15 @@
</span><span class="cx">     effect.element.forceRerendering();
</span><span class="cx">   },
</span><span class="cx">   beforeSetup: function(effect) {
</span><del>-    effect.element.setOpacity(effect.options.from).show(); 
</del><ins>+    effect.element.setOpacity(effect.options.from).show();
</ins><span class="cx">   }}, arguments[1] || { });
</span><span class="cx">   return new Effect.Opacity(element,options);
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Effect.Puff = function(element) {
</span><span class="cx">   element = $(element);
</span><del>-  var oldStyle = { 
-    opacity: element.getInlineOpacity(), 
</del><ins>+  var oldStyle = {
+    opacity: element.getInlineOpacity(),
</ins><span class="cx">     position: element.getStyle('position'),
</span><span class="cx">     top:  element.style.top,
</span><span class="cx">     left: element.style.left,
</span><span class="lines">@@ -565,12 +564,12 @@
</span><span class="cx">     height: element.style.height
</span><span class="cx">   };
</span><span class="cx">   return new Effect.Parallel(
</span><del>-   [ new Effect.Scale(element, 200, 
-      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }), 
-     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ], 
-     Object.extend({ duration: 1.0, 
</del><ins>+   [ new Effect.Scale(element, 200,
+      { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
+     new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
+     Object.extend({ duration: 1.0,
</ins><span class="cx">       beforeSetupInternal: function(effect) {
</span><del>-        Position.absolutize(effect.effects[0].element)
</del><ins>+        Position.absolutize(effect.effects[0].element);
</ins><span class="cx">       },
</span><span class="cx">       afterFinishInternal: function(effect) {
</span><span class="cx">          effect.effects[0].element.hide().setStyle(oldStyle); }
</span><span class="lines">@@ -582,12 +581,12 @@
</span><span class="cx">   element = $(element);
</span><span class="cx">   element.makeClipping();
</span><span class="cx">   return new Effect.Scale(element, 0,
</span><del>-    Object.extend({ scaleContent: false, 
-      scaleX: false, 
</del><ins>+    Object.extend({ scaleContent: false,
+      scaleX: false,
</ins><span class="cx">       restoreAfterFinish: true,
</span><span class="cx">       afterFinishInternal: function(effect) {
</span><span class="cx">         effect.element.hide().undoClipping();
</span><del>-      } 
</del><ins>+      }
</ins><span class="cx">     }, arguments[1] || { })
</span><span class="cx">   );
</span><span class="cx"> };
</span><span class="lines">@@ -595,15 +594,15 @@
</span><span class="cx"> Effect.BlindDown = function(element) {
</span><span class="cx">   element = $(element);
</span><span class="cx">   var elementDimensions = element.getDimensions();
</span><del>-  return new Effect.Scale(element, 100, Object.extend({ 
-    scaleContent: false, 
</del><ins>+  return new Effect.Scale(element, 100, Object.extend({
+    scaleContent: false,
</ins><span class="cx">     scaleX: false,
</span><span class="cx">     scaleFrom: 0,
</span><span class="cx">     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
</span><span class="cx">     restoreAfterFinish: true,
</span><span class="cx">     afterSetup: function(effect) {
</span><del>-      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
-    },  
</del><ins>+      effect.element.makeClipping().setStyle({height: '0px'}).show();
+    },
</ins><span class="cx">     afterFinishInternal: function(effect) {
</span><span class="cx">       effect.element.undoClipping();
</span><span class="cx">     }
</span><span class="lines">@@ -618,16 +617,16 @@
</span><span class="cx">     from: 0,
</span><span class="cx">     transition: Effect.Transitions.flicker,
</span><span class="cx">     afterFinishInternal: function(effect) {
</span><del>-      new Effect.Scale(effect.element, 1, { 
</del><ins>+      new Effect.Scale(effect.element, 1, {
</ins><span class="cx">         duration: 0.3, scaleFromCenter: true,
</span><span class="cx">         scaleX: false, scaleContent: false, restoreAfterFinish: true,
</span><del>-        beforeSetup: function(effect) { 
</del><ins>+        beforeSetup: function(effect) {
</ins><span class="cx">           effect.element.makePositioned().makeClipping();
</span><span class="cx">         },
</span><span class="cx">         afterFinishInternal: function(effect) {
</span><span class="cx">           effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
</span><span class="cx">         }
</span><del>-      })
</del><ins>+      });
</ins><span class="cx">     }
</span><span class="cx">   }, arguments[1] || { }));
</span><span class="cx"> };
</span><span class="lines">@@ -639,16 +638,16 @@
</span><span class="cx">     left: element.getStyle('left'),
</span><span class="cx">     opacity: element.getInlineOpacity() };
</span><span class="cx">   return new Effect.Parallel(
</span><del>-    [ new Effect.Move(element, {x: 0, y: 100, sync: true }), 
</del><ins>+    [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
</ins><span class="cx">       new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
</span><span class="cx">     Object.extend(
</span><span class="cx">       { duration: 0.5,
</span><span class="cx">         beforeSetup: function(effect) {
</span><del>-          effect.effects[0].element.makePositioned(); 
</del><ins>+          effect.effects[0].element.makePositioned();
</ins><span class="cx">         },
</span><span class="cx">         afterFinishInternal: function(effect) {
</span><span class="cx">           effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
</span><del>-        } 
</del><ins>+        }
</ins><span class="cx">       }, arguments[1] || { }));
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -676,7 +675,7 @@
</span><span class="cx">     new Effect.Move(effect.element,
</span><span class="cx">       { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
</span><span class="cx">         effect.element.undoPositioned().setStyle(oldStyle);
</span><del>-  }}) }}) }}) }}) }}) }});
</del><ins>+  }}); }}); }}); }}); }}); }});
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> Effect.SlideDown = function(element) {
</span><span class="lines">@@ -684,9 +683,9 @@
</span><span class="cx">   // SlideDown need to have the content of the element wrapped in a container element with fixed height!
</span><span class="cx">   var oldInnerBottom = element.down().getStyle('bottom');
</span><span class="cx">   var elementDimensions = element.getDimensions();
</span><del>-  return new Effect.Scale(element, 100, Object.extend({ 
-    scaleContent: false, 
-    scaleX: false, 
</del><ins>+  return new Effect.Scale(element, 100, Object.extend({
+    scaleContent: false,
+    scaleX: false,
</ins><span class="cx">     scaleFrom: window.opera ? 0 : 1,
</span><span class="cx">     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
</span><span class="cx">     restoreAfterFinish: true,
</span><span class="lines">@@ -694,11 +693,11 @@
</span><span class="cx">       effect.element.makePositioned();
</span><span class="cx">       effect.element.down().makePositioned();
</span><span class="cx">       if (window.opera) effect.element.setStyle({top: ''});
</span><del>-      effect.element.makeClipping().setStyle({height: '0px'}).show(); 
</del><ins>+      effect.element.makeClipping().setStyle({height: '0px'}).show();
</ins><span class="cx">     },
</span><span class="cx">     afterUpdateInternal: function(effect) {
</span><span class="cx">       effect.element.down().setStyle({bottom:
</span><del>-        (effect.dims[0] - effect.element.clientHeight) + 'px' }); 
</del><ins>+        (effect.dims[0] - effect.element.clientHeight) + 'px' });
</ins><span class="cx">     },
</span><span class="cx">     afterFinishInternal: function(effect) {
</span><span class="cx">       effect.element.undoClipping().undoPositioned();
</span><span class="lines">@@ -712,8 +711,8 @@
</span><span class="cx">   var oldInnerBottom = element.down().getStyle('bottom');
</span><span class="cx">   var elementDimensions = element.getDimensions();
</span><span class="cx">   return new Effect.Scale(element, window.opera ? 0 : 1,
</span><del>-   Object.extend({ scaleContent: false, 
-    scaleX: false, 
</del><ins>+   Object.extend({ scaleContent: false,
+    scaleX: false,
</ins><span class="cx">     scaleMode: 'box',
</span><span class="cx">     scaleFrom: 100,
</span><span class="cx">     scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
</span><span class="lines">@@ -723,7 +722,7 @@
</span><span class="cx">       effect.element.down().makePositioned();
</span><span class="cx">       if (window.opera) effect.element.setStyle({top: ''});
</span><span class="cx">       effect.element.makeClipping().show();
</span><del>-    },  
</del><ins>+    },
</ins><span class="cx">     afterUpdateInternal: function(effect) {
</span><span class="cx">       effect.element.down().setStyle({bottom:
</span><span class="cx">         (effect.dims[0] - effect.element.clientHeight) + 'px' });
</span><span class="lines">@@ -736,15 +735,15 @@
</span><span class="cx">   );
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-// Bug in opera makes the TD containing this element expand for a instance after finish 
</del><ins>+// Bug in opera makes the TD containing this element expand for a instance after finish
</ins><span class="cx"> Effect.Squish = function(element) {
</span><del>-  return new Effect.Scale(element, window.opera ? 1 : 0, { 
</del><ins>+  return new Effect.Scale(element, window.opera ? 1 : 0, {
</ins><span class="cx">     restoreAfterFinish: true,
</span><span class="cx">     beforeSetup: function(effect) {
</span><del>-      effect.element.makeClipping(); 
-    },  
</del><ins>+      effect.element.makeClipping();
+    },
</ins><span class="cx">     afterFinishInternal: function(effect) {
</span><del>-      effect.element.hide().undoClipping(); 
</del><ins>+      effect.element.hide().undoClipping();
</ins><span class="cx">     }
</span><span class="cx">   });
</span><span class="cx"> };
</span><span class="lines">@@ -764,13 +763,13 @@
</span><span class="cx">     width: element.style.width,
</span><span class="cx">     opacity: element.getInlineOpacity() };
</span><span class="cx"> 
</span><del>-  var dims = element.getDimensions();    
</del><ins>+  var dims = element.getDimensions();
</ins><span class="cx">   var initialMoveX, initialMoveY;
</span><span class="cx">   var moveX, moveY;
</span><del>-  
</del><ins>+
</ins><span class="cx">   switch (options.direction) {
</span><span class="cx">     case 'top-left':
</span><del>-      initialMoveX = initialMoveY = moveX = moveY = 0; 
</del><ins>+      initialMoveX = initialMoveY = moveX = moveY = 0;
</ins><span class="cx">       break;
</span><span class="cx">     case 'top-right':
</span><span class="cx">       initialMoveX = dims.width;
</span><span class="lines">@@ -795,11 +794,11 @@
</span><span class="cx">       moveY = -dims.height / 2;
</span><span class="cx">       break;
</span><span class="cx">   }
</span><del>-  
</del><ins>+
</ins><span class="cx">   return new Effect.Move(element, {
</span><span class="cx">     x: initialMoveX,
</span><span class="cx">     y: initialMoveY,
</span><del>-    duration: 0.01, 
</del><ins>+    duration: 0.01,
</ins><span class="cx">     beforeSetup: function(effect) {
</span><span class="cx">       effect.element.hide().makeClipping().makePositioned();
</span><span class="cx">     },
</span><span class="lines">@@ -808,17 +807,17 @@
</span><span class="cx">         [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
</span><span class="cx">           new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
</span><span class="cx">           new Effect.Scale(effect.element, 100, {
</span><del>-            scaleMode: { originalHeight: dims.height, originalWidth: dims.width }, 
</del><ins>+            scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
</ins><span class="cx">             sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
</span><span class="cx">         ], Object.extend({
</span><span class="cx">              beforeSetup: function(effect) {
</span><del>-               effect.effects[0].element.setStyle({height: '0px'}).show(); 
</del><ins>+               effect.effects[0].element.setStyle({height: '0px'}).show();
</ins><span class="cx">              },
</span><span class="cx">              afterFinishInternal: function(effect) {
</span><del>-               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle); 
</del><ins>+               effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
</ins><span class="cx">              }
</span><span class="cx">            }, options)
</span><del>-      )
</del><ins>+      );
</ins><span class="cx">     }
</span><span class="cx">   });
</span><span class="cx"> };
</span><span class="lines">@@ -840,7 +839,7 @@
</span><span class="cx"> 
</span><span class="cx">   var dims = element.getDimensions();
</span><span class="cx">   var moveX, moveY;
</span><del>-  
</del><ins>+
</ins><span class="cx">   switch (options.direction) {
</span><span class="cx">     case 'top-left':
</span><span class="cx">       moveX = moveY = 0;
</span><span class="lines">@@ -857,19 +856,19 @@
</span><span class="cx">       moveX = dims.width;
</span><span class="cx">       moveY = dims.height;
</span><span class="cx">       break;
</span><del>-    case 'center':  
</del><ins>+    case 'center':
</ins><span class="cx">       moveX = dims.width / 2;
</span><span class="cx">       moveY = dims.height / 2;
</span><span class="cx">       break;
</span><span class="cx">   }
</span><del>-  
</del><ins>+
</ins><span class="cx">   return new Effect.Parallel(
</span><span class="cx">     [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
</span><span class="cx">       new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
</span><span class="cx">       new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
</span><del>-    ], Object.extend({            
</del><ins>+    ], Object.extend({
</ins><span class="cx">          beforeStartInternal: function(effect) {
</span><del>-           effect.effects[0].element.makePositioned().makeClipping(); 
</del><ins>+           effect.effects[0].element.makePositioned().makeClipping();
</ins><span class="cx">          },
</span><span class="cx">          afterFinishInternal: function(effect) {
</span><span class="cx">            effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
</span><span class="lines">@@ -879,12 +878,14 @@
</span><span class="cx"> 
</span><span class="cx"> Effect.Pulsate = function(element) {
</span><span class="cx">   element = $(element);
</span><del>-  var options    = arguments[1] || { };
-  var oldOpacity = element.getInlineOpacity();
-  var transition = options.transition || Effect.Transitions.sinoidal;
-  var reverser   = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
-  reverser.bind(transition);
-  return new Effect.Opacity(element, 
</del><ins>+  var options    = arguments[1] || { },
+    oldOpacity = element.getInlineOpacity(),
+    transition = options.transition || Effect.Transitions.linear,
+    reverser   = function(pos){
+      return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
+    };
+
+  return new Effect.Opacity(element,
</ins><span class="cx">     Object.extend(Object.extend({  duration: 2.0, from: 0,
</span><span class="cx">       afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
</span><span class="cx">     }, options), {transition: reverser}));
</span><span class="lines">@@ -898,12 +899,12 @@
</span><span class="cx">     width: element.style.width,
</span><span class="cx">     height: element.style.height };
</span><span class="cx">   element.makeClipping();
</span><del>-  return new Effect.Scale(element, 5, Object.extend({   
</del><ins>+  return new Effect.Scale(element, 5, Object.extend({
</ins><span class="cx">     scaleContent: false,
</span><span class="cx">     scaleX: false,
</span><span class="cx">     afterFinishInternal: function(effect) {
</span><del>-    new Effect.Scale(element, 1, { 
-      scaleContent: false, 
</del><ins>+    new Effect.Scale(element, 1, {
+      scaleContent: false,
</ins><span class="cx">       scaleY: false,
</span><span class="cx">       afterFinishInternal: function(effect) {
</span><span class="cx">         effect.element.hide().undoClipping().setStyle(oldStyle);
</span><span class="lines">@@ -918,7 +919,7 @@
</span><span class="cx">     var options = Object.extend({
</span><span class="cx">       style: { }
</span><span class="cx">     }, arguments[1] || { });
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (!Object.isString(options.style)) this.style = $H(options.style);
</span><span class="cx">     else {
</span><span class="cx">       if (options.style.include(':'))
</span><span class="lines">@@ -936,18 +937,18 @@
</span><span class="cx">           effect.transforms.each(function(transform) {
</span><span class="cx">             effect.element.style[transform.style] = '';
</span><span class="cx">           });
</span><del>-        }
</del><ins>+        };
</ins><span class="cx">       }
</span><span class="cx">     }
</span><span class="cx">     this.start(options);
</span><span class="cx">   },
</span><del>-  
</del><ins>+
</ins><span class="cx">   setup: function(){
</span><span class="cx">     function parseColor(color){
</span><span class="cx">       if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
</span><span class="cx">       color = color.parseColor();
</span><span class="cx">       return $R(0,2).map(function(i){
</span><del>-        return parseInt( color.slice(i*2+1,i*2+3), 16 ) 
</del><ins>+        return parseInt( color.slice(i*2+1,i*2+3), 16 );
</ins><span class="cx">       });
</span><span class="cx">     }
</span><span class="cx">     this.transforms = this.style.map(function(pair){
</span><span class="lines">@@ -967,9 +968,9 @@
</span><span class="cx">       }
</span><span class="cx"> 
</span><span class="cx">       var originalValue = this.element.getStyle(property);
</span><del>-      return { 
-        style: property.camelize(), 
-        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0), 
</del><ins>+      return {
+        style: property.camelize(),
+        originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
</ins><span class="cx">         targetValue: unit=='color' ? parseColor(value) : value,
</span><span class="cx">         unit: unit
</span><span class="cx">       };
</span><span class="lines">@@ -980,13 +981,13 @@
</span><span class="cx">           transform.unit != 'color' &amp;&amp;
</span><span class="cx">           (isNaN(transform.originalValue) || isNaN(transform.targetValue))
</span><span class="cx">         )
</span><del>-      )
</del><ins>+      );
</ins><span class="cx">     });
</span><span class="cx">   },
</span><span class="cx">   update: function(position) {
</span><span class="cx">     var style = { }, transform, i = this.transforms.length;
</span><span class="cx">     while(i--)
</span><del>-      style[(transform = this.transforms[i]).style] = 
</del><ins>+      style[(transform = this.transforms[i]).style] =
</ins><span class="cx">         transform.unit=='color' ? '#'+
</span><span class="cx">           (Math.round(transform.originalValue[0]+
</span><span class="cx">             (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
</span><span class="lines">@@ -995,7 +996,7 @@
</span><span class="cx">           (Math.round(transform.originalValue[2]+
</span><span class="cx">             (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
</span><span class="cx">         (transform.originalValue +
</span><del>-          (transform.targetValue - transform.originalValue) * position).toFixed(3) + 
</del><ins>+          (transform.targetValue - transform.originalValue) * position).toFixed(3) +
</ins><span class="cx">             (transform.unit === null ? '' : transform.unit);
</span><span class="cx">     this.element.setStyle(style, true);
</span><span class="cx">   }
</span><span class="lines">@@ -1032,7 +1033,7 @@
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> Element.CSS_PROPERTIES = $w(
</span><del>-  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' + 
</del><ins>+  'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
</ins><span class="cx">   'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
</span><span class="cx">   'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
</span><span class="cx">   'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
</span><span class="lines">@@ -1041,7 +1042,7 @@
</span><span class="cx">   'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
</span><span class="cx">   'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
</span><span class="cx">   'right textIndent top width wordSpacing zIndex');
</span><del>-  
</del><ins>+
</ins><span class="cx"> Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
</span><span class="cx"> 
</span><span class="cx"> String.__parseStyleElement = document.createElement('div');
</span><span class="lines">@@ -1053,11 +1054,11 @@
</span><span class="cx">     String.__parseStyleElement.innerHTML = '&lt;div style=&quot;' + this + '&quot;&gt;&lt;/div&gt;';
</span><span class="cx">     style = String.__parseStyleElement.childNodes[0].style;
</span><span class="cx">   }
</span><del>-  
</del><ins>+
</ins><span class="cx">   Element.CSS_PROPERTIES.each(function(property){
</span><del>-    if (style[property]) styleRules.set(property, style[property]); 
</del><ins>+    if (style[property]) styleRules.set(property, style[property]);
</ins><span class="cx">   });
</span><del>-  
</del><ins>+
</ins><span class="cx">   if (Prototype.Browser.IE &amp;&amp; this.include('opacity'))
</span><span class="cx">     styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
</span><span class="cx"> 
</span><span class="lines">@@ -1076,14 +1077,14 @@
</span><span class="cx">   Element.getStyles = function(element) {
</span><span class="cx">     element = $(element);
</span><span class="cx">     var css = element.currentStyle, styles;
</span><del>-    styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) {
-      hash.set(property, css[property]);
-      return hash;
</del><ins>+    styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
+      results[property] = css[property];
+      return results;
</ins><span class="cx">     });
</span><del>-    if (!styles.opacity) styles.set('opacity', element.getOpacity());
</del><ins>+    if (!styles.opacity) styles.opacity = element.getOpacity();
</ins><span class="cx">     return styles;
</span><span class="cx">   };
</span><del>-};
</del><ins>+}
</ins><span class="cx"> 
</span><span class="cx"> Effect.Methods = {
</span><span class="cx">   morph: function(element, style) {
</span><span class="lines">@@ -1092,7 +1093,7 @@
</span><span class="cx">     return element;
</span><span class="cx">   },
</span><span class="cx">   visualEffect: function(element, effect, options) {
</span><del>-    element = $(element)
</del><ins>+    element = $(element);
</ins><span class="cx">     var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
</span><span class="cx">     new Effect[klass](element, options);
</span><span class="cx">     return element;
</span><span class="lines">@@ -1106,17 +1107,17 @@
</span><span class="cx"> 
</span><span class="cx"> $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
</span><span class="cx">   'pulsate shake puff squish switchOff dropOut').each(
</span><del>-  function(effect) { 
</del><ins>+  function(effect) {
</ins><span class="cx">     Effect.Methods[effect] = function(element, options){
</span><span class="cx">       element = $(element);
</span><span class="cx">       Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
</span><span class="cx">       return element;
</span><del>-    }
</del><ins>+    };
</ins><span class="cx">   }
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each( 
</del><ins>+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
</ins><span class="cx">   function(f) { Effect.Methods[f] = Element[f]; }
</span><span class="cx"> );
</span><span class="cx"> 
</span><del>-Element.addMethods(Effect.Methods);
</del><ins>+Element.addMethods(Effect.Methods);
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculousprototypejs"></a>
<div class="delfile"><h4>Deleted: trunk/wp-includes/js/scriptaculous/prototype.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/prototype.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/prototype.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,4184 +0,0 @@
</span><del>-/*  Prototype JavaScript framework, version 1.6.0
- *  (c) 2005-2007 Sam Stephenson
- *
- *  Prototype is freely distributable under the terms of an MIT-style license.
- *  For details, see the Prototype web site: http://www.prototypejs.org/
- *
- *--------------------------------------------------------------------------*/
-
-var Prototype = {
-  Version: '1.6.0',
-
-  Browser: {
-    IE:     !!(window.attachEvent &amp;&amp; !window.opera),
-    Opera:  !!window.opera,
-    WebKit: navigator.userAgent.indexOf('AppleWebKit/') &gt; -1,
-    Gecko:  navigator.userAgent.indexOf('Gecko') &gt; -1 &amp;&amp; navigator.userAgent.indexOf('KHTML') == -1,
-    MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
-  },
-
-  BrowserFeatures: {
-    XPath: !!document.evaluate,
-    ElementExtensions: !!window.HTMLElement,
-    SpecificElementExtensions:
-      document.createElement('div').__proto__ &amp;&amp;
-      document.createElement('div').__proto__ !==
-        document.createElement('form').__proto__
-  },
-
-  ScriptFragment: '&lt;script[^&gt;]*&gt;([\\S\\s]*?)&lt;\/script&gt;',
-  JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
-
-  emptyFunction: function() { },
-  K: function(x) { return x }
-};
-
-if (Prototype.Browser.MobileSafari)
-  Prototype.BrowserFeatures.SpecificElementExtensions = false;
-
-if (Prototype.Browser.WebKit)
-  Prototype.BrowserFeatures.XPath = false;
-
-/* Based on Alex Arnell's inheritance implementation. */
-var Class = {
-  create: function() {
-    var parent = null, properties = $A(arguments);
-    if (Object.isFunction(properties[0]))
-      parent = properties.shift();
-
-    function klass() {
-      this.initialize.apply(this, arguments);
-    }
-
-    Object.extend(klass, Class.Methods);
-    klass.superclass = parent;
-    klass.subclasses = [];
-
-    if (parent) {
-      var subclass = function() { };
-      subclass.prototype = parent.prototype;
-      klass.prototype = new subclass;
-      parent.subclasses.push(klass);
-    }
-
-    for (var i = 0; i &lt; properties.length; i++)
-      klass.addMethods(properties[i]);
-
-    if (!klass.prototype.initialize)
-      klass.prototype.initialize = Prototype.emptyFunction;
-
-    klass.prototype.constructor = klass;
-
-    return klass;
-  }
-};
-
-Class.Methods = {
-  addMethods: function(source) {
-    var ancestor   = this.superclass &amp;&amp; this.superclass.prototype;
-    var properties = Object.keys(source);
-
-    if (!Object.keys({ toString: true }).length)
-      properties.push(&quot;toString&quot;, &quot;valueOf&quot;);
-
-    for (var i = 0, length = properties.length; i &lt; length; i++) {
-      var property = properties[i], value = source[property];
-      if (ancestor &amp;&amp; Object.isFunction(value) &amp;&amp;
-          value.argumentNames().first() == &quot;$super&quot;) {
-        var method = value, value = Object.extend((function(m) {
-          return function() { return ancestor[m].apply(this, arguments) };
-        })(property).wrap(method), {
-          valueOf:  function() { return method },
-          toString: function() { return method.toString() }
-        });
-      }
-      this.prototype[property] = value;
-    }
-
-    return this;
-  }
-};
-
-var Abstract = { };
-
-Object.extend = function(destination, source) {
-  for (var property in source)
-    destination[property] = source[property];
-  return destination;
-};
-
-Object.extend(Object, {
-  inspect: function(object) {
-    try {
-      if (object === undefined) return 'undefined';
-      if (object === null) return 'null';
-      return object.inspect ? object.inspect() : object.toString();
-    } catch (e) {
-      if (e instanceof RangeError) return '...';
-      throw e;
-    }
-  },
-
-  toJSON: function(object) {
-    var type = typeof object;
-    switch (type) {
-      case 'undefined':
-      case 'function':
-      case 'unknown': return;
-      case 'boolean': return object.toString();
-    }
-
-    if (object === null) return 'null';
-    if (object.toJSON) return object.toJSON();
-    if (Object.isElement(object)) return;
-
-    var results = [];
-    for (var property in object) {
-      var value = Object.toJSON(object[property]);
-      if (value !== undefined)
-        results.push(property.toJSON() + ': ' + value);
-    }
-
-    return '{' + results.join(', ') + '}';
-  },
-
-  toQueryString: function(object) {
-    return $H(object).toQueryString();
-  },
-
-  toHTML: function(object) {
-    return object &amp;&amp; object.toHTML ? object.toHTML() : String.interpret(object);
-  },
-
-  keys: function(object) {
-    var keys = [];
-    for (var property in object)
-      keys.push(property);
-    return keys;
-  },
-
-  values: function(object) {
-    var values = [];
-    for (var property in object)
-      values.push(object[property]);
-    return values;
-  },
-
-  clone: function(object) {
-    return Object.extend({ }, object);
-  },
-
-  isElement: function(object) {
-    return object &amp;&amp; object.nodeType == 1;
-  },
-
-  isArray: function(object) {
-    return object &amp;&amp; object.constructor === Array;
-  },
-
-  isHash: function(object) {
-    return object instanceof Hash;
-  },
-
-  isFunction: function(object) {
-    return typeof object == &quot;function&quot;;
-  },
-
-  isString: function(object) {
-    return typeof object == &quot;string&quot;;
-  },
-
-  isNumber: function(object) {
-    return typeof object == &quot;number&quot;;
-  },
-
-  isUndefined: function(object) {
-    return typeof object == &quot;undefined&quot;;
-  }
-});
-
-Object.extend(Function.prototype, {
-  argumentNames: function() {
-    var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(&quot;,&quot;).invoke(&quot;strip&quot;);
-    return names.length == 1 &amp;&amp; !names[0] ? [] : names;
-  },
-
-  bind: function() {
-    if (arguments.length &lt; 2 &amp;&amp; arguments[0] === undefined) return this;
-    var __method = this, args = $A(arguments), object = args.shift();
-    return function() {
-      return __method.apply(object, args.concat($A(arguments)));
-    }
-  },
-
-  bindAsEventListener: function() {
-    var __method = this, args = $A(arguments), object = args.shift();
-    return function(event) {
-      return __method.apply(object, [event || window.event].concat(args));
-    }
-  },
-
-  curry: function() {
-    if (!arguments.length) return this;
-    var __method = this, args = $A(arguments);
-    return function() {
-      return __method.apply(this, args.concat($A(arguments)));
-    }
-  },
-
-  delay: function() {
-    var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
-    return window.setTimeout(function() {
-      return __method.apply(__method, args);
-    }, timeout);
-  },
-
-  wrap: function(wrapper) {
-    var __method = this;
-    return function() {
-      return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
-    }
-  },
-
-  methodize: function() {
-    if (this._methodized) return this._methodized;
-    var __method = this;
-    return this._methodized = function() {
-      return __method.apply(null, [this].concat($A(arguments)));
-    };
-  }
-});
-
-Function.prototype.defer = Function.prototype.delay.curry(0.01);
-
-Date.prototype.toJSON = function() {
-  return '&quot;' + this.getUTCFullYear() + '-' +
-    (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
-    this.getUTCDate().toPaddedString(2) + 'T' +
-    this.getUTCHours().toPaddedString(2) + ':' +
-    this.getUTCMinutes().toPaddedString(2) + ':' +
-    this.getUTCSeconds().toPaddedString(2) + 'Z&quot;';
-};
-
-var Try = {
-  these: function() {
-    var returnValue;
-
-    for (var i = 0, length = arguments.length; i &lt; length; i++) {
-      var lambda = arguments[i];
-      try {
-        returnValue = lambda();
-        break;
-      } catch (e) { }
-    }
-
-    return returnValue;
-  }
-};
-
-RegExp.prototype.match = RegExp.prototype.test;
-
-RegExp.escape = function(str) {
-  return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
-};
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create({
-  initialize: function(callback, frequency) {
-    this.callback = callback;
-    this.frequency = frequency;
-    this.currentlyExecuting = false;
-
-    this.registerCallback();
-  },
-
-  registerCallback: function() {
-    this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
-  },
-
-  execute: function() {
-    this.callback(this);
-  },
-
-  stop: function() {
-    if (!this.timer) return;
-    clearInterval(this.timer);
-    this.timer = null;
-  },
-
-  onTimerEvent: function() {
-    if (!this.currentlyExecuting) {
-      try {
-        this.currentlyExecuting = true;
-        this.execute();
-      } finally {
-        this.currentlyExecuting = false;
-      }
-    }
-  }
-});
-Object.extend(String, {
-  interpret: function(value) {
-    return value == null ? '' : String(value);
-  },
-  specialChar: {
-    '\b': '\\b',
-    '\t': '\\t',
-    '\n': '\\n',
-    '\f': '\\f',
-    '\r': '\\r',
-    '\\': '\\\\'
-  }
-});
-
-Object.extend(String.prototype, {
-  gsub: function(pattern, replacement) {
-    var result = '', source = this, match;
-    replacement = arguments.callee.prepareReplacement(replacement);
-
-    while (source.length &gt; 0) {
-      if (match = source.match(pattern)) {
-        result += source.slice(0, match.index);
-        result += String.interpret(replacement(match));
-        source  = source.slice(match.index + match[0].length);
-      } else {
-        result += source, source = '';
-      }
-    }
-    return result;
-  },
-
-  sub: function(pattern, replacement, count) {
-    replacement = this.gsub.prepareReplacement(replacement);
-    count = count === undefined ? 1 : count;
-
-    return this.gsub(pattern, function(match) {
-      if (--count &lt; 0) return match[0];
-      return replacement(match);
-    });
-  },
-
-  scan: function(pattern, iterator) {
-    this.gsub(pattern, iterator);
-    return String(this);
-  },
-
-  truncate: function(length, truncation) {
-    length = length || 30;
-    truncation = truncation === undefined ? '...' : truncation;
-    return this.length &gt; length ?
-      this.slice(0, length - truncation.length) + truncation : String(this);
-  },
-
-  strip: function() {
-    return this.replace(/^\s+/, '').replace(/\s+$/, '');
-  },
-
-  stripTags: function() {
-    return this.replace(/&lt;\/?[^&gt;]+&gt;/gi, '');
-  },
-
-  stripScripts: function() {
-    return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
-  },
-
-  extractScripts: function() {
-    var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
-    var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
-    return (this.match(matchAll) || []).map(function(scriptTag) {
-      return (scriptTag.match(matchOne) || ['', ''])[1];
-    });
-  },
-
-  evalScripts: function() {
-    return this.extractScripts().map(function(script) { return eval(script) });
-  },
-
-  escapeHTML: function() {
-    var self = arguments.callee;
-    self.text.data = this;
-    return self.div.innerHTML;
-  },
-
-  unescapeHTML: function() {
-    var div = new Element('div');
-    div.innerHTML = this.stripTags();
-    return div.childNodes[0] ? (div.childNodes.length &gt; 1 ?
-      $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
-      div.childNodes[0].nodeValue) : '';
-  },
-
-  toQueryParams: function(separator) {
-    var match = this.strip().match(/([^?#]*)(#.*)?$/);
-    if (!match) return { };
-
-    return match[1].split(separator || '&amp;').inject({ }, function(hash, pair) {
-      if ((pair = pair.split('='))[0]) {
-        var key = decodeURIComponent(pair.shift());
-        var value = pair.length &gt; 1 ? pair.join('=') : pair[0];
-        if (value != undefined) value = decodeURIComponent(value);
-
-        if (key in hash) {
-          if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
-          hash[key].push(value);
-        }
-        else hash[key] = value;
-      }
-      return hash;
-    });
-  },
-
-  toArray: function() {
-    return this.split('');
-  },
-
-  succ: function() {
-    return this.slice(0, this.length - 1) +
-      String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
-  },
-
-  times: function(count) {
-    return count &lt; 1 ? '' : new Array(count + 1).join(this);
-  },
-
-  camelize: function() {
-    var parts = this.split('-'), len = parts.length;
-    if (len == 1) return parts[0];
-
-    var camelized = this.charAt(0) == '-'
-      ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
-      : parts[0];
-
-    for (var i = 1; i &lt; len; i++)
-      camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
-    return camelized;
-  },
-
-  capitalize: function() {
-    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
-  },
-
-  underscore: function() {
-    return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
-  },
-
-  dasherize: function() {
-    return this.gsub(/_/,'-');
-  },
-
-  inspect: function(useDoubleQuotes) {
-    var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
-      var character = String.specialChar[match[0]];
-      return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
-    });
-    if (useDoubleQuotes) return '&quot;' + escapedString.replace(/&quot;/g, '\\&quot;') + '&quot;';
-    return &quot;'&quot; + escapedString.replace(/'/g, '\\\'') + &quot;'&quot;;
-  },
-
-  toJSON: function() {
-    return this.inspect(true);
-  },
-
-  unfilterJSON: function(filter) {
-    return this.sub(filter || Prototype.JSONFilter, '#{1}');
-  },
-
-  isJSON: function() {
-    var str = this.replace(/\\./g, '@').replace(/&quot;[^&quot;\\\n\r]*&quot;/g, '');
-    return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
-  },
-
-  evalJSON: function(sanitize) {
-    var json = this.unfilterJSON();
-    try {
-      if (!sanitize || json.isJSON()) return eval('(' + json + ')');
-    } catch (e) { }
-    throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
-  },
-
-  include: function(pattern) {
-    return this.indexOf(pattern) &gt; -1;
-  },
-
-  startsWith: function(pattern) {
-    return this.indexOf(pattern) === 0;
-  },
-
-  endsWith: function(pattern) {
-    var d = this.length - pattern.length;
-    return d &gt;= 0 &amp;&amp; this.lastIndexOf(pattern) === d;
-  },
-
-  empty: function() {
-    return this == '';
-  },
-
-  blank: function() {
-    return /^\s*$/.test(this);
-  },
-
-  interpolate: function(object, pattern) {
-    return new Template(this, pattern).evaluate(object);
-  }
-});
-
-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
-  escapeHTML: function() {
-    return this.replace(/&amp;/g,'&amp;amp;').replace(/&lt;/g,'&amp;lt;').replace(/&gt;/g,'&amp;gt;');
-  },
-  unescapeHTML: function() {
-    return this.replace(/&amp;amp;/g,'&amp;').replace(/&amp;lt;/g,'&lt;').replace(/&amp;gt;/g,'&gt;');
-  }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
-  if (Object.isFunction(replacement)) return replacement;
-  var template = new Template(replacement);
-  return function(match) { return template.evaluate(match) };
-};
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-Object.extend(String.prototype.escapeHTML, {
-  div:  document.createElement('div'),
-  text: document.createTextNode('')
-});
-
-with (String.prototype.escapeHTML) div.appendChild(text);
-
-var Template = Class.create({
-  initialize: function(template, pattern) {
-    this.template = template.toString();
-    this.pattern = pattern || Template.Pattern;
-  },
-
-  evaluate: function(object) {
-    if (Object.isFunction(object.toTemplateReplacements))
-      object = object.toTemplateReplacements();
-
-    return this.template.gsub(this.pattern, function(match) {
-      if (object == null) return '';
-
-      var before = match[1] || '';
-      if (before == '\\') return match[2];
-
-      var ctx = object, expr = match[3];
-      var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
-      if (match == null) return before;
-
-      while (match != null) {
-        var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
-        ctx = ctx[comp];
-        if (null == ctx || '' == match[3]) break;
-        expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
-        match = pattern.exec(expr);
-      }
-
-      return before + String.interpret(ctx);
-    }.bind(this));
-  }
-});
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-
-var $break = { };
-
-var Enumerable = {
-  each: function(iterator, context) {
-    var index = 0;
-    iterator = iterator.bind(context);
-    try {
-      this._each(function(value) {
-        iterator(value, index++);
-      });
-    } catch (e) {
-      if (e != $break) throw e;
-    }
-    return this;
-  },
-
-  eachSlice: function(number, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var index = -number, slices = [], array = this.toArray();
-    while ((index += number) &lt; array.length)
-      slices.push(array.slice(index, index+number));
-    return slices.collect(iterator, context);
-  },
-
-  all: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result = true;
-    this.each(function(value, index) {
-      result = result &amp;&amp; !!iterator(value, index);
-      if (!result) throw $break;
-    });
-    return result;
-  },
-
-  any: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result = false;
-    this.each(function(value, index) {
-      if (result = !!iterator(value, index))
-        throw $break;
-    });
-    return result;
-  },
-
-  collect: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var results = [];
-    this.each(function(value, index) {
-      results.push(iterator(value, index));
-    });
-    return results;
-  },
-
-  detect: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var result;
-    this.each(function(value, index) {
-      if (iterator(value, index)) {
-        result = value;
-        throw $break;
-      }
-    });
-    return result;
-  },
-
-  findAll: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var results = [];
-    this.each(function(value, index) {
-      if (iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  grep: function(filter, iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var results = [];
-
-    if (Object.isString(filter))
-      filter = new RegExp(filter);
-
-    this.each(function(value, index) {
-      if (filter.match(value))
-        results.push(iterator(value, index));
-    });
-    return results;
-  },
-
-  include: function(object) {
-    if (Object.isFunction(this.indexOf))
-      if (this.indexOf(object) != -1) return true;
-
-    var found = false;
-    this.each(function(value) {
-      if (value == object) {
-        found = true;
-        throw $break;
-      }
-    });
-    return found;
-  },
-
-  inGroupsOf: function(number, fillWith) {
-    fillWith = fillWith === undefined ? null : fillWith;
-    return this.eachSlice(number, function(slice) {
-      while(slice.length &lt; number) slice.push(fillWith);
-      return slice;
-    });
-  },
-
-  inject: function(memo, iterator, context) {
-    iterator = iterator.bind(context);
-    this.each(function(value, index) {
-      memo = iterator(memo, value, index);
-    });
-    return memo;
-  },
-
-  invoke: function(method) {
-    var args = $A(arguments).slice(1);
-    return this.map(function(value) {
-      return value[method].apply(value, args);
-    });
-  },
-
-  max: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result;
-    this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == undefined || value &gt;= result)
-        result = value;
-    });
-    return result;
-  },
-
-  min: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var result;
-    this.each(function(value, index) {
-      value = iterator(value, index);
-      if (result == undefined || value &lt; result)
-        result = value;
-    });
-    return result;
-  },
-
-  partition: function(iterator, context) {
-    iterator = iterator ? iterator.bind(context) : Prototype.K;
-    var trues = [], falses = [];
-    this.each(function(value, index) {
-      (iterator(value, index) ?
-        trues : falses).push(value);
-    });
-    return [trues, falses];
-  },
-
-  pluck: function(property) {
-    var results = [];
-    this.each(function(value) {
-      results.push(value[property]);
-    });
-    return results;
-  },
-
-  reject: function(iterator, context) {
-    iterator = iterator.bind(context);
-    var results = [];
-    this.each(function(value, index) {
-      if (!iterator(value, index))
-        results.push(value);
-    });
-    return results;
-  },
-
-  sortBy: function(iterator, context) {
-    iterator = iterator.bind(context);
-    return this.map(function(value, index) {
-      return {value: value, criteria: iterator(value, index)};
-    }).sort(function(left, right) {
-      var a = left.criteria, b = right.criteria;
-      return a &lt; b ? -1 : a &gt; b ? 1 : 0;
-    }).pluck('value');
-  },
-
-  toArray: function() {
-    return this.map();
-  },
-
-  zip: function() {
-    var iterator = Prototype.K, args = $A(arguments);
-    if (Object.isFunction(args.last()))
-      iterator = args.pop();
-
-    var collections = [this].concat(args).map($A);
-    return this.map(function(value, index) {
-      return iterator(collections.pluck(index));
-    });
-  },
-
-  size: function() {
-    return this.toArray().length;
-  },
-
-  inspect: function() {
-    return '#&lt;Enumerable:' + this.toArray().inspect() + '&gt;';
-  }
-};
-
-Object.extend(Enumerable, {
-  map:     Enumerable.collect,
-  find:    Enumerable.detect,
-  select:  Enumerable.findAll,
-  filter:  Enumerable.findAll,
-  member:  Enumerable.include,
-  entries: Enumerable.toArray,
-  every:   Enumerable.all,
-  some:    Enumerable.any
-});
-function $A(iterable) {
-  if (!iterable) return [];
-  if (iterable.toArray) return iterable.toArray();
-  var length = iterable.length, results = new Array(length);
-  while (length--) results[length] = iterable[length];
-  return results;
-}
-
-if (Prototype.Browser.WebKit) {
-  function $A(iterable) {
-    if (!iterable) return [];
-    if (!(Object.isFunction(iterable) &amp;&amp; iterable == '[object NodeList]') &amp;&amp;
-        iterable.toArray) return iterable.toArray();
-    var length = iterable.length, results = new Array(length);
-    while (length--) results[length] = iterable[length];
-    return results;
-  }
-}
-
-Array.from = $A;
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
-  _each: function(iterator) {
-    for (var i = 0, length = this.length; i &lt; length; i++)
-      iterator(this[i]);
-  },
-
-  clear: function() {
-    this.length = 0;
-    return this;
-  },
-
-  first: function() {
-    return this[0];
-  },
-
-  last: function() {
-    return this[this.length - 1];
-  },
-
-  compact: function() {
-    return this.select(function(value) {
-      return value != null;
-    });
-  },
-
-  flatten: function() {
-    return this.inject([], function(array, value) {
-      return array.concat(Object.isArray(value) ?
-        value.flatten() : [value]);
-    });
-  },
-
-  without: function() {
-    var values = $A(arguments);
-    return this.select(function(value) {
-      return !values.include(value);
-    });
-  },
-
-  reverse: function(inline) {
-    return (inline !== false ? this : this.toArray())._reverse();
-  },
-
-  reduce: function() {
-    return this.length &gt; 1 ? this : this[0];
-  },
-
-  uniq: function(sorted) {
-    return this.inject([], function(array, value, index) {
-      if (0 == index || (sorted ? array.last() != value : !array.include(value)))
-        array.push(value);
-      return array;
-    });
-  },
-
-  intersect: function(array) {
-    return this.uniq().findAll(function(item) {
-      return array.detect(function(value) { return item === value });
-    });
-  },
-
-  clone: function() {
-    return [].concat(this);
-  },
-
-  size: function() {
-    return this.length;
-  },
-
-  inspect: function() {
-    return '[' + this.map(Object.inspect).join(', ') + ']';
-  },
-
-  toJSON: function() {
-    var results = [];
-    this.each(function(object) {
-      var value = Object.toJSON(object);
-      if (value !== undefined) results.push(value);
-    });
-    return '[' + results.join(', ') + ']';
-  }
-});
-
-// use native browser JS 1.6 implementation if available
-if (Object.isFunction(Array.prototype.forEach))
-  Array.prototype._each = Array.prototype.forEach;
-
-if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
-  i || (i = 0);
-  var length = this.length;
-  if (i &lt; 0) i = length + i;
-  for (; i &lt; length; i++)
-    if (this[i] === item) return i;
-  return -1;
-};
-
-if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
-  i = isNaN(i) ? this.length : (i &lt; 0 ? this.length + i : i) + 1;
-  var n = this.slice(0, i).reverse().indexOf(item);
-  return (n &lt; 0) ? n : i - n - 1;
-};
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string) {
-  if (!Object.isString(string)) return [];
-  string = string.strip();
-  return string ? string.split(/\s+/) : [];
-}
-
-if (Prototype.Browser.Opera){
-  Array.prototype.concat = function() {
-    var array = [];
-    for (var i = 0, length = this.length; i &lt; length; i++) array.push(this[i]);
-    for (var i = 0, length = arguments.length; i &lt; length; i++) {
-      if (Object.isArray(arguments[i])) {
-        for (var j = 0, arrayLength = arguments[i].length; j &lt; arrayLength; j++)
-          array.push(arguments[i][j]);
-      } else {
-        array.push(arguments[i]);
-      }
-    }
-    return array;
-  };
-}
-Object.extend(Number.prototype, {
-  toColorPart: function() {
-    return this.toPaddedString(2, 16);
-  },
-
-  succ: function() {
-    return this + 1;
-  },
-
-  times: function(iterator) {
-    $R(0, this, true).each(iterator);
-    return this;
-  },
-
-  toPaddedString: function(length, radix) {
-    var string = this.toString(radix || 10);
-    return '0'.times(length - string.length) + string;
-  },
-
-  toJSON: function() {
-    return isFinite(this) ? this.toString() : 'null';
-  }
-});
-
-$w('abs round ceil floor').each(function(method){
-  Number.prototype[method] = Math[method].methodize();
-});
-function $H(object) {
-  return new Hash(object);
-};
-
-var Hash = Class.create(Enumerable, (function() {
-  if (function() {
-    var i = 0, Test = function(value) { this.key = value };
-    Test.prototype.key = 'foo';
-    for (var property in new Test('bar')) i++;
-    return i &gt; 1;
-  }()) {
-    function each(iterator) {
-      var cache = [];
-      for (var key in this._object) {
-        var value = this._object[key];
-        if (cache.include(key)) continue;
-        cache.push(key);
-        var pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
-    }
-  } else {
-    function each(iterator) {
-      for (var key in this._object) {
-        var value = this._object[key], pair = [key, value];
-        pair.key = key;
-        pair.value = value;
-        iterator(pair);
-      }
-    }
-  }
-
-  function toQueryPair(key, value) {
-    if (Object.isUndefined(value)) return key;
-    return key + '=' + encodeURIComponent(String.interpret(value));
-  }
-
-  return {
-    initialize: function(object) {
-      this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
-    },
-
-    _each: each,
-
-    set: function(key, value) {
-      return this._object[key] = value;
-    },
-
-    get: function(key) {
-      return this._object[key];
-    },
-
-    unset: function(key) {
-      var value = this._object[key];
-      delete this._object[key];
-      return value;
-    },
-
-    toObject: function() {
-      return Object.clone(this._object);
-    },
-
-    keys: function() {
-      return this.pluck('key');
-    },
-
-    values: function() {
-      return this.pluck('value');
-    },
-
-    index: function(value) {
-      var match = this.detect(function(pair) {
-        return pair.value === value;
-      });
-      return match &amp;&amp; match.key;
-    },
-
-    merge: function(object) {
-      return this.clone().update(object);
-    },
-
-    update: function(object) {
-      return new Hash(object).inject(this, function(result, pair) {
-        result.set(pair.key, pair.value);
-        return result;
-      });
-    },
-
-    toQueryString: function() {
-      return this.map(function(pair) {
-        var key = encodeURIComponent(pair.key), values = pair.value;
-
-        if (values &amp;&amp; typeof values == 'object') {
-          if (Object.isArray(values))
-            return values.map(toQueryPair.curry(key)).join('&amp;');
-        }
-        return toQueryPair(key, values);
-      }).join('&amp;');
-    },
-
-    inspect: function() {
-      return '#&lt;Hash:{' + this.map(function(pair) {
-        return pair.map(Object.inspect).join(': ');
-      }).join(', ') + '}&gt;';
-    },
-
-    toJSON: function() {
-      return Object.toJSON(this.toObject());
-    },
-
-    clone: function() {
-      return new Hash(this);
-    }
-  }
-})());
-
-Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
-Hash.from = $H;
-var ObjectRange = Class.create(Enumerable, {
-  initialize: function(start, end, exclusive) {
-    this.start = start;
-    this.end = end;
-    this.exclusive = exclusive;
-  },
-
-  _each: function(iterator) {
-    var value = this.start;
-    while (this.include(value)) {
-      iterator(value);
-      value = value.succ();
-    }
-  },
-
-  include: function(value) {
-    if (value &lt; this.start)
-      return false;
-    if (this.exclusive)
-      return value &lt; this.end;
-    return value &lt;= this.end;
-  }
-});
-
-var $R = function(start, end, exclusive) {
-  return new ObjectRange(start, end, exclusive);
-};
-
-var Ajax = {
-  getTransport: function() {
-    return Try.these(
-      function() {return new XMLHttpRequest()},
-      function() {return new ActiveXObject('Msxml2.XMLHTTP')},
-      function() {return new ActiveXObject('Microsoft.XMLHTTP')}
-    ) || false;
-  },
-
-  activeRequestCount: 0
-};
-
-Ajax.Responders = {
-  responders: [],
-
-  _each: function(iterator) {
-    this.responders._each(iterator);
-  },
-
-  register: function(responder) {
-    if (!this.include(responder))
-      this.responders.push(responder);
-  },
-
-  unregister: function(responder) {
-    this.responders = this.responders.without(responder);
-  },
-
-  dispatch: function(callback, request, transport, json) {
-    this.each(function(responder) {
-      if (Object.isFunction(responder[callback])) {
-        try {
-          responder[callback].apply(responder, [request, transport, json]);
-        } catch (e) { }
-      }
-    });
-  }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
-  onCreate:   function() { Ajax.activeRequestCount++ },
-  onComplete: function() { Ajax.activeRequestCount-- }
-});
-
-Ajax.Base = Class.create({
-  initialize: function(options) {
-    this.options = {
-      method:       'post',
-      asynchronous: true,
-      contentType:  'application/x-www-form-urlencoded',
-      encoding:     'UTF-8',
-      parameters:   '',
-      evalJSON:     true,
-      evalJS:       true
-    };
-    Object.extend(this.options, options || { });
-
-    this.options.method = this.options.method.toLowerCase();
-    if (Object.isString(this.options.parameters))
-      this.options.parameters = this.options.parameters.toQueryParams();
-  }
-});
-
-Ajax.Request = Class.create(Ajax.Base, {
-  _complete: false,
-
-  initialize: function($super, url, options) {
-    $super(options);
-    this.transport = Ajax.getTransport();
-    this.request(url);
-  },
-
-  request: function(url) {
-    this.url = url;
-    this.method = this.options.method;
-    var params = Object.clone(this.options.parameters);
-
-    if (!['get', 'post'].include(this.method)) {
-      // simulate other verbs over post
-      params['_method'] = this.method;
-      this.method = 'post';
-    }
-
-    this.parameters = params;
-
-    if (params = Object.toQueryString(params)) {
-      // when GET, append parameters to URL
-      if (this.method == 'get')
-        this.url += (this.url.include('?') ? '&amp;' : '?') + params;
-      else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
-        params += '&amp;_=';
-    }
-
-    try {
-      var response = new Ajax.Response(this);
-      if (this.options.onCreate) this.options.onCreate(response);
-      Ajax.Responders.dispatch('onCreate', this, response);
-
-      this.transport.open(this.method.toUpperCase(), this.url,
-        this.options.asynchronous);
-
-      if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
-
-      this.transport.onreadystatechange = this.onStateChange.bind(this);
-      this.setRequestHeaders();
-
-      this.body = this.method == 'post' ? (this.options.postBody || params) : null;
-      this.transport.send(this.body);
-
-      /* Force Firefox to handle ready state 4 for synchronous requests */
-      if (!this.options.asynchronous &amp;&amp; this.transport.overrideMimeType)
-        this.onStateChange();
-
-    }
-    catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  onStateChange: function() {
-    var readyState = this.transport.readyState;
-    if (readyState &gt; 1 &amp;&amp; !((readyState == 4) &amp;&amp; this._complete))
-      this.respondToReadyState(this.transport.readyState);
-  },
-
-  setRequestHeaders: function() {
-    var headers = {
-      'X-Requested-With': 'XMLHttpRequest',
-      'X-Prototype-Version': Prototype.Version,
-      'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
-    };
-
-    if (this.method == 'post') {
-      headers['Content-type'] = this.options.contentType +
-        (this.options.encoding ? '; charset=' + this.options.encoding : '');
-
-      /* Force &quot;Connection: close&quot; for older Mozilla browsers to work
-       * around a bug where XMLHttpRequest sends an incorrect
-       * Content-length header. See Mozilla Bugzilla #246651.
-       */
-      if (this.transport.overrideMimeType &amp;&amp;
-          (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] &lt; 2005)
-            headers['Connection'] = 'close';
-    }
-
-    // user-defined headers
-    if (typeof this.options.requestHeaders == 'object') {
-      var extras = this.options.requestHeaders;
-
-      if (Object.isFunction(extras.push))
-        for (var i = 0, length = extras.length; i &lt; length; i += 2)
-          headers[extras[i]] = extras[i+1];
-      else
-        $H(extras).each(function(pair) { headers[pair.key] = pair.value });
-    }
-
-    for (var name in headers)
-      this.transport.setRequestHeader(name, headers[name]);
-  },
-
-  success: function() {
-    var status = this.getStatus();
-    return !status || (status &gt;= 200 &amp;&amp; status &lt; 300);
-  },
-
-  getStatus: function() {
-    try {
-      return this.transport.status || 0;
-    } catch (e) { return 0 }
-  },
-
-  respondToReadyState: function(readyState) {
-    var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
-
-    if (state == 'Complete') {
-      try {
-        this._complete = true;
-        (this.options['on' + response.status]
-         || this.options['on' + (this.success() ? 'Success' : 'Failure')]
-         || Prototype.emptyFunction)(response, response.headerJSON);
-      } catch (e) {
-        this.dispatchException(e);
-      }
-
-      var contentType = response.getHeader('Content-type');
-      if (this.options.evalJS == 'force'
-          || (this.options.evalJS &amp;&amp; contentType
-          &amp;&amp; contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
-        this.evalResponse();
-    }
-
-    try {
-      (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
-      Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
-    } catch (e) {
-      this.dispatchException(e);
-    }
-
-    if (state == 'Complete') {
-      // avoid memory leak in MSIE: clean up
-      this.transport.onreadystatechange = Prototype.emptyFunction;
-    }
-  },
-
-  getHeader: function(name) {
-    try {
-      return this.transport.getResponseHeader(name);
-    } catch (e) { return null }
-  },
-
-  evalResponse: function() {
-    try {
-      return eval((this.transport.responseText || '').unfilterJSON());
-    } catch (e) {
-      this.dispatchException(e);
-    }
-  },
-
-  dispatchException: function(exception) {
-    (this.options.onException || Prototype.emptyFunction)(this, exception);
-    Ajax.Responders.dispatch('onException', this, exception);
-  }
-});
-
-Ajax.Request.Events =
-  ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Response = Class.create({
-  initialize: function(request){
-    this.request = request;
-    var transport  = this.transport  = request.transport,
-        readyState = this.readyState = transport.readyState;
-
-    if((readyState &gt; 2 &amp;&amp; !Prototype.Browser.IE) || readyState == 4) {
-      this.status       = this.getStatus();
-      this.statusText   = this.getStatusText();
-      this.responseText = String.interpret(transport.responseText);
-      this.headerJSON   = this._getHeaderJSON();
-    }
-
-    if(readyState == 4) {
-      var xml = transport.responseXML;
-      this.responseXML  = xml === undefined ? null : xml;
-      this.responseJSON = this._getResponseJSON();
-    }
-  },
-
-  status:      0,
-  statusText: '',
-
-  getStatus: Ajax.Request.prototype.getStatus,
-
-  getStatusText: function() {
-    try {
-      return this.transport.statusText || '';
-    } catch (e) { return '' }
-  },
-
-  getHeader: Ajax.Request.prototype.getHeader,
-
-  getAllHeaders: function() {
-    try {
-      return this.getAllResponseHeaders();
-    } catch (e) { return null }
-  },
-
-  getResponseHeader: function(name) {
-    return this.transport.getResponseHeader(name);
-  },
-
-  getAllResponseHeaders: function() {
-    return this.transport.getAllResponseHeaders();
-  },
-
-  _getHeaderJSON: function() {
-    var json = this.getHeader('X-JSON');
-    if (!json) return null;
-    json = decodeURIComponent(escape(json));
-    try {
-      return json.evalJSON(this.request.options.sanitizeJSON);
-    } catch (e) {
-      this.request.dispatchException(e);
-    }
-  },
-
-  _getResponseJSON: function() {
-    var options = this.request.options;
-    if (!options.evalJSON || (options.evalJSON != 'force' &amp;&amp;
-      !(this.getHeader('Content-type') || '').include('application/json')))
-        return null;
-    try {
-      return this.transport.responseText.evalJSON(options.sanitizeJSON);
-    } catch (e) {
-      this.request.dispatchException(e);
-    }
-  }
-});
-
-Ajax.Updater = Class.create(Ajax.Request, {
-  initialize: function($super, container, url, options) {
-    this.container = {
-      success: (container.success || container),
-      failure: (container.failure || (container.success ? null : container))
-    };
-
-    options = options || { };
-    var onComplete = options.onComplete;
-    options.onComplete = (function(response, param) {
-      this.updateContent(response.responseText);
-      if (Object.isFunction(onComplete)) onComplete(response, param);
-    }).bind(this);
-
-    $super(url, options);
-  },
-
-  updateContent: function(responseText) {
-    var receiver = this.container[this.success() ? 'success' : 'failure'],
-        options = this.options;
-
-    if (!options.evalScripts) responseText = responseText.stripScripts();
-
-    if (receiver = $(receiver)) {
-      if (options.insertion) {
-        if (Object.isString(options.insertion)) {
-          var insertion = { }; insertion[options.insertion] = responseText;
-          receiver.insert(insertion);
-        }
-        else options.insertion(receiver, responseText);
-      }
-      else receiver.update(responseText);
-    }
-
-    if (this.success()) {
-      if (this.onComplete) this.onComplete.bind(this).defer();
-    }
-  }
-});
-
-Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
-  initialize: function($super, container, url, options) {
-    $super(options);
-    this.onComplete = this.options.onComplete;
-
-    this.frequency = (this.options.frequency || 2);
-    this.decay = (this.options.decay || 1);
-
-    this.updater = { };
-    this.container = container;
-    this.url = url;
-
-    this.start();
-  },
-
-  start: function() {
-    this.options.onComplete = this.updateComplete.bind(this);
-    this.onTimerEvent();
-  },
-
-  stop: function() {
-    this.updater.options.onComplete = undefined;
-    clearTimeout(this.timer);
-    (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
-  },
-
-  updateComplete: function(response) {
-    if (this.options.decay) {
-      this.decay = (response.responseText == this.lastText ?
-        this.decay * this.options.decay : 1);
-
-      this.lastText = response.responseText;
-    }
-    this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
-  },
-
-  onTimerEvent: function() {
-    this.updater = new Ajax.Updater(this.container, this.url, this.options);
-  }
-});
-function $(element) {
-  if (arguments.length &gt; 1) {
-    for (var i = 0, elements = [], length = arguments.length; i &lt; length; i++)
-      elements.push($(arguments[i]));
-    return elements;
-  }
-  if (Object.isString(element))
-    element = document.getElementById(element);
-  return Element.extend(element);
-}
-
-if (Prototype.BrowserFeatures.XPath) {
-  document._getElementsByXPath = function(expression, parentElement) {
-    var results = [];
-    var query = document.evaluate(expression, $(parentElement) || document,
-      null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
-    for (var i = 0, length = query.snapshotLength; i &lt; length; i++)
-      results.push(Element.extend(query.snapshotItem(i)));
-    return results;
-  };
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Node) var Node = { };
-
-if (!Node.ELEMENT_NODE) {
-  // DOM level 2 ECMAScript Language Binding
-  Object.extend(Node, {
-    ELEMENT_NODE: 1,
-    ATTRIBUTE_NODE: 2,
-    TEXT_NODE: 3,
-    CDATA_SECTION_NODE: 4,
-    ENTITY_REFERENCE_NODE: 5,
-    ENTITY_NODE: 6,
-    PROCESSING_INSTRUCTION_NODE: 7,
-    COMMENT_NODE: 8,
-    DOCUMENT_NODE: 9,
-    DOCUMENT_TYPE_NODE: 10,
-    DOCUMENT_FRAGMENT_NODE: 11,
-    NOTATION_NODE: 12
-  });
-}
-
-(function() {
-  var element = this.Element;
-  this.Element = function(tagName, attributes) {
-    attributes = attributes || { };
-    tagName = tagName.toLowerCase();
-    var cache = Element.cache;
-    if (Prototype.Browser.IE &amp;&amp; attributes.name) {
-      tagName = '&lt;' + tagName + ' name=&quot;' + attributes.name + '&quot;&gt;';
-      delete attributes.name;
-      return Element.writeAttribute(document.createElement(tagName), attributes);
-    }
-    if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
-    return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
-  };
-  Object.extend(this.Element, element || { });
-}).call(window);
-
-Element.cache = { };
-
-Element.Methods = {
-  visible: function(element) {
-    return $(element).style.display != 'none';
-  },
-
-  toggle: function(element) {
-    element = $(element);
-    Element[Element.visible(element) ? 'hide' : 'show'](element);
-    return element;
-  },
-
-  hide: function(element) {
-    $(element).style.display = 'none';
-    return element;
-  },
-
-  show: function(element) {
-    $(element).style.display = '';
-    return element;
-  },
-
-  remove: function(element) {
-    element = $(element);
-    element.parentNode.removeChild(element);
-    return element;
-  },
-
-  update: function(element, content) {
-    element = $(element);
-    if (content &amp;&amp; content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-    content = Object.toHTML(content);
-    element.innerHTML = content.stripScripts();
-    content.evalScripts.bind(content).defer();
-    return element;
-  },
-
-  replace: function(element, content) {
-    element = $(element);
-    if (content &amp;&amp; content.toElement) content = content.toElement();
-    else if (!Object.isElement(content)) {
-      content = Object.toHTML(content);
-      var range = element.ownerDocument.createRange();
-      range.selectNode(element);
-      content.evalScripts.bind(content).defer();
-      content = range.createContextualFragment(content.stripScripts());
-    }
-    element.parentNode.replaceChild(content, element);
-    return element;
-  },
-
-  insert: function(element, insertions) {
-    element = $(element);
-
-    if (Object.isString(insertions) || Object.isNumber(insertions) ||
-        Object.isElement(insertions) || (insertions &amp;&amp; (insertions.toElement || insertions.toHTML)))
-          insertions = {bottom:insertions};
-
-    var content, t, range;
-
-    for (position in insertions) {
-      content  = insertions[position];
-      position = position.toLowerCase();
-      t = Element._insertionTranslations[position];
-
-      if (content &amp;&amp; content.toElement) content = content.toElement();
-      if (Object.isElement(content)) {
-        t.insert(element, content);
-        continue;
-      }
-
-      content = Object.toHTML(content);
-
-      range = element.ownerDocument.createRange();
-      t.initializeRange(element, range);
-      t.insert(element, range.createContextualFragment(content.stripScripts()));
-
-      content.evalScripts.bind(content).defer();
-    }
-
-    return element;
-  },
-
-  wrap: function(element, wrapper, attributes) {
-    element = $(element);
-    if (Object.isElement(wrapper))
-      $(wrapper).writeAttribute(attributes || { });
-    else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
-    else wrapper = new Element('div', wrapper);
-    if (element.parentNode)
-      element.parentNode.replaceChild(wrapper, element);
-    wrapper.appendChild(element);
-    return wrapper;
-  },
-
-  inspect: function(element) {
-    element = $(element);
-    var result = '&lt;' + element.tagName.toLowerCase();
-    $H({'id': 'id', 'className': 'class'}).each(function(pair) {
-      var property = pair.first(), attribute = pair.last();
-      var value = (element[property] || '').toString();
-      if (value) result += ' ' + attribute + '=' + value.inspect(true);
-    });
-    return result + '&gt;';
-  },
-
-  recursivelyCollect: function(element, property) {
-    element = $(element);
-    var elements = [];
-    while (element = element[property])
-      if (element.nodeType == 1)
-        elements.push(Element.extend(element));
-    return elements;
-  },
-
-  ancestors: function(element) {
-    return $(element).recursivelyCollect('parentNode');
-  },
-
-  descendants: function(element) {
-    return $A($(element).getElementsByTagName('*')).each(Element.extend);
-  },
-
-  firstDescendant: function(element) {
-    element = $(element).firstChild;
-    while (element &amp;&amp; element.nodeType != 1) element = element.nextSibling;
-    return $(element);
-  },
-
-  immediateDescendants: function(element) {
-    if (!(element = $(element).firstChild)) return [];
-    while (element &amp;&amp; element.nodeType != 1) element = element.nextSibling;
-    if (element) return [element].concat($(element).nextSiblings());
-    return [];
-  },
-
-  previousSiblings: function(element) {
-    return $(element).recursivelyCollect('previousSibling');
-  },
-
-  nextSiblings: function(element) {
-    return $(element).recursivelyCollect('nextSibling');
-  },
-
-  siblings: function(element) {
-    element = $(element);
-    return element.previousSiblings().reverse().concat(element.nextSiblings());
-  },
-
-  match: function(element, selector) {
-    if (Object.isString(selector))
-      selector = new Selector(selector);
-    return selector.match($(element));
-  },
-
-  up: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(element.parentNode);
-    var ancestors = element.ancestors();
-    return expression ? Selector.findElement(ancestors, expression, index) :
-      ancestors[index || 0];
-  },
-
-  down: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return element.firstDescendant();
-    var descendants = element.descendants();
-    return expression ? Selector.findElement(descendants, expression, index) :
-      descendants[index || 0];
-  },
-
-  previous: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
-    var previousSiblings = element.previousSiblings();
-    return expression ? Selector.findElement(previousSiblings, expression, index) :
-      previousSiblings[index || 0];
-  },
-
-  next: function(element, expression, index) {
-    element = $(element);
-    if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
-    var nextSiblings = element.nextSiblings();
-    return expression ? Selector.findElement(nextSiblings, expression, index) :
-      nextSiblings[index || 0];
-  },
-
-  select: function() {
-    var args = $A(arguments), element = $(args.shift());
-    return Selector.findChildElements(element, args);
-  },
-
-  adjacent: function() {
-    var args = $A(arguments), element = $(args.shift());
-    return Selector.findChildElements(element.parentNode, args).without(element);
-  },
-
-  identify: function(element) {
-    element = $(element);
-    var id = element.readAttribute('id'), self = arguments.callee;
-    if (id) return id;
-    do { id = 'anonymous_element_' + self.counter++ } while ($(id));
-    element.writeAttribute('id', id);
-    return id;
-  },
-
-  readAttribute: function(element, name) {
-    element = $(element);
-    if (Prototype.Browser.IE) {
-      var t = Element._attributeTranslations.read;
-      if (t.values[name]) return t.values[name](element, name);
-      if (t.names[name]) name = t.names[name];
-      if (name.include(':')) {
-        return (!element.attributes || !element.attributes[name]) ? null :
-         element.attributes[name].value;
-      }
-    }
-    return element.getAttribute(name);
-  },
-
-  writeAttribute: function(element, name, value) {
-    element = $(element);
-    var attributes = { }, t = Element._attributeTranslations.write;
-
-    if (typeof name == 'object') attributes = name;
-    else attributes[name] = value === undefined ? true : value;
-
-    for (var attr in attributes) {
-      var name = t.names[attr] || attr, value = attributes[attr];
-      if (t.values[attr]) name = t.values[attr](element, value);
-      if (value === false || value === null)
-        element.removeAttribute(name);
-      else if (value === true)
-        element.setAttribute(name, name);
-      else element.setAttribute(name, value);
-    }
-    return element;
-  },
-
-  getHeight: function(element) {
-    return $(element).getDimensions().height;
-  },
-
-  getWidth: function(element) {
-    return $(element).getDimensions().width;
-  },
-
-  classNames: function(element) {
-    return new Element.ClassNames(element);
-  },
-
-  hasClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    var elementClassName = element.className;
-    return (elementClassName.length &gt; 0 &amp;&amp; (elementClassName == className ||
-      new RegExp(&quot;(^|\\s)&quot; + className + &quot;(\\s|$)&quot;).test(elementClassName)));
-  },
-
-  addClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    if (!element.hasClassName(className))
-      element.className += (element.className ? ' ' : '') + className;
-    return element;
-  },
-
-  removeClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    element.className = element.className.replace(
-      new RegExp(&quot;(^|\\s+)&quot; + className + &quot;(\\s+|$)&quot;), ' ').strip();
-    return element;
-  },
-
-  toggleClassName: function(element, className) {
-    if (!(element = $(element))) return;
-    return element[element.hasClassName(className) ?
-      'removeClassName' : 'addClassName'](className);
-  },
-
-  // removes whitespace-only text node children
-  cleanWhitespace: function(element) {
-    element = $(element);
-    var node = element.firstChild;
-    while (node) {
-      var nextNode = node.nextSibling;
-      if (node.nodeType == 3 &amp;&amp; !/\S/.test(node.nodeValue))
-        element.removeChild(node);
-      node = nextNode;
-    }
-    return element;
-  },
-
-  empty: function(element) {
-    return $(element).innerHTML.blank();
-  },
-
-  descendantOf: function(element, ancestor) {
-    element = $(element), ancestor = $(ancestor);
-
-    if (element.compareDocumentPosition)
-      return (element.compareDocumentPosition(ancestor) &amp; 8) === 8;
-
-    if (element.sourceIndex &amp;&amp; !Prototype.Browser.Opera) {
-      var e = element.sourceIndex, a = ancestor.sourceIndex,
-       nextAncestor = ancestor.nextSibling;
-      if (!nextAncestor) {
-        do { ancestor = ancestor.parentNode; }
-        while (!(nextAncestor = ancestor.nextSibling) &amp;&amp; ancestor.parentNode);
-      }
-      if (nextAncestor) return (e &gt; a &amp;&amp; e &lt; nextAncestor.sourceIndex);
-    }
-
-    while (element = element.parentNode)
-      if (element == ancestor) return true;
-    return false;
-  },
-
-  scrollTo: function(element) {
-    element = $(element);
-    var pos = element.cumulativeOffset();
-    window.scrollTo(pos[0], pos[1]);
-    return element;
-  },
-
-  getStyle: function(element, style) {
-    element = $(element);
-    style = style == 'float' ? 'cssFloat' : style.camelize();
-    var value = element.style[style];
-    if (!value) {
-      var css = document.defaultView.getComputedStyle(element, null);
-      value = css ? css[style] : null;
-    }
-    if (style == 'opacity') return value ? parseFloat(value) : 1.0;
-    return value == 'auto' ? null : value;
-  },
-
-  getOpacity: function(element) {
-    return $(element).getStyle('opacity');
-  },
-
-  setStyle: function(element, styles) {
-    element = $(element);
-    var elementStyle = element.style, match;
-    if (Object.isString(styles)) {
-      element.style.cssText += ';' + styles;
-      return styles.include('opacity') ?
-        element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
-    }
-    for (var property in styles)
-      if (property == 'opacity') element.setOpacity(styles[property]);
-      else
-        elementStyle[(property == 'float' || property == 'cssFloat') ?
-          (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') :
-            property] = styles[property];
-
-    return element;
-  },
-
-  setOpacity: function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1 || value === '') ? '' :
-      (value &lt; 0.00001) ? 0 : value;
-    return element;
-  },
-
-  getDimensions: function(element) {
-    element = $(element);
-    var display = $(element).getStyle('display');
-    if (display != 'none' &amp;&amp; display != null) // Safari bug
-      return {width: element.offsetWidth, height: element.offsetHeight};
-
-    // All *Width and *Height properties give 0 on elements with display none,
-    // so enable the element temporarily
-    var els = element.style;
-    var originalVisibility = els.visibility;
-    var originalPosition = els.position;
-    var originalDisplay = els.display;
-    els.visibility = 'hidden';
-    els.position = 'absolute';
-    els.display = 'block';
-    var originalWidth = element.clientWidth;
-    var originalHeight = element.clientHeight;
-    els.display = originalDisplay;
-    els.position = originalPosition;
-    els.visibility = originalVisibility;
-    return {width: originalWidth, height: originalHeight};
-  },
-
-  makePositioned: function(element) {
-    element = $(element);
-    var pos = Element.getStyle(element, 'position');
-    if (pos == 'static' || !pos) {
-      element._madePositioned = true;
-      element.style.position = 'relative';
-      // Opera returns the offset relative to the positioning context, when an
-      // element is position relative but top and left have not been defined
-      if (window.opera) {
-        element.style.top = 0;
-        element.style.left = 0;
-      }
-    }
-    return element;
-  },
-
-  undoPositioned: function(element) {
-    element = $(element);
-    if (element._madePositioned) {
-      element._madePositioned = undefined;
-      element.style.position =
-        element.style.top =
-        element.style.left =
-        element.style.bottom =
-        element.style.right = '';
-    }
-    return element;
-  },
-
-  makeClipping: function(element) {
-    element = $(element);
-    if (element._overflow) return element;
-    element._overflow = Element.getStyle(element, 'overflow') || 'auto';
-    if (element._overflow !== 'hidden')
-      element.style.overflow = 'hidden';
-    return element;
-  },
-
-  undoClipping: function(element) {
-    element = $(element);
-    if (!element._overflow) return element;
-    element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
-    element._overflow = null;
-    return element;
-  },
-
-  cumulativeOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-    } while (element);
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  positionedOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      element = element.offsetParent;
-      if (element) {
-        if (element.tagName == 'BODY') break;
-        var p = Element.getStyle(element, 'position');
-        if (p == 'relative' || p == 'absolute') break;
-      }
-    } while (element);
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  absolutize: function(element) {
-    element = $(element);
-    if (element.getStyle('position') == 'absolute') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
-
-    var offsets = element.positionedOffset();
-    var top     = offsets[1];
-    var left    = offsets[0];
-    var width   = element.clientWidth;
-    var height  = element.clientHeight;
-
-    element._originalLeft   = left - parseFloat(element.style.left  || 0);
-    element._originalTop    = top  - parseFloat(element.style.top || 0);
-    element._originalWidth  = element.style.width;
-    element._originalHeight = element.style.height;
-
-    element.style.position = 'absolute';
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.width  = width + 'px';
-    element.style.height = height + 'px';
-    return element;
-  },
-
-  relativize: function(element) {
-    element = $(element);
-    if (element.getStyle('position') == 'relative') return;
-    // Position.prepare(); // To be done manually by Scripty when it needs it.
-
-    element.style.position = 'relative';
-    var top  = parseFloat(element.style.top  || 0) - (element._originalTop || 0);
-    var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
-    element.style.top    = top + 'px';
-    element.style.left   = left + 'px';
-    element.style.height = element._originalHeight;
-    element.style.width  = element._originalWidth;
-    return element;
-  },
-
-  cumulativeScrollOffset: function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.scrollTop  || 0;
-      valueL += element.scrollLeft || 0;
-      element = element.parentNode;
-    } while (element);
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  getOffsetParent: function(element) {
-    if (element.offsetParent) return $(element.offsetParent);
-    if (element == document.body) return $(element);
-
-    while ((element = element.parentNode) &amp;&amp; element != document.body)
-      if (Element.getStyle(element, 'position') != 'static')
-        return $(element);
-
-    return $(document.body);
-  },
-
-  viewportOffset: function(forElement) {
-    var valueT = 0, valueL = 0;
-
-    var element = forElement;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-
-      // Safari fix
-      if (element.offsetParent == document.body &amp;&amp;
-        Element.getStyle(element, 'position') == 'absolute') break;
-
-    } while (element = element.offsetParent);
-
-    element = forElement;
-    do {
-      if (!Prototype.Browser.Opera || element.tagName == 'BODY') {
-        valueT -= element.scrollTop  || 0;
-        valueL -= element.scrollLeft || 0;
-      }
-    } while (element = element.parentNode);
-
-    return Element._returnOffset(valueL, valueT);
-  },
-
-  clonePosition: function(element, source) {
-    var options = Object.extend({
-      setLeft:    true,
-      setTop:     true,
-      setWidth:   true,
-      setHeight:  true,
-      offsetTop:  0,
-      offsetLeft: 0
-    }, arguments[2] || { });
-
-    // find page position of source
-    source = $(source);
-    var p = source.viewportOffset();
-
-    // find coordinate system to use
-    element = $(element);
-    var delta = [0, 0];
-    var parent = null;
-    // delta [0,0] will do fine with position: fixed elements,
-    // position:absolute needs offsetParent deltas
-    if (Element.getStyle(element, 'position') == 'absolute') {
-      parent = element.getOffsetParent();
-      delta = parent.viewportOffset();
-    }
-
-    // correct by body offsets (fixes Safari)
-    if (parent == document.body) {
-      delta[0] -= document.body.offsetLeft;
-      delta[1] -= document.body.offsetTop;
-    }
-
-    // set position
-    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
-    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
-    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
-    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
-    return element;
-  }
-};
-
-Element.Methods.identify.counter = 1;
-
-Object.extend(Element.Methods, {
-  getElementsBySelector: Element.Methods.select,
-  childElements: Element.Methods.immediateDescendants
-});
-
-Element._attributeTranslations = {
-  write: {
-    names: {
-      className: 'class',
-      htmlFor:   'for'
-    },
-    values: { }
-  }
-};
-
-
-if (!document.createRange || Prototype.Browser.Opera) {
-  Element.Methods.insert = function(element, insertions) {
-    element = $(element);
-
-    if (Object.isString(insertions) || Object.isNumber(insertions) ||
-        Object.isElement(insertions) || (insertions &amp;&amp; (insertions.toElement || insertions.toHTML)))
-          insertions = { bottom: insertions };
-
-    var t = Element._insertionTranslations, content, position, pos, tagName;
-
-    for (position in insertions) {
-      content  = insertions[position];
-      position = position.toLowerCase();
-      pos      = t[position];
-
-      if (content &amp;&amp; content.toElement) content = content.toElement();
-      if (Object.isElement(content)) {
-        pos.insert(element, content);
-        continue;
-      }
-
-      content = Object.toHTML(content);
-      tagName = ((position == 'before' || position == 'after')
-        ? element.parentNode : element).tagName.toUpperCase();
-
-      if (t.tags[tagName]) {
-        var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-        if (position == 'top' || position == 'after') fragments.reverse();
-        fragments.each(pos.insert.curry(element));
-      }
-      else element.insertAdjacentHTML(pos.adjacency, content.stripScripts());
-
-      content.evalScripts.bind(content).defer();
-    }
-
-    return element;
-  };
-}
-
-if (Prototype.Browser.Opera) {
-  Element.Methods._getStyle = Element.Methods.getStyle;
-  Element.Methods.getStyle = function(element, style) {
-    switch(style) {
-      case 'left':
-      case 'top':
-      case 'right':
-      case 'bottom':
-        if (Element._getStyle(element, 'position') == 'static') return null;
-      default: return Element._getStyle(element, style);
-    }
-  };
-  Element.Methods._readAttribute = Element.Methods.readAttribute;
-  Element.Methods.readAttribute = function(element, attribute) {
-    if (attribute == 'title') return element.title;
-    return Element._readAttribute(element, attribute);
-  };
-}
-
-else if (Prototype.Browser.IE) {
-  $w('positionedOffset getOffsetParent viewportOffset').each(function(method) {
-    Element.Methods[method] = Element.Methods[method].wrap(
-      function(proceed, element) {
-        element = $(element);
-        var position = element.getStyle('position');
-        if (position != 'static') return proceed(element);
-        element.setStyle({ position: 'relative' });
-        var value = proceed(element);
-        element.setStyle({ position: position });
-        return value;
-      }
-    );
-  });
-
-  Element.Methods.getStyle = function(element, style) {
-    element = $(element);
-    style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
-    var value = element.style[style];
-    if (!value &amp;&amp; element.currentStyle) value = element.currentStyle[style];
-
-    if (style == 'opacity') {
-      if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
-        if (value[1]) return parseFloat(value[1]) / 100;
-      return 1.0;
-    }
-
-    if (value == 'auto') {
-      if ((style == 'width' || style == 'height') &amp;&amp; (element.getStyle('display') != 'none'))
-        return element['offset' + style.capitalize()] + 'px';
-      return null;
-    }
-    return value;
-  };
-
-  Element.Methods.setOpacity = function(element, value) {
-    function stripAlpha(filter){
-      return filter.replace(/alpha\([^\)]*\)/gi,'');
-    }
-    element = $(element);
-    var currentStyle = element.currentStyle;
-    if ((currentStyle &amp;&amp; !currentStyle.hasLayout) ||
-      (!currentStyle &amp;&amp; element.style.zoom == 'normal'))
-        element.style.zoom = 1;
-
-    var filter = element.getStyle('filter'), style = element.style;
-    if (value == 1 || value === '') {
-      (filter = stripAlpha(filter)) ?
-        style.filter = filter : style.removeAttribute('filter');
-      return element;
-    } else if (value &lt; 0.00001) value = 0;
-    style.filter = stripAlpha(filter) +
-      'alpha(opacity=' + (value * 100) + ')';
-    return element;
-  };
-
-  Element._attributeTranslations = {
-    read: {
-      names: {
-        'class': 'className',
-        'for':   'htmlFor'
-      },
-      values: {
-        _getAttr: function(element, attribute) {
-          return element.getAttribute(attribute, 2);
-        },
-        _getAttrNode: function(element, attribute) {
-          var node = element.getAttributeNode(attribute);
-          return node ? node.value : &quot;&quot;;
-        },
-        _getEv: function(element, attribute) {
-          var attribute = element.getAttribute(attribute);
-          return attribute ? attribute.toString().slice(23, -2) : null;
-        },
-        _flag: function(element, attribute) {
-          return $(element).hasAttribute(attribute) ? attribute : null;
-        },
-        style: function(element) {
-          return element.style.cssText.toLowerCase();
-        },
-        title: function(element) {
-          return element.title;
-        }
-      }
-    }
-  };
-
-  Element._attributeTranslations.write = {
-    names: Object.clone(Element._attributeTranslations.read.names),
-    values: {
-      checked: function(element, value) {
-        element.checked = !!value;
-      },
-
-      style: function(element, value) {
-        element.style.cssText = value ? value : '';
-      }
-    }
-  };
-
-  Element._attributeTranslations.has = {};
-
-  $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
-      'encType maxLength readOnly longDesc').each(function(attr) {
-    Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
-    Element._attributeTranslations.has[attr.toLowerCase()] = attr;
-  });
-
-  (function(v) {
-    Object.extend(v, {
-      href:        v._getAttr,
-      src:         v._getAttr,
-      type:        v._getAttr,
-      action:      v._getAttrNode,
-      disabled:    v._flag,
-      checked:     v._flag,
-      readonly:    v._flag,
-      multiple:    v._flag,
-      onload:      v._getEv,
-      onunload:    v._getEv,
-      onclick:     v._getEv,
-      ondblclick:  v._getEv,
-      onmousedown: v._getEv,
-      onmouseup:   v._getEv,
-      onmouseover: v._getEv,
-      onmousemove: v._getEv,
-      onmouseout:  v._getEv,
-      onfocus:     v._getEv,
-      onblur:      v._getEv,
-      onkeypress:  v._getEv,
-      onkeydown:   v._getEv,
-      onkeyup:     v._getEv,
-      onsubmit:    v._getEv,
-      onreset:     v._getEv,
-      onselect:    v._getEv,
-      onchange:    v._getEv
-    });
-  })(Element._attributeTranslations.read.values);
-}
-
-else if (Prototype.Browser.Gecko &amp;&amp; /rv:1\.8\.0/.test(navigator.userAgent)) {
-  Element.Methods.setOpacity = function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1) ? 0.999999 :
-      (value === '') ? '' : (value &lt; 0.00001) ? 0 : value;
-    return element;
-  };
-}
-
-else if (Prototype.Browser.WebKit) {
-  Element.Methods.setOpacity = function(element, value) {
-    element = $(element);
-    element.style.opacity = (value == 1 || value === '') ? '' :
-      (value &lt; 0.00001) ? 0 : value;
-
-    if (value == 1)
-      if(element.tagName == 'IMG' &amp;&amp; element.width) {
-        element.width++; element.width--;
-      } else try {
-        var n = document.createTextNode(' ');
-        element.appendChild(n);
-        element.removeChild(n);
-      } catch (e) { }
-
-    return element;
-  };
-
-  // Safari returns margins on body which is incorrect if the child is absolutely
-  // positioned.  For performance reasons, redefine Position.cumulativeOffset for
-  // KHTML/WebKit only.
-  Element.Methods.cumulativeOffset = function(element) {
-    var valueT = 0, valueL = 0;
-    do {
-      valueT += element.offsetTop  || 0;
-      valueL += element.offsetLeft || 0;
-      if (element.offsetParent == document.body)
-        if (Element.getStyle(element, 'position') == 'absolute') break;
-
-      element = element.offsetParent;
-    } while (element);
-
-    return Element._returnOffset(valueL, valueT);
-  };
-}
-
-if (Prototype.Browser.IE || Prototype.Browser.Opera) {
-  // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
-  Element.Methods.update = function(element, content) {
-    element = $(element);
-
-    if (content &amp;&amp; content.toElement) content = content.toElement();
-    if (Object.isElement(content)) return element.update().insert(content);
-
-    content = Object.toHTML(content);
-    var tagName = element.tagName.toUpperCase();
-
-    if (tagName in Element._insertionTranslations.tags) {
-      $A(element.childNodes).each(function(node) { element.removeChild(node) });
-      Element._getContentFromAnonymousElement(tagName, content.stripScripts())
-        .each(function(node) { element.appendChild(node) });
-    }
-    else element.innerHTML = content.stripScripts();
-
-    content.evalScripts.bind(content).defer();
-    return element;
-  };
-}
-
-if (document.createElement('div').outerHTML) {
-  Element.Methods.replace = function(element, content) {
-    element = $(element);
-
-    if (content &amp;&amp; content.toElement) content = content.toElement();
-    if (Object.isElement(content)) {
-      element.parentNode.replaceChild(content, element);
-      return element;
-    }
-
-    content = Object.toHTML(content);
-    var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
-
-    if (Element._insertionTranslations.tags[tagName]) {
-      var nextSibling = element.next();
-      var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-      parent.removeChild(element);
-      if (nextSibling)
-        fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
-      else
-        fragments.each(function(node) { parent.appendChild(node) });
-    }
-    else element.outerHTML = content.stripScripts();
-
-    content.evalScripts.bind(content).defer();
-    return element;
-  };
-}
-
-Element._returnOffset = function(l, t) {
-  var result = [l, t];
-  result.left = l;
-  result.top = t;
-  return result;
-};
-
-Element._getContentFromAnonymousElement = function(tagName, html) {
-  var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
-  div.innerHTML = t[0] + html + t[1];
-  t[2].times(function() { div = div.firstChild });
-  return $A(div.childNodes);
-};
-
-Element._insertionTranslations = {
-  before: {
-    adjacency: 'beforeBegin',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element);
-    },
-    initializeRange: function(element, range) {
-      range.setStartBefore(element);
-    }
-  },
-  top: {
-    adjacency: 'afterBegin',
-    insert: function(element, node) {
-      element.insertBefore(node, element.firstChild);
-    },
-    initializeRange: function(element, range) {
-      range.selectNodeContents(element);
-      range.collapse(true);
-    }
-  },
-  bottom: {
-    adjacency: 'beforeEnd',
-    insert: function(element, node) {
-      element.appendChild(node);
-    }
-  },
-  after: {
-    adjacency: 'afterEnd',
-    insert: function(element, node) {
-      element.parentNode.insertBefore(node, element.nextSibling);
-    },
-    initializeRange: function(element, range) {
-      range.setStartAfter(element);
-    }
-  },
-  tags: {
-    TABLE:  ['&lt;table&gt;',                '&lt;/table&gt;',                   1],
-    TBODY:  ['&lt;table&gt;&lt;tbody&gt;',         '&lt;/tbody&gt;&lt;/table&gt;',           2],
-    TR:     ['&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;',     '&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;',      3],
-    TD:     ['&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;', '&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;', 4],
-    SELECT: ['&lt;select&gt;',               '&lt;/select&gt;',                  1]
-  }
-};
-
-(function() {
-  this.bottom.initializeRange = this.top.initializeRange;
-  Object.extend(this.tags, {
-    THEAD: this.tags.TBODY,
-    TFOOT: this.tags.TBODY,
-    TH:    this.tags.TD
-  });
-}).call(Element._insertionTranslations);
-
-Element.Methods.Simulated = {
-  hasAttribute: function(element, attribute) {
-    attribute = Element._attributeTranslations.has[attribute] || attribute;
-    var node = $(element).getAttributeNode(attribute);
-    return node &amp;&amp; node.specified;
-  }
-};
-
-Element.Methods.ByTag = { };
-
-Object.extend(Element, Element.Methods);
-
-if (!Prototype.BrowserFeatures.ElementExtensions &amp;&amp;
-    document.createElement('div').__proto__) {
-  window.HTMLElement = { };
-  window.HTMLElement.prototype = document.createElement('div').__proto__;
-  Prototype.BrowserFeatures.ElementExtensions = true;
-}
-
-Element.extend = (function() {
-  if (Prototype.BrowserFeatures.SpecificElementExtensions)
-    return Prototype.K;
-
-  var Methods = { }, ByTag = Element.Methods.ByTag;
-
-  var extend = Object.extend(function(element) {
-    if (!element || element._extendedByPrototype ||
-        element.nodeType != 1 || element == window) return element;
-
-    var methods = Object.clone(Methods),
-      tagName = element.tagName, property, value;
-
-    // extend methods for specific tags
-    if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
-
-    for (property in methods) {
-      value = methods[property];
-      if (Object.isFunction(value) &amp;&amp; !(property in element))
-        element[property] = value.methodize();
-    }
-
-    element._extendedByPrototype = Prototype.emptyFunction;
-    return element;
-
-  }, {
-    refresh: function() {
-      // extend methods for all tags (Safari doesn't need this)
-      if (!Prototype.BrowserFeatures.ElementExtensions) {
-        Object.extend(Methods, Element.Methods);
-        Object.extend(Methods, Element.Methods.Simulated);
-      }
-    }
-  });
-
-  extend.refresh();
-  return extend;
-})();
-
-Element.hasAttribute = function(element, attribute) {
-  if (element.hasAttribute) return element.hasAttribute(attribute);
-  return Element.Methods.Simulated.hasAttribute(element, attribute);
-};
-
-Element.addMethods = function(methods) {
-  var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
-
-  if (!methods) {
-    Object.extend(Form, Form.Methods);
-    Object.extend(Form.Element, Form.Element.Methods);
-    Object.extend(Element.Methods.ByTag, {
-      &quot;FORM&quot;:     Object.clone(Form.Methods),
-      &quot;INPUT&quot;:    Object.clone(Form.Element.Methods),
-      &quot;SELECT&quot;:   Object.clone(Form.Element.Methods),
-      &quot;TEXTAREA&quot;: Object.clone(Form.Element.Methods)
-    });
-  }
-
-  if (arguments.length == 2) {
-    var tagName = methods;
-    methods = arguments[1];
-  }
-
-  if (!tagName) Object.extend(Element.Methods, methods || { });
-  else {
-    if (Object.isArray(tagName)) tagName.each(extend);
-    else extend(tagName);
-  }
-
-  function extend(tagName) {
-    tagName = tagName.toUpperCase();
-    if (!Element.Methods.ByTag[tagName])
-      Element.Methods.ByTag[tagName] = { };
-    Object.extend(Element.Methods.ByTag[tagName], methods);
-  }
-
-  function copy(methods, destination, onlyIfAbsent) {
-    onlyIfAbsent = onlyIfAbsent || false;
-    for (var property in methods) {
-      var value = methods[property];
-      if (!Object.isFunction(value)) continue;
-      if (!onlyIfAbsent || !(property in destination))
-        destination[property] = value.methodize();
-    }
-  }
-
-  function findDOMClass(tagName) {
-    var klass;
-    var trans = {
-      &quot;OPTGROUP&quot;: &quot;OptGroup&quot;, &quot;TEXTAREA&quot;: &quot;TextArea&quot;, &quot;P&quot;: &quot;Paragraph&quot;,
-      &quot;FIELDSET&quot;: &quot;FieldSet&quot;, &quot;UL&quot;: &quot;UList&quot;, &quot;OL&quot;: &quot;OList&quot;, &quot;DL&quot;: &quot;DList&quot;,
-      &quot;DIR&quot;: &quot;Directory&quot;, &quot;H1&quot;: &quot;Heading&quot;, &quot;H2&quot;: &quot;Heading&quot;, &quot;H3&quot;: &quot;Heading&quot;,
-      &quot;H4&quot;: &quot;Heading&quot;, &quot;H5&quot;: &quot;Heading&quot;, &quot;H6&quot;: &quot;Heading&quot;, &quot;Q&quot;: &quot;Quote&quot;,
-      &quot;INS&quot;: &quot;Mod&quot;, &quot;DEL&quot;: &quot;Mod&quot;, &quot;A&quot;: &quot;Anchor&quot;, &quot;IMG&quot;: &quot;Image&quot;, &quot;CAPTION&quot;:
-      &quot;TableCaption&quot;, &quot;COL&quot;: &quot;TableCol&quot;, &quot;COLGROUP&quot;: &quot;TableCol&quot;, &quot;THEAD&quot;:
-      &quot;TableSection&quot;, &quot;TFOOT&quot;: &quot;TableSection&quot;, &quot;TBODY&quot;: &quot;TableSection&quot;, &quot;TR&quot;:
-      &quot;TableRow&quot;, &quot;TH&quot;: &quot;TableCell&quot;, &quot;TD&quot;: &quot;TableCell&quot;, &quot;FRAMESET&quot;:
-      &quot;FrameSet&quot;, &quot;IFRAME&quot;: &quot;IFrame&quot;
-    };
-    if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
-    if (window[klass]) return window[klass];
-    klass = 'HTML' + tagName + 'Element';
-    if (window[klass]) return window[klass];
-    klass = 'HTML' + tagName.capitalize() + 'Element';
-    if (window[klass]) return window[klass];
-
-    window[klass] = { };
-    window[klass].prototype = document.createElement(tagName).__proto__;
-    return window[klass];
-  }
-
-  if (F.ElementExtensions) {
-    copy(Element.Methods, HTMLElement.prototype);
-    copy(Element.Methods.Simulated, HTMLElement.prototype, true);
-  }
-
-  if (F.SpecificElementExtensions) {
-    for (var tag in Element.Methods.ByTag) {
-      var klass = findDOMClass(tag);
-      if (Object.isUndefined(klass)) continue;
-      copy(T[tag], klass.prototype);
-    }
-  }
-
-  Object.extend(Element, Element.Methods);
-  delete Element.ByTag;
-
-  if (Element.extend.refresh) Element.extend.refresh();
-  Element.cache = { };
-};
-
-document.viewport = {
-  getDimensions: function() {
-    var dimensions = { };
-    $w('width height').each(function(d) {
-      var D = d.capitalize();
-      dimensions[d] = self['inner' + D] ||
-       (document.documentElement['client' + D] || document.body['client' + D]);
-    });
-    return dimensions;
-  },
-
-  getWidth: function() {
-    return this.getDimensions().width;
-  },
-
-  getHeight: function() {
-    return this.getDimensions().height;
-  },
-
-  getScrollOffsets: function() {
-    return Element._returnOffset(
-      window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
-      window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
-  }
-};
-/* Portions of the Selector class are derived from Jack Slocum’s DomQuery,
- * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
- * license.  Please see http://www.yui-ext.com/ for more information. */
-
-var Selector = Class.create({
-  initialize: function(expression) {
-    this.expression = expression.strip();
-    this.compileMatcher();
-  },
-
-  compileMatcher: function() {
-    // Selectors with namespaced attributes can't use the XPath version
-    if (Prototype.BrowserFeatures.XPath &amp;&amp; !(/(\[[\w-]*?:|:checked)/).test(this.expression))
-      return this.compileXPathMatcher();
-
-    var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
-        c = Selector.criteria, le, p, m;
-
-    if (Selector._cache[e]) {
-      this.matcher = Selector._cache[e];
-      return;
-    }
-
-    this.matcher = [&quot;this.matcher = function(root) {&quot;,
-                    &quot;var r = root, h = Selector.handlers, c = false, n;&quot;];
-
-    while (e &amp;&amp; le != e &amp;&amp; (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        p = ps[i];
-        if (m = e.match(p)) {
-          this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
-                  new Template(c[i]).evaluate(m));
-          e = e.replace(m[0], '');
-          break;
-        }
-      }
-    }
-
-    this.matcher.push(&quot;return h.unique(n);\n}&quot;);
-    eval(this.matcher.join('\n'));
-    Selector._cache[this.expression] = this.matcher;
-  },
-
-  compileXPathMatcher: function() {
-    var e = this.expression, ps = Selector.patterns,
-        x = Selector.xpath, le, m;
-
-    if (Selector._cache[e]) {
-      this.xpath = Selector._cache[e]; return;
-    }
-
-    this.matcher = ['.//*'];
-    while (e &amp;&amp; le != e &amp;&amp; (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        if (m = e.match(ps[i])) {
-          this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
-            new Template(x[i]).evaluate(m));
-          e = e.replace(m[0], '');
-          break;
-        }
-      }
-    }
-
-    this.xpath = this.matcher.join('');
-    Selector._cache[this.expression] = this.xpath;
-  },
-
-  findElements: function(root) {
-    root = root || document;
-    if (this.xpath) return document._getElementsByXPath(this.xpath, root);
-    return this.matcher(root);
-  },
-
-  match: function(element) {
-    this.tokens = [];
-
-    var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
-    var le, p, m;
-
-    while (e &amp;&amp; le !== e &amp;&amp; (/\S/).test(e)) {
-      le = e;
-      for (var i in ps) {
-        p = ps[i];
-        if (m = e.match(p)) {
-          // use the Selector.assertions methods unless the selector
-          // is too complex.
-          if (as[i]) {
-            this.tokens.push([i, Object.clone(m)]);
-            e = e.replace(m[0], '');
-          } else {
-            // reluctantly do a document-wide search
-            // and look for a match in the array
-            return this.findElements(document).include(element);
-          }
-        }
-      }
-    }
-
-    var match = true, name, matches;
-    for (var i = 0, token; token = this.tokens[i]; i++) {
-      name = token[0], matches = token[1];
-      if (!Selector.assertions[name](element, matches)) {
-        match = false; break;
-      }
-    }
-
-    return match;
-  },
-
-  toString: function() {
-    return this.expression;
-  },
-
-  inspect: function() {
-    return &quot;#&lt;Selector:&quot; + this.expression.inspect() + &quot;&gt;&quot;;
-  }
-});
-
-Object.extend(Selector, {
-  _cache: { },
-
-  xpath: {
-    descendant:   &quot;//*&quot;,
-    child:        &quot;/*&quot;,
-    adjacent:     &quot;/following-sibling::*[1]&quot;,
-    laterSibling: '/following-sibling::*',
-    tagName:      function(m) {
-      if (m[1] == '*') return '';
-      return &quot;[local-name()='&quot; + m[1].toLowerCase() +
-             &quot;' or local-name()='&quot; + m[1].toUpperCase() + &quot;']&quot;;
-    },
-    className:    &quot;[contains(concat(' ', @class, ' '), ' #{1} ')]&quot;,
-    id:           &quot;[@id='#{1}']&quot;,
-    attrPresence: &quot;[@#{1}]&quot;,
-    attr: function(m) {
-      m[3] = m[5] || m[6];
-      return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
-    },
-    pseudo: function(m) {
-      var h = Selector.xpath.pseudos[m[1]];
-      if (!h) return '';
-      if (Object.isFunction(h)) return h(m);
-      return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
-    },
-    operators: {
-      '=':  &quot;[@#{1}='#{3}']&quot;,
-      '!=': &quot;[@#{1}!='#{3}']&quot;,
-      '^=': &quot;[starts-with(@#{1}, '#{3}')]&quot;,
-      '$=': &quot;[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']&quot;,
-      '*=': &quot;[contains(@#{1}, '#{3}')]&quot;,
-      '~=': &quot;[contains(concat(' ', @#{1}, ' '), ' #{3} ')]&quot;,
-      '|=': &quot;[contains(concat('-', @#{1}, '-'), '-#{3}-')]&quot;
-    },
-    pseudos: {
-      'first-child': '[not(preceding-sibling::*)]',
-      'last-child':  '[not(following-sibling::*)]',
-      'only-child':  '[not(preceding-sibling::* or following-sibling::*)]',
-      'empty':       &quot;[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]&quot;,
-      'checked':     &quot;[@checked]&quot;,
-      'disabled':    &quot;[@disabled]&quot;,
-      'enabled':     &quot;[not(@disabled)]&quot;,
-      'not': function(m) {
-        var e = m[6], p = Selector.patterns,
-            x = Selector.xpath, le, m, v;
-
-        var exclusion = [];
-        while (e &amp;&amp; le != e &amp;&amp; (/\S/).test(e)) {
-          le = e;
-          for (var i in p) {
-            if (m = e.match(p[i])) {
-              v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
-              exclusion.push(&quot;(&quot; + v.substring(1, v.length - 1) + &quot;)&quot;);
-              e = e.replace(m[0], '');
-              break;
-            }
-          }
-        }
-        return &quot;[not(&quot; + exclusion.join(&quot; and &quot;) + &quot;)]&quot;;
-      },
-      'nth-child':      function(m) {
-        return Selector.xpath.pseudos.nth(&quot;(count(./preceding-sibling::*) + 1) &quot;, m);
-      },
-      'nth-last-child': function(m) {
-        return Selector.xpath.pseudos.nth(&quot;(count(./following-sibling::*) + 1) &quot;, m);
-      },
-      'nth-of-type':    function(m) {
-        return Selector.xpath.pseudos.nth(&quot;position() &quot;, m);
-      },
-      'nth-last-of-type': function(m) {
-        return Selector.xpath.pseudos.nth(&quot;(last() + 1 - position()) &quot;, m);
-      },
-      'first-of-type':  function(m) {
-        m[6] = &quot;1&quot;; return Selector.xpath.pseudos['nth-of-type'](m);
-      },
-      'last-of-type':   function(m) {
-        m[6] = &quot;1&quot;; return Selector.xpath.pseudos['nth-last-of-type'](m);
-      },
-      'only-of-type':   function(m) {
-        var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
-      },
-      nth: function(fragment, m) {
-        var mm, formula = m[6], predicate;
-        if (formula == 'even') formula = '2n+0';
-        if (formula == 'odd')  formula = '2n+1';
-        if (mm = formula.match(/^(\d+)$/)) // digit only
-          return '[' + fragment + &quot;= &quot; + mm[1] + ']';
-        if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
-          if (mm[1] == &quot;-&quot;) mm[1] = -1;
-          var a = mm[1] ? Number(mm[1]) : 1;
-          var b = mm[2] ? Number(mm[2]) : 0;
-          predicate = &quot;[((#{fragment} - #{b}) mod #{a} = 0) and &quot; +
-          &quot;((#{fragment} - #{b}) div #{a} &gt;= 0)]&quot;;
-          return new Template(predicate).evaluate({
-            fragment: fragment, a: a, b: b });
-        }
-      }
-    }
-  },
-
-  criteria: {
-    tagName:      'n = h.tagName(n, r, &quot;#{1}&quot;, c);   c = false;',
-    className:    'n = h.className(n, r, &quot;#{1}&quot;, c); c = false;',
-    id:           'n = h.id(n, r, &quot;#{1}&quot;, c);        c = false;',
-    attrPresence: 'n = h.attrPresence(n, r, &quot;#{1}&quot;); c = false;',
-    attr: function(m) {
-      m[3] = (m[5] || m[6]);
-      return new Template('n = h.attr(n, r, &quot;#{1}&quot;, &quot;#{3}&quot;, &quot;#{2}&quot;); c = false;').evaluate(m);
-    },
-    pseudo: function(m) {
-      if (m[6]) m[6] = m[6].replace(/&quot;/g, '\\&quot;');
-      return new Template('n = h.pseudo(n, &quot;#{1}&quot;, &quot;#{6}&quot;, r, c); c = false;').evaluate(m);
-    },
-    descendant:   'c = &quot;descendant&quot;;',
-    child:        'c = &quot;child&quot;;',
-    adjacent:     'c = &quot;adjacent&quot;;',
-    laterSibling: 'c = &quot;laterSibling&quot;;'
-  },
-
-  patterns: {
-    // combinators must be listed first
-    // (and descendant needs to be last combinator)
-    laterSibling: /^\s*~\s*/,
-    child:        /^\s*&gt;\s*/,
-    adjacent:     /^\s*\+\s*/,
-    descendant:   /^\s/,
-
-    // selectors follow
-    tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/,
-    id:           /^#([\w\-\*]+)(\b|$)/,
-    className:    /^\.([\w\-\*]+)(\b|$)/,
-    pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/,
-    attrPresence: /^\[([\w]+)\]/,
-    attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['&quot;])([^\4]*?)\4|([^'&quot;][^\]]*?)))?\]/
-  },
-
-  // for Selector.match and Element#match
-  assertions: {
-    tagName: function(element, matches) {
-      return matches[1].toUpperCase() == element.tagName.toUpperCase();
-    },
-
-    className: function(element, matches) {
-      return Element.hasClassName(element, matches[1]);
-    },
-
-    id: function(element, matches) {
-      return element.id === matches[1];
-    },
-
-    attrPresence: function(element, matches) {
-      return Element.hasAttribute(element, matches[1]);
-    },
-
-    attr: function(element, matches) {
-      var nodeValue = Element.readAttribute(element, matches[1]);
-      return Selector.operators[matches[2]](nodeValue, matches[3]);
-    }
-  },
-
-  handlers: {
-    // UTILITY FUNCTIONS
-    // joins two collections
-    concat: function(a, b) {
-      for (var i = 0, node; node = b[i]; i++)
-        a.push(node);
-      return a;
-    },
-
-    // marks an array of nodes for counting
-    mark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = true;
-      return nodes;
-    },
-
-    unmark: function(nodes) {
-      for (var i = 0, node; node = nodes[i]; i++)
-        node._counted = undefined;
-      return nodes;
-    },
-
-    // mark each child node with its position (for nth calls)
-    // &quot;ofType&quot; flag indicates whether we're indexing for nth-of-type
-    // rather than nth-child
-    index: function(parentNode, reverse, ofType) {
-      parentNode._counted = true;
-      if (reverse) {
-        for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i &gt;= 0; i--) {
-          var node = nodes[i];
-          if (node.nodeType == 1 &amp;&amp; (!ofType || node._counted)) node.nodeIndex = j++;
-        }
-      } else {
-        for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
-          if (node.nodeType == 1 &amp;&amp; (!ofType || node._counted)) node.nodeIndex = j++;
-      }
-    },
-
-    // filters out duplicates and extends all nodes
-    unique: function(nodes) {
-      if (nodes.length == 0) return nodes;
-      var results = [], n;
-      for (var i = 0, l = nodes.length; i &lt; l; i++)
-        if (!(n = nodes[i])._counted) {
-          n._counted = true;
-          results.push(Element.extend(n));
-        }
-      return Selector.handlers.unmark(results);
-    },
-
-    // COMBINATOR FUNCTIONS
-    descendant: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        h.concat(results, node.getElementsByTagName('*'));
-      return results;
-    },
-
-    child: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        for (var j = 0, children = [], child; child = node.childNodes[j]; j++)
-          if (child.nodeType == 1 &amp;&amp; child.tagName != '!') results.push(child);
-      }
-      return results;
-    },
-
-    adjacent: function(nodes) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        var next = this.nextElementSibling(node);
-        if (next) results.push(next);
-      }
-      return results;
-    },
-
-    laterSibling: function(nodes) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        h.concat(results, Element.nextSiblings(node));
-      return results;
-    },
-
-    nextElementSibling: function(node) {
-      while (node = node.nextSibling)
-              if (node.nodeType == 1) return node;
-      return null;
-    },
-
-    previousElementSibling: function(node) {
-      while (node = node.previousSibling)
-        if (node.nodeType == 1) return node;
-      return null;
-    },
-
-    // TOKEN FUNCTIONS
-    tagName: function(nodes, root, tagName, combinator) {
-      tagName = tagName.toUpperCase();
-      var results = [], h = Selector.handlers;
-      if (nodes) {
-        if (combinator) {
-          // fastlane for ordinary descendant combinators
-          if (combinator == &quot;descendant&quot;) {
-            for (var i = 0, node; node = nodes[i]; i++)
-              h.concat(results, node.getElementsByTagName(tagName));
-            return results;
-          } else nodes = this[combinator](nodes);
-          if (tagName == &quot;*&quot;) return nodes;
-        }
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node.tagName.toUpperCase() == tagName) results.push(node);
-        return results;
-      } else return root.getElementsByTagName(tagName);
-    },
-
-    id: function(nodes, root, id, combinator) {
-      var targetNode = $(id), h = Selector.handlers;
-      if (!targetNode) return [];
-      if (!nodes &amp;&amp; root == document) return [targetNode];
-      if (nodes) {
-        if (combinator) {
-          if (combinator == 'child') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (targetNode.parentNode == node) return [targetNode];
-          } else if (combinator == 'descendant') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (Element.descendantOf(targetNode, node)) return [targetNode];
-          } else if (combinator == 'adjacent') {
-            for (var i = 0, node; node = nodes[i]; i++)
-              if (Selector.handlers.previousElementSibling(targetNode) == node)
-                return [targetNode];
-          } else nodes = h[combinator](nodes);
-        }
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node == targetNode) return [targetNode];
-        return [];
-      }
-      return (targetNode &amp;&amp; Element.descendantOf(targetNode, root)) ? [targetNode] : [];
-    },
-
-    className: function(nodes, root, className, combinator) {
-      if (nodes &amp;&amp; combinator) nodes = this[combinator](nodes);
-      return Selector.handlers.byClassName(nodes, root, className);
-    },
-
-    byClassName: function(nodes, root, className) {
-      if (!nodes) nodes = Selector.handlers.descendant([root]);
-      var needle = ' ' + className + ' ';
-      for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
-        nodeClassName = node.className;
-        if (nodeClassName.length == 0) continue;
-        if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
-          results.push(node);
-      }
-      return results;
-    },
-
-    attrPresence: function(nodes, root, attr) {
-      if (!nodes) nodes = root.getElementsByTagName(&quot;*&quot;);
-      var results = [];
-      for (var i = 0, node; node = nodes[i]; i++)
-        if (Element.hasAttribute(node, attr)) results.push(node);
-      return results;
-    },
-
-    attr: function(nodes, root, attr, value, operator) {
-      if (!nodes) nodes = root.getElementsByTagName(&quot;*&quot;);
-      var handler = Selector.operators[operator], results = [];
-      for (var i = 0, node; node = nodes[i]; i++) {
-        var nodeValue = Element.readAttribute(node, attr);
-        if (nodeValue === null) continue;
-        if (handler(nodeValue, value)) results.push(node);
-      }
-      return results;
-    },
-
-    pseudo: function(nodes, name, value, root, combinator) {
-      if (nodes &amp;&amp; combinator) nodes = this[combinator](nodes);
-      if (!nodes) nodes = root.getElementsByTagName(&quot;*&quot;);
-      return Selector.pseudos[name](nodes, value, root);
-    }
-  },
-
-  pseudos: {
-    'first-child': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        if (Selector.handlers.previousElementSibling(node)) continue;
-          results.push(node);
-      }
-      return results;
-    },
-    'last-child': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        if (Selector.handlers.nextElementSibling(node)) continue;
-          results.push(node);
-      }
-      return results;
-    },
-    'only-child': function(nodes, value, root) {
-      var h = Selector.handlers;
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!h.previousElementSibling(node) &amp;&amp; !h.nextElementSibling(node))
-          results.push(node);
-      return results;
-    },
-    'nth-child':        function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root);
-    },
-    'nth-last-child':   function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, true);
-    },
-    'nth-of-type':      function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, false, true);
-    },
-    'nth-last-of-type': function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, formula, root, true, true);
-    },
-    'first-of-type':    function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, &quot;1&quot;, root, false, true);
-    },
-    'last-of-type':     function(nodes, formula, root) {
-      return Selector.pseudos.nth(nodes, &quot;1&quot;, root, true, true);
-    },
-    'only-of-type':     function(nodes, formula, root) {
-      var p = Selector.pseudos;
-      return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
-    },
-
-    // handles the an+b logic
-    getIndices: function(a, b, total) {
-      if (a == 0) return b &gt; 0 ? [b] : [];
-      return $R(1, total).inject([], function(memo, i) {
-        if (0 == (i - b) % a &amp;&amp; (i - b) / a &gt;= 0) memo.push(i);
-        return memo;
-      });
-    },
-
-    // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
-    nth: function(nodes, formula, root, reverse, ofType) {
-      if (nodes.length == 0) return [];
-      if (formula == 'even') formula = '2n+0';
-      if (formula == 'odd')  formula = '2n+1';
-      var h = Selector.handlers, results = [], indexed = [], m;
-      h.mark(nodes);
-      for (var i = 0, node; node = nodes[i]; i++) {
-        if (!node.parentNode._counted) {
-          h.index(node.parentNode, reverse, ofType);
-          indexed.push(node.parentNode);
-        }
-      }
-      if (formula.match(/^\d+$/)) { // just a number
-        formula = Number(formula);
-        for (var i = 0, node; node = nodes[i]; i++)
-          if (node.nodeIndex == formula) results.push(node);
-      } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
-        if (m[1] == &quot;-&quot;) m[1] = -1;
-        var a = m[1] ? Number(m[1]) : 1;
-        var b = m[2] ? Number(m[2]) : 0;
-        var indices = Selector.pseudos.getIndices(a, b, nodes.length);
-        for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
-          for (var j = 0; j &lt; l; j++)
-            if (node.nodeIndex == indices[j]) results.push(node);
-        }
-      }
-      h.unmark(nodes);
-      h.unmark(indexed);
-      return results;
-    },
-
-    'empty': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++) {
-        // IE treats comments as element nodes
-        if (node.tagName == '!' || (node.firstChild &amp;&amp; !node.innerHTML.match(/^\s*$/))) continue;
-        results.push(node);
-      }
-      return results;
-    },
-
-    'not': function(nodes, selector, root) {
-      var h = Selector.handlers, selectorType, m;
-      var exclusions = new Selector(selector).findElements(root);
-      h.mark(exclusions);
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node._counted) results.push(node);
-      h.unmark(exclusions);
-      return results;
-    },
-
-    'enabled': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (!node.disabled) results.push(node);
-      return results;
-    },
-
-    'disabled': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (node.disabled) results.push(node);
-      return results;
-    },
-
-    'checked': function(nodes, value, root) {
-      for (var i = 0, results = [], node; node = nodes[i]; i++)
-        if (node.checked) results.push(node);
-      return results;
-    }
-  },
-
-  operators: {
-    '=':  function(nv, v) { return nv == v; },
-    '!=': function(nv, v) { return nv != v; },
-    '^=': function(nv, v) { return nv.startsWith(v); },
-    '$=': function(nv, v) { return nv.endsWith(v); },
-    '*=': function(nv, v) { return nv.include(v); },
-    '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
-    '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); }
-  },
-
-  matchElements: function(elements, expression) {
-    var matches = new Selector(expression).findElements(), h = Selector.handlers;
-    h.mark(matches);
-    for (var i = 0, results = [], element; element = elements[i]; i++)
-      if (element._counted) results.push(element);
-    h.unmark(matches);
-    return results;
-  },
-
-  findElement: function(elements, expression, index) {
-    if (Object.isNumber(expression)) {
-      index = expression; expression = false;
-    }
-    return Selector.matchElements(elements, expression || '*')[index || 0];
-  },
-
-  findChildElements: function(element, expressions) {
-    var exprs = expressions.join(','), expressions = [];
-    exprs.scan(/(([\w#:.~&gt;+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
-      expressions.push(m[1].strip());
-    });
-    var results = [], h = Selector.handlers;
-    for (var i = 0, l = expressions.length, selector; i &lt; l; i++) {
-      selector = new Selector(expressions[i].strip());
-      h.concat(results, selector.findElements(element));
-    }
-    return (l &gt; 1) ? h.unique(results) : results;
-  }
-});
-
-function $$() {
-  return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
-  reset: function(form) {
-    $(form).reset();
-    return form;
-  },
-
-  serializeElements: function(elements, options) {
-    if (typeof options != 'object') options = { hash: !!options };
-    else if (options.hash === undefined) options.hash = true;
-    var key, value, submitted = false, submit = options.submit;
-
-    var data = elements.inject({ }, function(result, element) {
-      if (!element.disabled &amp;&amp; element.name) {
-        key = element.name; value = $(element).getValue();
-        if (value != null &amp;&amp; (element.type != 'submit' || (!submitted &amp;&amp;
-            submit !== false &amp;&amp; (!submit || key == submit) &amp;&amp; (submitted = true)))) {
-          if (key in result) {
-            // a key is already present; construct an array of values
-            if (!Object.isArray(result[key])) result[key] = [result[key]];
-            result[key].push(value);
-          }
-          else result[key] = value;
-        }
-      }
-      return result;
-    });
-
-    return options.hash ? data : Object.toQueryString(data);
-  }
-};
-
-Form.Methods = {
-  serialize: function(form, options) {
-    return Form.serializeElements(Form.getElements(form), options);
-  },
-
-  getElements: function(form) {
-    return $A($(form).getElementsByTagName('*')).inject([],
-      function(elements, child) {
-        if (Form.Element.Serializers[child.tagName.toLowerCase()])
-          elements.push(Element.extend(child));
-        return elements;
-      }
-    );
-  },
-
-  getInputs: function(form, typeName, name) {
-    form = $(form);
-    var inputs = form.getElementsByTagName('input');
-
-    if (!typeName &amp;&amp; !name) return $A(inputs).map(Element.extend);
-
-    for (var i = 0, matchingInputs = [], length = inputs.length; i &lt; length; i++) {
-      var input = inputs[i];
-      if ((typeName &amp;&amp; input.type != typeName) || (name &amp;&amp; input.name != name))
-        continue;
-      matchingInputs.push(Element.extend(input));
-    }
-
-    return matchingInputs;
-  },
-
-  disable: function(form) {
-    form = $(form);
-    Form.getElements(form).invoke('disable');
-    return form;
-  },
-
-  enable: function(form) {
-    form = $(form);
-    Form.getElements(form).invoke('enable');
-    return form;
-  },
-
-  findFirstElement: function(form) {
-    var elements = $(form).getElements().findAll(function(element) {
-      return 'hidden' != element.type &amp;&amp; !element.disabled;
-    });
-    var firstByIndex = elements.findAll(function(element) {
-      return element.hasAttribute('tabIndex') &amp;&amp; element.tabIndex &gt;= 0;
-    }).sortBy(function(element) { return element.tabIndex }).first();
-
-    return firstByIndex ? firstByIndex : elements.find(function(element) {
-      return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
-    });
-  },
-
-  focusFirstElement: function(form) {
-    form = $(form);
-    form.findFirstElement().activate();
-    return form;
-  },
-
-  request: function(form, options) {
-    form = $(form), options = Object.clone(options || { });
-
-    var params = options.parameters, action = form.readAttribute('action') || '';
-    if (action.blank()) action = window.location.href;
-    options.parameters = form.serialize(true);
-
-    if (params) {
-      if (Object.isString(params)) params = params.toQueryParams();
-      Object.extend(options.parameters, params);
-    }
-
-    if (form.hasAttribute('method') &amp;&amp; !options.method)
-      options.method = form.method;
-
-    return new Ajax.Request(action, options);
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
-  focus: function(element) {
-    $(element).focus();
-    return element;
-  },
-
-  select: function(element) {
-    $(element).select();
-    return element;
-  }
-};
-
-Form.Element.Methods = {
-  serialize: function(element) {
-    element = $(element);
-    if (!element.disabled &amp;&amp; element.name) {
-      var value = element.getValue();
-      if (value != undefined) {
-        var pair = { };
-        pair[element.name] = value;
-        return Object.toQueryString(pair);
-      }
-    }
-    return '';
-  },
-
-  getValue: function(element) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    return Form.Element.Serializers[method](element);
-  },
-
-  setValue: function(element, value) {
-    element = $(element);
-    var method = element.tagName.toLowerCase();
-    Form.Element.Serializers[method](element, value);
-    return element;
-  },
-
-  clear: function(element) {
-    $(element).value = '';
-    return element;
-  },
-
-  present: function(element) {
-    return $(element).value != '';
-  },
-
-  activate: function(element) {
-    element = $(element);
-    try {
-      element.focus();
-      if (element.select &amp;&amp; (element.tagName.toLowerCase() != 'input' ||
-          !['button', 'reset', 'submit'].include(element.type)))
-        element.select();
-    } catch (e) { }
-    return element;
-  },
-
-  disable: function(element) {
-    element = $(element);
-    element.blur();
-    element.disabled = true;
-    return element;
-  },
-
-  enable: function(element) {
-    element = $(element);
-    element.disabled = false;
-    return element;
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Field = Form.Element;
-var $F = Form.Element.Methods.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
-  input: function(element, value) {
-    switch (element.type.toLowerCase()) {
-      case 'checkbox':
-      case 'radio':
-        return Form.Element.Serializers.inputSelector(element, value);
-      default:
-        return Form.Element.Serializers.textarea(element, value);
-    }
-  },
-
-  inputSelector: function(element, value) {
-    if (value === undefined) return element.checked ? element.value : null;
-    else element.checked = !!value;
-  },
-
-  textarea: function(element, value) {
-    if (value === undefined) return element.value;
-    else element.value = value;
-  },
-
-  select: function(element, index) {
-    if (index === undefined)
-      return this[element.type == 'select-one' ?
-        'selectOne' : 'selectMany'](element);
-    else {
-      var opt, value, single = !Object.isArray(index);
-      for (var i = 0, length = element.length; i &lt; length; i++) {
-        opt = element.options[i];
-        value = this.optionValue(opt);
-        if (single) {
-          if (value == index) {
-            opt.selected = true;
-            return;
-          }
-        }
-        else opt.selected = index.include(value);
-      }
-    }
-  },
-
-  selectOne: function(element) {
-    var index = element.selectedIndex;
-    return index &gt;= 0 ? this.optionValue(element.options[index]) : null;
-  },
-
-  selectMany: function(element) {
-    var values, length = element.length;
-    if (!length) return null;
-
-    for (var i = 0, values = []; i &lt; length; i++) {
-      var opt = element.options[i];
-      if (opt.selected) values.push(this.optionValue(opt));
-    }
-    return values;
-  },
-
-  optionValue: function(opt) {
-    // extend element because hasAttribute may not be native
-    return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
-  initialize: function($super, element, frequency, callback) {
-    $super(callback, frequency);
-    this.element   = $(element);
-    this.lastValue = this.getValue();
-  },
-
-  execute: function() {
-    var value = this.getValue();
-    if (Object.isString(this.lastValue) &amp;&amp; Object.isString(value) ?
-        this.lastValue != value : String(this.lastValue) != String(value)) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  }
-});
-
-Form.Element.Observer = Class.create(Abstract.TimedObserver, {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.Observer = Class.create(Abstract.TimedObserver, {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = Class.create({
-  initialize: function(element, callback) {
-    this.element  = $(element);
-    this.callback = callback;
-
-    this.lastValue = this.getValue();
-    if (this.element.tagName.toLowerCase() == 'form')
-      this.registerFormCallbacks();
-    else
-      this.registerCallback(this.element);
-  },
-
-  onElementEvent: function() {
-    var value = this.getValue();
-    if (this.lastValue != value) {
-      this.callback(this.element, value);
-      this.lastValue = value;
-    }
-  },
-
-  registerFormCallbacks: function() {
-    Form.getElements(this.element).each(this.registerCallback, this);
-  },
-
-  registerCallback: function(element) {
-    if (element.type) {
-      switch (element.type.toLowerCase()) {
-        case 'checkbox':
-        case 'radio':
-          Event.observe(element, 'click', this.onElementEvent.bind(this));
-          break;
-        default:
-          Event.observe(element, 'change', this.onElementEvent.bind(this));
-          break;
-      }
-    }
-  }
-});
-
-Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
-  getValue: function() {
-    return Form.Element.getValue(this.element);
-  }
-});
-
-Form.EventObserver = Class.create(Abstract.EventObserver, {
-  getValue: function() {
-    return Form.serialize(this.element);
-  }
-});
-if (!window.Event) var Event = { };
-
-Object.extend(Event, {
-  KEY_BACKSPACE: 8,
-  KEY_TAB:       9,
-  KEY_RETURN:   13,
-  KEY_ESC:      27,
-  KEY_LEFT:     37,
-  KEY_UP:       38,
-  KEY_RIGHT:    39,
-  KEY_DOWN:     40,
-  KEY_DELETE:   46,
-  KEY_HOME:     36,
-  KEY_END:      35,
-  KEY_PAGEUP:   33,
-  KEY_PAGEDOWN: 34,
-  KEY_INSERT:   45,
-
-  cache: { },
-
-  relatedTarget: function(event) {
-    var element;
-    switch(event.type) {
-      case 'mouseover': element = event.fromElement; break;
-      case 'mouseout':  element = event.toElement;   break;
-      default: return null;
-    }
-    return Element.extend(element);
-  }
-});
-
-Event.Methods = (function() {
-  var isButton;
-
-  if (Prototype.Browser.IE) {
-    var buttonMap = { 0: 1, 1: 4, 2: 2 };
-    isButton = function(event, code) {
-      return event.button == buttonMap[code];
-    };
-
-  } else if (Prototype.Browser.WebKit) {
-    isButton = function(event, code) {
-      switch (code) {
-        case 0: return event.which == 1 &amp;&amp; !event.metaKey;
-        case 1: return event.which == 1 &amp;&amp; event.metaKey;
-        default: return false;
-      }
-    };
-
-  } else {
-    isButton = function(event, code) {
-      return event.which ? (event.which === code + 1) : (event.button === code);
-    };
-  }
-
-  return {
-    isLeftClick:   function(event) { return isButton(event, 0) },
-    isMiddleClick: function(event) { return isButton(event, 1) },
-    isRightClick:  function(event) { return isButton(event, 2) },
-
-    element: function(event) {
-      var node = Event.extend(event).target;
-      return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node);
-    },
-
-    findElement: function(event, expression) {
-      var element = Event.element(event);
-      return element.match(expression) ? element : element.up(expression);
-    },
-
-    pointer: function(event) {
-      return {
-        x: event.pageX || (event.clientX +
-          (document.documentElement.scrollLeft || document.body.scrollLeft)),
-        y: event.pageY || (event.clientY +
-          (document.documentElement.scrollTop || document.body.scrollTop))
-      };
-    },
-
-    pointerX: function(event) { return Event.pointer(event).x },
-    pointerY: function(event) { return Event.pointer(event).y },
-
-    stop: function(event) {
-      Event.extend(event);
-      event.preventDefault();
-      event.stopPropagation();
-      event.stopped = true;
-    }
-  };
-})();
-
-Event.extend = (function() {
-  var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
-    m[name] = Event.Methods[name].methodize();
-    return m;
-  });
-
-  if (Prototype.Browser.IE) {
-    Object.extend(methods, {
-      stopPropagation: function() { this.cancelBubble = true },
-      preventDefault:  function() { this.returnValue = false },
-      inspect: function() { return &quot;[object Event]&quot; }
-    });
-
-    return function(event) {
-      if (!event) return false;
-      if (event._extendedByPrototype) return event;
-
-      event._extendedByPrototype = Prototype.emptyFunction;
-      var pointer = Event.pointer(event);
-      Object.extend(event, {
-        target: event.srcElement,
-        relatedTarget: Event.relatedTarget(event),
-        pageX:  pointer.x,
-        pageY:  pointer.y
-      });
-      return Object.extend(event, methods);
-    };
-
-  } else {
-    Event.prototype = Event.prototype || document.createEvent(&quot;HTMLEvents&quot;).__proto__;
-    Object.extend(Event.prototype, methods);
-    return Prototype.K;
-  }
-})();
-
-Object.extend(Event, (function() {
-  var cache = Event.cache;
-
-  function getEventID(element) {
-    if (element._eventID) return element._eventID;
-    arguments.callee.id = arguments.callee.id || 1;
-    return element._eventID = ++arguments.callee.id;
-  }
-
-  function getDOMEventName(eventName) {
-    if (eventName &amp;&amp; eventName.include(':')) return &quot;dataavailable&quot;;
-    return eventName;
-  }
-
-  function getCacheForID(id) {
-    return cache[id] = cache[id] || { };
-  }
-
-  function getWrappersForEventName(id, eventName) {
-    var c = getCacheForID(id);
-    return c[eventName] = c[eventName] || [];
-  }
-
-  function createWrapper(element, eventName, handler) {
-    var id = getEventID(element);
-    var c = getWrappersForEventName(id, eventName);
-    if (c.pluck(&quot;handler&quot;).include(handler)) return false;
-
-    var wrapper = function(event) {
-      if (!Event || !Event.extend ||
-        (event.eventName &amp;&amp; event.eventName != eventName))
-          return false;
-
-      Event.extend(event);
-      handler.call(element, event)
-    };
-
-    wrapper.handler = handler;
-    c.push(wrapper);
-    return wrapper;
-  }
-
-  function findWrapper(id, eventName, handler) {
-    var c = getWrappersForEventName(id, eventName);
-    return c.find(function(wrapper) { return wrapper.handler == handler });
-  }
-
-  function destroyWrapper(id, eventName, handler) {
-    var c = getCacheForID(id);
-    if (!c[eventName]) return false;
-    c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
-  }
-
-  function destroyCache() {
-    for (var id in cache)
-      for (var eventName in cache[id])
-        cache[id][eventName] = null;
-  }
-
-  if (window.attachEvent) {
-    window.attachEvent(&quot;onunload&quot;, destroyCache);
-  }
-
-  return {
-    observe: function(element, eventName, handler) {
-      element = $(element);
-      var name = getDOMEventName(eventName);
-
-      var wrapper = createWrapper(element, eventName, handler);
-      if (!wrapper) return element;
-
-      if (element.addEventListener) {
-        element.addEventListener(name, wrapper, false);
-      } else {
-        element.attachEvent(&quot;on&quot; + name, wrapper);
-      }
-
-      return element;
-    },
-
-    stopObserving: function(element, eventName, handler) {
-      element = $(element);
-      var id = getEventID(element), name = getDOMEventName(eventName);
-
-      if (!handler &amp;&amp; eventName) {
-        getWrappersForEventName(id, eventName).each(function(wrapper) {
-          element.stopObserving(eventName, wrapper.handler);
-        });
-        return element;
-
-      } else if (!eventName) {
-        Object.keys(getCacheForID(id)).each(function(eventName) {
-          element.stopObserving(eventName);
-        });
-        return element;
-      }
-
-      var wrapper = findWrapper(id, eventName, handler);
-      if (!wrapper) return element;
-
-      if (element.removeEventListener) {
-        element.removeEventListener(name, wrapper, false);
-      } else {
-        element.detachEvent(&quot;on&quot; + name, wrapper);
-      }
-
-      destroyWrapper(id, eventName, handler);
-
-      return element;
-    },
-
-    fire: function(element, eventName, memo) {
-      element = $(element);
-      if (element == document &amp;&amp; document.createEvent &amp;&amp; !element.dispatchEvent)
-        element = document.documentElement;
-
-      if (document.createEvent) {
-        var event = document.createEvent(&quot;HTMLEvents&quot;);
-        event.initEvent(&quot;dataavailable&quot;, true, true);
-      } else {
-        var event = document.createEventObject();
-        event.eventType = &quot;ondataavailable&quot;;
-      }
-
-      event.eventName = eventName;
-      event.memo = memo || { };
-
-      if (document.createEvent) {
-        element.dispatchEvent(event);
-      } else {
-        element.fireEvent(event.eventType, event);
-      }
-
-      return event;
-    }
-  };
-})());
-
-Object.extend(Event, Event.Methods);
-
-Element.addMethods({
-  fire:          Event.fire,
-  observe:       Event.observe,
-  stopObserving: Event.stopObserving
-});
-
-Object.extend(document, {
-  fire:          Element.Methods.fire.methodize(),
-  observe:       Element.Methods.observe.methodize(),
-  stopObserving: Element.Methods.stopObserving.methodize()
-});
-
-(function() {
-  /* Support for the DOMContentLoaded event is based on work by Dan Webb,
-     Matthias Miller, Dean Edwards and John Resig. */
-
-  var timer, fired = false;
-
-  function fireContentLoadedEvent() {
-    if (fired) return;
-    if (timer) window.clearInterval(timer);
-    document.fire(&quot;dom:loaded&quot;);
-    fired = true;
-  }
-
-  if (document.addEventListener) {
-    if (Prototype.Browser.WebKit) {
-      timer = window.setInterval(function() {
-        if (/loaded|complete/.test(document.readyState))
-          fireContentLoadedEvent();
-      }, 0);
-
-      Event.observe(window, &quot;load&quot;, fireContentLoadedEvent);
-
-    } else {
-      document.addEventListener(&quot;DOMContentLoaded&quot;,
-        fireContentLoadedEvent, false);
-    }
-
-  } else {
-    document.write(&quot;&lt;script id=__onDOMContentLoaded defer src=//:&gt;&lt;\/script&gt;&quot;);
-    $(&quot;__onDOMContentLoaded&quot;).onreadystatechange = function() {
-      if (this.readyState == &quot;complete&quot;) {
-        this.onreadystatechange = null;
-        fireContentLoadedEvent();
-      }
-    };
-  }
-})();
-/*------------------------------- DEPRECATED -------------------------------*/
-
-Hash.toQueryString = Object.toQueryString;
-
-var Toggle = { display: Element.toggle };
-
-Element.Methods.childOf = Element.Methods.descendantOf;
-
-var Insertion = {
-  Before: function(element, content) {
-    return Element.insert(element, {before:content});
-  },
-
-  Top: function(element, content) {
-    return Element.insert(element, {top:content});
-  },
-
-  Bottom: function(element, content) {
-    return Element.insert(element, {bottom:content});
-  },
-
-  After: function(element, content) {
-    return Element.insert(element, {after:content});
-  }
-};
-
-var $continue = new Error('&quot;throw $continue&quot; is deprecated, use &quot;return&quot; instead');
-
-// This should be moved to script.aculo.us; notice the deprecated methods
-// further below, that map to the newer Element methods.
-var Position = {
-  // set to true if needed, warning: firefox performance problems
-  // NOT neeeded for page scrolling, only if draggable contained in
-  // scrollable elements
-  includeScrollOffsets: false,
-
-  // must be called before calling withinIncludingScrolloffset, every time the
-  // page is scrolled
-  prepare: function() {
-    this.deltaX =  window.pageXOffset
-                || document.documentElement.scrollLeft
-                || document.body.scrollLeft
-                || 0;
-    this.deltaY =  window.pageYOffset
-                || document.documentElement.scrollTop
-                || document.body.scrollTop
-                || 0;
-  },
-
-  // caches x/y coordinate pair to use with overlap
-  within: function(element, x, y) {
-    if (this.includeScrollOffsets)
-      return this.withinIncludingScrolloffsets(element, x, y);
-    this.xcomp = x;
-    this.ycomp = y;
-    this.offset = Element.cumulativeOffset(element);
-
-    return (y &gt;= this.offset[1] &amp;&amp;
-            y &lt;  this.offset[1] + element.offsetHeight &amp;&amp;
-            x &gt;= this.offset[0] &amp;&amp;
-            x &lt;  this.offset[0] + element.offsetWidth);
-  },
-
-  withinIncludingScrolloffsets: function(element, x, y) {
-    var offsetcache = Element.cumulativeScrollOffset(element);
-
-    this.xcomp = x + offsetcache[0] - this.deltaX;
-    this.ycomp = y + offsetcache[1] - this.deltaY;
-    this.offset = Element.cumulativeOffset(element);
-
-    return (this.ycomp &gt;= this.offset[1] &amp;&amp;
-            this.ycomp &lt;  this.offset[1] + element.offsetHeight &amp;&amp;
-            this.xcomp &gt;= this.offset[0] &amp;&amp;
-            this.xcomp &lt;  this.offset[0] + element.offsetWidth);
-  },
-
-  // within must be called directly before
-  overlap: function(mode, element) {
-    if (!mode) return 0;
-    if (mode == 'vertical')
-      return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
-        element.offsetHeight;
-    if (mode == 'horizontal')
-      return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
-        element.offsetWidth;
-  },
-
-  // Deprecation layer -- use newer Element methods now (1.5.2).
-
-  cumulativeOffset: Element.Methods.cumulativeOffset,
-
-  positionedOffset: Element.Methods.positionedOffset,
-
-  absolutize: function(element) {
-    Position.prepare();
-    return Element.absolutize(element);
-  },
-
-  relativize: function(element) {
-    Position.prepare();
-    return Element.relativize(element);
-  },
-
-  realOffset: Element.Methods.cumulativeScrollOffset,
-
-  offsetParent: Element.Methods.getOffsetParent,
-
-  page: Element.Methods.viewportOffset,
-
-  clone: function(source, target, options) {
-    options = options || { };
-    return Element.clonePosition(target, source, options);
-  }
-};
-
-/*--------------------------------------------------------------------------*/
-
-if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
-  function iter(name) {
-    return name.blank() ? null : &quot;[contains(concat(' ', @class, ' '), ' &quot; + name + &quot; ')]&quot;;
-  }
-
-  instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
-  function(element, className) {
-    className = className.toString().strip();
-    var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
-    return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
-  } : function(element, className) {
-    className = className.toString().strip();
-    var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
-    if (!classNames &amp;&amp; !className) return elements;
-
-    var nodes = $(element).getElementsByTagName('*');
-    className = ' ' + className + ' ';
-
-    for (var i = 0, child, cn; child = nodes[i]; i++) {
-      if (child.className &amp;&amp; (cn = ' ' + child.className + ' ') &amp;&amp; (cn.include(className) ||
-          (classNames &amp;&amp; classNames.all(function(name) {
-            return !name.toString().blank() &amp;&amp; cn.include(' ' + name + ' ');
-          }))))
-        elements.push(Element.extend(child));
-    }
-    return elements;
-  };
-
-  return function(className, parentElement) {
-    return $(parentElement || document.body).getElementsByClassName(className);
-  };
-}(Element.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
-  initialize: function(element) {
-    this.element = $(element);
-  },
-
-  _each: function(iterator) {
-    this.element.className.split(/\s+/).select(function(name) {
-      return name.length &gt; 0;
-    })._each(iterator);
-  },
-
-  set: function(className) {
-    this.element.className = className;
-  },
-
-  add: function(classNameToAdd) {
-    if (this.include(classNameToAdd)) return;
-    this.set($A(this).concat(classNameToAdd).join(' '));
-  },
-
-  remove: function(classNameToRemove) {
-    if (!this.include(classNameToRemove)) return;
-    this.set($A(this).without(classNameToRemove).join(' '));
-  },
-
-  toString: function() {
-    return $A(this).join(' ');
-  }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-
-/*--------------------------------------------------------------------------*/
-
-Element.addMethods();
</del><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculousscriptaculousjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/scriptaculous.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/scriptaculous.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/scriptaculous.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><del>-// script.aculo.us scriptaculous.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// 
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
</ins><span class="cx"> // Permission is hereby granted, free of charge, to any person obtaining
</span><span class="cx"> // a copy of this software and associated documentation files (the
</span><span class="cx"> // &quot;Software&quot;), to deal in the Software without restriction, including
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx"> // distribute, sublicense, and/or sell copies of the Software, and to
</span><span class="cx"> // permit persons to whom the Software is furnished to do so, subject to
</span><span class="cx"> // the following conditions:
</span><del>-// 
</del><ins>+//
</ins><span class="cx"> // The above copyright notice and this permission notice shall be
</span><span class="cx"> // included in all copies or substantial portions of the Software.
</span><span class="cx"> //
</span><span class="lines">@@ -24,35 +24,45 @@
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="cx"> 
</span><span class="cx"> var Scriptaculous = {
</span><del>-  Version: '1.8.0',
</del><ins>+  Version: '1.8.3',
</ins><span class="cx">   require: function(libraryName) {
</span><del>-    // inserting via DOM fails in Safari 2.0, so brute force approach
-    document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;'+libraryName+'&quot;&gt;&lt;\/script&gt;');
</del><ins>+    try{
+      // inserting via DOM fails in Safari 2.0, so brute force approach
+      document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;'+libraryName+'&quot;&gt;&lt;\/script&gt;');
+    } catch(e) {
+      // for xhtml+xml served content, fall back to DOM methods
+      var script = document.createElement('script');
+      script.type = 'text/javascript';
+      script.src = libraryName;
+      document.getElementsByTagName('head')[0].appendChild(script);
+    }
</ins><span class="cx">   },
</span><del>-  REQUIRED_PROTOTYPE: '1.6.0',
</del><ins>+  REQUIRED_PROTOTYPE: '1.6.0.3',
</ins><span class="cx">   load: function() {
</span><del>-    function convertVersionString(versionString){
-      var r = versionString.split('.');
-      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
</del><ins>+    function convertVersionString(versionString) {
+      var v = versionString.replace(/_.*|\./g, '');
+      v = parseInt(v + '0'.times(4-v.length));
+      return versionString.indexOf('_') &gt; -1 ? v-1 : v;
</ins><span class="cx">     }
</span><del>- 
-    if((typeof Prototype=='undefined') || 
-       (typeof Element == 'undefined') || 
</del><ins>+
+    if((typeof Prototype=='undefined') ||
+       (typeof Element == 'undefined') ||
</ins><span class="cx">        (typeof Element.Methods=='undefined') ||
</span><del>-       (convertVersionString(Prototype.Version) &lt; 
</del><ins>+       (convertVersionString(Prototype.Version) &lt;
</ins><span class="cx">         convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
</span><span class="cx">        throw(&quot;script.aculo.us requires the Prototype JavaScript framework &gt;= &quot; +
</span><span class="cx">         Scriptaculous.REQUIRED_PROTOTYPE);
</span><del>-    
-    $A(document.getElementsByTagName(&quot;script&quot;)).findAll( function(s) {
-      return (s.src &amp;&amp; s.src.match(/scriptaculous\.js(\?.*)?$/))
-    }).each( function(s) {
-      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
-      var includes = s.src.match(/\?.*load=([a-z,]*)/);
</del><ins>+
+    var js = /scriptaculous\.js(\?.*)?$/;
+    $$('head script[src]').findAll(function(s) {
+      return s.src.match(js);
+    }).each(function(s) {
+      var path = s.src.replace(js, ''),
+      includes = s.src.match(/\?.*load=([a-z,]*)/);
</ins><span class="cx">       (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
</span><span class="cx">        function(include) { Scriptaculous.require(path+include+'.js') });
</span><span class="cx">     });
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Scriptaculous.load();
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculoussliderjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/slider.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/slider.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/slider.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>-// script.aculo.us slider.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us slider.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs 
</del><ins>+// Copyright (c) 2005-2009 Marty Haught, Thomas Fuchs
</ins><span class="cx"> //
</span><span class="cx"> // script.aculo.us is freely distributable under the terms of an MIT-style license.
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="lines">@@ -16,13 +16,13 @@
</span><span class="cx"> Control.Slider = Class.create({
</span><span class="cx">   initialize: function(handle, track, options) {
</span><span class="cx">     var slider = this;
</span><del>-    
</del><ins>+
</ins><span class="cx">     if (Object.isArray(handle)) {
</span><span class="cx">       this.handles = handle.collect( function(e) { return $(e) });
</span><span class="cx">     } else {
</span><span class="cx">       this.handles = [$(handle)];
</span><span class="cx">     }
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.track   = $(track);
</span><span class="cx">     this.options = options || { };
</span><span class="cx"> 
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">     this.increment = this.options.increment || 1;
</span><span class="cx">     this.step      = parseInt(this.options.step || '1');
</span><span class="cx">     this.range     = this.options.range || $R(0,1);
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.value     = 0; // assure backwards compat
</span><span class="cx">     this.values    = this.handles.map( function() { return 0 });
</span><span class="cx">     this.spans     = this.options.spans ? this.options.spans.map(function(s){ return $(s) }) : false;
</span><span class="lines">@@ -45,13 +45,13 @@
</span><span class="cx">     // Will be used to align the handle onto the track, if necessary
</span><span class="cx">     this.alignX = parseInt(this.options.alignX || '0');
</span><span class="cx">     this.alignY = parseInt(this.options.alignY || '0');
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.trackLength = this.maximumOffset() - this.minimumOffset();
</span><span class="cx"> 
</span><del>-    this.handleLength = this.isVertical() ? 
-      (this.handles[0].offsetHeight != 0 ? 
-        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,&quot;&quot;)) : 
-      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth : 
</del><ins>+    this.handleLength = this.isVertical() ?
+      (this.handles[0].offsetHeight != 0 ?
+        this.handles[0].offsetHeight : this.handles[0].style.height.replace(/px$/,&quot;&quot;)) :
+      (this.handles[0].offsetWidth != 0 ? this.handles[0].offsetWidth :
</ins><span class="cx">         this.handles[0].style.width.replace(/px$/,&quot;&quot;));
</span><span class="cx"> 
</span><span class="cx">     this.active   = false;
</span><span class="lines">@@ -75,20 +75,20 @@
</span><span class="cx">     this.handles.each( function(h,i) {
</span><span class="cx">       i = slider.handles.length-1-i;
</span><span class="cx">       slider.setValue(parseFloat(
</span><del>-        (Object.isArray(slider.options.sliderValue) ? 
-          slider.options.sliderValue[i] : slider.options.sliderValue) || 
</del><ins>+        (Object.isArray(slider.options.sliderValue) ?
+          slider.options.sliderValue[i] : slider.options.sliderValue) ||
</ins><span class="cx">          slider.range.start), i);
</span><span class="cx">       h.makePositioned().observe(&quot;mousedown&quot;, slider.eventMouseDown);
</span><span class="cx">     });
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.track.observe(&quot;mousedown&quot;, this.eventMouseDown);
</span><span class="cx">     document.observe(&quot;mouseup&quot;, this.eventMouseUp);
</span><span class="cx">     document.observe(&quot;mousemove&quot;, this.eventMouseMove);
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.initialized = true;
</span><span class="cx">   },
</span><span class="cx">   dispose: function() {
</span><del>-    var slider = this;    
</del><ins>+    var slider = this;
</ins><span class="cx">     Event.stopObserving(this.track, &quot;mousedown&quot;, this.eventMouseDown);
</span><span class="cx">     Event.stopObserving(document, &quot;mouseup&quot;, this.eventMouseUp);
</span><span class="cx">     Event.stopObserving(document, &quot;mousemove&quot;, this.eventMouseMove);
</span><span class="lines">@@ -101,12 +101,12 @@
</span><span class="cx">   },
</span><span class="cx">   setEnabled: function(){
</span><span class="cx">     this.disabled = false;
</span><del>-  },  
</del><ins>+  },
</ins><span class="cx">   getNearestValue: function(value){
</span><span class="cx">     if (this.allowedValues){
</span><span class="cx">       if (value &gt;= this.allowedValues.max()) return(this.allowedValues.max());
</span><span class="cx">       if (value &lt;= this.allowedValues.min()) return(this.allowedValues.min());
</span><del>-      
</del><ins>+
</ins><span class="cx">       var offset = Math.abs(this.allowedValues[0] - value);
</span><span class="cx">       var newValue = this.allowedValues[0];
</span><span class="cx">       this.allowedValues.each( function(v) {
</span><span class="lines">@@ -114,7 +114,7 @@
</span><span class="cx">         if (currentOffset &lt;= offset){
</span><span class="cx">           newValue = v;
</span><span class="cx">           offset = currentOffset;
</span><del>-        } 
</del><ins>+        }
</ins><span class="cx">       });
</span><span class="cx">       return newValue;
</span><span class="cx">     }
</span><span class="lines">@@ -138,28 +138,28 @@
</span><span class="cx">     sliderValue = this.getNearestValue(sliderValue);
</span><span class="cx">     this.values[handleIdx] = sliderValue;
</span><span class="cx">     this.value = this.values[0]; // assure backwards compat
</span><del>-    
-    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] = 
</del><ins>+
+    this.handles[handleIdx].style[this.isVertical() ? 'top' : 'left'] =
</ins><span class="cx">       this.translateToPx(sliderValue);
</span><del>-    
</del><ins>+
</ins><span class="cx">     this.drawSpans();
</span><span class="cx">     if (!this.dragging || !this.event) this.updateFinished();
</span><span class="cx">   },
</span><span class="cx">   setValueBy: function(delta, handleIdx) {
</span><del>-    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta, 
</del><ins>+    this.setValue(this.values[handleIdx || this.activeHandleIdx || 0] + delta,
</ins><span class="cx">       handleIdx || this.activeHandleIdx || 0);
</span><span class="cx">   },
</span><span class="cx">   translateToPx: function(value) {
</span><span class="cx">     return Math.round(
</span><del>-      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) * 
</del><ins>+      ((this.trackLength-this.handleLength)/(this.range.end-this.range.start)) *
</ins><span class="cx">       (value - this.range.start)) + &quot;px&quot;;
</span><span class="cx">   },
</span><span class="cx">   translateToValue: function(offset) {
</span><del>-    return ((offset/(this.trackLength-this.handleLength) * 
</del><ins>+    return ((offset/(this.trackLength-this.handleLength) *
</ins><span class="cx">       (this.range.end-this.range.start)) + this.range.start);
</span><span class="cx">   },
</span><span class="cx">   getRange: function(range) {
</span><del>-    var v = this.values.sortBy(Prototype.K); 
</del><ins>+    var v = this.values.sortBy(Prototype.K);
</ins><span class="cx">     range = range || 0;
</span><span class="cx">     return $R(v[range],v[range+1]);
</span><span class="cx">   },
</span><span class="lines">@@ -167,12 +167,12 @@
</span><span class="cx">     return(this.isVertical() ? this.alignY : this.alignX);
</span><span class="cx">   },
</span><span class="cx">   maximumOffset: function(){
</span><del>-    return(this.isVertical() ? 
</del><ins>+    return(this.isVertical() ?
</ins><span class="cx">       (this.track.offsetHeight != 0 ? this.track.offsetHeight :
</span><del>-        this.track.style.height.replace(/px$/,&quot;&quot;)) - this.alignY : 
-      (this.track.offsetWidth != 0 ? this.track.offsetWidth : 
</del><ins>+        this.track.style.height.replace(/px$/,&quot;&quot;)) - this.alignY :
+      (this.track.offsetWidth != 0 ? this.track.offsetWidth :
</ins><span class="cx">         this.track.style.width.replace(/px$/,&quot;&quot;)) - this.alignX);
</span><del>-  },  
</del><ins>+  },
</ins><span class="cx">   isVertical:  function(){
</span><span class="cx">     return (this.axis == 'vertical');
</span><span class="cx">   },
</span><span class="lines">@@ -184,7 +184,7 @@
</span><span class="cx">       this.setSpan(this.options.startSpan,
</span><span class="cx">         $R(0, this.values.length&gt;1 ? this.getRange(0).min() : this.value ));
</span><span class="cx">     if (this.options.endSpan)
</span><del>-      this.setSpan(this.options.endSpan, 
</del><ins>+      this.setSpan(this.options.endSpan,
</ins><span class="cx">         $R(this.values.length&gt;1 ? this.getRange(this.spans.length-1).max() : this.value, this.maximum));
</span><span class="cx">   },
</span><span class="cx">   setSpan: function(span, range) {
</span><span class="lines">@@ -204,30 +204,30 @@
</span><span class="cx">     if (Event.isLeftClick(event)) {
</span><span class="cx">       if (!this.disabled){
</span><span class="cx">         this.active = true;
</span><del>-        
</del><ins>+
</ins><span class="cx">         var handle = Event.element(event);
</span><span class="cx">         var pointer  = [Event.pointerX(event), Event.pointerY(event)];
</span><span class="cx">         var track = handle;
</span><span class="cx">         if (track==this.track) {
</span><del>-          var offsets  = Position.cumulativeOffset(this.track); 
</del><ins>+          var offsets  = this.track.cumulativeOffset();
</ins><span class="cx">           this.event = event;
</span><del>-          this.setValue(this.translateToValue( 
</del><ins>+          this.setValue(this.translateToValue(
</ins><span class="cx">            (this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
</span><span class="cx">           ));
</span><del>-          var offsets  = Position.cumulativeOffset(this.activeHandle);
</del><ins>+          var offsets  = this.activeHandle.cumulativeOffset();
</ins><span class="cx">           this.offsetX = (pointer[0] - offsets[0]);
</span><span class="cx">           this.offsetY = (pointer[1] - offsets[1]);
</span><span class="cx">         } else {
</span><span class="cx">           // find the handle (prevents issues with Safari)
</span><del>-          while((this.handles.indexOf(handle) == -1) &amp;&amp; handle.parentNode) 
</del><ins>+          while((this.handles.indexOf(handle) == -1) &amp;&amp; handle.parentNode)
</ins><span class="cx">             handle = handle.parentNode;
</span><del>-            
</del><ins>+
</ins><span class="cx">           if (this.handles.indexOf(handle)!=-1) {
</span><span class="cx">             this.activeHandle    = handle;
</span><span class="cx">             this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
</span><span class="cx">             this.updateStyles();
</span><del>-            
-            var offsets  = Position.cumulativeOffset(this.activeHandle);
</del><ins>+
+            var offsets  = this.activeHandle.cumulativeOffset();
</ins><span class="cx">             this.offsetX = (pointer[0] - offsets[0]);
</span><span class="cx">             this.offsetY = (pointer[1] - offsets[1]);
</span><span class="cx">           }
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">   },
</span><span class="cx">   draw: function(event) {
</span><span class="cx">     var pointer = [Event.pointerX(event), Event.pointerY(event)];
</span><del>-    var offsets = Position.cumulativeOffset(this.track);
</del><ins>+    var offsets = this.track.cumulativeOffset();
</ins><span class="cx">     pointer[0] -= this.offsetX + offsets[0];
</span><span class="cx">     pointer[1] -= this.offsetY + offsets[1];
</span><span class="cx">     this.event = event;
</span><span class="lines">@@ -261,15 +261,15 @@
</span><span class="cx">     }
</span><span class="cx">     this.active = false;
</span><span class="cx">     this.dragging = false;
</span><del>-  },  
</del><ins>+  },
</ins><span class="cx">   finishDrag: function(event, success) {
</span><span class="cx">     this.active = false;
</span><span class="cx">     this.dragging = false;
</span><span class="cx">     this.updateFinished();
</span><span class="cx">   },
</span><span class="cx">   updateFinished: function() {
</span><del>-    if (this.initialized &amp;&amp; this.options.onChange) 
</del><ins>+    if (this.initialized &amp;&amp; this.options.onChange)
</ins><span class="cx">       this.options.onChange(this.values.length&gt;1 ? this.values : this.value, this);
</span><span class="cx">     this.event = null;
</span><span class="cx">   }
</span><del>-});
</del><ins>+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculoussoundjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/sound.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/sound.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/sound.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>-// script.aculo.us sound.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us sound.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
</ins><span class="cx"> //
</span><span class="cx"> // Based on code created by Jules Gravinese (http://www.webveteran.com/)
</span><span class="cx"> //
</span><span class="lines">@@ -23,23 +23,23 @@
</span><span class="cx">     var options = Object.extend({
</span><span class="cx">       track: 'global', url: url, replace: false
</span><span class="cx">     }, arguments[1] || {});
</span><del>-    
</del><ins>+
</ins><span class="cx">     if(options.replace &amp;&amp; this.tracks[options.track]) {
</span><span class="cx">       $R(0, this.tracks[options.track].id).each(function(id){
</span><span class="cx">         var sound = $('sound_'+options.track+'_'+id);
</span><span class="cx">         sound.Stop &amp;&amp; sound.Stop();
</span><span class="cx">         sound.remove();
</span><del>-      })
</del><ins>+      });
</ins><span class="cx">       this.tracks[options.track] = null;
</span><span class="cx">     }
</span><del>-      
</del><ins>+
</ins><span class="cx">     if(!this.tracks[options.track])
</span><del>-      this.tracks[options.track] = { id: 0 }
</del><ins>+      this.tracks[options.track] = { id: 0 };
</ins><span class="cx">     else
</span><span class="cx">       this.tracks[options.track].id++;
</span><del>-      
</del><ins>+
</ins><span class="cx">     options.id = this.tracks[options.track].id;
</span><del>-    $$('body')[0].insert( 
</del><ins>+    $$('body')[0].insert(
</ins><span class="cx">       Prototype.Browser.IE ? new Element('bgsound',{
</span><span class="cx">         id: 'sound_'+options.track+'_'+options.id,
</span><span class="cx">         src: options.url, loop: 1, autostart: true
</span><span class="lines">@@ -49,7 +49,11 @@
</span><span class="cx"> 
</span><span class="cx"> if(Prototype.Browser.Gecko &amp;&amp; navigator.userAgent.indexOf(&quot;Win&quot;) &gt; 0){
</span><span class="cx">   if(navigator.plugins &amp;&amp; $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
</span><del>-    Sound.template = new Template('&lt;object id=&quot;sound_#{track}_#{id}&quot; width=&quot;0&quot; height=&quot;0&quot; type=&quot;audio/mpeg&quot; data=&quot;#{url}&quot;/&gt;')
</del><ins>+    Sound.template = new Template('&lt;object id=&quot;sound_#{track}_#{id}&quot; width=&quot;0&quot; height=&quot;0&quot; type=&quot;audio/mpeg&quot; data=&quot;#{url}&quot;/&gt;');
+  else if(navigator.plugins &amp;&amp; $A(navigator.plugins).detect(function(p){ return p.name.indexOf('Windows Media') != -1 }))
+    Sound.template = new Template('&lt;object id=&quot;sound_#{track}_#{id}&quot; type=&quot;application/x-mplayer2&quot; data=&quot;#{url}&quot;&gt;&lt;/object&gt;');
+  else if(navigator.plugins &amp;&amp; $A(navigator.plugins).detect(function(p){ return p.name.indexOf('RealPlayer') != -1 }))
+    Sound.template = new Template('&lt;embed type=&quot;audio/x-pn-realaudio-plugin&quot; style=&quot;height:0&quot; id=&quot;sound_#{track}_#{id}&quot; src=&quot;#{url}&quot; loop=&quot;false&quot; autostart=&quot;true&quot; hidden=&quot;true&quot;/&gt;');
</ins><span class="cx">   else
</span><del>-    Sound.play = function(){}
-}
</del><ins>+    Sound.play = function(){};
+} 
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculousunittestjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/unittest.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/unittest.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/unittest.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><del>-// script.aculo.us unittest.js v1.8.0, Tue Nov 06 15:01:40 +0300 2007
</del><ins>+// script.aculo.us unittest.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-//           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
-//           (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/)
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//           (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
+//           (c) 2005-2009 Michael Schuerig (http://www.schuerig.de/michael/)
</ins><span class="cx"> //
</span><span class="cx"> // script.aculo.us is freely distributable under the terms of an MIT-style license.
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="lines">@@ -32,8 +32,8 @@
</span><span class="cx">   this.mark.style.left = options.pointerX + &quot;px&quot;;
</span><span class="cx">   this.mark.style.width = &quot;5px&quot;;
</span><span class="cx">   this.mark.style.height = &quot;5px;&quot;;
</span><del>-  this.mark.style.borderTop = &quot;1px solid red;&quot;
-  this.mark.style.borderLeft = &quot;1px solid red;&quot;
</del><ins>+  this.mark.style.borderTop = &quot;1px solid red;&quot;;
+  this.mark.style.borderLeft = &quot;1px solid red;&quot;;
</ins><span class="cx">   
</span><span class="cx">   if(this.step)
</span><span class="cx">     alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">   }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-var Test = {}
</del><ins>+var Test = {};
</ins><span class="cx"> Test.Unit = {};
</span><span class="cx"> 
</span><span class="cx"> // security exception workaround
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx">     '&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Status&lt;/th&gt;&lt;th&gt;Test&lt;/th&gt;&lt;th&gt;Message&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;' +
</span><span class="cx">     '&lt;tbody id=&quot;loglines&quot;&gt;&lt;/tbody&gt;' +
</span><span class="cx">     '&lt;/table&gt;';
</span><del>-    this.logsummary = $('logsummary')
</del><ins>+    this.logsummary = $('logsummary');
</ins><span class="cx">     this.loglines = $('loglines');
</span><span class="cx">   },
</span><span class="cx">   _toHTML: function(txt) {
</span><span class="lines">@@ -125,15 +125,15 @@
</span><span class="cx">   },
</span><span class="cx">   addLinksToResults: function(){ 
</span><span class="cx">     $$(&quot;tr.failed .nameCell&quot;).each( function(td){ // todo: limit to children of this.log
</span><del>-      td.title = &quot;Run only this test&quot;
</del><ins>+      td.title = &quot;Run only this test&quot;;
</ins><span class="cx">       Event.observe(td, 'click', function(){ window.location.search = &quot;?tests=&quot; + td.innerHTML;});
</span><span class="cx">     });
</span><span class="cx">     $$(&quot;tr.passed .nameCell&quot;).each( function(td){ // todo: limit to children of this.log
</span><del>-      td.title = &quot;Run all tests&quot;
</del><ins>+      td.title = &quot;Run all tests&quot;;
</ins><span class="cx">       Event.observe(td, 'click', function(){ window.location.search = &quot;&quot;;});
</span><span class="cx">     });
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Test.Unit.Runner = Class.create();
</span><span class="cx"> Test.Unit.Runner.prototype = {
</span><span class="lines">@@ -246,7 +246,7 @@
</span><span class="cx">       failures   + &quot; failures, &quot; +
</span><span class="cx">       errors     + &quot; errors&quot;);
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Test.Unit.Assertions = Class.create();
</span><span class="cx"> Test.Unit.Assertions.prototype = {
</span><span class="lines">@@ -331,7 +331,7 @@
</span><span class="cx">     catch(e) { this.error(e); } 
</span><span class="cx">   },
</span><span class="cx">   assertNull: function(obj) {
</span><del>-    var message = arguments[1] || 'assertNull'
</del><ins>+    var message = arguments[1] || 'assertNull';
</ins><span class="cx">     try { (obj==null) ? this.pass() : 
</span><span class="cx">       this.fail(message + ': got &quot;' + Test.Unit.inspect(obj) + '&quot;'); }
</span><span class="cx">     catch(e) { this.error(e); }
</span><span class="lines">@@ -461,7 +461,7 @@
</span><span class="cx">        iterations + ' iterations in ' + (timeTaken/1000)+'s' );
</span><span class="cx">     return timeTaken;
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Test.Unit.Testcase = Class.create();
</span><span class="cx"> Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
</span><span class="lines">@@ -526,7 +526,7 @@
</span><span class="cx">   };
</span><span class="cx">   var makeAssertion = function(assertion, args, object) { 
</span><span class="cx">            this[assertion].apply(this,(args || []).concat([object]));
</span><del>-  }
</del><ins>+  };
</ins><span class="cx">   
</span><span class="cx">   Test.BDDMethods = {};   
</span><span class="cx">   $H(METHODMAP).each(function(pair) { 
</span><span class="lines">@@ -539,7 +539,7 @@
</span><span class="cx">   [Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each(
</span><span class="cx">     function(p){ Object.extend(p, Test.BDDMethods) }
</span><span class="cx">   );
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Test.context = function(name, spec, log){
</span><span class="cx">   Test.setupBDDExtensionMethods();
</span></span></pre></div>
<a id="trunkwpincludesjsscriptaculouswpscriptaculousjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/scriptaculous/wp-scriptaculous.js (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/scriptaculous/wp-scriptaculous.js        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/js/scriptaculous/wp-scriptaculous.js        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><del>-// script.aculo.us scriptaculous.js v1.7.1_beta3, Fri May 25 17:19:41 +0200 2007
</del><ins>+// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
</ins><span class="cx"> 
</span><del>-// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// 
</del><ins>+// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
</ins><span class="cx"> // Permission is hereby granted, free of charge, to any person obtaining
</span><span class="cx"> // a copy of this software and associated documentation files (the
</span><span class="cx"> // &quot;Software&quot;), to deal in the Software without restriction, including
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx"> // distribute, sublicense, and/or sell copies of the Software, and to
</span><span class="cx"> // permit persons to whom the Software is furnished to do so, subject to
</span><span class="cx"> // the following conditions:
</span><del>-// 
</del><ins>+//
</ins><span class="cx"> // The above copyright notice and this permission notice shall be
</span><span class="cx"> // included in all copies or substantial portions of the Software.
</span><span class="cx"> //
</span><span class="lines">@@ -24,36 +24,50 @@
</span><span class="cx"> // For details, see the script.aculo.us web site: http://script.aculo.us/
</span><span class="cx"> 
</span><span class="cx"> var Scriptaculous = {
</span><del>-  Version: '1.8.0',
</del><ins>+  Version: '1.8.3',
</ins><span class="cx">   require: function(libraryName) {
</span><del>-    // inserting via DOM fails in Safari 2.0, so brute force approach
-    document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;'+libraryName+'&quot;&gt;&lt;/script&gt;');
</del><ins>+    try{
+      // inserting via DOM fails in Safari 2.0, so brute force approach
+      document.write('&lt;script type=&quot;text/javascript&quot; src=&quot;'+libraryName+'&quot;&gt;&lt;\/script&gt;');
+    } catch(e) {
+      // for xhtml+xml served content, fall back to DOM methods
+      var script = document.createElement('script');
+      script.type = 'text/javascript';
+      script.src = libraryName;
+      document.getElementsByTagName('head')[0].appendChild(script);
+    }
</ins><span class="cx">   },
</span><del>-  REQUIRED_PROTOTYPE: '1.6',
</del><ins>+  REQUIRED_PROTOTYPE: '1.6.0.3',
</ins><span class="cx">   load: function() {
</span><del>-    function convertVersionString(versionString){
-      var r = versionString.split('.');
-      return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
</del><ins>+    function convertVersionString(versionString) {
+      var v = versionString.replace(/_.*|\./g, '');
+      v = parseInt(v + '0'.times(4-v.length));
+      return versionString.indexOf('_') &gt; -1 ? v-1 : v;
</ins><span class="cx">     }
</span><del>- 
-    if((typeof Prototype=='undefined') || 
-       (typeof Element == 'undefined') || 
</del><ins>+
+    if((typeof Prototype=='undefined') ||
+       (typeof Element == 'undefined') ||
</ins><span class="cx">        (typeof Element.Methods=='undefined') ||
</span><del>-       (convertVersionString(Prototype.Version) &lt; 
</del><ins>+       (convertVersionString(Prototype.Version) &lt;
</ins><span class="cx">         convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
</span><span class="cx">        throw(&quot;script.aculo.us requires the Prototype JavaScript framework &gt;= &quot; +
</span><span class="cx">         Scriptaculous.REQUIRED_PROTOTYPE);
</span><del>-    
-    $A(document.getElementsByTagName(&quot;script&quot;)).findAll( function(s) {
-      return (s.src &amp;&amp; s.src.match(/scriptaculous\.js(\?.*)?$/))
-    }).each( function(s) {
-      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
-      var includes = s.src.match(/\?.*load=([a-z,]*)/);
-      if ( includes )
-       includes[1].split(',').each(
-       function(include) { Scriptaculous.require(path+include+'.js') });
</del><ins>+
+    var js = /scriptaculous\.js(\?.*)?$/;
+    $$('head script[src]').findAll(function(s) {
+      return s.src.match(js);
+    }).each(function(s) {
+                var path = s.src.replace(js, ''),
+                includes = s.src.match(/\?.*load=([a-z,]*)/);
+
+                // Modified for WordPress to work with enqueue_script
+                if ( includes ) {
+                        includes[1].split(',').each( function(include) {
+                                Scriptaculous.require(path+include+'.js')
+                        });
+                }
</ins><span class="cx">     });
</span><span class="cx">   }
</span><del>-}
</del><ins>+};
</ins><span class="cx"> 
</span><span class="cx"> Scriptaculous.load();
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (12556 => 12557)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2009-12-27 21:27:00 UTC (rev 12556)
+++ trunk/wp-includes/script-loader.php        2009-12-27 22:30:58 UTC (rev 12557)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'editor', &quot;/wp-admin/js/editor$suffix.js&quot;, false, '20091124' );
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');
</del><ins>+        $scripts-&gt;add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6.1');
</ins><span class="cx"> 
</span><span class="cx">         $scripts-&gt;add( 'wp-ajax-response', &quot;/wp-includes/js/wp-ajax-response$suffix.js&quot;, array('jquery'), '20091119' );
</span><span class="cx">         $scripts-&gt;add_data( 'wp-ajax-response', 'group', 1 );
</span><span class="lines">@@ -105,14 +105,14 @@
</span><span class="cx">         $scripts-&gt;add( 'wp-lists', &quot;/wp-includes/js/wp-lists$suffix.js&quot;, array('wp-ajax-response'), '20091128' );
</span><span class="cx">         $scripts-&gt;add_data( 'wp-lists', 'group', 1 );
</span><span class="cx"> 
</span><del>-        $scripts-&gt;add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
-        $scripts-&gt;add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
-        $scripts-&gt;add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
-        $scripts-&gt;add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
-        $scripts-&gt;add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.0');
-        $scripts-&gt;add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.0' );
-        $scripts-&gt;add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.0');
-        $scripts-&gt;add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.0');
</del><ins>+        $scripts-&gt;add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.3');
+        $scripts-&gt;add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.3');
+        $scripts-&gt;add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.3');
+        $scripts-&gt;add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.3');
+        $scripts-&gt;add( 'scriptaculous-slider', '/wp-includes/js/scriptaculous/slider.js', array('scriptaculous-effects'), '1.8.3');
+        $scripts-&gt;add( 'scriptaculous-sound', '/wp-includes/js/scriptaculous/sound.js', array( 'scriptaculous-root' ), '1.8.3' );
+        $scripts-&gt;add( 'scriptaculous-controls', '/wp-includes/js/scriptaculous/controls.js', array('scriptaculous-root'), '1.8.3');
+        $scripts-&gt;add( 'scriptaculous', '', array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls'), '1.8.3');
</ins><span class="cx"> 
</span><span class="cx">         // not used in core, replaced by Jcrop.js
</span><span class="cx">         $scripts-&gt;add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop'), '20070118');
</span></span></pre>
</div>
</div>

</body>
</html>