Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / pkgs / ext-foundation-debug.js
index 097d7d2..687eb3d 100644 (file)
 /*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.1.0
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
-/**
- * @class Ext.DomHelper
- * <p>The DomHelper class provides a layer of abstraction from DOM and transparently supports creating
- * elements via DOM or using HTML fragments. It also has the ability to create HTML fragment templates
- * from your DOM building code.</p>
- *
- * <p><b><u>DomHelper element specification object</u></b></p>
- * <p>A specification object is used when creating elements. Attributes of this object
- * are assumed to be element attributes, except for 4 special attributes:
- * <div class="mdetail-params"><ul>
- * <li><b><tt>tag</tt></b> : <div class="sub-desc">The tag name of the element</div></li>
- * <li><b><tt>children</tt></b> : or <tt>cn</tt><div class="sub-desc">An array of the
- * same kind of element definition objects to be created and appended. These can be nested
- * as deep as you want.</div></li>
- * <li><b><tt>cls</tt></b> : <div class="sub-desc">The class attribute of the element.
- * This will end up being either the "class" attribute on a HTML fragment or className
- * for a DOM node, depending on whether DomHelper is using fragments or DOM.</div></li>
- * <li><b><tt>html</tt></b> : <div class="sub-desc">The innerHTML for the element</div></li>
- * </ul></div></p>
- *
- * <p><b><u>Insertion methods</u></b></p>
- * <p>Commonly used insertion methods:
- * <div class="mdetail-params"><ul>
- * <li><b><tt>{@link #append}</tt></b> : <div class="sub-desc"></div></li>
- * <li><b><tt>{@link #insertBefore}</tt></b> : <div class="sub-desc"></div></li>
- * <li><b><tt>{@link #insertAfter}</tt></b> : <div class="sub-desc"></div></li>
- * <li><b><tt>{@link #overwrite}</tt></b> : <div class="sub-desc"></div></li>
- * <li><b><tt>{@link #createTemplate}</tt></b> : <div class="sub-desc"></div></li>
- * <li><b><tt>{@link #insertHtml}</tt></b> : <div class="sub-desc"></div></li>
- * </ul></div></p>
- *
- * <p><b><u>Example</u></b></p>
- * <p>This is an example, where an unordered list with 3 children items is appended to an existing
- * element with id <tt>'my-div'</tt>:<br>
- <pre><code>
-var dh = Ext.DomHelper; // create shorthand alias
-// specification object
-var spec = {
-    id: 'my-ul',
-    tag: 'ul',
-    cls: 'my-list',
-    // append children after creating
-    children: [     // may also specify 'cn' instead of 'children'
-        {tag: 'li', id: 'item0', html: 'List Item 0'},
-        {tag: 'li', id: 'item1', html: 'List Item 1'},
-        {tag: 'li', id: 'item2', html: 'List Item 2'}
-    ]
-};
-var list = dh.append(
-    'my-div', // the context element 'my-div' can either be the id or the actual node
-    spec      // the specification object
-);
- </code></pre></p>
- * <p>Element creation specification parameters in this class may also be passed as an Array of
- * specification objects. This can be used to insert multiple sibling nodes into an existing
- * container very efficiently. For example, to add more list items to the example above:<pre><code>
-dh.append('my-ul', [
-    {tag: 'li', id: 'item3', html: 'List Item 3'},
-    {tag: 'li', id: 'item4', html: 'List Item 4'}
-]);
- * </code></pre></p>
- *
- * <p><b><u>Templating</u></b></p>
- * <p>The real power is in the built-in templating. Instead of creating or appending any elements,
- * <tt>{@link #createTemplate}</tt> returns a Template object which can be used over and over to
- * insert new elements. Revisiting the example above, we could utilize templating this time:
- * <pre><code>
-// create the node
-var list = dh.append('my-div', {tag: 'ul', cls: 'my-list'});
-// get template
-var tpl = dh.createTemplate({tag: 'li', id: 'item{0}', html: 'List Item {0}'});
-
-for(var i = 0; i < 5, i++){
-    tpl.append(list, [i]); // use template to append to the actual node
-}
- * </code></pre></p>
- * <p>An example using a template:<pre><code>
-var html = '<a id="{0}" href="{1}" class="nav">{2}</a>';
-
-var tpl = new Ext.DomHelper.createTemplate(html);
-tpl.append('blog-roll', ['link1', 'http://www.jackslocum.com/', "Jack&#39;s Site"]);
-tpl.append('blog-roll', ['link2', 'http://www.dustindiaz.com/', "Dustin&#39;s Site"]);
- * </code></pre></p>
- *
- * <p>The same example using named parameters:<pre><code>
-var html = '<a id="{id}" href="{url}" class="nav">{text}</a>';
-
-var tpl = new Ext.DomHelper.createTemplate(html);
-tpl.append('blog-roll', {
-    id: 'link1',
-    url: 'http://www.jackslocum.com/',
-    text: "Jack&#39;s Site"
-});
-tpl.append('blog-roll', {
-    id: 'link2',
-    url: 'http://www.dustindiaz.com/',
-    text: "Dustin&#39;s Site"
-});
- * </code></pre></p>
- *
- * <p><b><u>Compiling Templates</u></b></p>
- * <p>Templates are applied using regular expressions. The performance is great, but if
- * you are adding a bunch of DOM elements using the same template, you can increase
- * performance even further by {@link Ext.Template#compile "compiling"} the template.
- * The way "{@link Ext.Template#compile compile()}" works is the template is parsed and
- * broken up at the different variable points and a dynamic function is created and eval'ed.
- * The generated function performs string concatenation of these parts and the passed
- * variables instead of using regular expressions.
- * <pre><code>
-var html = '<a id="{id}" href="{url}" class="nav">{text}</a>';
-
-var tpl = new Ext.DomHelper.createTemplate(html);
-tpl.compile();
-
-//... use template like normal
- * </code></pre></p>
- *
- * <p><b><u>Performance Boost</u></b></p>
- * <p>DomHelper will transparently create HTML fragments when it can. Using HTML fragments instead
- * of DOM can significantly boost performance.</p>
- * <p>Element creation specification parameters may also be strings. If {@link #useDom} is <tt>false</tt>,
- * then the string is used as innerHTML. If {@link #useDom} is <tt>true</tt>, a string specification
- * results in the creation of a text node. Usage:</p>
- * <pre><code>
-Ext.DomHelper.useDom = true; // force it to use DOM; reduces performance
- * </code></pre>
- * @singleton
- */
-Ext.DomHelper = function(){
-    var tempTableEl = null,
-       emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
-       tableRe = /^table|tbody|tr|td$/i,
-       pub,
-       // kill repeat to save bytes
-       afterbegin = "afterbegin",
-       afterend = "afterend",
-       beforebegin = "beforebegin",
-       beforeend = "beforeend",
-       ts = '<table>',
-        te = '</table>',
-        tbs = ts+'<tbody>',
-        tbe = '</tbody>'+te,
-        trs = tbs + '<tr>',
-        tre = '</tr>'+tbe;
-
-    // private
-    function doInsert(el, o, returnElement, pos, sibling, append){
-        var newNode = pub.insertHtml(pos, Ext.getDom(el), createHtml(o));
-        return returnElement ? Ext.get(newNode, true) : newNode;
-    }
-
-    // build as innerHTML where available
-    function createHtml(o){
-           var b = "",
-               attr,
-               val,
-               key,
-               keyVal,
-               cn;
-
-        if(typeof o == 'string'){
-            b = o;
-        } else if (Ext.isArray(o)) {
-               Ext.each(o, function(v) {
-                b += createHtml(v);
-            });
-        } else {
-               b += "<" + (o.tag = o.tag || "div");
-            Ext.iterate(o, function(attr, val){
-                if(!/tag|children|cn|html$/i.test(attr)){
-                    if (Ext.isObject(val)) {
-                        b += " " + attr + "='";
-                        Ext.iterate(val, function(key, keyVal){
-                            b += key + ":" + keyVal + ";";
-                        });
-                        b += "'";
-                    }else{
-                        b += " " + ({cls : "class", htmlFor : "for"}[attr] || attr) + "='" + val + "'";
-                    }
-                }
-            });
-               // Now either just close the tag or try to add children and close the tag.
-               if (emptyTags.test(o.tag)) {
-                   b += "/>";
-               } else {
-                   b += ">";
-                   if ((cn = o.children || o.cn)) {
-                       b += createHtml(cn);
-                   } else if(o.html){
-                       b += o.html;
-                   }
-                   b += "</" + o.tag + ">";
-               }
-        }
-        return b;
-    }
-
-    function ieTable(depth, s, h, e){
-        tempTableEl.innerHTML = [s, h, e].join('');
-        var i = -1,
-               el = tempTableEl;
-        while(++i < depth){
-            el = el.firstChild;
-        }
-        return el;
-    }
-
-    /**
-     * @ignore
-     * Nasty code for IE's broken table implementation
-     */
-    function insertIntoTable(tag, where, el, html) {
-           var node,
-               before;
-
-        tempTableEl = tempTableEl || document.createElement('div');
-
-           if(tag == 'td' && (where == afterbegin || where == beforeend) ||
-              !/td|tr|tbody/i.test(tag) && (where == beforebegin || where == afterend)) {
-            return;
-        }
-        before = where == beforebegin ? el :
-                                where == afterend ? el.nextSibling :
-                                where == afterbegin ? el.firstChild : null;
-
-        if (where == beforebegin || where == afterend) {
-               el = el.parentNode;
-       }
-
-        if (tag == 'td' || (tag == "tr" && (where == beforeend || where == afterbegin))) {
-               node = ieTable(4, trs, html, tre);
-        } else if ((tag == "tbody" && (where == beforeend || where == afterbegin)) ||
-                          (tag == "tr" && (where == beforebegin || where == afterend))) {
-               node = ieTable(3, tbs, html, tbe);
-        } else {
-               node = ieTable(2, ts, html, te);
-        }
-        el.insertBefore(node, before);
-        return node;
-    }
-
-
-    pub = {
-           /**
-            * Returns the markup for the passed Element(s) config.
-            * @param {Object} o The DOM object spec (and children)
-            * @return {String}
-            */
-           markup : function(o){
-               return createHtml(o);
-           },
-
-           /**
-            * Inserts an HTML fragment into the DOM.
-            * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.
-            * @param {HTMLElement} el The context element
-            * @param {String} html The HTML fragmenet
-            * @return {HTMLElement} The new node
-            */
-           insertHtml : function(where, el, html){
-               var hash = {},
-                       hashVal,
-                       setStart,
-                       range,
-                       frag,
-                       rangeEl,
-                       rs;
-
-               where = where.toLowerCase();
-               // add these here because they are used in both branches of the condition.
-               hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
-               hash[afterend] = ['AfterEnd', 'nextSibling'];
-
-               if (el.insertAdjacentHTML) {
-                   if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
-                       return rs;
-                   }
-                   // add these two to the hash.
-                   hash[afterbegin] = ['AfterBegin', 'firstChild'];
-                   hash[beforeend] = ['BeforeEnd', 'lastChild'];
-                   if ((hashVal = hash[where])) {
-                               el.insertAdjacentHTML(hashVal[0], html);
-                       return el[hashVal[1]];
-                   }
-               } else {
-                       range = el.ownerDocument.createRange();
-                       setStart = "setStart" + (/end/i.test(where) ? "After" : "Before");
-                       if (hash[where]) {
-                               range[setStart](el);
-                               frag = range.createContextualFragment(html);
-                               el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
-                               return el[(where == beforebegin ? "previous" : "next") + "Sibling"];
-                       } else {
-                               rangeEl = (where == afterbegin ? "first" : "last") + "Child";
-                               if (el.firstChild) {
-                                       range[setStart](el[rangeEl]);
-                                       frag = range.createContextualFragment(html);
-                        if(where == afterbegin){
-                            el.insertBefore(frag, el.firstChild);
-                        }else{
-                            el.appendChild(frag);
-                        }
-                               } else {
-                                   el.innerHTML = html;
-                           }
-                           return el[rangeEl];
-                       }
-               }
-               throw 'Illegal insertion point -> "' + where + '"';
-           },
-
-           /**
-            * Creates new DOM element(s) and inserts them before el.
-            * @param {Mixed} el The context element
-            * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
-            * @param {Boolean} returnElement (optional) true to return a Ext.Element
-            * @return {HTMLElement/Ext.Element} The new node
-            */
-           insertBefore : function(el, o, returnElement){
-               return doInsert(el, o, returnElement, beforebegin);
-           },
-
-           /**
-            * Creates new DOM element(s) and inserts them after el.
-            * @param {Mixed} el The context element
-            * @param {Object} o The DOM object spec (and children)
-            * @param {Boolean} returnElement (optional) true to return a Ext.Element
-            * @return {HTMLElement/Ext.Element} The new node
-            */
-           insertAfter : function(el, o, returnElement){
-               return doInsert(el, o, returnElement, afterend, "nextSibling");
-           },
-
-           /**
-            * Creates new DOM element(s) and inserts them as the first child of el.
-            * @param {Mixed} el The context element
-            * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
-            * @param {Boolean} returnElement (optional) true to return a Ext.Element
-            * @return {HTMLElement/Ext.Element} The new node
-            */
-           insertFirst : function(el, o, returnElement){
-               return doInsert(el, o, returnElement, afterbegin, "firstChild");
-           },
-
-           /**
-            * Creates new DOM element(s) and appends them to el.
-            * @param {Mixed} el The context element
-            * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
-            * @param {Boolean} returnElement (optional) true to return a Ext.Element
-            * @return {HTMLElement/Ext.Element} The new node
-            */
-           append : function(el, o, returnElement){
-                   return doInsert(el, o, returnElement, beforeend, "", true);
-           },
-
-           /**
-            * Creates new DOM element(s) and overwrites the contents of el with them.
-            * @param {Mixed} el The context element
-            * @param {Object/String} o The DOM object spec (and children) or raw HTML blob
-            * @param {Boolean} returnElement (optional) true to return a Ext.Element
-            * @return {HTMLElement/Ext.Element} The new node
-            */
-           overwrite : function(el, o, returnElement){
-               el = Ext.getDom(el);
-               el.innerHTML = createHtml(o);
-               return returnElement ? Ext.get(el.firstChild) : el.firstChild;
-           },
-
-           createHtml : createHtml
-    };
-    return pub;
+/**\r
+ * @class Ext.DomHelper\r
+ * <p>The DomHelper class provides a layer of abstraction from DOM and transparently supports creating\r
+ * elements via DOM or using HTML fragments. It also has the ability to create HTML fragment templates\r
+ * from your DOM building code.</p>\r
+ *\r
+ * <p><b><u>DomHelper element specification object</u></b></p>\r
+ * <p>A specification object is used when creating elements. Attributes of this object\r
+ * are assumed to be element attributes, except for 4 special attributes:\r
+ * <div class="mdetail-params"><ul>\r
+ * <li><b><tt>tag</tt></b> : <div class="sub-desc">The tag name of the element</div></li>\r
+ * <li><b><tt>children</tt></b> : or <tt>cn</tt><div class="sub-desc">An array of the\r
+ * same kind of element definition objects to be created and appended. These can be nested\r
+ * as deep as you want.</div></li>\r
+ * <li><b><tt>cls</tt></b> : <div class="sub-desc">The class attribute of the element.\r
+ * This will end up being either the "class" attribute on a HTML fragment or className\r
+ * for a DOM node, depending on whether DomHelper is using fragments or DOM.</div></li>\r
+ * <li><b><tt>html</tt></b> : <div class="sub-desc">The innerHTML for the element</div></li>\r
+ * </ul></div></p>\r
+ *\r
+ * <p><b><u>Insertion methods</u></b></p>\r
+ * <p>Commonly used insertion methods:\r
+ * <div class="mdetail-params"><ul>\r
+ * <li><b><tt>{@link #append}</tt></b> : <div class="sub-desc"></div></li>\r
+ * <li><b><tt>{@link #insertBefore}</tt></b> : <div class="sub-desc"></div></li>\r
+ * <li><b><tt>{@link #insertAfter}</tt></b> : <div class="sub-desc"></div></li>\r
+ * <li><b><tt>{@link #overwrite}</tt></b> : <div class="sub-desc"></div></li>\r
+ * <li><b><tt>{@link #createTemplate}</tt></b> : <div class="sub-desc"></div></li>\r
+ * <li><b><tt>{@link #insertHtml}</tt></b> : <div class="sub-desc"></div></li>\r
+ * </ul></div></p>\r
+ *\r
+ * <p><b><u>Example</u></b></p>\r
+ * <p>This is an example, where an unordered list with 3 children items is appended to an existing\r
+ * element with id <tt>'my-div'</tt>:<br>\r
+ <pre><code>\r
+var dh = Ext.DomHelper; // create shorthand alias\r
+// specification object\r
+var spec = {\r
+    id: 'my-ul',\r
+    tag: 'ul',\r
+    cls: 'my-list',\r
+    // append children after creating\r
+    children: [     // may also specify 'cn' instead of 'children'\r
+        {tag: 'li', id: 'item0', html: 'List Item 0'},\r
+        {tag: 'li', id: 'item1', html: 'List Item 1'},\r
+        {tag: 'li', id: 'item2', html: 'List Item 2'}\r
+    ]\r
+};\r
+var list = dh.append(\r
+    'my-div', // the context element 'my-div' can either be the id or the actual node\r
+    spec      // the specification object\r
+);\r
+ </code></pre></p>\r
+ * <p>Element creation specification parameters in this class may also be passed as an Array of\r
+ * specification objects. This can be used to insert multiple sibling nodes into an existing\r
+ * container very efficiently. For example, to add more list items to the example above:<pre><code>\r
+dh.append('my-ul', [\r
+    {tag: 'li', id: 'item3', html: 'List Item 3'},\r
+    {tag: 'li', id: 'item4', html: 'List Item 4'}\r
+]);\r
+ * </code></pre></p>\r
+ *\r
+ * <p><b><u>Templating</u></b></p>\r
+ * <p>The real power is in the built-in templating. Instead of creating or appending any elements,\r
+ * <tt>{@link #createTemplate}</tt> returns a Template object which can be used over and over to\r
+ * insert new elements. Revisiting the example above, we could utilize templating this time:\r
+ * <pre><code>\r
+// create the node\r
+var list = dh.append('my-div', {tag: 'ul', cls: 'my-list'});\r
+// get template\r
+var tpl = dh.createTemplate({tag: 'li', id: 'item{0}', html: 'List Item {0}'});\r
+\r
+for(var i = 0; i < 5, i++){\r
+    tpl.append(list, [i]); // use template to append to the actual node\r
+}\r
+ * </code></pre></p>\r
+ * <p>An example using a template:<pre><code>\r
+var html = '<a id="{0}" href="{1}" class="nav">{2}</a>';\r
+\r
+var tpl = new Ext.DomHelper.createTemplate(html);\r
+tpl.append('blog-roll', ['link1', 'http://www.jackslocum.com/', "Jack&#39;s Site"]);\r
+tpl.append('blog-roll', ['link2', 'http://www.dustindiaz.com/', "Dustin&#39;s Site"]);\r
+ * </code></pre></p>\r
+ *\r
+ * <p>The same example using named parameters:<pre><code>\r
+var html = '<a id="{id}" href="{url}" class="nav">{text}</a>';\r
+\r
+var tpl = new Ext.DomHelper.createTemplate(html);\r
+tpl.append('blog-roll', {\r
+    id: 'link1',\r
+    url: 'http://www.jackslocum.com/',\r
+    text: "Jack&#39;s Site"\r
+});\r
+tpl.append('blog-roll', {\r
+    id: 'link2',\r
+    url: 'http://www.dustindiaz.com/',\r
+    text: "Dustin&#39;s Site"\r
+});\r
+ * </code></pre></p>\r
+ *\r
+ * <p><b><u>Compiling Templates</u></b></p>\r
+ * <p>Templates are applied using regular expressions. The performance is great, but if\r
+ * you are adding a bunch of DOM elements using the same template, you can increase\r
+ * performance even further by {@link Ext.Template#compile "compiling"} the template.\r
+ * The way "{@link Ext.Template#compile compile()}" works is the template is parsed and\r
+ * broken up at the different variable points and a dynamic function is created and eval'ed.\r
+ * The generated function performs string concatenation of these parts and the passed\r
+ * variables instead of using regular expressions.\r
+ * <pre><code>\r
+var html = '<a id="{id}" href="{url}" class="nav">{text}</a>';\r
+\r
+var tpl = new Ext.DomHelper.createTemplate(html);\r
+tpl.compile();\r
+\r
+//... use template like normal\r
+ * </code></pre></p>\r
+ *\r
+ * <p><b><u>Performance Boost</u></b></p>\r
+ * <p>DomHelper will transparently create HTML fragments when it can. Using HTML fragments instead\r
+ * of DOM can significantly boost performance.</p>\r
+ * <p>Element creation specification parameters may also be strings. If {@link #useDom} is <tt>false</tt>,\r
+ * then the string is used as innerHTML. If {@link #useDom} is <tt>true</tt>, a string specification\r
+ * results in the creation of a text node. Usage:</p>\r
+ * <pre><code>\r
+Ext.DomHelper.useDom = true; // force it to use DOM; reduces performance\r
+ * </code></pre>\r
+ * @singleton\r
+ */\r
+Ext.DomHelper = function(){\r
+    var tempTableEl = null,\r
+        emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,\r
+        tableRe = /^table|tbody|tr|td$/i,\r
+        pub,\r
+        // kill repeat to save bytes\r
+        afterbegin = 'afterbegin',\r
+        afterend = 'afterend',\r
+        beforebegin = 'beforebegin',\r
+        beforeend = 'beforeend',\r
+        ts = '<table>',\r
+        te = '</table>',\r
+        tbs = ts+'<tbody>',\r
+        tbe = '</tbody>'+te,\r
+        trs = tbs + '<tr>',\r
+        tre = '</tr>'+tbe;\r
+\r
+    // private\r
+    function doInsert(el, o, returnElement, pos, sibling, append){\r
+        var newNode = pub.insertHtml(pos, Ext.getDom(el), createHtml(o));\r
+        return returnElement ? Ext.get(newNode, true) : newNode;\r
+    }\r
+\r
+    // build as innerHTML where available\r
+    function createHtml(o){\r
+        var b = '',\r
+            attr,\r
+            val,\r
+            key,\r
+            keyVal,\r
+            cn;\r
+\r
+        if(Ext.isString(o)){\r
+            b = o;\r
+        } else if (Ext.isArray(o)) {\r
+            for (var i=0; i < o.length; i++) {\r
+                if(o[i]) {\r
+                    b += createHtml(o[i]);\r
+                }\r
+            };\r
+        } else {\r
+            b += '<' + (o.tag = o.tag || 'div');\r
+            Ext.iterate(o, function(attr, val){\r
+                if(!/tag|children|cn|html$/i.test(attr)){\r
+                    if (Ext.isObject(val)) {\r
+                        b += ' ' + attr + '="';\r
+                        Ext.iterate(val, function(key, keyVal){\r
+                            b += key + ':' + keyVal + ';';\r
+                        });\r
+                        b += '"';\r
+                    }else{\r
+                        b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"';\r
+                    }\r
+                }\r
+            });\r
+            // Now either just close the tag or try to add children and close the tag.\r
+            if (emptyTags.test(o.tag)) {\r
+                b += '/>';\r
+            } else {\r
+                b += '>';\r
+                if ((cn = o.children || o.cn)) {\r
+                    b += createHtml(cn);\r
+                } else if(o.html){\r
+                    b += o.html;\r
+                }\r
+                b += '</' + o.tag + '>';\r
+            }\r
+        }\r
+        return b;\r
+    }\r
+\r
+    function ieTable(depth, s, h, e){\r
+        tempTableEl.innerHTML = [s, h, e].join('');\r
+        var i = -1,\r
+            el = tempTableEl,\r
+            ns;\r
+        while(++i < depth){\r
+            el = el.firstChild;\r
+        }\r
+//      If the result is multiple siblings, then encapsulate them into one fragment.\r
+        if(ns = el.nextSibling){\r
+            var df = document.createDocumentFragment();\r
+            while(el){\r
+                ns = el.nextSibling;\r
+                df.appendChild(el);\r
+                el = ns;\r
+            }\r
+            el = df;\r
+        }\r
+        return el;\r
+    }\r
+\r
+    /**\r
+     * @ignore\r
+     * Nasty code for IE's broken table implementation\r
+     */\r
+    function insertIntoTable(tag, where, el, html) {\r
+        var node,\r
+            before;\r
+\r
+        tempTableEl = tempTableEl || document.createElement('div');\r
+\r
+        if(tag == 'td' && (where == afterbegin || where == beforeend) ||\r
+           !/td|tr|tbody/i.test(tag) && (where == beforebegin || where == afterend)) {\r
+            return;\r
+        }\r
+        before = where == beforebegin ? el :\r
+                 where == afterend ? el.nextSibling :\r
+                 where == afterbegin ? el.firstChild : null;\r
+\r
+        if (where == beforebegin || where == afterend) {\r
+            el = el.parentNode;\r
+        }\r
+\r
+        if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {\r
+            node = ieTable(4, trs, html, tre);\r
+        } else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||\r
+                   (tag == 'tr' && (where == beforebegin || where == afterend))) {\r
+            node = ieTable(3, tbs, html, tbe);\r
+        } else {\r
+            node = ieTable(2, ts, html, te);\r
+        }\r
+        el.insertBefore(node, before);\r
+        return node;\r
+    }\r
+\r
+\r
+    pub = {\r
+        /**\r
+         * Returns the markup for the passed Element(s) config.\r
+         * @param {Object} o The DOM object spec (and children)\r
+         * @return {String}\r
+         */\r
+        markup : function(o){\r
+            return createHtml(o);\r
+        },\r
+        \r
+        /**\r
+         * Applies a style specification to an element.\r
+         * @param {String/HTMLElement} el The element to apply styles to\r
+         * @param {String/Object/Function} styles A style specification string e.g. 'width:100px', or object in the form {width:'100px'}, or\r
+         * a function which returns such a specification.\r
+         */\r
+        applyStyles : function(el, styles){\r
+            if(styles){\r
+                var i = 0,\r
+                    len,\r
+                    style;\r
+\r
+                el = Ext.fly(el);\r
+                if(Ext.isFunction(styles)){\r
+                    styles = styles.call();\r
+                }\r
+                if(Ext.isString(styles)){\r
+                    styles = styles.trim().split(/\s*(?::|;)\s*/);\r
+                    for(len = styles.length; i < len;){\r
+                        el.setStyle(styles[i++], styles[i++]);\r
+                    }\r
+                }else if (Ext.isObject(styles)){\r
+                    el.setStyle(styles);\r
+                }\r
+            }\r
+        },\r
+\r
+        /**\r
+         * Inserts an HTML fragment into the DOM.\r
+         * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd.\r
+         * @param {HTMLElement} el The context element\r
+         * @param {String} html The HTML fragment\r
+         * @return {HTMLElement} The new node\r
+         */\r
+        insertHtml : function(where, el, html){\r
+            var hash = {},\r
+                hashVal,\r
+                setStart,\r
+                range,\r
+                frag,\r
+                rangeEl,\r
+                rs;\r
+\r
+            where = where.toLowerCase();\r
+            // add these here because they are used in both branches of the condition.\r
+            hash[beforebegin] = ['BeforeBegin', 'previousSibling'];\r
+            hash[afterend] = ['AfterEnd', 'nextSibling'];\r
+\r
+            if (el.insertAdjacentHTML) {\r
+                if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){\r
+                    return rs;\r
+                }\r
+                // add these two to the hash.\r
+                hash[afterbegin] = ['AfterBegin', 'firstChild'];\r
+                hash[beforeend] = ['BeforeEnd', 'lastChild'];\r
+                if ((hashVal = hash[where])) {\r
+                    el.insertAdjacentHTML(hashVal[0], html);\r
+                    return el[hashVal[1]];\r
+                }\r
+            } else {\r
+                range = el.ownerDocument.createRange();\r
+                setStart = 'setStart' + (/end/i.test(where) ? 'After' : 'Before');\r
+                if (hash[where]) {\r
+                    range[setStart](el);\r
+                    frag = range.createContextualFragment(html);\r
+                    el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);\r
+                    return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];\r
+                } else {\r
+                    rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';\r
+                    if (el.firstChild) {\r
+                        range[setStart](el[rangeEl]);\r
+                        frag = range.createContextualFragment(html);\r
+                        if(where == afterbegin){\r
+                            el.insertBefore(frag, el.firstChild);\r
+                        }else{\r
+                            el.appendChild(frag);\r
+                        }\r
+                    } else {\r
+                        el.innerHTML = html;\r
+                    }\r
+                    return el[rangeEl];\r
+                }\r
+            }\r
+            throw 'Illegal insertion point -> "' + where + '"';\r
+        },\r
+\r
+        /**\r
+         * Creates new DOM element(s) and inserts them before el.\r
+         * @param {Mixed} el The context element\r
+         * @param {Object/String} o The DOM object spec (and children) or raw HTML blob\r
+         * @param {Boolean} returnElement (optional) true to return a Ext.Element\r
+         * @return {HTMLElement/Ext.Element} The new node\r
+         */\r
+        insertBefore : function(el, o, returnElement){\r
+            return doInsert(el, o, returnElement, beforebegin);\r
+        },\r
+\r
+        /**\r
+         * Creates new DOM element(s) and inserts them after el.\r
+         * @param {Mixed} el The context element\r
+         * @param {Object} o The DOM object spec (and children)\r
+         * @param {Boolean} returnElement (optional) true to return a Ext.Element\r
+         * @return {HTMLElement/Ext.Element} The new node\r
+         */\r
+        insertAfter : function(el, o, returnElement){\r
+            return doInsert(el, o, returnElement, afterend, 'nextSibling');\r
+        },\r
+\r
+        /**\r
+         * Creates new DOM element(s) and inserts them as the first child of el.\r
+         * @param {Mixed} el The context element\r
+         * @param {Object/String} o The DOM object spec (and children) or raw HTML blob\r
+         * @param {Boolean} returnElement (optional) true to return a Ext.Element\r
+         * @return {HTMLElement/Ext.Element} The new node\r
+         */\r
+        insertFirst : function(el, o, returnElement){\r
+            return doInsert(el, o, returnElement, afterbegin, 'firstChild');\r
+        },\r
+\r
+        /**\r
+         * Creates new DOM element(s) and appends them to el.\r
+         * @param {Mixed} el The context element\r
+         * @param {Object/String} o The DOM object spec (and children) or raw HTML blob\r
+         * @param {Boolean} returnElement (optional) true to return a Ext.Element\r
+         * @return {HTMLElement/Ext.Element} The new node\r
+         */\r
+        append : function(el, o, returnElement){\r
+            return doInsert(el, o, returnElement, beforeend, '', true);\r
+        },\r
+\r
+        /**\r
+         * Creates new DOM element(s) and overwrites the contents of el with them.\r
+         * @param {Mixed} el The context element\r
+         * @param {Object/String} o The DOM object spec (and children) or raw HTML blob\r
+         * @param {Boolean} returnElement (optional) true to return a Ext.Element\r
+         * @return {HTMLElement/Ext.Element} The new node\r
+         */\r
+        overwrite : function(el, o, returnElement){\r
+            el = Ext.getDom(el);\r
+            el.innerHTML = createHtml(o);\r
+            return returnElement ? Ext.get(el.firstChild) : el.firstChild;\r
+        },\r
+\r
+        createHtml : createHtml\r
+    };\r
+    return pub;\r
 }();/**\r
  * @class Ext.DomHelper\r
  */\r
@@ -436,7 +476,7 @@ function(){
                        }\r
                 }\r
             });\r
-            pub.applyStyles(el, o.style);\r
+            Ext.DomHelper.applyStyles(el, o.style);\r
 \r
             if ((cn = o.children || o.cn)) {\r
                 createDom(cn, el);\r
@@ -464,33 +504,6 @@ function(){
                /** True to force the use of DOM instead of html fragments @type Boolean */\r
            useDom : false,\r
 \r
-           /**\r
-            * Applies a style specification to an element.\r
-            * @param {String/HTMLElement} el The element to apply styles to\r
-            * @param {String/Object/Function} styles A style specification string e.g. 'width:100px', or object in the form {width:'100px'}, or\r
-            * a function which returns such a specification.\r
-            */\r
-           applyStyles : function(el, styles){\r
-                   if(styles){\r
-                               var i = 0,\r
-                               len,\r
-                               style;\r
-\r
-                       el = Ext.fly(el);\r
-                               if(Ext.isFunction(styles)){\r
-                                       styles = styles.call();\r
-                               }\r
-                               if(Ext.isString(styles)){\r
-                                       styles = styles.trim().split(/\s*(?::|;)\s*/);\r
-                                       for(len = styles.length; i < len;){\r
-                                               el.setStyle(styles[i++], styles[i++]);\r
-                                       }\r
-                               }else if (Ext.isObject(styles)){\r
-                                       el.setStyle(styles);\r
-                               }\r
-                       }\r
-           },\r
-\r
            /**\r
             * Creates new DOM element(s) and inserts them before el.\r
             * @param {Mixed} el The context element\r
@@ -549,19 +562,58 @@ function(){
        return pub;\r
 }());/**
  * @class Ext.Template
- * Represents an HTML fragment template. Templates can be precompiled for greater performance.
- * For a list of available format functions, see {@link Ext.util.Format}.<br />
- * Usage:
+ * <p>Represents an HTML fragment template. Templates may be {@link #compile precompiled}
+ * for greater performance.</p>
+ * <p>For example usage {@link #Template see the constructor}.</p>
+ * 
+ * @constructor
+ * An instance of this class may be created by passing to the constructor either
+ * a single argument, or multiple arguments:
+ * <div class="mdetail-params"><ul>
+ * <li><b>single argument</b> : String/Array
+ * <div class="sub-desc">
+ * The single argument may be either a String or an Array:<ul>
+ * <li><tt>String</tt> : </li><pre><code>
+var t = new Ext.Template("&lt;div>Hello {0}.&lt;/div>");
+t.{@link #append}('some-element', ['foo']);
+ * </code></pre>
+ * <li><tt>Array</tt> : </li>
+ * An Array will be combined with <code>join('')</code>.
 <pre><code>
-var t = new Ext.Template(
+var t = new Ext.Template([
     '&lt;div name="{id}"&gt;',
         '&lt;span class="{cls}"&gt;{name:trim} {value:ellipsis(10)}&lt;/span&gt;',
-    '&lt;/div&gt;'
-);
-t.append('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});
+    '&lt;/div&gt;',
+]);
+t.{@link #compile}();
+t.{@link #append}('some-element', {id: 'myid', cls: 'myclass', name: 'foo', value: 'bar'});
 </code></pre>
- * @constructor
- * @param {String/Array} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("")
+ * </ul></div></li>
+ * <li><b>multiple arguments</b> : String, Object, Array, ...
+ * <div class="sub-desc">
+ * Multiple arguments will be combined with <code>join('')</code>.
+ * <pre><code>
+var t = new Ext.Template(
+    '&lt;div name="{id}"&gt;',
+        '&lt;span class="{cls}"&gt;{name} {value}&lt;/span&gt;',
+    '&lt;/div&gt;',
+    // a configuration object:
+    {
+        compiled: true,      // {@link #compile} immediately
+        disableFormats: true // See Notes below.
+    } 
+);
+ * </code></pre>
+ * <p><b>Notes</b>:</p>
+ * <div class="mdetail-params"><ul>
+ * <li>Formatting and <code>disableFormats</code> are not applicable for Ext Core.</li>
+ * <li>For a list of available format functions, see {@link Ext.util.Format}.</li>
+ * <li><code>disableFormats</code> reduces <code>{@link #apply}</code> time
+ * when no formatting is required.</li>
+ * </ul></div>
+ * </div></li>
+ * </ul></div>
+ * @param {Mixed} config
  */
 Ext.Template = function(html){
     var me = this,
@@ -583,14 +635,35 @@ Ext.Template = function(html){
 
     /**@private*/
     me.html = html;
+    /**
+     * @cfg {Boolean} compiled Specify <tt>true</tt> to compile the template
+     * immediately (see <code>{@link #compile}</code>).
+     * Defaults to <tt>false</tt>.
+     */
     if (me.compiled) {
         me.compile();
     }
 };
 Ext.Template.prototype = {
     /**
-     * Returns an HTML fragment of this template with the specified values applied.
-     * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
+     * @cfg {RegExp} re The regular expression used to match template variables.
+     * Defaults to:<pre><code>
+     * re : /\{([\w-]+)\}/g                                     // for Ext Core
+     * re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g      // for Ext JS
+     * </code></pre>
+     */
+    re : /\{([\w-]+)\}/g,
+    /**
+     * See <code>{@link #re}</code>.
+     * @type RegExp
+     * @property re
+     */
+
+    /**
+     * Returns an HTML fragment of this template with the specified <code>values</code> applied.
+     * @param {Object/Array} values
+     * The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
+     * or an object (i.e. <code>{foo: 'bar'}</code>).
      * @return {String} The HTML fragment
      */
     applyTemplate : function(values){
@@ -616,13 +689,6 @@ Ext.Template.prototype = {
         return compile ? me.compile() : me;
     },
 
-    /**
-    * The regular expression used to match template variables
-    * @type RegExp
-    * @property
-    */
-    re : /\{([\w-]+)\}/g,
-
     /**
      * Compiles the template into an internal function, eliminating the RegEx overhead.
      * @return {Ext.Template} this
@@ -676,10 +742,14 @@ Ext.Template.prototype = {
     },
 
     /**
-     * Applies the supplied values to the template and appends the new node(s) to el.
+     * Applies the supplied <code>values</code> to the template and appends
+     * the new node(s) to the specified <code>el</code>.
+     * <p>For example usage {@link #Template see the constructor}.</p>
      * @param {Mixed} el The context element
-     * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
-     * @param {Boolean} returnElement (optional) true to return a Ext.Element (defaults to undefined)
+     * @param {Object/Array} values
+     * The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
+     * or an object (i.e. <code>{foo: 'bar'}</code>).
+     * @param {Boolean} returnElement (optional) true to return an Ext.Element (defaults to undefined)
      * @return {HTMLElement/Ext.Element} The new node or Element
      */
     append : function(el, values, returnElement){
@@ -707,8 +777,10 @@ Ext.Template.prototype = {
 };
 /**
  * Alias for {@link #applyTemplate}
- * Returns an HTML fragment of this template with the specified values applied.
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
+ * Returns an HTML fragment of this template with the specified <code>values</code> applied.
+ * @param {Object/Array} values
+ * The template values. Can be an array if the params are numeric (i.e. <code>{0}</code>)
+ * or an object (i.e. <code>{foo: 'bar'}</code>).
  * @return {String} The HTML fragment
  * @member Ext.Template
  * @method apply
@@ -730,14 +802,47 @@ Ext.Template.from = function(el, config){
  */\r
 Ext.apply(Ext.Template.prototype, {\r
     /**\r
-     * Returns an HTML fragment of this template with the specified values applied.\r
-     * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})\r
-     * @return {String} The HTML fragment\r
-     * @hide repeat doc\r
+     * @cfg {Boolean} disableFormats Specify <tt>true</tt> to disable format\r
+     * functions in the template. If the template does not contain\r
+     * {@link Ext.util.Format format functions}, setting <code>disableFormats</code>\r
+     * to true will reduce <code>{@link #apply}</code> time. Defaults to <tt>false</tt>.\r
+     * <pre><code>\r
+var t = new Ext.Template(\r
+    '&lt;div name="{id}"&gt;',\r
+        '&lt;span class="{cls}"&gt;{name} {value}&lt;/span&gt;',\r
+    '&lt;/div&gt;',\r
+    {\r
+        compiled: true,      // {@link #compile} immediately\r
+        disableFormats: true // reduce <code>{@link #apply}</code> time since no formatting\r
+    }    \r
+);\r
+     * </code></pre>\r
+     * For a list of available format functions, see {@link Ext.util.Format}.\r
      */\r
-    applyTemplate : function(values){\r
-               var me = this,\r
-                       useF = me.disableFormats !== true,\r
+    disableFormats : false,                            \r
+    /**\r
+     * See <code>{@link #disableFormats}</code>.\r
+     * @type Boolean\r
+     * @property disableFormats\r
+     */\r
+\r
+    /**\r
+     * The regular expression used to match template variables\r
+     * @type RegExp\r
+     * @property\r
+     * @hide repeat doc\r
+     */\r
+    re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,\r
+\r
+    /**\r
+     * Returns an HTML fragment of this template with the specified values applied.\r
+     * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})\r
+     * @return {String} The HTML fragment\r
+     * @hide repeat doc\r
+     */\r
+    applyTemplate : function(values){\r
+               var me = this,\r
+                       useF = me.disableFormats !== true,\r
                fm = Ext.util.Format, \r
                tpl = me;           \r
            \r
@@ -771,21 +876,6 @@ Ext.apply(Ext.Template.prototype, {
         return me.html.replace(me.re, fn);\r
     },\r
                \r
-    /**\r
-     * <tt>true</tt> to disable format functions (defaults to <tt>false</tt>)\r
-     * @type Boolean\r
-     * @property\r
-     */\r
-    disableFormats : false,                            \r
-       \r
-    /**\r
-     * The regular expression used to match template variables\r
-     * @type RegExp\r
-     * @property\r
-     * @hide repeat doc\r
-     */\r
-    re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,\r
-    \r
     /**\r
      * Compiles the template into an internal function, eliminating the RegEx overhead.\r
      * @return {Ext.Template} this\r
@@ -913,7 +1003,6 @@ Ext.DomQuery = function(){
            // IE runs the same speed using setAttribute, however FF slows way down\r
            // and Safari completely fails so they need to continue to use expandos.\r
            isIE = window.ActiveXObject ? true : false,\r
-        isOpera = Ext.isOpera,\r
            key = 30803;\r
            \r
     // this eval is stop the compressor from\r
@@ -1008,7 +1097,7 @@ Ext.DomQuery = function(){
         }else if(mode == "/" || mode == ">"){\r
             var utag = tagName.toUpperCase();\r
             for(var i = 0, ni, cn; ni = ns[i]; i++){\r
-                cn = isOpera ? ni.childNodes : (ni.children || ni.childNodes);\r
+                cn = ni.childNodes;\r
                 for(var j = 0, cj; cj = cn[j]; j++){\r
                     if(cj.nodeName == utag || cj.nodeName == tagName  || tagName == '*'){\r
                         result[++ri] = cj;\r
@@ -1188,7 +1277,7 @@ Ext.DomQuery = function(){
         if(!len1){\r
             return c2;\r
         }\r
-        if(isIE && c1[0].selectSingleNode){\r
+        if(isIE && typeof c1[0].selectSingleNode != "undefined"){\r
             return quickDiffIEXml(c1, c2);\r
         }        \r
         for(var i = 0; i < len1; i++){\r
@@ -1352,9 +1441,11 @@ Ext.DomQuery = function(){
             if(!valueCache[path]){\r
                 valueCache[path] = Ext.DomQuery.compile(path, "select");\r
             }\r
-            var n = valueCache[path](root),\r
-               v;\r
+            var n = valueCache[path](root), v;\r
             n = n[0] ? n[0] : n;\r
+            \r
+            if (typeof n.normalize == 'function') n.normalize();\r
+            \r
             v = (n && n.firstChild ? n.firstChild.nodeValue : null);\r
             return ((v === null||v === undefined||v==='') ? defaultValue : v);\r
         },\r
@@ -1457,8 +1548,29 @@ Ext.DomQuery = function(){
         },\r
 \r
         /**\r
-         * Collection of "pseudo class" processors. Each processor is passed the current nodeset (array)\r
-         * and the argument (if any) supplied in the selector.\r
+         * <p>Object hash of "pseudo class" filter functions which are used when filtering selections. Each function is passed\r
+         * two parameters:</p><div class="mdetail-params"><ul>\r
+         * <li><b>c</b> : Array<div class="sub-desc">An Array of DOM elements to filter.</div></li>\r
+         * <li><b>v</b> : String<div class="sub-desc">The argument (if any) supplied in the selector.</div></li>\r
+         * </ul></div>\r
+         * <p>A filter function returns an Array of DOM elements which conform to the pseudo class.</p>\r
+         * <p>In addition to the provided pseudo classes listed above such as <code>first-child</code> and <code>nth-child</code>,\r
+         * developers may add additional, custom psuedo class filters to select elements according to application-specific requirements.</p>\r
+         * <p>For example, to filter <code>&lt;a></code> elements to only return links to <i>external</i> resources:</p>\r
+         * <code><pre>\r
+Ext.DomQuery.pseudos.external = function(c, v){\r
+    var r = [], ri = -1;\r
+    for(var i = 0, ci; ci = c[i]; i++){\r
+//      Include in result set only if it's a link to an external resource\r
+        if(ci.hostname != location.hostname){\r
+            r[++ri] = ci;\r
+        }\r
+    }\r
+    return r;\r
+};</pre></code>\r
+         * Then external links could be gathered with the following statement:<code><pre>\r
+var externalLinks = Ext.select("a:external");\r
+</code></pre>\r
          */\r
         pseudos : {\r
             "first-child" : function(c){\r
@@ -1653,7 +1765,70 @@ Ext.DomQuery = function(){
  * @method query\r
  */\r
 Ext.query = Ext.DomQuery.select;\r
-(function(){
+/**
+ * @class Ext.util.DelayedTask
+ * <p> The DelayedTask class provides a convenient way to "buffer" the execution of a method,
+ * performing setTimeout where a new timeout cancels the old timeout. When called, the
+ * task will wait the specified time period before executing. If durng that time period,
+ * the task is called again, the original call will be cancelled. This continues so that
+ * the function is only called a single time for each iteration.</p>
+ * <p>This method is especially useful for things like detecting whether a user has finished
+ * typing in a text field. An example would be performing validation on a keypress. You can
+ * use this class to buffer the keypress events for a certain number of milliseconds, and
+ * perform only if they stop for that amount of time.  Usage:</p><pre><code>
+var task = new Ext.util.DelayedTask(function(){
+    alert(Ext.getDom('myInputField').value.length);
+});
+// Wait 500ms before calling our function. If the user presses another key 
+// during that 500ms, it will be cancelled and we'll wait another 500ms.
+Ext.get('myInputField').on('keypress', function(){
+    task.{@link #delay}(500); 
+});
+ * </code></pre> 
+ * <p>Note that we are using a DelayedTask here to illustrate a point. The configuration
+ * option <tt>buffer</tt> for {@link Ext.util.Observable#addListener addListener/on} will
+ * also setup a delayed task for you to buffer events.</p> 
+ * @constructor The parameters to this constructor serve as defaults and are not required.
+ * @param {Function} fn (optional) The default function to call.
+ * @param {Object} scope The default scope (The <code><b>this</b></code> reference) in which the
+ * function is called. If not specified, <code>this</code> will refer to the browser window.
+ * @param {Array} args (optional) The default Array of arguments.
+ */
+Ext.util.DelayedTask = function(fn, scope, args){
+    var me = this,
+       id,     
+       call = function(){
+               clearInterval(id);
+               id = null;
+               fn.apply(scope, args || []);
+           };
+           
+    /**
+     * Cancels any pending timeout and queues a new one
+     * @param {Number} delay The milliseconds to delay
+     * @param {Function} newFn (optional) Overrides function passed to constructor
+     * @param {Object} newScope (optional) Overrides scope passed to constructor. Remember that if no scope
+     * is specified, <code>this</code> will refer to the browser window.
+     * @param {Array} newArgs (optional) Overrides args passed to constructor
+     */
+    me.delay = function(delay, newFn, newScope, newArgs){
+        me.cancel();
+        fn = newFn || fn;
+        scope = newScope || scope;
+        args = newArgs || args;
+        id = setInterval(call, delay);
+    };
+
+    /**
+     * Cancel the last queued timeout
+     */
+    me.cancel = function(){
+        if(id){
+            clearInterval(id);
+            id = null;
+        }
+    };
+};(function(){
 
 var EXTUTIL = Ext.util,
     TOARRAY = Ext.toArray,
@@ -1765,216 +1940,223 @@ var combo = new Ext.form.ComboBox({
     me.events = e || {};
 };
 
-EXTUTIL.Observable.prototype = function(){
-    var filterOptRe = /^(?:scope|delay|buffer|single)$/, toLower = function(s){
-        return s.toLowerCase();
-    };
-
-    return {
-        /**
-         * <p>Fires the specified event with the passed parameters (minus the event name).</p>
-         * <p>An event may be set to bubble up an Observable parent hierarchy (See {@link Ext.Component#getBubbleTarget})
-         * by calling {@link #enableBubble}.</p>
-         * @param {String} eventName The name of the event to fire.
-         * @param {Object...} args Variable number of parameters are passed to handlers.
-         * @return {Boolean} returns false if any of the handlers return false otherwise it returns true.
-         */
+EXTUTIL.Observable.prototype = {
+    // private
+    filterOptRe : /^(?:scope|delay|buffer|single)$/,
 
-        fireEvent : function(){
-            var a = TOARRAY(arguments),
-                ename = toLower(a[0]),
-                me = this,
-                ret = TRUE,
-                ce = me.events[ename],
-                q,
-                c;
-            if (me.eventsSuspended === TRUE) {
-                if (q = me.suspendedEventsQueue) {
-                    q.push(a);
-                }
+    /**
+     * <p>Fires the specified event with the passed parameters (minus the event name).</p>
+     * <p>An event may be set to bubble up an Observable parent hierarchy (See {@link Ext.Component#getBubbleTarget})
+     * by calling {@link #enableBubble}.</p>
+     * @param {String} eventName The name of the event to fire.
+     * @param {Object...} args Variable number of parameters are passed to handlers.
+     * @return {Boolean} returns false if any of the handlers return false otherwise it returns true.
+     */
+    fireEvent : function(){
+        var a = TOARRAY(arguments),
+            ename = a[0].toLowerCase(),
+            me = this,
+            ret = TRUE,
+            ce = me.events[ename],
+            q,
+            c;
+        if (me.eventsSuspended === TRUE) {
+            if (q = me.eventQueue) {
+                q.push(a);
             }
-            else if(ISOBJECT(ce) && ce.bubble){
-                if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
-                    return FALSE;
-                }
-                c = me.getBubbleTarget && me.getBubbleTarget();
-                if(c && c.enableBubble) {
+        }
+        else if(ISOBJECT(ce) && ce.bubble){
+            if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
+                return FALSE;
+            }
+            c = me.getBubbleTarget && me.getBubbleTarget();
+            if(c && c.enableBubble) {
+                if(!c.events[ename] || !Ext.isObject(c.events[ename]) || !c.events[ename].bubble) {
                     c.enableBubble(ename);
-                    return c.fireEvent.apply(c, a);
                 }
+                return c.fireEvent.apply(c, a);
             }
-            else {
-                if (ISOBJECT(ce)) {
-                    a.shift();
-                    ret = ce.fire.apply(ce, a);
-                }
+        }
+        else {
+            if (ISOBJECT(ce)) {
+                a.shift();
+                ret = ce.fire.apply(ce, a);
             }
-            return ret;
-        },
+        }
+        return ret;
+    },
 
-        /**
-         * Appends an event handler to this object.
-         * @param {String}   eventName The name of the event to listen for.
-         * @param {Function} handler The method the event invokes.
-         * @param {Object}   scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
-         * <b>If omitted, defaults to the object which fired the event.</b>
-         * @param {Object}   options (optional) An object containing handler configuration.
-         * properties. This may contain any of the following properties:<ul>
-         * <li><b>scope</b> : Object<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
-         * <b>If omitted, defaults to the object which fired the event.</b></div></li>
-         * <li><b>delay</b> : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
-         * <li><b>single</b> : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
-         * <li><b>buffer</b> : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
-         * by the specified number of milliseconds. If the event fires again within that time, the original
-         * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
-         * <li><b>target</b> : Observable<div class="sub-desc">Only call the handler if the event was fired on the target Observable, <i>not</i>
-         * if the event was bubbled up from a child Observable.</div></li>
-         * </ul><br>
-         * <p>
-         * <b>Combining Options</b><br>
-         * Using the options argument, it is possible to combine different types of listeners:<br>
-         * <br>
-         * A delayed, one-time listener.
-         * <pre><code>
+    /**
+     * Appends an event handler to this object.
+     * @param {String}   eventName The name of the event to listen for.
+     * @param {Function} handler The method the event invokes.
+     * @param {Object}   scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
+     * <b>If omitted, defaults to the object which fired the event.</b>
+     * @param {Object}   options (optional) An object containing handler configuration.
+     * properties. This may contain any of the following properties:<ul>
+     * <li><b>scope</b> : Object<div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
+     * <b>If omitted, defaults to the object which fired the event.</b></div></li>
+     * <li><b>delay</b> : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
+     * <li><b>single</b> : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
+     * <li><b>buffer</b> : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
+     * by the specified number of milliseconds. If the event fires again within that time, the original
+     * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
+     * <li><b>target</b> : Observable<div class="sub-desc">Only call the handler if the event was fired on the target Observable, <i>not</i>
+     * if the event was bubbled up from a child Observable.</div></li>
+     * </ul><br>
+     * <p>
+     * <b>Combining Options</b><br>
+     * Using the options argument, it is possible to combine different types of listeners:<br>
+     * <br>
+     * A delayed, one-time listener.
+     * <pre><code>
 myDataView.on('click', this.onClick, this, {
-    single: true,
-    delay: 100
-});</code></pre>
-         * <p>
-         * <b>Attaching multiple handlers in 1 call</b><br>
-         * The method also allows for a single argument to be passed which is a config object containing properties
-         * which specify multiple handlers.
-         * <p>
-         * <pre><code>
-myGridPanel.on({
-    'click' : {
-        fn: this.onClick,
-        scope: this,
-        delay: 100
-    },
-    'mouseover' : {
-        fn: this.onMouseOver,
-        scope: this
-    },
-    'mouseout' : {
-        fn: this.onMouseOut,
-        scope: this
-    }
+single: true,
+delay: 100
 });</code></pre>
      * <p>
-     * Or a shorthand syntax:<br>
+     * <b>Attaching multiple handlers in 1 call</b><br>
+     * The method also allows for a single argument to be passed which is a config object containing properties
+     * which specify multiple handlers.
+     * <p>
      * <pre><code>
 myGridPanel.on({
-    'click' : this.onClick,
-    'mouseover' : this.onMouseOver,
-    'mouseout' : this.onMouseOut,
-     scope: this
+'click' : {
+    fn: this.onClick,
+    scope: this,
+    delay: 100
+},
+'mouseover' : {
+    fn: this.onMouseOver,
+    scope: this
+},
+'mouseout' : {
+    fn: this.onMouseOut,
+    scope: this
+}
 });</code></pre>
-         */
-        addListener : function(eventName, fn, scope, o){
-            var me = this,
-                e,
-                oe,
-                isF,
-            ce;
-            if (ISOBJECT(eventName)) {
-                o = eventName;
-                for (e in o){
-                    oe = o[e];
-                    if (!filterOptRe.test(e)) {
-                        me.addListener(e, oe.fn || oe, oe.scope || o.scope, oe.fn ? oe : o);
-                    }
-                }
-            } else {
-                eventName = toLower(eventName);
-                ce = me.events[eventName] || TRUE;
-                if (typeof ce == "boolean") {
-                    me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
+ * <p>
+ * Or a shorthand syntax:<br>
+ * <pre><code>
+myGridPanel.on({
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
+});</code></pre>
+     */
+    addListener : function(eventName, fn, scope, o){
+        var me = this,
+            e,
+            oe,
+            isF,
+        ce;
+        if (ISOBJECT(eventName)) {
+            o = eventName;
+            for (e in o){
+                oe = o[e];
+                if (!me.filterOptRe.test(e)) {
+                    me.addListener(e, oe.fn || oe, oe.scope || o.scope, oe.fn ? oe : o);
                 }
-                ce.addListener(fn, scope, ISOBJECT(o) ? o : {});
             }
-        },
-
-        /**
-         * Removes an event handler.
-         * @param {String}   eventName The type of event the handler was associated with.
-         * @param {Function} handler   The handler to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
-         * @param {Object}   scope     (optional) The scope originally specified for the handler.
-         */
-        removeListener : function(eventName, fn, scope){
-            var ce = this.events[toLower(eventName)];
-            if (ISOBJECT(ce)) {
-                ce.removeListener(fn, scope);
+        } else {
+            eventName = eventName.toLowerCase();
+            ce = me.events[eventName] || TRUE;
+            if (Ext.isBoolean(ce)) {
+                me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
             }
-        },
+            ce.addListener(fn, scope, ISOBJECT(o) ? o : {});
+        }
+    },
 
-        /**
-         * Removes all listeners for this object
-         */
-        purgeListeners : function(){
-            var events = this.events,
-                evt,
-                key;
-            for(key in events){
-                evt = events[key];
-                if(ISOBJECT(evt)){
-                    evt.clearListeners();
-                }
-            }
-        },
+    /**
+     * Removes an event handler.
+     * @param {String}   eventName The type of event the handler was associated with.
+     * @param {Function} handler   The handler to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
+     * @param {Object}   scope     (optional) The scope originally specified for the handler.
+     */
+    removeListener : function(eventName, fn, scope){
+        var ce = this.events[eventName.toLowerCase()];
+        if (ISOBJECT(ce)) {
+            ce.removeListener(fn, scope);
+        }
+    },
 
-        /**
-         * Used to define events on this Observable
-         * @param {Object} object The object with the events defined
-         */
-        addEvents : function(o){
-            var me = this;
-            me.events = me.events || {};
-            if (typeof o == 'string') {
-                EACH(arguments, function(a) {
-                    me.events[a] = me.events[a] || TRUE;
-                });
-            } else {
-                Ext.applyIf(me.events, o);
+    /**
+     * Removes all listeners for this object
+     */
+    purgeListeners : function(){
+        var events = this.events,
+            evt,
+            key;
+        for(key in events){
+            evt = events[key];
+            if(ISOBJECT(evt)){
+                evt.clearListeners();
             }
-        },
-
-        /**
-         * Checks to see if this object has any listeners for a specified event
-         * @param {String} eventName The name of the event to check for
-         * @return {Boolean} True if the event is being listened for, else false
-         */
-        hasListener : function(eventName){
-            var e = this.events[eventName];
-            return ISOBJECT(e) && e.listeners.length > 0;
-        },
+        }
+    },
 
-        /**
-         * Suspend the firing of all events. (see {@link #resumeEvents})
-         * @param {Boolean} queueSuspended Pass as true to queue up suspended events to be fired
-         * after the {@link #resumeEvents} call instead of discarding all suspended events;
-         */
-        suspendEvents : function(queueSuspended){
-            this.eventsSuspended = TRUE;
-            if (queueSuspended){
-                this.suspendedEventsQueue = [];
+    /**
+     * Adds the specified events to the list of events which this Observable may fire.
+     * @param {Object|String} o Either an object with event names as properties with a value of <code>true</code>
+     * or the first event name string if multiple event names are being passed as separate parameters.
+     * @param {string} Optional. Event name if multiple event names are being passed as separate parameters.
+     * Usage:<pre><code>
+this.addEvents('storeloaded', 'storecleared');
+</code></pre>
+     */
+    addEvents : function(o){
+        var me = this;
+        me.events = me.events || {};
+        if (Ext.isString(o)) {
+            var a = arguments,
+                i = a.length;
+            while(i--) {
+                me.events[a[i]] = me.events[a[i]] || TRUE;
             }
-        },
+        } else {
+            Ext.applyIf(me.events, o);
+        }
+    },
 
-        /**
-         * Resume firing events. (see {@link #suspendEvents})
-         * If events were suspended using the <tt><b>queueSuspended</b></tt> parameter, then all
-         * events fired during event suspension will be sent to any listeners now.
-         */
-        resumeEvents : function(){
-            var me = this;
-            me.eventsSuspended = !delete me.suspendedEventQueue;
-            EACH(me.suspendedEventsQueue, function(e) {
-                me.fireEvent.apply(me, e);
-            });
+    /**
+     * Checks to see if this object has any listeners for a specified event
+     * @param {String} eventName The name of the event to check for
+     * @return {Boolean} True if the event is being listened for, else false
+     */
+    hasListener : function(eventName){
+        var e = this.events[eventName];
+        return ISOBJECT(e) && e.listeners.length > 0;
+    },
+
+    /**
+     * Suspend the firing of all events. (see {@link #resumeEvents})
+     * @param {Boolean} queueSuspended Pass as true to queue up suspended events to be fired
+     * after the {@link #resumeEvents} call instead of discarding all suspended events;
+     */
+    suspendEvents : function(queueSuspended){
+        this.eventsSuspended = TRUE;
+        if(queueSuspended && !this.eventQueue){
+            this.eventQueue = [];
         }
+    },
+
+    /**
+     * Resume firing events. (see {@link #suspendEvents})
+     * If events were suspended using the <tt><b>queueSuspended</b></tt> parameter, then all
+     * events fired during event suspension will be sent to any listeners now.
+     */
+    resumeEvents : function(){
+        var me = this,
+            queued = me.eventQueue || [];
+        me.eventsSuspended = FALSE;
+        delete me.eventQueue;
+        EACH(queued, function(e) {
+            me.fireEvent.apply(me, e);
+        });
     }
-}();
+};
 
 var OBSERVABLE = EXTUTIL.Observable.prototype;
 /**
@@ -2013,10 +2195,10 @@ function createTargeted(h, o, scope){
     };
 };
 
-function createBuffered(h, o, scope){
-    var task = new EXTUTIL.DelayedTask();
+function createBuffered(h, o, fn, scope){
+    fn.task = new EXTUTIL.DelayedTask();
     return function(){
-        task.delay(o.buffer, h, scope, TOARRAY(arguments));
+        fn.task.delay(o.buffer, h, scope, TOARRAY(arguments));
     };
 }
 
@@ -2027,12 +2209,14 @@ function createSingle(h, e, fn, scope){
     };
 }
 
-function createDelayed(h, o, scope){
+function createDelayed(h, o, fn, scope){
     return function(){
-        var args = TOARRAY(arguments);
-        (function(){
-            h.apply(scope, args);
-        }).defer(o.delay || 10);
+        var task = new EXTUTIL.DelayedTask();
+        if(!fn.tasks) {
+            fn.tasks = [];
+        }
+        fn.tasks.push(task);
+        task.delay(o.delay || 10, h, scope, TOARRAY(arguments));
     };
 };
 
@@ -2067,29 +2251,33 @@ EXTUTIL.Event.prototype = {
             h = createTargeted(h, o, scope);
         }
         if(o.delay){
-            h = createDelayed(h, o, scope);
+            h = createDelayed(h, o, fn, scope);
         }
         if(o.single){
             h = createSingle(h, this, fn, scope);
         }
         if(o.buffer){
-            h = createBuffered(h, o, scope);
+            h = createBuffered(h, o, fn, scope);
         }
         l.fireFn = h;
         return l;
     },
 
     findListener : function(fn, scope){
-        var s, ret = -1;
-        EACH(this.listeners, function(l, i) {
-            s = l.scope;
-            if(l.fn == fn && (s == scope || s == this.obj)){
-                ret = i;
-                return FALSE;
+        var list = this.listeners,
+            i = list.length,
+            l,
+            s;
+        while(i--) {
+            l = list[i];
+            if(l) {
+                s = l.scope;
+                if(l.fn == fn && (s == scope || s == this.obj)){
+                    return i;
+                }
             }
-        },
-        this);
-        return ret;
+        }
+        return -1;
     },
 
     isListening : function(fn, scope){
@@ -2098,62 +2286,90 @@ EXTUTIL.Event.prototype = {
 
     removeListener : function(fn, scope){
         var index,
+            l,
+            k,
             me = this,
             ret = FALSE;
         if((index = me.findListener(fn, scope)) != -1){
             if (me.firing) {
                 me.listeners = me.listeners.slice(0);
             }
+            l = me.listeners[index].fn;
+            // Cancel buffered tasks
+            if(l.task) {
+                l.task.cancel();
+                delete l.task;
+            }
+            // Cancel delayed tasks
+            k = l.tasks && l.tasks.length;
+            if(k) {
+                while(k--) {
+                    l.tasks[k].cancel();
+                }
+                delete l.tasks;
+            }
             me.listeners.splice(index, 1);
             ret = TRUE;
         }
         return ret;
     },
 
+    // Iterate to stop any buffered/delayed events
     clearListeners : function(){
-        this.listeners = [];
+        var me = this,
+            l = me.listeners,
+            i = l.length;
+        while(i--) {
+            me.removeListener(l[i].fn, l[i].scope);
+        }
     },
 
     fire : function(){
         var me = this,
             args = TOARRAY(arguments),
-            ret = TRUE;
+            listeners = me.listeners,
+            len = listeners.length,
+            i = 0,
+            l;
 
-        EACH(me.listeners, function(l) {
+        if(len > 0){
             me.firing = TRUE;
-            if (l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
-                return ret = me.firing = FALSE;
+            for (; i < len; i++) {
+                l = listeners[i];
+                if(l && l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
+                    return (me.firing = FALSE);
+                }
             }
-        });
+        }
         me.firing = FALSE;
-        return ret;
+        return TRUE;
     }
 };
 })();/**\r
  * @class Ext.util.Observable\r
  */\r
-Ext.apply(Ext.util.Observable.prototype, function(){    \r
+Ext.apply(Ext.util.Observable.prototype, function(){\r
     // this is considered experimental (along with beforeMethod, afterMethod, removeMethodListener?)\r
     // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call\r
     // private\r
     function getMethodEvent(method){\r
         var e = (this.methodEvents = this.methodEvents ||\r
         {})[method], returnValue, v, cancel, obj = this;\r
-        \r
+\r
         if (!e) {\r
             this.methodEvents[method] = e = {};\r
             e.originalFn = this[method];\r
             e.methodName = method;\r
             e.before = [];\r
             e.after = [];\r
-            \r
+\r
             var makeCall = function(fn, scope, args){\r
                 if (!Ext.isEmpty(v = fn.apply(scope || obj, args))) {\r
                     if (Ext.isObject(v)) {\r
                         returnValue = !Ext.isEmpty(v.returnValue) ? v.returnValue : v;\r
                         cancel = !!v.cancel;\r
                     }\r
-                    else \r
+                    else\r
                         if (v === false) {\r
                             cancel = true;\r
                         }\r
@@ -2162,19 +2378,19 @@ Ext.apply(Ext.util.Observable.prototype, function(){
                         }\r
                 }\r
             };\r
-            \r
+\r
             this[method] = function(){\r
                 var args = Ext.toArray(arguments);\r
                 returnValue = v = undefined;\r
                 cancel = false;\r
-                \r
+\r
                 Ext.each(e.before, function(b){\r
                     makeCall(b.fn, b.scope, args);\r
                     if (cancel) {\r
                         return returnValue;\r
                     }\r
                 });\r
-                \r
+\r
                 if (!Ext.isEmpty(v = e.originalFn.apply(obj, args))) {\r
                     returnValue = v;\r
                 }\r
@@ -2189,26 +2405,26 @@ Ext.apply(Ext.util.Observable.prototype, function(){
         }\r
         return e;\r
     }\r
-    \r
+\r
     return {\r
         // these are considered experimental\r
         // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call\r
-        // adds an "interceptor" called before the original method\r
-        beforeMethod: function(method, fn, scope){\r
+        // adds an 'interceptor' called before the original method\r
+        beforeMethod : function(method, fn, scope){\r
             getMethodEvent.call(this, method).before.push({\r
                 fn: fn,\r
                 scope: scope\r
             });\r
         },\r
-        \r
-        // adds a "sequence" called after the original method\r
-        afterMethod: function(method, fn, scope){\r
+\r
+        // adds a 'sequence' called after the original method\r
+        afterMethod : function(method, fn, scope){\r
             getMethodEvent.call(this, method).after.push({\r
                 fn: fn,\r
                 scope: scope\r
             });\r
         },\r
-        \r
+\r
         removeMethodListener: function(method, fn, scope){\r
             var e = getMethodEvent.call(this, method), found = false;\r
             Ext.each(e.before, function(b, i, arr){\r
@@ -2227,13 +2443,13 @@ Ext.apply(Ext.util.Observable.prototype, function(){
                 });\r
             }\r
         },\r
-        \r
+\r
         /**\r
          * Relays selected events from the specified Observable as if the events were fired by <tt><b>this</b></tt>.\r
          * @param {Object} o The Observable whose events this object is to relay.\r
          * @param {Array} events Array of event names to relay.\r
          */\r
-        relayEvents: function(o, events){\r
+        relayEvents : function(o, events){\r
             var me = this;\r
             function createHandler(ename){\r
                 return function(){\r
@@ -2245,23 +2461,58 @@ Ext.apply(Ext.util.Observable.prototype, function(){
                 o.on(ename, createHandler(ename), me);\r
             });\r
         },\r
-        \r
+\r
         /**\r
-         * Used to enable bubbling of events\r
-         * @param {Object} events\r
+         * <p>Enables events fired by this Observable to bubble up an owner hierarchy by calling\r
+         * <code>this.getBubbleTarget()</code> if present. There is no implementation in the Observable base class.</p>\r
+         * <p>This is commonly used by Ext.Components to bubble events to owner Containers. See {@link Ext.Component.getBubbleTarget}. The default\r
+         * implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to\r
+         * access the required target more quickly.</p>\r
+         * <p>Example:</p><pre><code>\r
+Ext.override(Ext.form.Field, {\r
+    //  Add functionality to Field&#39;s initComponent to enable the change event to bubble\r
+    initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {\r
+        this.enableBubble('change');\r
+    }),\r
+\r
+    //  We know that we want Field&#39;s events to bubble directly to the FormPanel.\r
+    getBubbleTarget : function() {\r
+        if (!this.formPanel) {\r
+            this.formPanel = this.findParentByType('form');\r
+        }\r
+        return this.formPanel;\r
+    }\r
+});\r
+\r
+var myForm = new Ext.formPanel({\r
+    title: 'User Details',\r
+    items: [{\r
+        ...\r
+    }],\r
+    listeners: {\r
+        change: function() {\r
+            // Title goes red if form has been modified.\r
+            myForm.header.setStyle('color', 'red');\r
+        }\r
+    }\r
+});\r
+</code></pre>\r
+         * @param {String/Array} events The event name to bubble, or an Array of event names.\r
          */\r
-        enableBubble: function(events){\r
+        enableBubble : function(events){\r
             var me = this;\r
-            events = Ext.isArray(events) ? events : Ext.toArray(arguments);\r
-            Ext.each(events, function(ename){\r
-                ename = ename.toLowerCase();\r
-                var ce = me.events[ename] || true;\r
-                if (typeof ce == "boolean") {\r
-                    ce = new Ext.util.Event(me, ename);\r
-                    me.events[ename] = ce;\r
-                }\r
-                ce.bubble = true;\r
-            });\r
+            if(!Ext.isEmpty(events)){\r
+                events = Ext.isArray(events) ? events : Ext.toArray(arguments);\r
+                Ext.each(events, function(ename){\r
+                    ename = ename.toLowerCase();\r
+                    var ce = me.events[ename] || true;\r
+                    if (Ext.isBoolean(ce)) {\r
+                        ce = new Ext.util.Event(me, ename);\r
+                        me.events[ename] = ce;\r
+                    }\r
+                    ce.bubble = true;\r
+                });\r
+            }\r
         }\r
     };\r
 }());\r
@@ -2272,9 +2523,9 @@ Ext.apply(Ext.util.Observable.prototype, function(){
  * to the supplied function with the event name + standard signature of the event\r
  * <b>before</b> the event is fired. If the supplied function returns false,\r
  * the event will not fire.\r
- * @param {Observable} o The Observable to capture\r
- * @param {Function} fn The function to call\r
- * @param {Object} scope (optional) The scope (this object) for the fn\r
+ * @param {Observable} o The Observable to capture events from.\r
+ * @param {Function} fn The function to call when an event is fired.\r
+ * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the Observable firing the event.\r
  * @static\r
  */\r
 Ext.util.Observable.capture = function(o, fn, scope){\r
@@ -2289,2448 +2540,2671 @@ Ext.util.Observable.capture = function(o, fn, scope){
  * <p>Usage:</p><pre><code>\r
 Ext.util.Observable.observeClass(Ext.data.Connection);\r
 Ext.data.Connection.on('beforerequest', function(con, options) {\r
-    console.log("Ajax request made to " + options.url);\r
+    console.log('Ajax request made to ' + options.url);\r
 });</code></pre>\r
  * @param {Function} c The class constructor to make observable.\r
+ * @param {Object} listeners An object containing a series of listeners to add. See {@link #addListener}. \r
  * @static\r
  */\r
-Ext.util.Observable.observeClass = function(c){\r
-    Ext.apply(c, new Ext.util.Observable());\r
-    c.prototype.fireEvent = function(){\r
-        return (c.fireEvent.apply(c, arguments) !== false) &&\r
-        (Ext.util.Observable.prototype.fireEvent.apply(this, arguments) !== false);\r
-    };\r
-};/**
- * @class Ext.EventManager
- * Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
- * several useful events directly.
- * See {@link Ext.EventObject} for more details on normalized event objects.
- * @singleton
- */
-Ext.EventManager = function(){
-    var docReadyEvent, 
-       docReadyProcId, 
-       docReadyState = false,          
-       E = Ext.lib.Event,
-       D = Ext.lib.Dom,
-       DOC = document,
-       WINDOW = window,
-       IEDEFERED = "ie-deferred-loader",
-       DOMCONTENTLOADED = "DOMContentLoaded",
-       elHash = {},
-       propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
-
-    /// There is some jquery work around stuff here that isn't needed in Ext Core.
-    function addListener(el, ename, fn, wrap, scope){      
-        var id = Ext.id(el),
-               es = elHash[id] = elHash[id] || {};             
-       
-        (es[ename] = es[ename] || []).push([fn, wrap, scope]);
-        E.on(el, ename, wrap);
-
-        // this is a workaround for jQuery and should somehow be removed from Ext Core in the future
-        // without breaking ExtJS.
-        if(ename == "mousewheel" && el.addEventListener){ // workaround for jQuery
-               var args = ["DOMMouseScroll", wrap, false];
-               el.addEventListener.apply(el, args);
-            E.on(window, 'unload', function(){
-                   el.removeEventListener.apply(el, args);                
-            });
-        }
-        if(ename == "mousedown" && el == document){ // fix stopped mousedowns on the document
-            Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
-        }
-    };
-    
-    function fireDocReady(){
-        if(!docReadyState){            
-            Ext.isReady = docReadyState = true;
-            if(docReadyProcId){
-                clearInterval(docReadyProcId);
-            }
-            if(Ext.isGecko || Ext.isOpera) {
-                DOC.removeEventListener(DOMCONTENTLOADED, fireDocReady, false);
-            }
-            if(Ext.isIE){
-                var defer = DOC.getElementById(IEDEFERED);
-                if(defer){
-                    defer.onreadystatechange = null;
-                    defer.parentNode.removeChild(defer);
-                }
-            }
-            if(docReadyEvent){
-                docReadyEvent.fire();
-                docReadyEvent.clearListeners();
-            }
-        }
-    };
-
-    function initDocReady(){
-           var COMPLETE = "complete";
-               
-        docReadyEvent = new Ext.util.Event();
-        if (Ext.isGecko || Ext.isOpera) {
-            DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);
-        } else if (Ext.isIE){
-            DOC.write("<s"+'cript id=' + IEDEFERED + ' defer="defer" src="/'+'/:"></s'+"cript>");            
-            DOC.getElementById(IEDEFERED).onreadystatechange = function(){
-                if(this.readyState == COMPLETE){
-                    fireDocReady();
-                }
-            };
-        } else if (Ext.isWebKit){
-            docReadyProcId = setInterval(function(){                
-                if(DOC.readyState == COMPLETE) {
-                    fireDocReady();
-                 }
-            }, 10);
-        }
-        // no matter what, make sure it fires on load
-        E.on(WINDOW, "load", fireDocReady);
-    };
-
-    function createTargeted(h, o){
-        return function(){
-               var args = Ext.toArray(arguments);
-            if(o.target == Ext.EventObject.setEvent(args[0]).target){
-                h.apply(this, args);
-            }
-        };
-    };    
-    
-    function createBuffered(h, o){
-        var task = new Ext.util.DelayedTask(h);
-        return function(e){
-            // create new event object impl so new events don't wipe out properties            
-            task.delay(o.buffer, h, null, [new Ext.EventObjectImpl(e)]);
-        };
-    };
-
-    function createSingle(h, el, ename, fn, scope){
-        return function(e){
-            Ext.EventManager.removeListener(el, ename, fn, scope);
-            h(e);
-        };
-    };
-
-    function createDelayed(h, o){
-        return function(e){
-            // create new event object impl so new events don't wipe out properties   
-            e = new Ext.EventObjectImpl(e);
-            setTimeout(function(){
-                h(e);
-            }, o.delay || 10);
-        };
-    };
-
-    function listen(element, ename, opt, fn, scope){
-        var o = !Ext.isObject(opt) ? {} : opt,
-               el = Ext.getDom(element);
-               
-        fn = fn || o.fn; 
-        scope = scope || o.scope;
-        
-        if(!el){
-            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
-        }
-        function h(e){
-            // prevent errors while unload occurring
-            if(!Ext){// !window[xname]){  ==> can't we do this? 
-                return;
-            }
-            e = Ext.EventObject.setEvent(e);
-            var t;
-            if (o.delegate) {
-                if(!(t = e.getTarget(o.delegate, el))){
-                    return;
-                }
-            } else {
-                t = e.target;
-            }            
-            if (o.stopEvent) {
-                e.stopEvent();
-            }
-            if (o.preventDefault) {
-               e.preventDefault();
-            }
-            if (o.stopPropagation) {
-                e.stopPropagation();
-            }
-            if (o.normalized) {
-                e = e.browserEvent;
-            }
-            
-            fn.call(scope || el, e, t, o);
-        };
-        if(o.target){
-            h = createTargeted(h, o);
-        }
-        if(o.delay){
-            h = createDelayed(h, o);
-        }
-        if(o.single){
-            h = createSingle(h, el, ename, fn, scope);
-        }
-        if(o.buffer){
-            h = createBuffered(h, o);
-        }
-
-        addListener(el, ename, fn, h, scope);
-        return h;
-    };
-
-    var pub = {
-           /**
-            * Appends an event handler to an element.  The shorthand version {@link #on} is equivalent.  Typically you will
-            * use {@link Ext.Element#addListener} directly on an Element in favor of calling this version.
-            * @param {String/HTMLElement} el The html element or id to assign the event handler to
-            * @param {String} eventName The type of event to listen for
-            * @param {Function} handler The handler function the event invokes This function is passed
-            * the following parameters:<ul>
-            * <li>evt : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>
-            * <li>t : Element<div class="sub-desc">The {@link Ext.Element Element} which was the target of the event.
-            * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
-            * <li>o : Object<div class="sub-desc">The options object from the addListener call.</div></li>
-            * </ul>
-            * @param {Object} scope (optional) The scope (<b><code>this</code></b> reference) in which the handler function is executed. <b>Defaults to the Element</b>.
-            * @param {Object} options (optional) An object containing handler configuration properties.
-            * This may contain any of the following properties:<ul>
-            * <li>scope : Object<div class="sub-desc">The scope (<b><code>this</code></b> reference) in which the handler function is executed. <b>Defaults to the Element</b>.</div></li>
-            * <li>delegate : String<div class="sub-desc">A simple selector to filter the target or look for a descendant of the target</div></li>
-            * <li>stopEvent : Boolean<div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>
-            * <li>preventDefault : Boolean<div class="sub-desc">True to prevent the default action</div></li>
-            * <li>stopPropagation : Boolean<div class="sub-desc">True to prevent event propagation</div></li>
-            * <li>normalized : Boolean<div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>
-            * <li>delay : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after te event fires.</div></li>
-            * <li>single : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
-            * <li>buffer : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
-            * by the specified number of milliseconds. If the event fires again within that time, the original
-            * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
-            * <li>target : Element<div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>
-            * </ul><br>
-            * <p>See {@link Ext.Element#addListener} for examples of how to use these options.</p>
-            */
-               addListener : function(element, eventName, fn, scope, options){                                              
-            if(Ext.isObject(eventName)){                
-                   var o = eventName, e, val;
-                for(e in o){
-                       val = o[e];
-                    if(!propRe.test(e)){                                                
-                           if(Ext.isFunction(val)){
-                               // shared options
-                               listen(element, e, o, val, o.scope);
-                           }else{
-                               // individual options
-                               listen(element, e, val);
-                           }
-                    }
-                }
-            } else {
-               listen(element, eventName, options, fn, scope);
-               }
-        },
-        
-        /**
-         * Removes an event handler from an element.  The shorthand version {@link #un} is equivalent.  Typically
-         * you will use {@link Ext.Element#removeListener} directly on an Element in favor of calling this version.
-         * @param {String/HTMLElement} el The id or html element from which to remove the event
-         * @param {String} eventName The type of event
-         * @param {Function} fn The handler function to remove
-         */
-        removeListener : function(element, eventName, fn, scope){            
-            var el = Ext.getDom(element),
-                id = Ext.id(el),
-                   wrap;      
-               
-               Ext.each((elHash[id] || {})[eventName], function (v,i,a) {
-                           if (Ext.isArray(v) && v[0] == fn && (!scope || v[2] == scope)) {                                                    
-                               E.un(el, eventName, wrap = v[1]);
-                               a.splice(i,1);
-                               return false;                           
-                       }
-               });     
-
-            // jQuery workaround that should be removed from Ext Core
-               if(eventName == "mousewheel" && el.addEventListener && wrap){
-                   el.removeEventListener("DOMMouseScroll", wrap, false);
-               }
-                       
-               if(eventName == "mousedown" && el == DOC && wrap){ // fix stopped mousedowns on the document
-                   Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
-               }
-        },
-        
-        /**
-         * Removes all event handers from an element.  Typically you will use {@link Ext.Element#removeAllListeners}
-         * directly on an Element in favor of calling this version.
-         * @param {String/HTMLElement} el The id or html element from which to remove the event
-         */
-        removeAll : function(el){
-               var id = Ext.id(el = Ext.getDom(el)), 
-                               es = elHash[id],                                
-                               ename;
-              
-               for(ename in es){
-                   if(es.hasOwnProperty(ename)){                           
-                       Ext.each(es[ename], function(v) {
-                           E.un(el, ename, v.wrap);                    
-                       });
-                   }            
-               }
-               elHash[id] = null;       
-        },
-
-        /**
-         * Fires when the document is ready (before onload and before images are loaded). Can be
-         * accessed shorthanded as Ext.onReady().
-         * @param {Function} fn The method the event invokes
-         * @param {Object} scope (optional) An object that becomes the scope of the handler
-         * @param {boolean} options (optional) An object containing standard {@link #addListener} options
-         */
-        onDocumentReady : function(fn, scope, options){
-            if(docReadyState){ // if it already fired
-                docReadyEvent.addListener(fn, scope, options);
-                docReadyEvent.fire();
-                docReadyEvent.clearListeners();               
-            } else {
-                if(!docReadyEvent) initDocReady();
-                options = options || {};
-                   options.delay = options.delay || 1;             
-                   docReadyEvent.addListener(fn, scope, options);
-            }
-        },
-        
-        elHash : elHash   
-    };
-     /**
-     * Appends an event handler to an element.  Shorthand for {@link #addListener}.
-     * @param {String/HTMLElement} el The html element or id to assign the event handler to
-     * @param {String} eventName The type of event to listen for
-     * @param {Function} handler The handler function the event invokes
-     * @param {Object} scope (optional) The scope in which to execute the handler
-     * function (the handler function's "this" context)
-     * @param {Object} options (optional) An object containing standard {@link #addListener} options
-     * @member Ext.EventManager
-     * @method on
-     */
-    pub.on = pub.addListener;
-    /**
-     * Removes an event handler from an element.  Shorthand for {@link #removeListener}.
-     * @param {String/HTMLElement} el The id or html element from which to remove the event
-     * @param {String} eventName The type of event
-     * @param {Function} fn The handler function to remove
-     * @return {Boolean} True if a listener was actually removed, else false
-     * @member Ext.EventManager
-     * @method un
-     */
-    pub.un = pub.removeListener;
-
-    pub.stoppedMouseDownEvent = new Ext.util.Event();
-    return pub;
-}();
-/**
-  * Fires when the document is ready (before onload and before images are loaded).  Shorthand of {@link Ext.EventManager#onDocumentReady}.
-  * @param {Function} fn The method the event invokes
-  * @param {Object} scope An object that becomes the scope of the handler
-  * @param {boolean} options (optional) An object containing standard {@link #addListener} options
-  * @member Ext
-  * @method onReady
- */
-Ext.onReady = Ext.EventManager.onDocumentReady;
-
-
-//Initialize doc classes
-(function(){
-    
-    var initExtCss = function(){
-        // find the body element
-        var bd = document.body || document.getElementsByTagName('body')[0];
-        if(!bd){ return false; }
-        var cls = [' ',
-                Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))
-                : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
-                : Ext.isOpera ? "ext-opera"
-                : Ext.isWebKit ? "ext-webkit" : ""];
-
-        if(Ext.isSafari){
-            cls.push("ext-safari " + (Ext.isSafari2 ? 'ext-safari2' : (Ext.isSafari3 ? 'ext-safari3' : 'ext-safari4')));
-        }else if(Ext.isChrome){
-            cls.push("ext-chrome");
-        }
-
-        if(Ext.isMac){
-            cls.push("ext-mac");
-        }
-        if(Ext.isLinux){
-            cls.push("ext-linux");
-        }
-
-        if(Ext.isStrict || Ext.isBorderBox){ // add to the parent to allow for selectors like ".ext-strict .ext-ie"
-            var p = bd.parentNode;
-            if(p){
-                p.className += Ext.isStrict ? ' ext-strict' : ' ext-border-box';
-            }
-        }
-        bd.className += cls.join(' ');
-        return true;
-    }
-
-    if(!initExtCss()){
-        Ext.onReady(initExtCss);
-    }
-})();
-
-
-/**
- * @class Ext.EventObject
- * Just as {@link Ext.Element} wraps around a native DOM node, Ext.EventObject 
- * wraps the browser's native event-object normalizing cross-browser differences,
- * such as which mouse button is clicked, keys pressed, mechanisms to stop
- * event-propagation along with a method to prevent default actions from taking place.
- * <p>For example:</p>
- * <pre><code>
-function handleClick(e, t){ // e is not a standard event object, it is a Ext.EventObject
-    e.preventDefault();
-    var target = e.getTarget(); // same as t (the target HTMLElement)
-    ...
-}
-var myDiv = {@link Ext#get Ext.get}("myDiv");  // get reference to an {@link Ext.Element}
-myDiv.on(         // 'on' is shorthand for addListener
-    "click",      // perform an action on click of myDiv
-    handleClick   // reference to the action handler
-);  
-// other methods to do the same:
-Ext.EventManager.on("myDiv", 'click', handleClick);
-Ext.EventManager.addListener("myDiv", 'click', handleClick);
- </code></pre>
- * @singleton
- */
-Ext.EventObject = function(){
-    var E = Ext.lib.Event,
-       // safari keypress events for special keys return bad keycodes
-       safariKeys = {
-               3 : 13, // enter
-               63234 : 37, // left
-               63235 : 39, // right
-               63232 : 38, // up
-               63233 : 40, // down
-               63276 : 33, // page up
-               63277 : 34, // page down
-               63272 : 46, // delete
-               63273 : 36, // home
-               63275 : 35  // end
-       },
-       // normalize button clicks
-       btnMap = Ext.isIE ? {1:0,4:1,2:2} :
-                (Ext.isWebKit ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
-
-    Ext.EventObjectImpl = function(e){
-        if(e){
-            this.setEvent(e.browserEvent || e);
-        }
-    };
-
-    Ext.EventObjectImpl.prototype = {
-           /** @private */
-        setEvent : function(e){
-               var me = this;
-            if(e == me || (e && e.browserEvent)){ // already wrapped
-                return e;
-            }
-            me.browserEvent = e;
-            if(e){
-                // normalize buttons
-                me.button = e.button ? btnMap[e.button] : (e.which ? e.which - 1 : -1);
-                if(e.type == 'click' && me.button == -1){
-                    me.button = 0;
-                }
-                me.type = e.type;
-                me.shiftKey = e.shiftKey;
-                // mac metaKey behaves like ctrlKey
-                me.ctrlKey = e.ctrlKey || e.metaKey || false;
-                me.altKey = e.altKey;
-                // in getKey these will be normalized for the mac
-                me.keyCode = e.keyCode;
-                me.charCode = e.charCode;
-                // cache the target for the delayed and or buffered events
-                me.target = E.getTarget(e);
-                // same for XY
-                me.xy = E.getXY(e);
-            }else{
-                me.button = -1;
-                me.shiftKey = false;
-                me.ctrlKey = false;
-                me.altKey = false;
-                me.keyCode = 0;
-                me.charCode = 0;
-                me.target = null;
-                me.xy = [0, 0];
-            }
-            return me;
-        },
-
-        /**
-         * Stop the event (preventDefault and stopPropagation)
-         */
-        stopEvent : function(){
-               var me = this;
-            if(me.browserEvent){
-                if(me.browserEvent.type == 'mousedown'){
-                    Ext.EventManager.stoppedMouseDownEvent.fire(me);
-                }
-                E.stopEvent(me.browserEvent);
-            }
-        },
-
-        /**
-         * Prevents the browsers default handling of the event.
-         */
-        preventDefault : function(){
-            if(this.browserEvent){
-                E.preventDefault(this.browserEvent);
-            }
-        },        
-
-        /**
-         * Cancels bubbling of the event.
-         */
-        stopPropagation : function(){
-               var me = this;
-            if(me.browserEvent){
-                if(me.browserEvent.type == 'mousedown'){
-                    Ext.EventManager.stoppedMouseDownEvent.fire(me);
-                }
-                E.stopPropagation(me.browserEvent);
-            }
-        },
-
-        /**
-         * Gets the character code for the event.
-         * @return {Number}
-         */
-        getCharCode : function(){
-            return this.charCode || this.keyCode;
-        },
-
-        /**
-         * Returns a normalized keyCode for the event.
-         * @return {Number} The key code
-         */
-        getKey : function(){
-            return this.normalizeKey(this.keyCode || this.charCode)
-        },
-               
-               // private
-               normalizeKey: function(k){
-                       return Ext.isSafari ? (safariKeys[k] || k) : k; 
-               },
-
-        /**
-         * Gets the x coordinate of the event.
-         * @return {Number}
-         */
-        getPageX : function(){
-            return this.xy[0];
-        },
-
-        /**
-         * Gets the y coordinate of the event.
-         * @return {Number}
-         */
-        getPageY : function(){
-            return this.xy[1];
-        },
-
-        /**
-         * Gets the page coordinates of the event.
-         * @return {Array} The xy values like [x, y]
-         */
-        getXY : function(){
-            return this.xy;
-        },
-
-        /**
-         * Gets the target for the event.
-         * @param {String} selector (optional) A simple selector to filter the target or look for an ancestor of the target
-         * @param {Number/Mixed} maxDepth (optional) The max depth to
-                search as a number or element (defaults to 10 || document.body)
-         * @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node
-         * @return {HTMLelement}
-         */
-        getTarget : function(selector, maxDepth, returnEl){
-            return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
-        },
-
-        /**
-         * Gets the related target.
-         * @return {HTMLElement}
-         */
-        getRelatedTarget : function(){
-            return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null;
-        },
-
-        /**
-         * Normalizes mouse wheel delta across browsers
-         * @return {Number} The delta
-         */
-        getWheelDelta : function(){
-            var e = this.browserEvent;
-            var delta = 0;
-            if(e.wheelDelta){ /* IE/Opera. */
-                delta = e.wheelDelta/120;
-            }else if(e.detail){ /* Mozilla case. */
-                delta = -e.detail/3;
-            }
-            return delta;
-        },
-               
-               /**
-               * Returns true if the target of this event is a child of el.  Unless the allowEl parameter is set, it will return false if if the target is el.
-               * Example usage:<pre><code>
-               // Handle click on any child of an element
-               Ext.getBody().on('click', function(e){
-                       if(e.within('some-el')){
-                               alert('Clicked on a child of some-el!');
-                       }
-               });
-               
-               // Handle click directly on an element, ignoring clicks on child nodes
-               Ext.getBody().on('click', function(e,t){
-                       if((t.id == 'some-el') && !e.within(t, true)){
-                               alert('Clicked directly on some-el!');
-                       }
-               });
-               </code></pre>
-                * @param {Mixed} el The id, DOM element or Ext.Element to check
-                * @param {Boolean} related (optional) true to test if the related target is within el instead of the target
-                * @param {Boolean} allowEl {optional} true to also check if the passed element is the target or related target
-                * @return {Boolean}
-                */
-               within : function(el, related, allowEl){
-            if(el){
-                           var t = this[related ? "getRelatedTarget" : "getTarget"]();
-                           return t && ((allowEl ? (t == Ext.getDom(el)) : false) || Ext.fly(el).contains(t));
-            }
-            return false;
-               }
-        };
-
-    return new Ext.EventObjectImpl();
-}();/**\r
+Ext.util.Observable.observeClass = function(c, listeners){\r
+    if(c){\r
+      if(!c.fireEvent){\r
+          Ext.apply(c, new Ext.util.Observable());\r
+          Ext.util.Observable.capture(c.prototype, c.fireEvent, c);\r
+      }\r
+      if(Ext.isObject(listeners)){\r
+          c.on(listeners);\r
+      }\r
+      return c;\r
+   }\r
+};/**\r
  * @class Ext.EventManager\r
+ * Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides\r
+ * several useful events directly.\r
+ * See {@link Ext.EventObject} for more details on normalized event objects.\r
+ * @singleton\r
  */\r
-Ext.apply(Ext.EventManager, function(){\r
-       var resizeEvent, \r
-       resizeTask, \r
-       textEvent, \r
-       textSize,\r
-       D = Ext.lib.Dom,\r
-       E = Ext.lib.Event,\r
-       propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,\r
-        curWidth = 0,\r
-        curHeight = 0,\r
-        // note 1: IE fires ONLY the keydown event on specialkey autorepeat\r
-        // note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat\r
-        // (research done by @Jan Wolter at http://unixpapa.com/js/key.html)\r
-        useKeydown = Ext.isSafari ? \r
-                    Ext.num(navigator.userAgent.toLowerCase().match(/version\/(\d+\.\d)/)[1] || 2) >= 3.1 :\r
-                    !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);\r
-       \r
-       return { \r
-               // private\r
-           doResizeEvent: function(){\r
-            var h = D.getViewHeight(),\r
-                w = D.getViewWidth();\r
-            \r
-            //whacky problem in IE where the resize event will fire even though the w/h are the same.\r
-            if(curHeight != h || curWidth != w){\r
-                resizeEvent.fire(curWidth = w, curHeight = h);\r
-            }\r
-           },\r
-           \r
-           /**\r
-            * Fires when the window is resized and provides resize event buffering (50 milliseconds), passes new viewport width and height to handlers.\r
-            * @param {Function} fn        The method the event invokes\r
-            * @param {Object}   scope    An object that becomes the scope of the handler\r
-            * @param {boolean}  options\r
-            */\r
-           onWindowResize : function(fn, scope, options){\r
-               if(!resizeEvent){\r
-                   resizeEvent = new Ext.util.Event();\r
-                   resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);\r
-                   E.on(window, "resize", this.fireWindowResize, this);\r
-               }\r
-               resizeEvent.addListener(fn, scope, options);\r
-           },\r
-       \r
-           // exposed only to allow manual firing\r
-           fireWindowResize : function(){\r
-               if(resizeEvent){\r
-                   if((Ext.isIE||Ext.isAir) && resizeTask){\r
-                       resizeTask.delay(50);\r
-                   }else{\r
-                       resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
-                   }\r
-               }\r
-           },\r
-       \r
-           /**\r
-            * Fires when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.\r
-            * @param {Function} fn        The method the event invokes\r
-            * @param {Object}   scope    An object that becomes the scope of the handler\r
-            * @param {boolean}  options\r
-            */\r
-           onTextResize : function(fn, scope, options){\r
-               if(!textEvent){\r
-                   textEvent = new Ext.util.Event();\r
-                   var textEl = new Ext.Element(document.createElement('div'));\r
-                   textEl.dom.className = 'x-text-resize';\r
-                   textEl.dom.innerHTML = 'X';\r
-                   textEl.appendTo(document.body);\r
-                   textSize = textEl.dom.offsetHeight;\r
-                   setInterval(function(){\r
-                       if(textEl.dom.offsetHeight != textSize){\r
-                           textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);\r
-                       }\r
-                   }, this.textResizeInterval);\r
-               }\r
-               textEvent.addListener(fn, scope, options);\r
-           },\r
-       \r
-           /**\r
-            * Removes the passed window resize listener.\r
-            * @param {Function} fn        The method the event invokes\r
-            * @param {Object}   scope    The scope of handler\r
-            */\r
-           removeResizeListener : function(fn, scope){\r
-               if(resizeEvent){\r
-                   resizeEvent.removeListener(fn, scope);\r
-               }\r
-           },\r
-       \r
-           // private\r
-           fireResize : function(){\r
-               if(resizeEvent){\r
-                   resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
-               }\r
-           },\r
-           \r
-            /**\r
-            * The frequency, in milliseconds, to check for text resize events (defaults to 50)\r
-            */\r
-           textResizeInterval : 50,\r
-           \r
-           /**\r
-         * Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)\r
+Ext.EventManager = function(){\r
+    var docReadyEvent,\r
+        docReadyProcId,\r
+        docReadyState = false,\r
+        E = Ext.lib.Event,\r
+        D = Ext.lib.Dom,\r
+        DOC = document,\r
+        WINDOW = window,\r
+        IEDEFERED = "ie-deferred-loader",\r
+        DOMCONTENTLOADED = "DOMContentLoaded",\r
+        propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,\r
+        /*\r
+         * This cache is used to hold special js objects, the document and window, that don't have an id. We need to keep\r
+         * a reference to them so we can look them up at a later point.\r
          */\r
-        ieDeferSrc : false,\r
-        \r
-        // protected for use inside the framework\r
-        // detects whether we should use keydown or keypress based on the browser.\r
-        useKeydown: useKeydown\r
-    };\r
-}());\r
+        specialElCache = [];\r
+\r
+     function getId(el){\r
+        var id = false,\r
+            i = 0,\r
+            len = specialElCache.length,\r
+            id = false,\r
+            skip = false,\r
+            o;\r
+        if(el){\r
+            if(el.getElementById || el.navigator){\r
+                // look up the id\r
+                for(; i < len; ++i){\r
+                    o = specialElCache[i];\r
+                    if(o.el === el){\r
+                        id = o.id;\r
+                        break;\r
+                    }\r
+                }\r
+                if(!id){\r
+                    // for browsers that support it, ensure that give the el the same id\r
+                    id = Ext.id(el);\r
+                    specialElCache.push({\r
+                        id: id,\r
+                        el: el\r
+                    });\r
+                    skip = true;\r
+                }\r
+            }else{\r
+                id = Ext.id(el);\r
+            }\r
+            if(!Ext.elCache[id]){\r
+                Ext.Element.addToCache(new Ext.Element(el), id);\r
+                if(skip){\r
+                    Ext.elCache[id].skipGC = true;\r
+                }\r
+            }\r
+        }\r
+        return id;\r
+     };\r
 \r
-Ext.EventManager.on = Ext.EventManager.addListener;\r
-\r
-\r
-Ext.apply(Ext.EventObjectImpl.prototype, {\r
-    /** Key constant @type Number */\r
-    BACKSPACE: 8,\r
-    /** Key constant @type Number */\r
-    TAB: 9,\r
-    /** Key constant @type Number */\r
-    NUM_CENTER: 12,\r
-    /** Key constant @type Number */\r
-    ENTER: 13,\r
-    /** Key constant @type Number */\r
-    RETURN: 13,\r
-    /** Key constant @type Number */\r
-    SHIFT: 16,\r
-    /** Key constant @type Number */\r
-    CTRL: 17,\r
-    CONTROL : 17, // legacy\r
-    /** Key constant @type Number */\r
-    ALT: 18,\r
-    /** Key constant @type Number */\r
-    PAUSE: 19,\r
-    /** Key constant @type Number */\r
-    CAPS_LOCK: 20,\r
-    /** Key constant @type Number */\r
-    ESC: 27,\r
-    /** Key constant @type Number */\r
-    SPACE: 32,\r
-    /** Key constant @type Number */\r
-    PAGE_UP: 33,\r
-    PAGEUP : 33, // legacy\r
-    /** Key constant @type Number */\r
-    PAGE_DOWN: 34,\r
-    PAGEDOWN : 34, // legacy\r
-    /** Key constant @type Number */\r
-    END: 35,\r
-    /** Key constant @type Number */\r
-    HOME: 36,\r
-    /** Key constant @type Number */\r
-    LEFT: 37,\r
-    /** Key constant @type Number */\r
-    UP: 38,\r
-    /** Key constant @type Number */\r
-    RIGHT: 39,\r
-    /** Key constant @type Number */\r
-    DOWN: 40,\r
-    /** Key constant @type Number */\r
-    PRINT_SCREEN: 44,\r
-    /** Key constant @type Number */\r
-    INSERT: 45,\r
-    /** Key constant @type Number */\r
-    DELETE: 46,\r
-    /** Key constant @type Number */\r
-    ZERO: 48,\r
-    /** Key constant @type Number */\r
-    ONE: 49,\r
-    /** Key constant @type Number */\r
-    TWO: 50,\r
-    /** Key constant @type Number */\r
-    THREE: 51,\r
-    /** Key constant @type Number */\r
-    FOUR: 52,\r
-    /** Key constant @type Number */\r
-    FIVE: 53,\r
-    /** Key constant @type Number */\r
-    SIX: 54,\r
-    /** Key constant @type Number */\r
-    SEVEN: 55,\r
-    /** Key constant @type Number */\r
-    EIGHT: 56,\r
-    /** Key constant @type Number */\r
-    NINE: 57,\r
-    /** Key constant @type Number */\r
-    A: 65,\r
-    /** Key constant @type Number */\r
-    B: 66,\r
-    /** Key constant @type Number */\r
-    C: 67,\r
-    /** Key constant @type Number */\r
-    D: 68,\r
-    /** Key constant @type Number */\r
-    E: 69,\r
-    /** Key constant @type Number */\r
-    F: 70,\r
-    /** Key constant @type Number */\r
-    G: 71,\r
-    /** Key constant @type Number */\r
-    H: 72,\r
-    /** Key constant @type Number */\r
-    I: 73,\r
-    /** Key constant @type Number */\r
-    J: 74,\r
-    /** Key constant @type Number */\r
-    K: 75,\r
-    /** Key constant @type Number */\r
-    L: 76,\r
-    /** Key constant @type Number */\r
-    M: 77,\r
-    /** Key constant @type Number */\r
-    N: 78,\r
-    /** Key constant @type Number */\r
-    O: 79,\r
-    /** Key constant @type Number */\r
-    P: 80,\r
-    /** Key constant @type Number */\r
-    Q: 81,\r
-    /** Key constant @type Number */\r
-    R: 82,\r
-    /** Key constant @type Number */\r
-    S: 83,\r
-    /** Key constant @type Number */\r
-    T: 84,\r
-    /** Key constant @type Number */\r
-    U: 85,\r
-    /** Key constant @type Number */\r
-    V: 86,\r
-    /** Key constant @type Number */\r
-    W: 87,\r
-    /** Key constant @type Number */\r
-    X: 88,\r
-    /** Key constant @type Number */\r
-    Y: 89,\r
-    /** Key constant @type Number */\r
-    Z: 90,\r
-    /** Key constant @type Number */\r
-    CONTEXT_MENU: 93,\r
-    /** Key constant @type Number */\r
-    NUM_ZERO: 96,\r
-    /** Key constant @type Number */\r
-    NUM_ONE: 97,\r
-    /** Key constant @type Number */\r
-    NUM_TWO: 98,\r
-    /** Key constant @type Number */\r
-    NUM_THREE: 99,\r
-    /** Key constant @type Number */\r
-    NUM_FOUR: 100,\r
-    /** Key constant @type Number */\r
-    NUM_FIVE: 101,\r
-    /** Key constant @type Number */\r
-    NUM_SIX: 102,\r
-    /** Key constant @type Number */\r
-    NUM_SEVEN: 103,\r
-    /** Key constant @type Number */\r
-    NUM_EIGHT: 104,\r
-    /** Key constant @type Number */\r
-    NUM_NINE: 105,\r
-    /** Key constant @type Number */\r
-    NUM_MULTIPLY: 106,\r
-    /** Key constant @type Number */\r
-    NUM_PLUS: 107,\r
-    /** Key constant @type Number */\r
-    NUM_MINUS: 109,\r
-    /** Key constant @type Number */\r
-    NUM_PERIOD: 110,\r
-    /** Key constant @type Number */\r
-    NUM_DIVISION: 111,\r
-    /** Key constant @type Number */\r
-    F1: 112,\r
-    /** Key constant @type Number */\r
-    F2: 113,\r
-    /** Key constant @type Number */\r
-    F3: 114,\r
-    /** Key constant @type Number */\r
-    F4: 115,\r
-    /** Key constant @type Number */\r
-    F5: 116,\r
-    /** Key constant @type Number */\r
-    F6: 117,\r
-    /** Key constant @type Number */\r
-    F7: 118,\r
-    /** Key constant @type Number */\r
-    F8: 119,\r
-    /** Key constant @type Number */\r
-    F9: 120,\r
-    /** Key constant @type Number */\r
-    F10: 121,\r
-    /** Key constant @type Number */\r
-    F11: 122,\r
-    /** Key constant @type Number */\r
-    F12: 123,  \r
-    \r
-    /** @private */\r
-    isNavKeyPress : function(){\r
-        var me = this,\r
-               k = this.normalizeKey(me.keyCode);              \r
-        return (k >= 33 && k <= 40) ||  // Page Up/Down, End, Home, Left, Up, Right, Down\r
-               k == me.RETURN ||\r
-               k == me.TAB ||\r
-               k == me.ESC;\r
-    },\r
+    /// There is some jquery work around stuff here that isn't needed in Ext Core.\r
+    function addListener(el, ename, fn, wrap, scope){\r
+        el = Ext.getDom(el);\r
+        var id = getId(el),\r
+            es = Ext.elCache[id].events,\r
+            wfn;\r
+\r
+        wfn = E.on(el, ename, wrap);\r
+        es[ename] = es[ename] || [];\r
+        es[ename].push([fn, wrap, scope, wfn]);\r
+\r
+        // this is a workaround for jQuery and should somehow be removed from Ext Core in the future\r
+        // without breaking ExtJS.\r
+        if(ename == "mousewheel" && el.addEventListener){ // workaround for jQuery\r
+            var args = ["DOMMouseScroll", wrap, false];\r
+            el.addEventListener.apply(el, args);\r
+            Ext.EventManager.addListener(WINDOW, 'unload', function(){\r
+                el.removeEventListener.apply(el, args);\r
+            });\r
+        }\r
+        if(ename == "mousedown" && el == document){ // fix stopped mousedowns on the document\r
+            Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);\r
+        }\r
+    };\r
 \r
-    isSpecialKey : function(){\r
-        var k = this.normalizeKey(this.keyCode);\r
-        return (this.type == 'keypress' && this.ctrlKey) ||\r
-               this.isNavKeyPress() ||\r
-        (k == this.BACKSPACE) || // Backspace\r
-               (k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock\r
-               (k >= 44 && k <= 45);   // Print Screen, Insert\r
-    },\r
-       \r
-       getPoint : function(){\r
-           return new Ext.lib.Point(this.xy[0], this.xy[1]);\r
-       },\r
+    function fireDocReady(){\r
+        if(!docReadyState){\r
+            Ext.isReady = docReadyState = true;\r
+            if(docReadyProcId){\r
+                clearInterval(docReadyProcId);\r
+            }\r
+            if(Ext.isGecko || Ext.isOpera) {\r
+                DOC.removeEventListener(DOMCONTENTLOADED, fireDocReady, false);\r
+            }\r
+            if(Ext.isIE){\r
+                var defer = DOC.getElementById(IEDEFERED);\r
+                if(defer){\r
+                    defer.onreadystatechange = null;\r
+                    defer.parentNode.removeChild(defer);\r
+                }\r
+            }\r
+            if(docReadyEvent){\r
+                docReadyEvent.fire();\r
+                docReadyEvent.listeners = []; // clearListeners no longer compatible.  Force single: true?\r
+            }\r
+        }\r
+    };\r
 \r
-    /**\r
-     * Returns true if the control, meta, shift or alt key was pressed during this event.\r
-     * @return {Boolean}\r
-     */\r
-    hasModifier : function(){\r
-        return ((this.ctrlKey || this.altKey) || this.shiftKey);\r
-    }\r
-});/**\r
- * @class Ext.Element\r
- * <p>Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.</p>\r
- * <p>All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.</p>\r
- * <p>Note that the events documented in this class are not Ext events, they encapsulate browser events. To\r
- * access the underlying browser event, see {@link Ext.EventObject#browserEvent}. Some older\r
- * browsers may not support the full range of events. Which events are supported is beyond the control of ExtJs.</p>\r
- * Usage:<br>\r
-<pre><code>\r
-// by id\r
-var el = Ext.get("my-div");\r
-\r
-// by DOM element reference\r
-var el = Ext.get(myDivElement);\r
-</code></pre>\r
- * <b>Animations</b><br />\r
- * <p>When an element is manipulated, by default there is no animation.</p>\r
- * <pre><code>\r
-var el = Ext.get("my-div");\r
-\r
-// no animation\r
-el.setWidth(100);\r
- * </code></pre>\r
- * <p>Many of the functions for manipulating an element have an optional "animate" parameter.  This\r
- * parameter can be specified as boolean (<tt>true</tt>) for default animation effects.</p>\r
- * <pre><code>\r
-// default animation\r
-el.setWidth(100, true);\r
- * </code></pre>\r
- * \r
- * <p>To configure the effects, an object literal with animation options to use as the Element animation\r
- * configuration object can also be specified. Note that the supported Element animation configuration\r
- * options are a subset of the {@link Ext.Fx} animation options specific to Fx effects.  The supported\r
- * Element animation configuration options are:</p>\r
-<pre>\r
-Option    Default   Description\r
---------- --------  ---------------------------------------------\r
-{@link Ext.Fx#duration duration}  .35       The duration of the animation in seconds\r
-{@link Ext.Fx#easing easing}    easeOut   The easing method\r
-{@link Ext.Fx#callback callback}  none      A function to execute when the anim completes\r
-{@link Ext.Fx#scope scope}     this      The scope (this) of the callback function\r
-</pre>\r
- * \r
- * <pre><code>\r
-// Element animation options object\r
-var opt = {\r
-    {@link Ext.Fx#duration duration}: 1,\r
-    {@link Ext.Fx#easing easing}: 'elasticIn',\r
-    {@link Ext.Fx#callback callback}: this.foo,\r
-    {@link Ext.Fx#scope scope}: this\r
-};\r
-// animation with some options set\r
-el.setWidth(100, opt);\r
- * </code></pre>\r
- * <p>The Element animation object being used for the animation will be set on the options\r
- * object as "anim", which allows you to stop or manipulate the animation. Here is an example:</p>\r
- * <pre><code>\r
-// using the "anim" property to get the Anim object\r
-if(opt.anim.isAnimated()){\r
-    opt.anim.stop();\r
-}\r
- * </code></pre>\r
- * <p>Also see the <tt>{@link #animate}</tt> method for another animation technique.</p>\r
- * <p><b> Composite (Collections of) Elements</b></p>\r
- * <p>For working with collections of Elements, see {@link Ext.CompositeElement}</p>\r
- * @constructor Create a new Element directly.\r
- * @param {String/HTMLElement} element\r
- * @param {Boolean} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).\r
- */\r
-(function(){\r
-var DOC = document;\r
-\r
-Ext.Element = function(element, forceNew){\r
-    var dom = typeof element == "string" ?\r
-              DOC.getElementById(element) : element,\r
-        id;\r
+    function initDocReady(){\r
+        var COMPLETE = "complete";\r
+\r
+        docReadyEvent = new Ext.util.Event();\r
+        if (Ext.isGecko || Ext.isOpera) {\r
+            DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);\r
+        } else if (Ext.isIE){\r
+            DOC.write("<s"+'cript id=' + IEDEFERED + ' defer="defer" src="/'+'/:"></s'+"cript>");\r
+            DOC.getElementById(IEDEFERED).onreadystatechange = function(){\r
+                if(this.readyState == COMPLETE){\r
+                    fireDocReady();\r
+                }\r
+            };\r
+        } else if (Ext.isWebKit){\r
+            docReadyProcId = setInterval(function(){\r
+                if(DOC.readyState == COMPLETE) {\r
+                    fireDocReady();\r
+                 }\r
+            }, 10);\r
+        }\r
+        // no matter what, make sure it fires on load\r
+        E.on(WINDOW, "load", fireDocReady);\r
+    };\r
 \r
-    if(!dom) return null;\r
+    function createTargeted(h, o){\r
+        return function(){\r
+            var args = Ext.toArray(arguments);\r
+            if(o.target == Ext.EventObject.setEvent(args[0]).target){\r
+                h.apply(this, args);\r
+            }\r
+        };\r
+    };\r
 \r
-    id = dom.id;\r
+    function createBuffered(h, o, fn){\r
+        fn.task = new Ext.util.DelayedTask(h);\r
+        var w = function(e){\r
+            // create new event object impl so new events don't wipe out properties\r
+            fn.task.delay(o.buffer, h, null, [new Ext.EventObjectImpl(e)]);\r
+        };\r
+        return w;\r
+    };\r
 \r
-    if(!forceNew && id && Ext.Element.cache[id]){ // element object already exists\r
-        return Ext.Element.cache[id];\r
-    }\r
+    function createSingle(h, el, ename, fn, scope){\r
+        return function(e){\r
+            Ext.EventManager.removeListener(el, ename, fn, scope);\r
+            h(e);\r
+        };\r
+    };\r
 \r
-    /**\r
-     * The DOM element\r
-     * @type HTMLElement\r
-     */\r
-    this.dom = dom;\r
+    function createDelayed(h, o, fn){\r
+        return function(e){\r
+            var task = new Ext.util.DelayedTask(h);\r
+            if(!fn.tasks) {\r
+                fn.tasks = [];\r
+            }\r
+            fn.tasks.push(task);\r
+            task.delay(o.delay || 10, h, null, [new Ext.EventObjectImpl(e)]);\r
+        };\r
+    };\r
 \r
-    /**\r
-     * The DOM element ID\r
-     * @type String\r
-     */\r
-    this.id = id || Ext.id(dom);\r
-};\r
+    function listen(element, ename, opt, fn, scope){\r
+        var o = !Ext.isObject(opt) ? {} : opt,\r
+            el = Ext.getDom(element);\r
 \r
-var D = Ext.lib.Dom,\r
-    DH = Ext.DomHelper,\r
-    E = Ext.lib.Event,\r
-    A = Ext.lib.Anim,\r
-    El = Ext.Element;\r
+        fn = fn || o.fn;\r
+        scope = scope || o.scope;\r
 \r
-El.prototype = {\r
-    /**\r
-     * Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)\r
-     * @param {Object} o The object with the attributes\r
-     * @param {Boolean} useSet (optional) false to override the default setAttribute to use expandos.\r
-     * @return {Ext.Element} this\r
-     */\r
-    set : function(o, useSet){\r
-        var el = this.dom,\r
-            attr,\r
-            val;        \r
-       \r
-        for(attr in o){\r
-            val = o[attr];\r
-            if (attr != "style" && !Ext.isFunction(val)) {\r
-                if (attr == "cls" ) {\r
-                    el.className = val;\r
-                } else if (o.hasOwnProperty(attr)) {\r
-                    if (useSet || !!el.setAttribute) el.setAttribute(attr, val);\r
-                    else el[attr] = val;\r
+        if(!el){\r
+            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';\r
+        }\r
+        function h(e){\r
+            // prevent errors while unload occurring\r
+            if(!Ext){// !window[xname]){  ==> can't we do this?\r
+                return;\r
+            }\r
+            e = Ext.EventObject.setEvent(e);\r
+            var t;\r
+            if (o.delegate) {\r
+                if(!(t = e.getTarget(o.delegate, el))){\r
+                    return;\r
                 }\r
+            } else {\r
+                t = e.target;\r
+            }\r
+            if (o.stopEvent) {\r
+                e.stopEvent();\r
             }\r
+            if (o.preventDefault) {\r
+               e.preventDefault();\r
+            }\r
+            if (o.stopPropagation) {\r
+                e.stopPropagation();\r
+            }\r
+            if (o.normalized) {\r
+                e = e.browserEvent;\r
+            }\r
+\r
+            fn.call(scope || el, e, t, o);\r
+        };\r
+        if(o.target){\r
+            h = createTargeted(h, o);\r
         }\r
-        if(o.style){\r
-            Ext.DomHelper.applyStyles(el, o.style);\r
+        if(o.delay){\r
+            h = createDelayed(h, o, fn);\r
+        }\r
+        if(o.single){\r
+            h = createSingle(h, el, ename, fn, scope);\r
+        }\r
+        if(o.buffer){\r
+            h = createBuffered(h, o, fn);\r
         }\r
-        return this;\r
-    },\r
-    \r
-//  Mouse events\r
-    /**\r
-     * @event click\r
-     * Fires when a mouse click is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event dblclick\r
-     * Fires when a mouse double click is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mousedown\r
-     * Fires when a mousedown is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mouseup\r
-     * Fires when a mouseup is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mouseover\r
-     * Fires when a mouseover is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mousemove\r
-     * Fires when a mousemove is detected with the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mouseout\r
-     * Fires when a mouseout is detected with the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mouseenter\r
-     * Fires when the mouse enters the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event mouseleave\r
-     * Fires when the mouse leaves the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    \r
-//  Keyboard events\r
-    /**\r
-     * @event keypress\r
-     * Fires when a keypress is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event keydown\r
-     * Fires when a keydown is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event keyup\r
-     * Fires when a keyup is detected within the element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-\r
 \r
-//  HTML frame/object events\r
-    /**\r
-     * @event load\r
-     * Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event unload\r
-     * Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event abort\r
-     * Fires when an object/image is stopped from loading before completely loaded.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event error\r
-     * Fires when an object/image/frame cannot be loaded properly.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event resize\r
-     * Fires when a document view is resized.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event scroll\r
-     * Fires when a document view is scrolled.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
+        addListener(el, ename, fn, h, scope);\r
+        return h;\r
+    };\r
 \r
-//  Form events\r
-    /**\r
-     * @event select\r
-     * Fires when a user selects some text in a text field, including input and textarea.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event change\r
-     * Fires when a control loses the input focus and its value has been modified since gaining focus.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event submit\r
-     * Fires when a form is submitted.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event reset\r
-     * Fires when a form is reset.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event focus\r
-     * Fires when an element receives focus either via the pointing device or by tab navigation.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event blur\r
-     * Fires when an element loses focus either via the pointing device or by tabbing navigation.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
+    var pub = {\r
+        /**\r
+         * Appends an event handler to an element.  The shorthand version {@link #on} is equivalent.  Typically you will\r
+         * use {@link Ext.Element#addListener} directly on an Element in favor of calling this version.\r
+         * @param {String/HTMLElement} el The html element or id to assign the event handler to.\r
+         * @param {String} eventName The name of the event to listen for.\r
+         * @param {Function} handler The handler function the event invokes. This function is passed\r
+         * the following parameters:<ul>\r
+         * <li>evt : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>\r
+         * <li>t : Element<div class="sub-desc">The {@link Ext.Element Element} which was the target of the event.\r
+         * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>\r
+         * <li>o : Object<div class="sub-desc">The options object from the addListener call.</div></li>\r
+         * </ul>\r
+         * @param {Object} scope (optional) The scope (<b><code>this</code></b> reference) in which the handler function is executed. <b>Defaults to the Element</b>.\r
+         * @param {Object} options (optional) An object containing handler configuration properties.\r
+         * This may contain any of the following properties:<ul>\r
+         * <li>scope : Object<div class="sub-desc">The scope (<b><code>this</code></b> reference) in which the handler function is executed. <b>Defaults to the Element</b>.</div></li>\r
+         * <li>delegate : String<div class="sub-desc">A simple selector to filter the target or look for a descendant of the target</div></li>\r
+         * <li>stopEvent : Boolean<div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>\r
+         * <li>preventDefault : Boolean<div class="sub-desc">True to prevent the default action</div></li>\r
+         * <li>stopPropagation : Boolean<div class="sub-desc">True to prevent event propagation</div></li>\r
+         * <li>normalized : Boolean<div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>\r
+         * <li>delay : Number<div class="sub-desc">The number of milliseconds to delay the invocation of the handler after te event fires.</div></li>\r
+         * <li>single : Boolean<div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>\r
+         * <li>buffer : Number<div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed\r
+         * by the specified number of milliseconds. If the event fires again within that time, the original\r
+         * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>\r
+         * <li>target : Element<div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>\r
+         * </ul><br>\r
+         * <p>See {@link Ext.Element#addListener} for examples of how to use these options.</p>\r
+         */\r
+        addListener : function(element, eventName, fn, scope, options){\r
+            if(Ext.isObject(eventName)){\r
+                var o = eventName, e, val;\r
+                for(e in o){\r
+                    val = o[e];\r
+                    if(!propRe.test(e)){\r
+                        if(Ext.isFunction(val)){\r
+                            // shared options\r
+                            listen(element, e, o, val, o.scope);\r
+                        }else{\r
+                            // individual options\r
+                            listen(element, e, val);\r
+                        }\r
+                    }\r
+                }\r
+            } else {\r
+                listen(element, eventName, options, fn, scope);\r
+            }\r
+        },\r
 \r
-//  User Interface events\r
-    /**\r
-     * @event DOMFocusIn\r
-     * Where supported. Similar to HTML focus event, but can be applied to any focusable element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMFocusOut\r
-     * Where supported. Similar to HTML blur event, but can be applied to any focusable element.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMActivate\r
-     * Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
+        /**\r
+         * Removes an event handler from an element.  The shorthand version {@link #un} is equivalent.  Typically\r
+         * you will use {@link Ext.Element#removeListener} directly on an Element in favor of calling this version.\r
+         * @param {String/HTMLElement} el The id or html element from which to remove the listener.\r
+         * @param {String} eventName The name of the event.\r
+         * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>\r
+         * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,\r
+         * then this must refer to the same object.\r
+         */\r
+        removeListener : function(el, eventName, fn, scope){\r
+            el = Ext.getDom(el);\r
+            var id = getId(el),\r
+                f = el && (Ext.elCache[id].events)[eventName] || [],\r
+                wrap, i, l, k, wf;\r
+\r
+            for (i = 0, len = f.length; i < len; i++) {\r
+                if (Ext.isArray(f[i]) && f[i][0] == fn && (!scope || f[i][2] == scope)) {\r
+                    if(fn.task) {\r
+                        fn.task.cancel();\r
+                        delete fn.task;\r
+                    }\r
+                    k = fn.tasks && fn.tasks.length;\r
+                    if(k) {\r
+                        while(k--) {\r
+                            fn.tasks[k].cancel();\r
+                        }\r
+                        delete fn.tasks;\r
+                    }\r
+                    wf = wrap = f[i][1];\r
+                    if (E.extAdapter) {\r
+                        wf = f[i][3];\r
+                    }\r
+                    E.un(el, eventName, wf);\r
+                    f.splice(i,1);\r
+                    if (f.length === 0) {\r
+                        delete Ext.elCache[id].events[eventName];\r
+                    }\r
+                    for (k in Ext.elCache[id].events) {\r
+                        return false;\r
+                    }\r
+                    Ext.elCache[id].events = {};\r
+                    return false;\r
+                }\r
+            }\r
 \r
-//  DOM Mutation events\r
-    /**\r
-     * @event DOMSubtreeModified\r
-     * Where supported. Fires when the subtree is modified.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMNodeInserted\r
-     * Where supported. Fires when a node has been added as a child of another node.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMNodeRemoved\r
-     * Where supported. Fires when a descendant node of the element is removed.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMNodeRemovedFromDocument\r
-     * Where supported. Fires when a node is being removed from a document.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMNodeInsertedIntoDocument\r
-     * Where supported. Fires when a node is being inserted into a document.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMAttrModified\r
-     * Where supported. Fires when an attribute has been modified.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
-    /**\r
-     * @event DOMCharacterDataModified\r
-     * Where supported. Fires when the character data has been modified.\r
-     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.\r
-     * @param {HtmlElement} t The target of the event.\r
-     * @param {Object} o The options configuration passed to the {@link #addListener} call.\r
-     */\r
+            // jQuery workaround that should be removed from Ext Core\r
+            if(eventName == "mousewheel" && el.addEventListener && wrap){\r
+                el.removeEventListener("DOMMouseScroll", wrap, false);\r
+            }\r
 \r
-    /**\r
-     * The default unit to append to CSS values where a unit isn't provided (defaults to px).\r
-     * @type String\r
-     */\r
-    defaultUnit : "px",\r
+            if(eventName == "mousedown" && el == DOC && wrap){ // fix stopped mousedowns on the document\r
+                Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);\r
+            }\r
+        },\r
 \r
-    /**\r
-     * Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)\r
-     * @param {String} selector The simple selector to test\r
-     * @return {Boolean} True if this element matches the selector, else false\r
-     */\r
-    is : function(simpleSelector){\r
-        return Ext.DomQuery.is(this.dom, simpleSelector);\r
-    },\r
+        /**\r
+         * Removes all event handers from an element.  Typically you will use {@link Ext.Element#removeAllListeners}\r
+         * directly on an Element in favor of calling this version.\r
+         * @param {String/HTMLElement} el The id or html element from which to remove all event handlers.\r
+         */\r
+        removeAll : function(el){\r
+            el = Ext.getDom(el);\r
+            var id = getId(el),\r
+                ec = Ext.elCache[id] || {},\r
+                es = ec.events || {},\r
+                f, i, len, ename, fn, k;\r
+\r
+            for(ename in es){\r
+                if(es.hasOwnProperty(ename)){\r
+                    f = es[ename];\r
+                    for (i = 0, len = f.length; i < len; i++) {\r
+                        fn = f[i][0];\r
+                        if(fn.task) {\r
+                            fn.task.cancel();\r
+                            delete fn.task;\r
+                        }\r
+                        if(fn.tasks && (k = fn.tasks.length)) {\r
+                            while(k--) {\r
+                                fn.tasks[k].cancel();\r
+                            }\r
+                            delete fn.tasks;\r
+                        }\r
+                        E.un(el, ename, E.extAdapter ? f[i][3] : f[i][1]);\r
+                    }\r
+                }\r
+            }\r
+            if (Ext.elCache[id]) {\r
+                Ext.elCache[id].events = {};\r
+            }\r
+        },\r
 \r
-    /**\r
-     * Tries to focus the element. Any exceptions are caught and ignored.\r
-     * @param {Number} defer (optional) Milliseconds to defer the focus\r
-     * @return {Ext.Element} this\r
-     */\r
-    focus : function(defer, /* private */ dom) {\r
-        var me = this,\r
-            dom = dom || me.dom;\r
-        try{\r
-            if(Number(defer)){\r
-                me.focus.defer(defer, null, [null, dom]);\r
-            }else{\r
-                dom.focus();\r
+        getListeners : function(el, eventName) {\r
+            el = Ext.getDom(el);\r
+            var id = getId(el),\r
+                ec = Ext.elCache[id] || {},\r
+                es = ec.events || {},\r
+                results = [];\r
+            if (es && es[eventName]) {\r
+                return es[eventName];\r
+            } else {\r
+                return null;\r
             }\r
-        }catch(e){}\r
-        return me;\r
-    },\r
+        },\r
 \r
-    /**\r
-     * Tries to blur the element. Any exceptions are caught and ignored.\r
-     * @return {Ext.Element} this\r
-     */\r
-    blur : function() {\r
-        try{\r
-            this.dom.blur();\r
-        }catch(e){}\r
-        return this;\r
-    },\r
+        purgeElement : function(el, recurse, eventName) {\r
+            el = Ext.getDom(el);\r
+            var id = getId(el),\r
+                ec = Ext.elCache[id] || {},\r
+                es = ec.events || {},\r
+                i, f, len;\r
+            if (eventName) {\r
+                if (es && es.hasOwnProperty(eventName)) {\r
+                    f = es[eventName];\r
+                    for (i = 0, len = f.length; i < len; i++) {\r
+                        Ext.EventManager.removeListener(el, eventName, f[i][0]);\r
+                    }\r
+                }\r
+            } else {\r
+                Ext.EventManager.removeAll(el);\r
+            }\r
+            if (recurse && el && el.childNodes) {\r
+                for (i = 0, len = el.childNodes.length; i < len; i++) {\r
+                    Ext.EventManager.purgeElement(el.childNodes[i], recurse, eventName);\r
+                }\r
+            }\r
+        },\r
 \r
-    /**\r
-     * Returns the value of the "value" attribute\r
-     * @param {Boolean} asNumber true to parse the value as a number\r
-     * @return {String/Number}\r
-     */\r
-    getValue : function(asNumber){\r
-        var val = this.dom.value;\r
-        return asNumber ? parseInt(val, 10) : val;\r
-    },\r
+        _unload : function() {\r
+            var el;\r
+            for (el in Ext.elCache) {\r
+                Ext.EventManager.removeAll(el);\r
+            }\r
+        },\r
+        /**\r
+         * Adds a listener to be notified when the document is ready (before onload and before images are loaded). Can be\r
+         * accessed shorthanded as Ext.onReady().\r
+         * @param {Function} fn The method the event invokes.\r
+         * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.\r
+         * @param {boolean} options (optional) Options object as passed to {@link Ext.Element#addListener}. It is recommended that the options\r
+         * <code>{single: true}</code> be used so that the handler is removed on first invocation.\r
+         */\r
+        onDocumentReady : function(fn, scope, options){\r
+            if(docReadyState){ // if it already fired\r
+                docReadyEvent.addListener(fn, scope, options);\r
+                docReadyEvent.fire();\r
+                docReadyEvent.listeners = []; // clearListeners no longer compatible.  Force single: true?\r
+            } else {\r
+                if(!docReadyEvent) initDocReady();\r
+                options = options || {};\r
+                options.delay = options.delay || 1;\r
+                docReadyEvent.addListener(fn, scope, options);\r
+            }\r
+        }\r
+    };\r
+     /**\r
+     * Appends an event handler to an element.  Shorthand for {@link #addListener}.\r
+     * @param {String/HTMLElement} el The html element or id to assign the event handler to\r
+     * @param {String} eventName The name of the event to listen for.\r
+     * @param {Function} handler The handler function the event invokes.\r
+     * @param {Object} scope (optional) (<code>this</code> reference) in which the handler function executes. <b>Defaults to the Element</b>.\r
+     * @param {Object} options (optional) An object containing standard {@link #addListener} options\r
+     * @member Ext.EventManager\r
+     * @method on\r
+     */\r
+    pub.on = pub.addListener;\r
+    /**\r
+     * Removes an event handler from an element.  Shorthand for {@link #removeListener}.\r
+     * @param {String/HTMLElement} el The id or html element from which to remove the listener.\r
+     * @param {String} eventName The name of the event.\r
+     * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #on} call.</b>\r
+     * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,\r
+     * then this must refer to the same object.\r
+     * @member Ext.EventManager\r
+     * @method un\r
+     */\r
+    pub.un = pub.removeListener;\r
+\r
+    pub.stoppedMouseDownEvent = new Ext.util.Event();\r
+    return pub;\r
+}();\r
+/**\r
+  * Adds a listener to be notified when the document is ready (before onload and before images are loaded). Shorthand of {@link Ext.EventManager#onDocumentReady}.\r
+  * @param {Function} fn The method the event invokes.\r
+  * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.\r
+  * @param {boolean} options (optional) Options object as passed to {@link Ext.Element#addListener}. It is recommended that the options\r
+  * <code>{single: true}</code> be used so that the handler is removed on first invocation.\r
+  * @member Ext\r
+  * @method onReady\r
+ */\r
+Ext.onReady = Ext.EventManager.onDocumentReady;\r
 \r
-    /**\r
-     * Appends an event handler to this element.  The shorthand version {@link #on} is equivalent.\r
-     * @param {String} eventName The type of event to handle\r
-     * @param {Function} fn The handler function the event invokes. This function is passed\r
-     * the following parameters:<ul>\r
-     * <li><b>evt</b> : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>\r
-     * <li><b>el</b> : Element<div class="sub-desc">The {@link Ext.Element Element} which was the target of the event.\r
-     * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>\r
-     * <li><b>o</b> : Object<div class="sub-desc">The options object from the addListener call.</div></li>\r
-     * </ul>\r
-     * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.\r
-     * <b>If omitted, defaults to this Element.</b>.\r
-     * @param {Object} options (optional) An object containing handler configuration properties.\r
-     * This may contain any of the following properties:<ul>\r
-     * <li><b>scope</b> Object : <div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.\r
-     * <b>If omitted, defaults to this Element.</b></div></li>\r
-     * <li><b>delegate</b> String: <div class="sub-desc">A simple selector to filter the target or look for a descendant of the target. See below for additional details.</div></li>\r
-     * <li><b>stopEvent</b> Boolean: <div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>\r
-     * <li><b>preventDefault</b> Boolean: <div class="sub-desc">True to prevent the default action</div></li>\r
-     * <li><b>stopPropagation</b> Boolean: <div class="sub-desc">True to prevent event propagation</div></li>\r
-     * <li><b>normalized</b> Boolean: <div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>\r
-     * <li><b>target</b> Ext.Element: <div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>\r
-     * <li><b>delay</b> Number: <div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>\r
-     * <li><b>single</b> Boolean: <div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>\r
-     * <li><b>buffer</b> Number: <div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed\r
-     * by the specified number of milliseconds. If the event fires again within that time, the original\r
-     * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>\r
-     * </ul><br>\r
-     * <p>\r
-     * <b>Combining Options</b><br>\r
-     * In the following examples, the shorthand form {@link #on} is used rather than the more verbose\r
-     * addListener.  The two are equivalent.  Using the options argument, it is possible to combine different\r
-     * types of listeners:<br>\r
-     * <br>\r
-     * A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the\r
-     * options object. The options object is available as the third parameter in the handler function.<div style="margin: 5px 20px 20px;">\r
-     * Code:<pre><code>\r
-el.on('click', this.onClick, this, {\r
-    single: true,\r
-    delay: 100,\r
-    stopEvent : true,\r
-    forumId: 4\r
-});</code></pre></p>\r
-     * <p>\r
-     * <b>Attaching multiple handlers in 1 call</b><br>\r
-     * The method also allows for a single argument to be passed which is a config object containing properties\r
-     * which specify multiple handlers.</p>\r
-     * <p>\r
-     * Code:<pre><code>\r
-el.on({\r
-    'click' : {\r
-        fn: this.onClick,\r
-        scope: this,\r
-        delay: 100\r
-    },\r
-    'mouseover' : {\r
-        fn: this.onMouseOver,\r
-        scope: this\r
-    },\r
-    'mouseout' : {\r
-        fn: this.onMouseOut,\r
-        scope: this\r
-    }\r
-});</code></pre>\r
-     * <p>\r
-     * Or a shorthand syntax:<br>\r
-     * Code:<pre><code></p>\r
-el.on({\r
-    'click' : this.onClick,\r
-    'mouseover' : this.onMouseOver,\r
-    'mouseout' : this.onMouseOut,\r
-    scope: this\r
-});\r
-     * </code></pre></p>\r
-     * <p><b>delegate</b></p>\r
-     * <p>This is a configuration option that you can pass along when registering a handler for\r
-     * an event to assist with event delegation. Event delegation is a technique that is used to\r
-     * reduce memory consumption and prevent exposure to memory-leaks. By registering an event\r
-     * for a container element as opposed to each element within a container. By setting this\r
-     * configuration option to a simple selector, the target element will be filtered to look for\r
-     * a descendant of the target.\r
-     * For example:<pre><code>\r
-// using this markup:\r
-&lt;div id='elId'>\r
-    &lt;p id='p1'>paragraph one&lt;/p>\r
-    &lt;p id='p2' class='clickable'>paragraph two&lt;/p>\r
-    &lt;p id='p3'>paragraph three&lt;/p>\r
-&lt;/div>\r
-// utilize event delegation to registering just one handler on the container element: \r
-el = Ext.get('elId');\r
-el.on(\r
-    'click',\r
-    function(e,t) {\r
-        // handle click\r
-        console.info(t.id); // 'p2'\r
-    },\r
-    this,\r
-    {\r
-        // filter the target element to be a descendant with the class 'clickable'\r
-        delegate: '.clickable' \r
-    }\r
-);\r
-     * </code></pre></p>\r
-     * @return {Ext.Element} this\r
-     */\r
-    addListener : function(eventName, fn, scope, options){\r
-        Ext.EventManager.on(this.dom,  eventName, fn, scope || this, options);\r
-        return this;\r
-    },\r
 \r
-    /**\r
-     * Removes an event handler from this element.  The shorthand version {@link #un} is equivalent.\r
-     * <b>Note</b>: if a <i>scope</i> was explicitly specified when {@link #addListener adding} the\r
-     * listener, the same scope must be specified here.\r
-     * Example:\r
-     * <pre><code>\r
-el.removeListener('click', this.handlerFn);\r
-// or\r
-el.un('click', this.handlerFn);\r
-</code></pre>\r
-     * @param {String} eventName the type of event to remove\r
-     * @param {Function} fn the method the event invokes\r
-     * @param {Object} scope (optional) The scope (The <tt>this</tt> reference) of the handler function. Defaults\r
-     * to this Element.\r
-     * @return {Ext.Element} this\r
-     */\r
-    removeListener : function(eventName, fn, scope){\r
-        Ext.EventManager.removeListener(this.dom,  eventName, fn, scope || this);\r
-        return this;\r
-    },\r
+//Initialize doc classes\r
+(function(){\r
 \r
-    /**\r
-     * Removes all previous added listeners from this element\r
-     * @return {Ext.Element} this\r
-     */\r
-    removeAllListeners : function(){\r
-        Ext.EventManager.removeAll(this.dom);\r
-        return this;\r
-    },\r
+    var initExtCss = function(){\r
+        // find the body element\r
+        var bd = document.body || document.getElementsByTagName('body')[0];\r
+        if(!bd){ return false; }\r
+        var cls = [' ',\r
+                Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))\r
+                : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')\r
+                : Ext.isOpera ? "ext-opera"\r
+                : Ext.isWebKit ? "ext-webkit" : ""];\r
 \r
-    /**\r
-     * @private Test if size has a unit, otherwise appends the default\r
-     */\r
-    addUnits : function(size){\r
-        if(size === "" || size == "auto" || size === undefined){\r
-            size = size || '';\r
-        } else if(!isNaN(size) || !unitPattern.test(size)){\r
-            size = size + (this.defaultUnit || 'px');\r
+        if(Ext.isSafari){\r
+            cls.push("ext-safari " + (Ext.isSafari2 ? 'ext-safari2' : (Ext.isSafari3 ? 'ext-safari3' : 'ext-safari4')));\r
+        }else if(Ext.isChrome){\r
+            cls.push("ext-chrome");\r
         }\r
-        return size;\r
-    },\r
 \r
-    /**\r
-     * <p>Updates the <a href="http://developer.mozilla.org/en/DOM/element.innerHTML">innerHTML</a> of this Element\r
-     * from a specified URL. Note that this is subject to the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a></p>\r
-     * <p>Updating innerHTML of an element will <b>not</b> execute embedded <tt>&lt;script></tt> elements. This is a browser restriction.</p>\r
-     * @param {Mixed} options. Either a sring containing the URL from which to load the HTML, or an {@link Ext.Ajax#request} options object specifying\r
-     * exactly how to request the HTML.\r
-     * @return {Ext.Element} this\r
-     */\r
-    load : function(url, params, cb){\r
-        Ext.Ajax.request(Ext.apply({\r
-            params: params,\r
-            url: url.url || url,\r
-            callback: cb,\r
-            el: this.dom,\r
-            indicatorText: url.indicatorText || ''\r
-        }, Ext.isObject(url) ? url : {}));\r
-        return this;\r
-    },\r
+        if(Ext.isMac){\r
+            cls.push("ext-mac");\r
+        }\r
+        if(Ext.isLinux){\r
+            cls.push("ext-linux");\r
+        }\r
 \r
-    /**\r
-     * Tests various css rules/browsers to determine if this element uses a border box\r
-     * @return {Boolean}\r
-     */\r
-    isBorderBox : function(){\r
-        return noBoxAdjust[(this.dom.tagName || "").toLowerCase()] || Ext.isBorderBox;\r
-    },\r
-\r
-    /**\r
-     * Removes this element from the DOM and deletes it from the cache\r
-     */\r
-    remove : function(){\r
-        var me = this,\r
-            dom = me.dom;\r
-        \r
-        me.removeAllListeners();\r
-        delete El.cache[dom.id];\r
-        delete El.dataCache[dom.id]\r
-        Ext.removeNode(dom);\r
-    },\r
-\r
-    /**\r
-     * Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.\r
-     * @param {Function} overFn The function to call when the mouse enters the Element.\r
-     * @param {Function} outFn The function to call when the mouse leaves the Element.\r
-     * @param {Object} scope (optional) The scope (<tt>this</tt> reference) in which the functions are executed. Defaults to the Element's DOM element.\r
-     * @param {Object} options (optional) Options for the listener. See {@link Ext.util.Observable#addListener the <tt>options</tt> parameter}.\r
-     * @return {Ext.Element} this\r
-     */\r
-    hover : function(overFn, outFn, scope, options){\r
-        var me = this;\r
-        me.on('mouseenter', overFn, scope || me.dom, options);\r
-        me.on('mouseleave', outFn, scope || me.dom, options);\r
-        return me;\r
-    },\r
-\r
-    /**\r
-     * Returns true if this element is an ancestor of the passed element\r
-     * @param {HTMLElement/String} el The element to check\r
-     * @return {Boolean} True if this element is an ancestor of el, else false\r
-     */\r
-    contains : function(el){\r
-        return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);\r
-    },\r
-\r
-    /**\r
-     * Returns the value of a namespaced attribute from the element's underlying DOM node.\r
-     * @param {String} namespace The namespace in which to look for the attribute\r
-     * @param {String} name The attribute name\r
-     * @return {String} The attribute value\r
-     * @deprecated\r
-     */\r
-    getAttributeNS : function(ns, name){\r
-        return this.getAttribute(name, ns); \r
-    },\r
-    \r
-    /**\r
-     * Returns the value of an attribute from the element's underlying DOM node.\r
-     * @param {String} name The attribute name\r
-     * @param {String} namespace (optional) The namespace in which to look for the attribute\r
-     * @return {String} The attribute value\r
-     */\r
-    getAttribute : Ext.isIE ? function(name, ns){\r
-        var d = this.dom,\r
-            type = typeof d[ns + ":" + name];\r
-\r
-        if(['undefined', 'unknown'].indexOf(type) == -1){\r
-            return d[ns + ":" + name];\r
+        if(Ext.isStrict || Ext.isBorderBox){ // add to the parent to allow for selectors like ".ext-strict .ext-ie"\r
+            var p = bd.parentNode;\r
+            if(p){\r
+                p.className += Ext.isStrict ? ' ext-strict' : ' ext-border-box';\r
+            }\r
         }\r
-        return d[name];\r
-    } : function(name, ns){\r
-        var d = this.dom;\r
-        return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];\r
-    },\r
-    \r
-    /**\r
-    * Update the innerHTML of this element\r
-    * @param {String} html The new HTML\r
-    * @return {Ext.Element} this\r
-     */\r
-    update : function(html) {\r
-        this.dom.innerHTML = html;\r
-        return this;\r
+        bd.className += cls.join(' ');\r
+        return true;\r
     }\r
-};\r
-\r
-var ep = El.prototype;\r
-\r
-El.addMethods = function(o){\r
-   Ext.apply(ep, o);\r
-};\r
-\r
-/**\r
- * Appends an event handler (shorthand for {@link #addListener}).\r
- * @param {String} eventName The type of event to handle\r
- * @param {Function} fn The handler function the event invokes\r
- * @param {Object} scope (optional) The scope (this element) of the handler function\r
- * @param {Object} options (optional) An object containing standard {@link #addListener} options\r
- * @member Ext.Element\r
- * @method on\r
- */\r
-ep.on = ep.addListener;\r
-\r
-/**\r
- * Removes an event handler from this element (see {@link #removeListener} for additional notes).\r
- * @param {String} eventName the type of event to remove\r
- * @param {Function} fn the method the event invokes\r
- * @param {Object} scope (optional) The scope (The <tt>this</tt> reference) of the handler function. Defaults\r
- * to this Element.\r
- * @return {Ext.Element} this\r
- * @member Ext.Element\r
- * @method un\r
- */\r
-ep.un = ep.removeListener;\r
 \r
-/**\r
- * true to automatically adjust width and height settings for box-model issues (default to true)\r
- */\r
-ep.autoBoxAdjust = true;\r
+    if(!initExtCss()){\r
+        Ext.onReady(initExtCss);\r
+    }\r
+})();\r
 \r
-// private\r
-var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,\r
-    docEl;\r
 \r
 /**\r
- * @private\r
+ * @class Ext.EventObject\r
+ * Just as {@link Ext.Element} wraps around a native DOM node, Ext.EventObject\r
+ * wraps the browser's native event-object normalizing cross-browser differences,\r
+ * such as which mouse button is clicked, keys pressed, mechanisms to stop\r
+ * event-propagation along with a method to prevent default actions from taking place.\r
+ * <p>For example:</p>\r
+ * <pre><code>\r
+function handleClick(e, t){ // e is not a standard event object, it is a Ext.EventObject\r
+    e.preventDefault();\r
+    var target = e.getTarget(); // same as t (the target HTMLElement)\r
+    ...\r
+}\r
+var myDiv = {@link Ext#get Ext.get}("myDiv");  // get reference to an {@link Ext.Element}\r
+myDiv.on(         // 'on' is shorthand for addListener\r
+    "click",      // perform an action on click of myDiv\r
+    handleClick   // reference to the action handler\r
+);\r
+// other methods to do the same:\r
+Ext.EventManager.on("myDiv", 'click', handleClick);\r
+Ext.EventManager.addListener("myDiv", 'click', handleClick);\r
+ </code></pre>\r
+ * @singleton\r
  */\r
-El.cache = {};\r
-El.dataCache = {};\r
+Ext.EventObject = function(){\r
+    var E = Ext.lib.Event,\r
+        // safari keypress events for special keys return bad keycodes\r
+        safariKeys = {\r
+            3 : 13, // enter\r
+            63234 : 37, // left\r
+            63235 : 39, // right\r
+            63232 : 38, // up\r
+            63233 : 40, // down\r
+            63276 : 33, // page up\r
+            63277 : 34, // page down\r
+            63272 : 46, // delete\r
+            63273 : 36, // home\r
+            63275 : 35  // end\r
+        },\r
+        // normalize button clicks\r
+        btnMap = Ext.isIE ? {1:0,4:1,2:2} :\r
+                (Ext.isWebKit ? {1:0,2:1,3:2} : {0:0,1:1,2:2});\r
 \r
-/**\r
- * Retrieves Ext.Element objects.\r
- * <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method\r
- * retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by\r
- * its ID, use {@link Ext.ComponentMgr#get}.</p>\r
- * <p>Uses simple caching to consistently return the same object. Automatically fixes if an\r
- * object was recreated with the same id via AJAX or DOM.</p>\r
- * @param {Mixed} el The id of the node, a DOM Node or an existing Element.\r
- * @return {Element} The Element object (or null if no matching element was found)\r
- * @static\r
- * @member Ext.Element\r
- * @method get\r
- */\r
-El.get = function(el){\r
-    var ex,\r
-        elm,\r
-        id;\r
-    if(!el){ return null; }\r
-    if (typeof el == "string") { // element id\r
-        if (!(elm = DOC.getElementById(el))) {\r
-            return null;\r
-        }\r
-        if (ex = El.cache[el]) {\r
-            ex.dom = elm;\r
-        } else {\r
-            ex = El.cache[el] = new El(elm);\r
-        }\r
-        return ex;\r
-    } else if (el.tagName) { // dom element\r
-        if(!(id = el.id)){\r
-            id = Ext.id(el);\r
-        }\r
-        if(ex = El.cache[id]){\r
-            ex.dom = el;\r
-        }else{\r
-            ex = El.cache[id] = new El(el);\r
-        }\r
-        return ex;\r
-    } else if (el instanceof El) {\r
-        if(el != docEl){\r
-            el.dom = DOC.getElementById(el.id) || el.dom; // refresh dom element in case no longer valid,\r
-                                                          // catch case where it hasn't been appended\r
-            El.cache[el.id] = el; // in case it was created directly with Element(), let's cache it\r
-        }\r
-        return el;\r
-    } else if(el.isComposite) {\r
-        return el;\r
-    } else if(Ext.isArray(el)) {\r
-        return El.select(el);\r
-    } else if(el == DOC) {\r
-        // create a bogus element object representing the document object\r
-        if(!docEl){\r
-            var f = function(){};\r
-            f.prototype = El.prototype;\r
-            docEl = new f();\r
-            docEl.dom = DOC;\r
+    Ext.EventObjectImpl = function(e){\r
+        if(e){\r
+            this.setEvent(e.browserEvent || e);\r
         }\r
-        return docEl;\r
-    }\r
-    return null;\r
-};\r
+    };\r
 \r
-// private method for getting and setting element data\r
-El.data = function(el, key, value){\r
-    var c = El.dataCache[el.id];\r
-    if(!c){\r
-        c = El.dataCache[el.id] = {};\r
-    }\r
-    if(arguments.length == 2){\r
-        return c[key];    \r
-    }else{\r
-        c[key] = value;\r
-    }\r
-};\r
+    Ext.EventObjectImpl.prototype = {\r
+           /** @private */\r
+        setEvent : function(e){\r
+            var me = this;\r
+            if(e == me || (e && e.browserEvent)){ // already wrapped\r
+                return e;\r
+            }\r
+            me.browserEvent = e;\r
+            if(e){\r
+                // normalize buttons\r
+                me.button = e.button ? btnMap[e.button] : (e.which ? e.which - 1 : -1);\r
+                if(e.type == 'click' && me.button == -1){\r
+                    me.button = 0;\r
+                }\r
+                me.type = e.type;\r
+                me.shiftKey = e.shiftKey;\r
+                // mac metaKey behaves like ctrlKey\r
+                me.ctrlKey = e.ctrlKey || e.metaKey || false;\r
+                me.altKey = e.altKey;\r
+                // in getKey these will be normalized for the mac\r
+                me.keyCode = e.keyCode;\r
+                me.charCode = e.charCode;\r
+                // cache the target for the delayed and or buffered events\r
+                me.target = E.getTarget(e);\r
+                // same for XY\r
+                me.xy = E.getXY(e);\r
+            }else{\r
+                me.button = -1;\r
+                me.shiftKey = false;\r
+                me.ctrlKey = false;\r
+                me.altKey = false;\r
+                me.keyCode = 0;\r
+                me.charCode = 0;\r
+                me.target = null;\r
+                me.xy = [0, 0];\r
+            }\r
+            return me;\r
+        },\r
 \r
-// private\r
-// Garbage collection - uncache elements/purge listeners on orphaned elements\r
-// so we don't hold a reference and cause the browser to retain them\r
-function garbageCollect(){\r
-    if(!Ext.enableGarbageCollector){\r
-        clearInterval(El.collectorThread);\r
-    } else {\r
-        var eid,\r
-            el,\r
-            d;\r
+        /**\r
+         * Stop the event (preventDefault and stopPropagation)\r
+         */\r
+        stopEvent : function(){\r
+            var me = this;\r
+            if(me.browserEvent){\r
+                if(me.browserEvent.type == 'mousedown'){\r
+                    Ext.EventManager.stoppedMouseDownEvent.fire(me);\r
+                }\r
+                E.stopEvent(me.browserEvent);\r
+            }\r
+        },\r
+\r
+        /**\r
+         * Prevents the browsers default handling of the event.\r
+         */\r
+        preventDefault : function(){\r
+            if(this.browserEvent){\r
+                E.preventDefault(this.browserEvent);\r
+            }\r
+        },\r
 \r
-        for(eid in El.cache){\r
-            el = El.cache[eid];\r
-            d = el.dom;\r
-            // -------------------------------------------------------\r
-            // Determining what is garbage:\r
-            // -------------------------------------------------------\r
-            // !d\r
-            // dom node is null, definitely garbage\r
-            // -------------------------------------------------------\r
-            // !d.parentNode\r
-            // no parentNode == direct orphan, definitely garbage\r
-            // -------------------------------------------------------\r
-            // !d.offsetParent && !document.getElementById(eid)\r
-            // display none elements have no offsetParent so we will\r
-            // also try to look it up by it's id. However, check\r
-            // offsetParent first so we don't do unneeded lookups.\r
-            // This enables collection of elements that are not orphans\r
-            // directly, but somewhere up the line they have an orphan\r
-            // parent.\r
-            // -------------------------------------------------------\r
-            if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){\r
-                delete El.cache[eid];\r
-                if(d && Ext.enableListenerCollection){\r
-                    Ext.EventManager.removeAll(d);\r
+        /**\r
+         * Cancels bubbling of the event.\r
+         */\r
+        stopPropagation : function(){\r
+            var me = this;\r
+            if(me.browserEvent){\r
+                if(me.browserEvent.type == 'mousedown'){\r
+                    Ext.EventManager.stoppedMouseDownEvent.fire(me);\r
                 }\r
+                E.stopPropagation(me.browserEvent);\r
             }\r
-        }\r
-    }\r
-}\r
-El.collectorThreadId = setInterval(garbageCollect, 30000);\r
+        },\r
 \r
-var flyFn = function(){};\r
-flyFn.prototype = El.prototype;\r
+        /**\r
+         * Gets the character code for the event.\r
+         * @return {Number}\r
+         */\r
+        getCharCode : function(){\r
+            return this.charCode || this.keyCode;\r
+        },\r
 \r
-// dom is optional\r
-El.Flyweight = function(dom){\r
-    this.dom = dom;\r
-};\r
+        /**\r
+         * Returns a normalized keyCode for the event.\r
+         * @return {Number} The key code\r
+         */\r
+        getKey : function(){\r
+            return this.normalizeKey(this.keyCode || this.charCode)\r
+        },\r
 \r
-El.Flyweight.prototype = new flyFn();\r
-El.Flyweight.prototype.isFlyweight = true;\r
-El._flyweights = {};\r
+        // private\r
+        normalizeKey: function(k){\r
+            return Ext.isSafari ? (safariKeys[k] || k) : k;\r
+        },\r
 \r
-/**\r
- * <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -\r
- * the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>\r
- * <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by\r
- * application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}\r
- * will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>\r
- * @param {String/HTMLElement} el The dom node or id\r
- * @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts\r
- * (e.g. internally Ext uses "_global")\r
- * @return {Element} The shared Element object (or null if no matching element was found)\r
- * @member Ext.Element\r
- * @method fly\r
- */\r
-El.fly = function(el, named){\r
-    var ret = null;\r
-    named = named || '_global';\r
+        /**\r
+         * Gets the x coordinate of the event.\r
+         * @return {Number}\r
+         */\r
+        getPageX : function(){\r
+            return this.xy[0];\r
+        },\r
 \r
-    if (el = Ext.getDom(el)) {\r
-        (El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;\r
-        ret = El._flyweights[named];\r
-    }\r
-    return ret;\r
-};\r
+        /**\r
+         * Gets the y coordinate of the event.\r
+         * @return {Number}\r
+         */\r
+        getPageY : function(){\r
+            return this.xy[1];\r
+        },\r
 \r
-/**\r
- * Retrieves Ext.Element objects.\r
- * <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method\r
- * retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by\r
- * its ID, use {@link Ext.ComponentMgr#get}.</p>\r
- * <p>Uses simple caching to consistently return the same object. Automatically fixes if an\r
- * object was recreated with the same id via AJAX or DOM.</p>\r
- * Shorthand of {@link Ext.Element#get}\r
- * @param {Mixed} el The id of the node, a DOM Node or an existing Element.\r
- * @return {Element} The Element object (or null if no matching element was found)\r
- * @member Ext\r
- * @method get\r
- */\r
-Ext.get = El.get;\r
+        /**\r
+         * Gets the page coordinates of the event.\r
+         * @return {Array} The xy values like [x, y]\r
+         */\r
+        getXY : function(){\r
+            return this.xy;\r
+        },\r
 \r
-/**\r
- * <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -\r
- * the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>\r
- * <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by\r
- * application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}\r
- * will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>\r
- * @param {String/HTMLElement} el The dom node or id\r
- * @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts\r
- * (e.g. internally Ext uses "_global")\r
- * @return {Element} The shared Element object (or null if no matching element was found)\r
- * @member Ext\r
- * @method fly\r
- */\r
-Ext.fly = El.fly;\r
+        /**\r
+         * Gets the target for the event.\r
+         * @param {String} selector (optional) A simple selector to filter the target or look for an ancestor of the target\r
+         * @param {Number/Mixed} maxDepth (optional) The max depth to\r
+                search as a number or element (defaults to 10 || document.body)\r
+         * @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node\r
+         * @return {HTMLelement}\r
+         */\r
+        getTarget : function(selector, maxDepth, returnEl){\r
+            return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);\r
+        },\r
 \r
-// speedy lookup for elements never to box adjust\r
-var noBoxAdjust = Ext.isStrict ? {\r
-    select:1\r
-} : {\r
-    input:1, select:1, textarea:1\r
-};\r
-if(Ext.isIE || Ext.isGecko){\r
-    noBoxAdjust['button'] = 1;\r
-}\r
+        /**\r
+         * Gets the related target.\r
+         * @return {HTMLElement}\r
+         */\r
+        getRelatedTarget : function(){\r
+            return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null;\r
+        },\r
 \r
+        /**\r
+         * Normalizes mouse wheel delta across browsers\r
+         * @return {Number} The delta\r
+         */\r
+        getWheelDelta : function(){\r
+            var e = this.browserEvent;\r
+            var delta = 0;\r
+            if(e.wheelDelta){ /* IE/Opera. */\r
+                delta = e.wheelDelta/120;\r
+            }else if(e.detail){ /* Mozilla case. */\r
+                delta = -e.detail/3;\r
+            }\r
+            return delta;\r
+        },\r
 \r
-Ext.EventManager.on(window, 'unload', function(){\r
-    delete El.cache;\r
-    delete El.dataCache;\r
-    delete El._flyweights;\r
-});\r
-})();\r
-/**\r
- * @class Ext.Element\r
- */\r
-Ext.Element.addMethods({    \r
-    /**\r
-     * Stops the specified event(s) from bubbling and optionally prevents the default action\r
-     * @param {String/Array} eventName an event / array of events to stop from bubbling\r
-     * @param {Boolean} preventDefault (optional) true to prevent the default action too\r
-     * @return {Ext.Element} this\r
-     */\r
-    swallowEvent : function(eventName, preventDefault){\r
-           var me = this;\r
-        function fn(e){\r
-            e.stopPropagation();\r
-            if(preventDefault){\r
-                e.preventDefault();\r
+        /**\r
+        * Returns true if the target of this event is a child of el.  Unless the allowEl parameter is set, it will return false if if the target is el.\r
+        * Example usage:<pre><code>\r
+        // Handle click on any child of an element\r
+        Ext.getBody().on('click', function(e){\r
+            if(e.within('some-el')){\r
+                alert('Clicked on a child of some-el!');\r
             }\r
-        }\r
-        if(Ext.isArray(eventName)){            \r
-               Ext.each(eventName, function(e) {\r
-                 me.on(e, fn);\r
-            });\r
-            return me;\r
-        }\r
-        me.on(eventName, fn);\r
-        return me;\r
-    },\r
-    \r
-    /**\r
-     * Create an event handler on this element such that when the event fires and is handled by this element,\r
-     * it will be relayed to another object (i.e., fired again as if it originated from that object instead).\r
-     * @param {String} eventName The type of event to relay\r
-     * @param {Object} object Any object that extends {@link Ext.util.Observable} that will provide the context\r
-     * for firing the relayed event\r
-     */\r
-    relayEvent : function(eventName, observable){\r
-        this.on(eventName, function(e){\r
-            observable.fireEvent(eventName, e);\r
         });\r
-    },\r
-    \r
-       /**\r
-     * Removes worthless text nodes\r
-     * @param {Boolean} forceReclean (optional) By default the element\r
-     * keeps track if it has been cleaned already so\r
-     * you can call this over and over. However, if you update the element and\r
-     * need to force a reclean, you can pass true.\r
-     */\r
-    clean : function(forceReclean){\r
-        var me = this, \r
-            dom = me.dom,\r
-               n = dom.firstChild, \r
-               ni = -1;\r
-               \r
-           if(Ext.Element.data(dom, 'isCleaned') && forceReclean !== true){\r
-            return me;\r
-        }      \r
-               \r
-           while(n){\r
-               var nx = n.nextSibling;\r
-            if(n.nodeType == 3 && !/\S/.test(n.nodeValue)){\r
-                dom.removeChild(n);\r
-            }else{\r
-                n.nodeIndex = ++ni;\r
-            }\r
-               n = nx;\r
-           }\r
-        Ext.Element.data(dom, 'isCleaned', true);\r
-           return me;\r
-       },\r
-    \r
-    /**\r
-     * Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object\r
-     * parameter as {@link Ext.Updater#update}\r
-     * @return {Ext.Element} this\r
-     */\r
-    load : function(){\r
-        var um = this.getUpdater();\r
-        um.update.apply(um, arguments);\r
-        return this;\r
-    },\r
 \r
-    /**\r
-    * Gets this element's {@link Ext.Updater Updater}\r
-    * @return {Ext.Updater} The Updater\r
-    */\r
-    getUpdater : function(){\r
-        return this.updateManager || (this.updateManager = new Ext.Updater(this));\r
-    },\r
-    \r
-       /**\r
-    * Update the innerHTML of this element, optionally searching for and processing scripts\r
-    * @param {String} html The new HTML\r
-    * @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false)\r
-    * @param {Function} callback (optional) For async script loading you can be notified when the update completes\r
-    * @return {Ext.Element} this\r
-     */\r
-    update : function(html, loadScripts, callback){\r
-        html = html || "";\r
-           \r
-        if(loadScripts !== true){\r
-            this.dom.innerHTML = html;\r
-            if(Ext.isFunction(callback)){\r
-                callback();\r
-            }\r
-            return this;\r
-        }\r
-        \r
-        var id = Ext.id(),\r
-               dom = this.dom;\r
-\r
-        html += '<span id="' + id + '"></span>';\r
-\r
-        Ext.lib.Event.onAvailable(id, function(){\r
-            var DOC = document,\r
-                hd = DOC.getElementsByTagName("head")[0],\r
-               re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,\r
-               srcRe = /\ssrc=([\'\"])(.*?)\1/i,\r
-               typeRe = /\stype=([\'\"])(.*?)\1/i,\r
-               match,\r
-               attrs,\r
-               srcMatch,\r
-               typeMatch,\r
-               el,\r
-               s;\r
-\r
-            while((match = re.exec(html))){\r
-                attrs = match[1];\r
-                srcMatch = attrs ? attrs.match(srcRe) : false;\r
-                if(srcMatch && srcMatch[2]){\r
-                   s = DOC.createElement("script");\r
-                   s.src = srcMatch[2];\r
-                   typeMatch = attrs.match(typeRe);\r
-                   if(typeMatch && typeMatch[2]){\r
-                       s.type = typeMatch[2];\r
-                   }\r
-                   hd.appendChild(s);\r
-                }else if(match[2] && match[2].length > 0){\r
-                    if(window.execScript) {\r
-                       window.execScript(match[2]);\r
-                    } else {\r
-                       window.eval(match[2]);\r
-                    }\r
-                }\r
-            }\r
-            el = DOC.getElementById(id);\r
-            if(el){Ext.removeNode(el);}\r
-            if(Ext.isFunction(callback)){\r
-                callback();\r
+        // Handle click directly on an element, ignoring clicks on child nodes\r
+        Ext.getBody().on('click', function(e,t){\r
+            if((t.id == 'some-el') && !e.within(t, true)){\r
+                alert('Clicked directly on some-el!');\r
             }\r
         });\r
-        dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");\r
-        return this;\r
-    },\r
-    \r
-    /**\r
-     * Creates a proxy element of this element\r
-     * @param {String/Object} config The class name of the proxy element or a DomHelper config object\r
-     * @param {String/HTMLElement} renderTo (optional) The element or element id to render the proxy to (defaults to document.body)\r
-     * @param {Boolean} matchBox (optional) True to align and size the proxy to this element now (defaults to false)\r
-     * @return {Ext.Element} The new proxy element\r
-     */\r
-    createProxy : function(config, renderTo, matchBox){\r
-        config = Ext.isObject(config) ? config : {tag : "div", cls: config};\r
-\r
-        var me = this,\r
-               proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :\r
-                                                  Ext.DomHelper.insertBefore(me.dom, config, true);        \r
-        \r
-        if(matchBox && me.setBox && me.getBox){ // check to make sure Element.position.js is loaded\r
-           proxy.setBox(me.getBox());\r
-        }\r
-        return proxy;\r
-    }\r
-});\r
-\r
-Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater;\r
-\r
-// private\r
-Ext.Element.uncache = function(el){\r
-    for(var i = 0, a = arguments, len = a.length; i < len; i++) {\r
-        if(a[i]){\r
-            delete Ext.Element.cache[a[i].id || a[i]];\r
+        </code></pre>\r
+         * @param {Mixed} el The id, DOM element or Ext.Element to check\r
+         * @param {Boolean} related (optional) true to test if the related target is within el instead of the target\r
+         * @param {Boolean} allowEl {optional} true to also check if the passed element is the target or related target\r
+         * @return {Boolean}\r
+         */\r
+        within : function(el, related, allowEl){\r
+            if(el){\r
+                var t = this[related ? "getRelatedTarget" : "getTarget"]();\r
+                return t && ((allowEl ? (t == Ext.getDom(el)) : false) || Ext.fly(el).contains(t));\r
+            }\r
+            return false;\r
         }\r
-    }\r
-};/**\r
- * @class Ext.Element\r
- */\r
-Ext.Element.addMethods({\r
-    /**\r
-     * Gets the x,y coordinates specified by the anchor position on the element.\r
-     * @param {String} anchor (optional) The specified anchor position (defaults to "c").  See {@link #alignTo}\r
-     * for details on supported anchor positions.\r
-     * @param {Boolean} local (optional) True to get the local (element top/left-relative) anchor position instead\r
-     * of page coordinates\r
-     * @param {Object} size (optional) An object containing the size to use for calculating anchor position\r
-     * {width: (target width), height: (target height)} (defaults to the element's current size)\r
-     * @return {Array} [x, y] An array containing the element's x and y coordinates\r
-     */\r
-    getAnchorXY : function(anchor, local, s){\r
-        //Passing a different size is useful for pre-calculating anchors,\r
-        //especially for anchored animations that change the el size.\r
-               anchor = (anchor || "tl").toLowerCase();\r
-        s = s || {};\r
-        \r
-        var me = this,        \r
-               vp = me.dom == document.body || me.dom == document,\r
-               w = s.width || vp ? Ext.lib.Dom.getViewWidth() : me.getWidth(),\r
-               h = s.height || vp ? Ext.lib.Dom.getViewHeight() : me.getHeight(),                              \r
-               xy,             \r
-               r = Math.round,\r
-               o = me.getXY(),\r
-               scroll = me.getScroll(),\r
-               extraX = vp ? scroll.left : !local ? o[0] : 0,\r
-               extraY = vp ? scroll.top : !local ? o[1] : 0,\r
-               hash = {\r
-                       c  : [r(w * 0.5), r(h * 0.5)],\r
-                       t  : [r(w * 0.5), 0],\r
-                       l  : [0, r(h * 0.5)],\r
-                       r  : [w, r(h * 0.5)],\r
-                       b  : [r(w * 0.5), h],\r
-                       tl : [0, 0],    \r
-                       bl : [0, h],\r
-                       br : [w, h],\r
-                       tr : [w, 0]\r
-               };\r
-        \r
-        xy = hash[anchor];     \r
-        return [xy[0] + extraX, xy[1] + extraY]; \r
-    },\r
+     };\r
 \r
-    /**\r
-     * Anchors an element to another element and realigns it when the window is resized.\r
-     * @param {Mixed} element The element to align to.\r
-     * @param {String} position The position to align to.\r
-     * @param {Array} offsets (optional) Offset the positioning by [x, y]\r
-     * @param {Boolean/Object} animate (optional) True for the default animation or a standard Element animation config object\r
-     * @param {Boolean/Number} monitorScroll (optional) True to monitor body scroll and reposition. If this parameter\r
-     * is a number, it is used as the buffer delay (defaults to 50ms).\r
-     * @param {Function} callback The function to call after the animation finishes\r
-     * @return {Ext.Element} this\r
-     */\r
-    anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){        \r
-           var me = this,\r
-            dom = me.dom;\r
-           \r
-           function action(){\r
-            Ext.fly(dom).alignTo(el, alignment, offsets, animate);\r
-            Ext.callback(callback, Ext.fly(dom));\r
-        }\r
-        \r
-        Ext.EventManager.onWindowResize(action, me);\r
-        \r
-        if(!Ext.isEmpty(monitorScroll)){\r
-            Ext.EventManager.on(window, 'scroll', action, me,\r
-                {buffer: !isNaN(monitorScroll) ? monitorScroll : 50});\r
-        }\r
-        action.call(me); // align immediately\r
-        return me;\r
-    },\r
+    return new Ext.EventObjectImpl();\r
+}();\r
 \r
-    /**\r
-     * Gets the x,y coordinates to align this element with another element. See {@link #alignTo} for more info on the\r
-     * supported position values.\r
-     * @param {Mixed} element The element to align to.\r
-     * @param {String} position The position to align to.\r
-     * @param {Array} offsets (optional) Offset the positioning by [x, y]\r
-     * @return {Array} [x, y]\r
-     */\r
-    getAlignToXY : function(el, p, o){     \r
-        el = Ext.get(el);\r
-        \r
-        if(!el || !el.dom){\r
-            throw "Element.alignToXY with an element that doesn't exist";\r
-        }\r
-        \r
-        o = o || [0,0];\r
-        p = (p == "?" ? "tl-bl?" : (!/-/.test(p) && p !== "" ? "tl-" + p : p || "tl-bl")).toLowerCase();       \r
-                \r
-        var me = this,\r
-               d = me.dom,\r
-               a1,\r
-               a2,\r
-               x,\r
-               y,\r
-               //constrain the aligned el to viewport if necessary\r
-               w,\r
-               h,\r
-               r,\r
-               dw = Ext.lib.Dom.getViewWidth() -10, // 10px of margin for ie\r
-               dh = Ext.lib.Dom.getViewHeight()-10, // 10px of margin for ie\r
-               p1y,\r
-               p1x,            \r
-               p2y,\r
-               p2x,\r
-               swapY,\r
-               swapX,\r
-               doc = document,\r
-               docElement = doc.documentElement,\r
-               docBody = doc.body,\r
-               scrollX = (docElement.scrollLeft || docBody.scrollLeft || 0)+5,\r
-               scrollY = (docElement.scrollTop || docBody.scrollTop || 0)+5,\r
-               c = false, //constrain to viewport\r
-               p1 = "", \r
-               p2 = "",\r
-               m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);\r
-        \r
-        if(!m){\r
-           throw "Element.alignTo with an invalid alignment " + p;\r
-        }\r
-        \r
-        p1 = m[1]; \r
-        p2 = m[2]; \r
-        c = !!m[3];\r
-\r
-        //Subtract the aligned el's internal xy from the target's offset xy\r
-        //plus custom offset to get the aligned el's new offset xy\r
-        a1 = me.getAnchorXY(p1, true);\r
-        a2 = el.getAnchorXY(p2, false);\r
-\r
-        x = a2[0] - a1[0] + o[0];\r
-        y = a2[1] - a1[1] + o[1];\r
-\r
-        if(c){    \r
-              w = me.getWidth();\r
-           h = me.getHeight();\r
-           r = el.getRegion();       \r
-           //If we are at a viewport boundary and the aligned el is anchored on a target border that is\r
-           //perpendicular to the vp border, allow the aligned el to slide on that border,\r
-           //otherwise swap the aligned el to the opposite border of the target.\r
-           p1y = p1.charAt(0);\r
-           p1x = p1.charAt(p1.length-1);\r
-           p2y = p2.charAt(0);\r
-           p2x = p2.charAt(p2.length-1);\r
-           swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));\r
-           swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));          \r
-           \r
-\r
-           if (x + w > dw + scrollX) {\r
-                x = swapX ? r.left-w : dw+scrollX-w;\r
-           }\r
-           if (x < scrollX) {\r
-               x = swapX ? r.right : scrollX;\r
-           }\r
-           if (y + h > dh + scrollY) {\r
-                y = swapY ? r.top-h : dh+scrollY-h;\r
-            }\r
-           if (y < scrollY){\r
-               y = swapY ? r.bottom : scrollY;\r
-           }\r
-        }\r
-        return [x,y];\r
-    },\r
-\r
-    /**\r
-     * Aligns this element with another element relative to the specified anchor points. If the other element is the\r
-     * document it aligns it to the viewport.\r
-     * The position parameter is optional, and can be specified in any one of the following formats:\r
-     * <ul>\r
-     *   <li><b>Blank</b>: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").</li>\r
-     *   <li><b>One anchor (deprecated)</b>: The passed anchor position is used as the target element's anchor point.\r
-     *       The element being aligned will position its top-left corner (tl) to that point.  <i>This method has been\r
-     *       deprecated in favor of the newer two anchor syntax below</i>.</li>\r
-     *   <li><b>Two anchors</b>: If two values from the table below are passed separated by a dash, the first value is used as the\r
-     *       element's anchor point, and the second value is used as the target's anchor point.</li>\r
-     * </ul>\r
-     * In addition to the anchor points, the position parameter also supports the "?" character.  If "?" is passed at the end of\r
-     * the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to\r
-     * the viewport if necessary.  Note that the element being aligned might be swapped to align to a different position than\r
-     * that specified in order to enforce the viewport constraints.\r
-     * Following are all of the supported anchor positions:\r
-<pre>\r
-Value  Description\r
------  -----------------------------\r
-tl     The top left corner (default)\r
-t      The center of the top edge\r
-tr     The top right corner\r
-l      The center of the left edge\r
-c      In the center of the element\r
-r      The center of the right edge\r
-bl     The bottom left corner\r
-b      The center of the bottom edge\r
-br     The bottom right corner\r
-</pre>\r
-Example Usage:\r
-<pre><code>\r
-// align el to other-el using the default positioning ("tl-bl", non-constrained)\r
-el.alignTo("other-el");\r
-\r
-// align the top left corner of el with the top right corner of other-el (constrained to viewport)\r
-el.alignTo("other-el", "tr?");\r
-\r
-// align the bottom right corner of el with the center left edge of other-el\r
-el.alignTo("other-el", "br-l?");\r
-\r
-// align the center of el with the bottom left corner of other-el and\r
-// adjust the x position by -6 pixels (and the y position by 0)\r
-el.alignTo("other-el", "c-bl", [-6, 0]);\r
-</code></pre>\r
-     * @param {Mixed} element The element to align to.\r
-     * @param {String} position The position to align to.\r
-     * @param {Array} offsets (optional) Offset the positioning by [x, y]\r
-     * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
-     * @return {Ext.Element} this\r
-     */\r
-    alignTo : function(element, position, offsets, animate){\r
-           var me = this;\r
-        return me.setXY(me.getAlignToXY(element, position, offsets),\r
-                               me.preanim && !!animate ? me.preanim(arguments, 3) : false);\r
-    },\r
-    \r
-    // private ==>  used outside of core\r
-    adjustForConstraints : function(xy, parent, offsets){\r
-        return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;\r
-    },\r
-\r
-    // private ==>  used outside of core\r
-    getConstrainToXY : function(el, local, offsets, proposedXY){   \r
-           var os = {top:0, left:0, bottom:0, right: 0};\r
-\r
-        return function(el, local, offsets, proposedXY){\r
-            el = Ext.get(el);\r
-            offsets = offsets ? Ext.applyIf(offsets, os) : os;\r
-\r
-            var vw, vh, vx = 0, vy = 0;\r
-            if(el.dom == document.body || el.dom == document){\r
-                vw =Ext.lib.Dom.getViewWidth();\r
-                vh = Ext.lib.Dom.getViewHeight();\r
-            }else{\r
-                vw = el.dom.clientWidth;\r
-                vh = el.dom.clientHeight;\r
-                if(!local){\r
-                    var vxy = el.getXY();\r
-                    vx = vxy[0];\r
-                    vy = vxy[1];\r
-                }\r
-            }\r
-\r
-            var s = el.getScroll();\r
-\r
-            vx += offsets.left + s.left;\r
-            vy += offsets.top + s.top;\r
-\r
-            vw -= offsets.right;\r
-            vh -= offsets.bottom;\r
-\r
-            var vr = vx+vw;\r
-            var vb = vy+vh;\r
-\r
-            var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);\r
-            var x = xy[0], y = xy[1];\r
-            var w = this.dom.offsetWidth, h = this.dom.offsetHeight;\r
-\r
-            // only move it if it needs it\r
-            var moved = false;\r
-\r
-            // first validate right/bottom\r
-            if((x + w) > vr){\r
-                x = vr - w;\r
-                moved = true;\r
-            }\r
-            if((y + h) > vb){\r
-                y = vb - h;\r
-                moved = true;\r
-            }\r
-            // then make sure top/left isn't negative\r
-            if(x < vx){\r
-                x = vx;\r
-                moved = true;\r
-            }\r
-            if(y < vy){\r
-                y = vy;\r
-                moved = true;\r
-            }\r
-            return moved ? [x, y] : false;\r
-        };\r
-    }(),\r
-           \r
-           \r
-               \r
-//         el = Ext.get(el);\r
-//         offsets = Ext.applyIf(offsets || {}, {top : 0, left : 0, bottom : 0, right : 0});\r
-\r
-//         var me = this,\r
-//             doc = document,\r
-//             s = el.getScroll(),\r
-//             vxy = el.getXY(),\r
-//             vx = offsets.left + s.left, \r
-//             vy = offsets.top + s.top,               \r
-//             vw = -offsets.right, \r
-//             vh = -offsets.bottom, \r
-//             vr,\r
-//             vb,\r
-//             xy = proposedXY || (!local ? me.getXY() : [me.getLeft(true), me.getTop(true)]),\r
-//             x = xy[0],\r
-//             y = xy[1],\r
-//             w = me.dom.offsetWidth, h = me.dom.offsetHeight,\r
-//             moved = false; // only move it if it needs it\r
-//       \r
-//             \r
-//         if(el.dom == doc.body || el.dom == doc){\r
-//             vw += Ext.lib.Dom.getViewWidth();\r
-//             vh += Ext.lib.Dom.getViewHeight();\r
-//         }else{\r
-//             vw += el.dom.clientWidth;\r
-//             vh += el.dom.clientHeight;\r
-//             if(!local){                    \r
-//                 vx += vxy[0];\r
-//                 vy += vxy[1];\r
-//             }\r
-//         }\r
-\r
-//         // first validate right/bottom\r
-//         if(x + w > vx + vw){\r
-//             x = vx + vw - w;\r
-//             moved = true;\r
-//         }\r
-//         if(y + h > vy + vh){\r
-//             y = vy + vh - h;\r
-//             moved = true;\r
-//         }\r
-//         // then make sure top/left isn't negative\r
-//         if(x < vx){\r
-//             x = vx;\r
-//             moved = true;\r
-//         }\r
-//         if(y < vy){\r
-//             y = vy;\r
-//             moved = true;\r
-//         }\r
-//         return moved ? [x, y] : false;\r
-//    },\r
-    \r
-    /**\r
-    * Calculates the x, y to center this element on the screen\r
-    * @return {Array} The x, y values [x, y]\r
-    */\r
-    getCenterXY : function(){\r
-        return this.getAlignToXY(document, 'c-c');\r
-    },\r
-\r
-    /**\r
-    * Centers the Element in either the viewport, or another Element.\r
-    * @param {Mixed} centerIn (optional) The element in which to center the element.\r
-    */\r
-    center : function(centerIn){\r
-        return this.alignTo(centerIn || document, 'c-c');        \r
-    }    \r
-});\r
+/**
+* @class Ext.EventManager
+*/
+Ext.apply(Ext.EventManager, function(){
+   var resizeEvent,
+       resizeTask,
+       textEvent,
+       textSize,
+       D = Ext.lib.Dom,
+       propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
+       curWidth = 0,
+       curHeight = 0,
+       // note 1: IE fires ONLY the keydown event on specialkey autorepeat
+       // note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat
+       // (research done by @Jan Wolter at http://unixpapa.com/js/key.html)
+       useKeydown = Ext.isWebKit ?
+                   Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 :
+                   !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);
+
+   return {
+       // private
+       doResizeEvent: function(){
+           var h = D.getViewHeight(),
+               w = D.getViewWidth();
+
+           //whacky problem in IE where the resize event will fire even though the w/h are the same.
+           if(curHeight != h || curWidth != w){
+               resizeEvent.fire(curWidth = w, curHeight = h);
+           }
+       },
+
+       /**
+        * Adds a listener to be notified when the browser window is resized and provides resize event buffering (50 milliseconds),
+        * passes new viewport width and height to handlers.
+        * @param {Function} fn      The handler function the window resize event invokes.
+        * @param {Object}   scope   The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
+        * @param {boolean}  options Options object as passed to {@link Ext.Element#addListener}
+        */
+       onWindowResize : function(fn, scope, options){
+           if(!resizeEvent){
+               resizeEvent = new Ext.util.Event();
+               resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);
+               Ext.EventManager.on(window, "resize", this.fireWindowResize, this);
+           }
+           resizeEvent.addListener(fn, scope, options);
+       },
+
+       // exposed only to allow manual firing
+       fireWindowResize : function(){
+           if(resizeEvent){
+               if((Ext.isIE||Ext.isAir) && resizeTask){
+                   resizeTask.delay(50);
+               }else{
+                   resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
+               }
+           }
+       },
+
+       /**
+        * Adds a listener to be notified when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.
+        * @param {Function} fn      The function the event invokes.
+        * @param {Object}   scope   The scope (<code>this</code> reference) in which the handler function executes. Defaults to the browser window.
+        * @param {boolean}  options Options object as passed to {@link Ext.Element#addListener}
+        */
+       onTextResize : function(fn, scope, options){
+           if(!textEvent){
+               textEvent = new Ext.util.Event();
+               var textEl = new Ext.Element(document.createElement('div'));
+               textEl.dom.className = 'x-text-resize';
+               textEl.dom.innerHTML = 'X';
+               textEl.appendTo(document.body);
+               textSize = textEl.dom.offsetHeight;
+               setInterval(function(){
+                   if(textEl.dom.offsetHeight != textSize){
+                       textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
+                   }
+               }, this.textResizeInterval);
+           }
+           textEvent.addListener(fn, scope, options);
+       },
+
+       /**
+        * Removes the passed window resize listener.
+        * @param {Function} fn        The method the event invokes
+        * @param {Object}   scope    The scope of handler
+        */
+       removeResizeListener : function(fn, scope){
+           if(resizeEvent){
+               resizeEvent.removeListener(fn, scope);
+           }
+       },
+
+       // private
+       fireResize : function(){
+           if(resizeEvent){
+               resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
+           }
+       },
+
+        /**
+        * The frequency, in milliseconds, to check for text resize events (defaults to 50)
+        */
+       textResizeInterval : 50,
+
+       /**
+        * Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)
+        */
+       ieDeferSrc : false,
+
+       // protected for use inside the framework
+       // detects whether we should use keydown or keypress based on the browser.
+       useKeydown: useKeydown
+   };
+}());
+
+Ext.EventManager.on = Ext.EventManager.addListener;
+
+
+Ext.apply(Ext.EventObjectImpl.prototype, {
+   /** Key constant @type Number */
+   BACKSPACE: 8,
+   /** Key constant @type Number */
+   TAB: 9,
+   /** Key constant @type Number */
+   NUM_CENTER: 12,
+   /** Key constant @type Number */
+   ENTER: 13,
+   /** Key constant @type Number */
+   RETURN: 13,
+   /** Key constant @type Number */
+   SHIFT: 16,
+   /** Key constant @type Number */
+   CTRL: 17,
+   CONTROL : 17, // legacy
+   /** Key constant @type Number */
+   ALT: 18,
+   /** Key constant @type Number */
+   PAUSE: 19,
+   /** Key constant @type Number */
+   CAPS_LOCK: 20,
+   /** Key constant @type Number */
+   ESC: 27,
+   /** Key constant @type Number */
+   SPACE: 32,
+   /** Key constant @type Number */
+   PAGE_UP: 33,
+   PAGEUP : 33, // legacy
+   /** Key constant @type Number */
+   PAGE_DOWN: 34,
+   PAGEDOWN : 34, // legacy
+   /** Key constant @type Number */
+   END: 35,
+   /** Key constant @type Number */
+   HOME: 36,
+   /** Key constant @type Number */
+   LEFT: 37,
+   /** Key constant @type Number */
+   UP: 38,
+   /** Key constant @type Number */
+   RIGHT: 39,
+   /** Key constant @type Number */
+   DOWN: 40,
+   /** Key constant @type Number */
+   PRINT_SCREEN: 44,
+   /** Key constant @type Number */
+   INSERT: 45,
+   /** Key constant @type Number */
+   DELETE: 46,
+   /** Key constant @type Number */
+   ZERO: 48,
+   /** Key constant @type Number */
+   ONE: 49,
+   /** Key constant @type Number */
+   TWO: 50,
+   /** Key constant @type Number */
+   THREE: 51,
+   /** Key constant @type Number */
+   FOUR: 52,
+   /** Key constant @type Number */
+   FIVE: 53,
+   /** Key constant @type Number */
+   SIX: 54,
+   /** Key constant @type Number */
+   SEVEN: 55,
+   /** Key constant @type Number */
+   EIGHT: 56,
+   /** Key constant @type Number */
+   NINE: 57,
+   /** Key constant @type Number */
+   A: 65,
+   /** Key constant @type Number */
+   B: 66,
+   /** Key constant @type Number */
+   C: 67,
+   /** Key constant @type Number */
+   D: 68,
+   /** Key constant @type Number */
+   E: 69,
+   /** Key constant @type Number */
+   F: 70,
+   /** Key constant @type Number */
+   G: 71,
+   /** Key constant @type Number */
+   H: 72,
+   /** Key constant @type Number */
+   I: 73,
+   /** Key constant @type Number */
+   J: 74,
+   /** Key constant @type Number */
+   K: 75,
+   /** Key constant @type Number */
+   L: 76,
+   /** Key constant @type Number */
+   M: 77,
+   /** Key constant @type Number */
+   N: 78,
+   /** Key constant @type Number */
+   O: 79,
+   /** Key constant @type Number */
+   P: 80,
+   /** Key constant @type Number */
+   Q: 81,
+   /** Key constant @type Number */
+   R: 82,
+   /** Key constant @type Number */
+   S: 83,
+   /** Key constant @type Number */
+   T: 84,
+   /** Key constant @type Number */
+   U: 85,
+   /** Key constant @type Number */
+   V: 86,
+   /** Key constant @type Number */
+   W: 87,
+   /** Key constant @type Number */
+   X: 88,
+   /** Key constant @type Number */
+   Y: 89,
+   /** Key constant @type Number */
+   Z: 90,
+   /** Key constant @type Number */
+   CONTEXT_MENU: 93,
+   /** Key constant @type Number */
+   NUM_ZERO: 96,
+   /** Key constant @type Number */
+   NUM_ONE: 97,
+   /** Key constant @type Number */
+   NUM_TWO: 98,
+   /** Key constant @type Number */
+   NUM_THREE: 99,
+   /** Key constant @type Number */
+   NUM_FOUR: 100,
+   /** Key constant @type Number */
+   NUM_FIVE: 101,
+   /** Key constant @type Number */
+   NUM_SIX: 102,
+   /** Key constant @type Number */
+   NUM_SEVEN: 103,
+   /** Key constant @type Number */
+   NUM_EIGHT: 104,
+   /** Key constant @type Number */
+   NUM_NINE: 105,
+   /** Key constant @type Number */
+   NUM_MULTIPLY: 106,
+   /** Key constant @type Number */
+   NUM_PLUS: 107,
+   /** Key constant @type Number */
+   NUM_MINUS: 109,
+   /** Key constant @type Number */
+   NUM_PERIOD: 110,
+   /** Key constant @type Number */
+   NUM_DIVISION: 111,
+   /** Key constant @type Number */
+   F1: 112,
+   /** Key constant @type Number */
+   F2: 113,
+   /** Key constant @type Number */
+   F3: 114,
+   /** Key constant @type Number */
+   F4: 115,
+   /** Key constant @type Number */
+   F5: 116,
+   /** Key constant @type Number */
+   F6: 117,
+   /** Key constant @type Number */
+   F7: 118,
+   /** Key constant @type Number */
+   F8: 119,
+   /** Key constant @type Number */
+   F9: 120,
+   /** Key constant @type Number */
+   F10: 121,
+   /** Key constant @type Number */
+   F11: 122,
+   /** Key constant @type Number */
+   F12: 123,
+
+   /** @private */
+   isNavKeyPress : function(){
+       var me = this,
+           k = this.normalizeKey(me.keyCode);
+       return (k >= 33 && k <= 40) ||  // Page Up/Down, End, Home, Left, Up, Right, Down
+       k == me.RETURN ||
+       k == me.TAB ||
+       k == me.ESC;
+   },
+
+   isSpecialKey : function(){
+       var k = this.normalizeKey(this.keyCode);
+       return (this.type == 'keypress' && this.ctrlKey) ||
+       this.isNavKeyPress() ||
+       (k == this.BACKSPACE) || // Backspace
+       (k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
+       (k >= 44 && k <= 45);   // Print Screen, Insert
+   },
+
+   getPoint : function(){
+       return new Ext.lib.Point(this.xy[0], this.xy[1]);
+   },
+
+   /**
+    * Returns true if the control, meta, shift or alt key was pressed during this event.
+    * @return {Boolean}
+    */
+   hasModifier : function(){
+       return ((this.ctrlKey || this.altKey) || this.shiftKey);
+   }
+});/**
+ * @class Ext.Element
+ * <p>Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.</p>
+ * <p>All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.</p>
+ * <p>Note that the events documented in this class are not Ext events, they encapsulate browser events. To
+ * access the underlying browser event, see {@link Ext.EventObject#browserEvent}. Some older
+ * browsers may not support the full range of events. Which events are supported is beyond the control of ExtJs.</p>
+ * Usage:<br>
+<pre><code>
+// by id
+var el = Ext.get("my-div");
+
+// by DOM element reference
+var el = Ext.get(myDivElement);
+</code></pre>
+ * <b>Animations</b><br />
+ * <p>When an element is manipulated, by default there is no animation.</p>
+ * <pre><code>
+var el = Ext.get("my-div");
+
+// no animation
+el.setWidth(100);
+ * </code></pre>
+ * <p>Many of the functions for manipulating an element have an optional "animate" parameter.  This
+ * parameter can be specified as boolean (<tt>true</tt>) for default animation effects.</p>
+ * <pre><code>
+// default animation
+el.setWidth(100, true);
+ * </code></pre>
+ *
+ * <p>To configure the effects, an object literal with animation options to use as the Element animation
+ * configuration object can also be specified. Note that the supported Element animation configuration
+ * options are a subset of the {@link Ext.Fx} animation options specific to Fx effects.  The supported
+ * Element animation configuration options are:</p>
+<pre>
+Option    Default   Description
+--------- --------  ---------------------------------------------
+{@link Ext.Fx#duration duration}  .35       The duration of the animation in seconds
+{@link Ext.Fx#easing easing}    easeOut   The easing method
+{@link Ext.Fx#callback callback}  none      A function to execute when the anim completes
+{@link Ext.Fx#scope scope}     this      The scope (this) of the callback function
+</pre>
+ *
+ * <pre><code>
+// Element animation options object
+var opt = {
+    {@link Ext.Fx#duration duration}: 1,
+    {@link Ext.Fx#easing easing}: 'elasticIn',
+    {@link Ext.Fx#callback callback}: this.foo,
+    {@link Ext.Fx#scope scope}: this
+};
+// animation with some options set
+el.setWidth(100, opt);
+ * </code></pre>
+ * <p>The Element animation object being used for the animation will be set on the options
+ * object as "anim", which allows you to stop or manipulate the animation. Here is an example:</p>
+ * <pre><code>
+// using the "anim" property to get the Anim object
+if(opt.anim.isAnimated()){
+    opt.anim.stop();
+}
+ * </code></pre>
+ * <p>Also see the <tt>{@link #animate}</tt> method for another animation technique.</p>
+ * <p><b> Composite (Collections of) Elements</b></p>
+ * <p>For working with collections of Elements, see {@link Ext.CompositeElement}</p>
+ * @constructor Create a new Element directly.
+ * @param {String/HTMLElement} element
+ * @param {Boolean} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
+ */
+(function(){
+var DOC = document;
+
+Ext.Element = function(element, forceNew){
+    var dom = typeof element == "string" ?
+              DOC.getElementById(element) : element,
+        id;
+
+    if(!dom) return null;
+
+    id = dom.id;
+
+    if(!forceNew && id && Ext.elCache[id]){ // element object already exists
+        return Ext.elCache[id].el;
+    }
+
+    /**
+     * The DOM element
+     * @type HTMLElement
+     */
+    this.dom = dom;
+
+    /**
+     * The DOM element ID
+     * @type String
+     */
+    this.id = id || Ext.id(dom);
+};
+
+var D = Ext.lib.Dom,
+    DH = Ext.DomHelper,
+    E = Ext.lib.Event,
+    A = Ext.lib.Anim,
+    El = Ext.Element,
+    EC = Ext.elCache;
+
+El.prototype = {
+    /**
+     * Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
+     * @param {Object} o The object with the attributes
+     * @param {Boolean} useSet (optional) false to override the default setAttribute to use expandos.
+     * @return {Ext.Element} this
+     */
+    set : function(o, useSet){
+        var el = this.dom,
+            attr,
+            val,
+            useSet = (useSet !== false) && !!el.setAttribute;
+
+        for(attr in o){
+            if (o.hasOwnProperty(attr)) {
+                val = o[attr];
+                if (attr == 'style') {
+                    DH.applyStyles(el, val);
+                } else if (attr == 'cls') {
+                    el.className = val;
+                } else if (useSet) {
+                    el.setAttribute(attr, val);
+                } else {
+                    el[attr] = val;
+                }
+            }
+        }
+        return this;
+    },
+
+//  Mouse events
+    /**
+     * @event click
+     * Fires when a mouse click is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event contextmenu
+     * Fires when a right click is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event dblclick
+     * Fires when a mouse double click is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mousedown
+     * Fires when a mousedown is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mouseup
+     * Fires when a mouseup is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mouseover
+     * Fires when a mouseover is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mousemove
+     * Fires when a mousemove is detected with the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mouseout
+     * Fires when a mouseout is detected with the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mouseenter
+     * Fires when the mouse enters the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event mouseleave
+     * Fires when the mouse leaves the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+
+//  Keyboard events
+    /**
+     * @event keypress
+     * Fires when a keypress is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event keydown
+     * Fires when a keydown is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event keyup
+     * Fires when a keyup is detected within the element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+
+
+//  HTML frame/object events
+    /**
+     * @event load
+     * Fires when the user agent finishes loading all content within the element. Only supported by window, frames, objects and images.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event unload
+     * Fires when the user agent removes all content from a window or frame. For elements, it fires when the target element or any of its content has been removed.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event abort
+     * Fires when an object/image is stopped from loading before completely loaded.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event error
+     * Fires when an object/image/frame cannot be loaded properly.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event resize
+     * Fires when a document view is resized.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event scroll
+     * Fires when a document view is scrolled.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+
+//  Form events
+    /**
+     * @event select
+     * Fires when a user selects some text in a text field, including input and textarea.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event change
+     * Fires when a control loses the input focus and its value has been modified since gaining focus.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event submit
+     * Fires when a form is submitted.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event reset
+     * Fires when a form is reset.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event focus
+     * Fires when an element receives focus either via the pointing device or by tab navigation.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event blur
+     * Fires when an element loses focus either via the pointing device or by tabbing navigation.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+
+//  User Interface events
+    /**
+     * @event DOMFocusIn
+     * Where supported. Similar to HTML focus event, but can be applied to any focusable element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMFocusOut
+     * Where supported. Similar to HTML blur event, but can be applied to any focusable element.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMActivate
+     * Where supported. Fires when an element is activated, for instance, through a mouse click or a keypress.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+
+//  DOM Mutation events
+    /**
+     * @event DOMSubtreeModified
+     * Where supported. Fires when the subtree is modified.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMNodeInserted
+     * Where supported. Fires when a node has been added as a child of another node.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMNodeRemoved
+     * Where supported. Fires when a descendant node of the element is removed.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMNodeRemovedFromDocument
+     * Where supported. Fires when a node is being removed from a document.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMNodeInsertedIntoDocument
+     * Where supported. Fires when a node is being inserted into a document.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMAttrModified
+     * Where supported. Fires when an attribute has been modified.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+    /**
+     * @event DOMCharacterDataModified
+     * Where supported. Fires when the character data has been modified.
+     * @param {Ext.EventObject} e The {@link Ext.EventObject} encapsulating the DOM event.
+     * @param {HtmlElement} t The target of the event.
+     * @param {Object} o The options configuration passed to the {@link #addListener} call.
+     */
+
+    /**
+     * The default unit to append to CSS values where a unit isn't provided (defaults to px).
+     * @type String
+     */
+    defaultUnit : "px",
+
+    /**
+     * Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
+     * @param {String} selector The simple selector to test
+     * @return {Boolean} True if this element matches the selector, else false
+     */
+    is : function(simpleSelector){
+        return Ext.DomQuery.is(this.dom, simpleSelector);
+    },
+
+    /**
+     * Tries to focus the element. Any exceptions are caught and ignored.
+     * @param {Number} defer (optional) Milliseconds to defer the focus
+     * @return {Ext.Element} this
+     */
+    focus : function(defer, /* private */ dom) {
+        var me = this,
+            dom = dom || me.dom;
+        try{
+            if(Number(defer)){
+                me.focus.defer(defer, null, [null, dom]);
+            }else{
+                dom.focus();
+            }
+        }catch(e){}
+        return me;
+    },
+
+    /**
+     * Tries to blur the element. Any exceptions are caught and ignored.
+     * @return {Ext.Element} this
+     */
+    blur : function() {
+        try{
+            this.dom.blur();
+        }catch(e){}
+        return this;
+    },
+
+    /**
+     * Returns the value of the "value" attribute
+     * @param {Boolean} asNumber true to parse the value as a number
+     * @return {String/Number}
+     */
+    getValue : function(asNumber){
+        var val = this.dom.value;
+        return asNumber ? parseInt(val, 10) : val;
+    },
+
+    /**
+     * Appends an event handler to this element.  The shorthand version {@link #on} is equivalent.
+     * @param {String} eventName The name of event to handle.
+     * @param {Function} fn The handler function the event invokes. This function is passed
+     * the following parameters:<ul>
+     * <li><b>evt</b> : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>
+     * <li><b>el</b> : HtmlElement<div class="sub-desc">The DOM element which was the target of the event.
+     * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>
+     * <li><b>o</b> : Object<div class="sub-desc">The options object from the addListener call.</div></li>
+     * </ul>
+     * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the handler function is executed.
+     * <b>If omitted, defaults to this Element.</b>.
+     * @param {Object} options (optional) An object containing handler configuration properties.
+     * This may contain any of the following properties:<ul>
+     * <li><b>scope</b> Object : <div class="sub-desc">The scope (<code><b>this</b></code> reference) in which the handler function is executed.
+     * <b>If omitted, defaults to this Element.</b></div></li>
+     * <li><b>delegate</b> String: <div class="sub-desc">A simple selector to filter the target or look for a descendant of the target. See below for additional details.</div></li>
+     * <li><b>stopEvent</b> Boolean: <div class="sub-desc">True to stop the event. That is stop propagation, and prevent the default action.</div></li>
+     * <li><b>preventDefault</b> Boolean: <div class="sub-desc">True to prevent the default action</div></li>
+     * <li><b>stopPropagation</b> Boolean: <div class="sub-desc">True to prevent event propagation</div></li>
+     * <li><b>normalized</b> Boolean: <div class="sub-desc">False to pass a browser event to the handler function instead of an Ext.EventObject</div></li>
+     * <li><b>target</b> Ext.Element: <div class="sub-desc">Only call the handler if the event was fired on the target Element, <i>not</i> if the event was bubbled up from a child node.</div></li>
+     * <li><b>delay</b> Number: <div class="sub-desc">The number of milliseconds to delay the invocation of the handler after the event fires.</div></li>
+     * <li><b>single</b> Boolean: <div class="sub-desc">True to add a handler to handle just the next firing of the event, and then remove itself.</div></li>
+     * <li><b>buffer</b> Number: <div class="sub-desc">Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed
+     * by the specified number of milliseconds. If the event fires again within that time, the original
+     * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</div></li>
+     * </ul><br>
+     * <p>
+     * <b>Combining Options</b><br>
+     * In the following examples, the shorthand form {@link #on} is used rather than the more verbose
+     * addListener.  The two are equivalent.  Using the options argument, it is possible to combine different
+     * types of listeners:<br>
+     * <br>
+     * A delayed, one-time listener that auto stops the event and adds a custom argument (forumId) to the
+     * options object. The options object is available as the third parameter in the handler function.<div style="margin: 5px 20px 20px;">
+     * Code:<pre><code>
+el.on('click', this.onClick, this, {
+    single: true,
+    delay: 100,
+    stopEvent : true,
+    forumId: 4
+});</code></pre></p>
+     * <p>
+     * <b>Attaching multiple handlers in 1 call</b><br>
+     * The method also allows for a single argument to be passed which is a config object containing properties
+     * which specify multiple handlers.</p>
+     * <p>
+     * Code:<pre><code>
+el.on({
+    'click' : {
+        fn: this.onClick,
+        scope: this,
+        delay: 100
+    },
+    'mouseover' : {
+        fn: this.onMouseOver,
+        scope: this
+    },
+    'mouseout' : {
+        fn: this.onMouseOut,
+        scope: this
+    }
+});</code></pre>
+     * <p>
+     * Or a shorthand syntax:<br>
+     * Code:<pre><code></p>
+el.on({
+    'click' : this.onClick,
+    'mouseover' : this.onMouseOver,
+    'mouseout' : this.onMouseOut,
+    scope: this
+});
+     * </code></pre></p>
+     * <p><b>delegate</b></p>
+     * <p>This is a configuration option that you can pass along when registering a handler for
+     * an event to assist with event delegation. Event delegation is a technique that is used to
+     * reduce memory consumption and prevent exposure to memory-leaks. By registering an event
+     * for a container element as opposed to each element within a container. By setting this
+     * configuration option to a simple selector, the target element will be filtered to look for
+     * a descendant of the target.
+     * For example:<pre><code>
+// using this markup:
+&lt;div id='elId'>
+    &lt;p id='p1'>paragraph one&lt;/p>
+    &lt;p id='p2' class='clickable'>paragraph two&lt;/p>
+    &lt;p id='p3'>paragraph three&lt;/p>
+&lt;/div>
+// utilize event delegation to registering just one handler on the container element:
+el = Ext.get('elId');
+el.on(
+    'click',
+    function(e,t) {
+        // handle click
+        console.info(t.id); // 'p2'
+    },
+    this,
+    {
+        // filter the target element to be a descendant with the class 'clickable'
+        delegate: '.clickable'
+    }
+);
+     * </code></pre></p>
+     * @return {Ext.Element} this
+     */
+    addListener : function(eventName, fn, scope, options){
+        Ext.EventManager.on(this.dom,  eventName, fn, scope || this, options);
+        return this;
+    },
+
+    /**
+     * Removes an event handler from this element.  The shorthand version {@link #un} is equivalent.
+     * <b>Note</b>: if a <i>scope</i> was explicitly specified when {@link #addListener adding} the
+     * listener, the same scope must be specified here.
+     * Example:
+     * <pre><code>
+el.removeListener('click', this.handlerFn);
+// or
+el.un('click', this.handlerFn);
+</code></pre>
+     * @param {String} eventName The name of the event from which to remove the handler.
+     * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
+     * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
+     * then this must refer to the same object.
+     * @return {Ext.Element} this
+     */
+    removeListener : function(eventName, fn, scope){
+        Ext.EventManager.removeListener(this.dom,  eventName, fn, scope || this);
+        return this;
+    },
+
+    /**
+     * Removes all previous added listeners from this element
+     * @return {Ext.Element} this
+     */
+    removeAllListeners : function(){
+        Ext.EventManager.removeAll(this.dom);
+        return this;
+    },
+
+    /**
+     * Recursively removes all previous added listeners from this element and its children
+     * @return {Ext.Element} this
+     */
+    purgeAllListeners : function() {
+        Ext.EventManager.purgeElement(this, true);
+        return this;
+    },
+    /**
+     * @private Test if size has a unit, otherwise appends the default
+     */
+    addUnits : function(size){
+        if(size === "" || size == "auto" || size === undefined){
+            size = size || '';
+        } else if(!isNaN(size) || !unitPattern.test(size)){
+            size = size + (this.defaultUnit || 'px');
+        }
+        return size;
+    },
+
+    /**
+     * <p>Updates the <a href="http://developer.mozilla.org/en/DOM/element.innerHTML">innerHTML</a> of this Element
+     * from a specified URL. Note that this is subject to the <a href="http://en.wikipedia.org/wiki/Same_origin_policy">Same Origin Policy</a></p>
+     * <p>Updating innerHTML of an element will <b>not</b> execute embedded <tt>&lt;script></tt> elements. This is a browser restriction.</p>
+     * @param {Mixed} options. Either a sring containing the URL from which to load the HTML, or an {@link Ext.Ajax#request} options object specifying
+     * exactly how to request the HTML.
+     * @return {Ext.Element} this
+     */
+    load : function(url, params, cb){
+        Ext.Ajax.request(Ext.apply({
+            params: params,
+            url: url.url || url,
+            callback: cb,
+            el: this.dom,
+            indicatorText: url.indicatorText || ''
+        }, Ext.isObject(url) ? url : {}));
+        return this;
+    },
+
+    /**
+     * Tests various css rules/browsers to determine if this element uses a border box
+     * @return {Boolean}
+     */
+    isBorderBox : function(){
+        return noBoxAdjust[(this.dom.tagName || "").toLowerCase()] || Ext.isBorderBox;
+    },
+
+    /**
+     * <p>Removes this element's dom reference.  Note that event and cache removal is handled at {@link Ext#removeNode}</p>
+     */
+    remove : function(){
+        var me = this,
+            dom = me.dom;
+
+        if (dom) {
+            delete me.dom;
+            Ext.removeNode(dom);
+        }
+    },
+
+    /**
+     * Sets up event handlers to call the passed functions when the mouse is moved into and out of the Element.
+     * @param {Function} overFn The function to call when the mouse enters the Element.
+     * @param {Function} outFn The function to call when the mouse leaves the Element.
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the functions are executed. Defaults to the Element's DOM element.
+     * @param {Object} options (optional) Options for the listener. See {@link Ext.util.Observable#addListener the <tt>options</tt> parameter}.
+     * @return {Ext.Element} this
+     */
+    hover : function(overFn, outFn, scope, options){
+        var me = this;
+        me.on('mouseenter', overFn, scope || me.dom, options);
+        me.on('mouseleave', outFn, scope || me.dom, options);
+        return me;
+    },
+
+    /**
+     * Returns true if this element is an ancestor of the passed element
+     * @param {HTMLElement/String} el The element to check
+     * @return {Boolean} True if this element is an ancestor of el, else false
+     */
+    contains : function(el){
+        return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);
+    },
+
+    /**
+     * Returns the value of a namespaced attribute from the element's underlying DOM node.
+     * @param {String} namespace The namespace in which to look for the attribute
+     * @param {String} name The attribute name
+     * @return {String} The attribute value
+     * @deprecated
+     */
+    getAttributeNS : function(ns, name){
+        return this.getAttribute(name, ns);
+    },
+
+    /**
+     * Returns the value of an attribute from the element's underlying DOM node.
+     * @param {String} name The attribute name
+     * @param {String} namespace (optional) The namespace in which to look for the attribute
+     * @return {String} The attribute value
+     */
+    getAttribute : Ext.isIE ? function(name, ns){
+        var d = this.dom,
+            type = typeof d[ns + ":" + name];
+
+        if(['undefined', 'unknown'].indexOf(type) == -1){
+            return d[ns + ":" + name];
+        }
+        return d[name];
+    } : function(name, ns){
+        var d = this.dom;
+        return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
+    },
+
+    /**
+    * Update the innerHTML of this element
+    * @param {String} html The new HTML
+    * @return {Ext.Element} this
+     */
+    update : function(html) {
+        if (this.dom) {
+            this.dom.innerHTML = html;
+        }
+        return this;
+    }
+};
+
+var ep = El.prototype;
+
+El.addMethods = function(o){
+   Ext.apply(ep, o);
+};
+
+/**
+ * Appends an event handler (shorthand for {@link #addListener}).
+ * @param {String} eventName The name of event to handle.
+ * @param {Function} fn The handler function the event invokes.
+ * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the handler function is executed.
+ * @param {Object} options (optional) An object containing standard {@link #addListener} options
+ * @member Ext.Element
+ * @method on
+ */
+ep.on = ep.addListener;
+
+/**
+ * Removes an event handler from this element (see {@link #removeListener} for additional notes).
+ * @param {String} eventName The name of the event from which to remove the handler.
+ * @param {Function} fn The handler function to remove. <b>This must be a reference to the function passed into the {@link #addListener} call.</b>
+ * @param {Object} scope If a scope (<b><code>this</code></b> reference) was specified when the listener was added,
+ * then this must refer to the same object.
+ * @return {Ext.Element} this
+ * @member Ext.Element
+ * @method un
+ */
+ep.un = ep.removeListener;
+
+/**
+ * true to automatically adjust width and height settings for box-model issues (default to true)
+ */
+ep.autoBoxAdjust = true;
+
+// private
+var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
+    docEl;
+
+/**
+ * @private
+ */
+
+/**
+ * Retrieves Ext.Element objects.
+ * <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method
+ * retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by
+ * its ID, use {@link Ext.ComponentMgr#get}.</p>
+ * <p>Uses simple caching to consistently return the same object. Automatically fixes if an
+ * object was recreated with the same id via AJAX or DOM.</p>
+ * @param {Mixed} el The id of the node, a DOM Node or an existing Element.
+ * @return {Element} The Element object (or null if no matching element was found)
+ * @static
+ * @member Ext.Element
+ * @method get
+ */
+El.get = function(el){
+    var ex,
+        elm,
+        id;
+    if(!el){ return null; }
+    if (typeof el == "string") { // element id
+        if (!(elm = DOC.getElementById(el))) {
+            return null;
+        }
+        if (EC[el] && EC[el].el) {
+            ex = EC[el].el;
+            ex.dom = elm;
+        } else {
+            ex = El.addToCache(new El(elm));
+        }
+        return ex;
+    } else if (el.tagName) { // dom element
+        if(!(id = el.id)){
+            id = Ext.id(el);
+        }
+        if (EC[id] && EC[id].el) {
+            ex = EC[id].el;
+            ex.dom = el;
+        } else {
+            ex = El.addToCache(new El(el));
+        }
+        return ex;
+    } else if (el instanceof El) {
+        if(el != docEl){
+            el.dom = DOC.getElementById(el.id) || el.dom; // refresh dom element in case no longer valid,
+                                                          // catch case where it hasn't been appended
+        }
+        return el;
+    } else if(el.isComposite) {
+        return el;
+    } else if(Ext.isArray(el)) {
+        return El.select(el);
+    } else if(el == DOC) {
+        // create a bogus element object representing the document object
+        if(!docEl){
+            var f = function(){};
+            f.prototype = El.prototype;
+            docEl = new f();
+            docEl.dom = DOC;
+        }
+        return docEl;
+    }
+    return null;
+};
+
+El.addToCache = function(el, id){
+    id = id || el.id;    
+    EC[id] = {
+        el:  el,
+        data: {},
+        events: {}
+    };
+    return el;
+};
+
+// private method for getting and setting element data
+El.data = function(el, key, value){
+    el = El.get(el);
+    if (!el) {
+        return null;
+    }
+    var c = EC[el.id].data;
+    if(arguments.length == 2){
+        return c[key];
+    }else{
+        return (c[key] = value);
+    }
+};
+
+// private
+// Garbage collection - uncache elements/purge listeners on orphaned elements
+// so we don't hold a reference and cause the browser to retain them
+function garbageCollect(){
+    if(!Ext.enableGarbageCollector){
+        clearInterval(El.collectorThreadId);
+    } else {
+        var eid,
+            el,
+            d,
+            o;
+
+        for(eid in EC){
+            o = EC[eid];
+            if(o.skipGC){
+                continue;
+            }
+            el = o.el;
+            d = el.dom;
+            // -------------------------------------------------------
+            // Determining what is garbage:
+            // -------------------------------------------------------
+            // !d
+            // dom node is null, definitely garbage
+            // -------------------------------------------------------
+            // !d.parentNode
+            // no parentNode == direct orphan, definitely garbage
+            // -------------------------------------------------------
+            // !d.offsetParent && !document.getElementById(eid)
+            // display none elements have no offsetParent so we will
+            // also try to look it up by it's id. However, check
+            // offsetParent first so we don't do unneeded lookups.
+            // This enables collection of elements that are not orphans
+            // directly, but somewhere up the line they have an orphan
+            // parent.
+            // -------------------------------------------------------
+            if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){
+                if(Ext.enableListenerCollection){
+                    Ext.EventManager.removeAll(d);
+                }
+                delete EC[eid];
+            }
+        }
+        // Cleanup IE Object leaks
+        if (Ext.isIE) {
+            var t = {};
+            for (eid in EC) {
+                t[eid] = EC[eid];
+            }
+            EC = Ext.elCache = t;
+        }
+    }
+}
+El.collectorThreadId = setInterval(garbageCollect, 30000);
+
+var flyFn = function(){};
+flyFn.prototype = El.prototype;
+
+// dom is optional
+El.Flyweight = function(dom){
+    this.dom = dom;
+};
+
+El.Flyweight.prototype = new flyFn();
+El.Flyweight.prototype.isFlyweight = true;
+El._flyweights = {};
+
+/**
+ * <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
+ * the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>
+ * <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by
+ * application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}
+ * will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>
+ * @param {String/HTMLElement} el The dom node or id
+ * @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts
+ * (e.g. internally Ext uses "_global")
+ * @return {Element} The shared Element object (or null if no matching element was found)
+ * @member Ext.Element
+ * @method fly
+ */
+El.fly = function(el, named){
+    var ret = null;
+    named = named || '_global';
+
+    if (el = Ext.getDom(el)) {
+        (El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;
+        ret = El._flyweights[named];
+    }
+    return ret;
+};
+
+/**
+ * Retrieves Ext.Element objects.
+ * <p><b>This method does not retrieve {@link Ext.Component Component}s.</b> This method
+ * retrieves Ext.Element objects which encapsulate DOM elements. To retrieve a Component by
+ * its ID, use {@link Ext.ComponentMgr#get}.</p>
+ * <p>Uses simple caching to consistently return the same object. Automatically fixes if an
+ * object was recreated with the same id via AJAX or DOM.</p>
+ * Shorthand of {@link Ext.Element#get}
+ * @param {Mixed} el The id of the node, a DOM Node or an existing Element.
+ * @return {Element} The Element object (or null if no matching element was found)
+ * @member Ext
+ * @method get
+ */
+Ext.get = El.get;
+
+/**
+ * <p>Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
+ * the dom node can be overwritten by other code. Shorthand of {@link Ext.Element#fly}</p>
+ * <p>Use this to make one-time references to DOM elements which are not going to be accessed again either by
+ * application code, or by Ext's classes. If accessing an element which will be processed regularly, then {@link Ext#get}
+ * will be more appropriate to take advantage of the caching provided by the Ext.Element class.</p>
+ * @param {String/HTMLElement} el The dom node or id
+ * @param {String} named (optional) Allows for creation of named reusable flyweights to prevent conflicts
+ * (e.g. internally Ext uses "_global")
+ * @return {Element} The shared Element object (or null if no matching element was found)
+ * @member Ext
+ * @method fly
+ */
+Ext.fly = El.fly;
+
+// speedy lookup for elements never to box adjust
+var noBoxAdjust = Ext.isStrict ? {
+    select:1
+} : {
+    input:1, select:1, textarea:1
+};
+if(Ext.isIE || Ext.isGecko){
+    noBoxAdjust['button'] = 1;
+}
+
+
+Ext.EventManager.on(window, 'unload', function(){
+    delete EC;
+    delete El._flyweights;
+});
+})();
+/**
+ * @class Ext.Element
+ */
+Ext.Element.addMethods({
+    /**
+     * Stops the specified event(s) from bubbling and optionally prevents the default action
+     * @param {String/Array} eventName an event / array of events to stop from bubbling
+     * @param {Boolean} preventDefault (optional) true to prevent the default action too
+     * @return {Ext.Element} this
+     */
+    swallowEvent : function(eventName, preventDefault){
+        var me = this;
+        function fn(e){
+            e.stopPropagation();
+            if(preventDefault){
+                e.preventDefault();
+            }
+        }
+        if(Ext.isArray(eventName)){
+            Ext.each(eventName, function(e) {
+                 me.on(e, fn);
+            });
+            return me;
+        }
+        me.on(eventName, fn);
+        return me;
+    },
+
+    /**
+     * Create an event handler on this element such that when the event fires and is handled by this element,
+     * it will be relayed to another object (i.e., fired again as if it originated from that object instead).
+     * @param {String} eventName The type of event to relay
+     * @param {Object} object Any object that extends {@link Ext.util.Observable} that will provide the context
+     * for firing the relayed event
+     */
+    relayEvent : function(eventName, observable){
+        this.on(eventName, function(e){
+            observable.fireEvent(eventName, e);
+        });
+    },
+
+    /**
+     * Removes worthless text nodes
+     * @param {Boolean} forceReclean (optional) By default the element
+     * keeps track if it has been cleaned already so
+     * you can call this over and over. However, if you update the element and
+     * need to force a reclean, you can pass true.
+     */
+    clean : function(forceReclean){
+        var me = this,
+            dom = me.dom,
+            n = dom.firstChild,
+            ni = -1;
+
+        if(Ext.Element.data(dom, 'isCleaned') && forceReclean !== true){
+            return me;
+        }
+
+        while(n){
+            var nx = n.nextSibling;
+            if(n.nodeType == 3 && !/\S/.test(n.nodeValue)){
+                dom.removeChild(n);
+            }else{
+                n.nodeIndex = ++ni;
+            }
+            n = nx;
+        }
+        Ext.Element.data(dom, 'isCleaned', true);
+        return me;
+    },
+
+    /**
+     * Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object
+     * parameter as {@link Ext.Updater#update}
+     * @return {Ext.Element} this
+     */
+    load : function(){
+        var um = this.getUpdater();
+        um.update.apply(um, arguments);
+        return this;
+    },
+
+    /**
+    * Gets this element's {@link Ext.Updater Updater}
+    * @return {Ext.Updater} The Updater
+    */
+    getUpdater : function(){
+        return this.updateManager || (this.updateManager = new Ext.Updater(this));
+    },
+
+    /**
+    * Update the innerHTML of this element, optionally searching for and processing scripts
+    * @param {String} html The new HTML
+    * @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false)
+    * @param {Function} callback (optional) For async script loading you can be notified when the update completes
+    * @return {Ext.Element} this
+     */
+    update : function(html, loadScripts, callback){
+        if (!this.dom) {
+            return this;
+        }
+        html = html || "";
+
+        if(loadScripts !== true){
+            this.dom.innerHTML = html;
+            if(Ext.isFunction(callback)){
+                callback();
+            }
+            return this;
+        }
+
+        var id = Ext.id(),
+            dom = this.dom;
+
+        html += '<span id="' + id + '"></span>';
+
+        Ext.lib.Event.onAvailable(id, function(){
+            var DOC = document,
+                hd = DOC.getElementsByTagName("head")[0],
+                re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
+                srcRe = /\ssrc=([\'\"])(.*?)\1/i,
+                typeRe = /\stype=([\'\"])(.*?)\1/i,
+                match,
+                attrs,
+                srcMatch,
+                typeMatch,
+                el,
+                s;
+
+            while((match = re.exec(html))){
+                attrs = match[1];
+                srcMatch = attrs ? attrs.match(srcRe) : false;
+                if(srcMatch && srcMatch[2]){
+                   s = DOC.createElement("script");
+                   s.src = srcMatch[2];
+                   typeMatch = attrs.match(typeRe);
+                   if(typeMatch && typeMatch[2]){
+                       s.type = typeMatch[2];
+                   }
+                   hd.appendChild(s);
+                }else if(match[2] && match[2].length > 0){
+                    if(window.execScript) {
+                       window.execScript(match[2]);
+                    } else {
+                       window.eval(match[2]);
+                    }
+                }
+            }
+            el = DOC.getElementById(id);
+            if(el){Ext.removeNode(el);}
+            if(Ext.isFunction(callback)){
+                callback();
+            }
+        });
+        dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
+        return this;
+    },
+
+    // inherit docs, overridden so we can add removeAnchor
+    removeAllListeners : function(){
+        this.removeAnchor();
+        Ext.EventManager.removeAll(this.dom);
+        return this;
+    },
+
+    /**
+     * Creates a proxy element of this element
+     * @param {String/Object} config The class name of the proxy element or a DomHelper config object
+     * @param {String/HTMLElement} renderTo (optional) The element or element id to render the proxy to (defaults to document.body)
+     * @param {Boolean} matchBox (optional) True to align and size the proxy to this element now (defaults to false)
+     * @return {Ext.Element} The new proxy element
+     */
+    createProxy : function(config, renderTo, matchBox){
+        config = Ext.isObject(config) ? config : {tag : "div", cls: config};
+
+        var me = this,
+            proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
+                               Ext.DomHelper.insertBefore(me.dom, config, true);
+
+        if(matchBox && me.setBox && me.getBox){ // check to make sure Element.position.js is loaded
+           proxy.setBox(me.getBox());
+        }
+        return proxy;
+    }
+});
+
+Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater;
+/**
+ * @class Ext.Element
+ */
+Ext.Element.addMethods({
+    /**
+     * Gets the x,y coordinates specified by the anchor position on the element.
+     * @param {String} anchor (optional) The specified anchor position (defaults to "c").  See {@link #alignTo}
+     * for details on supported anchor positions.
+     * @param {Boolean} local (optional) True to get the local (element top/left-relative) anchor position instead
+     * of page coordinates
+     * @param {Object} size (optional) An object containing the size to use for calculating anchor position
+     * {width: (target width), height: (target height)} (defaults to the element's current size)
+     * @return {Array} [x, y] An array containing the element's x and y coordinates
+     */
+    getAnchorXY : function(anchor, local, s){
+        //Passing a different size is useful for pre-calculating anchors,
+        //especially for anchored animations that change the el size.
+               anchor = (anchor || "tl").toLowerCase();
+        s = s || {};
+        
+        var me = this,        
+               vp = me.dom == document.body || me.dom == document,
+               w = s.width || vp ? Ext.lib.Dom.getViewWidth() : me.getWidth(),
+               h = s.height || vp ? Ext.lib.Dom.getViewHeight() : me.getHeight(),                              
+               xy,             
+               r = Math.round,
+               o = me.getXY(),
+               scroll = me.getScroll(),
+               extraX = vp ? scroll.left : !local ? o[0] : 0,
+               extraY = vp ? scroll.top : !local ? o[1] : 0,
+               hash = {
+                       c  : [r(w * 0.5), r(h * 0.5)],
+                       t  : [r(w * 0.5), 0],
+                       l  : [0, r(h * 0.5)],
+                       r  : [w, r(h * 0.5)],
+                       b  : [r(w * 0.5), h],
+                       tl : [0, 0],    
+                       bl : [0, h],
+                       br : [w, h],
+                       tr : [w, 0]
+               };
+        
+        xy = hash[anchor];     
+        return [xy[0] + extraX, xy[1] + extraY]; 
+    },
+
+    /**
+     * Anchors an element to another element and realigns it when the window is resized.
+     * @param {Mixed} element The element to align to.
+     * @param {String} position The position to align to.
+     * @param {Array} offsets (optional) Offset the positioning by [x, y]
+     * @param {Boolean/Object} animate (optional) True for the default animation or a standard Element animation config object
+     * @param {Boolean/Number} monitorScroll (optional) True to monitor body scroll and reposition. If this parameter
+     * is a number, it is used as the buffer delay (defaults to 50ms).
+     * @param {Function} callback The function to call after the animation finishes
+     * @return {Ext.Element} this
+     */
+    anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){        
+           var me = this,
+            dom = me.dom,
+            scroll = !Ext.isEmpty(monitorScroll),
+            action = function(){
+                Ext.fly(dom).alignTo(el, alignment, offsets, animate);
+                Ext.callback(callback, Ext.fly(dom));
+            },
+            anchor = this.getAnchor();
+            
+        // previous listener anchor, remove it
+        this.removeAnchor();
+        Ext.apply(anchor, {
+            fn: action,
+            scroll: scroll
+        });
+
+        Ext.EventManager.onWindowResize(action, null);
+        
+        if(scroll){
+            Ext.EventManager.on(window, 'scroll', action, null,
+                {buffer: !isNaN(monitorScroll) ? monitorScroll : 50});
+        }
+        action.call(me); // align immediately
+        return me;
+    },
+    
+    /**
+     * Remove any anchor to this element. See {@link #anchorTo}.
+     * @return {Ext.Element} this
+     */
+    removeAnchor : function(){
+        var me = this,
+            anchor = this.getAnchor();
+            
+        if(anchor && anchor.fn){
+            Ext.EventManager.removeResizeListener(anchor.fn);
+            if(anchor.scroll){
+                Ext.EventManager.un(window, 'scroll', anchor.fn);
+            }
+            delete anchor.fn;
+        }
+        return me;
+    },
+    
+    // private
+    getAnchor : function(){
+        var data = Ext.Element.data,
+            dom = this.dom;
+            if (!dom) {
+                return;
+            }
+            var anchor = data(dom, '_anchor');
+            
+        if(!anchor){
+            anchor = data(dom, '_anchor', {});
+        }
+        return anchor;
+    },
+
+    /**
+     * Gets the x,y coordinates to align this element with another element. See {@link #alignTo} for more info on the
+     * supported position values.
+     * @param {Mixed} element The element to align to.
+     * @param {String} position (optional, defaults to "tl-bl?") The position to align to.
+     * @param {Array} offsets (optional) Offset the positioning by [x, y]
+     * @return {Array} [x, y]
+     */
+    getAlignToXY : function(el, p, o){     
+        el = Ext.get(el);
+        
+        if(!el || !el.dom){
+            throw "Element.alignToXY with an element that doesn't exist";
+        }
+        
+        o = o || [0,0];
+        p = (!p || p == "?" ? "tl-bl?" : (!/-/.test(p) && p !== "" ? "tl-" + p : p || "tl-bl")).toLowerCase();       
+                
+        var me = this,
+               d = me.dom,
+               a1,
+               a2,
+               x,
+               y,
+               //constrain the aligned el to viewport if necessary
+               w,
+               h,
+               r,
+               dw = Ext.lib.Dom.getViewWidth() -10, // 10px of margin for ie
+               dh = Ext.lib.Dom.getViewHeight()-10, // 10px of margin for ie
+               p1y,
+               p1x,            
+               p2y,
+               p2x,
+               swapY,
+               swapX,
+               doc = document,
+               docElement = doc.documentElement,
+               docBody = doc.body,
+               scrollX = (docElement.scrollLeft || docBody.scrollLeft || 0)+5,
+               scrollY = (docElement.scrollTop || docBody.scrollTop || 0)+5,
+               c = false, //constrain to viewport
+               p1 = "", 
+               p2 = "",
+               m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
+        
+        if(!m){
+           throw "Element.alignTo with an invalid alignment " + p;
+        }
+        
+        p1 = m[1]; 
+        p2 = m[2]; 
+        c = !!m[3];
+
+        //Subtract the aligned el's internal xy from the target's offset xy
+        //plus custom offset to get the aligned el's new offset xy
+        a1 = me.getAnchorXY(p1, true);
+        a2 = el.getAnchorXY(p2, false);
+
+        x = a2[0] - a1[0] + o[0];
+        y = a2[1] - a1[1] + o[1];
+
+        if(c){    
+              w = me.getWidth();
+           h = me.getHeight();
+           r = el.getRegion();       
+           //If we are at a viewport boundary and the aligned el is anchored on a target border that is
+           //perpendicular to the vp border, allow the aligned el to slide on that border,
+           //otherwise swap the aligned el to the opposite border of the target.
+           p1y = p1.charAt(0);
+           p1x = p1.charAt(p1.length-1);
+           p2y = p2.charAt(0);
+           p2x = p2.charAt(p2.length-1);
+           swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
+           swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));          
+           
+
+           if (x + w > dw + scrollX) {
+                x = swapX ? r.left-w : dw+scrollX-w;
+           }
+           if (x < scrollX) {
+               x = swapX ? r.right : scrollX;
+           }
+           if (y + h > dh + scrollY) {
+                y = swapY ? r.top-h : dh+scrollY-h;
+            }
+           if (y < scrollY){
+               y = swapY ? r.bottom : scrollY;
+           }
+        }
+        return [x,y];
+    },
+
+    /**
+     * Aligns this element with another element relative to the specified anchor points. If the other element is the
+     * document it aligns it to the viewport.
+     * The position parameter is optional, and can be specified in any one of the following formats:
+     * <ul>
+     *   <li><b>Blank</b>: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").</li>
+     *   <li><b>One anchor (deprecated)</b>: The passed anchor position is used as the target element's anchor point.
+     *       The element being aligned will position its top-left corner (tl) to that point.  <i>This method has been
+     *       deprecated in favor of the newer two anchor syntax below</i>.</li>
+     *   <li><b>Two anchors</b>: If two values from the table below are passed separated by a dash, the first value is used as the
+     *       element's anchor point, and the second value is used as the target's anchor point.</li>
+     * </ul>
+     * In addition to the anchor points, the position parameter also supports the "?" character.  If "?" is passed at the end of
+     * the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to
+     * the viewport if necessary.  Note that the element being aligned might be swapped to align to a different position than
+     * that specified in order to enforce the viewport constraints.
+     * Following are all of the supported anchor positions:
+<pre>
+Value  Description
+-----  -----------------------------
+tl     The top left corner (default)
+t      The center of the top edge
+tr     The top right corner
+l      The center of the left edge
+c      In the center of the element
+r      The center of the right edge
+bl     The bottom left corner
+b      The center of the bottom edge
+br     The bottom right corner
+</pre>
+Example Usage:
+<pre><code>
+// align el to other-el using the default positioning ("tl-bl", non-constrained)
+el.alignTo("other-el");
+
+// align the top left corner of el with the top right corner of other-el (constrained to viewport)
+el.alignTo("other-el", "tr?");
+
+// align the bottom right corner of el with the center left edge of other-el
+el.alignTo("other-el", "br-l?");
+
+// align the center of el with the bottom left corner of other-el and
+// adjust the x position by -6 pixels (and the y position by 0)
+el.alignTo("other-el", "c-bl", [-6, 0]);
+</code></pre>
+     * @param {Mixed} element The element to align to.
+     * @param {String} position (optional, defaults to "tl-bl?") The position to align to.
+     * @param {Array} offsets (optional) Offset the positioning by [x, y]
+     * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+     * @return {Ext.Element} this
+     */
+    alignTo : function(element, position, offsets, animate){
+           var me = this;
+        return me.setXY(me.getAlignToXY(element, position, offsets),
+                               me.preanim && !!animate ? me.preanim(arguments, 3) : false);
+    },
+    
+    // private ==>  used outside of core
+    adjustForConstraints : function(xy, parent, offsets){
+        return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;
+    },
+
+    // private ==>  used outside of core
+    getConstrainToXY : function(el, local, offsets, proposedXY){   
+           var os = {top:0, left:0, bottom:0, right: 0};
+
+        return function(el, local, offsets, proposedXY){
+            el = Ext.get(el);
+            offsets = offsets ? Ext.applyIf(offsets, os) : os;
+
+            var vw, vh, vx = 0, vy = 0;
+            if(el.dom == document.body || el.dom == document){
+                vw =Ext.lib.Dom.getViewWidth();
+                vh = Ext.lib.Dom.getViewHeight();
+            }else{
+                vw = el.dom.clientWidth;
+                vh = el.dom.clientHeight;
+                if(!local){
+                    var vxy = el.getXY();
+                    vx = vxy[0];
+                    vy = vxy[1];
+                }
+            }
+
+            var s = el.getScroll();
+
+            vx += offsets.left + s.left;
+            vy += offsets.top + s.top;
+
+            vw -= offsets.right;
+            vh -= offsets.bottom;
+
+            var vr = vx+vw;
+            var vb = vy+vh;
+
+            var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
+            var x = xy[0], y = xy[1];
+            var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
+
+            // only move it if it needs it
+            var moved = false;
+
+            // first validate right/bottom
+            if((x + w) > vr){
+                x = vr - w;
+                moved = true;
+            }
+            if((y + h) > vb){
+                y = vb - h;
+                moved = true;
+            }
+            // then make sure top/left isn't negative
+            if(x < vx){
+                x = vx;
+                moved = true;
+            }
+            if(y < vy){
+                y = vy;
+                moved = true;
+            }
+            return moved ? [x, y] : false;
+        };
+    }(),
+           
+           
+               
+//         el = Ext.get(el);
+//         offsets = Ext.applyIf(offsets || {}, {top : 0, left : 0, bottom : 0, right : 0});
+
+//         var me = this,
+//             doc = document,
+//             s = el.getScroll(),
+//             vxy = el.getXY(),
+//             vx = offsets.left + s.left, 
+//             vy = offsets.top + s.top,               
+//             vw = -offsets.right, 
+//             vh = -offsets.bottom, 
+//             vr,
+//             vb,
+//             xy = proposedXY || (!local ? me.getXY() : [me.getLeft(true), me.getTop(true)]),
+//             x = xy[0],
+//             y = xy[1],
+//             w = me.dom.offsetWidth, h = me.dom.offsetHeight,
+//             moved = false; // only move it if it needs it
+//       
+//             
+//         if(el.dom == doc.body || el.dom == doc){
+//             vw += Ext.lib.Dom.getViewWidth();
+//             vh += Ext.lib.Dom.getViewHeight();
+//         }else{
+//             vw += el.dom.clientWidth;
+//             vh += el.dom.clientHeight;
+//             if(!local){                    
+//                 vx += vxy[0];
+//                 vy += vxy[1];
+//             }
+//         }
+
+//         // first validate right/bottom
+//         if(x + w > vx + vw){
+//             x = vx + vw - w;
+//             moved = true;
+//         }
+//         if(y + h > vy + vh){
+//             y = vy + vh - h;
+//             moved = true;
+//         }
+//         // then make sure top/left isn't negative
+//         if(x < vx){
+//             x = vx;
+//             moved = true;
+//         }
+//         if(y < vy){
+//             y = vy;
+//             moved = true;
+//         }
+//         return moved ? [x, y] : false;
+//    },
+    
+    /**
+    * Calculates the x, y to center this element on the screen
+    * @return {Array} The x, y values [x, y]
+    */
+    getCenterXY : function(){
+        return this.getAlignToXY(document, 'c-c');
+    },
+
+    /**
+    * Centers the Element in either the viewport, or another Element.
+    * @param {Mixed} centerIn (optional) The element in which to center the element.
+    */
+    center : function(centerIn){
+        return this.alignTo(centerIn || document, 'c-c');        
+    }    
+});
 /**\r
  * @class Ext.Element\r
  */\r
@@ -4800,11 +5274,10 @@ Ext.Element.addMethods(function(){
            /**\r
             * Creates a {@link Ext.CompositeElement} for child nodes based on the passed CSS selector (the selector should not contain an id).\r
             * @param {String} selector The CSS selector\r
-            * @param {Boolean} unique (optional) True to create a unique Ext.Element for each child (defaults to false, which creates a single shared flyweight object)\r
             * @return {CompositeElement/CompositeElementLite} The composite element\r
             */\r
-           select : function(selector, unique){\r
-               return Ext.Element.select(selector, unique, this.dom);\r
+           select : function(selector){\r
+               return Ext.Element.select(selector, this.dom);\r
            },\r
        \r
            /**\r
@@ -4812,7 +5285,7 @@ Ext.Element.addMethods(function(){
             * @param {String} selector The CSS selector\r
             * @return {Array} An array of the matched nodes\r
             */\r
-           query : function(selector, unique){\r
+           query : function(selector){\r
                return DQ.select(selector, this.dom);\r
            },\r
        \r
@@ -4903,14 +5376,24 @@ Ext.Element.addMethods(function(){
 }());/**\r
  * @class Ext.Element\r
  */\r
+Ext.Element.addMethods({\r
+    /**\r
+     * Creates a {@link Ext.CompositeElement} for child nodes based on the passed CSS selector (the selector should not contain an id).\r
+     * @param {String} selector The CSS selector\r
+     * @param {Boolean} unique (optional) True to create a unique Ext.Element for each child (defaults to false, which creates a single shared flyweight object)\r
+     * @return {CompositeElement/CompositeElementLite} The composite element\r
+     */\r
+    select : function(selector, unique){\r
+        return Ext.Element.select(selector, unique, this.dom);\r
+    }\r
+});/**\r
+ * @class Ext.Element\r
+ */\r
 Ext.Element.addMethods(\r
 function() {\r
        var GETDOM = Ext.getDom,\r
                GET = Ext.get,\r
-               DH = Ext.DomHelper,\r
-        isEl = function(el){\r
-            return  (el.nodeType || el.dom || typeof el == 'string');  \r
-        };\r
+               DH = Ext.DomHelper;\r
        \r
        return {\r
            /**\r
@@ -4959,14 +5442,14 @@ function() {
             */\r
            insertFirst: function(el, returnDom){\r
             el = el || {};\r
-            if(isEl(el)){ // element\r
+            if(el.nodeType || el.dom || typeof el == 'string'){ // element\r
                 el = GETDOM(el);\r
                 this.dom.insertBefore(el, this.dom.firstChild);\r
                 return !returnDom ? GET(el) : el;\r
             }else{ // dh config\r
                 return this.createChild(el, this.dom.firstChild, returnDom);\r
             }\r
-    },\r
+        },\r
        \r
            /**\r
             * Replaces the passed element with this element\r
@@ -4986,773 +5469,818 @@ function() {
             * @return {Ext.Element} this\r
             */\r
            replaceWith: function(el){\r
-                   var me = this,\r
-                       Element = Ext.Element;\r
-            if(isEl(el)){\r
-                el = GETDOM(el);\r
-                me.dom.parentNode.insertBefore(el, me.dom);\r
-            }else{\r
-                el = DH.insertBefore(me.dom, el);\r
-            }\r
-               \r
-               delete Element.cache[me.id];\r
-               Ext.removeNode(me.dom);      \r
-               me.id = Ext.id(me.dom = el);\r
-               return Element.cache[me.id] = me;        \r
-           },\r
-           \r
-               /**\r
-                * Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.\r
-                * @param {Object} config DomHelper element config object.  If no tag is specified (e.g., {tag:'input'}) then a div will be\r
-                * automatically generated with the specified attributes.\r
-                * @param {HTMLElement} insertBefore (optional) a child element of this element\r
-                * @param {Boolean} returnDom (optional) true to return the dom node instead of creating an Element\r
-                * @return {Ext.Element} The new child element\r
-                */\r
-               createChild: function(config, insertBefore, returnDom){\r
-                   config = config || {tag:'div'};\r
-                   return insertBefore ? \r
-                          DH.insertBefore(insertBefore, config, returnDom !== true) :  \r
-                          DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);\r
-               },\r
-               \r
-               /**\r
-                * Creates and wraps this element with another element\r
-                * @param {Object} config (optional) DomHelper element config object for the wrapper element or null for an empty div\r
-                * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element\r
-                * @return {HTMLElement/Element} The newly created wrapper element\r
-                */\r
-               wrap: function(config, returnDom){        \r
-                   var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom);\r
-                   newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);\r
-                   return newEl;\r
-               },\r
-               \r
-               /**\r
-                * Inserts an html fragment into this element\r
-                * @param {String} where Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd.\r
-                * @param {String} html The HTML fragment\r
-                * @param {Boolean} returnEl (optional) True to return an Ext.Element (defaults to false)\r
-                * @return {HTMLElement/Ext.Element} The inserted node (or nearest related if more than 1 inserted)\r
-                */\r
-               insertHtml : function(where, html, returnEl){\r
-                   var el = DH.insertHtml(where, this.dom, html);\r
-                   return returnEl ? Ext.get(el) : el;\r
-               }\r
-       }\r
-}());/**\r
- * @class Ext.Element\r
- */\r
-Ext.apply(Ext.Element.prototype, function() {\r
-       var GETDOM = Ext.getDom,\r
-               GET = Ext.get,\r
-               DH = Ext.DomHelper;\r
-       \r
-       return {        \r
-               /**\r
-            * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element\r
-            * @param {Mixed/Object/Array} el The id, element to insert or a DomHelper config to create and insert *or* an array of any of those.\r
-            * @param {String} where (optional) 'before' or 'after' defaults to before\r
-            * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element\r
-            * @return {Ext.Element} the inserted Element\r
-            */\r
-           insertSibling: function(el, where, returnDom){\r
-               var me = this,\r
-                       rt;\r
-                       \r
-               if(Ext.isArray(el)){            \r
-                   Ext.each(el, function(e) {\r
-                           rt = me.insertSibling(e, where, returnDom);\r
-                   });\r
-                   return rt;\r
-               }\r
-                       \r
-               where = (where || 'before').toLowerCase();\r
-               el = el || {};\r
-               \r
-            if(el.nodeType || el.dom){\r
-                rt = me.dom.parentNode.insertBefore(GETDOM(el), where == 'before' ? me.dom : me.dom.nextSibling);\r
-                if (!returnDom) {\r
-                    rt = GET(rt);\r
-                }\r
-            }else{\r
-                if (where == 'after' && !me.dom.nextSibling) {\r
-                    rt = DH.append(me.dom.parentNode, el, !returnDom);\r
-                } else {                    \r
-                    rt = DH[where == 'after' ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);\r
-                }\r
-            }\r
-               return rt;\r
-           }\r
-    };\r
-}());/**\r
- * @class Ext.Element\r
- */\r
-Ext.Element.addMethods(function(){  \r
-    // local style camelizing for speed\r
-    var propCache = {},\r
-        camelRe = /(-[a-z])/gi,\r
-        classReCache = {},\r
-        view = document.defaultView,\r
-        propFloat = Ext.isIE ? 'styleFloat' : 'cssFloat',\r
-        opacityRe = /alpha\(opacity=(.*)\)/i,\r
-        trimRe = /^\s+|\s+$/g,\r
-        EL = Ext.Element,   \r
-        PADDING = "padding",\r
-        MARGIN = "margin",\r
-        BORDER = "border",\r
-        LEFT = "-left",\r
-        RIGHT = "-right",\r
-        TOP = "-top",\r
-        BOTTOM = "-bottom",\r
-        WIDTH = "-width",    \r
-        MATH = Math,\r
-        HIDDEN = 'hidden',\r
-        ISCLIPPED = 'isClipped',\r
-        OVERFLOW = 'overflow',\r
-        OVERFLOWX = 'overflow-x',\r
-        OVERFLOWY = 'overflow-y',\r
-        ORIGINALCLIP = 'originalClip',\r
-        // special markup used throughout Ext when box wrapping elements    \r
-        borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH},\r
-        paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM},\r
-        margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM},\r
-        data = Ext.Element.data;\r
-        \r
-    \r
-    // private  \r
-    function camelFn(m, a) {\r
-        return a.charAt(1).toUpperCase();\r
-    }\r
-    \r
-    // private (needs to be called => addStyles.call(this, sides, styles))\r
-    function addStyles(sides, styles){\r
-        var val = 0;    \r
-        \r
-        Ext.each(sides.match(/\w/g), function(s) {\r
-            if (s = parseInt(this.getStyle(styles[s]), 10)) {\r
-                val += MATH.abs(s);      \r
-            }\r
-        },\r
-        this);\r
-        return val;\r
-    }\r
-\r
-    function chkCache(prop) {\r
-        return propCache[prop] || (propCache[prop] = prop == 'float' ? propFloat : prop.replace(camelRe, camelFn));\r
-\r
-    }\r
-            \r
-    return {    \r
-        // private  ==> used by Fx  \r
-        adjustWidth : function(width) {\r
-            var me = this;\r
-            var isNum = (typeof width == "number");\r
-            if(isNum && me.autoBoxAdjust && !me.isBorderBox()){\r
-               width -= (me.getBorderWidth("lr") + me.getPadding("lr"));\r
-            }\r
-            return (isNum && width < 0) ? 0 : width;\r
-        },\r
-        \r
-        // private   ==> used by Fx \r
-        adjustHeight : function(height) {\r
-            var me = this;\r
-            var isNum = (typeof height == "number");\r
-            if(isNum && me.autoBoxAdjust && !me.isBorderBox()){\r
-               height -= (me.getBorderWidth("tb") + me.getPadding("tb"));               \r
-            }\r
-            return (isNum && height < 0) ? 0 : height;\r
-        },\r
-    \r
-    \r
-        /**\r
-         * Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.\r
-         * @param {String/Array} className The CSS class to add, or an array of classes\r
-         * @return {Ext.Element} this\r
-         */\r
-        addClass : function(className){\r
-            var me = this;\r
-            Ext.each(className, function(v) {\r
-                me.dom.className += (!me.hasClass(v) && v ? " " + v : "");  \r
-            });\r
-            return me;\r
-        },\r
-    \r
-        /**\r
-         * Adds one or more CSS classes to this element and removes the same class(es) from all siblings.\r
-         * @param {String/Array} className The CSS class to add, or an array of classes\r
-         * @return {Ext.Element} this\r
-         */\r
-        radioClass : function(className){\r
-            Ext.each(this.dom.parentNode.childNodes, function(v) {\r
-                if(v.nodeType == 1) {\r
-                    Ext.fly(v, '_internal').removeClass(className);          \r
-                }\r
-            });\r
-            return this.addClass(className);\r
-        },\r
-    \r
-        /**\r
-         * Removes one or more CSS classes from the element.\r
-         * @param {String/Array} className The CSS class to remove, or an array of classes\r
-         * @return {Ext.Element} this\r
-         */\r
-        removeClass : function(className){\r
-            var me = this;\r
-            if (me.dom.className) {\r
-                Ext.each(className, function(v) {               \r
-                    me.dom.className = me.dom.className.replace(\r
-                        classReCache[v] = classReCache[v] || new RegExp('(?:^|\\s+)' + v + '(?:\\s+|$)', "g"), \r
-                        " ");               \r
-                });    \r
-            }\r
-            return me;\r
-        },\r
-    \r
-        /**\r
-         * Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).\r
-         * @param {String} className The CSS class to toggle\r
-         * @return {Ext.Element} this\r
-         */\r
-        toggleClass : function(className){\r
-            return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);\r
-        },\r
-    \r
-        /**\r
-         * Checks if the specified CSS class exists on this element's DOM node.\r
-         * @param {String} className The CSS class to check for\r
-         * @return {Boolean} True if the class exists, else false\r
-         */\r
-        hasClass : function(className){\r
-            return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;\r
-        },\r
-    \r
-        /**\r
-         * Replaces a CSS class on the element with another.  If the old name does not exist, the new name will simply be added.\r
-         * @param {String} oldClassName The CSS class to replace\r
-         * @param {String} newClassName The replacement CSS class\r
-         * @return {Ext.Element} this\r
-         */\r
-        replaceClass : function(oldClassName, newClassName){\r
-            return this.removeClass(oldClassName).addClass(newClassName);\r
-        },\r
-        \r
-        isStyle : function(style, val) {\r
-            return this.getStyle(style) == val;  \r
-        },\r
-    \r
-        /**\r
-         * Normalizes currentStyle and computedStyle.\r
-         * @param {String} property The style property whose value is returned.\r
-         * @return {String} The current value of the style property for this element.\r
-         */\r
-        getStyle : function(){         \r
-            return view && view.getComputedStyle ?\r
-                function(prop){\r
-                    var el = this.dom,\r
-                        v,                  \r
-                        cs;\r
-                    if(el == document) return null;\r
-                    prop = chkCache(prop);\r
-                    return (v = el.style[prop]) ? v : \r
-                           (cs = view.getComputedStyle(el, "")) ? cs[prop] : null;\r
-                } :\r
-                function(prop){      \r
-                    var el = this.dom, \r
-                        m, \r
-                        cs;     \r
-                        \r
-                    if(el == document) return null;      \r
-                    if (prop == 'opacity') {\r
-                        if (el.style.filter.match) {                       \r
-                            if(m = el.style.filter.match(opacityRe)){\r
-                                var fv = parseFloat(m[1]);\r
-                                if(!isNaN(fv)){\r
-                                    return fv ? fv / 100 : 0;\r
-                                }\r
-                            }\r
-                        }\r
-                        return 1;\r
-                    }\r
-                    prop = chkCache(prop);  \r
-                    return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);\r
-                };\r
-        }(),\r
-        \r
-        /**\r
-         * Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values\r
-         * are convert to standard 6 digit hex color.\r
-         * @param {String} attr The css attribute\r
-         * @param {String} defaultValue The default value to use when a valid color isn't found\r
-         * @param {String} prefix (optional) defaults to #. Use an empty string when working with\r
-         * color anims.\r
-         */\r
-        getColor : function(attr, defaultValue, prefix){\r
-            var v = this.getStyle(attr),\r
-                color = prefix || '#',\r
-                h;\r
-                \r
-            if(!v || /transparent|inherit/.test(v)){\r
-                return defaultValue;\r
-            }\r
-            if(/^r/.test(v)){\r
-                Ext.each(v.slice(4, v.length -1).split(','), function(s){\r
-                    h = parseInt(s, 10);\r
-                    color += (h < 16 ? '0' : '') + h.toString(16); \r
-                });\r
-            }else{\r
-                v = v.replace('#', '');\r
-                color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;\r
-            }\r
-            return(color.length > 5 ? color.toLowerCase() : defaultValue);\r
-        },\r
-    \r
-        /**\r
-         * Wrapper for setting style properties, also takes single object parameter of multiple styles.\r
-         * @param {String/Object} property The style property to be set, or an object of multiple styles.\r
-         * @param {String} value (optional) The value to apply to the given property, or null if an object was passed.\r
-         * @return {Ext.Element} this\r
-         */\r
-        setStyle : function(prop, value){\r
-            var tmp, \r
-                style,\r
-                camel;\r
-            if (!Ext.isObject(prop)) {\r
-                tmp = {};\r
-                tmp[prop] = value;          \r
-                prop = tmp;\r
-            }\r
-            for (style in prop) {\r
-                value = prop[style];            \r
-                style == 'opacity' ? \r
-                    this.setOpacity(value) : \r
-                    this.dom.style[chkCache(style)] = value;\r
-            }\r
-            return this;\r
-        },\r
-        \r
-        /**\r
-         * Set the opacity of the element\r
-         * @param {Float} opacity The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc\r
-         * @param {Boolean/Object} animate (optional) a standard Element animation config object or <tt>true</tt> for\r
-         * the default animation (<tt>{duration: .35, easing: 'easeIn'}</tt>)\r
-         * @return {Ext.Element} this\r
-         */\r
-         setOpacity : function(opacity, animate){\r
-            var me = this,\r
-                s = me.dom.style;\r
+                   var me = this;\r
                 \r
-            if(!animate || !me.anim){            \r
-                if(Ext.isIE){\r
-                    var opac = opacity < 1 ? 'alpha(opacity=' + opacity * 100 + ')' : '', \r
-                    val = s.filter.replace(opacityRe, '').replace(trimRe, '');\r
-\r
-                    s.zoom = 1;\r
-                    s.filter = val + (val.length > 0 ? ' ' : '') + opac;\r
-                }else{\r
-                    s.opacity = opacity;\r
-                }\r
+            if(el.nodeType || el.dom || typeof el == 'string'){\r
+                el = GETDOM(el);\r
+                me.dom.parentNode.insertBefore(el, me.dom);\r
             }else{\r
-                me.anim({opacity: {to: opacity}}, me.preanim(arguments, 1), null, .35, 'easeIn');\r
+                el = DH.insertBefore(me.dom, el);\r
             }\r
+               \r
+               delete Ext.elCache[me.id];\r
+               Ext.removeNode(me.dom);      \r
+               me.id = Ext.id(me.dom = el);\r
+               Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me);     \r
             return me;\r
-        },\r
-        \r
-        /**\r
-         * Clears any opacity settings from this element. Required in some cases for IE.\r
-         * @return {Ext.Element} this\r
-         */\r
-        clearOpacity : function(){\r
-            var style = this.dom.style;\r
-            if(Ext.isIE){\r
-                if(!Ext.isEmpty(style.filter)){\r
-                    style.filter = style.filter.replace(opacityRe, '').replace(trimRe, '');\r
+           },\r
+           \r
+               /**\r
+                * Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.\r
+                * @param {Object} config DomHelper element config object.  If no tag is specified (e.g., {tag:'input'}) then a div will be\r
+                * automatically generated with the specified attributes.\r
+                * @param {HTMLElement} insertBefore (optional) a child element of this element\r
+                * @param {Boolean} returnDom (optional) true to return the dom node instead of creating an Element\r
+                * @return {Ext.Element} The new child element\r
+                */\r
+               createChild: function(config, insertBefore, returnDom){\r
+                   config = config || {tag:'div'};\r
+                   return insertBefore ? \r
+                          DH.insertBefore(insertBefore, config, returnDom !== true) :  \r
+                          DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);\r
+               },\r
+               \r
+               /**\r
+                * Creates and wraps this element with another element\r
+                * @param {Object} config (optional) DomHelper element config object for the wrapper element or null for an empty div\r
+                * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element\r
+                * @return {HTMLElement/Element} The newly created wrapper element\r
+                */\r
+               wrap: function(config, returnDom){        \r
+                   var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom);\r
+                   newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);\r
+                   return newEl;\r
+               },\r
+               \r
+               /**\r
+                * Inserts an html fragment into this element\r
+                * @param {String} where Where to insert the html in relation to this element - beforeBegin, afterBegin, beforeEnd, afterEnd.\r
+                * @param {String} html The HTML fragment\r
+                * @param {Boolean} returnEl (optional) True to return an Ext.Element (defaults to false)\r
+                * @return {HTMLElement/Ext.Element} The inserted node (or nearest related if more than 1 inserted)\r
+                */\r
+               insertHtml : function(where, html, returnEl){\r
+                   var el = DH.insertHtml(where, this.dom, html);\r
+                   return returnEl ? Ext.get(el) : el;\r
+               }\r
+       }\r
+}());/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.apply(Ext.Element.prototype, function() {\r
+       var GETDOM = Ext.getDom,\r
+               GET = Ext.get,\r
+               DH = Ext.DomHelper;\r
+       \r
+       return {        \r
+               /**\r
+            * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element\r
+            * @param {Mixed/Object/Array} el The id, element to insert or a DomHelper config to create and insert *or* an array of any of those.\r
+            * @param {String} where (optional) 'before' or 'after' defaults to before\r
+            * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Ext.Element\r
+            * @return {Ext.Element} The inserted Element. If an array is passed, the last inserted element is returned.\r
+            */\r
+           insertSibling: function(el, where, returnDom){\r
+               var me = this,\r
+                       rt,\r
+                isAfter = (where || 'before').toLowerCase() == 'after',\r
+                insertEl;\r
+                       \r
+               if(Ext.isArray(el)){\r
+                insertEl = me;\r
+                   Ext.each(el, function(e) {\r
+                           rt = Ext.fly(insertEl, '_internal').insertSibling(e, where, returnDom);\r
+                    if(isAfter){\r
+                        insertEl = rt;\r
+                    }\r
+                   });\r
+                   return rt;\r
+               }\r
+                       \r
+               el = el || {};\r
+               \r
+            if(el.nodeType || el.dom){\r
+                rt = me.dom.parentNode.insertBefore(GETDOM(el), isAfter ? me.dom.nextSibling : me.dom);\r
+                if (!returnDom) {\r
+                    rt = GET(rt);\r
                 }\r
             }else{\r
-                style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = '';\r
+                if (isAfter && !me.dom.nextSibling) {\r
+                    rt = DH.append(me.dom.parentNode, el, !returnDom);\r
+                } else {                    \r
+                    rt = DH[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom);\r
+                }\r
             }\r
-            return this;\r
-        },\r
-    \r
+               return rt;\r
+           }\r
+    };\r
+}());/**
+ * @class Ext.Element
+ */
+Ext.Element.addMethods(function(){
+    // local style camelizing for speed
+    var propCache = {},
+        camelRe = /(-[a-z])/gi,
+        classReCache = {},
+        view = document.defaultView,
+        propFloat = Ext.isIE ? 'styleFloat' : 'cssFloat',
+        opacityRe = /alpha\(opacity=(.*)\)/i,
+        trimRe = /^\s+|\s+$/g,
+        EL = Ext.Element,
+        PADDING = "padding",
+        MARGIN = "margin",
+        BORDER = "border",
+        LEFT = "-left",
+        RIGHT = "-right",
+        TOP = "-top",
+        BOTTOM = "-bottom",
+        WIDTH = "-width",
+        MATH = Math,
+        HIDDEN = 'hidden',
+        ISCLIPPED = 'isClipped',
+        OVERFLOW = 'overflow',
+        OVERFLOWX = 'overflow-x',
+        OVERFLOWY = 'overflow-y',
+        ORIGINALCLIP = 'originalClip',
+        // special markup used throughout Ext when box wrapping elements
+        borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH},
+        paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM},
+        margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM},
+        data = Ext.Element.data;
+
+
+    // private
+    function camelFn(m, a) {
+        return a.charAt(1).toUpperCase();
+    }
+
+    function chkCache(prop) {
+        return propCache[prop] || (propCache[prop] = prop == 'float' ? propFloat : prop.replace(camelRe, camelFn));
+    }
+
+    return {
+        // private  ==> used by Fx
+        adjustWidth : function(width) {
+            var me = this;
+            var isNum = Ext.isNumber(width);
+            if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
+               width -= (me.getBorderWidth("lr") + me.getPadding("lr"));
+            }
+            return (isNum && width < 0) ? 0 : width;
+        },
+
+        // private   ==> used by Fx
+        adjustHeight : function(height) {
+            var me = this;
+            var isNum = Ext.isNumber(height);
+            if(isNum && me.autoBoxAdjust && !me.isBorderBox()){
+               height -= (me.getBorderWidth("tb") + me.getPadding("tb"));
+            }
+            return (isNum && height < 0) ? 0 : height;
+        },
+
+
+        /**
+         * Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
+         * @param {String/Array} className The CSS class to add, or an array of classes
+         * @return {Ext.Element} this
+         */
+        addClass : function(className){
+            var me = this, i, len, v;
+            className = Ext.isArray(className) ? className : [className];
+            for (i=0, len = className.length; i < len; i++) {
+                v = className[i];
+                if (v) {
+                    me.dom.className += (!me.hasClass(v) && v ? " " + v : "");
+                };
+            };
+            return me;
+        },
+
+        /**
+         * Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
+         * @param {String/Array} className The CSS class to add, or an array of classes
+         * @return {Ext.Element} this
+         */
+        radioClass : function(className){
+            var cn = this.dom.parentNode.childNodes, v;
+            className = Ext.isArray(className) ? className : [className];
+            for (var i=0, len = cn.length; i < len; i++) {
+                v = cn[i];
+                if(v && v.nodeType == 1) {
+                    Ext.fly(v, '_internal').removeClass(className);
+                }
+            };
+            return this.addClass(className);
+        },
+
+        /**
+         * Removes one or more CSS classes from the element.
+         * @param {String/Array} className The CSS class to remove, or an array of classes
+         * @return {Ext.Element} this
+         */
+        removeClass : function(className){
+            var me = this, v;
+            className = Ext.isArray(className) ? className : [className];
+            if (me.dom && me.dom.className) {
+                for (var i=0, len=className.length; i < len; i++) {
+                    v = className[i];
+                    if(v) {
+                        me.dom.className = me.dom.className.replace(
+                            classReCache[v] = classReCache[v] || new RegExp('(?:^|\\s+)' + v + '(?:\\s+|$)', "g"), " "
+                        );
+                    }
+                };
+            }
+            return me;
+        },
+
+        /**
+         * Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
+         * @param {String} className The CSS class to toggle
+         * @return {Ext.Element} this
+         */
+        toggleClass : function(className){
+            return this.hasClass(className) ? this.removeClass(className) : this.addClass(className);
+        },
+
+        /**
+         * Checks if the specified CSS class exists on this element's DOM node.
+         * @param {String} className The CSS class to check for
+         * @return {Boolean} True if the class exists, else false
+         */
+        hasClass : function(className){
+            return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
+        },
+
+        /**
+         * Replaces a CSS class on the element with another.  If the old name does not exist, the new name will simply be added.
+         * @param {String} oldClassName The CSS class to replace
+         * @param {String} newClassName The replacement CSS class
+         * @return {Ext.Element} this
+         */
+        replaceClass : function(oldClassName, newClassName){
+            return this.removeClass(oldClassName).addClass(newClassName);
+        },
+
+        isStyle : function(style, val) {
+            return this.getStyle(style) == val;
+        },
+
+        /**
+         * Normalizes currentStyle and computedStyle.
+         * @param {String} property The style property whose value is returned.
+         * @return {String} The current value of the style property for this element.
+         */
+        getStyle : function(){
+            return view && view.getComputedStyle ?
+                function(prop){
+                    var el = this.dom,
+                        v,
+                        cs,
+                        out,
+                        display,
+                        wk = Ext.isWebKit,
+                        display;
+                        
+                    if(el == document){
+                        return null;
+                    }
+                    prop = chkCache(prop);
+                    // Fix bug caused by this: https://bugs.webkit.org/show_bug.cgi?id=13343
+                    if(wk && /marginRight/.test(prop)){
+                        display = this.getStyle('display');
+                        el.style.display = 'inline-block';
+                    }
+                    out = (v = el.style[prop]) ? v :
+                           (cs = view.getComputedStyle(el, "")) ? cs[prop] : null;
+
+                    // Webkit returns rgb values for transparent.
+                    if(wk){
+                        if(out == 'rgba(0, 0, 0, 0)'){
+                            out = 'transparent';
+                        }else if(display){
+                            el.style.display = display;
+                        }
+                    }
+                    return out;
+                } :
+                function(prop){
+                    var el = this.dom,
+                        m,
+                        cs;
+
+                    if(el == document) return null;
+                    if (prop == 'opacity') {
+                        if (el.style.filter.match) {
+                            if(m = el.style.filter.match(opacityRe)){
+                                var fv = parseFloat(m[1]);
+                                if(!isNaN(fv)){
+                                    return fv ? fv / 100 : 0;
+                                }
+                            }
+                        }
+                        return 1;
+                    }
+                    prop = chkCache(prop);
+                    return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null);
+                };
+        }(),
+
+        /**
+         * Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values
+         * are convert to standard 6 digit hex color.
+         * @param {String} attr The css attribute
+         * @param {String} defaultValue The default value to use when a valid color isn't found
+         * @param {String} prefix (optional) defaults to #. Use an empty string when working with
+         * color anims.
+         */
+        getColor : function(attr, defaultValue, prefix){
+            var v = this.getStyle(attr),
+                color = Ext.isDefined(prefix) ? prefix : '#',
+                h;
+
+            if(!v || /transparent|inherit/.test(v)){
+                return defaultValue;
+            }
+            if(/^r/.test(v)){
+                Ext.each(v.slice(4, v.length -1).split(','), function(s){
+                    h = parseInt(s, 10);
+                    color += (h < 16 ? '0' : '') + h.toString(16);
+                });
+            }else{
+                v = v.replace('#', '');
+                color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v;
+            }
+            return(color.length > 5 ? color.toLowerCase() : defaultValue);
+        },
+
+        /**
+         * Wrapper for setting style properties, also takes single object parameter of multiple styles.
+         * @param {String/Object} property The style property to be set, or an object of multiple styles.
+         * @param {String} value (optional) The value to apply to the given property, or null if an object was passed.
+         * @return {Ext.Element} this
+         */
+        setStyle : function(prop, value){
+            var tmp,
+                style,
+                camel;
+            if (!Ext.isObject(prop)) {
+                tmp = {};
+                tmp[prop] = value;
+                prop = tmp;
+            }
+            for (style in prop) {
+                value = prop[style];
+                style == 'opacity' ?
+                    this.setOpacity(value) :
+                    this.dom.style[chkCache(style)] = value;
+            }
+            return this;
+        },
+
+        /**
+         * Set the opacity of the element
+         * @param {Float} opacity The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
+         * @param {Boolean/Object} animate (optional) a standard Element animation config object or <tt>true</tt> for
+         * the default animation (<tt>{duration: .35, easing: 'easeIn'}</tt>)
+         * @return {Ext.Element} this
+         */
+         setOpacity : function(opacity, animate){
+            var me = this,
+                s = me.dom.style;
+
+            if(!animate || !me.anim){
+                if(Ext.isIE){
+                    var opac = opacity < 1 ? 'alpha(opacity=' + opacity * 100 + ')' : '',
+                    val = s.filter.replace(opacityRe, '').replace(trimRe, '');
+
+                    s.zoom = 1;
+                    s.filter = val + (val.length > 0 ? ' ' : '') + opac;
+                }else{
+                    s.opacity = opacity;
+                }
+            }else{
+                me.anim({opacity: {to: opacity}}, me.preanim(arguments, 1), null, .35, 'easeIn');
+            }
+            return me;
+        },
+
+        /**
+         * Clears any opacity settings from this element. Required in some cases for IE.
+         * @return {Ext.Element} this
+         */
+        clearOpacity : function(){
+            var style = this.dom.style;
+            if(Ext.isIE){
+                if(!Ext.isEmpty(style.filter)){
+                    style.filter = style.filter.replace(opacityRe, '').replace(trimRe, '');
+                }
+            }else{
+                style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = '';
+            }
+            return this;
+        },
+
+        /**
+         * Returns the offset height of the element
+         * @param {Boolean} contentHeight (optional) true to get the height minus borders and padding
+         * @return {Number} The element's height
+         */
+        getHeight : function(contentHeight){
+            var me = this,
+                dom = me.dom,
+                hidden = Ext.isIE && me.isStyle('display', 'none'),
+                h = MATH.max(dom.offsetHeight, hidden ? 0 : dom.clientHeight) || 0;
+
+            h = !contentHeight ? h : h - me.getBorderWidth("tb") - me.getPadding("tb");
+            return h < 0 ? 0 : h;
+        },
+
+        /**
+         * Returns the offset width of the element
+         * @param {Boolean} contentWidth (optional) true to get the width minus borders and padding
+         * @return {Number} The element's width
+         */
+        getWidth : function(contentWidth){
+            var me = this,
+                dom = me.dom,
+                hidden = Ext.isIE && me.isStyle('display', 'none'),
+                w = MATH.max(dom.offsetWidth, hidden ? 0 : dom.clientWidth) || 0;
+            w = !contentWidth ? w : w - me.getBorderWidth("lr") - me.getPadding("lr");
+            return w < 0 ? 0 : w;
+        },
+
+        /**
+         * Set the width of this Element.
+         * @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>
+         * <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels).</li>
+         * <li>A String used to set the CSS width style. Animation may <b>not</b> be used.
+         * </ul></div>
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Ext.Element} this
+         */
+        setWidth : function(width, animate){
+            var me = this;
+            width = me.adjustWidth(width);
+            !animate || !me.anim ?
+                me.dom.style.width = me.addUnits(width) :
+                me.anim({width : {to : width}}, me.preanim(arguments, 1));
+            return me;
+        },
+
+        /**
+         * Set the height of this Element.
+         * <pre><code>
+// change the height to 200px and animate with default configuration
+Ext.fly('elementId').setHeight(200, true);
+
+// change the height to 150px and animate with a custom configuration
+Ext.fly('elId').setHeight(150, {
+    duration : .5, // animation will have a duration of .5 seconds
+    // will change the content to "finished"
+    callback: function(){ this.{@link #update}("finished"); }
+});
+         * </code></pre>
+         * @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>
+         * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels.)</li>
+         * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
+         * </ul></div>
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Ext.Element} this
+         */
+         setHeight : function(height, animate){
+            var me = this;
+            height = me.adjustHeight(height);
+            !animate || !me.anim ?
+                me.dom.style.height = me.addUnits(height) :
+                me.anim({height : {to : height}}, me.preanim(arguments, 1));
+            return me;
+        },
+
+        /**
+         * Gets the width of the border(s) for the specified side(s)
+         * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,
+         * passing <tt>'lr'</tt> would get the border <b><u>l</u></b>eft width + the border <b><u>r</u></b>ight width.
+         * @return {Number} The width of the sides passed added together
+         */
+        getBorderWidth : function(side){
+            return this.addStyles(side, borders);
+        },
+
+        /**
+         * Gets the width of the padding(s) for the specified side(s)
+         * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,
+         * passing <tt>'lr'</tt> would get the padding <b><u>l</u></b>eft + the padding <b><u>r</u></b>ight.
+         * @return {Number} The padding of the sides passed added together
+         */
+        getPadding : function(side){
+            return this.addStyles(side, paddings);
+        },
+
+        /**
+         *  Store the current overflow setting and clip overflow on the element - use <tt>{@link #unclip}</tt> to remove
+         * @return {Ext.Element} this
+         */
+        clip : function(){
+            var me = this,
+                dom = me.dom;
+
+            if(!data(dom, ISCLIPPED)){
+                data(dom, ISCLIPPED, true);
+                data(dom, ORIGINALCLIP, {
+                    o: me.getStyle(OVERFLOW),
+                    x: me.getStyle(OVERFLOWX),
+                    y: me.getStyle(OVERFLOWY)
+                });
+                me.setStyle(OVERFLOW, HIDDEN);
+                me.setStyle(OVERFLOWX, HIDDEN);
+                me.setStyle(OVERFLOWY, HIDDEN);
+            }
+            return me;
+        },
+
+        /**
+         *  Return clipping (overflow) to original clipping before <tt>{@link #clip}</tt> was called
+         * @return {Ext.Element} this
+         */
+        unclip : function(){
+            var me = this,
+                dom = me.dom;
+
+            if(data(dom, ISCLIPPED)){
+                data(dom, ISCLIPPED, false);
+                var o = data(dom, ORIGINALCLIP);
+                if(o.o){
+                    me.setStyle(OVERFLOW, o.o);
+                }
+                if(o.x){
+                    me.setStyle(OVERFLOWX, o.x);
+                }
+                if(o.y){
+                    me.setStyle(OVERFLOWY, o.y);
+                }
+            }
+            return me;
+        },
+
+        // private
+        addStyles : function(sides, styles){
+            var val = 0,
+                m = sides.match(/\w/g),
+                s;
+            for (var i=0, len=m.length; i<len; i++) {
+                s = m[i] && parseInt(this.getStyle(styles[m[i]]), 10);
+                if (s) {
+                    val += MATH.abs(s);
+                }
+            }
+            return val;
+        },
+
+        margins : margins
+    }
+}()
+);
+/**\r
+ * @class Ext.Element\r
+ */\r
+\r
+// special markup used throughout Ext when box wrapping elements\r
+Ext.Element.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';\r
+\r
+Ext.Element.addMethods(function(){\r
+    var INTERNAL = "_internal",\r
+        pxMatch = /(\d+)px/;\r
+    return {\r
         /**\r
-         * Returns the offset height of the element\r
-         * @param {Boolean} contentHeight (optional) true to get the height minus borders and padding\r
-         * @return {Number} The element's height\r
+         * More flexible version of {@link #setStyle} for setting style properties.\r
+         * @param {String/Object/Function} styles A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or\r
+         * a function which returns such a specification.\r
+         * @return {Ext.Element} this\r
          */\r
-        getHeight : function(contentHeight){\r
-            var me = this,\r
-                dom = me.dom,\r
-                h = MATH.max(dom.offsetHeight, dom.clientHeight) || 0;\r
-            h = !contentHeight ? h : h - me.getBorderWidth("tb") - me.getPadding("tb");\r
-            return h < 0 ? 0 : h;\r
+        applyStyles : function(style){\r
+            Ext.DomHelper.applyStyles(this.dom, style);\r
+            return this;\r
         },\r
-    \r
+\r
         /**\r
-         * Returns the offset width of the element\r
-         * @param {Boolean} contentWidth (optional) true to get the width minus borders and padding\r
-         * @return {Number} The element's width\r
+         * Returns an object with properties matching the styles requested.\r
+         * For example, el.getStyles('color', 'font-size', 'width') might return\r
+         * {'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.\r
+         * @param {String} style1 A style name\r
+         * @param {String} style2 A style name\r
+         * @param {String} etc.\r
+         * @return {Object} The style object\r
          */\r
-        getWidth : function(contentWidth){\r
+        getStyles : function(){\r
+            var ret = {};\r
+            Ext.each(arguments, function(v) {\r
+               ret[v] = this.getStyle(v);\r
+            },\r
+            this);\r
+            return ret;\r
+        },\r
+\r
+        // deprecated\r
+        getStyleSize : function(){\r
             var me = this,\r
-                dom = me.dom,\r
-                w = MATH.max(dom.offsetWidth, dom.clientWidth) || 0;\r
-            w = !contentWidth ? w : w - me.getBorderWidth("lr") - me.getPadding("lr");\r
-            return w < 0 ? 0 : w;\r
+                w,\r
+                h,\r
+                d = this.dom,\r
+                s = d.style;\r
+            if(s.width && s.width != 'auto'){\r
+                w = parseInt(s.width, 10);\r
+                if(me.isBorderBox()){\r
+                   w -= me.getFrameWidth('lr');\r
+                }\r
+            }\r
+            if(s.height && s.height != 'auto'){\r
+                h = parseInt(s.height, 10);\r
+                if(me.isBorderBox()){\r
+                   h -= me.getFrameWidth('tb');\r
+                }\r
+            }\r
+            return {width: w || me.getWidth(true), height: h || me.getHeight(true)};\r
         },\r
-    \r
+\r
+        // private  ==> used by ext full\r
+        setOverflow : function(v){\r
+            var dom = this.dom;\r
+            if(v=='auto' && Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug\r
+                dom.style.overflow = 'hidden';\r
+                (function(){dom.style.overflow = 'auto';}).defer(1);\r
+            }else{\r
+                dom.style.overflow = v;\r
+            }\r
+        },\r
+\r
+       /**\r
+        * <p>Wraps the specified element with a special 9 element markup/CSS block that renders by default as\r
+        * a gray container with a gradient background, rounded corners and a 4-way shadow.</p>\r
+        * <p>This special markup is used throughout Ext when box wrapping elements ({@link Ext.Button},\r
+        * {@link Ext.Panel} when <tt>{@link Ext.Panel#frame frame=true}</tt>, {@link Ext.Window}).  The markup\r
+        * is of this form:</p>\r
+        * <pre><code>\r
+    Ext.Element.boxMarkup =\r
+    &#39;&lt;div class="{0}-tl">&lt;div class="{0}-tr">&lt;div class="{0}-tc">&lt;/div>&lt;/div>&lt;/div>\r
+     &lt;div class="{0}-ml">&lt;div class="{0}-mr">&lt;div class="{0}-mc">&lt;/div>&lt;/div>&lt;/div>\r
+     &lt;div class="{0}-bl">&lt;div class="{0}-br">&lt;div class="{0}-bc">&lt;/div>&lt;/div>&lt;/div>&#39;;\r
+        * </code></pre>\r
+        * <p>Example usage:</p>\r
+        * <pre><code>\r
+    // Basic box wrap\r
+    Ext.get("foo").boxWrap();\r
+\r
+    // You can also add a custom class and use CSS inheritance rules to customize the box look.\r
+    // 'x-box-blue' is a built-in alternative -- look at the related CSS definitions as an example\r
+    // for how to create a custom box wrap style.\r
+    Ext.get("foo").boxWrap().addClass("x-box-blue");\r
+        * </code></pre>\r
+        * @param {String} class (optional) A base CSS class to apply to the containing wrapper element\r
+        * (defaults to <tt>'x-box'</tt>). Note that there are a number of CSS rules that are dependent on\r
+        * this name to make the overall effect work, so if you supply an alternate base class, make sure you\r
+        * also supply all of the necessary rules.\r
+        * @return {Ext.Element} The outermost wrapping element of the created box structure.\r
+        */\r
+        boxWrap : function(cls){\r
+            cls = cls || 'x-box';\r
+            var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + String.format(Ext.Element.boxMarkup, cls) + "</div>"));        //String.format('<div class="{0}">'+Ext.Element.boxMarkup+'</div>', cls)));\r
+            Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);\r
+            return el;\r
+        },\r
+\r
         /**\r
-         * Set the width of this Element.\r
+         * Set the size of this Element. If animation is true, both width and height will be animated concurrently.\r
          * @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>\r
          * <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels).</li>\r
          * <li>A String used to set the CSS width style. Animation may <b>not</b> be used.\r
+         * <li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>\r
          * </ul></div>\r
-         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
-         * @return {Ext.Element} this\r
-         */\r
-        setWidth : function(width, animate){\r
-            var me = this;\r
-            width = me.adjustWidth(width);\r
-            !animate || !me.anim ? \r
-                me.dom.style.width = me.addUnits(width) :\r
-                me.anim({width : {to : width}}, me.preanim(arguments, 1));\r
-            return me;\r
-        },\r
-    \r
-        /**\r
-         * Set the height of this Element.\r
-         * <pre><code>\r
-// change the height to 200px and animate with default configuration\r
-Ext.fly('elementId').setHeight(200, true);\r
-\r
-// change the height to 150px and animate with a custom configuration\r
-Ext.fly('elId').setHeight(150, {\r
-    duration : .5, // animation will have a duration of .5 seconds\r
-    // will change the content to "finished"\r
-    callback: function(){ this.{@link #update}("finished"); } \r
-});\r
-         * </code></pre>\r
          * @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>\r
-         * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels.)</li>\r
+         * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels).</li>\r
          * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>\r
          * </ul></div>\r
          * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
          * @return {Ext.Element} this\r
          */\r
-         setHeight : function(height, animate){\r
+        setSize : function(width, height, animate){\r
             var me = this;\r
+            if(Ext.isObject(width)){ // in case of object from getSize()\r
+                height = width.height;\r
+                width = width.width;\r
+            }\r
+            width = me.adjustWidth(width);\r
             height = me.adjustHeight(height);\r
-            !animate || !me.anim ? \r
-                me.dom.style.height = me.addUnits(height) :\r
-                me.anim({height : {to : height}}, me.preanim(arguments, 1));\r
+            if(!animate || !me.anim){\r
+                me.dom.style.width = me.addUnits(width);\r
+                me.dom.style.height = me.addUnits(height);\r
+            }else{\r
+                me.anim({width: {to: width}, height: {to: height}}, me.preanim(arguments, 2));\r
+            }\r
             return me;\r
         },\r
-        \r
+\r
         /**\r
-         * Gets the width of the border(s) for the specified side(s)\r
-         * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,\r
-         * passing <tt>'lr'</tt> would get the border <b><u>l</u></b>eft width + the border <b><u>r</u></b>ight width.\r
-         * @return {Number} The width of the sides passed added together\r
+         * Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders\r
+         * when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements\r
+         * if a height has not been set using CSS.\r
+         * @return {Number}\r
          */\r
-        getBorderWidth : function(side){\r
-            return addStyles.call(this, side, borders);\r
+        getComputedHeight : function(){\r
+            var me = this,\r
+                h = Math.max(me.dom.offsetHeight, me.dom.clientHeight);\r
+            if(!h){\r
+                h = parseInt(me.getStyle('height'), 10) || 0;\r
+                if(!me.isBorderBox()){\r
+                    h += me.getFrameWidth('tb');\r
+                }\r
+            }\r
+            return h;\r
         },\r
-    \r
+\r
         /**\r
-         * Gets the width of the padding(s) for the specified side(s)\r
-         * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,\r
-         * passing <tt>'lr'</tt> would get the padding <b><u>l</u></b>eft + the padding <b><u>r</u></b>ight.\r
-         * @return {Number} The padding of the sides passed added together\r
+         * Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders\r
+         * when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements\r
+         * if a width has not been set using CSS.\r
+         * @return {Number}\r
          */\r
-        getPadding : function(side){\r
-            return addStyles.call(this, side, paddings);\r
+        getComputedWidth : function(){\r
+            var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);\r
+            if(!w){\r
+                w = parseInt(this.getStyle('width'), 10) || 0;\r
+                if(!this.isBorderBox()){\r
+                    w += this.getFrameWidth('lr');\r
+                }\r
+            }\r
+            return w;\r
         },\r
-    \r
+\r
         /**\r
-         *  Store the current overflow setting and clip overflow on the element - use <tt>{@link #unclip}</tt> to remove\r
-         * @return {Ext.Element} this\r
+         * Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth()\r
+         for more information about the sides.\r
+         * @param {String} sides\r
+         * @return {Number}\r
          */\r
-        clip : function(){\r
-            var me = this,\r
-                dom = me.dom;\r
-                \r
-            if(!data(dom, ISCLIPPED)){\r
-                data(dom, ISCLIPPED, true);\r
-                data(dom, ORIGINALCLIP, {\r
-                    o: me.getStyle(OVERFLOW),\r
-                    x: me.getStyle(OVERFLOWX),\r
-                    y: me.getStyle(OVERFLOWY)\r
-                });\r
-                me.setStyle(OVERFLOW, HIDDEN);\r
-                me.setStyle(OVERFLOWX, HIDDEN);\r
-                me.setStyle(OVERFLOWY, HIDDEN);\r
-            }\r
-            return me;\r
+        getFrameWidth : function(sides, onlyContentBox){\r
+            return onlyContentBox && this.isBorderBox() ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));\r
         },\r
-    \r
+\r
         /**\r
-         *  Return clipping (overflow) to original clipping before <tt>{@link #clip}</tt> was called\r
+         * Sets up event handlers to add and remove a css class when the mouse is over this element\r
+         * @param {String} className\r
          * @return {Ext.Element} this\r
          */\r
-        unclip : function(){\r
-            var me = this,\r
-                dom = me.dom;\r
-                \r
-            if(data(dom, ISCLIPPED)){\r
-                data(dom, ISCLIPPED, false);\r
-                var o = data(dom, ORIGINALCLIP);\r
-                if(o.o){\r
-                    me.setStyle(OVERFLOW, o.o);\r
-                }\r
-                if(o.x){\r
-                    me.setStyle(OVERFLOWX, o.x);\r
-                }\r
-                if(o.y){\r
-                    me.setStyle(OVERFLOWY, o.y);\r
+        addClassOnOver : function(className){\r
+            this.hover(\r
+                function(){\r
+                    Ext.fly(this, INTERNAL).addClass(className);\r
+                },\r
+                function(){\r
+                    Ext.fly(this, INTERNAL).removeClass(className);\r
                 }\r
-            }\r
-            return me;\r
+            );\r
+            return this;\r
         },\r
-        \r
-        addStyles : addStyles,\r
-        margins : margins\r
-    }\r
-}()         \r
-);/**\r
- * @class Ext.Element\r
- */\r
-\r
-// special markup used throughout Ext when box wrapping elements\r
-Ext.Element.boxMarkup = '<div class="{0}-tl"><div class="{0}-tr"><div class="{0}-tc"></div></div></div><div class="{0}-ml"><div class="{0}-mr"><div class="{0}-mc"></div></div></div><div class="{0}-bl"><div class="{0}-br"><div class="{0}-bc"></div></div></div>';\r
-\r
-Ext.Element.addMethods(function(){\r
-       var INTERNAL = "_internal";\r
-       return {\r
-           /**\r
-            * More flexible version of {@link #setStyle} for setting style properties.\r
-            * @param {String/Object/Function} styles A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or\r
-            * a function which returns such a specification.\r
-            * @return {Ext.Element} this\r
-            */\r
-           applyStyles : function(style){\r
-               Ext.DomHelper.applyStyles(this.dom, style);\r
-               return this;\r
-           },\r
-\r
-               /**\r
-            * Returns an object with properties matching the styles requested.\r
-            * For example, el.getStyles('color', 'font-size', 'width') might return\r
-            * {'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.\r
-            * @param {String} style1 A style name\r
-            * @param {String} style2 A style name\r
-            * @param {String} etc.\r
-            * @return {Object} The style object\r
-            */\r
-           getStyles : function(){\r
-                   var ret = {};\r
-                   Ext.each(arguments, function(v) {\r
-                          ret[v] = this.getStyle(v);\r
-                   },\r
-                   this);\r
-                   return ret;\r
-           },\r
-\r
-               getStyleSize : function(){\r
-               var me = this,\r
-                       w,\r
-                       h,\r
-                       d = this.dom,\r
-                       s = d.style;\r
-               if(s.width && s.width != 'auto'){\r
-                   w = parseInt(s.width, 10);\r
-                   if(me.isBorderBox()){\r
-                      w -= me.getFrameWidth('lr');\r
-                   }\r
-               }\r
-               if(s.height && s.height != 'auto'){\r
-                   h = parseInt(s.height, 10);\r
-                   if(me.isBorderBox()){\r
-                      h -= me.getFrameWidth('tb');\r
-                   }\r
-               }\r
-               return {width: w || me.getWidth(true), height: h || me.getHeight(true)};\r
-           },\r
-\r
-           // private  ==> used by ext full\r
-               setOverflow : function(v){\r
-                       var dom = this.dom;\r
-               if(v=='auto' && Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug\r
-                       dom.style.overflow = 'hidden';\r
-                       (function(){dom.style.overflow = 'auto';}).defer(1);\r
-               }else{\r
-                       dom.style.overflow = v;\r
-               }\r
-               },\r
-\r
-          /**\r
-               * <p>Wraps the specified element with a special 9 element markup/CSS block that renders by default as\r
-               * a gray container with a gradient background, rounded corners and a 4-way shadow.</p>\r
-               * <p>This special markup is used throughout Ext when box wrapping elements ({@link Ext.Button},\r
-               * {@link Ext.Panel} when <tt>{@link Ext.Panel#frame frame=true}</tt>, {@link Ext.Window}).  The markup\r
-               * is of this form:</p>\r
-               * <pre><code>\r
-Ext.Element.boxMarkup =\r
-    &#39;&lt;div class="{0}-tl">&lt;div class="{0}-tr">&lt;div class="{0}-tc">&lt;/div>&lt;/div>&lt;/div>\r
-     &lt;div class="{0}-ml">&lt;div class="{0}-mr">&lt;div class="{0}-mc">&lt;/div>&lt;/div>&lt;/div>\r
-     &lt;div class="{0}-bl">&lt;div class="{0}-br">&lt;div class="{0}-bc">&lt;/div>&lt;/div>&lt;/div>&#39;;\r
-               * </code></pre>\r
-               * <p>Example usage:</p>\r
-               * <pre><code>\r
-// Basic box wrap\r
-Ext.get("foo").boxWrap();\r
-\r
-// You can also add a custom class and use CSS inheritance rules to customize the box look.\r
-// 'x-box-blue' is a built-in alternative -- look at the related CSS definitions as an example\r
-// for how to create a custom box wrap style.\r
-Ext.get("foo").boxWrap().addClass("x-box-blue");\r
-               * </code></pre>\r
-               * @param {String} class (optional) A base CSS class to apply to the containing wrapper element\r
-               * (defaults to <tt>'x-box'</tt>). Note that there are a number of CSS rules that are dependent on\r
-               * this name to make the overall effect work, so if you supply an alternate base class, make sure you\r
-               * also supply all of the necessary rules.\r
-               * @return {Ext.Element} this\r
-               */\r
-           boxWrap : function(cls){\r
-               cls = cls || 'x-box';\r
-               var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "'>" + String.format(Ext.Element.boxMarkup, cls) + "</div>"));        //String.format('<div class="{0}">'+Ext.Element.boxMarkup+'</div>', cls)));\r
-               Ext.DomQuery.selectNode('.' + cls + '-mc', el.dom).appendChild(this.dom);\r
-               return el;\r
-           },\r
 \r
         /**\r
-         * Set the size of this Element. If animation is true, both width and height will be animated concurrently.\r
-         * @param {Mixed} width The new width. This may be one of:<div class="mdetail-params"><ul>\r
-         * <li>A Number specifying the new width in this Element's {@link #defaultUnit}s (by default, pixels).</li>\r
-         * <li>A String used to set the CSS width style. Animation may <b>not</b> be used.\r
-         * <li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>\r
-         * </ul></div>\r
-         * @param {Mixed} height The new height. This may be one of:<div class="mdetail-params"><ul>\r
-         * <li>A Number specifying the new height in this Element's {@link #defaultUnit}s (by default, pixels).</li>\r
-         * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>\r
-         * </ul></div>\r
-         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
+         * Sets up event handlers to add and remove a css class when this element has the focus\r
+         * @param {String} className\r
          * @return {Ext.Element} this\r
          */\r
-           setSize : function(width, height, animate){\r
-                       var me = this;\r
-                       if(Ext.isObject(width)){ // in case of object from getSize()\r
-                           height = width.height;\r
-                           width = width.width;\r
-                       }\r
-                       width = me.adjustWidth(width);\r
-                       height = me.adjustHeight(height);\r
-                       if(!animate || !me.anim){\r
-                           me.dom.style.width = me.addUnits(width);\r
-                           me.dom.style.height = me.addUnits(height);\r
-                       }else{\r
-                           me.anim({width: {to: width}, height: {to: height}}, me.preanim(arguments, 2));\r
-                       }\r
-                       return me;\r
-           },\r
-\r
-           /**\r
-            * Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders\r
-            * when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements\r
-            * if a height has not been set using CSS.\r
-            * @return {Number}\r
-            */\r
-           getComputedHeight : function(){\r
-                   var me = this,\r
-                       h = Math.max(me.dom.offsetHeight, me.dom.clientHeight);\r
-               if(!h){\r
-                   h = parseInt(me.getStyle('height'), 10) || 0;\r
-                   if(!me.isBorderBox()){\r
-                       h += me.getFrameWidth('tb');\r
-                   }\r
-               }\r
-               return h;\r
-           },\r
-\r
-           /**\r
-            * Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders\r
-            * when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements\r
-            * if a width has not been set using CSS.\r
-            * @return {Number}\r
-            */\r
-           getComputedWidth : function(){\r
-               var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);\r
-               if(!w){\r
-                   w = parseInt(this.getStyle('width'), 10) || 0;\r
-                   if(!this.isBorderBox()){\r
-                       w += this.getFrameWidth('lr');\r
-                   }\r
-               }\r
-               return w;\r
-           },\r
-\r
-           /**\r
-            * Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth()\r
-            for more information about the sides.\r
-            * @param {String} sides\r
-            * @return {Number}\r
-            */\r
-           getFrameWidth : function(sides, onlyContentBox){\r
-               return onlyContentBox && this.isBorderBox() ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));\r
-           },\r
-\r
-           /**\r
-            * Sets up event handlers to add and remove a css class when the mouse is over this element\r
-            * @param {String} className\r
-            * @return {Ext.Element} this\r
-            */\r
-           addClassOnOver : function(className){\r
-               this.hover(\r
-                   function(){\r
-                       Ext.fly(this, INTERNAL).addClass(className);\r
-                   },\r
-                   function(){\r
-                       Ext.fly(this, INTERNAL).removeClass(className);\r
-                   }\r
-               );\r
-               return this;\r
-           },\r
-\r
-           /**\r
-            * Sets up event handlers to add and remove a css class when this element has the focus\r
-            * @param {String} className\r
-            * @return {Ext.Element} this\r
-            */\r
-           addClassOnFocus : function(className){\r
-                   this.on("focus", function(){\r
-                       Ext.fly(this, INTERNAL).addClass(className);\r
-                   }, this.dom);\r
-                   this.on("blur", function(){\r
-                       Ext.fly(this, INTERNAL).removeClass(className);\r
-                   }, this.dom);\r
-                   return this;\r
-           },\r
+        addClassOnFocus : function(className){\r
+            this.on("focus", function(){\r
+                Ext.fly(this, INTERNAL).addClass(className);\r
+            }, this.dom);\r
+            this.on("blur", function(){\r
+                Ext.fly(this, INTERNAL).removeClass(className);\r
+            }, this.dom);\r
+            return this;\r
+        },\r
 \r
-           /**\r
-            * Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)\r
-            * @param {String} className\r
-            * @return {Ext.Element} this\r
-            */\r
-           addClassOnClick : function(className){\r
-               var dom = this.dom;\r
-               this.on("mousedown", function(){\r
-                   Ext.fly(dom, INTERNAL).addClass(className);\r
-                   var d = Ext.getDoc(),\r
-                       fn = function(){\r
-                               Ext.fly(dom, INTERNAL).removeClass(className);\r
-                               d.removeListener("mouseup", fn);\r
-                           };\r
-                   d.on("mouseup", fn);\r
-               });\r
-               return this;\r
-           },\r
+        /**\r
+         * Sets up event handlers to add and remove a css class when the mouse is down and then up on this element (a click effect)\r
+         * @param {String} className\r
+         * @return {Ext.Element} this\r
+         */\r
+        addClassOnClick : function(className){\r
+            var dom = this.dom;\r
+            this.on("mousedown", function(){\r
+                Ext.fly(dom, INTERNAL).addClass(className);\r
+                var d = Ext.getDoc(),\r
+                    fn = function(){\r
+                        Ext.fly(dom, INTERNAL).removeClass(className);\r
+                        d.removeListener("mouseup", fn);\r
+                    };\r
+                d.on("mouseup", fn);\r
+            });\r
+            return this;\r
+        },\r
 \r
-           /**\r
-            * Returns the width and height of the viewport.\r
-        * <pre><code>\r
+        /**\r
+         * <p>Returns the dimensions of the element available to lay content out in.<p>\r
+         * <p>If the element (or any ancestor element) has CSS style <code>display : none</code>, the dimensions will be zero.</p>\r
+         * example:<pre><code>\r
         var vpSize = Ext.getBody().getViewSize();\r
 \r
         // all Windows created afterwards will have a default value of 90% height and 95% width\r
@@ -5762,73 +6290,128 @@ Ext.get("foo").boxWrap().addClass("x-box-blue");
         });\r
         // To handle window resizing you would have to hook onto onWindowResize.\r
         </code></pre>\r
-            * @return {Object} An object containing the viewport's size {width: (viewport width), height: (viewport height)}\r
-            */\r
-           getViewSize : function(){\r
-               var doc = document,\r
-                       d = this.dom,\r
-                       extdom = Ext.lib.Dom,\r
-                       isDoc = (d == doc || d == doc.body);\r
-               return { width : (isDoc ? extdom.getViewWidth() : d.clientWidth),\r
-                                height : (isDoc ? extdom.getViewHeight() : d.clientHeight) };\r
-           },\r
+         * @param {Boolean} contentBox True to return the W3 content box <i>within</i> the padding area of the element. False\r
+         * or omitted to return the full area of the element within the border. See <a href="http://www.w3.org/TR/CSS2/box.html">http://www.w3.org/TR/CSS2/box.html</a>\r
+         * @return {Object} An object containing the elements's area: <code>{width: &lt;element width>, height: &lt;element height>}</code>\r
+         */\r
+        getViewSize : function(contentBox){\r
+            var doc = document,\r
+                me = this,\r
+                d = me.dom,\r
+                extdom = Ext.lib.Dom,\r
+                isDoc = (d == doc || d == doc.body),\r
+                isBB, w, h, tbBorder = 0, lrBorder = 0,\r
+                tbPadding = 0, lrPadding = 0;\r
+            if (isDoc) {\r
+                return { width: extdom.getViewWidth(), height: extdom.getViewHeight() };\r
+            }\r
+            isBB = me.isBorderBox();\r
+            tbBorder = me.getBorderWidth('tb');\r
+            lrBorder = me.getBorderWidth('lr');\r
+            tbPadding = me.getPadding('tb');\r
+            lrPadding = me.getPadding('lr');\r
+\r
+            // Width calcs\r
+            // Try the style first, then clientWidth, then offsetWidth\r
+            if (w = me.getStyle('width').match(pxMatch)){\r
+                if ((w = parseInt(w[1], 10)) && isBB){\r
+                    // Style includes the padding and border if isBB\r
+                    w -= (lrBorder + lrPadding);\r
+                }\r
+                if (!contentBox){\r
+                    w += lrPadding;\r
+                }\r
+            } else {\r
+                if (!(w = d.clientWidth) && (w = d.offsetWidth)){\r
+                    w -= lrBorder;\r
+                }\r
+                if (w && contentBox){\r
+                    w -= lrPadding;\r
+                }\r
+            }\r
 \r
-           /**\r
-            * Returns the size of the element.\r
-            * @param {Boolean} contentSize (optional) true to get the width/size minus borders and padding\r
-            * @return {Object} An object containing the element's size {width: (element width), height: (element height)}\r
-            */\r
-           getSize : function(contentSize){\r
-               return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};\r
-           },\r
+            // Height calcs\r
+            // Try the style first, then clientHeight, then offsetHeight\r
+            if (h = me.getStyle('height').match(pxMatch)){\r
+                if ((h = parseInt(h[1], 10)) && isBB){\r
+                    // Style includes the padding and border if isBB\r
+                    h -= (tbBorder + tbPadding);\r
+                }\r
+                if (!contentBox){\r
+                    h += tbPadding;\r
+                }\r
+            } else {\r
+                if (!(h = d.clientHeight) && (h = d.offsetHeight)){\r
+                    h -= tbBorder;\r
+                }\r
+                if (h && contentBox){\r
+                    h -= tbPadding;\r
+                }\r
+            }\r
 \r
-           /**\r
-            * Forces the browser to repaint this element\r
-            * @return {Ext.Element} this\r
-            */\r
-           repaint : function(){\r
-               var dom = this.dom;\r
-               this.addClass("x-repaint");\r
-               setTimeout(function(){\r
-                   Ext.fly(dom).removeClass("x-repaint");\r
-               }, 1);\r
-               return this;\r
-           },\r
+            return {\r
+                width : w,\r
+                height : h\r
+            };\r
+        },\r
 \r
-           /**\r
-            * Disables text selection for this element (normalized across browsers)\r
-            * @return {Ext.Element} this\r
-            */\r
-           unselectable : function(){\r
-               this.dom.unselectable = "on";\r
-               return this.swallowEvent("selectstart", true).\r
-                                   applyStyles("-moz-user-select:none;-khtml-user-select:none;").\r
-                                   addClass("x-unselectable");\r
-           },\r
+        /**\r
+         * Returns the size of the element.\r
+         * @param {Boolean} contentSize (optional) true to get the width/size minus borders and padding\r
+         * @return {Object} An object containing the element's size {width: (element width), height: (element height)}\r
+         */\r
+        getSize : function(contentSize){\r
+            return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};\r
+        },\r
 \r
-           /**\r
-            * Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,\r
-            * then it returns the calculated width of the sides (see getPadding)\r
-            * @param {String} sides (optional) Any combination of l, r, t, b to get the sum of those sides\r
-            * @return {Object/Number}\r
-            */\r
-           getMargins : function(side){\r
-                   var me = this,\r
-                       key,\r
-                       hash = {t:"top", l:"left", r:"right", b: "bottom"},\r
-                       o = {};\r
+        /**\r
+         * Forces the browser to repaint this element\r
+         * @return {Ext.Element} this\r
+         */\r
+        repaint : function(){\r
+            var dom = this.dom;\r
+            this.addClass("x-repaint");\r
+            setTimeout(function(){\r
+                Ext.fly(dom).removeClass("x-repaint");\r
+            }, 1);\r
+            return this;\r
+        },\r
+\r
+        /**\r
+         * Disables text selection for this element (normalized across browsers)\r
+         * @return {Ext.Element} this\r
+         */\r
+        unselectable : function(){\r
+            this.dom.unselectable = "on";\r
+            return this.swallowEvent("selectstart", true).\r
+                        applyStyles("-moz-user-select:none;-khtml-user-select:none;").\r
+                        addClass("x-unselectable");\r
+        },\r
+\r
+        /**\r
+         * Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,\r
+         * then it returns the calculated width of the sides (see getPadding)\r
+         * @param {String} sides (optional) Any combination of l, r, t, b to get the sum of those sides\r
+         * @return {Object/Number}\r
+         */\r
+        getMargins : function(side){\r
+            var me = this,\r
+                key,\r
+                hash = {t:"top", l:"left", r:"right", b: "bottom"},\r
+                o = {};\r
 \r
-                   if (!side) {\r
-                       for (key in me.margins){\r
-                               o[hash[key]] = parseInt(me.getStyle(me.margins[key]), 10) || 0;\r
+            if (!side) {\r
+                for (key in me.margins){\r
+                    o[hash[key]] = parseInt(me.getStyle(me.margins[key]), 10) || 0;\r
                 }\r
-                       return o;\r
-               } else {\r
-                   return me.addStyles.call(me, side, me.margins);\r
-               }\r
-           }\r
+                return o;\r
+            } else {\r
+                return me.addStyles.call(me, side, me.margins);\r
+            }\r
+        }\r
     };\r
-}());/**\r
+}());\r
+/**\r
  * @class Ext.Element\r
  */\r
 (function(){\r
@@ -5843,10 +6426,6 @@ var D = Ext.lib.Dom,
         AUTO = "auto",\r
         ZINDEX = "z-index";\r
 \r
-function animTest(args, animate, i) {\r
-       return this.preanim && !!animate ? this.preanim(args, i) : false        \r
-}\r
-\r
 Ext.Element.addMethods({\r
        /**\r
       * Gets the current X position of the element based on page coordinates.  Element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
@@ -5890,7 +6469,7 @@ Ext.Element.addMethods({
      * @return {Ext.Element} this\r
      */\r
     setX : function(x, animate){           \r
-           return this.setXY([x, this.getY()], animTest.call(this, arguments, animate, 1));\r
+           return this.setXY([x, this.getY()], this.animTest(arguments, animate, 1));\r
     },\r
 \r
     /**\r
@@ -5900,7 +6479,7 @@ Ext.Element.addMethods({
      * @return {Ext.Element} this\r
      */\r
     setY : function(y, animate){           \r
-           return this.setXY([this.getX(), y], animTest.call(this, arguments, animate, 1));\r
+           return this.setXY([this.getX(), y], this.animTest(arguments, animate, 1));\r
     },\r
 \r
     /**\r
@@ -5969,7 +6548,7 @@ Ext.Element.addMethods({
      * @return {Ext.Element} this\r
      */\r
     setLocation : function(x, y, animate){\r
-        return this.setXY([x, y], animTest.call(this, arguments, animate, 2));\r
+        return this.setXY([x, y], this.animTest(arguments, animate, 2));\r
     },\r
 \r
     /**\r
@@ -5981,7 +6560,7 @@ Ext.Element.addMethods({
      * @return {Ext.Element} this\r
      */\r
     moveTo : function(x, y, animate){\r
-        return this.setXY([x, y], animTest.call(this, arguments, animate, 2));        \r
+        return this.setXY([x, y], this.animTest(arguments, animate, 2));        \r
     },    \r
     \r
     /**\r
@@ -6122,7 +6701,9 @@ Ext.Element.addMethods({
         return {left: (x - o[0] + l), top: (y - o[1] + t)}; \r
     },\r
     \r
-    animTest : animTest\r
+    animTest : function(args, animate, i) {\r
+        return !!animate && this.preanim ? this.preanim(args, i) : false;\r
+    }\r
 });\r
 })();/**\r
  * @class Ext.Element\r
@@ -6146,13 +6727,24 @@ Ext.Element.addMethods({
         me.setBounds(box.x, box.y, w, h, me.animTest.call(me, arguments, animate, 2));\r
         return me;\r
     },\r
-    \r
+\r
     /**\r
-     * Return a box {x, y, width, height} that can be used to set another elements\r
-     * size/location to match this element.\r
+     * Return an object defining the area of this Element which can be passed to {@link #setBox} to\r
+     * set another Element's size/location to match this element.\r
      * @param {Boolean} contentBox (optional) If true a box for the content of the element is returned.\r
      * @param {Boolean} local (optional) If true the element's left and top are returned instead of page x/y.\r
-     * @return {Object} box An object in the format {x, y, width, height}\r
+     * @return {Object} box An object in the format<pre><code>\r
+{\r
+    x: &lt;Element's X position>,\r
+    y: &lt;Element's Y position>,\r
+    width: &lt;Element's width>,\r
+    height: &lt;Element's height>,\r
+    bottom: &lt;Element's lower bound>,\r
+    right: &lt;Element's rightmost bound>\r
+}\r
+</code></pre>\r
+     * The returned object may also be addressed as an Array where index 0 contains the X position\r
+     * and index 1 contains the Y position. So the result may also be used for {@link #setXY}\r
      */\r
        getBox : function(contentBox, local) {      \r
            var me = this,\r
@@ -6345,14 +6937,16 @@ Ext.Element.addMethods({
      * @return {Element} this\r
      */\r
     scrollTo : function(side, value, animate){\r
-        var tester = /top/i,\r
-               prop = "scroll" + (tester.test(side) ? "Top" : "Left"),\r
+        var top = /top/i.test(side), //check if we're scrolling top or left\r
                me = this,\r
-               dom = me.dom;\r
+               dom = me.dom,\r
+            prop;\r
         if (!animate || !me.anim) {\r
+            prop = 'scroll' + (top ? 'Top' : 'Left'), // just setting the value, so grab the direction\r
             dom[prop] = value;\r
-        } else {\r
-            me.anim({scroll: {to: tester.test(prop) ? [dom[prop], value] : [value, dom[prop]]}},\r
+        }else{\r
+            prop = 'scroll' + (top ? 'Left' : 'Top'), // if scrolling top, we need to grab scrollLeft, if left, scrollTop\r
+            me.anim({scroll: {to: top ? [dom[prop], value] : [value, dom[prop]]}},\r
                         me.preanim(arguments, 2), 'scroll');\r
         }\r
         return me;\r
@@ -6487,7 +7081,7 @@ Ext.Element.addMethods(function(){
         /**\r
          * Sets the element's visibility mode. When setVisible() is called it\r
          * will use this to determine whether to set the visibility or the display property.\r
-         * @param visMode Ext.Element.VISIBILITY or Ext.Element.DISPLAY\r
+         * @param {Number} visMode Ext.Element.VISIBILITY or Ext.Element.DISPLAY\r
          * @return {Ext.Element} this\r
          */\r
         setVisibilityMode : function(visMode){  \r
@@ -6890,9 +7484,7 @@ function(){
                        shim;\r
                el.frameBorder = '0';\r
                el.className = 'ext-shim';\r
-               if(Ext.isIE && Ext.isSecure){\r
-                   el.src = Ext.SSL_SECURE_URL;\r
-               }\r
+               el.src = Ext.SSL_SECURE_URL;\r
                shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));\r
                shim.autoBoxAdjust = false;\r
                return shim;\r
@@ -6905,9 +7497,9 @@ Ext.Element.addMethods({
     /**\r
      * Convenience method for constructing a KeyMap\r
      * @param {Number/Array/Object/String} key Either a string with the keys to listen for, the numeric key code, array of key codes or an object with the following options:\r
-     *                                  {key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}\r
+     * <code>{key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}</code>\r
      * @param {Function} fn The function to call\r
-     * @param {Object} scope (optional) The scope of the function\r
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the specified function is executed. Defaults to this Element.\r
      * @return {Ext.KeyMap} The KeyMap created\r
      */\r
     addKeyListener : function(key, fn, scope){\r
@@ -7031,7 +7623,7 @@ br     The bottom right corner
  * The callback is intended for any additional code that should run once a particular effect has completed. The Element\r
  * being operated upon is passed as the first parameter.\r
  * \r
- * @cfg {Object} scope The scope of the <tt>{@link #callback}</tt> function\r
+ * @cfg {Object} scope The scope (<code>this</code> reference) in which the <tt>{@link #callback}</tt> function is executed. Defaults to the browser window.\r
  * \r
  * @cfg {String} easing A valid Ext.lib.Easing value for the effect:</p><div class="mdetail-params"><ul>\r
  * <li><b><tt>backBoth</tt></b></li>\r
@@ -7505,9 +8097,9 @@ el.frame("C3DAF9", 1, {
             active;\r
 \r
         me.queueFx(o, function(){\r
-            color = color || "#C3DAF9"\r
+            color = color || '#C3DAF9';\r
             if(color.length == 6){\r
-                color = "#" + color;\r
+                color = '#' + color;\r
             }            \r
             count = count || 1;\r
             fly(dom).show();\r
@@ -7517,10 +8109,9 @@ el.frame("C3DAF9", 1, {
                 queue = function(){\r
                     proxy = fly(document.body || document.documentElement).createChild({\r
                         style:{\r
-                            visbility: HIDDEN,\r
                             position : ABSOLUTE,\r
-                            "z-index": 35000, // yee haw\r
-                            border : "0px solid " + color\r
+                            'z-index': 35000, // yee haw\r
+                            border : '0px solid ' + color\r
                         }\r
                     });\r
                     return proxy.queueFx({}, animFn);\r
@@ -7939,7 +8530,7 @@ el.ghost('b', {
 \r
     /* @private */\r
     queueFx : function(o, fn){\r
-        var me = this;\r
+        var me = fly(this.dom);\r
         if(!me.hasFxBlock()){\r
             Ext.applyIf(o, me.fxDefaults);\r
             if(!o.concurrent){\r
@@ -7988,7 +8579,8 @@ el.ghost('b', {
         fly(dom).clearPositioning();\r
         fly(dom).setPositioning(pos);\r
         if(!o.wrap){\r
-            wrap.parentNode.insertBefore(dom, wrap);\r
+            var pn = fly(wrap).dom.parentNode;
+            pn.insertBefore(dom, wrap); \r
             fly(wrap).remove();\r
         }\r
     },\r
@@ -8002,8 +8594,7 @@ el.ghost('b', {
     /* @private */\r
     afterFx : function(o){\r
         var dom = this.dom,\r
-            id = dom.id,\r
-            notConcurrent = !o.concurrent;\r
+            id = dom.id;\r
         if(o.afterStyle){\r
             fly(dom).setStyle(o.afterStyle);            \r
         }\r
@@ -8013,13 +8604,11 @@ el.ghost('b', {
         if(o.remove == TRUE){\r
             fly(dom).remove();\r
         }\r
-        if(notConcurrent){\r
-            getQueue(id).shift();\r
-        }\r
         if(o.callback){\r
             o.callback.call(o.scope, fly(dom));\r
         }\r
-        if(notConcurrent){\r
+        if(!o.concurrent){\r
+            getQueue(id).shift();\r
             fly(dom).nextFx();\r
         }\r
     },\r
@@ -8047,59 +8636,119 @@ Ext.Fx.resize = Ext.Fx.scale;
 //When included, Ext.Fx is automatically applied to Element so that all basic\r
 //effects are available directly via the Element API\r
 Ext.Element.addMethods(Ext.Fx);\r
-})();/**\r
+})();
+/**\r
  * @class Ext.CompositeElementLite\r
- * Flyweight composite class. Reuses the same Ext.Element for element operations.\r
- <pre><code>\r
- var els = Ext.select("#some-el div.some-class");\r
- // or select directly from an existing element\r
- var el = Ext.get('some-el');\r
- el.select('div.some-class');\r
-\r
- els.setWidth(100); // all elements become 100 width\r
- els.hide(true); // all elements fade out and hide\r
- // or\r
- els.setWidth(100).hide(true);\r
- </code></pre><br><br>\r
- * <b>NOTE: Although they are not listed, this class supports all of the set/update methods of Ext.Element. All Ext.Element\r
- * actions will be performed on all the elements in this collection.</b>\r
+ * <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter\r
+ * members, or to perform collective actions upon the whole set.</p>\r
+ * <p>Although they are not listed, this class supports all of the methods of {@link Ext.Element} and\r
+ * {@link Ext.Fx}. The methods from these classes will be performed on all the elements in this collection.</p>\r
+ * Example:<pre><code>\r
+var els = Ext.select("#some-el div.some-class");\r
+// or select directly from an existing element\r
+var el = Ext.get('some-el');\r
+el.select('div.some-class');\r
+\r
+els.setWidth(100); // all elements become 100 width\r
+els.hide(true); // all elements fade out and hide\r
+// or\r
+els.setWidth(100).hide(true);\r
+</code>\r
  */\r
 Ext.CompositeElementLite = function(els, root){\r
+    /**\r
+     * <p>The Array of DOM elements which this CompositeElement encapsulates. Read-only.</p>\r
+     * <p>This will not <i>usually</i> be accessed in developers' code, but developers wishing\r
+     * to augment the capabilities of the CompositeElementLite class may use it when adding\r
+     * methods to the class.</p>\r
+     * <p>For example to add the <code>nextAll</code> method to the class to <b>add</b> all\r
+     * following siblings of selected elements, the code would be</p><code><pre>\r
+Ext.override(Ext.CompositeElementLite, {\r
+    nextAll: function() {\r
+        var els = this.elements, i, l = els.length, n, r = [], ri = -1;\r
+\r
+//      Loop through all elements in this Composite, accumulating\r
+//      an Array of all siblings.\r
+        for (i = 0; i < l; i++) {\r
+            for (n = els[i].nextSibling; n; n = n.nextSibling) {\r
+                r[++ri] = n;\r
+            }\r
+        }\r
+\r
+//      Add all found siblings to this Composite\r
+        return this.add(r);\r
+    }\r
+});</pre></code>\r
+     * @type Array\r
+     * @property elements\r
+     */\r
     this.elements = [];\r
     this.add(els, root);\r
     this.el = new Ext.Element.Flyweight();\r
 };\r
 \r
 Ext.CompositeElementLite.prototype = {\r
-       isComposite: true,      \r
-       /**\r
-     * Returns the number of elements in this composite\r
+    isComposite: true,    \r
+    \r
+    // private\r
+    getElement : function(el){\r
+        // Set the shared flyweight dom property to the current element\r
+        var e = this.el;\r
+        e.dom = el;\r
+        e.id = el.id;\r
+        return e;\r
+    },\r
+    \r
+    // private\r
+    transformElement : function(el){\r
+        return Ext.getDom(el);\r
+    },\r
+    \r
+    /**\r
+     * Returns the number of elements in this Composite.\r
      * @return Number\r
      */\r
     getCount : function(){\r
         return this.elements.length;\r
     },    \r
-       add : function(els){\r
-        if(els){\r
-            if (Ext.isArray(els)) {\r
-                this.elements = this.elements.concat(els);\r
-            } else {\r
-                var yels = this.elements;                                      \r
-                   Ext.each(els, function(e) {\r
-                    yels.push(e);\r
-                });\r
-            }\r
+    /**\r
+     * Adds elements to this Composite object.\r
+     * @param {Mixed} els Either an Array of DOM elements to add, or another Composite object who's elements should be added.\r
+     * @return {CompositeElement} This Composite object.\r
+     */\r
+    add : function(els, root){\r
+        var me = this,\r
+            elements = me.elements;\r
+        if(!els){\r
+            return this;\r
         }\r
-        return this;\r
+        if(Ext.isString(els)){\r
+            els = Ext.Element.selectorFunction(els, root);\r
+        }else if(els.isComposite){\r
+            els = els.elements;\r
+        }else if(!Ext.isIterable(els)){\r
+            els = [els];\r
+        }\r
+        \r
+        for(var i = 0, len = els.length; i < len; ++i){\r
+            elements.push(me.transformElement(els[i]));\r
+        }\r
+        return me;\r
     },\r
+    \r
     invoke : function(fn, args){\r
-        var els = this.elements,\r
-               el = this.el;        \r
-           Ext.each(els, function(e) {    \r
-            el.dom = e;\r
-               Ext.Element.prototype[fn].apply(el, args);\r
-        });\r
-        return this;\r
+        var me = this,\r
+            els = me.elements,\r
+            len = els.length, \r
+            e;\r
+            \r
+        for(i = 0; i<len; i++) {\r
+            e = els[i];\r
+            if(e){\r
+                Ext.Element.prototype[fn].apply(me.getElement(e), args);\r
+            }\r
+        }\r
+        return me;\r
     },\r
     /**\r
      * Returns a flyweight Element of the dom element object at the specified index\r
@@ -8107,37 +8756,97 @@ Ext.CompositeElementLite.prototype = {
      * @return {Ext.Element}\r
      */\r
     item : function(index){\r
-           var me = this;\r
-        if(!me.elements[index]){\r
-            return null;\r
+        var me = this,\r
+            el = me.elements[index],\r
+            out = null;\r
+\r
+        if(el){\r
+            out = me.getElement(el);\r
         }\r
-        me.el.dom = me.elements[index];\r
-        return me.el;\r
+        return out;\r
     },\r
 \r
     // fixes scope with flyweight\r
     addListener : function(eventName, handler, scope, opt){\r
-        Ext.each(this.elements, function(e) {\r
-               Ext.EventManager.on(e, eventName, handler, scope || e, opt);\r
-        });\r
+        var els = this.elements,\r
+            len = els.length,\r
+            i, e;\r
+        \r
+        for(i = 0; i<len; i++) {\r
+            e = els[i];\r
+            if(e) {\r
+                Ext.EventManager.on(e, eventName, handler, scope || e, opt);\r
+            }\r
+        }\r
         return this;\r
     },\r
     /**\r
-    * Calls the passed function passing (el, this, index) for each element in this composite. <b>The element\r
-    * passed is the flyweight (shared) Ext.Element instance, so if you require a\r
-    * a reference to the dom node, use el.dom.</b>\r
-    * @param {Function} fn The function to call\r
-    * @param {Object} scope (optional) The <i>this</i> object (defaults to the element)\r
-    * @return {CompositeElement} this\r
-    */\r
+     * <p>Calls the passed function for each element in this composite.</p>\r
+     * @param {Function} fn The function to call. The function is passed the following parameters:<ul>\r
+     * <li><b>el</b> : Element<div class="sub-desc">The current Element in the iteration.\r
+     * <b>This is the flyweight (shared) Ext.Element instance, so if you require a\r
+     * a reference to the dom node, use el.dom.</b></div></li>\r
+     * <li><b>c</b> : Composite<div class="sub-desc">This Composite object.</div></li>\r
+     * <li><b>idx</b> : Number<div class="sub-desc">The zero-based index in the iteration.</div></li>\r
+     * </ul>\r
+     * @param {Object} scope (optional) The scope (<i>this</i> reference) in which the function is executed. (defaults to the Element)\r
+     * @return {CompositeElement} this\r
+     */\r
     each : function(fn, scope){       \r
         var me = this,\r
-               el = me.el;\r
-       \r
-           Ext.each(me.elements, function(e,i) {    \r
-            el.dom = e;\r
-               return fn.call(scope || el, el, me, i);\r
+            els = me.elements,\r
+            len = els.length,\r
+            i, e;\r
+        \r
+        for(i = 0; i<len; i++) {\r
+            e = els[i];\r
+            if(e){\r
+                e = this.getElement(e);\r
+                if(fn.call(scope || e, e, me, i)){\r
+                    break;\r
+                }\r
+            }\r
+        }\r
+        return me;\r
+    },\r
+    \r
+    /**\r
+    * Clears this Composite and adds the elements passed.\r
+    * @param {Mixed} els Either an array of DOM elements, or another Composite from which to fill this Composite.\r
+    * @return {CompositeElement} this\r
+    */\r
+    fill : function(els){\r
+        var me = this;\r
+        me.elements = [];\r
+        me.add(els);\r
+        return me;\r
+    },\r
+    \r
+    /**\r
+     * Filters this composite to only elements that match the passed selector.\r
+     * @param {String/Function} selector A string CSS selector or a comparison function.\r
+     * The comparison function will be called with the following arguments:<ul>\r
+     * <li><code>el</code> : Ext.Element<div class="sub-desc">The current DOM element.</div></li>\r
+     * <li><code>index</code> : Number<div class="sub-desc">The current index within the collection.</div></li>\r
+     * </ul>\r
+     * @return {CompositeElement} this\r
+     */\r
+    filter : function(selector){\r
+        var els = [],\r
+            me = this,\r
+            elements = me.elements,\r
+            fn = Ext.isFunction(selector) ? selector\r
+                : function(el){\r
+                    return el.is(selector);\r
+                };\r
+                \r
+        \r
+        me.each(function(el, self, i){\r
+            if(fn(el, i) !== false){\r
+                els[els.length] = me.transformElement(el);\r
+            }\r
         });\r
+        me.elements = els;\r
         return me;\r
     },\r
     \r
@@ -8147,7 +8856,7 @@ Ext.CompositeElementLite.prototype = {
      * @return Number The index of the passed Ext.Element in the composite collection, or -1 if not found.\r
      */\r
     indexOf : function(el){\r
-        return this.elements.indexOf(Ext.getDom(el));\r
+        return this.elements.indexOf(this.transformElement(el));\r
     },\r
     \r
     /**\r
@@ -8160,7 +8869,7 @@ Ext.CompositeElementLite.prototype = {
     */    \r
     replaceElement : function(el, replacement, domReplace){\r
         var index = !isNaN(el) ? el : this.indexOf(el),\r
-               d;\r
+            d;\r
         if(index > -1){\r
             replacement = Ext.getDom(replacement);\r
             if(domReplace){\r
@@ -8185,16 +8894,16 @@ Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addLi
 \r
 (function(){\r
 var fnName,\r
-       ElProto = Ext.Element.prototype,\r
-       CelProto = Ext.CompositeElementLite.prototype;\r
-       \r
+    ElProto = Ext.Element.prototype,\r
+    CelProto = Ext.CompositeElementLite.prototype;\r
+    \r
 for(fnName in ElProto){\r
     if(Ext.isFunction(ElProto[fnName])){\r
-           (function(fnName){ \r
-                   CelProto[fnName] = CelProto[fnName] || function(){\r
-                       return this.invoke(fnName, arguments);\r
-               };\r
-       }).call(CelProto, fnName);\r
+        (function(fnName){ \r
+            CelProto[fnName] = CelProto[fnName] || function(){\r
+                return this.invoke(fnName, arguments);\r
+            };\r
+        }).call(CelProto, fnName);\r
         \r
     }\r
 }\r
@@ -8209,13 +8918,12 @@ if(Ext.DomQuery){
  * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or\r
  * {@link Ext.CompositeElementLite CompositeElementLite} object.\r
  * @param {String/Array} selector The CSS selector or an array of elements\r
- * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object) <b>Not supported in core</b>\r
  * @param {HTMLElement/String} root (optional) The root element of the query or id of the root\r
  * @return {CompositeElementLite/CompositeElement}\r
  * @member Ext.Element\r
  * @method select\r
  */\r
-Ext.Element.select = function(selector, unique, root){\r
+Ext.Element.select = function(selector, root){\r
     var els;\r
     if(typeof selector == "string"){\r
         els = Ext.Element.selectorFunction(selector, root);\r
@@ -8231,7 +8939,6 @@ Ext.Element.select = function(selector, unique, root){
  * to be applied to many related elements in one statement through the returned {@link Ext.CompositeElement CompositeElement} or\r
  * {@link Ext.CompositeElementLite CompositeElementLite} object.\r
  * @param {String/Array} selector The CSS selector or an array of elements\r
- * @param {Boolean} unique (optional) true to create a unique Ext.Element for each element (defaults to a shared flyweight object)\r
  * @param {HTMLElement/String} root (optional) The root element of the query or id of the root\r
  * @return {CompositeElementLite/CompositeElement}\r
  * @member Ext\r
@@ -8255,17 +8962,6 @@ Ext.apply(Ext.CompositeElementLite.prototype, {
         return this;\r
     },\r
     \r
-    /**\r
-    * Clears this composite and adds the elements returned by the passed selector.\r
-    * @param {String/Array} els A string CSS selector, an array of elements or an element\r
-    * @return {CompositeElement} this\r
-    */\r
-    fill : function(els){\r
-        this.elements = [];\r
-        this.add(els);\r
-        return this;\r
-    },\r
-    \r
     /**\r
      * Returns the first Element\r
      * @return {Ext.Element}\r
@@ -8289,22 +8985,6 @@ Ext.apply(Ext.CompositeElementLite.prototype, {
      */\r
     contains : function(el){\r
         return this.indexOf(el) != -1;\r
-    },\r
-\r
-    /**\r
-    * Filters this composite to only elements that match the passed selector.\r
-    * @param {String} selector A string CSS selector\r
-    * @return {CompositeElement} this\r
-    */\r
-    filter : function(selector){\r
-        var els = [];\r
-        this.each(function(el){\r
-            if(el.is(selector)){\r
-                els[els.length] = el.dom;\r
-            }\r
-        });\r
-        this.fill(els);\r
-        return this;\r
     },
     
     /**\r
@@ -8336,23 +9016,23 @@ Ext.apply(Ext.CompositeElementLite.prototype, {
 /**\r
  * @class Ext.CompositeElement\r
  * @extends Ext.CompositeElementLite\r
- * Standard composite class. Creates a Ext.Element for every element in the collection.\r
- * <br><br>\r
- * <b>NOTE: Although they are not listed, this class supports all of the set/update methods of Ext.Element. All Ext.Element\r
- * actions will be performed on all the elements in this collection.</b>\r
- * <br><br>\r
- * All methods return <i>this</i> and can be chained.\r
- <pre><code>\r
- var els = Ext.select("#some-el div.some-class", true);\r
- // or select directly from an existing element\r
- var el = Ext.get('some-el');\r
- el.select('div.some-class', true);\r
-\r
- els.setWidth(100); // all elements become 100 width\r
- els.hide(true); // all elements fade out and hide\r
- // or\r
- els.setWidth(100).hide(true);\r
- </code></pre>\r
+ * <p>This class encapsulates a <i>collection</i> of DOM elements, providing methods to filter\r
+ * members, or to perform collective actions upon the whole set.</p>\r
+ * <p>Although they are not listed, this class supports all of the methods of {@link Ext.Element} and\r
+ * {@link Ext.Fx}. The methods from these classes will be performed on all the elements in this collection.</p>\r
+ * <p>All methods return <i>this</i> and can be chained.</p>\r
+ * Usage:\r
+<pre><code>\r
+var els = Ext.select("#some-el div.some-class", true);\r
+// or select directly from an existing element\r
+var el = Ext.get('some-el');\r
+el.select('div.some-class', true);\r
+\r
+els.setWidth(100); // all elements become 100 width\r
+els.hide(true); // all elements fade out and hide\r
+// or\r
+els.setWidth(100).hide(true);\r
+</code></pre>\r
  */\r
 Ext.CompositeElement = function(els, root){\r
     this.elements = [];\r
@@ -8360,71 +9040,47 @@ Ext.CompositeElement = function(els, root){
 };\r
 \r
 Ext.extend(Ext.CompositeElement, Ext.CompositeElementLite, {\r
-    invoke : function(fn, args){\r
-           Ext.each(this.elements, function(e) {\r
-               Ext.Element.prototype[fn].apply(e, args);\r
-        });\r
-        return this;\r
+    \r
+    // private\r
+    getElement : function(el){\r
+        // In this case just return it, since we already have a reference to it\r
+        return el;\r
     },\r
     \r
+    // private\r
+    transformElement : function(el){\r
+        return Ext.get(el);\r
+    }\r
+\r
     /**\r
     * Adds elements to this composite.\r
     * @param {String/Array} els A string CSS selector, an array of elements or an element\r
     * @return {CompositeElement} this\r
     */\r
-    add : function(els, root){\r
-           if(!els){\r
-            return this;\r
-        }\r
-        if(typeof els == "string"){\r
-            els = Ext.Element.selectorFunction(els, root);\r
-        }\r
-        var yels = this.elements;        \r
-           Ext.each(els, function(e) {\r
-               yels.push(Ext.get(e));\r
-        });\r
-        return this;\r
-    },    \r
-    \r
+\r
     /**\r
      * Returns the Element object at the specified index\r
      * @param {Number} index\r
      * @return {Ext.Element}\r
      */\r
-    item : function(index){\r
-        return this.elements[index] || null;\r
-    },\r
 \r
-\r
-    indexOf : function(el){\r
-        return this.elements.indexOf(Ext.get(el));\r
-    },\r
-        \r
-    filter : function(selector){\r
-               var me = this,\r
-                       out = [];\r
-                       \r
-               Ext.each(me.elements, function(el) {    \r
-                       if(el.is(selector)){\r
-                               out.push(Ext.get(el));\r
-                       }\r
-               });\r
-               me.elements = out;\r
-               return me;\r
-       },\r
-       \r
-       /**\r
-    * Calls the passed function passing (el, this, index) for each element in this composite.\r
-    * @param {Function} fn The function to call\r
-    * @param {Object} scope (optional) The <i>this</i> object (defaults to the element)\r
-    * @return {CompositeElement} this\r
-    */\r
-    each : function(fn, scope){        \r
-        Ext.each(this.elements, function(e,i) {\r
-               return fn.call(scope || e, e, this, i);\r
-        }, this);\r
-        return this;\r
-    }\r
+    /**\r
+     * Iterates each <code>element</code> in this <code>composite</code>\r
+     * calling the supplied function using {@link Ext#each}.\r
+     * @param {Function} fn The function to be called with each\r
+     * <code>element</code>. If the supplied function returns <tt>false</tt>,\r
+     * iteration stops. This function is called with the following arguments:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><code>element</code> : <i>Ext.Element</i><div class="sub-desc">The element at the current <code>index</code>\r
+     * in the <code>composite</code></div></li>\r
+     * <li><code>composite</code> : <i>Object</i> <div class="sub-desc">This composite.</div></li>\r
+     * <li><code>index</code> : <i>Number</i> <div class="sub-desc">The current index within the <code>composite</code> </div></li>\r
+     * </ul></div>\r
+     * @param {Object} scope (optional) The scope (<code><this</code> reference) in which the specified function is executed.\r
+     * Defaults to the <code>element</code> at the current <code>index</code>\r
+     * within the composite.\r
+     * @return {CompositeElement} this\r
+     */\r
 });\r
 \r
 /**\r
@@ -8449,7 +9105,7 @@ Ext.Element.select = function(selector, unique, root){
     }\r
 \r
     return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);\r
-};
+};\r
 \r
 /**\r
  * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
@@ -8540,136 +9196,6 @@ Ext.select = Ext.Element.select;(function(){
         Ext.data.Connection.superclass.constructor.call(this);\r
     };\r
 \r
-    // private\r
-    function handleResponse(response){\r
-        this.transId = false;\r
-        var options = response.argument.options;\r
-        response.argument = options ? options.argument : null;\r
-        this.fireEvent(REQUESTCOMPLETE, this, response, options);\r
-        if(options.success){\r
-            options.success.call(options.scope, response, options);\r
-        }\r
-        if(options.callback){\r
-            options.callback.call(options.scope, options, true, response);\r
-        }\r
-    }\r
-\r
-    // private\r
-    function handleFailure(response, e){\r
-        this.transId = false;\r
-        var options = response.argument.options;\r
-        response.argument = options ? options.argument : null;\r
-        this.fireEvent(REQUESTEXCEPTION, this, response, options, e);\r
-        if(options.failure){\r
-            options.failure.call(options.scope, response, options);\r
-        }\r
-        if(options.callback){\r
-            options.callback.call(options.scope, options, false, response);\r
-        }\r
-    }\r
-\r
-    // private\r
-    function doFormUpload(o, ps, url){\r
-        var id = Ext.id(),\r
-            doc = document,\r
-            frame = doc.createElement('iframe'),\r
-            form = Ext.getDom(o.form),\r
-            hiddens = [],\r
-            hd,\r
-            encoding = 'multipart/form-data',\r
-            buf = {\r
-                target: form.target,\r
-                method: form.method,\r
-                encoding: form.encoding,\r
-                enctype: form.enctype,\r
-                action: form.action\r
-            };\r
-            \r
-        Ext.apply(frame, {\r
-            id: id,\r
-            name: id,\r
-            className: 'x-hidden',\r
-            src: Ext.SSL_SECURE_URL // for IE\r
-        });     \r
-        doc.body.appendChild(frame);\r
-        \r
-        // This is required so that IE doesn't pop the response up in a new window.\r
-        if(Ext.isIE){\r
-           document.frames[id].name = id;\r
-        }\r
-        \r
-        Ext.apply(form, {\r
-            target: id,\r
-            method: POST,\r
-            enctype: encoding,\r
-            encoding: encoding,\r
-            action: url || buf.action\r
-        });\r
-        \r
-        // add dynamic params            \r
-        ps = Ext.urlDecode(ps, false);\r
-        for(var k in ps){\r
-            if(ps.hasOwnProperty(k)){\r
-                hd = doc.createElement('input');\r
-                hd.type = 'hidden';                    \r
-                hd.value = ps[hd.name = k];\r
-                form.appendChild(hd);\r
-                hiddens.push(hd);\r
-            }\r
-        }        \r
-\r
-        function cb(){\r
-            var me = this,\r
-                // bogus response object\r
-                r = {responseText : '',\r
-                     responseXML : null,\r
-                     argument : o.argument},\r
-                doc,\r
-                firstChild;\r
-\r
-            try{ \r
-                doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;\r
-                if(doc){\r
-                    if(doc.body){\r
-                        if(/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)){ // json response wrapped in textarea                        \r
-                            r.responseText = firstChild.value;\r
-                        }else{\r
-                            r.responseText = doc.body.innerHTML;\r
-                        }\r
-                    }\r
-                    //in IE the document may still have a body even if returns XML.\r
-                    r.responseXML = doc.XMLDocument || doc;\r
-                }\r
-            }\r
-            catch(e) {}\r
-\r
-            Ext.EventManager.removeListener(frame, LOAD, cb, me);\r
-\r
-            me.fireEvent(REQUESTCOMPLETE, me, r, o);\r
-            \r
-            function runCallback(fn, scope, args){\r
-                if(Ext.isFunction(fn)){\r
-                    fn.apply(scope, args);\r
-                }\r
-            }\r
-\r
-            runCallback(o.success, o.scope, [r, o]);\r
-            runCallback(o.callback, o.scope, [o, true, r]);\r
-\r
-            if(!me.debugUploads){\r
-                setTimeout(function(){Ext.removeNode(frame);}, 100);\r
-            }\r
-        }\r
-\r
-        Ext.EventManager.on(frame, LOAD, cb, this);\r
-        form.submit();\r
-        \r
-        Ext.apply(form, buf);\r
-        Ext.each(hiddens, function(h) {\r
-            Ext.removeNode(h);\r
-        });\r
-    }\r
-\r
     Ext.extend(Ext.data.Connection, Ext.util.Observable, {\r
         /**\r
          * @cfg {String} url (Optional) <p>The default URL to be used for requests to the server. Defaults to undefined.</p>\r
@@ -8827,8 +9353,8 @@ Ext.Ajax.request({
                 var p = o.params,\r
                     url = o.url || me.url,                \r
                     method,\r
-                    cb = {success: handleResponse,\r
-                          failure: handleFailure,\r
+                    cb = {success: me.handleResponse,\r
+                          failure: me.handleFailure,\r
                           scope: me,\r
                           argument: {options: o},\r
                           timeout : o.timeout || me.timeout\r
@@ -8850,7 +9376,7 @@ Ext.Ajax.request({
                 if((form = Ext.getDom(o.form))){\r
                     url = url || form.action;\r
                      if(o.isUpload || /multipart\/form-data/i.test(form.getAttribute("enctype"))) { \r
-                         return doFormUpload.call(me, o, p, url);\r
+                         return me.doFormUpload.call(me, o, p, url);\r
                      }\r
                     serForm = Ext.lib.Ajax.serializeForm(form);                    \r
                     p = p ? (p + '&' + serForm) : serForm;\r
@@ -8896,6 +9422,136 @@ Ext.Ajax.request({
             if(transId || this.isLoading()){\r
                 Ext.lib.Ajax.abort(transId || this.transId);\r
             }\r
+        },\r
+\r
+        // private\r
+        handleResponse : function(response){\r
+            this.transId = false;\r
+            var options = response.argument.options;\r
+            response.argument = options ? options.argument : null;\r
+            this.fireEvent(REQUESTCOMPLETE, this, response, options);\r
+            if(options.success){\r
+                options.success.call(options.scope, response, options);\r
+            }\r
+            if(options.callback){\r
+                options.callback.call(options.scope, options, true, response);\r
+            }\r
+        },\r
+\r
+        // private\r
+        handleFailure : function(response, e){\r
+            this.transId = false;\r
+            var options = response.argument.options;\r
+            response.argument = options ? options.argument : null;\r
+            this.fireEvent(REQUESTEXCEPTION, this, response, options, e);\r
+            if(options.failure){\r
+                options.failure.call(options.scope, response, options);\r
+            }\r
+            if(options.callback){\r
+                options.callback.call(options.scope, options, false, response);\r
+            }\r
+        },\r
+\r
+        // private\r
+        doFormUpload : function(o, ps, url){\r
+            var id = Ext.id(),\r
+                doc = document,\r
+                frame = doc.createElement('iframe'),\r
+                form = Ext.getDom(o.form),\r
+                hiddens = [],\r
+                hd,\r
+                encoding = 'multipart/form-data',\r
+                buf = {\r
+                    target: form.target,\r
+                    method: form.method,\r
+                    encoding: form.encoding,\r
+                    enctype: form.enctype,\r
+                    action: form.action\r
+                };\r
+\r
+            Ext.fly(frame).set({\r
+                id: id,\r
+                name: id,\r
+                cls: 'x-hidden',\r
+                src: Ext.SSL_SECURE_URL // for IE\r
+            });\r
+            doc.body.appendChild(frame);\r
+\r
+            // This is required so that IE doesn't pop the response up in a new window.\r
+            if(Ext.isIE){\r
+               document.frames[id].name = id;\r
+            }\r
+\r
+            Ext.fly(form).set({\r
+                target: id,\r
+                method: POST,\r
+                enctype: encoding,\r
+                encoding: encoding,\r
+                action: url || buf.action\r
+            });\r
+\r
+            // add dynamic params\r
+            Ext.iterate(Ext.urlDecode(ps, false), function(k, v){\r
+                hd = doc.createElement('input');\r
+                Ext.fly(hd).set({\r
+                    type: 'hidden',\r
+                    value: v,\r
+                    name: k\r
+                });\r
+                form.appendChild(hd);\r
+                hiddens.push(hd);\r
+            });\r
+\r
+            function cb(){\r
+                var me = this,\r
+                    // bogus response object\r
+                    r = {responseText : '',\r
+                         responseXML : null,\r
+                         argument : o.argument},\r
+                    doc,\r
+                    firstChild;\r
+\r
+                try{\r
+                    doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;\r
+                    if(doc){\r
+                        if(doc.body){\r
+                            if(/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)){ // json response wrapped in textarea\r
+                                r.responseText = firstChild.value;\r
+                            }else{\r
+                                r.responseText = doc.body.innerHTML;\r
+                            }\r
+                        }\r
+                        //in IE the document may still have a body even if returns XML.\r
+                        r.responseXML = doc.XMLDocument || doc;\r
+                    }\r
+                }\r
+                catch(e) {}\r
+\r
+                Ext.EventManager.removeListener(frame, LOAD, cb, me);\r
+\r
+                me.fireEvent(REQUESTCOMPLETE, me, r, o);\r
+\r
+                function runCallback(fn, scope, args){\r
+                    if(Ext.isFunction(fn)){\r
+                        fn.apply(scope, args);\r
+                    }\r
+                }\r
+\r
+                runCallback(o.success, o.scope, [r, o]);\r
+                runCallback(o.callback, o.scope, [o, true, r]);\r
+\r
+                if(!me.debugUploads){\r
+                    setTimeout(function(){Ext.removeNode(frame);}, 100);\r
+                }\r
+            }\r
+\r
+            Ext.EventManager.on(frame, LOAD, cb, this);\r
+            form.submit();\r
+\r
+            Ext.fly(form).set(buf);\r
+            Ext.each(hiddens, function(h) {\r
+                Ext.removeNode(h);\r
+            });\r
         }\r
     });\r
 })();\r
@@ -9256,17 +9912,17 @@ function() {
             * If params are specified it uses POST, otherwise it uses GET.<br><br>
             * <b>Note:</b> Due to the asynchronous nature of remote server requests, the Element
             * will not have been fully updated when the function returns. To post-process the returned
-            * data, use the callback option, or an <b><tt>update</tt></b> event handler.
+            * data, use the callback option, or an <b><code>update</code></b> event handler.
             * @param {Object} options A config object containing any of the following options:<ul>
             * <li>url : <b>String/Function</b><p class="sub-desc">The URL to request or a function which
             * <i>returns</i> the URL (defaults to the value of {@link Ext.Ajax#url} if not specified).</p></li>
             * <li>method : <b>String</b><p class="sub-desc">The HTTP method to
-            * use. Defaults to POST if the <tt>params</tt> argument is present, otherwise GET.</p></li>
+            * use. Defaults to POST if the <code>params</code> argument is present, otherwise GET.</p></li>
             * <li>params : <b>String/Object/Function</b><p class="sub-desc">The
             * parameters to pass to the server (defaults to none). These may be specified as a url-encoded
             * string, or as an object containing properties which represent parameters,
             * or as a function, which returns such an object.</p></li>
-            * <li>scripts : <b>Boolean</b><p class="sub-desc">If <tt>true</tt>
+            * <li>scripts : <b>Boolean</b><p class="sub-desc">If <code>true</code>
             * any &lt;script&gt; tags embedded in the response text will be extracted
             * and executed (defaults to {@link Ext.Updater.defaults#loadScripts}). If this option is specified,
             * the callback will be called <i>after</i> the execution of the scripts.</p></li>
@@ -9279,11 +9935,11 @@ function() {
             * <li><b>options</b> : Object<p class="sub-desc">The config object passed to the update call.</p></li></ul>
             * </p></li>
             * <li>scope : <b>Object</b><p class="sub-desc">The scope in which
-            * to execute the callback (The callback's <tt>this</tt> reference.) If the
-            * <tt>params</tt> argument is a function, this scope is used for that function also.</p></li>
+            * to execute the callback (The callback's <code>this</code> reference.) If the
+            * <code>params</code> argument is a function, this scope is used for that function also.</p></li>
             * <li>discardUrl : <b>Boolean</b><p class="sub-desc">By default, the URL of this request becomes
             * the default URL for this Updater object, and will be subsequently used in {@link #refresh}
-            * calls.  To bypass this behavior, pass <tt>discardUrl:true</tt> (defaults to false).</p></li>
+            * calls.  To bypass this behavior, pass <code>discardUrl:true</code> (defaults to false).</p></li>
             * <li>timeout : <b>Number</b><p class="sub-desc">The number of seconds to wait for a response before
             * timing out (defaults to {@link Ext.Updater.defaults#timeout}).</p></li>
             * <li>text : <b>String</b><p class="sub-desc">The text to use as the innerHTML of the
@@ -9359,14 +10015,14 @@ function() {
            },          
 
                /**
-            * <p>Performs an async form post, updating this element with the response. If the form has the attribute
+            * <p>Performs an asynchronous form post, updating this element with the response. If the form has the attribute
             * enctype="<a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form-data</a>", it assumes it's a file upload.
             * Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning.</p>
             * <p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>
             * performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the
-            * DOM <tt>&lt;form></tt> element temporarily modified to have its
+            * DOM <code>&lt;form></code> element temporarily modified to have its
             * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer
-            * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document
+            * to a dynamically generated, hidden <code>&lt;iframe></code> which is inserted into the document
             * but removed after the return data has been gathered.</p>
             * <p>Be aware that file upload packets, sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form-data</a>
             * and some server technologies (notably JEE) may require some custom processing in order to
@@ -9518,7 +10174,7 @@ Ext.Updater.defaults = {
     * Blank page URL to use with SSL file uploads (defaults to {@link Ext#SSL_SECURE_URL} if set, or "javascript:false").
     * @type String
     */
-    sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false")      
+    sslBlankUrl : Ext.SSL_SECURE_URL      
 };
 
 
@@ -9543,17 +10199,17 @@ Ext.Updater.updateElement = function(el, url, params, options){
 
 /**
  * @class Ext.Updater.BasicRenderer
- * Default Content renderer. Updates the elements innerHTML with the responseText.
+ * <p>This class is a base class implementing a simple render method which updates an element using results from an Ajax request.</p>
+ * <p>The BasicRenderer updates the element's innerHTML with the responseText. To perform a custom render (i.e. XML or JSON processing),
+ * create an object with a conforming {@link #render} method and pass it to setRenderer on the Updater.</p>
  */
 Ext.Updater.BasicRenderer = function(){};
 
 Ext.Updater.BasicRenderer.prototype = {
     /**
-     * This is called when the transaction is completed and it's time to update the element - The BasicRenderer
-     * updates the elements innerHTML with the responseText - To perform a custom render (i.e. XML or JSON processing),
-     * create an object with a "render(el, response)" method and pass it to setRenderer on the Updater.
+     * This method is called when an Ajax response is received, and an Element needs updating.
      * @param {Ext.Element} el The element being rendered
-     * @param {Object} response The XMLHttpRequest object
+     * @param {Object} xhr The XMLHttpRequest object
      * @param {Updater} updateManager The calling update manager
      * @param {Function} callback A callback that will need to be called if loadScripts is true on the Updater
      */
@@ -10350,15 +11006,15 @@ dt = Date.parseDate("2006-02-29 03:20:01", "Y-m-d H:i:s", true); // returns null
         a: {
             g:1,
             c:"if (results[{0}] == 'am') {\n"
-                + "if (h == 12) { h = 0; }\n"
-                + "} else { if (h < 12) { h += 12; }}",
+                + "if (!h || h == 12) { h = 0; }\n"
+                + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
             s:"(am|pm)"
         },
         A: {
             g:1,
             c:"if (results[{0}] == 'AM') {\n"
-                + "if (h == 12) { h = 0; }\n"
-                + "} else { if (h < 12) { h += 12; }}",
+                + "if (!h || h == 12) { h = 0; }\n"
+                + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}",
             s:"(AM|PM)"
         },
         g: function() {
@@ -10534,12 +11190,12 @@ Ext.apply(Date.prototype, {
      * @return {Number} 0 to 364 (365 in leap years).
      */
     getDayOfYear: function() {
-        var i = 0,
-            num = 0,
+        var num = 0,
             d = this.clone(),
-            m = this.getMonth();
+            m = this.getMonth(),
+            i;
 
-        for (i = 0, d.setMonth(0); i < m; d.setMonth(++i)) {
+        for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) {
             num += d.getDaysInMonth();
         }
         return num + this.getDate() - 1;
@@ -10870,636 +11526,603 @@ console.group('ISO-8601 Granularity Test (see http://www.w3.org/TR/NOTE-datetime
     console.log('Date.parseDate("1997-13-16T19:20:30.45+01:00", "c", true)= %o', Date.parseDate("1997-13-16T19:20:30.45+01:00", "c", true)); // strict date parsing with invalid month value
 console.groupEnd();
 
-//*//**
- * @class Ext.util.DelayedTask
- * <p> The DelayedTask class provides a convenient way to "buffer" the execution of a method,
- * performing setTimeout where a new timeout cancels the old timeout. When called, the
- * task will wait the specified time period before executing. If durng that time period,
- * the task is called again, the original call will be cancelled. This continues so that
- * the function is only called a single time for each iteration.</p>
- * <p>This method is especially useful for things like detecting whether a user has finished
- * typing in a text field. An example would be performing validation on a keypress. You can
- * use this class to buffer the keypress events for a certain number of milliseconds, and
- * perform only if they stop for that amount of time.  Usage:</p><pre><code>
-var task = new Ext.util.DelayedTask(function(){
-    alert(Ext.getDom('myInputField').value.length);
-});
-// Wait 500ms before calling our function. If the user presses another key 
-// during that 500ms, it will be cancelled and we'll wait another 500ms.
-Ext.get('myInputField').on('keypress', function(){
-    task.{@link #delay}(500); 
-});
- * </code></pre> 
- * <p>Note that we are using a DelayedTask here to illustrate a point. The configuration
- * option <tt>buffer</tt> for {@link Ext.util.Observable#addListener addListener/on} will
- * also setup a delayed task for you to buffer events.</p> 
- * @constructor The parameters to this constructor serve as defaults and are not required.
- * @param {Function} fn (optional) The default function to timeout
- * @param {Object} scope (optional) The default scope of that timeout
- * @param {Array} args (optional) The default Array of arguments
+//*//**
+ * @class Ext.util.MixedCollection
+ * @extends Ext.util.Observable
+ * A Collection class that maintains both numeric indexes and keys and exposes events.
+ * @constructor
+ * @param {Boolean} allowFunctions Specify <tt>true</tt> if the {@link #addAll}
+ * function should add function references to the collection. Defaults to
+ * <tt>false</tt>.
+ * @param {Function} keyFn A function that can accept an item of the type(s) stored in this MixedCollection
+ * and return the key value for that item.  This is used when available to look up the key on items that
+ * were passed without an explicit key parameter to a MixedCollection method.  Passing this parameter is
+ * equivalent to providing an implementation for the {@link #getKey} method.
  */
-Ext.util.DelayedTask = function(fn, scope, args){
-    var me = this,
-       id,     
-       call = function(){
-               clearInterval(id);
-               id = null;
-               fn.apply(scope, args || []);
-           };
-           
+Ext.util.MixedCollection = function(allowFunctions, keyFn){
+    this.items = [];
+    this.map = {};
+    this.keys = [];
+    this.length = 0;
+    this.addEvents(
+        /**
+         * @event clear
+         * Fires when the collection is cleared.
+         */
+        'clear',
+        /**
+         * @event add
+         * Fires when an item is added to the collection.
+         * @param {Number} index The index at which the item was added.
+         * @param {Object} o The item added.
+         * @param {String} key The key associated with the added item.
+         */
+        'add',
+        /**
+         * @event replace
+         * Fires when an item is replaced in the collection.
+         * @param {String} key he key associated with the new added.
+         * @param {Object} old The item being replaced.
+         * @param {Object} new The new item.
+         */
+        'replace',
+        /**
+         * @event remove
+         * Fires when an item is removed from the collection.
+         * @param {Object} o The item being removed.
+         * @param {String} key (optional) The key associated with the removed item.
+         */
+        'remove',
+        'sort'
+    );
+    this.allowFunctions = allowFunctions === true;
+    if(keyFn){
+        this.getKey = keyFn;
+    }
+    Ext.util.MixedCollection.superclass.constructor.call(this);
+};
+
+Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, {
+
     /**
-     * Cancels any pending timeout and queues a new one
-     * @param {Number} delay The milliseconds to delay
-     * @param {Function} newFn (optional) Overrides function passed to constructor
-     * @param {Object} newScope (optional) Overrides scope passed to constructor
-     * @param {Array} newArgs (optional) Overrides args passed to constructor
+     * @cfg {Boolean} allowFunctions Specify <tt>true</tt> if the {@link #addAll}
+     * function should add function references to the collection. Defaults to
+     * <tt>false</tt>.
      */
-    me.delay = function(delay, newFn, newScope, newArgs){
-        me.cancel();
-        fn = newFn || fn;
-        scope = newScope || scope;
-        args = newArgs || args;
-        id = setInterval(call, delay);
-    };
+    allowFunctions : false,
 
     /**
-     * Cancel the last queued timeout
+     * Adds an item to the collection. Fires the {@link #add} event when complete.
+     * @param {String} key <p>The key to associate with the item, or the new item.</p>
+     * <p>If a {@link #getKey} implementation was specified for this MixedCollection,
+     * or if the key of the stored items is in a property called <tt><b>id</b></tt>,
+     * the MixedCollection will be able to <i>derive</i> the key for the new item.
+     * In this case just pass the new item in this parameter.</p>
+     * @param {Object} o The item to add.
+     * @return {Object} The item added.
      */
-    me.cancel = function(){
-        if(id){
-            clearInterval(id);
-            id = null;
+    add : function(key, o){
+        if(arguments.length == 1){
+            o = arguments[0];
+            key = this.getKey(o);
         }
-    };
-};/**\r
- * @class Ext.util.MixedCollection\r
- * @extends Ext.util.Observable\r
- * A Collection class that maintains both numeric indexes and keys and exposes events.\r
- * @constructor\r
- * @param {Boolean} allowFunctions True if the addAll function should add function references to the\r
- * collection (defaults to false)\r
- * @param {Function} keyFn A function that can accept an item of the type(s) stored in this MixedCollection\r
- * and return the key value for that item.  This is used when available to look up the key on items that\r
- * were passed without an explicit key parameter to a MixedCollection method.  Passing this parameter is\r
- * equivalent to providing an implementation for the {@link #getKey} method.\r
- */\r
-Ext.util.MixedCollection = function(allowFunctions, keyFn){\r
-    this.items = [];\r
-    this.map = {};\r
-    this.keys = [];\r
-    this.length = 0;\r
-    this.addEvents(\r
-        /**\r
-         * @event clear\r
-         * Fires when the collection is cleared.\r
-         */\r
-        "clear",\r
-        /**\r
-         * @event add\r
-         * Fires when an item is added to the collection.\r
-         * @param {Number} index The index at which the item was added.\r
-         * @param {Object} o The item added.\r
-         * @param {String} key The key associated with the added item.\r
-         */\r
-        "add",\r
-        /**\r
-         * @event replace\r
-         * Fires when an item is replaced in the collection.\r
-         * @param {String} key he key associated with the new added.\r
-         * @param {Object} old The item being replaced.\r
-         * @param {Object} new The new item.\r
-         */\r
-        "replace",\r
-        /**\r
-         * @event remove\r
-         * Fires when an item is removed from the collection.\r
-         * @param {Object} o The item being removed.\r
-         * @param {String} key (optional) The key associated with the removed item.\r
-         */\r
-        "remove",\r
-        "sort"\r
-    );\r
-    this.allowFunctions = allowFunctions === true;\r
-    if(keyFn){\r
-        this.getKey = keyFn;\r
-    }\r
-    Ext.util.MixedCollection.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, {\r
-    allowFunctions : false,\r
-\r
-/**\r
- * Adds an item to the collection. Fires the {@link #add} event when complete.\r
- * @param {String} key <p>The key to associate with the item, or the new item.</p>\r
- * <p>If you supplied a {@link #getKey} implementation for this MixedCollection, or if the key\r
- * of your stored items is in a property called <tt><b>id</b></tt>, then the MixedCollection\r
- * will be able to <i>derive</i> the key for the new item. In this case just pass the new item in\r
- * this parameter.</p>\r
- * @param {Object} o The item to add.\r
- * @return {Object} The item added.\r
- */\r
-    add: function(key, o){\r
-        if(arguments.length == 1){\r
-            o = arguments[0];\r
-            key = this.getKey(o);\r
-        }\r
-        if(typeof key != 'undefined' && key !== null){\r
-            var old = this.map[key];\r
-            if(typeof old != 'undefined'){\r
-                return this.replace(key, o);\r
-            }\r
-            this.map[key] = o;\r
-        }\r
-        this.length++;\r
-        this.items.push(o);\r
-        this.keys.push(key);\r
-        this.fireEvent('add', this.length-1, o, key);\r
-        return o;\r
-    },\r
-\r
-/**\r
-  * MixedCollection has a generic way to fetch keys if you implement getKey.  The default implementation\r
-  * simply returns <tt style="font-weight:bold;">item.id</tt> but you can provide your own implementation\r
-  * to return a different value as in the following examples:\r
-<pre><code>\r
-// normal way\r
-var mc = new Ext.util.MixedCollection();\r
-mc.add(someEl.dom.id, someEl);\r
-mc.add(otherEl.dom.id, otherEl);\r
-//and so on\r
-\r
-// using getKey\r
-var mc = new Ext.util.MixedCollection();\r
-mc.getKey = function(el){\r
-   return el.dom.id;\r
-};\r
-mc.add(someEl);\r
-mc.add(otherEl);\r
-\r
-// or via the constructor\r
-var mc = new Ext.util.MixedCollection(false, function(el){\r
-   return el.dom.id;\r
-});\r
-mc.add(someEl);\r
-mc.add(otherEl);\r
-</code></pre>\r
- * @param {Object} item The item for which to find the key.\r
- * @return {Object} The key for the passed item.\r
- */\r
-    getKey : function(o){\r
-         return o.id;\r
-    },\r
-\r
-/**\r
- * Replaces an item in the collection. Fires the {@link #replace} event when complete.\r
- * @param {String} key <p>The key associated with the item to replace, or the replacement item.</p>\r
- * <p>If you supplied a {@link #getKey} implementation for this MixedCollection, or if the key\r
- * of your stored items is in a property called <tt><b>id</b></tt>, then the MixedCollection\r
- * will be able to <i>derive</i> the key of the replacement item. If you want to replace an item\r
- * with one having the same key value, then just pass the replacement item in this parameter.</p>\r
- * @param o {Object} o (optional) If the first parameter passed was a key, the item to associate\r
- * with that key.\r
- * @return {Object}  The new item.\r
- */\r
-    replace : function(key, o){\r
-        if(arguments.length == 1){\r
-            o = arguments[0];\r
-            key = this.getKey(o);\r
-        }\r
-        var old = this.map[key];\r
-        if(typeof key == "undefined" || key === null || typeof old == "undefined"){\r
-             return this.add(key, o);\r
-        }\r
-        var index = this.indexOfKey(key);\r
-        this.items[index] = o;\r
-        this.map[key] = o;\r
-        this.fireEvent("replace", key, old, o);\r
-        return o;\r
-    },\r
-\r
-/**\r
- * Adds all elements of an Array or an Object to the collection.\r
- * @param {Object/Array} objs An Object containing properties which will be added to the collection, or\r
- * an Array of values, each of which are added to the collection.\r
- */\r
-    addAll : function(objs){\r
-        if(arguments.length > 1 || Ext.isArray(objs)){\r
-            var args = arguments.length > 1 ? arguments : objs;\r
-            for(var i = 0, len = args.length; i < len; i++){\r
-                this.add(args[i]);\r
-            }\r
-        }else{\r
-            for(var key in objs){\r
-                if(this.allowFunctions || typeof objs[key] != "function"){\r
-                    this.add(key, objs[key]);\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-/**\r
- * Executes the specified function once for every item in the collection, passing the following arguments:\r
- * <div class="mdetail-params"><ul>\r
- * <li><b>item</b> : Mixed<p class="sub-desc">The collection item</p></li>\r
- * <li><b>index</b> : Number<p class="sub-desc">The item's index</p></li>\r
- * <li><b>length</b> : Number<p class="sub-desc">The total number of items in the collection</p></li>\r
- * </ul></div>\r
- * The function should return a boolean value. Returning false from the function will stop the iteration.\r
- * @param {Function} fn The function to execute for each item.\r
- * @param {Object} scope (optional) The scope in which to execute the function.\r
- */\r
-    each : function(fn, scope){\r
-        var items = [].concat(this.items); // each safe for removal\r
-        for(var i = 0, len = items.length; i < len; i++){\r
-            if(fn.call(scope || items[i], items[i], i, len) === false){\r
-                break;\r
-            }\r
-        }\r
-    },\r
-\r
-/**\r
- * Executes the specified function once for every key in the collection, passing each\r
- * key, and its associated item as the first two parameters.\r
- * @param {Function} fn The function to execute for each item.\r
- * @param {Object} scope (optional) The scope in which to execute the function.\r
- */\r
-    eachKey : function(fn, scope){\r
-        for(var i = 0, len = this.keys.length; i < len; i++){\r
-            fn.call(scope || window, this.keys[i], this.items[i], i, len);\r
-        }\r
-    },\r
-\r
-    /**\r
-     * Returns the first item in the collection which elicits a true return value from the\r
-     * passed selection function.\r
-     * @param {Function} fn The selection function to execute for each item.\r
-     * @param {Object} scope (optional) The scope in which to execute the function.\r
-     * @return {Object} The first item in the collection which returned true from the selection function.\r
-     */\r
-    find : function(fn, scope){\r
-        for(var i = 0, len = this.items.length; i < len; i++){\r
-            if(fn.call(scope || window, this.items[i], this.keys[i])){\r
-                return this.items[i];\r
-            }\r
-        }\r
-        return null;\r
-    },\r
-\r
-/**\r
- * Inserts an item at the specified index in the collection. Fires the {@link #add} event when complete.\r
- * @param {Number} index The index to insert the item at.\r
- * @param {String} key The key to associate with the new item, or the item itself.\r
- * @param {Object} o (optional) If the second parameter was a key, the new item.\r
- * @return {Object} The item inserted.\r
- */\r
-    insert : function(index, key, o){\r
-        if(arguments.length == 2){\r
-            o = arguments[1];\r
-            key = this.getKey(o);\r
-        }\r
-        if(this.containsKey(key)){\r
-            this.suspendEvents();\r
-            this.removeKey(key);\r
-            this.resumeEvents();\r
-        }\r
-        if(index >= this.length){\r
-            return this.add(key, o);\r
-        }\r
-        this.length++;\r
-        this.items.splice(index, 0, o);\r
-        if(typeof key != "undefined" && key !== null){\r
-            this.map[key] = o;\r
-        }\r
-        this.keys.splice(index, 0, key);\r
-        this.fireEvent("add", index, o, key);\r
-        return o;\r
-    },\r
-\r
-/**\r
- * Remove an item from the collection.\r
- * @param {Object} o The item to remove.\r
- * @return {Object} The item removed or false if no item was removed.\r
- */\r
-    remove : function(o){\r
-        return this.removeAt(this.indexOf(o));\r
-    },\r
-\r
-/**\r
- * Remove an item from a specified index in the collection. Fires the {@link #remove} event when complete.\r
- * @param {Number} index The index within the collection of the item to remove.\r
- * @return {Object} The item removed or false if no item was removed.\r
- */\r
-    removeAt : function(index){\r
-        if(index < this.length && index >= 0){\r
-            this.length--;\r
-            var o = this.items[index];\r
-            this.items.splice(index, 1);\r
-            var key = this.keys[index];\r
-            if(typeof key != "undefined"){\r
-                delete this.map[key];\r
-            }\r
-            this.keys.splice(index, 1);\r
-            this.fireEvent("remove", o, key);\r
-            return o;\r
-        }\r
-        return false;\r
-    },\r
-\r
-/**\r
- * Removed an item associated with the passed key fom the collection.\r
- * @param {String} key The key of the item to remove.\r
- * @return {Object} The item removed or false if no item was removed.\r
- */\r
-    removeKey : function(key){\r
-        return this.removeAt(this.indexOfKey(key));\r
-    },\r
-\r
-/**\r
- * Returns the number of items in the collection.\r
- * @return {Number} the number of items in the collection.\r
- */\r
-    getCount : function(){\r
-        return this.length;\r
-    },\r
-\r
-/**\r
- * Returns index within the collection of the passed Object.\r
- * @param {Object} o The item to find the index of.\r
- * @return {Number} index of the item. Returns -1 if not found.\r
- */\r
-    indexOf : function(o){\r
-        return this.items.indexOf(o);\r
-    },\r
-\r
-/**\r
- * Returns index within the collection of the passed key.\r
- * @param {String} key The key to find the index of.\r
- * @return {Number} index of the key.\r
- */\r
-    indexOfKey : function(key){\r
-        return this.keys.indexOf(key);\r
-    },\r
-\r
-/**\r
- * Returns the item associated with the passed key OR index. Key has priority over index.  This is the equivalent\r
- * of calling {@link #key} first, then if nothing matched calling {@link #itemAt}.\r
- * @param {String/Number} key The key or index of the item.\r
- * @return {Object} If the item is found, returns the item.  If the item was not found, returns <tt>undefined</tt>.\r
- * If an item was found, but is a Class, returns <tt>null</tt>.\r
- */\r
-    item : function(key){\r
-        var mk = this.map[key],\r
-            item = mk !== undefined ? mk : (typeof key == 'number') ? this.items[key] : undefined;\r
-        return !Ext.isFunction(item) || this.allowFunctions ? item : null; // for prototype!\r
-    },\r
-\r
-/**\r
- * Returns the item at the specified index.\r
- * @param {Number} index The index of the item.\r
- * @return {Object} The item at the specified index.\r
- */\r
-    itemAt : function(index){\r
-        return this.items[index];\r
-    },\r
-\r
-/**\r
- * Returns the item associated with the passed key.\r
- * @param {String/Number} key The key of the item.\r
- * @return {Object} The item associated with the passed key.\r
- */\r
-    key : function(key){\r
-        return this.map[key];\r
-    },\r
-\r
-/**\r
- * Returns true if the collection contains the passed Object as an item.\r
- * @param {Object} o  The Object to look for in the collection.\r
- * @return {Boolean} True if the collection contains the Object as an item.\r
- */\r
-    contains : function(o){\r
-        return this.indexOf(o) != -1;\r
-    },\r
-\r
-/**\r
- * Returns true if the collection contains the passed Object as a key.\r
- * @param {String} key The key to look for in the collection.\r
- * @return {Boolean} True if the collection contains the Object as a key.\r
- */\r
-    containsKey : function(key){\r
-        return typeof this.map[key] != "undefined";\r
-    },\r
-\r
-/**\r
- * Removes all items from the collection.  Fires the {@link #clear} event when complete.\r
- */\r
-    clear : function(){\r
-        this.length = 0;\r
-        this.items = [];\r
-        this.keys = [];\r
-        this.map = {};\r
-        this.fireEvent("clear");\r
-    },\r
-\r
-/**\r
- * Returns the first item in the collection.\r
- * @return {Object} the first item in the collection..\r
- */\r
-    first : function(){\r
-        return this.items[0];\r
-    },\r
-\r
-/**\r
- * Returns the last item in the collection.\r
- * @return {Object} the last item in the collection..\r
- */\r
-    last : function(){\r
-        return this.items[this.length-1];\r
-    },\r
-\r
-    // private\r
-    _sort : function(property, dir, fn){\r
-        var i,\r
-            len,\r
-            dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1,\r
-            c = [], k = this.keys, items = this.items;\r
-            \r
-        fn = fn || function(a, b){\r
-            return a-b;\r
-        };\r
-        for(i = 0, len = items.length; i < len; i++){\r
-            c[c.length] = {key: k[i], value: items[i], index: i};\r
-        }\r
-        c.sort(function(a, b){\r
-            var v = fn(a[property], b[property]) * dsc;\r
-            if(v === 0){\r
-                v = (a.index < b.index ? -1 : 1);\r
-            }\r
-            return v;\r
-        });\r
-        for(i = 0, len = c.length; i < len; i++){\r
-            items[i] = c[i].value;\r
-            k[i] = c[i].key;\r
-        }\r
-        this.fireEvent("sort", this);\r
-    },\r
-\r
-    /**\r
-     * Sorts this collection with the passed comparison function\r
-     * @param {String} direction (optional) "ASC" or "DESC"\r
-     * @param {Function} fn (optional) comparison function\r
-     */\r
-    sort : function(dir, fn){\r
-        this._sort("value", dir, fn);\r
-    },\r
-\r
-    /**\r
-     * Sorts this collection by keys\r
-     * @param {String} direction (optional) "ASC" or "DESC"\r
-     * @param {Function} fn (optional) a comparison function (defaults to case insensitive string)\r
-     */\r
-    keySort : function(dir, fn){\r
-        this._sort("key", dir, fn || function(a, b){\r
-            var v1 = String(a).toUpperCase(), v2 = String(b).toUpperCase();\r
-            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);\r
-        });\r
-    },\r
-\r
-    /**\r
-     * Returns a range of items in this collection\r
-     * @param {Number} startIndex (optional) defaults to 0\r
-     * @param {Number} endIndex (optional) default to the last item\r
-     * @return {Array} An array of items\r
-     */\r
-    getRange : function(start, end){\r
-        var items = this.items;\r
-        if(items.length < 1){\r
-            return [];\r
-        }\r
-        start = start || 0;\r
-        end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1);\r
-        var i, r = [];\r
-        if(start <= end){\r
-            for(i = start; i <= end; i++) {\r
-                r[r.length] = items[i];\r
-            }\r
-        }else{\r
-            for(i = start; i >= end; i--) {\r
-                r[r.length] = items[i];\r
-            }\r
-        }\r
-        return r;\r
-    },\r
-\r
-    /**\r
-     * Filter the <i>objects</i> in this collection by a specific property.\r
-     * Returns a new collection that has been filtered.\r
-     * @param {String} property A property on your objects\r
-     * @param {String/RegExp} value Either string that the property values\r
-     * should start with or a RegExp to test against the property\r
-     * @param {Boolean} anyMatch (optional) True to match any part of the string, not just the beginning\r
-     * @param {Boolean} caseSensitive (optional) True for case sensitive comparison (defaults to False).\r
-     * @return {MixedCollection} The new filtered collection\r
-     */\r
-    filter : function(property, value, anyMatch, caseSensitive){\r
-        if(Ext.isEmpty(value, false)){\r
-            return this.clone();\r
-        }\r
-        value = this.createValueMatcher(value, anyMatch, caseSensitive);\r
-        return this.filterBy(function(o){\r
-            return o && value.test(o[property]);\r
-        });\r
-    },\r
-\r
-    /**\r
-     * Filter by a function. Returns a <i>new</i> collection that has been filtered.\r
-     * The passed function will be called with each object in the collection.\r
-     * If the function returns true, the value is included otherwise it is filtered.\r
-     * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key)\r
-     * @param {Object} scope (optional) The scope of the function (defaults to this)\r
-     * @return {MixedCollection} The new filtered collection\r
-     */\r
-    filterBy : function(fn, scope){\r
-        var r = new Ext.util.MixedCollection();\r
-        r.getKey = this.getKey;\r
-        var k = this.keys, it = this.items;\r
-        for(var i = 0, len = it.length; i < len; i++){\r
-            if(fn.call(scope||this, it[i], k[i])){\r
-                r.add(k[i], it[i]);\r
-            }\r
-        }\r
-        return r;\r
-    },\r
-\r
-    /**\r
-     * Finds the index of the first matching object in this collection by a specific property/value.\r
-     * @param {String} property The name of a property on your objects.\r
-     * @param {String/RegExp} value A string that the property values\r
-     * should start with or a RegExp to test against the property.\r
-     * @param {Number} start (optional) The index to start searching at (defaults to 0).\r
-     * @param {Boolean} anyMatch (optional) True to match any part of the string, not just the beginning.\r
-     * @param {Boolean} caseSensitive (optional) True for case sensitive comparison.\r
-     * @return {Number} The matched index or -1\r
-     */\r
-    findIndex : function(property, value, start, anyMatch, caseSensitive){\r
-        if(Ext.isEmpty(value, false)){\r
-            return -1;\r
-        }\r
-        value = this.createValueMatcher(value, anyMatch, caseSensitive);\r
-        return this.findIndexBy(function(o){\r
-            return o && value.test(o[property]);\r
-        }, null, start);\r
-    },\r
-\r
-    /**\r
-     * Find the index of the first matching object in this collection by a function.\r
-     * If the function returns <i>true</i> it is considered a match.\r
-     * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key).\r
-     * @param {Object} scope (optional) The scope of the function (defaults to this).\r
-     * @param {Number} start (optional) The index to start searching at (defaults to 0).\r
-     * @return {Number} The matched index or -1\r
-     */\r
-    findIndexBy : function(fn, scope, start){\r
-        var k = this.keys, it = this.items;\r
-        for(var i = (start||0), len = it.length; i < len; i++){\r
-            if(fn.call(scope||this, it[i], k[i])){\r
-                return i;\r
-            }\r
-        }\r
-        return -1;\r
-    },\r
-\r
-    // private\r
-    createValueMatcher : function(value, anyMatch, caseSensitive){\r
-        if(!value.exec){ // not a regex\r
-            value = String(value);\r
-            value = new RegExp((anyMatch === true ? '' : '^') + Ext.escapeRe(value), caseSensitive ? '' : 'i');\r
-        }\r
-        return value;\r
-    },\r
-\r
-    /**\r
-     * Creates a shallow copy of this collection\r
-     * @return {MixedCollection}\r
-     */\r
-    clone : function(){\r
-        var r = new Ext.util.MixedCollection();\r
-        var k = this.keys, it = this.items;\r
-        for(var i = 0, len = it.length; i < len; i++){\r
-            r.add(k[i], it[i]);\r
-        }\r
-        r.getKey = this.getKey;\r
-        return r;\r
-    }\r
-});\r
-/**\r
- * This method calls {@link #item item()}.\r
- * Returns the item associated with the passed key OR index. Key has priority over index.  This is the equivalent\r
- * of calling {@link #key} first, then if nothing matched calling {@link #itemAt}.\r
- * @param {String/Number} key The key or index of the item.\r
- * @return {Object} If the item is found, returns the item.  If the item was not found, returns <tt>undefined</tt>.\r
- * If an item was found, but is a Class, returns <tt>null</tt>.\r
- */\r
+        if(typeof key != 'undefined' && key !== null){
+            var old = this.map[key];
+            if(typeof old != 'undefined'){
+                return this.replace(key, o);
+            }
+            this.map[key] = o;
+        }
+        this.length++;
+        this.items.push(o);
+        this.keys.push(key);
+        this.fireEvent('add', this.length-1, o, key);
+        return o;
+    },
+
+    /**
+      * MixedCollection has a generic way to fetch keys if you implement getKey.  The default implementation
+      * simply returns <b><code>item.id</code></b> but you can provide your own implementation
+      * to return a different value as in the following examples:<pre><code>
+// normal way
+var mc = new Ext.util.MixedCollection();
+mc.add(someEl.dom.id, someEl);
+mc.add(otherEl.dom.id, otherEl);
+//and so on
+
+// using getKey
+var mc = new Ext.util.MixedCollection();
+mc.getKey = function(el){
+   return el.dom.id;
+};
+mc.add(someEl);
+mc.add(otherEl);
+
+// or via the constructor
+var mc = new Ext.util.MixedCollection(false, function(el){
+   return el.dom.id;
+});
+mc.add(someEl);
+mc.add(otherEl);
+     * </code></pre>
+     * @param {Object} item The item for which to find the key.
+     * @return {Object} The key for the passed item.
+     */
+    getKey : function(o){
+         return o.id;
+    },
+
+    /**
+     * Replaces an item in the collection. Fires the {@link #replace} event when complete.
+     * @param {String} key <p>The key associated with the item to replace, or the replacement item.</p>
+     * <p>If you supplied a {@link #getKey} implementation for this MixedCollection, or if the key
+     * of your stored items is in a property called <tt><b>id</b></tt>, then the MixedCollection
+     * will be able to <i>derive</i> the key of the replacement item. If you want to replace an item
+     * with one having the same key value, then just pass the replacement item in this parameter.</p>
+     * @param o {Object} o (optional) If the first parameter passed was a key, the item to associate
+     * with that key.
+     * @return {Object}  The new item.
+     */
+    replace : function(key, o){
+        if(arguments.length == 1){
+            o = arguments[0];
+            key = this.getKey(o);
+        }
+        var old = this.map[key];
+        if(typeof key == 'undefined' || key === null || typeof old == 'undefined'){
+             return this.add(key, o);
+        }
+        var index = this.indexOfKey(key);
+        this.items[index] = o;
+        this.map[key] = o;
+        this.fireEvent('replace', key, old, o);
+        return o;
+    },
+
+    /**
+     * Adds all elements of an Array or an Object to the collection.
+     * @param {Object/Array} objs An Object containing properties which will be added
+     * to the collection, or an Array of values, each of which are added to the collection.
+     * Functions references will be added to the collection if <code>{@link #allowFunctions}</code>
+     * has been set to <tt>true</tt>.
+     */
+    addAll : function(objs){
+        if(arguments.length > 1 || Ext.isArray(objs)){
+            var args = arguments.length > 1 ? arguments : objs;
+            for(var i = 0, len = args.length; i < len; i++){
+                this.add(args[i]);
+            }
+        }else{
+            for(var key in objs){
+                if(this.allowFunctions || typeof objs[key] != 'function'){
+                    this.add(key, objs[key]);
+                }
+            }
+        }
+    },
+
+    /**
+     * Executes the specified function once for every item in the collection, passing the following arguments:
+     * <div class="mdetail-params"><ul>
+     * <li><b>item</b> : Mixed<p class="sub-desc">The collection item</p></li>
+     * <li><b>index</b> : Number<p class="sub-desc">The item's index</p></li>
+     * <li><b>length</b> : Number<p class="sub-desc">The total number of items in the collection</p></li>
+     * </ul></div>
+     * The function should return a boolean value. Returning false from the function will stop the iteration.
+     * @param {Function} fn The function to execute for each item.
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the current item in the iteration.
+     */
+    each : function(fn, scope){
+        var items = [].concat(this.items); // each safe for removal
+        for(var i = 0, len = items.length; i < len; i++){
+            if(fn.call(scope || items[i], items[i], i, len) === false){
+                break;
+            }
+        }
+    },
+
+    /**
+     * Executes the specified function once for every key in the collection, passing each
+     * key, and its associated item as the first two parameters.
+     * @param {Function} fn The function to execute for each item.
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.
+     */
+    eachKey : function(fn, scope){
+        for(var i = 0, len = this.keys.length; i < len; i++){
+            fn.call(scope || window, this.keys[i], this.items[i], i, len);
+        }
+    },
+
+    /**
+     * Returns the first item in the collection which elicits a true return value from the
+     * passed selection function.
+     * @param {Function} fn The selection function to execute for each item.
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.
+     * @return {Object} The first item in the collection which returned true from the selection function.
+     */
+    find : function(fn, scope){
+        for(var i = 0, len = this.items.length; i < len; i++){
+            if(fn.call(scope || window, this.items[i], this.keys[i])){
+                return this.items[i];
+            }
+        }
+        return null;
+    },
+
+    /**
+     * Inserts an item at the specified index in the collection. Fires the {@link #add} event when complete.
+     * @param {Number} index The index to insert the item at.
+     * @param {String} key The key to associate with the new item, or the item itself.
+     * @param {Object} o (optional) If the second parameter was a key, the new item.
+     * @return {Object} The item inserted.
+     */
+    insert : function(index, key, o){
+        if(arguments.length == 2){
+            o = arguments[1];
+            key = this.getKey(o);
+        }
+        if(this.containsKey(key)){
+            this.suspendEvents();
+            this.removeKey(key);
+            this.resumeEvents();
+        }
+        if(index >= this.length){
+            return this.add(key, o);
+        }
+        this.length++;
+        this.items.splice(index, 0, o);
+        if(typeof key != 'undefined' && key !== null){
+            this.map[key] = o;
+        }
+        this.keys.splice(index, 0, key);
+        this.fireEvent('add', index, o, key);
+        return o;
+    },
+
+    /**
+     * Remove an item from the collection.
+     * @param {Object} o The item to remove.
+     * @return {Object} The item removed or false if no item was removed.
+     */
+    remove : function(o){
+        return this.removeAt(this.indexOf(o));
+    },
+
+    /**
+     * Remove an item from a specified index in the collection. Fires the {@link #remove} event when complete.
+     * @param {Number} index The index within the collection of the item to remove.
+     * @return {Object} The item removed or false if no item was removed.
+     */
+    removeAt : function(index){
+        if(index < this.length && index >= 0){
+            this.length--;
+            var o = this.items[index];
+            this.items.splice(index, 1);
+            var key = this.keys[index];
+            if(typeof key != 'undefined'){
+                delete this.map[key];
+            }
+            this.keys.splice(index, 1);
+            this.fireEvent('remove', o, key);
+            return o;
+        }
+        return false;
+    },
+
+    /**
+     * Removed an item associated with the passed key fom the collection.
+     * @param {String} key The key of the item to remove.
+     * @return {Object} The item removed or false if no item was removed.
+     */
+    removeKey : function(key){
+        return this.removeAt(this.indexOfKey(key));
+    },
+
+    /**
+     * Returns the number of items in the collection.
+     * @return {Number} the number of items in the collection.
+     */
+    getCount : function(){
+        return this.length;
+    },
+
+    /**
+     * Returns index within the collection of the passed Object.
+     * @param {Object} o The item to find the index of.
+     * @return {Number} index of the item. Returns -1 if not found.
+     */
+    indexOf : function(o){
+        return this.items.indexOf(o);
+    },
+
+    /**
+     * Returns index within the collection of the passed key.
+     * @param {String} key The key to find the index of.
+     * @return {Number} index of the key.
+     */
+    indexOfKey : function(key){
+        return this.keys.indexOf(key);
+    },
+
+    /**
+     * Returns the item associated with the passed key OR index.
+     * Key has priority over index.  This is the equivalent
+     * of calling {@link #key} first, then if nothing matched calling {@link #itemAt}.
+     * @param {String/Number} key The key or index of the item.
+     * @return {Object} If the item is found, returns the item.  If the item was not found, returns <tt>undefined</tt>.
+     * If an item was found, but is a Class, returns <tt>null</tt>.
+     */
+    item : function(key){
+        var mk = this.map[key],
+            item = mk !== undefined ? mk : (typeof key == 'number') ? this.items[key] : undefined;
+        return !Ext.isFunction(item) || this.allowFunctions ? item : null; // for prototype!
+    },
+
+    /**
+     * Returns the item at the specified index.
+     * @param {Number} index The index of the item.
+     * @return {Object} The item at the specified index.
+     */
+    itemAt : function(index){
+        return this.items[index];
+    },
+
+    /**
+     * Returns the item associated with the passed key.
+     * @param {String/Number} key The key of the item.
+     * @return {Object} The item associated with the passed key.
+     */
+    key : function(key){
+        return this.map[key];
+    },
+
+    /**
+     * Returns true if the collection contains the passed Object as an item.
+     * @param {Object} o  The Object to look for in the collection.
+     * @return {Boolean} True if the collection contains the Object as an item.
+     */
+    contains : function(o){
+        return this.indexOf(o) != -1;
+    },
+
+    /**
+     * Returns true if the collection contains the passed Object as a key.
+     * @param {String} key The key to look for in the collection.
+     * @return {Boolean} True if the collection contains the Object as a key.
+     */
+    containsKey : function(key){
+        return typeof this.map[key] != 'undefined';
+    },
+
+    /**
+     * Removes all items from the collection.  Fires the {@link #clear} event when complete.
+     */
+    clear : function(){
+        this.length = 0;
+        this.items = [];
+        this.keys = [];
+        this.map = {};
+        this.fireEvent('clear');
+    },
+
+    /**
+     * Returns the first item in the collection.
+     * @return {Object} the first item in the collection..
+     */
+    first : function(){
+        return this.items[0];
+    },
+
+    /**
+     * Returns the last item in the collection.
+     * @return {Object} the last item in the collection..
+     */
+    last : function(){
+        return this.items[this.length-1];
+    },
+
+    /**
+     * @private
+     * @param {String} property Property to sort by ('key', 'value', or 'index')
+     * @param {String} dir (optional) Direction to sort 'ASC' or 'DESC'. Defaults to 'ASC'.
+     * @param {Function} fn (optional) Comparison function that defines the sort order.
+     * Defaults to sorting by numeric value.
+     */
+    _sort : function(property, dir, fn){
+        var i,
+            len,
+            dsc = String(dir).toUpperCase() == 'DESC' ? -1 : 1,
+            c = [], k = this.keys, items = this.items;
+
+        fn = fn || function(a, b){
+            return a-b;
+        };
+        for(i = 0, len = items.length; i < len; i++){
+            c[c.length] = {key: k[i], value: items[i], index: i};
+        }
+        c.sort(function(a, b){
+            var v = fn(a[property], b[property]) * dsc;
+            if(v === 0){
+                v = (a.index < b.index ? -1 : 1);
+            }
+            return v;
+        });
+        for(i = 0, len = c.length; i < len; i++){
+            items[i] = c[i].value;
+            k[i] = c[i].key;
+        }
+        this.fireEvent('sort', this);
+    },
+
+    /**
+     * Sorts this collection by <b>item</b> value with the passed comparison function.
+     * @param {String} direction (optional) 'ASC' or 'DESC'. Defaults to 'ASC'.
+     * @param {Function} fn (optional) Comparison function that defines the sort order.
+     * Defaults to sorting by numeric value.
+     */
+    sort : function(dir, fn){
+        this._sort('value', dir, fn);
+    },
+
+    /**
+     * Sorts this collection by <b>key</b>s.
+     * @param {String} direction (optional) 'ASC' or 'DESC'. Defaults to 'ASC'.
+     * @param {Function} fn (optional) Comparison function that defines the sort order.
+     * Defaults to sorting by case insensitive string.
+     */
+    keySort : function(dir, fn){
+        this._sort('key', dir, fn || function(a, b){
+            var v1 = String(a).toUpperCase(), v2 = String(b).toUpperCase();
+            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
+        });
+    },
+
+    /**
+     * Returns a range of items in this collection
+     * @param {Number} startIndex (optional) The starting index. Defaults to 0.
+     * @param {Number} endIndex (optional) The ending index. Defaults to the last item.
+     * @return {Array} An array of items
+     */
+    getRange : function(start, end){
+        var items = this.items;
+        if(items.length < 1){
+            return [];
+        }
+        start = start || 0;
+        end = Math.min(typeof end == 'undefined' ? this.length-1 : end, this.length-1);
+        var i, r = [];
+        if(start <= end){
+            for(i = start; i <= end; i++) {
+                r[r.length] = items[i];
+            }
+        }else{
+            for(i = start; i >= end; i--) {
+                r[r.length] = items[i];
+            }
+        }
+        return r;
+    },
+
+    /**
+     * Filter the <i>objects</i> in this collection by a specific property.
+     * Returns a new collection that has been filtered.
+     * @param {String} property A property on your objects
+     * @param {String/RegExp} value Either string that the property values
+     * should start with or a RegExp to test against the property
+     * @param {Boolean} anyMatch (optional) True to match any part of the string, not just the beginning
+     * @param {Boolean} caseSensitive (optional) True for case sensitive comparison (defaults to False).
+     * @return {MixedCollection} The new filtered collection
+     */
+    filter : function(property, value, anyMatch, caseSensitive){
+        if(Ext.isEmpty(value, false)){
+            return this.clone();
+        }
+        value = this.createValueMatcher(value, anyMatch, caseSensitive);
+        return this.filterBy(function(o){
+            return o && value.test(o[property]);
+        });
+    },
+
+    /**
+     * Filter by a function. Returns a <i>new</i> collection that has been filtered.
+     * The passed function will be called with each object in the collection.
+     * If the function returns true, the value is included otherwise it is filtered.
+     * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key)
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to this MixedCollection.
+     * @return {MixedCollection} The new filtered collection
+     */
+    filterBy : function(fn, scope){
+        var r = new Ext.util.MixedCollection();
+        r.getKey = this.getKey;
+        var k = this.keys, it = this.items;
+        for(var i = 0, len = it.length; i < len; i++){
+            if(fn.call(scope||this, it[i], k[i])){
+                r.add(k[i], it[i]);
+            }
+        }
+        return r;
+    },
+
+    /**
+     * Finds the index of the first matching object in this collection by a specific property/value.
+     * @param {String} property The name of a property on your objects.
+     * @param {String/RegExp} value A string that the property values
+     * should start with or a RegExp to test against the property.
+     * @param {Number} start (optional) The index to start searching at (defaults to 0).
+     * @param {Boolean} anyMatch (optional) True to match any part of the string, not just the beginning.
+     * @param {Boolean} caseSensitive (optional) True for case sensitive comparison.
+     * @return {Number} The matched index or -1
+     */
+    findIndex : function(property, value, start, anyMatch, caseSensitive){
+        if(Ext.isEmpty(value, false)){
+            return -1;
+        }
+        value = this.createValueMatcher(value, anyMatch, caseSensitive);
+        return this.findIndexBy(function(o){
+            return o && value.test(o[property]);
+        }, null, start);
+    },
+
+    /**
+     * Find the index of the first matching object in this collection by a function.
+     * If the function returns <i>true</i> it is considered a match.
+     * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key).
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to this MixedCollection.
+     * @param {Number} start (optional) The index to start searching at (defaults to 0).
+     * @return {Number} The matched index or -1
+     */
+    findIndexBy : function(fn, scope, start){
+        var k = this.keys, it = this.items;
+        for(var i = (start||0), len = it.length; i < len; i++){
+            if(fn.call(scope||this, it[i], k[i])){
+                return i;
+            }
+        }
+        return -1;
+    },
+
+    // private
+    createValueMatcher : function(value, anyMatch, caseSensitive, exactMatch) {
+        if (!value.exec) { // not a regex
+            var er = Ext.escapeRe;
+            value = String(value);
+            if (anyMatch === true) {
+                value = er(value);
+            } else {
+                value = '^' + er(value);
+                if (exactMatch === true) {
+                    value += '$';
+                }
+            }
+            value = new RegExp(value, caseSensitive ? '' : 'i');
+         }
+         return value;
+    },
+
+    /**
+     * Creates a shallow copy of this collection
+     * @return {MixedCollection}
+     */
+    clone : function(){
+        var r = new Ext.util.MixedCollection();
+        var k = this.keys, it = this.items;
+        for(var i = 0, len = it.length; i < len; i++){
+            r.add(k[i], it[i]);
+        }
+        r.getKey = this.getKey;
+        return r;
+    }
+});
+/**
+ * This method calls {@link #item item()}.
+ * Returns the item associated with the passed key OR index. Key has priority
+ * over index.  This is the equivalent of calling {@link #key} first, then if
+ * nothing matched calling {@link #itemAt}.
+ * @param {String/Number} key The key or index of the item.
+ * @return {Object} If the item is found, returns the item.  If the item was
+ * not found, returns <tt>undefined</tt>. If an item was found, but is a Class,
+ * returns <tt>null</tt>.
+ */
 Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item;/**
  * @class Ext.util.JSON
  * Modified version of Douglas Crockford"s json.js that doesn"t
@@ -11527,35 +12150,39 @@ Ext.util.JSON = new (function(){
             return eval("(" + json + ')');    
         },
         doEncode = function(o){
-            if(typeof o == "undefined" || o === null){
+            if(!Ext.isDefined(o) || o === null){
                 return "null";
             }else if(Ext.isArray(o)){
                 return encodeArray(o);
-            }else if(Object.prototype.toString.apply(o) === '[object Date]'){
+            }else if(Ext.isDate(o)){
                 return Ext.util.JSON.encodeDate(o);
-            }else if(typeof o == "string"){
+            }else if(Ext.isString(o)){
                 return encodeString(o);
             }else if(typeof o == "number"){
+                //don't use isNumber here, since finite checks happen inside isNumber
                 return isFinite(o) ? String(o) : "null";
-            }else if(typeof o == "boolean"){
+            }else if(Ext.isBoolean(o)){
                 return String(o);
             }else {
                 var a = ["{"], b, i, v;
                 for (i in o) {
-                    if(!useHasOwn || o.hasOwnProperty(i)) {
-                        v = o[i];
-                        switch (typeof v) {
-                        case "undefined":
-                        case "function":
-                        case "unknown":
-                            break;
-                        default:
-                            if(b){
-                                a.push(',');
+                    // don't encode DOM objects
+                    if(!o.getElementsByTagName){
+                        if(!useHasOwn || o.hasOwnProperty(i)) {
+                            v = o[i];
+                            switch (typeof v) {
+                            case "undefined":
+                            case "function":
+                            case "unknown":
+                                break;
+                            default:
+                                if(b){
+                                    a.push(',');
+                                }
+                                a.push(doEncode(i), ":",
+                                        v === null ? "null" : doEncode(v));
+                                b = true;
                             }
-                            a.push(doEncode(i), ":",
-                                    v === null ? "null" : doEncode(v));
-                            b = true;
                         }
                     }
                 }
@@ -11674,7 +12301,11 @@ Ext.decode = Ext.util.JSON.decode;
  * @singleton\r
  */\r
 Ext.util.Format = function(){\r
-    var trimRe = /^\s+|\s+$/g;\r
+    var trimRe = /^\s+|\s+$/g,\r
+        stripTagsRE = /<\/?[^>]+>/gi,\r
+        stripScriptsRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,\r
+        nl2brRe = /\r?\n/g;\r
+        \r
     return {\r
         /**\r
          * Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length\r
@@ -11686,8 +12317,8 @@ Ext.util.Format = function(){
         ellipsis : function(value, len, word){\r
             if(value && value.length > len){\r
                 if(word){\r
-                    var vs = value.substr(0, len - 2);\r
-                    var index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));\r
+                    var vs = value.substr(0, len - 2),\r
+                        index = Math.max(vs.lastIndexOf(' '), vs.lastIndexOf('.'), vs.lastIndexOf('!'), vs.lastIndexOf('?'));\r
                     if(index == -1 || index < (len - 15)){\r
                         return value.substr(0, len - 3) + "...";\r
                     }else{\r
@@ -11804,10 +12435,10 @@ Ext.util.Format = function(){
             v = (Math.round((v-0)*100))/100;\r
             v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);\r
             v = String(v);\r
-            var ps = v.split('.');\r
-            var whole = ps[0];\r
-            var sub = ps[1] ? '.'+ ps[1] : '.00';\r
-            var r = /(\d+)(\d{3})/;\r
+            var ps = v.split('.'),\r
+                whole = ps[0],\r
+                sub = ps[1] ? '.'+ ps[1] : '.00',\r
+                r = /(\d+)(\d{3})/;\r
             while (r.test(whole)) {\r
                 whole = whole.replace(r, '$1' + ',' + '$2');\r
             }\r
@@ -11844,9 +12475,6 @@ Ext.util.Format = function(){
                 return Ext.util.Format.date(v, format);\r
             };\r
         },\r
-\r
-        // private\r
-        stripTagsRE : /<\/?[^>]+>/gi,\r
         \r
         /**\r
          * Strips all HTML tags\r
@@ -11854,18 +12482,16 @@ Ext.util.Format = function(){
          * @return {String} The stripped text\r
          */\r
         stripTags : function(v){\r
-            return !v ? v : String(v).replace(this.stripTagsRE, "");\r
+            return !v ? v : String(v).replace(stripTagsRE, "");\r
         },\r
 \r
-        stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,\r
-\r
         /**\r
          * Strips all script tags\r
          * @param {Mixed} value The text from which to strip script tags\r
          * @return {String} The stripped text\r
          */\r
         stripScripts : function(v){\r
-            return !v ? v : String(v).replace(this.stripScriptsRe, "");\r
+            return !v ? v : String(v).replace(stripScriptsRe, "");\r
         },\r
 \r
         /**\r
@@ -12014,18 +12640,45 @@ Ext.util.Format = function(){
          * @return {String} The string with embedded &lt;br/> tags in place of newlines.\r
          */\r
         nl2br : function(v){\r
-            return v === undefined || v === null ? '' : v.replace(/\n/g, '<br/>');\r
+            return Ext.isEmpty(v) ? '' : v.replace(nl2brRe, '<br/>');\r
         }\r
     }\r
-}();/**
+}();\r
+/**
  * @class Ext.XTemplate
  * @extends Ext.Template
- * <p>A template class that supports advanced functionality like autofilling arrays, conditional processing with
- * basic comparison operators, sub-templates, basic math function support, special built-in template variables,
- * inline code execution and more.  XTemplate also provides the templating mechanism built into {@link Ext.DataView}.</p>
- * <p>XTemplate supports many special tags and built-in operators that aren't defined as part of the API, but are
- * supported in the templates that can be created.  The following examples demonstrate all of the supported features.
- * This is the data object used for reference in each code example:</p>
+ * <p>A template class that supports advanced functionality like:<div class="mdetail-params"><ul>
+ * <li>Autofilling arrays using templates and sub-templates</li>
+ * <li>Conditional processing with basic comparison operators</li>
+ * <li>Basic math function support</li>
+ * <li>Execute arbitrary inline code with special built-in template variables</li>
+ * <li>Custom member functions</li>
+ * <li>Many special tags and built-in operators that aren't defined as part of
+ * the API, but are supported in the templates that can be created</li>
+ * </ul></div></p>
+ * <p>XTemplate provides the templating mechanism built into:<div class="mdetail-params"><ul>
+ * <li>{@link Ext.DataView}</li>
+ * <li>{@link Ext.ListView}</li>
+ * <li>{@link Ext.form.ComboBox}</li>
+ * <li>{@link Ext.grid.TemplateColumn}</li>
+ * <li>{@link Ext.grid.GroupingView}</li>
+ * <li>{@link Ext.menu.Item}</li>
+ * <li>{@link Ext.layout.MenuLayout}</li>
+ * <li>{@link Ext.ColorPalette}</li>
+ * </ul></div></p>
+ * 
+ * <p>For example usage {@link #XTemplate see the constructor}.</p>  
+ *   
+ * @constructor
+ * The {@link Ext.Template#Template Ext.Template constructor} describes
+ * the acceptable parameters to pass to the constructor. The following
+ * examples demonstrate all of the supported features.</p>
+ * 
+ * <div class="mdetail-params"><ul>
+ * 
+ * <li><b><u>Sample Data</u></b> 
+ * <div class="sub-desc">
+ * <p>This is the data object used for reference in each code example:</p>
  * <pre><code>
 var data = {
     name: 'Jack Slocum',
@@ -12049,104 +12702,161 @@ var data = {
     }]
 };
  * </code></pre>
- * <p><b>Auto filling of arrays</b><br/>The <tt>tpl</tt> tag and the <tt>for</tt> operator are used
- * to process the provided data object. If <tt>for="."</tt> is specified, the data object provided
- * is examined. If the variable in <tt>for</tt> is an array, it will auto-fill, repeating the template
- * block inside the <tt>tpl</tt> tag for each item in the array:</p>
+ * </div>
+ * </li>
+ * 
+ * 
+ * <li><b><u>Auto filling of arrays</u></b> 
+ * <div class="sub-desc">
+ * <p>The <b><tt>tpl</tt></b> tag and the <b><tt>for</tt></b> operator are used
+ * to process the provided data object:
+ * <ul>
+ * <li>If the value specified in <tt>for</tt> is an array, it will auto-fill,
+ * repeating the template block inside the <tt>tpl</tt> tag for each item in the
+ * array.</li>
+ * <li>If <tt>for="."</tt> is specified, the data object provided is examined.</li>
+ * <li>While processing an array, the special variable <tt>{#}</tt>
+ * will provide the current array index + 1 (starts at 1, not 0).</li>
+ * </ul>
+ * </p>
+ * <pre><code>
+&lt;tpl <b>for</b>=".">...&lt;/tpl>       // loop through array at root node
+&lt;tpl <b>for</b>="foo">...&lt;/tpl>     // loop through array at foo node
+&lt;tpl <b>for</b>="foo.bar">...&lt;/tpl> // loop through array at foo.bar node
+ * </code></pre>
+ * Using the sample data above:
  * <pre><code>
 var tpl = new Ext.XTemplate(
     '&lt;p>Kids: ',
-    '&lt;tpl for=".">',
-        '&lt;p>{name}&lt;/p>',
+    '&lt;tpl <b>for</b>=".">',       // process the data.kids node
+        '&lt;p>{#}. {name}&lt;/p>',  // use current array index to autonumber
     '&lt;/tpl>&lt;/p>'
 );
 tpl.overwrite(panel.body, data.kids); // pass the kids property of the data object
  * </code></pre>
- * <p><b>Scope switching</b><br/>The <tt>for</tt> property can be leveraged to access specified members
- * of the provided data object to populate the template:</p>
+ * <p>An example illustrating how the <b><tt>for</tt></b> property can be leveraged
+ * to access specified members of the provided data object to populate the template:</p>
  * <pre><code>
 var tpl = new Ext.XTemplate(
     '&lt;p>Name: {name}&lt;/p>',
     '&lt;p>Title: {title}&lt;/p>',
     '&lt;p>Company: {company}&lt;/p>',
     '&lt;p>Kids: ',
-    '&lt;tpl <b>for="kids"</b>>', // interrogate the kids property within the data
+    '&lt;tpl <b>for="kids"</b>>',     // interrogate the kids property within the data
         '&lt;p>{name}&lt;/p>',
     '&lt;/tpl>&lt;/p>'
 );
+tpl.overwrite(panel.body, data);  // pass the root node of the data object
+ * </code></pre>
+ * <p>Flat arrays that contain values (and not objects) can be auto-rendered
+ * using the special <b><tt>{.}</tt></b> variable inside a loop.  This variable
+ * will represent the value of the array at the current index:</p>
+ * <pre><code>
+var tpl = new Ext.XTemplate(
+    '&lt;p>{name}\&#39;s favorite beverages:&lt;/p>',
+    '&lt;tpl for="drinks">',
+       '&lt;div> - {.}&lt;/div>',
+    '&lt;/tpl>'
+);
 tpl.overwrite(panel.body, data);
  * </code></pre>
- * <p><b>Access to parent object from within sub-template scope</b><br/>When processing a sub-template, for example while
- * looping through a child array, you can access the parent object's members via the <tt>parent</tt> object:</p>
+ * <p>When processing a sub-template, for example while looping through a child array,
+ * you can access the parent object's members via the <b><tt>parent</tt></b> object:</p>
  * <pre><code>
 var tpl = new Ext.XTemplate(
     '&lt;p>Name: {name}&lt;/p>',
     '&lt;p>Kids: ',
     '&lt;tpl for="kids">',
-        '&lt;tpl if="age &amp;gt; 1">',  // <-- Note that the &gt; is encoded
+        '&lt;tpl if="age > 1">',
             '&lt;p>{name}&lt;/p>',
-            '&lt;p>Dad: {parent.name}&lt;/p>',
+            '&lt;p>Dad: {<b>parent</b>.name}&lt;/p>',
         '&lt;/tpl>',
     '&lt;/tpl>&lt;/p>'
 );
 tpl.overwrite(panel.body, data);
-</code></pre>
- * <p><b>Array item index and basic math support</b> <br/>While processing an array, the special variable <tt>{#}</tt>
- * will provide the current array index + 1 (starts at 1, not 0). Templates also support the basic math operators
- * + - * and / that can be applied directly on numeric data values:</p>
+ * </code></pre>
+ * </div>
+ * </li>
+ * 
+ * 
+ * <li><b><u>Conditional processing with basic comparison operators</u></b> 
+ * <div class="sub-desc">
+ * <p>The <b><tt>tpl</tt></b> tag and the <b><tt>if</tt></b> operator are used
+ * to provide conditional checks for deciding whether or not to render specific
+ * parts of the template. Notes:<div class="sub-desc"><ul>
+ * <li>Double quotes must be encoded if used within the conditional</li>
+ * <li>There is no <tt>else</tt> operator &mdash; if needed, two opposite
+ * <tt>if</tt> statements should be used.</li>
+ * </ul></div>
+ * <pre><code>
+&lt;tpl if="age &gt; 1 &amp;&amp; age &lt; 10">Child&lt;/tpl>
+&lt;tpl if="age >= 10 && age < 18">Teenager&lt;/tpl>
+&lt;tpl <b>if</b>="this.isGirl(name)">...&lt;/tpl>
+&lt;tpl <b>if</b>="id==\'download\'">...&lt;/tpl>
+&lt;tpl <b>if</b>="needsIcon">&lt;img src="{icon}" class="{iconCls}"/>&lt;/tpl>
+// no good:
+&lt;tpl if="name == "Jack"">Hello&lt;/tpl>
+// encode &#34; if it is part of the condition, e.g.
+&lt;tpl if="name == &#38;quot;Jack&#38;quot;">Hello&lt;/tpl>
+ * </code></pre>
+ * Using the sample data above:
  * <pre><code>
 var tpl = new Ext.XTemplate(
     '&lt;p>Name: {name}&lt;/p>',
     '&lt;p>Kids: ',
     '&lt;tpl for="kids">',
-        '&lt;tpl if="age &amp;gt; 1">',  // <-- Note that the &gt; is encoded
-            '&lt;p>{#}: {name}&lt;/p>',  // <-- Auto-number each item
-            '&lt;p>In 5 Years: {age+5}&lt;/p>',  // <-- Basic math
-            '&lt;p>Dad: {parent.name}&lt;/p>',
+        '&lt;tpl if="age > 1">',
+            '&lt;p>{name}&lt;/p>',
         '&lt;/tpl>',
     '&lt;/tpl>&lt;/p>'
 );
 tpl.overwrite(panel.body, data);
-</code></pre>
- * <p><b>Auto-rendering of flat arrays</b> <br/>Flat arrays that contain values (and not objects) can be auto-rendered
- * using the special <tt>{.}</tt> variable inside a loop.  This variable will represent the value of
- * the array at the current index:</p>
- * <pre><code>
-var tpl = new Ext.XTemplate(
-    '&lt;p>{name}\'s favorite beverages:&lt;/p>',
-    '&lt;tpl for="drinks">',
-       '&lt;div> - {.}&lt;/div>',
-    '&lt;/tpl>'
-);
-tpl.overwrite(panel.body, data);
-</code></pre>
- * <p><b>Basic conditional logic</b> <br/>Using the <tt>tpl</tt> tag and the <tt>if</tt>
- * operator you can provide conditional checks for deciding whether or not to render specific parts of the template.
- * Note that there is no <tt>else</tt> operator &mdash; if needed, you should use two opposite <tt>if</tt> statements.
- * Properly-encoded attributes are required as seen in the following example:</p>
+ * </code></pre>
+ * </div>
+ * </li>
+ * 
+ * 
+ * <li><b><u>Basic math support</u></b> 
+ * <div class="sub-desc">
+ * <p>The following basic math operators may be applied directly on numeric
+ * data values:</p><pre>
+ * + - * /
+ * </pre>
+ * For example:
  * <pre><code>
 var tpl = new Ext.XTemplate(
     '&lt;p>Name: {name}&lt;/p>',
     '&lt;p>Kids: ',
     '&lt;tpl for="kids">',
         '&lt;tpl if="age &amp;gt; 1">',  // <-- Note that the &gt; is encoded
-            '&lt;p>{name}&lt;/p>',
+            '&lt;p>{#}: {name}&lt;/p>',  // <-- Auto-number each item
+            '&lt;p>In 5 Years: {age+5}&lt;/p>',  // <-- Basic math
+            '&lt;p>Dad: {parent.name}&lt;/p>',
         '&lt;/tpl>',
     '&lt;/tpl>&lt;/p>'
 );
 tpl.overwrite(panel.body, data);
 </code></pre>
- * <p><b>Ability to execute arbitrary inline code</b> <br/>In an XTemplate, anything between {[ ... ]}  is considered
- * code to be executed in the scope of the template. There are some special variables available in that code:
+ * </div>
+ * </li>
+ *
+ * 
+ * <li><b><u>Execute arbitrary inline code with special built-in template variables</u></b> 
+ * <div class="sub-desc">
+ * <p>Anything between <code>{[ ... ]}</code> is considered code to be executed
+ * in the scope of the template. There are some special variables available in that code:
  * <ul>
- * <li><b><tt>values</tt></b>: The values in the current scope. If you are using scope changing sub-templates, you
- * can change what <tt>values</tt> is.</li>
+ * <li><b><tt>values</tt></b>: The values in the current scope. If you are using
+ * scope changing sub-templates, you can change what <tt>values</tt> is.</li>
  * <li><b><tt>parent</tt></b>: The scope (values) of the ancestor template.</li>
- * <li><b><tt>xindex</tt></b>: If you are in a looping template, the index of the loop you are in (1-based).</li>
- * <li><b><tt>xcount</tt></b>: If you are in a looping template, the total length of the array you are looping.</li>
+ * <li><b><tt>xindex</tt></b>: If you are in a looping template, the index of the
+ * loop you are in (1-based).</li>
+ * <li><b><tt>xcount</tt></b>: If you are in a looping template, the total length
+ * of the array you are looping.</li>
  * <li><b><tt>fm</tt></b>: An alias for <tt>Ext.util.Format</tt>.</li>
  * </ul>
- * This example demonstrates basic row striping using an inline code block and the <tt>xindex</tt> variable:</p>
+ * This example demonstrates basic row striping using an inline code block and the
+ * <tt>xindex</tt> variable:</p>
  * <pre><code>
 var tpl = new Ext.XTemplate(
     '&lt;p>Name: {name}&lt;/p>',
@@ -12159,8 +12869,13 @@ var tpl = new Ext.XTemplate(
     '&lt;/tpl>&lt;/p>'
 );
 tpl.overwrite(panel.body, data);
-</code></pre>
- * <p><b>Template member functions</b> <br/>One or more member functions can be defined directly on the config
+ * </code></pre>
+ * </div>
+ * </li>
+ * 
+ * <li><b><u>Template member functions</u></b> 
+ * <div class="sub-desc">
+ * <p>One or more member functions can be specified in a configuration
  * object passed into the XTemplate constructor for more complex processing:</p>
  * <pre><code>
 var tpl = new Ext.XTemplate(
@@ -12170,25 +12885,35 @@ var tpl = new Ext.XTemplate(
         '&lt;tpl if="this.isGirl(name)">',
             '&lt;p>Girl: {name} - {age}&lt;/p>',
         '&lt;/tpl>',
+        // use opposite if statement to simulate 'else' processing:
         '&lt;tpl if="this.isGirl(name) == false">',
             '&lt;p>Boy: {name} - {age}&lt;/p>',
         '&lt;/tpl>',
         '&lt;tpl if="this.isBaby(age)">',
             '&lt;p>{name} is a baby!&lt;/p>',
         '&lt;/tpl>',
-    '&lt;/tpl>&lt;/p>', {
-     isGirl: function(name){
-         return name == 'Sara Grace';
-     },
-     isBaby: function(age){
-        return age < 1;
-     }
-});
+    '&lt;/tpl>&lt;/p>',
+    {
+        // XTemplate configuration:
+        compiled: true,
+        disableFormats: true,
+        // member functions:
+        isGirl: function(name){
+            return name == 'Sara Grace';
+        },
+        isBaby: function(age){
+            return age < 1;
+        }
+    }
+);
 tpl.overwrite(panel.body, data);
-</code></pre>
- * @constructor
- * @param {String/Array/Object} parts The HTML fragment or an array of fragments to join(""), or multiple arguments
- * to join("") that can also include a config object
+ * </code></pre>
+ * </div>
+ * </li>
+ * 
+ * </ul></div>
+ * 
+ * @param {Mixed} config
  */
 Ext.XTemplate = function(){
     Ext.XTemplate.superclass.constructor.apply(this, arguments);
@@ -12323,7 +13048,8 @@ Ext.extend(Ext.XTemplate, Ext.Template, {
         }
 
         function codeFn(m, code){
-            return "'"+ sep +'('+code+')'+sep+"'";
+            // Single quotes get escaped when the template is compiled, however we want to undo this when running code.
+            return "'" + sep + '(' + code.replace(/\\'/g, "'") + ')' + sep + "'";
         }
 
         // branched to use + in gecko and [].join() in others
@@ -12476,7 +13202,7 @@ Ext.util.CSS = function(){
        try{// try catch for cross domain access issue\r
            var ssRules = ss.cssRules || ss.rules;\r
            for(var j = ssRules.length-1; j >= 0; --j){\r
-               rules[ssRules[j].selectorText] = ssRules[j];\r
+               rules[ssRules[j].selectorText.toLowerCase()] = ssRules[j];\r
            }\r
        }catch(e){}\r
    },\r
@@ -12508,11 +13234,11 @@ Ext.util.CSS = function(){
    getRule : function(selector, refreshCache){\r
                var rs = this.getRules(refreshCache);\r
                if(!Ext.isArray(selector)){\r
-                   return rs[selector];\r
+                   return rs[selector.toLowerCase()];\r
                }\r
                for(var i = 0; i < selector.length; i++){\r
                        if(rs[selector[i]]){\r
-                               return rs[selector[i]];\r
+                               return rs[selector[i].toLowerCase()];\r
                        }\r
                }\r
                return null;\r
@@ -12791,15 +13517,6 @@ Ext.KeyNav.prototype = {
      */
     forceKeyDown : false,
 
-    // private
-    prepareEvent : function(e){
-        var k = e.getKey();
-        var h = this.keyToHandler[k];
-        if(Ext.isSafari2 && h && k >= 37 && k <= 40){
-            e.stopEvent();
-        }
-    },
-
     // private
     relay : function(e){
         var k = e.getKey();
@@ -12845,38 +13562,53 @@ Ext.KeyNav.prototype = {
         27 : "esc",
         9  : "tab"
     },
+    
+    stopKeyUp: function(e) {
+        var k = e.getKey();
+
+        if (k >= 37 && k <= 40) {
+            // *** bugfix - safari 2.x fires 2 keyup events on cursor keys
+            // *** (note: this bugfix sacrifices the "keyup" event originating from keyNav elements in Safari 2)
+            e.stopEvent();
+        }
+    },
+    
+    /**
+     * Destroy this KeyNav (this is the same as calling disable).
+     */
+    destroy: function(){
+        this.disable();    
+    },
 
        /**
         * Enable this KeyNav
         */
-       enable: function(){
-               if(this.disabled){
-            // ie won't do special keys on keypress, no one else will repeat keys with keydown
-            // the EventObject will normalize Safari automatically
-            if(this.isKeydown()){
-                this.el.on("keydown", this.relay,  this);
-            }else{
-                this.el.on("keydown", this.prepareEvent,  this);
-                this.el.on("keypress", this.relay,  this);
+       enable: function() {
+        if (this.disabled) {
+            if (Ext.isSafari2) {
+                // call stopKeyUp() on "keyup" event
+                this.el.on('keyup', this.stopKeyUp, this);
             }
-                   this.disabled = false;
-               }
-       },
+
+            this.el.on(this.isKeydown()? 'keydown' : 'keypress', this.relay, this);
+            this.disabled = false;
+        }
+    },
 
        /**
         * Disable this KeyNav
         */
-       disable: function(){
-               if(!this.disabled){
-                   if(this.isKeydown()){
-                this.el.un("keydown", this.relay, this);
-            }else{
-                this.el.un("keydown", this.prepareEvent, this);
-                this.el.un("keypress", this.relay, this);
+       disable: function() {
+        if (!this.disabled) {
+            if (Ext.isSafari2) {
+                // remove "keyup" event handler
+                this.el.un('keyup', this.stopKeyUp, this);
             }
-                   this.disabled = true;
-               }
-       },
+
+            this.el.un(this.isKeydown()? 'keydown' : 'keypress', this.relay, this);
+            this.disabled = true;
+        }
+    },
     
     /**
      * Convenience function for setting disabled/enabled by boolean.
@@ -13059,7 +13791,7 @@ map.addBinding({
      * following options:\r
      * {key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}\r
      * @param {Function} fn The function to call\r
-     * @param {Object} scope (optional) The scope of the function\r
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to the browser window.\r
      */\r
     on : function(key, fn, scope){\r
         var keyCode, shift, ctrl, alt;\r
@@ -13181,6 +13913,7 @@ Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
 
     var instance = {
         /**
+         * <p><b>Only available on the instance returned from {@link #createInstance}, <u>not</u> on the singleton.</b></p>
          * Returns the size of the specified text based on the internal element's style and width properties
          * @param {String} text The text to measure
          * @return {Object} An object containing the text's size {width: (width), height: (height)}
@@ -13193,6 +13926,7 @@ Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
         },
 
         /**
+         * <p><b>Only available on the instance returned from {@link #createInstance}, <u>not</u> on the singleton.</b></p>
          * Binds this TextMetrics instance to an element from which to copy existing CSS styles
          * that can affect the size of the rendered text
          * @param {String/HTMLElement} el The element, dom node or id
@@ -13204,6 +13938,7 @@ Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
         },
 
         /**
+         * <p><b>Only available on the instance returned from {@link #createInstance}, <u>not</u> on the singleton.</b></p>
          * Sets a fixed width on the internal measurement element.  If the text will be multiline, you have
          * to set a fixed width in order to accurately measure the text height.
          * @param {Number} width The width to set on the element
@@ -13213,6 +13948,7 @@ Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
         },
 
         /**
+         * <p><b>Only available on the instance returned from {@link #createInstance}, <u>not</u> on the singleton.</b></p>
          * Returns the measured width of the specified text
          * @param {String} text The text to measure
          * @return {Number} width The width in pixels
@@ -13223,6 +13959,7 @@ Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
         },
 
         /**
+         * <p><b>Only available on the instance returned from {@link #createInstance}, <u>not</u> on the singleton.</b></p>
          * Returns the measured height of the specified text.  For multiline text, be sure to call
          * {@link #setFixedWidth} if necessary.
          * @param {String} text The text to measure
@@ -13261,8 +13998,8 @@ Ext.util.Cookies = {
      * Create a cookie with the specified name and value. Additional settings\r
      * for the cookie may be optionally specified (for example: expiration,\r
      * access restriction, SSL).\r
-     * @param {Object} name\r
-     * @param {Object} value\r
+     * @param {String} name The name of the cookie to set. \r
+     * @param {Mixed} value The value to set for the cookie.\r
      * @param {Object} expires (Optional) Specify an expiration date the\r
      * cookie is to persist until.  Note that the specified Date object will\r
      * be converted to Greenwich Mean Time (GMT). \r
@@ -13297,7 +14034,7 @@ Ext.util.Cookies = {
      * <pre><code>\r
      * var validStatus = Ext.util.Cookies.get("valid");\r
      * </code></pre>\r
-     * @param {Object} name The name of the cookie to get\r
+     * @param {String} name The name of the cookie to get\r
      * @return {Mixed} Returns the cookie value for the specified name;\r
      * null if the cookie name does not exist.\r
      */\r
@@ -13322,8 +14059,8 @@ Ext.util.Cookies = {
 \r
     /**\r
      * Removes a cookie with the provided name from the browser\r
-     * if found.\r
-     * @param {Object} name The name of the cookie to remove\r
+     * if found by setting its expiration date to sometime in the past. \r
+     * @param {String} name The name of the cookie to remove\r
      */\r
     clear : function(name){\r
         if(Ext.util.Cookies.get(name)){\r