Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / ext-all-debug.js
index 072ce1c..0f649b5 100644 (file)
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
+/*!
+ * Ext JS Library 3.0.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
  */\r
+Ext.apply(Ext.DomHelper,\r
+function(){\r
+       var pub,\r
+               afterbegin = 'afterbegin',\r
+       afterend = 'afterend',\r
+       beforebegin = 'beforebegin',\r
+       beforeend = 'beforeend';\r
 \r
-\r
-Ext.DomHelper = function(){\r
-    var tempTableEl = null;\r
-    var emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;\r
-    var tableRe = /^table|tbody|tr|td$/i;\r
-\r
-    // build as innerHTML where available\r
-    var createHtml = function(o){\r
-        if(typeof o == 'string'){\r
-            return o;\r
-        }\r
-        var b = "";\r
-        if (Ext.isArray(o)) {\r
-            for (var i = 0, l = o.length; i < l; i++) {\r
-                b += createHtml(o[i]);\r
-            }\r
-            return b;\r
-        }\r
-        if(!o.tag){\r
-            o.tag = "div";\r
-        }\r
-        b += "<" + o.tag;\r
-        for(var attr in o){\r
-            if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || typeof o[attr] == "function") continue;\r
-            if(attr == "style"){\r
-                var s = o["style"];\r
-                if(typeof s == "function"){\r
-                    s = s.call();\r
-                }\r
-                if(typeof s == "string"){\r
-                    b += ' style="' + s + '"';\r
-                }else if(typeof s == "object"){\r
-                    b += ' style="';\r
-                    for(var key in s){\r
-                        if(typeof s[key] != "function"){\r
-                            b += key + ":" + s[key] + ";";\r
-                        }\r
-                    }\r
-                    b += '"';\r
-                }\r
-            }else{\r
-                if(attr == "cls"){\r
-                    b += ' class="' + o["cls"] + '"';\r
-                }else if(attr == "htmlFor"){\r
-                    b += ' for="' + o["htmlFor"] + '"';\r
-                }else{\r
-                    b += " " + attr + '="' + o[attr] + '"';\r
-                }\r
-            }\r
-        }\r
-        if(emptyTags.test(o.tag)){\r
-            b += "/>";\r
-        }else{\r
-            b += ">";\r
-            var cn = o.children || o.cn;\r
-            if(cn){\r
-                b += createHtml(cn);\r
-            } else if(o.html){\r
-                b += o.html;\r
+       // private\r
+    function doInsert(el, o, returnElement, pos, sibling, append){\r
+        el = Ext.getDom(el);\r
+        var newNode;\r
+        if (pub.useDom) {\r
+            newNode = createDom(o, null);\r
+            if (append) {\r
+                   el.appendChild(newNode);\r
+            } else {\r
+                       (sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);\r
             }\r
-            b += "</" + o.tag + ">";\r
+        } else {\r
+            newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));\r
         }\r
-        return b;\r
-    };\r
+        return returnElement ? Ext.get(newNode, true) : newNode;\r
+    }\r
+\r
+       // build as dom\r
+    /** @ignore */\r
+    function createDom(o, parentNode){\r
+        var el,\r
+               doc = document,\r
+               useSet,\r
+               attr,\r
+               val,\r
+               cn;\r
 \r
-    // build as dom\r
-    \r
-    var createDom = function(o, parentNode){\r
-        var el;\r
         if (Ext.isArray(o)) {                       // Allow Arrays of siblings to be inserted\r
-            el = document.createDocumentFragment(); // in one shot using a DocumentFragment\r
-            for(var i = 0, l = o.length; i < l; i++) {\r
-                createDom(o[i], el);\r
-            }\r
-        } else if (typeof o == "string") {         // Allow a string as a child spec.\r
-            el = document.createTextNode(o);\r
+            el = doc.createDocumentFragment(); // in one shot using a DocumentFragment\r
+               Ext.each(o, function(v) {\r
+                createDom(v, el);\r
+            });\r
+        } else if (Ext.isString(o)) {         // Allow a string as a child spec.\r
+            el = doc.createTextNode(o);\r
         } else {\r
-            el = document.createElement(o.tag||'div');\r
-            var useSet = !!el.setAttribute; // In IE some elements don't have setAttribute\r
-            for(var attr in o){\r
-                if(attr == "tag" || attr == "children" || attr == "cn" || attr == "html" || attr == "style" || typeof o[attr] == "function") continue;\r
-                if(attr=="cls"){\r
-                    el.className = o["cls"];\r
-                }else{\r
-                    if(useSet) el.setAttribute(attr, o[attr]);\r
-                    else el[attr] = o[attr];\r
+            el = doc.createElement( o.tag || 'div' );\r
+            useSet = !!el.setAttribute; // In IE some elements don't have setAttribute\r
+            Ext.iterate(o, function(attr, val){\r
+                if(!/tag|children|cn|html|style/.test(attr)){\r
+                       if(attr == 'cls'){\r
+                           el.className = val;\r
+                       }else{\r
+                        if(useSet){\r
+                            el.setAttribute(attr, val);\r
+                        }else{\r
+                            el[attr] = val;\r
+                        }\r
+                       }\r
                 }\r
-            }\r
-            Ext.DomHelper.applyStyles(el, o.style);\r
-            var cn = o.children || o.cn;\r
-            if(cn){\r
+            });\r
+            pub.applyStyles(el, o.style);\r
+\r
+            if ((cn = o.children || o.cn)) {\r
                 createDom(cn, el);\r
-            } else if(o.html){\r
+            } else if (o.html) {\r
                 el.innerHTML = o.html;\r
             }\r
         }\r
@@ -106,275 +448,308 @@ Ext.DomHelper = function(){
            parentNode.appendChild(el);\r
         }\r
         return el;\r
-    };\r
-\r
-    var ieTable = function(depth, s, h, e){\r
-        tempTableEl.innerHTML = [s, h, e].join('');\r
-        var i = -1, el = tempTableEl;\r
-        while(++i < depth){\r
-            el = el.firstChild;\r
-        }\r
-        return el;\r
-    };\r
-\r
-    // kill repeat to save bytes\r
-    var ts = '<table>',\r
-        te = '</table>',\r
-        tbs = ts+'<tbody>',\r
-        tbe = '</tbody>'+te,\r
-        trs = tbs + '<tr>',\r
-        tre = '</tr>'+tbe;\r
-\r
-    \r
-    var insertIntoTable = function(tag, where, el, html){\r
-        if(!tempTableEl){\r
-            tempTableEl = document.createElement('div');\r
-        }\r
-        var node;\r
-        var before = null;\r
-        if(tag == 'td'){\r
-            if(where == 'afterbegin' || where == 'beforeend'){ // INTO a TD\r
-                return;\r
-            }\r
-            if(where == 'beforebegin'){\r
-                before = el;\r
-                el = el.parentNode;\r
-            } else{\r
-                before = el.nextSibling;\r
-                el = el.parentNode;\r
-            }\r
-            node = ieTable(4, trs, html, tre);\r
-        }\r
-        else if(tag == 'tr'){\r
-            if(where == 'beforebegin'){\r
-                before = el;\r
-                el = el.parentNode;\r
-                node = ieTable(3, tbs, html, tbe);\r
-            } else if(where == 'afterend'){\r
-                before = el.nextSibling;\r
-                el = el.parentNode;\r
-                node = ieTable(3, tbs, html, tbe);\r
-            } else{ // INTO a TR\r
-                if(where == 'afterbegin'){\r
-                    before = el.firstChild;\r
-                }\r
-                node = ieTable(4, trs, html, tre);\r
-            }\r
-        } else if(tag == 'tbody'){\r
-            if(where == 'beforebegin'){\r
-                before = el;\r
-                el = el.parentNode;\r
-                node = ieTable(2, ts, html, te);\r
-            } else if(where == 'afterend'){\r
-                before = el.nextSibling;\r
-                el = el.parentNode;\r
-                node = ieTable(2, ts, html, te);\r
-            } else{\r
-                if(where == 'afterbegin'){\r
-                    before = el.firstChild;\r
-                }\r
-                node = ieTable(3, tbs, html, tbe);\r
-            }\r
-        } else{ // TABLE\r
-            if(where == 'beforebegin' || where == 'afterend'){ // OUTSIDE the table\r
-                return;\r
-            }\r
-            if(where == 'afterbegin'){\r
-                before = el.firstChild;\r
-            }\r
-            node = ieTable(2, ts, html, te);\r
-        }\r
-        el.insertBefore(node, before);\r
-        return node;\r
-    };\r
-\r
-\r
-    return {\r
-    \r
-    useDom : false,\r
-\r
-    \r
-    markup : function(o){\r
-        return createHtml(o);\r
-    },\r
-\r
-    \r
-    applyStyles : function(el, styles){\r
-        if(styles){\r
-           el = Ext.fly(el);\r
-           if(typeof styles == "string"){\r
-               var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi;\r
-               var matches;\r
-               while ((matches = re.exec(styles)) != null){\r
-                   el.setStyle(matches[1], matches[2]);\r
-               }\r
-           }else if (typeof styles == "object"){\r
-               for (var style in styles){\r
-                  el.setStyle(style, styles[style]);\r
-               }\r
-           }else if (typeof styles == "function"){\r
-                Ext.DomHelper.applyStyles(el, styles.call());\r
-           }\r
-        }\r
-    },\r
-\r
-    \r
-    insertHtml : function(where, el, html){\r
-        where = where.toLowerCase();\r
-        if(el.insertAdjacentHTML){\r
-            if(tableRe.test(el.tagName)){\r
-                var rs;\r
-                if(rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html)){\r
-                    return rs;\r
-                }\r
-            }\r
-            switch(where){\r
-                case "beforebegin":\r
-                    el.insertAdjacentHTML('BeforeBegin', html);\r
-                    return el.previousSibling;\r
-                case "afterbegin":\r
-                    el.insertAdjacentHTML('AfterBegin', html);\r
-                    return el.firstChild;\r
-                case "beforeend":\r
-                    el.insertAdjacentHTML('BeforeEnd', html);\r
-                    return el.lastChild;\r
-                case "afterend":\r
-                    el.insertAdjacentHTML('AfterEnd', html);\r
-                    return el.nextSibling;\r
-            }\r
-            throw 'Illegal insertion point -> "' + where + '"';\r
-        }\r
-        var range = el.ownerDocument.createRange();\r
-        var frag;\r
-        switch(where){\r
-             case "beforebegin":\r
-                range.setStartBefore(el);\r
-                frag = range.createContextualFragment(html);\r
-                el.parentNode.insertBefore(frag, el);\r
-                return el.previousSibling;\r
-             case "afterbegin":\r
-                if(el.firstChild){\r
-                    range.setStartBefore(el.firstChild);\r
-                    frag = range.createContextualFragment(html);\r
-                    el.insertBefore(frag, el.firstChild);\r
-                    return el.firstChild;\r
-                }else{\r
-                    el.innerHTML = html;\r
-                    return el.firstChild;\r
-                }\r
-            case "beforeend":\r
-                if(el.lastChild){\r
-                    range.setStartAfter(el.lastChild);\r
-                    frag = range.createContextualFragment(html);\r
-                    el.appendChild(frag);\r
-                    return el.lastChild;\r
-                }else{\r
-                    el.innerHTML = html;\r
-                    return el.lastChild;\r
-                }\r
-            case "afterend":\r
-                range.setStartAfter(el);\r
-                frag = range.createContextualFragment(html);\r
-                el.parentNode.insertBefore(frag, el.nextSibling);\r
-                return el.nextSibling;\r
-            }\r
-            throw 'Illegal insertion point -> "' + where + '"';\r
-    },\r
-\r
-    \r
-    insertBefore : function(el, o, returnElement){\r
-        return this.doInsert(el, o, returnElement, "beforeBegin");\r
-    },\r
-\r
-    \r
-    insertAfter : function(el, o, returnElement){\r
-        return this.doInsert(el, o, returnElement, "afterEnd", "nextSibling");\r
-    },\r
-\r
-    \r
-    insertFirst : function(el, o, returnElement){\r
-        return this.doInsert(el, o, returnElement, "afterBegin", "firstChild");\r
-    },\r
-\r
-    // private\r
-    doInsert : function(el, o, returnElement, pos, sibling){\r
-        el = Ext.getDom(el);\r
-        var newNode;\r
-        if(this.useDom){\r
-            newNode = createDom(o, null);\r
-            (sibling === "firstChild" ? el : el.parentNode).insertBefore(newNode, sibling ? el[sibling] : el);\r
-        }else{\r
-            var html = createHtml(o);\r
-            newNode = this.insertHtml(pos, el, html);\r
-        }\r
-        return returnElement ? Ext.get(newNode, true) : newNode;\r
-    },\r
-\r
-    \r
-    append : function(el, o, returnElement){\r
-        el = Ext.getDom(el);\r
-        var newNode;\r
-        if(this.useDom){\r
-            newNode = createDom(o, null);\r
-            el.appendChild(newNode);\r
-        }else{\r
-            var html = createHtml(o);\r
-            newNode = this.insertHtml("beforeEnd", el, html);\r
-        }\r
-        return returnElement ? Ext.get(newNode, true) : newNode;\r
-    },\r
-\r
-    \r
-    overwrite : function(el, o, returnElement){\r
-        el = Ext.getDom(el);\r
-        el.innerHTML = createHtml(o);\r
-        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;\r
-    },\r
-\r
-    \r
-    createTemplate : function(o){\r
-        var html = createHtml(o);\r
-        return new Ext.Template(html);\r
     }\r
-    };\r
-}();\r
 \r
+       pub = {\r
+               /**\r
+            * Creates a new Ext.Template from the DOM object spec.\r
+            * @param {Object} o The DOM object spec (and children)\r
+            * @return {Ext.Template} The new template\r
+            */\r
+           createTemplate : function(o){\r
+               var html = Ext.DomHelper.createHtml(o);\r
+               return new Ext.Template(html);\r
+           },\r
+\r
+               /** 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
+            * @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
+         * @hide (repeat)\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
+         * @hide (repeat)\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
+         * @hide (repeat)\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
+         * @hide (repeat)\r
+            */\r
+           append: function(el, o, returnElement){\r
+            return doInsert(el, o, returnElement, beforeend, '', true);\r
+        },\r
 \r
-Ext.Template = function(html){\r
-    var a = arguments;\r
-    if(Ext.isArray(html)){\r
-        html = html.join("");\r
-    }else if(a.length > 1){\r
-        var buf = [];\r
-        for(var i = 0, len = a.length; i < len; i++){\r
-            if(typeof a[i] == 'object'){\r
-                Ext.apply(this, a[i]);\r
-            }else{\r
-                buf[buf.length] = a[i];\r
-            }\r
-        }\r
-        html = buf.join('');\r
-    }\r
-    \r
-    this.html = html;\r
-    if(this.compiled){\r
-        this.compile();\r
-    }\r
-};\r
-Ext.Template.prototype = {\r
-    \r
+           /**\r
+            * Creates new DOM element(s) without inserting them to the document.\r
+            * @param {Object/String} o The DOM object spec (and children) or raw HTML blob\r
+            * @return {HTMLElement} The new uninserted node\r
+            */\r
+        createDom: createDom\r
+       };\r
+       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:
+<pre><code>
+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'});
+</code></pre>
+ * @constructor
+ * @param {String/Array} html The HTML fragment or an array of fragments to join("") or multiple arguments to join("")
+ */
+Ext.Template = function(html){
+    var me = this,
+       a = arguments,
+       buf = [];
+
+    if (Ext.isArray(html)) {
+        html = html.join("");
+    } else if (a.length > 1) {
+           Ext.each(a, function(v) {
+            if (Ext.isObject(v)) {
+                Ext.apply(me, v);
+            } else {
+                buf.push(v);
+            }
+        });
+        html = buf.join('');
+    }
+
+    /**@private*/
+    me.html = html;
+    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'})
+     * @return {String} The HTML fragment
+     */
+    applyTemplate : function(values){
+               var me = this;
+
+        return me.compiled ?
+                       me.compiled(values) :
+                               me.html.replace(me.re, function(m, name){
+                               return values[name] !== undefined ? values[name] : "";
+                       });
+       },
+
+    /**
+     * Sets the HTML used as the template and optionally compiles it.
+     * @param {String} html
+     * @param {Boolean} compile (optional) True to compile the template (defaults to undefined)
+     * @return {Ext.Template} this
+     */
+    set : function(html, compile){
+           var me = this;
+        me.html = html;
+        me.compiled = null;
+        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
+     */
+    compile : function(){
+        var me = this,
+               sep = Ext.isGecko ? "+" : ",";
+
+        function fn(m, name){                        
+               name = "values['" + name + "']";
+               return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
+        }
+                
+        eval("this.compiled = function(values){ return " + (Ext.isGecko ? "'" : "['") +
+             me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
+             (Ext.isGecko ?  "';};" : "'].join('');};"));
+        return me;
+    },
+
+    /**
+     * Applies the supplied values to the template and inserts the new node(s) as the first child of el.
+     * @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)
+     * @return {HTMLElement/Ext.Element} The new node or Element
+     */
+    insertFirst: function(el, values, returnElement){
+        return this.doInsert('afterBegin', el, values, returnElement);
+    },
+
+    /**
+     * Applies the supplied values to the template and inserts the new node(s) before el.
+     * @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)
+     * @return {HTMLElement/Ext.Element} The new node or Element
+     */
+    insertBefore: function(el, values, returnElement){
+        return this.doInsert('beforeBegin', el, values, returnElement);
+    },
+
+    /**
+     * Applies the supplied values to the template and inserts the new node(s) after el.
+     * @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)
+     * @return {HTMLElement/Ext.Element} The new node or Element
+     */
+    insertAfter : function(el, values, returnElement){
+        return this.doInsert('afterEnd', el, values, returnElement);
+    },
+
+    /**
+     * Applies the supplied values to the template and appends the new node(s) to el.
+     * @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)
+     * @return {HTMLElement/Ext.Element} The new node or Element
+     */
+    append : function(el, values, returnElement){
+        return this.doInsert('beforeEnd', el, values, returnElement);
+    },
+
+    doInsert : function(where, el, values, returnEl){
+        el = Ext.getDom(el);
+        var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
+        return returnEl ? Ext.get(newNode, true) : newNode;
+    },
+
+    /**
+     * Applies the supplied values to the template and overwrites the content of el with the new node(s).
+     * @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)
+     * @return {HTMLElement/Ext.Element} The new node or Element
+     */
+    overwrite : function(el, values, returnElement){
+        el = Ext.getDom(el);
+        el.innerHTML = this.applyTemplate(values);
+        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
+    }
+};
+/**
+ * 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'})
+ * @return {String} The HTML fragment
+ * @member Ext.Template
+ * @method apply
+ */
+Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
+
+/**
+ * Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
+ * @param {String/HTMLElement} el A DOM element or its id
+ * @param {Object} config A configuration object
+ * @return {Ext.Template} The created template
+ * @static
+ */
+Ext.Template.from = function(el, config){
+    el = Ext.getDom(el);
+    return new Ext.Template(el.value || el.innerHTML, config || '');
+};/**\r
+ * @class Ext.Template\r
+ */\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
+     */\r
     applyTemplate : function(values){\r
-        if(this.compiled){\r
-            return this.compiled(values);\r
-        }\r
-        var useF = this.disableFormats !== true;\r
-        var fm = Ext.util.Format, tpl = this;\r
-        var fn = function(m, name, format, args){\r
-            if(format && useF){\r
-                if(format.substr(0, 5) == "this."){\r
+               var me = this,\r
+                       useF = me.disableFormats !== true,\r
+               fm = Ext.util.Format, \r
+               tpl = me;           \r
+           \r
+        if(me.compiled){\r
+            return me.compiled(values);\r
+        }\r
+        function fn(m, name, format, args){\r
+            if (format && useF) {\r
+                if (format.substr(0, 5) == "this.") {\r
                     return tpl.call(format.substr(5), values[name], values);\r
-                }else{\r
-                    if(args){\r
+                } else {\r
+                    if (args) {\r
                         // quoted values are required for strings in compiled templates,\r
                         // but for non compiled we need to strip them\r
                         // quoted reversed for jsmin\r
@@ -384,40 +759,46 @@ Ext.Template.prototype = {
                             args[i] = args[i].replace(re, "$1");\r
                         }\r
                         args = [values[name]].concat(args);\r
-                    }else{\r
+                    } else {\r
                         args = [values[name]];\r
                     }\r
                     return fm[format].apply(fm, args);\r
                 }\r
-            }else{\r
+            } else {\r
                 return values[name] !== undefined ? values[name] : "";\r
             }\r
-        };\r
-        return this.html.replace(this.re, fn);\r
-    },\r
-\r
-    \r
-    set : function(html, compile){\r
-        this.html = html;\r
-        this.compiled = null;\r
-        if(compile){\r
-            this.compile();\r
         }\r
-        return this;\r
+        return me.html.replace(me.re, fn);\r
     },\r
-\r
-    \r
-    disableFormats : false,\r
-\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
+    /**\r
+     * Compiles the template into an internal function, eliminating the RegEx overhead.\r
+     * @return {Ext.Template} this\r
+     * @hide repeat doc\r
+     */\r
     compile : function(){\r
-        var fm = Ext.util.Format;\r
-        var useF = this.disableFormats !== true;\r
-        var sep = Ext.isGecko ? "+" : ",";\r
-        var fn = function(m, name, format, args){\r
+        var me = this,\r
+               fm = Ext.util.Format,\r
+               useF = me.disableFormats !== true,\r
+               sep = Ext.isGecko ? "+" : ",",\r
+               body;\r
+        \r
+        function fn(m, name, format, args){\r
             if(format && useF){\r
                 args = args ? ',' + args : "";\r
                 if(format.substr(0, 5) != "this."){\r
@@ -430,86 +811,118 @@ Ext.Template.prototype = {
                 args= ''; format = "(values['" + name + "'] == undefined ? '' : ";\r
             }\r
             return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";\r
-        };\r
-        var body;\r
+        }\r
+        \r
         // branched to use + in gecko and [].join() in others\r
         if(Ext.isGecko){\r
             body = "this.compiled = function(values){ return '" +\r
-                   this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +\r
+                   me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +\r
                     "';};";\r
         }else{\r
             body = ["this.compiled = function(values){ return ['"];\r
-            body.push(this.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));\r
+            body.push(me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn));\r
             body.push("'].join('');};");\r
             body = body.join('');\r
         }\r
         eval(body);\r
-        return this;\r
+        return me;\r
     },\r
-\r
+    \r
     // private function used to call members\r
     call : function(fnName, value, allValues){\r
         return this[fnName](value, allValues);\r
-    },\r
-\r
-    \r
-    insertFirst: function(el, values, returnElement){\r
-        return this.doInsert('afterBegin', el, values, returnElement);\r
-    },\r
-\r
-    \r
-    insertBefore: function(el, values, returnElement){\r
-        return this.doInsert('beforeBegin', el, values, returnElement);\r
-    },\r
-\r
-    \r
-    insertAfter : function(el, values, returnElement){\r
-        return this.doInsert('afterEnd', el, values, returnElement);\r
-    },\r
-\r
-    \r
-    append : function(el, values, returnElement){\r
-        return this.doInsert('beforeEnd', el, values, returnElement);\r
-    },\r
-\r
-    doInsert : function(where, el, values, returnEl){\r
-        el = Ext.getDom(el);\r
-        var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));\r
-        return returnEl ? Ext.get(newNode, true) : newNode;\r
-    },\r
-\r
-    \r
-    overwrite : function(el, values, returnElement){\r
-        el = Ext.getDom(el);\r
-        el.innerHTML = this.applyTemplate(values);\r
-        return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;\r
     }\r
-};\r
-\r
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;\r
-\r
-// backwards compat\r
-Ext.DomHelper.Template = Ext.Template;\r
-\r
-\r
-Ext.Template.from = function(el, config){\r
-    el = Ext.getDom(el);\r
-    return new Ext.Template(el.value || el.innerHTML, config || '');\r
-};\r
-\r
-\r
+});\r
+Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; /*\r
+ * This is code is also distributed under MIT license for use\r
+ * with jQuery and prototype JavaScript libraries.\r
+ */\r
+/**\r
+ * @class Ext.DomQuery\r
+Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).\r
+<p>\r
+DomQuery supports most of the <a href="http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#selectors">CSS3 selectors spec</a>, along with some custom selectors and basic XPath.</p>\r
+\r
+<p>\r
+All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example "div.foo:nth-child(odd)[@foo=bar].bar:first" would be a perfectly valid selector. Node filters are processed in the order in which they appear, which allows you to optimize your queries for your document structure.\r
+</p>\r
+<h4>Element Selectors:</h4>\r
+<ul class="list">\r
+    <li> <b>*</b> any element</li>\r
+    <li> <b>E</b> an element with the tag E</li>\r
+    <li> <b>E F</b> All descendent elements of E that have the tag F</li>\r
+    <li> <b>E > F</b> or <b>E/F</b> all direct children elements of E that have the tag F</li>\r
+    <li> <b>E + F</b> all elements with the tag F that are immediately preceded by an element with the tag E</li>\r
+    <li> <b>E ~ F</b> all elements with the tag F that are preceded by a sibling element with the tag E</li>\r
+</ul>\r
+<h4>Attribute Selectors:</h4>\r
+<p>The use of &#64; and quotes are optional. For example, div[&#64;foo='bar'] is also a valid attribute selector.</p>\r
+<ul class="list">\r
+    <li> <b>E[foo]</b> has an attribute "foo"</li>\r
+    <li> <b>E[foo=bar]</b> has an attribute "foo" that equals "bar"</li>\r
+    <li> <b>E[foo^=bar]</b> has an attribute "foo" that starts with "bar"</li>\r
+    <li> <b>E[foo$=bar]</b> has an attribute "foo" that ends with "bar"</li>\r
+    <li> <b>E[foo*=bar]</b> has an attribute "foo" that contains the substring "bar"</li>\r
+    <li> <b>E[foo%=2]</b> has an attribute "foo" that is evenly divisible by 2</li>\r
+    <li> <b>E[foo!=bar]</b> has an attribute "foo" that does not equal "bar"</li>\r
+</ul>\r
+<h4>Pseudo Classes:</h4>\r
+<ul class="list">\r
+    <li> <b>E:first-child</b> E is the first child of its parent</li>\r
+    <li> <b>E:last-child</b> E is the last child of its parent</li>\r
+    <li> <b>E:nth-child(<i>n</i>)</b> E is the <i>n</i>th child of its parent (1 based as per the spec)</li>\r
+    <li> <b>E:nth-child(odd)</b> E is an odd child of its parent</li>\r
+    <li> <b>E:nth-child(even)</b> E is an even child of its parent</li>\r
+    <li> <b>E:only-child</b> E is the only child of its parent</li>\r
+    <li> <b>E:checked</b> E is an element that is has a checked attribute that is true (e.g. a radio or checkbox) </li>\r
+    <li> <b>E:first</b> the first E in the resultset</li>\r
+    <li> <b>E:last</b> the last E in the resultset</li>\r
+    <li> <b>E:nth(<i>n</i>)</b> the <i>n</i>th E in the resultset (1 based)</li>\r
+    <li> <b>E:odd</b> shortcut for :nth-child(odd)</li>\r
+    <li> <b>E:even</b> shortcut for :nth-child(even)</li>\r
+    <li> <b>E:contains(foo)</b> E's innerHTML contains the substring "foo"</li>\r
+    <li> <b>E:nodeValue(foo)</b> E contains a textNode with a nodeValue that equals "foo"</li>\r
+    <li> <b>E:not(S)</b> an E element that does not match simple selector S</li>\r
+    <li> <b>E:has(S)</b> an E element that has a descendent that matches simple selector S</li>\r
+    <li> <b>E:next(S)</b> an E element whose next sibling matches simple selector S</li>\r
+    <li> <b>E:prev(S)</b> an E element whose previous sibling matches simple selector S</li>\r
+</ul>\r
+<h4>CSS Value Selectors:</h4>\r
+<ul class="list">\r
+    <li> <b>E{display=none}</b> css value "display" that equals "none"</li>\r
+    <li> <b>E{display^=none}</b> css value "display" that starts with "none"</li>\r
+    <li> <b>E{display$=none}</b> css value "display" that ends with "none"</li>\r
+    <li> <b>E{display*=none}</b> css value "display" that contains the substring "none"</li>\r
+    <li> <b>E{display%=2}</b> css value "display" that is evenly divisible by 2</li>\r
+    <li> <b>E{display!=none}</b> css value "display" that does not equal "none"</li>\r
+</ul>\r
+ * @singleton\r
+ */\r
 Ext.DomQuery = function(){\r
-    var cache = {}, simpleCache = {}, valueCache = {};\r
-    var nonSpace = /\S/;\r
-    var trimRe = /^\s+|\s+$/g;\r
-    var tplRe = /\{(\d+)\}/g;\r
-    var modeRe = /^(\s?[\/>+~]\s?|\s|$)/;\r
-    var tagTokenRe = /^(#)?([\w-\*]+)/;\r
-    var nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/;\r
+    var cache = {}, \r
+       simpleCache = {}, \r
+       valueCache = {},\r
+       nonSpace = /\S/,\r
+       trimRe = /^\s+|\s+$/g,\r
+       tplRe = /\{(\d+)\}/g,\r
+       modeRe = /^(\s?[\/>+~]\s?|\s|$)/,\r
+       tagTokenRe = /^(#)?([\w-\*]+)/,\r
+       nthRe = /(\d*)n\+?(\d*)/, \r
+       nthRe2 = /\D/,\r
+       // This is for IE MSXML which does not support expandos.\r
+           // 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
+       // renaming the variable to something shorter\r
+       eval("var batch = 30803;");     \r
 \r
     function child(p, index){\r
-        var i = 0;\r
-        var n = p.firstChild;\r
+        var i = 0,\r
+               n = p.firstChild;\r
         while(n){\r
             if(n.nodeType == 1){\r
                if(++i == index){\r
@@ -532,9 +945,10 @@ Ext.DomQuery = function(){
     };\r
 \r
     function children(d){\r
-        var n = d.firstChild, ni = -1;\r
+        var n = d.firstChild, ni = -1,\r
+               nx;\r
            while(n){\r
-               var nx = n.nextSibling;\r
+               nx = n.nextSibling;\r
                if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){\r
                    d.removeChild(n);\r
                }else{\r
@@ -594,7 +1008,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 = ni.children || ni.childNodes;\r
+                cn = isOpera ? ni.childNodes : (ni.children || 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
@@ -610,10 +1024,12 @@ Ext.DomQuery = function(){
                 }\r
             }\r
         }else if(mode == "~"){\r
+            var utag = tagName.toUpperCase();\r
             for(var i = 0, n; n = ns[i]; i++){\r
-                while((n = n.nextSibling) && (n.nodeType != 1 || (tagName == '*' || n.tagName.toLowerCase()!=tagName)));\r
-                if(n){\r
-                    result[++ri] = n;\r
+                while((n = n.nextSibling)){\r
+                    if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){\r
+                        result[++ri] = n;\r
+                    }\r
                 }\r
             }\r
         }\r
@@ -665,9 +1081,14 @@ Ext.DomQuery = function(){
     };\r
 \r
     function byAttribute(cs, attr, value, op, custom){\r
-        var r = [], ri = -1, st = custom=="{";\r
-        var f = Ext.DomQuery.operators[op];\r
+        var r = [], \r
+               ri = -1, \r
+               st = custom=="{",\r
+               f = Ext.DomQuery.operators[op];\r
         for(var i = 0, ci; ci = cs[i]; i++){\r
+            if(ci.nodeType != 1){\r
+                continue;\r
+            }\r
             var a;\r
             if(st){\r
                 a = Ext.DomQuery.getStyle(ci, attr);\r
@@ -692,21 +1113,11 @@ Ext.DomQuery = function(){
         return Ext.DomQuery.pseudos[name](cs, value);\r
     };\r
 \r
-    // This is for IE MSXML which does not support expandos.\r
-    // 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
-    var isIE = window.ActiveXObject ? true : false;\r
-\r
-    // this eval is stop the compressor from\r
-    // renaming the variable to something shorter\r
-    eval("var batch = 30803;");\r
-\r
-    var key = 30803;\r
-\r
     function nodupIEXml(cs){\r
-        var d = ++key;\r
+        var d = ++key, \r
+               r;\r
         cs[0].setAttribute("_nodup", d);\r
-        var r = [cs[0]];\r
+        r = [cs[0]];\r
         for(var i = 1, len = cs.length; i < len; i++){\r
             var c = cs[i];\r
             if(!c.getAttribute("_nodup") != d){\r
@@ -754,11 +1165,11 @@ Ext.DomQuery = function(){
     }\r
 \r
     function quickDiffIEXml(c1, c2){\r
-        var d = ++key;\r
+        var d = ++key,\r
+               r = [];\r
         for(var i = 0, len = c1.length; i < len; i++){\r
             c1[i].setAttribute("_qdiff", d);\r
-        }\r
-        var r = [];\r
+        }        \r
         for(var i = 0, len = c2.length; i < len; i++){\r
             if(c2[i].getAttribute("_qdiff") != d){\r
                 r[r.length] = c2[i];\r
@@ -771,18 +1182,18 @@ Ext.DomQuery = function(){
     }\r
 \r
     function quickDiff(c1, c2){\r
-        var len1 = c1.length;\r
+        var len1 = c1.length,\r
+               d = ++key,\r
+               r = [];\r
         if(!len1){\r
             return c2;\r
         }\r
         if(isIE && c1[0].selectSingleNode){\r
             return quickDiffIEXml(c1, c2);\r
-        }\r
-        var d = ++key;\r
+        }        \r
         for(var i = 0; i < len1; i++){\r
             c1[i]._qdiff = d;\r
-        }\r
-        var r = [];\r
+        }        \r
         for(var i = 0, len = c2.length; i < len; i++){\r
             if(c2[i]._qdiff != d){\r
                 r[r.length] = c2[i];\r
@@ -804,18 +1215,24 @@ Ext.DomQuery = function(){
         getStyle : function(el, name){\r
             return Ext.fly(el).getStyle(name);\r
         },\r
-        \r
+        /**\r
+         * Compiles a selector/xpath query into a reusable function. The returned function\r
+         * takes one parameter "root" (optional), which is the context node from where the query should start.\r
+         * @param {String} selector The selector/xpath query\r
+         * @param {String} type (optional) Either "select" (the default) or "simple" for a simple selector match\r
+         * @return {Function}\r
+         */\r
         compile : function(path, type){\r
             type = type || "select";\r
 \r
-            var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"];\r
-            var q = path, mode, lq;\r
-            var tk = Ext.DomQuery.matchers;\r
-            var tklen = tk.length;\r
-            var mm;\r
-\r
-            // accept leading mode switch\r
-            var lmode = q.match(modeRe);\r
+            var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],\r
+               q = path, mode, lq,\r
+               tk = Ext.DomQuery.matchers,\r
+               tklen = tk.length,\r
+               mm,\r
+               // accept leading mode switch\r
+               lmode = q.match(modeRe);\r
+            \r
             if(lmode && lmode[1]){\r
                 fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';\r
                 q = q.replace(lmode[1], "");\r
@@ -878,7 +1295,13 @@ Ext.DomQuery = function(){
             return f;\r
         },\r
 \r
-        \r
+        /**\r
+         * Selects a group of elements.\r
+         * @param {String} selector The selector/xpath query (can be a comma separated list of selectors)\r
+         * @param {Node} root (optional) The start of the query (defaults to document).\r
+         * @return {Array} An Array of DOM elements which match the selector. If there are\r
+         * no matches, and empty Array is returned.\r
+         */\r
         select : function(path, root, type){\r
             if(!root || root == document){\r
                 root = document;\r
@@ -886,8 +1309,8 @@ Ext.DomQuery = function(){
             if(typeof root == "string"){\r
                 root = document.getElementById(root);\r
             }\r
-            var paths = path.split(",");\r
-            var results = [];\r
+            var paths = path.split(","),\r
+               results = [];\r
             for(var i = 0, len = paths.length; i < len; i++){\r
                 var p = paths[i].replace(trimRe, "");\r
                 if(!cache[p]){\r
@@ -907,40 +1330,71 @@ Ext.DomQuery = function(){
             return results;\r
         },\r
 \r
-        \r
+        /**\r
+         * Selects a single element.\r
+         * @param {String} selector The selector/xpath query\r
+         * @param {Node} root (optional) The start of the query (defaults to document).\r
+         * @return {Element} The DOM element which matched the selector.\r
+         */\r
         selectNode : function(path, root){\r
             return Ext.DomQuery.select(path, root)[0];\r
         },\r
 \r
-        \r
+        /**\r
+         * Selects the value of a node, optionally replacing null with the defaultValue.\r
+         * @param {String} selector The selector/xpath query\r
+         * @param {Node} root (optional) The start of the query (defaults to document).\r
+         * @param {String} defaultValue\r
+         * @return {String}\r
+         */\r
         selectValue : function(path, root, defaultValue){\r
             path = path.replace(trimRe, "");\r
             if(!valueCache[path]){\r
                 valueCache[path] = Ext.DomQuery.compile(path, "select");\r
             }\r
-            var n = valueCache[path](root);\r
+            var n = valueCache[path](root),\r
+               v;\r
             n = n[0] ? n[0] : n;\r
-            var v = (n && n.firstChild ? n.firstChild.nodeValue : null);\r
+            v = (n && n.firstChild ? n.firstChild.nodeValue : null);\r
             return ((v === null||v === undefined||v==='') ? defaultValue : v);\r
         },\r
 \r
-        \r
+        /**\r
+         * Selects the value of a node, parsing integers and floats. Returns the defaultValue, or 0 if none is specified.\r
+         * @param {String} selector The selector/xpath query\r
+         * @param {Node} root (optional) The start of the query (defaults to document).\r
+         * @param {Number} defaultValue\r
+         * @return {Number}\r
+         */\r
         selectNumber : function(path, root, defaultValue){\r
             var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);\r
             return parseFloat(v);\r
         },\r
 \r
-        \r
+        /**\r
+         * Returns true if the passed element(s) match the passed simple selector (e.g. div.some-class or span:first-child)\r
+         * @param {String/HTMLElement/Array} el An element id, element or array of elements\r
+         * @param {String} selector The simple selector to test\r
+         * @return {Boolean}\r
+         */\r
         is : function(el, ss){\r
             if(typeof el == "string"){\r
                 el = document.getElementById(el);\r
             }\r
-            var isArray = Ext.isArray(el);\r
-            var result = Ext.DomQuery.filter(isArray ? el : [el], ss);\r
+            var isArray = Ext.isArray(el),\r
+               result = Ext.DomQuery.filter(isArray ? el : [el], ss);\r
             return isArray ? (result.length == el.length) : (result.length > 0);\r
         },\r
 \r
-        \r
+        /**\r
+         * Filters an array of elements to only include matches of a simple selector (e.g. div.some-class or span:first-child)\r
+         * @param {Array} el An array of elements to filter\r
+         * @param {String} selector The simple selector to test\r
+         * @param {Boolean} nonMatches If true, it returns the elements that DON'T match\r
+         * the selector instead of the ones that match\r
+         * @return {Array} An Array of DOM elements which match the selector. If there are\r
+         * no matches, and empty Array is returned.\r
+         */\r
         filter : function(els, ss, nonMatches){\r
             ss = ss.replace(trimRe, "");\r
             if(!simpleCache[ss]){\r
@@ -950,7 +1404,9 @@ Ext.DomQuery = function(){
             return nonMatches ? quickDiff(result, els) : result;\r
         },\r
 \r
-        \r
+        /**\r
+         * Collection of matching regular expressions and code snippets.\r
+         */\r
         matchers : [{\r
                 re: /^\.([\w-]+)/,\r
                 select: 'n = byClassName(n, null, " {1} ");'\r
@@ -969,7 +1425,10 @@ Ext.DomQuery = function(){
             }\r
         ],\r
 \r
-        \r
+        /**\r
+         * Collection of operator comparison functions. The default operators are =, !=, ^=, $=, *=, %=, |= and ~=.\r
+         * New operators can be added as long as the match the format <i>c</i>= where <i>c</i> is any character other than space, &gt; &lt;.\r
+         */\r
         operators : {\r
             "=" : function(a, v){\r
                 return a == v;\r
@@ -997,7 +1456,10 @@ Ext.DomQuery = function(){
             }\r
         },\r
 \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
+         */\r
         pseudos : {\r
             "first-child" : function(c){\r
                 var r = [], ri = -1, n;\r
@@ -1022,9 +1484,9 @@ Ext.DomQuery = function(){
             },\r
 \r
             "nth-child" : function(c, a) {\r
-                var r = [], ri = -1;\r
-                var m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a);\r
-                var f = (m[1] || 1) - 0, l = m[2] - 0;\r
+                var r = [], ri = -1,\r
+                       m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),\r
+                       f = (m[1] || 1) - 0, l = m[2] - 0;\r
                 for(var i = 0, n; n = c[i]; i++){\r
                     var pn = n.parentNode;\r
                     if (batch != pn._batch) {\r
@@ -1111,8 +1573,8 @@ Ext.DomQuery = function(){
             },\r
 \r
             "any" : function(c, selectors){\r
-                var ss = selectors.split('|');\r
-                var r = [], ri = -1, s;\r
+                var ss = selectors.split('|'),\r
+                       r = [], ri = -1, s;\r
                 for(var i = 0, ci; ci = c[i]; i++){\r
                     for(var j = 0; s = ss[j]; j++){\r
                         if(Ext.DomQuery.is(ci, s)){\r
@@ -1145,8 +1607,8 @@ Ext.DomQuery = function(){
             },\r
 \r
             "has" : function(c, ss){\r
-                var s = Ext.DomQuery.select;\r
-                var r = [], ri = -1;\r
+                var s = Ext.DomQuery.select,\r
+                       r = [], ri = -1;\r
                 for(var i = 0, ci; ci = c[i]; i++){\r
                     if(s(ss, ci).length > 0){\r
                         r[++ri] = ci;\r
@@ -1156,8 +1618,8 @@ Ext.DomQuery = function(){
             },\r
 \r
             "next" : function(c, ss){\r
-                var is = Ext.DomQuery.is;\r
-                var r = [], ri = -1;\r
+                var is = Ext.DomQuery.is,\r
+                       r = [], ri = -1;\r
                 for(var i = 0, ci; ci = c[i]; i++){\r
                     var n = next(ci);\r
                     if(n && is(n, ss)){\r
@@ -1168,8 +1630,8 @@ Ext.DomQuery = function(){
             },\r
 \r
             "prev" : function(c, ss){\r
-                var is = Ext.DomQuery.is;\r
-                var r = [], ri = -1;\r
+                var is = Ext.DomQuery.is,\r
+                       r = [], ri = -1;\r
                 for(var i = 0, ci; ci = c[i]; i++){\r
                     var n = prev(ci);\r
                     if(n && is(n, ss)){\r
@@ -1182,1257 +1644,4744 @@ Ext.DomQuery = function(){
     };\r
 }();\r
 \r
-\r
+/**\r
+ * Selects an array of DOM nodes by CSS/XPath selector. Shorthand of {@link Ext.DomQuery#select}\r
+ * @param {String} path The selector/xpath query\r
+ * @param {Node} root (optional) The start of the query (defaults to document).\r
+ * @return {Array}\r
+ * @member Ext\r
+ * @method query\r
+ */\r
 Ext.query = Ext.DomQuery.select;\r
-\r
-\r
-Ext.util.Observable = function(){\r
-    \r
-    if(this.listeners){\r
-        this.on(this.listeners);\r
-        delete this.listeners;\r
-    }\r
-};\r
-Ext.util.Observable.prototype = {\r
-    \r
-    fireEvent : function(){\r
-        if(this.eventsSuspended !== true){\r
-            var ce = this.events[arguments[0].toLowerCase()];\r
-            if(typeof ce == "object"){\r
-                return ce.fire.apply(ce, Array.prototype.slice.call(arguments, 1));\r
-            }\r
-        }\r
-        return true;\r
-    },\r
-\r
+(function(){
+
+var EXTUTIL = Ext.util,
+    TOARRAY = Ext.toArray,
+    EACH = Ext.each,
+    ISOBJECT = Ext.isObject,
+    TRUE = true,
+    FALSE = false;
+/**
+ * @class Ext.util.Observable
+ * Base class that provides a common interface for publishing events. Subclasses are expected to
+ * to have a property "events" with all the events defined, and, optionally, a property "listeners"
+ * with configured listeners defined.<br>
+ * For example:
+ * <pre><code>
+Employee = Ext.extend(Ext.util.Observable, {
+    constructor: function(config){
+        this.name = config.name;
+        this.addEvents({
+            "fired" : true,
+            "quit" : true
+        });
+
+        // Copy configured listeners into *this* object so that the base class&#39;s
+        // constructor will add them.
+        this.listeners = config.listeners;
+
+        // Call our superclass constructor to complete construction process.
+        Employee.superclass.constructor.call(config)
+    }
+});
+</code></pre>
+ * This could then be used like this:<pre><code>
+var newEmployee = new Employee({
+    name: employeeName,
+    listeners: {
+        quit: function() {
+            // By default, "this" will be the object that fired the event.
+            alert(this.name + " has quit!");
+        }
+    }
+});
+</code></pre>
+ */
+EXTUTIL.Observable = function(){
+    /**
+     * @cfg {Object} listeners (optional) <p>A config object containing one or more event handlers to be added to this
+     * object during initialization.  This should be a valid listeners config object as specified in the
+     * {@link #addListener} example for attaching multiple handlers at once.</p>
+     * <br><p><b><u>DOM events from ExtJs {@link Ext.Component Components}</u></b></p>
+     * <br><p>While <i>some</i> ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
+     * is usually only done when extra value can be added. For example the {@link Ext.DataView DataView}'s
+     * <b><code>{@link Ext.DataView#click click}</code></b> event passing the node clicked on. To access DOM
+     * events directly from a Component's HTMLElement, listeners must be added to the <i>{@link Ext.Component#getEl Element}</i> after the Component
+     * has been rendered. A plugin can simplify this step:<pre><code>
+// Plugin is configured with a listeners config object.
+// The Component is appended to the argument list of all handler functions.
+Ext.DomObserver = Ext.extend(Object, {
+    constructor: function(config) {
+        this.listeners = config.listeners ? config.listeners : config;
+    },
+
+    // Component passes itself into plugin&#39;s init method
+    init: function(c) {
+        var p, l = this.listeners;
+        for (p in l) {
+            if (Ext.isFunction(l[p])) {
+                l[p] = this.createHandler(l[p], c);
+            } else {
+                l[p].fn = this.createHandler(l[p].fn, c);
+            }
+        }
+
+        // Add the listeners to the Element immediately following the render call
+        c.render = c.render.{@link Function#createSequence createSequence}(function() {
+            var e = c.getEl();
+            if (e) {
+                e.on(l);
+            }
+        });
+    },
+
+    createHandler: function(fn, c) {
+        return function(e) {
+            fn.call(this, e, c);
+        };
+    }
+});
+
+var combo = new Ext.form.ComboBox({
+
+    // Collapse combo when its element is clicked on
+    plugins: [ new Ext.DomObserver({
+        click: function(evt, comp) {
+            comp.collapse();
+        }
+    })],
+    store: myStore,
+    typeAhead: true,
+    mode: 'local',
+    triggerAction: 'all'
+});
+     * </code></pre></p>
+     */
+    var me = this, e = me.events;
+    if(me.listeners){
+        me.on(me.listeners);
+        delete me.listeners;
+    }
+    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.
+         */
+
+        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);
+                }
+            }
+            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) {
+                    c.enableBubble(ename);
+                    return c.fireEvent.apply(c, a);
+                }
+            }
+            else {
+                if (ISOBJECT(ce)) {
+                    a.shift();
+                    ret = ce.fire.apply(ce, a);
+                }
+            }
+            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>
+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
+    }
+});</code></pre>
+     * <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 (!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);
+                }
+                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);
+            }
+        },
+
+        /**
+         * 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();
+                }
+            }
+        },
+
+        /**
+         * 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);
+            }
+        },
+
+        /**
+         * 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 = [];
+            }
+        },
+
+        /**
+         * 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);
+            });
+        }
+    }
+}();
+
+var OBSERVABLE = EXTUTIL.Observable.prototype;
+/**
+ * Appends an event handler to this object (shorthand for {@link #addListener}.)
+ * @param {String}   eventName     The type of 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.
+ * @method
+ */
+OBSERVABLE.on = OBSERVABLE.addListener;
+/**
+ * Removes an event handler (shorthand for {@link #removeListener}.)
+ * @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.
+ * @method
+ */
+OBSERVABLE.un = OBSERVABLE.removeListener;
+
+/**
+ * Removes <b>all</b> added captures from the Observable.
+ * @param {Observable} o The Observable to release
+ * @static
+ */
+EXTUTIL.Observable.releaseCapture = function(o){
+    o.fireEvent = OBSERVABLE.fireEvent;
+};
+
+function createTargeted(h, o, scope){
+    return function(){
+        if(o.target == arguments[0]){
+            h.apply(scope, TOARRAY(arguments));
+        }
+    };
+};
+
+function createBuffered(h, o, scope){
+    var task = new EXTUTIL.DelayedTask();
+    return function(){
+        task.delay(o.buffer, h, scope, TOARRAY(arguments));
+    };
+}
+
+function createSingle(h, e, fn, scope){
+    return function(){
+        e.removeListener(fn, scope);
+        return h.apply(scope, arguments);
+    };
+}
+
+function createDelayed(h, o, scope){
+    return function(){
+        var args = TOARRAY(arguments);
+        (function(){
+            h.apply(scope, args);
+        }).defer(o.delay || 10);
+    };
+};
+
+EXTUTIL.Event = function(obj, name){
+    this.name = name;
+    this.obj = obj;
+    this.listeners = [];
+};
+
+EXTUTIL.Event.prototype = {
+    addListener : function(fn, scope, options){
+        var me = this,
+            l;
+        scope = scope || me.obj;
+        if(!me.isListening(fn, scope)){
+            l = me.createListener(fn, scope, options);
+            if(me.firing){ // if we are currently firing this event, don't disturb the listener loop
+                me.listeners = me.listeners.slice(0);
+            }
+            me.listeners.push(l);
+        }
+    },
+
+    createListener: function(fn, scope, o){
+        o = o || {}, scope = scope || this.obj;
+        var l = {
+            fn: fn,
+            scope: scope,
+            options: o
+        }, h = fn;
+        if(o.target){
+            h = createTargeted(h, o, scope);
+        }
+        if(o.delay){
+            h = createDelayed(h, o, scope);
+        }
+        if(o.single){
+            h = createSingle(h, this, fn, scope);
+        }
+        if(o.buffer){
+            h = createBuffered(h, o, 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;
+            }
+        },
+        this);
+        return ret;
+    },
+
+    isListening : function(fn, scope){
+        return this.findListener(fn, scope) != -1;
+    },
+
+    removeListener : function(fn, scope){
+        var index,
+            me = this,
+            ret = FALSE;
+        if((index = me.findListener(fn, scope)) != -1){
+            if (me.firing) {
+                me.listeners = me.listeners.slice(0);
+            }
+            me.listeners.splice(index, 1);
+            ret = TRUE;
+        }
+        return ret;
+    },
+
+    clearListeners : function(){
+        this.listeners = [];
+    },
+
+    fire : function(){
+        var me = this,
+            args = TOARRAY(arguments),
+            ret = TRUE;
+
+        EACH(me.listeners, function(l) {
+            me.firing = TRUE;
+            if (l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
+                return ret = me.firing = FALSE;
+            }
+        });
+        me.firing = FALSE;
+        return ret;
+    }
+};
+})();/**\r
+ * @class Ext.util.Observable\r
+ */\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
-    filterOptRe : /^(?:scope|delay|buffer|single)$/,\r
-\r
-    \r
-    addListener : function(eventName, fn, scope, o){\r
-        if(typeof eventName == "object"){\r
-            o = eventName;\r
-            for(var e in o){\r
-                if(this.filterOptRe.test(e)){\r
-                    continue;\r
-                }\r
-                if(typeof o[e] == "function"){\r
-                    // shared options\r
-                    this.addListener(e, o[e], o.scope,  o);\r
-                }else{\r
-                    // individual options\r
-                    this.addListener(e, o[e].fn, o[e].scope, o[e]);\r
-                }\r
-            }\r
-            return;\r
-        }\r
-        o = (!o || typeof o == "boolean") ? {} : o;\r
-        eventName = eventName.toLowerCase();\r
-        var ce = this.events[eventName] || true;\r
-        if(typeof ce == "boolean"){\r
-            ce = new Ext.util.Event(this, eventName);\r
-            this.events[eventName] = ce;\r
-        }\r
-        ce.addListener(fn, scope, o);\r
-    },\r
-\r
-    \r
-    removeListener : function(eventName, fn, scope){\r
-        var ce = this.events[eventName.toLowerCase()];\r
-        if(typeof ce == "object"){\r
-            ce.removeListener(fn, scope);\r
-        }\r
-    },\r
-\r
-    \r
-    purgeListeners : function(){\r
-        for(var evt in this.events){\r
-            if(typeof this.events[evt] == "object"){\r
-                 this.events[evt].clearListeners();\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    relayEvents : function(o, events){\r
-        var createHandler = function(ename){\r
-            return function(){\r
-                return this.fireEvent.apply(this, Ext.combine(ename, Array.prototype.slice.call(arguments, 0)));\r
-            };\r
-        };\r
-        for(var i = 0, len = events.length; i < len; i++){\r
-            var ename = events[i];\r
-            if(!this.events[ename]){ this.events[ename] = true; };\r
-            o.on(ename, createHandler(ename), this);\r
-        }\r
-    },\r
-\r
-    \r
-    addEvents : function(o){\r
-        if(!this.events){\r
-            this.events = {};\r
-        }\r
-        if(typeof o == 'string'){\r
-            for(var i = 0, a = arguments, v; v = a[i]; i++){\r
-                if(!this.events[a[i]]){\r
-                    this.events[a[i]] = true;\r
-                }\r
-            }\r
-        }else{\r
-            Ext.applyIf(this.events, o);\r
-        }\r
-    },\r
-\r
-    \r
-    hasListener : function(eventName){\r
-        var e = this.events[eventName];\r
-        return typeof e == "object" && e.listeners.length > 0;\r
-    },\r
-\r
-    \r
-    suspendEvents : function(){\r
-        this.eventsSuspended = true;\r
-    },\r
-\r
-    \r
-    resumeEvents : function(){\r
-        this.eventsSuspended = false;\r
-    },\r
-\r
-    // these are considered experimental\r
-    // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call\r
-    // private\r
-    getMethodEvent : function(method){\r
-        if(!this.methodEvents){\r
-            this.methodEvents = {};\r
-        }\r
-        var e = this.methodEvents[method];\r
-        if(!e){\r
-            e = {};\r
-            this.methodEvents[method] = e;\r
-\r
+    function getMethodEvent(method){\r
+        var e = (this.methodEvents = this.methodEvents ||\r
+        {})[method], returnValue, v, cancel, obj = this;\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 returnValue, v, cancel;\r
-            var obj = this;\r
-\r
+            \r
             var makeCall = function(fn, scope, args){\r
-                if((v = fn.apply(scope || obj, args)) !== undefined){\r
-                    if(typeof v === 'object'){\r
-                        if(v.returnValue !== undefined){\r
-                            returnValue = v.returnValue;\r
-                        }else{\r
-                            returnValue = v;\r
-                        }\r
-                        if(v.cancel === true){\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
+                        if (v === false) {\r
                             cancel = true;\r
                         }\r
-                    }else if(v === false){\r
-                        cancel = true;\r
-                    }else {\r
-                        returnValue = v;\r
-                    }\r
+                        else {\r
+                            returnValue = v;\r
+                        }\r
                 }\r
-            }\r
-\r
+            };\r
+            \r
             this[method] = function(){\r
-                returnValue = v = undefined; cancel = false;\r
-                var args = Array.prototype.slice.call(arguments, 0);\r
-                for(var i = 0, len = e.before.length; i < len; i++){\r
-                    makeCall(e.before[i].fn, e.before[i].scope, args);\r
-                    if(cancel){\r
+                var args = Ext.toArray(arguments);\r
+                returnValue = v = undefined;\r
+                cancel = false;\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
-                if((v = e.originalFn.apply(obj, args)) !== undefined){\r
+                });\r
+                \r
+                if (!Ext.isEmpty(v = e.originalFn.apply(obj, args))) {\r
                     returnValue = v;\r
                 }\r
-\r
-                for(var i = 0, len = e.after.length; i < len; i++){\r
-                    makeCall(e.after[i].fn, e.after[i].scope, args);\r
-                    if(cancel){\r
+                Ext.each(e.after, function(a){\r
+                    makeCall(a.fn, a.scope, args);\r
+                    if (cancel) {\r
                         return returnValue;\r
                     }\r
-                }\r
+                });\r
                 return returnValue;\r
             };\r
         }\r
         return e;\r
-    },\r
-\r
-    // adds an "interceptor" called before the original method\r
-    beforeMethod : function(method, fn, scope){\r
-        var e = this.getMethodEvent(method);\r
-        e.before.push({fn: fn, scope: scope});\r
-    },\r
-\r
-    // adds a "sequence" called after the original method\r
-    afterMethod : function(method, fn, scope){\r
-        var e = this.getMethodEvent(method);\r
-        e.after.push({fn: fn, scope: scope});\r
-    },\r
-\r
-    removeMethodListener : function(method, fn, scope){\r
-        var e = this.getMethodEvent(method);\r
-        for(var i = 0, len = e.before.length; i < len; i++){\r
-            if(e.before[i].fn == fn && e.before[i].scope == scope){\r
-                e.before.splice(i, 1);\r
-                return;\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
+            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
+            getMethodEvent.call(this, method).after.push({\r
+                fn: fn,\r
+                scope: scope\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
+                if (b.fn == fn && b.scope == scope) {\r
+                    arr.splice(i, 1);\r
+                    found = true;\r
+                    return false;\r
+                }\r
+            });\r
+            if (!found) {\r
+                Ext.each(e.after, function(a, i, arr){\r
+                    if (a.fn == fn && a.scope == scope) {\r
+                        arr.splice(i, 1);\r
+                        return false;\r
+                    }\r
+                });\r
             }\r
-        }\r
-        for(var i = 0, len = e.after.length; i < len; i++){\r
-            if(e.after[i].fn == fn && e.after[i].scope == scope){\r
-                e.after.splice(i, 1);\r
-                return;\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
+            var me = this;\r
+            function createHandler(ename){\r
+                return function(){\r
+                    return me.fireEvent.apply(me, [ename].concat(Ext.toArray(arguments)));\r
+                };\r
             }\r
+            Ext.each(events, function(ename){\r
+                me.events[ename] = me.events[ename] || true;\r
+                o.on(ename, createHandler(ename), me);\r
+            });\r
+        },\r
+        \r
+        /**\r
+         * Used to enable bubbling of events\r
+         * @param {Object} events\r
+         */\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
         }\r
-    }\r
-};\r
-\r
-Ext.util.Observable.prototype.on = Ext.util.Observable.prototype.addListener;\r
-\r
-Ext.util.Observable.prototype.un = Ext.util.Observable.prototype.removeListener;\r
+    };\r
+}());\r
 \r
 \r
+/**\r
+ * Starts capture on the specified Observable. All events will be passed\r
+ * 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
+ * @static\r
+ */\r
 Ext.util.Observable.capture = function(o, fn, scope){\r
     o.fireEvent = o.fireEvent.createInterceptor(fn, scope);\r
 };\r
 \r
 \r
-Ext.util.Observable.releaseCapture = function(o){\r
-    o.fireEvent = Ext.util.Observable.prototype.fireEvent;\r
-};\r
+/**\r
+ * Sets observability on the passed class constructor.<p>\r
+ * <p>This makes any event fired on any instance of the passed class also fire a single event through\r
+ * the <i>class</i> allowing for central handling of events on many instances at once.</p>\r
+ * <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
+});</code></pre>\r
+ * @param {Function} c The class constructor to make observable.\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
+ * @class Ext.EventManager\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
+         */\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
+\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
+\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
 \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
-    var createBuffered = function(h, o, scope){\r
-        var task = new Ext.util.DelayedTask();\r
-        return function(){\r
-            task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));\r
-        };\r
-    };\r
+Ext.Element = function(element, forceNew){\r
+    var dom = typeof element == "string" ?\r
+              DOC.getElementById(element) : element,\r
+        id;\r
 \r
-    var createSingle = function(h, e, fn, scope){\r
-        return function(){\r
-            e.removeListener(fn, scope);\r
-            return h.apply(scope, arguments);\r
-        };\r
-    };\r
+    if(!dom) return null;\r
 \r
-    var createDelayed = function(h, o, scope){\r
-        return function(){\r
-            var args = Array.prototype.slice.call(arguments, 0);\r
-            setTimeout(function(){\r
-                h.apply(scope, args);\r
-            }, o.delay || 10);\r
-        };\r
-    };\r
+    id = dom.id;\r
 \r
-    Ext.util.Event = function(obj, name){\r
-        this.name = name;\r
-        this.obj = obj;\r
-        this.listeners = [];\r
-    };\r
+    if(!forceNew && id && Ext.Element.cache[id]){ // element object already exists\r
+        return Ext.Element.cache[id];\r
+    }\r
 \r
-    Ext.util.Event.prototype = {\r
-        addListener : function(fn, scope, options){\r
-            scope = scope || this.obj;\r
-            if(!this.isListening(fn, scope)){\r
-                var l = this.createListener(fn, scope, options);\r
-                if(!this.firing){\r
-                    this.listeners.push(l);\r
-                }else{ // if we are currently firing this event, don't disturb the listener loop\r
-                    this.listeners = this.listeners.slice(0);\r
-                    this.listeners.push(l);\r
-                }\r
-            }\r
-        },\r
+    /**\r
+     * The DOM element\r
+     * @type HTMLElement\r
+     */\r
+    this.dom = dom;\r
 \r
-        createListener : function(fn, scope, o){\r
-            o = o || {};\r
-            scope = scope || this.obj;\r
-            var l = {fn: fn, scope: scope, options: o};\r
-            var h = fn;\r
-            if(o.delay){\r
-                h = createDelayed(h, o, scope);\r
-            }\r
-            if(o.single){\r
-                h = createSingle(h, this, fn, scope);\r
-            }\r
-            if(o.buffer){\r
-                h = createBuffered(h, o, scope);\r
-            }\r
-            l.fireFn = h;\r
-            return l;\r
-        },\r
+    /**\r
+     * The DOM element ID\r
+     * @type String\r
+     */\r
+    this.id = id || Ext.id(dom);\r
+};\r
 \r
-        findListener : function(fn, scope){\r
-            scope = scope || this.obj;\r
-            var ls = this.listeners;\r
-            for(var i = 0, len = ls.length; i < len; i++){\r
-                var l = ls[i];\r
-                if(l.fn == fn && l.scope == scope){\r
-                    return i;\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
+\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
                 }\r
             }\r
-            return -1;\r
-        },\r
+        }\r
+        if(o.style){\r
+            Ext.DomHelper.applyStyles(el, o.style);\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
+\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
+\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
+//  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
+\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
 \r
-        isListening : function(fn, scope){\r
-            return this.findListener(fn, scope) != -1;\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
-        removeListener : function(fn, scope){\r
-            var index;\r
-            if((index = this.findListener(fn, scope)) != -1){\r
-                if(!this.firing){\r
-                    this.listeners.splice(index, 1);\r
-                }else{\r
-                    this.listeners = this.listeners.slice(0);\r
-                    this.listeners.splice(index, 1);\r
-                }\r
-                return true;\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
             }\r
-            return false;\r
-        },\r
+        }catch(e){}\r
+        return me;\r
+    },\r
 \r
-        clearListeners : function(){\r
-            this.listeners = [];\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
 \r
-        fire : function(){\r
-            var ls = this.listeners, scope, len = ls.length;\r
-            if(len > 0){\r
-                this.firing = true;\r
-                var args = Array.prototype.slice.call(arguments, 0);\r
-                for(var i = 0; i < len; i++){\r
-                    var l = ls[i];\r
-                    if(l.fireFn.apply(l.scope||this.obj||window, arguments) === false){\r
-                        this.firing = false;\r
-                        return false;\r
-                    }\r
-                }\r
-                this.firing = false;\r
-            }\r
-            return true;\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
+\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
-Ext.EventManager = function(){\r
-    var docReadyEvent, docReadyProcId, docReadyState = false;\r
-    var resizeEvent, resizeTask, textEvent, textSize;\r
-    var E = Ext.lib.Event;\r
-    var D = Ext.lib.Dom;\r
-    // fix parser confusion\r
-    var xname = 'Ex' + 't';\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
 \r
-    var elHash = {};\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
 \r
-    var addListener = function(el, ename, fn, wrap, scope){\r
-        var id = Ext.id(el);\r
-        if(!elHash[id]){\r
-            elHash[id] = {};\r
-        }\r
-        var es = elHash[id];\r
-        if(!es[ename]){\r
-            es[ename] = [];\r
-        }\r
-        var ls = es[ename];\r
-        ls.push({\r
-            id: id,\r
-            ename: ename,\r
-            fn: fn,\r
-            wrap: wrap,\r
-            scope: scope\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
+        }\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
 \r
-         E.on(el, ename, wrap);\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
-        if(ename == "mousewheel" && el.addEventListener){ // workaround for jQuery\r
-            el.addEventListener("DOMMouseScroll", wrap, false);\r
-            E.on(window, 'unload', function(){\r
-                el.removeEventListener("DOMMouseScroll", wrap, false);\r
-            });\r
-        }\r
-        if(ename == "mousedown" && el == document){ // fix stopped mousedowns on the document\r
-            Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);\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
-    var removeListener = function(el, ename, fn, scope){\r
-        el = Ext.getDom(el);\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
-        var id = Ext.id(el), es = elHash[id], wrap;\r
-        if(es){\r
-            var ls = es[ename], l;\r
-            if(ls){\r
-                for(var i = 0, len = ls.length; i < len; i++){\r
-                    l = ls[i];\r
-                    if(l.fn == fn && (!scope || l.scope == scope)){\r
-                        wrap = l.wrap;\r
-                        E.un(el, ename, wrap);\r
-                        ls.splice(i, 1);\r
-                        break;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if(ename == "mousewheel" && el.addEventListener && wrap){\r
-            el.removeEventListener("DOMMouseScroll", wrap, false);\r
-        }\r
-        if(ename == "mousedown" && el == document && wrap){ // fix stopped mousedowns on the document\r
-            Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);\r
+        if(['undefined', 'unknown'].indexOf(type) == -1){\r
+            return d[ns + ":" + name];\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
     }\r
+};\r
 \r
-    var removeAll = function(el){\r
-        el = Ext.getDom(el);\r
-        var id = Ext.id(el), es = elHash[id], ls;\r
-        if(es){\r
-            for(var ename in es){\r
-                if(es.hasOwnProperty(ename)){\r
-                    ls = es[ename];\r
-                    for(var i = 0, len = ls.length; i < len; i++){\r
-                        E.un(el, ename, ls[i].wrap);\r
-                        ls[i] = null;\r
-                    }\r
-                }\r
-                es[ename] = null;\r
-            }\r
-            delete elHash[id];\r
-        }\r
-    }\r
+var ep = El.prototype;\r
 \r
+El.addMethods = function(o){\r
+   Ext.apply(ep, o);\r
+};\r
 \r
-    var fireDocReady = function(){\r
-        if(!docReadyState){\r
-            docReadyState = true;\r
-            Ext.isReady = true;\r
-            if(docReadyProcId){\r
-                clearInterval(docReadyProcId);\r
-            }\r
-            if(Ext.isGecko || Ext.isOpera) {\r
-                document.removeEventListener("DOMContentLoaded", fireDocReady, false);\r
-            }\r
-            if(Ext.isIE){\r
-                var defer = document.getElementById("ie-deferred-loader");\r
-                if(defer){\r
-                    defer.onreadystatechange = null;\r
-                    defer.parentNode.removeChild(defer);\r
-                }\r
-            }\r
-            if(docReadyEvent){\r
-                docReadyEvent.fire();\r
-                docReadyEvent.clearListeners();\r
-            }\r
-        }\r
-    };\r
-\r
-    var initDocReady = function(){\r
-        docReadyEvent = new Ext.util.Event();\r
-        if(Ext.isGecko || Ext.isOpera) {\r
-            document.addEventListener("DOMContentLoaded", fireDocReady, false);\r
-        }else if(Ext.isIE){\r
-            document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");\r
-            var defer = document.getElementById("ie-deferred-loader");\r
-            defer.onreadystatechange = function(){\r
-                if(this.readyState == "complete"){\r
-                    fireDocReady();\r
-                }\r
-            };\r
-        }else if(Ext.isSafari){\r
-            docReadyProcId = setInterval(function(){\r
-                var rs = document.readyState;\r
-                if(rs == "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
+ * 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
-    var createBuffered = function(h, o){\r
-        var task = new Ext.util.DelayedTask(h);\r
-        return function(e){\r
-            // create new event object impl so new events don't wipe out properties\r
-            e = new Ext.EventObjectImpl(e);\r
-            task.delay(o.buffer, h, null, [e]);\r
-        };\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
-    var createSingle = function(h, el, ename, fn, scope){\r
-        return function(e){\r
-            Ext.EventManager.removeListener(el, ename, fn, scope);\r
-            h(e);\r
-        };\r
-    };\r
+/**\r
+ * true to automatically adjust width and height settings for box-model issues (default to true)\r
+ */\r
+ep.autoBoxAdjust = true;\r
 \r
-    var createDelayed = function(h, o){\r
-        return function(e){\r
-            // create new event object impl so new events don't wipe out properties\r
-            e = new Ext.EventObjectImpl(e);\r
-            setTimeout(function(){\r
-                h(e);\r
-            }, o.delay || 10);\r
-        };\r
-    };\r
+// private\r
+var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,\r
+    docEl;\r
 \r
-    var listen = function(element, ename, opt, fn, scope){\r
-        var o = (!opt || typeof opt == "boolean") ? {} : opt;\r
-        fn = fn || o.fn; scope = scope || o.scope;\r
-        var el = Ext.getDom(element);\r
-        if(!el){\r
-            throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';\r
+/**\r
+ * @private\r
+ */\r
+El.cache = {};\r
+El.dataCache = {};\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
-        var h = function(e){\r
-            // prevent errors while unload occurring\r
-            if(!window[xname]){\r
-                return;\r
-            }\r
-            e = Ext.EventObject.setEvent(e);\r
-            var t;\r
-            if(o.delegate){\r
-                t = e.getTarget(o.delegate, el);\r
-                if(!t){\r
-                    return;\r
-                }\r
-            }else{\r
-                t = e.target;\r
-            }\r
-            if(o.stopEvent === true){\r
-                e.stopEvent();\r
-            }\r
-            if(o.preventDefault === true){\r
-               e.preventDefault();\r
-            }\r
-            if(o.stopPropagation === true){\r
-                e.stopPropagation();\r
-            }\r
-\r
-            if(o.normalized === false){\r
-                e = e.browserEvent;\r
-            }\r
-\r
-            fn.call(scope || el, e, t, o);\r
-        };\r
-        if(o.delay){\r
-            h = createDelayed(h, o);\r
+        if (ex = El.cache[el]) {\r
+            ex.dom = elm;\r
+        } else {\r
+            ex = El.cache[el] = new El(elm);\r
         }\r
-        if(o.single){\r
-            h = createSingle(h, el, ename, fn, scope);\r
+        return ex;\r
+    } else if (el.tagName) { // dom element\r
+        if(!(id = el.id)){\r
+            id = Ext.id(el);\r
         }\r
-        if(o.buffer){\r
-            h = createBuffered(h, o);\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
+        }\r
+        return docEl;\r
+    }\r
+    return null;\r
+};\r
 \r
-        addListener(el, ename, fn, h, scope);\r
-        return h;\r
-    };\r
-\r
-    var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;\r
-    var pub = {\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
 \r
-    \r
-        addListener : function(element, eventName, fn, scope, options){\r
-            if(typeof eventName == "object"){\r
-                var o = eventName;\r
-                for(var e in o){\r
-                    if(propRe.test(e)){\r
-                        continue;\r
-                    }\r
-                    if(typeof o[e] == "function"){\r
-                        // shared options\r
-                        listen(element, e, o, o[e], o.scope);\r
-                    }else{\r
-                        // individual options\r
-                        listen(element, e, o[e]);\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
+        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
-                return;\r
             }\r
-            return listen(element, eventName, options, fn, scope);\r
-        },\r
-\r
-        \r
-        removeListener : function(element, eventName, fn, scope){\r
-            return removeListener(element, eventName, fn, scope);\r
-        },\r
-\r
-        \r
-        removeAll : function(element){\r
-            return removeAll(element);\r
-        },\r
+        }\r
+    }\r
+}\r
+El.collectorThreadId = setInterval(garbageCollect, 30000);\r
 \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.clearListeners();\r
-                return;\r
-            }\r
-            if(!docReadyEvent){\r
-                initDocReady();\r
-            }\r
-            options = options || {};\r
-            if(!options.delay){\r
-                options.delay = 1;\r
-            }\r
-            docReadyEvent.addListener(fn, scope, options);\r
-        },\r
-        \r
-        // private\r
-        doResizeEvent: function(){\r
-            resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
-        },\r
+var flyFn = function(){};\r
+flyFn.prototype = El.prototype;\r
 \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
+// dom is optional\r
+El.Flyweight = function(dom){\r
+    this.dom = dom;\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
+El.Flyweight.prototype = new flyFn();\r
+El.Flyweight.prototype.isFlyweight = true;\r
+El._flyweights = {};\r
 \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
+ * <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
-        \r
-        removeResizeListener : function(fn, scope){\r
-            if(resizeEvent){\r
-                resizeEvent.removeListener(fn, scope);\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
-        // private\r
-        fireResize : function(){\r
-            if(resizeEvent){\r
-                resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
-            }\r
-        },\r
-        \r
-        ieDeferSrc : false,\r
-        \r
-        textResizeInterval : 50\r
-    };\r
-     \r
-    pub.on = pub.addListener;\r
-    \r
-    pub.un = pub.removeListener;\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
-    pub.stoppedMouseDownEvent = new Ext.util.Event();\r
-    return pub;\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
-Ext.onReady = Ext.EventManager.onDocumentReady;\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
 \r
-// Initialize doc classes\r
-(function(){\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.isSafari ? "ext-safari"\r
-                : Ext.isChrome ? "ext-chrome" : ""];\r
-\r
-        if(Ext.isMac){\r
-            cls.push("ext-mac");\r
-        }\r
-        if(Ext.isLinux){\r
-            cls.push("ext-linux");\r
-        }\r
-        if(Ext.isBorderBox){\r
-            cls.push('ext-border-box');\r
-        }\r
-        if(Ext.isStrict){ // 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-strict';\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
         }\r
-        bd.className += cls.join(' ');\r
-        return true;\r
-    }\r
-\r
-    if(!initExtCss()){\r
-        Ext.onReady(initExtCss);\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
-Ext.EventObject = function(){\r
+        html += '<span id="' + id + '"></span>';\r
 \r
-    var E = Ext.lib.Event;\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
+            }\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
-    // safari keypress events for special keys return bad keycodes\r
-    var 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
+        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
-    // normalize button clicks\r
-    var btnMap = Ext.isIE ? {1:0,4:1,2:2} :\r
-                (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});\r
+Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater;\r
 \r
-    Ext.EventObjectImpl = function(e){\r
-        if(e){\r
-            this.setEvent(e.browserEvent || e);\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
         }\r
-    };\r
-\r
-    Ext.EventObjectImpl.prototype = {\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
-        browserEvent : null,\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
-        button : -1,\r
+        xy = hash[anchor];     \r
+        return [xy[0] + extraX, xy[1] + extraY]; \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
-        shiftKey : false,\r
+        Ext.EventManager.onWindowResize(action, me);\r
         \r
-        ctrlKey : false,\r
-        \r
-        altKey : false,\r
-\r
-        \r
-        BACKSPACE: 8,\r
-        \r
-        TAB: 9,\r
-        \r
-        NUM_CENTER: 12,\r
-        \r
-        ENTER: 13,\r
-        \r
-        RETURN: 13,\r
-        \r
-        SHIFT: 16,\r
-        \r
-        CTRL: 17,\r
-        CONTROL : 17, // legacy\r
-        \r
-        ALT: 18,\r
-        \r
-        PAUSE: 19,\r
-        \r
-        CAPS_LOCK: 20,\r
-        \r
-        ESC: 27,\r
-        \r
-        SPACE: 32,\r
-        \r
-        PAGE_UP: 33,\r
-        PAGEUP : 33, // legacy\r
-        \r
-        PAGE_DOWN: 34,\r
-        PAGEDOWN : 34, // legacy\r
-        \r
-        END: 35,\r
-        \r
-        HOME: 36,\r
-        \r
-        LEFT: 37,\r
-        \r
-        UP: 38,\r
-        \r
-        RIGHT: 39,\r
-        \r
-        DOWN: 40,\r
-        \r
-        PRINT_SCREEN: 44,\r
-        \r
-        INSERT: 45,\r
-        \r
-        DELETE: 46,\r
-        \r
-        ZERO: 48,\r
-        \r
-        ONE: 49,\r
-        \r
-        TWO: 50,\r
-        \r
-        THREE: 51,\r
-        \r
-        FOUR: 52,\r
-        \r
-        FIVE: 53,\r
-        \r
-        SIX: 54,\r
-        \r
-        SEVEN: 55,\r
-        \r
-        EIGHT: 56,\r
-        \r
-        NINE: 57,\r
-        \r
-        A: 65,\r
-        \r
-        B: 66,\r
-        \r
-        C: 67,\r
-        \r
-        D: 68,\r
-        \r
-        E: 69,\r
-        \r
-        F: 70,\r
-        \r
-        G: 71,\r
-        \r
-        H: 72,\r
-        \r
-        I: 73,\r
-        \r
-        J: 74,\r
-        \r
-        K: 75,\r
-        \r
-        L: 76,\r
-        \r
-        M: 77,\r
-        \r
-        N: 78,\r
-        \r
-        O: 79,\r
-        \r
-        P: 80,\r
-        \r
-        Q: 81,\r
-        \r
-        R: 82,\r
-        \r
-        S: 83,\r
-        \r
-        T: 84,\r
-        \r
-        U: 85,\r
-        \r
-        V: 86,\r
-        \r
-        W: 87,\r
-        \r
-        X: 88,\r
-        \r
-        Y: 89,\r
-        \r
-        Z: 90,\r
-        \r
-        CONTEXT_MENU: 93,\r
-        \r
-        NUM_ZERO: 96,\r
-        \r
-        NUM_ONE: 97,\r
-        \r
-        NUM_TWO: 98,\r
-        \r
-        NUM_THREE: 99,\r
-        \r
-        NUM_FOUR: 100,\r
-        \r
-        NUM_FIVE: 101,\r
-        \r
-        NUM_SIX: 102,\r
-        \r
-        NUM_SEVEN: 103,\r
-        \r
-        NUM_EIGHT: 104,\r
-        \r
-        NUM_NINE: 105,\r
-        \r
-        NUM_MULTIPLY: 106,\r
-        \r
-        NUM_PLUS: 107,\r
-        \r
-        NUM_MINUS: 109,\r
-        \r
-        NUM_PERIOD: 110,\r
-        \r
-        NUM_DIVISION: 111,\r
-        \r
-        F1: 112,\r
-        \r
-        F2: 113,\r
-        \r
-        F3: 114,\r
-        \r
-        F4: 115,\r
-        \r
-        F5: 116,\r
-        \r
-        F6: 117,\r
-        \r
-        F7: 118,\r
-        \r
-        F8: 119,\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
+\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
-        F9: 120,\r
+        if(!el || !el.dom){\r
+            throw "Element.alignToXY with an element that doesn't exist";\r
+        }\r
         \r
-        F10: 121,\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
-        F11: 122,\r
+        if(!m){\r
+           throw "Element.alignTo with an invalid alignment " + p;\r
+        }\r
         \r
-        F12: 123,\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
-        setEvent : function(e){\r
-            if(e == this || (e && e.browserEvent)){ // already wrapped\r
-                return e;\r
-            }\r
-            this.browserEvent = e;\r
-            if(e){\r
-                // normalize buttons\r
-                this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);\r
-                if(e.type == 'click' && this.button == -1){\r
-                    this.button = 0;\r
-                }\r
-                this.type = e.type;\r
-                this.shiftKey = e.shiftKey;\r
-                // mac metaKey behaves like ctrlKey\r
-                this.ctrlKey = e.ctrlKey || e.metaKey;\r
-                this.altKey = e.altKey;\r
-                // in getKey these will be normalized for the mac\r
-                this.keyCode = e.keyCode;\r
-                this.charCode = e.charCode;\r
-                // cache the target for the delayed and or buffered events\r
-                this.target = E.getTarget(e);\r
-                // same for XY\r
-                this.xy = E.getXY(e);\r
-            }else{\r
-                this.button = -1;\r
-                this.shiftKey = false;\r
-                this.ctrlKey = false;\r
-                this.altKey = false;\r
-                this.keyCode = 0;\r
-                this.charCode = 0;\r
-                this.target = null;\r
-                this.xy = [0, 0];\r
-            }\r
-            return this;\r
-        },\r
 \r
-        \r
-        stopEvent : function(){\r
-            if(this.browserEvent){\r
-                if(this.browserEvent.type == 'mousedown'){\r
-                    Ext.EventManager.stoppedMouseDownEvent.fire(this);\r
-                }\r
-                E.stopEvent(this.browserEvent);\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
-        },\r
+           if (y < scrollY){\r
+               y = swapY ? r.bottom : scrollY;\r
+           }\r
+        }\r
+        return [x,y];\r
+    },\r
 \r
-        \r
-        preventDefault : function(){\r
-            if(this.browserEvent){\r
-                E.preventDefault(this.browserEvent);\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
-        \r
-        isNavKeyPress : function(){\r
-            var k = this.keyCode;\r
-            k = Ext.isSafari ? (safariKeys[k] || k) : k;\r
-            return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;\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
-        isSpecialKey : function(){\r
-            var k = this.keyCode;\r
-            return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13  || k == 40 || k == 27 ||\r
-            (k == 16) || (k == 17) ||\r
-            (k >= 18 && k <= 20) ||\r
-            (k >= 33 && k <= 35) ||\r
-            (k >= 36 && k <= 39) ||\r
-            (k >= 44 && k <= 45);\r
-        },\r
+        return function(el, local, offsets, proposedXY){\r
+            el = Ext.get(el);\r
+            offsets = offsets ? Ext.applyIf(offsets, os) : os;\r
 \r
-        \r
-        stopPropagation : function(){\r
-            if(this.browserEvent){\r
-                if(this.browserEvent.type == 'mousedown'){\r
-                    Ext.EventManager.stoppedMouseDownEvent.fire(this);\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
-                E.stopPropagation(this.browserEvent);\r
             }\r
-        },\r
 \r
-        \r
-        getCharCode : function(){\r
-            return this.charCode || this.keyCode;\r
-        },\r
+            var s = el.getScroll();\r
 \r
-        \r
-        getKey : function(){\r
-            var k = this.keyCode || this.charCode;\r
-            return Ext.isSafari ? (safariKeys[k] || k) : k;\r
-        },\r
+            vx += offsets.left + s.left;\r
+            vy += offsets.top + s.top;\r
 \r
-        \r
-        getPageX : function(){\r
-            return this.xy[0];\r
-        },\r
+            vw -= offsets.right;\r
+            vh -= offsets.bottom;\r
 \r
-        \r
-        getPageY : function(){\r
-            return this.xy[1];\r
-        },\r
+            var vr = vx+vw;\r
+            var vb = vy+vh;\r
 \r
-        \r
-        getTime : function(){\r
-            if(this.browserEvent){\r
-                return E.getTime(this.browserEvent);\r
-            }\r
-            return null;\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
-        \r
-        getXY : function(){\r
-            return this.xy;\r
-        },\r
+            // only move it if it needs it\r
+            var moved = false;\r
 \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
+            // 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
+/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods(function(){\r
+       var PARENTNODE = 'parentNode',\r
+               NEXTSIBLING = 'nextSibling',\r
+               PREVIOUSSIBLING = 'previousSibling',\r
+               DQ = Ext.DomQuery,\r
+               GET = Ext.get;\r
+       \r
+       return {\r
+               /**\r
+            * Looks at this node and then at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)\r
+            * @param {String} selector The simple selector to test\r
+            * @param {Number/Mixed} maxDepth (optional) The max depth to search as a number or element (defaults to 50 || document.body)\r
+            * @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node\r
+            * @return {HTMLElement} The matching DOM node (or null if no match was found)\r
+            */\r
+           findParent : function(simpleSelector, maxDepth, returnEl){\r
+               var p = this.dom,\r
+                       b = document.body, \r
+                       depth = 0,                      \r
+                       stopEl;         \r
+            if(Ext.isGecko && Object.prototype.toString.call(p) == '[object XULElement]') {\r
+                return null;\r
+            }\r
+               maxDepth = maxDepth || 50;\r
+               if (isNaN(maxDepth)) {\r
+                   stopEl = Ext.getDom(maxDepth);\r
+                   maxDepth = Number.MAX_VALUE;\r
+               }\r
+               while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){\r
+                   if(DQ.is(p, simpleSelector)){\r
+                       return returnEl ? GET(p) : p;\r
+                   }\r
+                   depth++;\r
+                   p = p.parentNode;\r
+               }\r
+               return null;\r
+           },\r
+       \r
+           /**\r
+            * Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)\r
+            * @param {String} selector The simple selector to test\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} The matching DOM node (or null if no match was found)\r
+            */\r
+           findParentNode : function(simpleSelector, maxDepth, returnEl){\r
+               var p = Ext.fly(this.dom.parentNode, '_internal');\r
+               return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;\r
+           },\r
+       \r
+           /**\r
+            * Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).\r
+            * This is a shortcut for findParentNode() that always returns an Ext.Element.\r
+            * @param {String} selector The simple selector to test\r
+            * @param {Number/Mixed} maxDepth (optional) The max depth to\r
+                   search as a number or element (defaults to 10 || document.body)\r
+            * @return {Ext.Element} The matching DOM node (or null if no match was found)\r
+            */\r
+           up : function(simpleSelector, maxDepth){\r
+               return this.findParentNode(simpleSelector, maxDepth, true);\r
+           },\r
+       \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
+           /**\r
+            * Selects child nodes based on the passed CSS selector (the selector should not contain an id).\r
+            * @param {String} selector The CSS selector\r
+            * @return {Array} An array of the matched nodes\r
+            */\r
+           query : function(selector, unique){\r
+               return DQ.select(selector, this.dom);\r
+           },\r
+       \r
+           /**\r
+            * Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).\r
+            * @param {String} selector The CSS selector\r
+            * @param {Boolean} returnDom (optional) True to return the DOM node instead of Ext.Element (defaults to false)\r
+            * @return {HTMLElement/Ext.Element} The child Ext.Element (or DOM node if returnDom = true)\r
+            */\r
+           child : function(selector, returnDom){\r
+               var n = DQ.selectNode(selector, this.dom);\r
+               return returnDom ? n : GET(n);\r
+           },\r
+       \r
+           /**\r
+            * Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id).\r
+            * @param {String} selector The CSS selector\r
+            * @param {Boolean} returnDom (optional) True to return the DOM node instead of Ext.Element (defaults to false)\r
+            * @return {HTMLElement/Ext.Element} The child Ext.Element (or DOM node if returnDom = true)\r
+            */\r
+           down : function(selector, returnDom){\r
+               var n = DQ.selectNode(" > " + selector, this.dom);\r
+               return returnDom ? n : GET(n);\r
+           },\r
+       \r
+                /**\r
+            * Gets the parent node for this element, optionally chaining up trying to match a selector\r
+            * @param {String} selector (optional) Find a parent node that matches the passed simple selector\r
+            * @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element\r
+            * @return {Ext.Element/HTMLElement} The parent node or null\r
+                */\r
+           parent : function(selector, returnDom){\r
+               return this.matchNode(PARENTNODE, PARENTNODE, selector, returnDom);\r
+           },\r
+       \r
+            /**\r
+            * Gets the next sibling, skipping text nodes\r
+            * @param {String} selector (optional) Find the next sibling that matches the passed simple selector\r
+            * @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element\r
+            * @return {Ext.Element/HTMLElement} The next sibling or null\r
+                */\r
+           next : function(selector, returnDom){\r
+               return this.matchNode(NEXTSIBLING, NEXTSIBLING, selector, returnDom);\r
+           },\r
+       \r
+           /**\r
+            * Gets the previous sibling, skipping text nodes\r
+            * @param {String} selector (optional) Find the previous sibling that matches the passed simple selector\r
+            * @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element\r
+            * @return {Ext.Element/HTMLElement} The previous sibling or null\r
+                */\r
+           prev : function(selector, returnDom){\r
+               return this.matchNode(PREVIOUSSIBLING, PREVIOUSSIBLING, selector, returnDom);\r
+           },\r
+       \r
+       \r
+           /**\r
+            * Gets the first child, skipping text nodes\r
+            * @param {String} selector (optional) Find the next sibling that matches the passed simple selector\r
+            * @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element\r
+            * @return {Ext.Element/HTMLElement} The first child or null\r
+                */\r
+           first : function(selector, returnDom){\r
+               return this.matchNode(NEXTSIBLING, 'firstChild', selector, returnDom);\r
+           },\r
+       \r
+           /**\r
+            * Gets the last child, skipping text nodes\r
+            * @param {String} selector (optional) Find the previous sibling that matches the passed simple selector\r
+            * @param {Boolean} returnDom (optional) True to return a raw dom node instead of an Ext.Element\r
+            * @return {Ext.Element/HTMLElement} The last child or null\r
+                */\r
+           last : function(selector, returnDom){\r
+               return this.matchNode(PREVIOUSSIBLING, 'lastChild', selector, returnDom);\r
+           },\r
+           \r
+           matchNode : function(dir, start, selector, returnDom){\r
+               var n = this.dom[start];\r
+               while(n){\r
+                   if(n.nodeType == 1 && (!selector || DQ.is(n, selector))){\r
+                       return !returnDom ? GET(n) : n;\r
+                   }\r
+                   n = n[dir];\r
+               }\r
+               return null;\r
+           }   \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
+       \r
+       return {\r
+           /**\r
+            * Appends the passed element(s) to this element\r
+            * @param {String/HTMLElement/Array/Element/CompositeElement} el\r
+            * @return {Ext.Element} this\r
+            */\r
+           appendChild: function(el){        \r
+               return GET(el).appendTo(this);        \r
+           },\r
+       \r
+           /**\r
+            * Appends this element to the passed element\r
+            * @param {Mixed} el The new parent element\r
+            * @return {Ext.Element} this\r
+            */\r
+           appendTo: function(el){        \r
+               GETDOM(el).appendChild(this.dom);        \r
+               return this;\r
+           },\r
+       \r
+           /**\r
+            * Inserts this element before the passed element in the DOM\r
+            * @param {Mixed} el The element before which this element will be inserted\r
+            * @return {Ext.Element} this\r
+            */\r
+           insertBefore: function(el){                   \r
+               (el = GETDOM(el)).parentNode.insertBefore(this.dom, el);\r
+               return this;\r
+           },\r
+       \r
+           /**\r
+            * Inserts this element after the passed element in the DOM\r
+            * @param {Mixed} el The element to insert after\r
+            * @return {Ext.Element} this\r
+            */\r
+           insertAfter: function(el){\r
+               (el = GETDOM(el)).parentNode.insertBefore(this.dom, el.nextSibling);\r
+               return this;\r
+           },\r
+       \r
+           /**\r
+            * Inserts (or creates) an element (or DomHelper config) as the first child of this element\r
+            * @param {Mixed/Object} el The id or element to insert or a DomHelper config to create and insert\r
+            * @return {Ext.Element} The new child\r
+            */\r
+           insertFirst: function(el, returnDom){\r
+            el = el || {};\r
+            if(isEl(el)){ // 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
+            * Replaces the passed element with this element\r
+            * @param {Mixed} el The element to replace\r
+            * @return {Ext.Element} this\r
+            */\r
+           replace: function(el){\r
+               el = GET(el);\r
+               this.insertBefore(el);\r
+               el.remove();\r
+               return this;\r
+           },\r
+       \r
+           /**\r
+            * Replaces this element with the passed element\r
+            * @param {Mixed/Object} el The new element or a DomHelper config of an element to create\r
+            * @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
-        getRelatedTarget : function(){\r
-            if(this.browserEvent){\r
-                return E.getRelatedTarget(this.browserEvent);\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
-            return null;\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
-        getWheelDelta : function(){\r
-            var e = this.browserEvent;\r
-            var delta = 0;\r
-            if(e.wheelDelta){ \r
-                delta = e.wheelDelta/120;\r
-            }else if(e.detail){ \r
-                delta = -e.detail/3;\r
-            }\r
-            return delta;\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
+        /**\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
-        hasModifier : function(){\r
-            return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;\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
+                \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
+            }else{\r
+                me.anim({opacity: {to: opacity}}, me.preanim(arguments, 1), null, .35, 'easeIn');\r
+            }\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
+            }else{\r
+                style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = '';\r
+            }\r
+            return this;\r
+        },\r
+    \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
+         */\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
+        },\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
+         */\r
+        getWidth : function(contentWidth){\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
+        },\r
+    \r
+        /**\r
+         * Set the width of this Element.\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
+         * </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 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
+            var me = this;\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
+            return me;\r
+        },\r
         \r
-        within : function(el, related, allowEl){\r
-            var t = this[related ? "getRelatedTarget" : "getTarget"]();\r
-            return t && ((allowEl ? (t === Ext.getDom(el)) : false) || Ext.fly(el).contains(t));\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
+         */\r
+        getBorderWidth : function(side){\r
+            return addStyles.call(this, side, borders);\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
+         */\r
+        getPadding : function(side){\r
+            return addStyles.call(this, side, paddings);\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
+         */\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
+        },\r
+    \r
+        /**\r
+         *  Return clipping (overflow) to original clipping before <tt>{@link #clip}</tt> was called\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
+                }\r
+            }\r
+            return me;\r
         },\r
+        \r
+        addStyles : addStyles,\r
+        margins : margins\r
+    }\r
+}()         \r
+);/**\r
+ * @class Ext.Element\r
+ */\r
 \r
-        getPoint : function(){\r
-            return new Ext.lib.Point(this.xy[0], this.xy[1]);\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
+         * @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
+\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
+        var vpSize = Ext.getBody().getViewSize();\r
+\r
+        // all Windows created afterwards will have a default value of 90% height and 95% width\r
+        Ext.Window.override({\r
+            width: vpSize.width * 0.9,\r
+            height: vpSize.height * 0.95\r
+        });\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
+\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
+            * 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
+                }\r
+                       return o;\r
+               } else {\r
+                   return me.addStyles.call(me, side, me.margins);\r
+               }\r
+           }\r
     };\r
+}());/**\r
+ * @class Ext.Element\r
+ */\r
+(function(){\r
+var D = Ext.lib.Dom,\r
+        LEFT = "left",\r
+        RIGHT = "right",\r
+        TOP = "top",\r
+        BOTTOM = "bottom",\r
+        POSITION = "position",\r
+        STATIC = "static",\r
+        RELATIVE = "relative",\r
+        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
-    return new Ext.EventObjectImpl();\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
+      * @return {Number} The X position of the element\r
+      */\r
+    getX : function(){\r
+        return D.getX(this.dom);\r
+    },\r
 \r
-(function(){\r
-var D = Ext.lib.Dom;\r
-var E = Ext.lib.Event;\r
-var A = Ext.lib.Anim;\r
+    /**\r
+      * Gets the current Y 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
+      * @return {Number} The Y position of the element\r
+      */\r
+    getY : function(){\r
+        return D.getY(this.dom);\r
+    },\r
 \r
-// local style camelizing for speed\r
-var propCache = {};\r
-var camelRe = /(-[a-z])/gi;\r
-var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };\r
-var view = document.defaultView;\r
+    /**\r
+      * Gets the current 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
+      * @return {Array} The XY position of the element\r
+      */\r
+    getXY : function(){\r
+        return D.getXY(this.dom);\r
+    },\r
 \r
-Ext.Element = function(element, forceNew){\r
-    var dom = typeof element == "string" ?\r
-            document.getElementById(element) : element;\r
-    if(!dom){ // invalid id/element\r
-        return null;\r
-    }\r
-    var id = dom.id;\r
-    if(forceNew !== true && id && Ext.Element.cache[id]){ // element object already exists\r
-        return Ext.Element.cache[id];\r
-    }\r
+    /**\r
+      * Returns the offsets of this element from the passed element. Both element must be part of the DOM tree and not have display:none to have page coordinates.\r
+      * @param {Mixed} element The element to get the offsets from.\r
+      * @return {Array} The XY page offsets (e.g. [100, -200])\r
+      */\r
+    getOffsetsTo : function(el){\r
+        var o = this.getXY(),\r
+               e = Ext.fly(el, '_internal').getXY();\r
+        return [o[0]-e[0],o[1]-e[1]];\r
+    },\r
 \r
-    \r
-    this.dom = dom;\r
+    /**\r
+     * Sets the 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
+     * @param {Number} The X position of the element\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
+    setX : function(x, animate){           \r
+           return this.setXY([x, this.getY()], animTest.call(this, arguments, animate, 1));\r
+    },\r
 \r
-    \r
-    this.id = id || Ext.id(dom);\r
-};\r
+    /**\r
+     * Sets the Y 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
+     * @param {Number} The Y position of the element\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
+    setY : function(y, animate){           \r
+           return this.setXY([this.getX(), y], animTest.call(this, arguments, animate, 1));\r
+    },\r
 \r
-var El = Ext.Element;\r
+    /**\r
+     * Sets the element's left position directly using CSS style (instead of {@link #setX}).\r
+     * @param {String} left The left CSS property value\r
+     * @return {Ext.Element} this\r
+     */\r
+    setLeft : function(left){\r
+        this.setStyle(LEFT, this.addUnits(left));\r
+        return this;\r
+    },\r
 \r
-El.prototype = {\r
-    \r
-    originalDisplay : "",\r
+    /**\r
+     * Sets the element's top position directly using CSS style (instead of {@link #setY}).\r
+     * @param {String} top The top CSS property value\r
+     * @return {Ext.Element} this\r
+     */\r
+    setTop : function(top){\r
+        this.setStyle(TOP, this.addUnits(top));\r
+        return this;\r
+    },\r
 \r
-    visibilityMode : 1,\r
-    \r
-    defaultUnit : "px",\r
-    \r
-    setVisibilityMode : function(visMode){\r
-        this.visibilityMode = visMode;\r
+    /**\r
+     * Sets the element's CSS right style.\r
+     * @param {String} right The right CSS property value\r
+     * @return {Ext.Element} this\r
+     */\r
+    setRight : function(right){\r
+        this.setStyle(RIGHT, this.addUnits(right));\r
         return this;\r
     },\r
-    \r
-    enableDisplayMode : function(display){\r
-        this.setVisibilityMode(El.DISPLAY);\r
-        if(typeof display != "undefined") this.originalDisplay = display;\r
+\r
+    /**\r
+     * Sets the element's CSS bottom style.\r
+     * @param {String} bottom The bottom CSS property value\r
+     * @return {Ext.Element} this\r
+     */\r
+    setBottom : function(bottom){\r
+        this.setStyle(BOTTOM, this.addUnits(bottom));\r
         return this;\r
     },\r
 \r
-    \r
-    findParent : function(simpleSelector, maxDepth, returnEl){\r
-        var p = this.dom, b = document.body, depth = 0, dq = Ext.DomQuery, stopEl;\r
-        maxDepth = maxDepth || 50;\r
-        if(typeof maxDepth != "number"){\r
-            stopEl = Ext.getDom(maxDepth);\r
-            maxDepth = 10;\r
-        }\r
-        while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){\r
-            if(dq.is(p, simpleSelector)){\r
-                return returnEl ? Ext.get(p) : p;\r
-            }\r
-            depth++;\r
-            p = p.parentNode;\r
+    /**\r
+     * Sets the position of the element in page coordinates, regardless of how the element is positioned.\r
+     * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+     * @param {Array} pos Contains X & Y [x, y] values for new position (coordinates are page-based)\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
+    setXY : function(pos, animate){\r
+           var me = this;\r
+        if(!animate || !me.anim){\r
+            D.setXY(me.dom, pos);\r
+        }else{\r
+            me.anim({points: {to: pos}}, me.preanim(arguments, 1), 'motion');\r
         }\r
-        return null;\r
+        return me;\r
     },\r
 \r
-\r
-    \r
-    findParentNode : function(simpleSelector, maxDepth, returnEl){\r
-        var p = Ext.fly(this.dom.parentNode, '_internal');\r
-        return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;\r
+    /**\r
+     * Sets the position of the element in page coordinates, regardless of how the element is positioned.\r
+     * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+     * @param {Number} x X value for new position (coordinates are page-based)\r
+     * @param {Number} y Y value for new position (coordinates are page-based)\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
+    setLocation : function(x, y, animate){\r
+        return this.setXY([x, y], animTest.call(this, arguments, animate, 2));\r
     },\r
 \r
-    \r
-    up : function(simpleSelector, maxDepth){\r
-        return this.findParentNode(simpleSelector, maxDepth, true);\r
+    /**\r
+     * Sets the position of the element in page coordinates, regardless of how the element is positioned.\r
+     * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).\r
+     * @param {Number} x X value for new position (coordinates are page-based)\r
+     * @param {Number} y Y value for new position (coordinates are page-based)\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
+    moveTo : function(x, y, animate){\r
+        return this.setXY([x, y], animTest.call(this, arguments, animate, 2));        \r
+    },    \r
+    \r
+    /**\r
+     * Gets the left X coordinate\r
+     * @param {Boolean} local True to get the local css position instead of page coordinate\r
+     * @return {Number}\r
+     */\r
+    getLeft : function(local){\r
+           return !local ? this.getX() : parseInt(this.getStyle(LEFT), 10) || 0;\r
     },\r
 \r
+    /**\r
+     * Gets the right X coordinate of the element (element X position + element width)\r
+     * @param {Boolean} local True to get the local css position instead of page coordinate\r
+     * @return {Number}\r
+     */\r
+    getRight : function(local){\r
+           var me = this;\r
+           return !local ? me.getX() + me.getWidth() : (me.getLeft(true) + me.getWidth()) || 0;\r
+    },\r
 \r
+    /**\r
+     * Gets the top Y coordinate\r
+     * @param {Boolean} local True to get the local css position instead of page coordinate\r
+     * @return {Number}\r
+     */\r
+    getTop : function(local) {\r
+           return !local ? this.getY() : parseInt(this.getStyle(TOP), 10) || 0;\r
+    },\r
 \r
-    \r
-    is : function(simpleSelector){\r
-        return Ext.DomQuery.is(this.dom, simpleSelector);\r
+    /**\r
+     * Gets the bottom Y coordinate of the element (element Y position + element height)\r
+     * @param {Boolean} local True to get the local css position instead of page coordinate\r
+     * @return {Number}\r
+     */\r
+    getBottom : function(local){\r
+           var me = this;\r
+           return !local ? me.getY() + me.getHeight() : (me.getTop(true) + me.getHeight()) || 0;\r
+    },\r
+\r
+    /**\r
+    * Initializes positioning on this element. If a desired position is not passed, it will make the\r
+    * the element positioned relative IF it is not already positioned.\r
+    * @param {String} pos (optional) Positioning to use "relative", "absolute" or "fixed"\r
+    * @param {Number} zIndex (optional) The zIndex to apply\r
+    * @param {Number} x (optional) Set the page X position\r
+    * @param {Number} y (optional) Set the page Y position\r
+    */\r
+    position : function(pos, zIndex, x, y){\r
+           var me = this;\r
+           \r
+        if(!pos && me.isStyle(POSITION, STATIC)){           \r
+            me.setStyle(POSITION, RELATIVE);           \r
+        } else if(pos) {\r
+            me.setStyle(POSITION, pos);\r
+        }\r
+        if(zIndex){\r
+            me.setStyle(ZINDEX, zIndex);\r
+        }\r
+        if(x || y) me.setXY([x || false, y || false]);\r
     },\r
 \r
-    \r
-    animate : function(args, duration, onComplete, easing, animType){\r
-        this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);\r
+    /**\r
+    * Clear positioning back to the default when the document was loaded\r
+    * @param {String} value (optional) The value to use for the left,right,top,bottom, defaults to '' (empty string). You could use 'auto'.\r
+    * @return {Ext.Element} this\r
+     */\r
+    clearPositioning : function(value){\r
+        value = value || '';\r
+        this.setStyle({\r
+            left : value,\r
+            right : value,\r
+            top : value,\r
+            bottom : value,\r
+            "z-index" : "",\r
+            position : STATIC\r
+        });\r
         return this;\r
     },\r
 \r
-    \r
-    anim : function(args, opt, animType, defaultDur, defaultEase, cb){\r
-        animType = animType || 'run';\r
-        opt = opt || {};\r
-        var anim = Ext.lib.Anim[animType](\r
-            this.dom, args,\r
-            (opt.duration || defaultDur) || .35,\r
-            (opt.easing || defaultEase) || 'easeOut',\r
-            function(){\r
-                Ext.callback(cb, this);\r
-                Ext.callback(opt.callback, opt.scope || this, [this, opt]);\r
-            },\r
-            this\r
-        );\r
-        opt.anim = anim;\r
-        return anim;\r
+    /**\r
+    * Gets an object with all CSS positioning properties. Useful along with setPostioning to get\r
+    * snapshot before performing an update and then restoring the element.\r
+    * @return {Object}\r
+    */\r
+    getPositioning : function(){\r
+        var l = this.getStyle(LEFT);\r
+        var t = this.getStyle(TOP);\r
+        return {\r
+            "position" : this.getStyle(POSITION),\r
+            "left" : l,\r
+            "right" : l ? "" : this.getStyle(RIGHT),\r
+            "top" : t,\r
+            "bottom" : t ? "" : this.getStyle(BOTTOM),\r
+            "z-index" : this.getStyle(ZINDEX)\r
+        };\r
     },\r
+    \r
+    /**\r
+    * Set positioning with an object returned by getPositioning().\r
+    * @param {Object} posCfg\r
+    * @return {Ext.Element} this\r
+     */\r
+    setPositioning : function(pc){\r
+           var me = this,\r
+               style = me.dom.style;\r
+               \r
+        me.setStyle(pc);\r
+        \r
+        if(pc.right == AUTO){\r
+            style.right = "";\r
+        }\r
+        if(pc.bottom == AUTO){\r
+            style.bottom = "";\r
+        }\r
+        \r
+        return me;\r
+    },    \r
+       \r
+    /**\r
+     * Translates the passed page coordinates into left/top css values for this element\r
+     * @param {Number/Array} x The page x or an array containing [x, y]\r
+     * @param {Number} y (optional) The page y, required if x is not an array\r
+     * @return {Object} An object with left and top properties. e.g. {left: (value), top: (value)}\r
+     */\r
+    translatePoints : function(x, y){               \r
+           y = isNaN(x[1]) ? y : x[1];\r
+        x = isNaN(x[0]) ? x : x[0];\r
+        var me = this,\r
+               relative = me.isStyle(POSITION, RELATIVE),\r
+               o = me.getXY(),\r
+               l = parseInt(me.getStyle(LEFT), 10),\r
+               t = parseInt(me.getStyle(TOP), 10);\r
+        \r
+        l = !isNaN(l) ? l : (relative ? 0 : me.dom.offsetLeft);\r
+        t = !isNaN(t) ? t : (relative ? 0 : me.dom.offsetTop);        \r
 \r
-    // private legacy anim prep\r
-    preanim : function(a, i){\r
-        return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});\r
+        return {left: (x - o[0] + l), top: (y - o[1] + t)}; \r
     },\r
-\r
     \r
-    clean : function(forceReclean){\r
-        if(this.isCleaned && forceReclean !== true){\r
-            return this;\r
+    animTest : animTest\r
+});\r
+})();/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods({\r
+    /**\r
+     * Sets the element's box. Use getBox() on another element to get a box obj. If animate is true then width, height, x and y will be animated concurrently.\r
+     * @param {Object} box The box to fill {x, y, width, height}\r
+     * @param {Boolean} adjust (optional) Whether to adjust for box-model issues automatically\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
+    setBox : function(box, adjust, animate){\r
+        var me = this,\r
+               w = box.width, \r
+               h = box.height;\r
+        if((adjust && !me.autoBoxAdjust) && !me.isBorderBox()){\r
+           w -= (me.getBorderWidth("lr") + me.getPadding("lr"));\r
+           h -= (me.getBorderWidth("tb") + me.getPadding("tb"));\r
+        }\r
+        me.setBounds(box.x, box.y, w, h, me.animTest.call(me, arguments, animate, 2));\r
+        return me;\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
+     * @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
+     */\r
+       getBox : function(contentBox, local) {      \r
+           var me = this,\r
+               xy,\r
+               left,\r
+               top,\r
+               getBorderWidth = me.getBorderWidth,\r
+               getPadding = me.getPadding, \r
+               l,\r
+               r,\r
+               t,\r
+               b;\r
+        if(!local){\r
+            xy = me.getXY();\r
+        }else{\r
+            left = parseInt(me.getStyle("left"), 10) || 0;\r
+            top = parseInt(me.getStyle("top"), 10) || 0;\r
+            xy = [left, top];\r
         }\r
-        var ns = /\S/;\r
-        var d = this.dom, n = d.firstChild, ni = -1;\r
-           while(n){\r
-               var nx = n.nextSibling;\r
-               if(n.nodeType == 3 && !ns.test(n.nodeValue)){\r
-                   d.removeChild(n);\r
-               }else{\r
-                   n.nodeIndex = ++ni;\r
-               }\r
-               n = nx;\r
-           }\r
-           this.isCleaned = true;\r
-           return this;\r
-       },\r
+        var el = me.dom, w = el.offsetWidth, h = el.offsetHeight, bx;\r
+        if(!contentBox){\r
+            bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};\r
+        }else{\r
+            l = getBorderWidth.call(me, "l") + getPadding.call(me, "l");\r
+            r = getBorderWidth.call(me, "r") + getPadding.call(me, "r");\r
+            t = getBorderWidth.call(me, "t") + getPadding.call(me, "t");\r
+            b = getBorderWidth.call(me, "b") + getPadding.call(me, "b");\r
+            bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};\r
+        }\r
+        bx.right = bx.x + bx.width;\r
+        bx.bottom = bx.y + bx.height;\r
+        return bx;\r
+       },\r
+       \r
+    /**\r
+     * Move this element relative to its current position.\r
+     * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").\r
+     * @param {Number} distance How far to move the element in pixels\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
+     move : function(direction, distance, animate){\r
+        var me = this,         \r
+               xy = me.getXY(),\r
+               x = xy[0],\r
+               y = xy[1],              \r
+               left = [x - distance, y],\r
+               right = [x + distance, y],\r
+               top = [x, y - distance],\r
+               bottom = [x, y + distance],\r
+               hash = {\r
+                       l :     left,\r
+                       left : left,\r
+                       r : right,\r
+                       right : right,\r
+                       t : top,\r
+                       top : top,\r
+                       up : top,\r
+                       b : bottom, \r
+                       bottom : bottom,\r
+                       down : bottom                           \r
+               };\r
+        \r
+           direction = direction.toLowerCase();    \r
+           me.moveTo(hash[direction][0], hash[direction][1], me.animTest.call(me, arguments, animate, 2));\r
+    },\r
+    \r
+    /**\r
+     * Quick set left and top adding default units\r
+     * @param {String} left The left CSS property value\r
+     * @param {String} top The top CSS property value\r
+     * @return {Ext.Element} this\r
+     */\r
+     setLeftTop : function(left, top){\r
+           var me = this,\r
+               style = me.dom.style;\r
+        style.left = me.addUnits(left);\r
+        style.top = me.addUnits(top);\r
+        return me;\r
+    },\r
+    \r
+    /**\r
+     * Returns the region of the given element.\r
+     * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).\r
+     * @return {Region} A Ext.lib.Region containing "top, left, bottom, right" member data.\r
+     */\r
+    getRegion : function(){\r
+        return Ext.lib.Dom.getRegion(this.dom);\r
+    },\r
+    \r
+    /**\r
+     * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.\r
+     * @param {Number} x X value for new position (coordinates are page-based)\r
+     * @param {Number} y Y value for new position (coordinates are page-based)\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
+     * </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
+     * @return {Ext.Element} this\r
+     */\r
+    setBounds : function(x, y, width, height, animate){\r
+           var me = this;\r
+        if (!animate || !me.anim) {\r
+            me.setSize(width, height);\r
+            me.setLocation(x, y);\r
+        } else {\r
+            me.anim({points: {to: [x, y]}, \r
+                        width: {to: me.adjustWidth(width)}, \r
+                        height: {to: me.adjustHeight(height)}},\r
+                     me.preanim(arguments, 4), \r
+                     'motion');\r
+        }\r
+        return me;\r
+    },\r
+\r
+    /**\r
+     * Sets the element's position and size the specified region. If animation is true then width, height, x and y will be animated concurrently.\r
+     * @param {Ext.lib.Region} region The region to fill\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
+    setRegion : function(region, animate) {\r
+        return this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.animTest.call(this, arguments, animate, 1));\r
+    }\r
+});/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods({\r
+    /**\r
+     * Returns true if this element is scrollable.\r
+     * @return {Boolean}\r
+     */\r
+    isScrollable : function(){\r
+        var dom = this.dom;\r
+        return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;\r
+    },\r
 \r
+    /**\r
+     * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().\r
+     * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.\r
+     * @param {Number} value The new scroll value.\r
+     * @return {Element} this\r
+     */\r
+    scrollTo : function(side, value){\r
+        this.dom["scroll" + (/top/i.test(side) ? "Top" : "Left")] = value;\r
+        return this;\r
+    },\r
+\r
+    /**\r
+     * Returns the current scroll position of the element.\r
+     * @return {Object} An object containing the scroll position in the format {left: (scrollLeft), top: (scrollTop)}\r
+     */\r
+    getScroll : function(){\r
+        var d = this.dom, \r
+            doc = document,\r
+            body = doc.body,\r
+            docElement = doc.documentElement,\r
+            l,\r
+            t,\r
+            ret;\r
+\r
+        if(d == doc || d == body){\r
+            if(Ext.isIE && Ext.isStrict){\r
+                l = docElement.scrollLeft; \r
+                t = docElement.scrollTop;\r
+            }else{\r
+                l = window.pageXOffset;\r
+                t = window.pageYOffset;\r
+            }\r
+            ret = {left: l || (body ? body.scrollLeft : 0), top: t || (body ? body.scrollTop : 0)};\r
+        }else{\r
+            ret = {left: d.scrollLeft, top: d.scrollTop};\r
+        }\r
+        return ret;\r
+    }\r
+});/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods({\r
+    /**\r
+     * Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().\r
+     * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.\r
+     * @param {Number} value The new scroll value\r
+     * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
+     * @return {Element} this\r
+     */\r
+    scrollTo : function(side, value, animate){\r
+        var tester = /top/i,\r
+               prop = "scroll" + (tester.test(side) ? "Top" : "Left"),\r
+               me = this,\r
+               dom = me.dom;\r
+        if (!animate || !me.anim) {\r
+            dom[prop] = value;\r
+        } else {\r
+            me.anim({scroll: {to: tester.test(prop) ? [dom[prop], value] : [value, dom[prop]]}},\r
+                        me.preanim(arguments, 2), 'scroll');\r
+        }\r
+        return me;\r
+    },\r
     \r
+    /**\r
+     * Scrolls this element into view within the passed container.\r
+     * @param {Mixed} container (optional) The container element to scroll (defaults to document.body).  Should be a\r
+     * string (id), dom node, or Ext.Element.\r
+     * @param {Boolean} hscroll (optional) False to disable horizontal scroll (defaults to true)\r
+     * @return {Ext.Element} this\r
+     */\r
     scrollIntoView : function(container, hscroll){\r
-        var c = Ext.getDom(container) || Ext.getBody().dom;\r
-        var el = this.dom;\r
-\r
-        var o = this.getOffsetsTo(c),\r
+        var c = Ext.getDom(container) || Ext.getBody().dom,\r
+               el = this.dom,\r
+               o = this.getOffsetsTo(c),\r
             l = o[0] + c.scrollLeft,\r
             t = o[1] + c.scrollTop,\r
-            b = t+el.offsetHeight,\r
-            r = l+el.offsetWidth;\r
-\r
-        var ch = c.clientHeight;\r
-        var ct = parseInt(c.scrollTop, 10);\r
-        var cl = parseInt(c.scrollLeft, 10);\r
-        var cb = ct + ch;\r
-        var cr = cl + c.clientWidth;\r
-\r
-        if(el.offsetHeight > ch || t < ct){\r
+            b = t + el.offsetHeight,\r
+            r = l + el.offsetWidth,\r
+               ch = c.clientHeight,\r
+               ct = parseInt(c.scrollTop, 10),\r
+               cl = parseInt(c.scrollLeft, 10),\r
+               cb = ct + ch,\r
+               cr = cl + c.clientWidth;\r
+\r
+        if (el.offsetHeight > ch || t < ct) {\r
                c.scrollTop = t;\r
-        }else if(b > cb){\r
+        } else if (b > cb){\r
             c.scrollTop = b-ch;\r
         }\r
         c.scrollTop = c.scrollTop; // corrects IE, other browsers will ignore\r
@@ -2441,7 +6390,7 @@ El.prototype = {
                        if(el.offsetWidth > c.clientWidth || l < cl){\r
                 c.scrollLeft = l;\r
             }else if(r > cr){\r
-                c.scrollLeft = r-c.clientWidth;\r
+                c.scrollLeft = r - c.clientWidth;\r
             }\r
             c.scrollLeft = c.scrollLeft;\r
         }\r
@@ -2452,34612 +6401,59210 @@ El.prototype = {
     scrollChildIntoView : function(child, hscroll){\r
         Ext.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);\r
     },\r
-\r
     \r
-    autoHeight : function(animate, duration, onComplete, easing){\r
-        var oldHeight = this.getHeight();\r
-        this.clip();\r
-        this.setHeight(1); // force clipping\r
-        setTimeout(function(){\r
-            var height = parseInt(this.dom.scrollHeight, 10); // parseInt for Safari\r
-            if(!animate){\r
-                this.setHeight(height);\r
-                this.unclip();\r
-                if(typeof onComplete == "function"){\r
-                    onComplete();\r
-                }\r
-            }else{\r
-                this.setHeight(oldHeight); // restore original height\r
-                this.setHeight(height, animate, duration, function(){\r
-                    this.unclip();\r
-                    if(typeof onComplete == "function") onComplete();\r
-                }.createDelegate(this), easing);\r
-            }\r
-        }.createDelegate(this), 0);\r
-        return this;\r
-    },\r
-\r
-    \r
-    contains : function(el){\r
-        if(!el){return false;}\r
-        return D.isAncestor(this.dom, el.dom ? el.dom : el);\r
-    },\r
-\r
-    \r
-    isVisible : function(deep) {\r
-        var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");\r
-        if(deep !== true || !vis){\r
-            return vis;\r
-        }\r
-        var p = this.dom.parentNode;\r
-        while(p && p.tagName.toLowerCase() != "body"){\r
-            if(!Ext.fly(p, '_isVisible').isVisible()){\r
-                return false;\r
+    /**\r
+     * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is\r
+     * within this element's scrollable range.\r
+     * @param {String} direction Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").\r
+     * @param {Number} distance How far to scroll the element in pixels\r
+     * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object\r
+     * @return {Boolean} Returns true if a scroll was triggered or false if the element\r
+     * was scrolled as far as it could go.\r
+     */\r
+     scroll : function(direction, distance, animate){\r
+         if(!this.isScrollable()){\r
+             return;\r
+         }\r
+         var el = this.dom,\r
+            l = el.scrollLeft, t = el.scrollTop,\r
+            w = el.scrollWidth, h = el.scrollHeight,\r
+            cw = el.clientWidth, ch = el.clientHeight,\r
+            scrolled = false, v,\r
+            hash = {\r
+                l: Math.min(l + distance, w-cw),\r
+                r: v = Math.max(l - distance, 0),\r
+                t: Math.max(t - distance, 0),\r
+                b: Math.min(t + distance, h-ch)\r
+            };\r
+            hash.d = hash.b;\r
+            hash.u = hash.t;\r
+            \r
+         direction = direction.substr(0, 1);\r
+         if((v = hash[direction]) > -1){\r
+            scrolled = true;\r
+            this.scrollTo(direction == 'l' || direction == 'r' ? 'left' : 'top', v, this.preanim(arguments, 2));\r
+         }\r
+         return scrolled;\r
+    }\r
+});/**\r
+ * @class Ext.Element\r
+ */\r
+/**\r
+ * Visibility mode constant for use with {@link #setVisibilityMode}. Use visibility to hide element\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.Element.VISIBILITY = 1;\r
+/**\r
+ * Visibility mode constant for use with {@link #setVisibilityMode}. Use display to hide element\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.Element.DISPLAY = 2;\r
+\r
+Ext.Element.addMethods(function(){\r
+    var VISIBILITY = "visibility",\r
+        DISPLAY = "display",\r
+        HIDDEN = "hidden",\r
+        NONE = "none",      \r
+        ORIGINALDISPLAY = 'originalDisplay',\r
+        VISMODE = 'visibilityMode',\r
+        ELDISPLAY = Ext.Element.DISPLAY,\r
+        data = Ext.Element.data,\r
+        getDisplay = function(dom){\r
+            var d = data(dom, ORIGINALDISPLAY);\r
+            if(d === undefined){\r
+                data(dom, ORIGINALDISPLAY, d = '');\r
+            }\r
+            return d;\r
+        },\r
+        getVisMode = function(dom){\r
+            var m = data(dom, VISMODE);\r
+            if(m === undefined){\r
+                data(dom, VISMODE, m = 1)\r
             }\r
-            p = p.parentNode;\r
-        }\r
-        return true;\r
-    },\r
-\r
-    \r
-    select : function(selector, unique){\r
-        return El.select(selector, unique, this.dom);\r
-    },\r
-\r
-    \r
-    query : function(selector){\r
-        return Ext.DomQuery.select(selector, this.dom);\r
-    },\r
-\r
-    \r
-    child : function(selector, returnDom){\r
-        var n = Ext.DomQuery.selectNode(selector, this.dom);\r
-        return returnDom ? n : Ext.get(n);\r
-    },\r
-\r
-    \r
-    down : function(selector, returnDom){\r
-        var n = Ext.DomQuery.selectNode(" > " + selector, this.dom);\r
-        return returnDom ? n : Ext.get(n);\r
-    },\r
-\r
-    \r
-    initDD : function(group, config, overrides){\r
-        var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);\r
-        return Ext.apply(dd, overrides);\r
-    },\r
-\r
-    \r
-    initDDProxy : function(group, config, overrides){\r
-        var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);\r
-        return Ext.apply(dd, overrides);\r
-    },\r
-\r
-    \r
-    initDDTarget : function(group, config, overrides){\r
-        var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);\r
-        return Ext.apply(dd, overrides);\r
-    },\r
-\r
+            return m;\r
+        };\r
     \r
-     setVisible : function(visible, animate){\r
-        if(!animate || !A){\r
-            if(this.visibilityMode == El.DISPLAY){\r
-                this.setDisplayed(visible);\r
-            }else{\r
-                this.fixDisplay();\r
-                this.dom.style.visibility = visible ? "visible" : "hidden";\r
-            }\r
-        }else{\r
-            // closure for composites\r
-            var dom = this.dom;\r
-            var visMode = this.visibilityMode;\r
-            if(visible){\r
-                this.setOpacity(.01);\r
-                this.setVisible(true);\r
-            }\r
-            this.anim({opacity: { to: (visible?1:0) }},\r
-                  this.preanim(arguments, 1),\r
-                  null, .35, 'easeIn', function(){\r
-                     if(!visible){\r
-                         if(visMode == El.DISPLAY){\r
-                             dom.style.display = "none";\r
-                         }else{\r
-                             dom.style.visibility = "hidden";\r
-                         }\r
-                         Ext.get(dom).setOpacity(1);\r
-                     }\r
-                 });\r
+    return {\r
+        /**\r
+         * The element's default display mode  (defaults to "")\r
+         * @type String\r
+         */\r
+        originalDisplay : "",\r
+        visibilityMode : 1,\r
+        \r
+        /**\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
+         * @return {Ext.Element} this\r
+         */\r
+        setVisibilityMode : function(visMode){  \r
+            data(this.dom, VISMODE, visMode);\r
+            return this;\r
+        },\r
+        \r
+        /**\r
+         * Perform custom animation on this element.\r
+         * <div><ul class="mdetail-params">\r
+         * <li><u>Animation Properties</u></li>\r
+         * \r
+         * <p>The Animation Control Object enables gradual transitions for any member of an\r
+         * element's style object that takes a numeric value including but not limited to\r
+         * these properties:</p><div><ul class="mdetail-params">\r
+         * <li><tt>bottom, top, left, right</tt></li>\r
+         * <li><tt>height, width</tt></li>\r
+         * <li><tt>margin, padding</tt></li>\r
+         * <li><tt>borderWidth</tt></li>\r
+         * <li><tt>opacity</tt></li>\r
+         * <li><tt>fontSize</tt></li>\r
+         * <li><tt>lineHeight</tt></li>\r
+         * </ul></div>\r
+         * \r
+         * \r
+         * <li><u>Animation Property Attributes</u></li>\r
+         * \r
+         * <p>Each Animation Property is a config object with optional properties:</p>\r
+         * <div><ul class="mdetail-params">\r
+         * <li><tt>by</tt>*  : relative change - start at current value, change by this value</li>\r
+         * <li><tt>from</tt> : ignore current value, start from this value</li>\r
+         * <li><tt>to</tt>*  : start at current value, go to this value</li>\r
+         * <li><tt>unit</tt> : any allowable unit specification</li>\r
+         * <p>* do not specify both <tt>to</tt> and <tt>by</tt> for an animation property</p>\r
+         * </ul></div>\r
+         * \r
+         * <li><u>Animation Types</u></li>\r
+         * \r
+         * <p>The supported animation types:</p><div><ul class="mdetail-params">\r
+         * <li><tt>'run'</tt> : Default\r
+         * <pre><code>\r
+var el = Ext.get('complexEl');\r
+el.animate(\r
+    // animation control object\r
+    {\r
+        borderWidth: {to: 3, from: 0},\r
+        opacity: {to: .3, from: 1},\r
+        height: {to: 50, from: el.getHeight()},\r
+        width: {to: 300, from: el.getWidth()},\r
+        top  : {by: - 100, unit: 'px'},\r
+    },\r
+    0.35,      // animation duration\r
+    null,      // callback\r
+    'easeOut', // easing method\r
+    'run'      // animation type ('run','color','motion','scroll')    \r
+);\r
+         * </code></pre>\r
+         * </li>\r
+         * <li><tt>'color'</tt>\r
+         * <p>Animates transition of background, text, or border colors.</p>\r
+         * <pre><code>\r
+el.animate(\r
+    // animation control object\r
+    {\r
+        color: { to: '#06e' },\r
+        backgroundColor: { to: '#e06' }\r
+    },\r
+    0.35,      // animation duration\r
+    null,      // callback\r
+    'easeOut', // easing method\r
+    'color'    // animation type ('run','color','motion','scroll')    \r
+);\r
+         * </code></pre> \r
+         * </li>\r
+         * \r
+         * <li><tt>'motion'</tt>\r
+         * <p>Animates the motion of an element to/from specific points using optional bezier\r
+         * way points during transit.</p>\r
+         * <pre><code>\r
+el.animate(\r
+    // animation control object\r
+    {\r
+        borderWidth: {to: 3, from: 0},\r
+        opacity: {to: .3, from: 1},\r
+        height: {to: 50, from: el.getHeight()},\r
+        width: {to: 300, from: el.getWidth()},\r
+        top  : {by: - 100, unit: 'px'},\r
+        points: {\r
+            to: [50, 100],  // go to this point\r
+            control: [      // optional bezier way points\r
+                [ 600, 800],\r
+                [-100, 200]\r
+            ]\r
         }\r
-        return this;\r
-    },\r
-\r
-    \r
-    isDisplayed : function() {\r
-        return this.getStyle("display") != "none";\r
-    },\r
-\r
-    \r
-    toggle : function(animate){\r
-        this.setVisible(!this.isVisible(), this.preanim(arguments, 0));\r
-        return this;\r
     },\r
-\r
+    3000,      // animation duration (milliseconds!)\r
+    null,      // callback\r
+    'easeOut', // easing method\r
+    'motion'   // animation type ('run','color','motion','scroll')    \r
+);\r
+         * </code></pre> \r
+         * </li>\r
+         * <li><tt>'scroll'</tt>\r
+         * <p>Animate horizontal or vertical scrolling of an overflowing page element.</p>\r
+         * <pre><code>\r
+el.animate(\r
+    // animation control object\r
+    {\r
+        scroll: {to: [400, 300]}\r
+    },\r
+    0.35,      // animation duration\r
+    null,      // callback\r
+    'easeOut', // easing method\r
+    'scroll'   // animation type ('run','color','motion','scroll')    \r
+);\r
+         * </code></pre> \r
+         * </li>\r
+         * </ul></div>\r
+         * \r
+         * </ul></div>\r
+         * \r
+         * @param {Object} args The animation control args\r
+         * @param {Float} duration (optional) How long the animation lasts in seconds (defaults to <tt>.35</tt>)\r
+         * @param {Function} onComplete (optional) Function to call when animation completes\r
+         * @param {String} easing (optional) {@link Ext.Fx#easing} method to use (defaults to <tt>'easeOut'</tt>)\r
+         * @param {String} animType (optional) <tt>'run'</tt> is the default. Can also be <tt>'color'</tt>,\r
+         * <tt>'motion'</tt>, or <tt>'scroll'</tt>\r
+         * @return {Ext.Element} this\r
+         */\r
+        animate : function(args, duration, onComplete, easing, animType){       \r
+            this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);\r
+            return this;\r
+        },\r
     \r
-    setDisplayed : function(value) {\r
-        if(typeof value == "boolean"){\r
-           value = value ? this.originalDisplay : "none";\r
-        }\r
-        this.setStyle("display", value);\r
-        return this;\r
-    },\r
-\r
+        /*\r
+         * @private Internal animation call\r
+         */\r
+        anim : function(args, opt, animType, defaultDur, defaultEase, cb){\r
+            animType = animType || 'run';\r
+            opt = opt || {};\r
+            var me = this,              \r
+                anim = Ext.lib.Anim[animType](\r
+                    me.dom, \r
+                    args,\r
+                    (opt.duration || defaultDur) || .35,\r
+                    (opt.easing || defaultEase) || 'easeOut',\r
+                    function(){\r
+                        if(cb) cb.call(me);\r
+                        if(opt.callback) opt.callback.call(opt.scope || me, me, opt);\r
+                    },\r
+                    me\r
+                );\r
+            opt.anim = anim;\r
+            return anim;\r
+        },\r
     \r
-    focus : function() {\r
-        try{\r
-            this.dom.focus();\r
-        }catch(e){}\r
-        return this;\r
-    },\r
-\r
+        // private legacy anim prep\r
+        preanim : function(a, i){\r
+            return !a[i] ? false : (Ext.isObject(a[i]) ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});\r
+        },\r
+        \r
+        /**\r
+         * Checks whether the element is currently visible using both visibility and display properties.         \r
+         * @return {Boolean} True if the element is currently visible, else false\r
+         */\r
+        isVisible : function() {\r
+            return !this.isStyle(VISIBILITY, HIDDEN) && !this.isStyle(DISPLAY, NONE);\r
+        },\r
+        \r
+        /**\r
+         * Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use\r
+         * the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.\r
+         * @param {Boolean} visible Whether the element is visible\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
+         setVisible : function(visible, animate){\r
+            var me = this,\r
+                dom = me.dom,\r
+                isDisplay = getVisMode(this.dom) == ELDISPLAY;\r
+                \r
+            if (!animate || !me.anim) {\r
+                if(isDisplay){\r
+                    me.setDisplayed(visible);\r
+                }else{\r
+                    me.fixDisplay();\r
+                    dom.style.visibility = visible ? "visible" : HIDDEN;\r
+                }\r
+            }else{\r
+                // closure for composites            \r
+                if(visible){\r
+                    me.setOpacity(.01);\r
+                    me.setVisible(true);\r
+                }\r
+                me.anim({opacity: { to: (visible?1:0) }},\r
+                        me.preanim(arguments, 1),\r
+                        null,\r
+                        .35,\r
+                        'easeIn',\r
+                        function(){\r
+                             if(!visible){\r
+                                 dom.style[isDisplay ? DISPLAY : VISIBILITY] = (isDisplay) ? NONE : HIDDEN;                     \r
+                                 Ext.fly(dom).setOpacity(1);\r
+                             }\r
+                        });\r
+            }\r
+            return me;\r
+        },\r
     \r
-    blur : function() {\r
-        try{\r
-            this.dom.blur();\r
-        }catch(e){}\r
-        return this;\r
-    },\r
-\r
+        /**\r
+         * Toggles the element's visibility or display, depending on visibility mode.\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
+        toggle : function(animate){\r
+            var me = this;\r
+            me.setVisible(!me.isVisible(), me.preanim(arguments, 0));\r
+            return me;\r
+        },\r
     \r
-    addClass : function(className){\r
-        if(Ext.isArray(className)){\r
-            for(var i = 0, len = className.length; i < len; i++) {\r
-               this.addClass(className[i]);\r
+        /**\r
+         * Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.\r
+         * @param {Mixed} value Boolean value to display the element using its default display, or a string to set the display directly.\r
+         * @return {Ext.Element} this\r
+         */\r
+        setDisplayed : function(value) {            \r
+            if(typeof value == "boolean"){\r
+               value = value ? getDisplay(this.dom) : NONE;\r
             }\r
-        }else{\r
-            if(className && !this.hasClass(className)){\r
-                this.dom.className = this.dom.className + " " + className;\r
+            this.setStyle(DISPLAY, value);\r
+            return this;\r
+        },\r
+        \r
+        // private\r
+        fixDisplay : function(){\r
+            var me = this;\r
+            if(me.isStyle(DISPLAY, NONE)){\r
+                me.setStyle(VISIBILITY, HIDDEN);\r
+                me.setStyle(DISPLAY, getDisplay(this.dom)); // first try reverting to default\r
+                if(me.isStyle(DISPLAY, NONE)){ // if that fails, default to block\r
+                    me.setStyle(DISPLAY, "block");\r
+                }\r
             }\r
-        }\r
-        return this;\r
-    },\r
-\r
+        },\r
     \r
-    radioClass : function(className){\r
-        var siblings = this.dom.parentNode.childNodes;\r
-        for(var i = 0; i < siblings.length; i++) {\r
-               var s = siblings[i];\r
-               if(s.nodeType == 1){\r
-                   Ext.get(s).removeClass(className);\r
-               }\r
-        }\r
-        this.addClass(className);\r
-        return this;\r
-    },\r
-\r
+        /**\r
+         * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.\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
+        hide : function(animate){\r
+            this.setVisible(false, this.preanim(arguments, 0));\r
+            return this;\r
+        },\r
     \r
-    removeClass : function(className){\r
-        if(!className || !this.dom.className){\r
+        /**\r
+        * Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.\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
+        show : function(animate){\r
+            this.setVisible(true, this.preanim(arguments, 0));\r
             return this;\r
         }\r
-        if(Ext.isArray(className)){\r
-            for(var i = 0, len = className.length; i < len; i++) {\r
-               this.removeClass(className[i]);\r
-            }\r
+    }\r
+}());/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods(\r
+function(){\r
+    var VISIBILITY = "visibility",\r
+        DISPLAY = "display",\r
+        HIDDEN = "hidden",\r
+        NONE = "none",\r
+           XMASKED = "x-masked",\r
+               XMASKEDRELATIVE = "x-masked-relative",\r
+        data = Ext.Element.data;\r
+               \r
+       return {\r
+               /**\r
+            * Checks whether the element is currently visible using both visibility and display properties.\r
+            * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)\r
+            * @return {Boolean} True if the element is currently visible, else false\r
+            */\r
+           isVisible : function(deep) {\r
+               var vis = !this.isStyle(VISIBILITY,HIDDEN) && !this.isStyle(DISPLAY,NONE),\r
+                       p = this.dom.parentNode;\r
+               if(deep !== true || !vis){\r
+                   return vis;\r
+               }               \r
+               while(p && !/body/i.test(p.tagName)){\r
+                   if(!Ext.fly(p, '_isVisible').isVisible()){\r
+                       return false;\r
+                   }\r
+                   p = p.parentNode;\r
+               }\r
+               return true;\r
+           },\r
+           \r
+           /**\r
+            * Returns true if display is not "none"\r
+            * @return {Boolean}\r
+            */\r
+           isDisplayed : function() {\r
+               return !this.isStyle(DISPLAY, NONE);\r
+           },\r
+           \r
+               /**\r
+            * Convenience method for setVisibilityMode(Element.DISPLAY)\r
+            * @param {String} display (optional) What to set display to when visible\r
+            * @return {Ext.Element} this\r
+            */\r
+           enableDisplayMode : function(display){          \r
+               this.setVisibilityMode(Ext.Element.DISPLAY);\r
+               if(!Ext.isEmpty(display)){\r
+                data(this.dom, 'originalDisplay', display);\r
+            }\r
+               return this;\r
+           },\r
+           \r
+               /**\r
+            * Puts a mask over this element to disable user interaction. Requires core.css.\r
+            * This method can only be applied to elements which accept child nodes.\r
+            * @param {String} msg (optional) A message to display in the mask\r
+            * @param {String} msgCls (optional) A css class to apply to the msg element\r
+            * @return {Element} The mask element\r
+            */\r
+           mask : function(msg, msgCls){\r
+                   var me = this,\r
+                       dom = me.dom,\r
+                       dh = Ext.DomHelper,\r
+                       EXTELMASKMSG = "ext-el-mask-msg",\r
+                el, \r
+                mask;\r
+                       \r
+               if(me.getStyle("position") == "static"){\r
+                   me.addClass(XMASKEDRELATIVE);\r
+               }\r
+               if((el = data(dom, 'maskMsg'))){\r
+                   el.remove();\r
+               }\r
+               if((el = data(dom, 'mask'))){\r
+                   el.remove();\r
+               }\r
+       \r
+            mask = dh.append(dom, {cls : "ext-el-mask"}, true);\r
+               data(dom, 'mask', mask);\r
+       \r
+               me.addClass(XMASKED);\r
+               mask.setDisplayed(true);\r
+               if(typeof msg == 'string'){\r
+                var mm = dh.append(dom, {cls : EXTELMASKMSG, cn:{tag:'div'}}, true);\r
+                data(dom, 'maskMsg', mm);\r
+                   mm.dom.className = msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG;\r
+                   mm.dom.firstChild.innerHTML = msg;\r
+                   mm.setDisplayed(true);\r
+                   mm.center(me);\r
+               }\r
+               if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && me.getStyle('height') == 'auto'){ // ie will not expand full height automatically\r
+                   mask.setSize(undefined, me.getHeight());\r
+               }\r
+               return mask;\r
+           },\r
+       \r
+           /**\r
+            * Removes a previously applied mask.\r
+            */\r
+           unmask : function(){\r
+                   var me = this,\r
+                dom = me.dom,\r
+                       mask = data(dom, 'mask'),\r
+                       maskMsg = data(dom, 'maskMsg');\r
+               if(mask){\r
+                   if(maskMsg){\r
+                       maskMsg.remove();\r
+                    data(dom, 'maskMsg', undefined);\r
+                   }\r
+                   mask.remove();\r
+                data(dom, 'mask', undefined);\r
+               }\r
+               me.removeClass([XMASKED, XMASKEDRELATIVE]);\r
+           },\r
+       \r
+           /**\r
+            * Returns true if this element is masked\r
+            * @return {Boolean}\r
+            */\r
+           isMasked : function(){\r
+            var m = data(this.dom, 'mask');\r
+               return m && m.isVisible();\r
+           },\r
+           \r
+           /**\r
+            * Creates an iframe shim for this element to keep selects and other windowed objects from\r
+            * showing through.\r
+            * @return {Ext.Element} The new shim element\r
+            */\r
+           createShim : function(){\r
+               var el = document.createElement('iframe'),              \r
+                       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
+               shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));\r
+               shim.autoBoxAdjust = false;\r
+               return shim;\r
+           }\r
+    };\r
+}());/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods({\r
+    /**\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
+     * @param {Function} fn The function to call\r
+     * @param {Object} scope (optional) The scope of the function\r
+     * @return {Ext.KeyMap} The KeyMap created\r
+     */\r
+    addKeyListener : function(key, fn, scope){\r
+        var config;\r
+        if(!Ext.isObject(key) || Ext.isArray(key)){\r
+            config = {\r
+                key: key,\r
+                fn: fn,\r
+                scope: scope\r
+            };\r
         }else{\r
-            if(this.hasClass(className)){\r
-                var re = this.classReCache[className];\r
-                if (!re) {\r
-                   re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");\r
-                   this.classReCache[className] = re;\r
-                }\r
-                this.dom.className =\r
-                    this.dom.className.replace(re, " ");\r
-            }\r
+            config = {\r
+                key : key.key,\r
+                shift : key.shift,\r
+                ctrl : key.ctrl,\r
+                alt : key.alt,\r
+                fn: fn,\r
+                scope: scope\r
+            };\r
         }\r
-        return this;\r
+        return new Ext.KeyMap(this, config);\r
     },\r
 \r
-    // private\r
-    classReCache: {},\r
-\r
+    /**\r
+     * Creates a KeyMap for this element\r
+     * @param {Object} config The KeyMap config. See {@link Ext.KeyMap} for more details\r
+     * @return {Ext.KeyMap} The KeyMap created\r
+     */\r
+    addKeyMap : function(config){\r
+        return new Ext.KeyMap(this, config);\r
+    }\r
+});(function(){\r
+    // contants\r
+    var NULL = null,\r
+        UNDEFINED = undefined,\r
+        TRUE = true,\r
+        FALSE = false,\r
+        SETX = "setX",\r
+        SETY = "setY",\r
+        SETXY = "setXY",\r
+        LEFT = "left",\r
+        BOTTOM = "bottom",\r
+        TOP = "top",\r
+        RIGHT = "right",\r
+        HEIGHT = "height",\r
+        WIDTH = "width",\r
+        POINTS = "points",\r
+        HIDDEN = "hidden",\r
+        ABSOLUTE = "absolute",\r
+        VISIBLE = "visible",\r
+        MOTION = "motion",\r
+        POSITION = "position",\r
+        EASEOUT = "easeOut",\r
+        /*\r
+         * Use a light flyweight here since we are using so many callbacks and are always assured a DOM element\r
+         */\r
+        flyEl = new Ext.Element.Flyweight(),\r
+        queues = {},\r
+        getObject = function(o){\r
+            return o || {};\r
+        },\r
+        fly = function(dom){\r
+            flyEl.dom = dom;\r
+            flyEl.id = Ext.id(dom);\r
+            return flyEl;\r
+        },\r
+        /*\r
+         * Queueing now stored outside of the element due to closure issues\r
+         */\r
+        getQueue = function(id){\r
+            if(!queues[id]){\r
+                queues[id] = [];\r
+            }\r
+            return queues[id];\r
+        },\r
+        setQueue = function(id, value){\r
+            queues[id] = value;\r
+        };\r
+        \r
+//Notifies Element that fx methods are available\r
+Ext.enableFx = TRUE;\r
+\r
+/**\r
+ * @class Ext.Fx\r
+ * <p>A class to provide basic animation and visual effects support.  <b>Note:</b> This class is automatically applied\r
+ * to the {@link Ext.Element} interface when included, so all effects calls should be performed via {@link Ext.Element}.\r
+ * Conversely, since the effects are not actually defined in {@link Ext.Element}, Ext.Fx <b>must</b> be\r
+ * {@link Ext#enableFx included} in order for the Element effects to work.</p><br/>\r
+ * \r
+ * <p><b><u>Method Chaining</u></b></p>\r
+ * <p>It is important to note that although the Fx methods and many non-Fx Element methods support "method chaining" in that\r
+ * they return the Element object itself as the method return value, it is not always possible to mix the two in a single\r
+ * method chain.  The Fx methods use an internal effects queue so that each effect can be properly timed and sequenced.\r
+ * Non-Fx methods, on the other hand, have no such internal queueing and will always execute immediately.  For this reason,\r
+ * while it may be possible to mix certain Fx and non-Fx method calls in a single chain, it may not always provide the\r
+ * expected results and should be done with care.  Also see <tt>{@link #callback}</tt>.</p><br/>\r
+ *\r
+ * <p><b><u>Anchor Options for Motion Effects</u></b></p>\r
+ * <p>Motion effects support 8-way anchoring, meaning that you can choose one of 8 different anchor points on the Element\r
+ * that will serve as either the start or end point of the animation.  Following are all of the supported anchor positions:</p>\r
+<pre>\r
+Value  Description\r
+-----  -----------------------------\r
+tl     The top left corner\r
+t      The center of the top edge\r
+tr     The top right corner\r
+l      The center of the left edge\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
+ * <b>Note</b>: some Fx methods accept specific custom config parameters.  The options shown in the Config Options\r
+ * section below are common options that can be passed to any Fx method unless otherwise noted.</b>\r
+ * \r
+ * @cfg {Function} callback A function called when the effect is finished.  Note that effects are queued internally by the\r
+ * Fx class, so a callback is not required to specify another effect -- effects can simply be chained together\r
+ * and called in sequence (see note for <b><u>Method Chaining</u></b> above), for example:<pre><code>\r
+ * el.slideIn().highlight();\r
+ * </code></pre>\r
+ * 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
+ * \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
+ * <li><b><tt>backIn</tt></b></li>\r
+ * <li><b><tt>backOut</tt></b></li>\r
+ * <li><b><tt>bounceBoth</tt></b></li>\r
+ * <li><b><tt>bounceIn</tt></b></li>\r
+ * <li><b><tt>bounceOut</tt></b></li>\r
+ * <li><b><tt>easeBoth</tt></b></li>\r
+ * <li><b><tt>easeBothStrong</tt></b></li>\r
+ * <li><b><tt>easeIn</tt></b></li>\r
+ * <li><b><tt>easeInStrong</tt></b></li>\r
+ * <li><b><tt>easeNone</tt></b></li>\r
+ * <li><b><tt>easeOut</tt></b></li>\r
+ * <li><b><tt>easeOutStrong</tt></b></li>\r
+ * <li><b><tt>elasticBoth</tt></b></li>\r
+ * <li><b><tt>elasticIn</tt></b></li>\r
+ * <li><b><tt>elasticOut</tt></b></li>\r
+ * </ul></div>\r
+ *\r
+ * @cfg {String} afterCls A css class to apply after the effect\r
+ * @cfg {Number} duration The length of time (in seconds) that the effect should last\r
+ * \r
+ * @cfg {Number} endOpacity Only applicable for {@link #fadeIn} or {@link #fadeOut}, a number between\r
+ * <tt>0</tt> and <tt>1</tt> inclusive to configure the ending opacity value.\r
+ *  \r
+ * @cfg {Boolean} remove Whether the Element should be removed from the DOM and destroyed after the effect finishes\r
+ * @cfg {Boolean} useDisplay Whether to use the <i>display</i> CSS property instead of <i>visibility</i> when hiding Elements (only applies to \r
+ * effects that end with the element being visually hidden, ignored otherwise)\r
+ * @cfg {String/Object/Function} afterStyle A style specification string, e.g. <tt>"width:100px"</tt>, or an object\r
+ * in the form <tt>{width:"100px"}</tt>, or a function which returns such a specification that will be applied to the\r
+ * Element after the effect finishes.\r
+ * @cfg {Boolean} block Whether the effect should block other effects from queueing while it runs\r
+ * @cfg {Boolean} concurrent Whether to allow subsequently-queued effects to run at the same time as the current effect, or to ensure that they run in sequence\r
+ * @cfg {Boolean} stopFx Whether preceding effects should be stopped and removed before running current effect (only applies to non blocking effects)\r
+ */\r
+Ext.Fx = {\r
     \r
-    toggleClass : function(className){\r
-        if(this.hasClass(className)){\r
-            this.removeClass(className);\r
-        }else{\r
-            this.addClass(className);\r
-        }\r
-        return this;\r
+    // private - calls the function taking arguments from the argHash based on the key.  Returns the return value of the function.\r
+    //           this is useful for replacing switch statements (for example).\r
+    switchStatements : function(key, fn, argHash){\r
+        return fn.apply(this, argHash[key]);\r
     },\r
-\r
     \r
-    hasClass : function(className){\r
-        return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;\r
-    },\r
+    /**\r
+     * Slides the element into view.  An anchor point can be optionally passed to set the point of\r
+     * origin for the slide effect.  This function automatically handles wrapping the element with\r
+     * a fixed-size container if needed.  See the Fx class overview for valid anchor point options.\r
+     * Usage:\r
+     *<pre><code>\r
+// default: slide the element in from the top\r
+el.slideIn();\r
 \r
-    \r
-    replaceClass : function(oldClassName, newClassName){\r
-        this.removeClass(oldClassName);\r
-        this.addClass(newClassName);\r
-        return this;\r
-    },\r
+// custom: slide the element in from the right with a 2-second duration\r
+el.slideIn('r', { duration: 2 });\r
 \r
-    \r
-    getStyles : function(){\r
-        var a = arguments, len = a.length, r = {};\r
-        for(var i = 0; i < len; i++){\r
-            r[a[i]] = this.getStyle(a[i]);\r
-        }\r
-        return r;\r
-    },\r
+// common config options shown with default values\r
+el.slideIn('t', {\r
+    easing: 'easeOut',\r
+    duration: .5\r
+});\r
+</code></pre>\r
+     * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to top: 't')\r
+     * @param {Object} options (optional) Object literal with any of the Fx config options\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    slideIn : function(anchor, o){ \r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            st = dom.style,\r
+            xy,\r
+            r,\r
+            b,              \r
+            wrap,               \r
+            after,\r
+            st,\r
+            args, \r
+            pt,\r
+            bw,\r
+            bh;\r
+            \r
+        anchor = anchor || "t";\r
 \r
-    \r
-    getStyle : function(){\r
-        return view && view.getComputedStyle ?\r
-            function(prop){\r
-                var el = this.dom, v, cs, camel;\r
-                if(prop == 'float'){\r
-                    prop = "cssFloat";\r
-                }\r
-                if(v = el.style[prop]){\r
-                    return v;\r
-                }\r
-                if(cs = view.getComputedStyle(el, "")){\r
-                    if(!(camel = propCache[prop])){\r
-                        camel = propCache[prop] = prop.replace(camelRe, camelFn);\r
-                    }\r
-                    return cs[camel];\r
-                }\r
-                return null;\r
-            } :\r
-            function(prop){\r
-                var el = this.dom, v, cs, camel;\r
-                if(prop == 'opacity'){\r
-                    if(typeof el.style.filter == 'string'){\r
-                        var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);\r
-                        if(m){\r
-                            var fv = parseFloat(m[1]);\r
-                            if(!isNaN(fv)){\r
-                                return fv ? fv / 100 : 0;\r
-                            }\r
-                        }\r
-                    }\r
-                    return 1;\r
-                }else if(prop == 'float'){\r
-                    prop = "styleFloat";\r
-                }\r
-                if(!(camel = propCache[prop])){\r
-                    camel = propCache[prop] = prop.replace(camelRe, camelFn);\r
+        me.queueFx(o, function(){            \r
+            xy = fly(dom).getXY();\r
+            // fix display to visibility\r
+            fly(dom).fixDisplay();            \r
+            \r
+            // restore values after effect\r
+            r = fly(dom).getFxRestore();      \r
+            b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight};\r
+            b.right = b.x + b.width;\r
+            b.bottom = b.y + b.height;\r
+            \r
+            // fixed size for slide\r
+            fly(dom).setWidth(b.width).setHeight(b.height);            \r
+            \r
+            // wrap if needed\r
+            wrap = fly(dom).fxWrap(r.pos, o, HIDDEN);\r
+            \r
+            st.visibility = VISIBLE;\r
+            st.position = ABSOLUTE;\r
+            \r
+            // clear out temp styles after slide and unwrap\r
+            function after(){\r
+                 fly(dom).fxUnwrap(wrap, r.pos, o);\r
+                 st.width = r.width;\r
+                 st.height = r.height;\r
+                 fly(dom).afterFx(o);\r
+            }\r
+            \r
+            // time to calculate the positions        \r
+            pt = {to: [b.x, b.y]}; \r
+            bw = {to: b.width};\r
+            bh = {to: b.height};\r
+                \r
+            function argCalc(wrap, style, ww, wh, sXY, sXYval, s1, s2, w, h, p){                    \r
+                var ret = {};\r
+                fly(wrap).setWidth(ww).setHeight(wh);\r
+                if(fly(wrap)[sXY]){\r
+                    fly(wrap)[sXY](sXYval);                  \r
                 }\r
-                if(v = el.style[camel]){\r
-                    return v;\r
+                style[s1] = style[s2] = "0";                    \r
+                if(w){\r
+                    ret.width = w\r
+                };\r
+                if(h){\r
+                    ret.height = h;\r
                 }\r
-                if(cs = el.currentStyle){\r
-                    return cs[camel];\r
+                if(p){\r
+                    ret.points = p;\r
                 }\r
-                return null;\r
+                return ret;\r
             };\r
-    }(),\r
 \r
-    \r
-    setStyle : function(prop, value){\r
-        if(typeof prop == "string"){\r
-            var camel;\r
-            if(!(camel = propCache[prop])){\r
-                camel = propCache[prop] = prop.replace(camelRe, camelFn);\r
-            }\r
-            if(camel == 'opacity') {\r
-                this.setOpacity(value);\r
-            }else{\r
-                this.dom.style[camel] = value;\r
-            }\r
-        }else{\r
-            for(var style in prop){\r
-                if(typeof prop[style] != "function"){\r
-                   this.setStyle(style, prop[style]);\r
-                }\r
-            }\r
-        }\r
-        return this;\r
-    },\r
+            args = fly(dom).switchStatements(anchor.toLowerCase(), argCalc, {\r
+                    t  : [wrap, st, b.width, 0, NULL, NULL, LEFT, BOTTOM, NULL, bh, NULL],\r
+                    l  : [wrap, st, 0, b.height, NULL, NULL, RIGHT, TOP, bw, NULL, NULL],\r
+                    r  : [wrap, st, b.width, b.height, SETX, b.right, LEFT, TOP, NULL, NULL, pt],\r
+                    b  : [wrap, st, b.width, b.height, SETY, b.bottom, LEFT, TOP, NULL, bh, pt],\r
+                    tl : [wrap, st, 0, 0, NULL, NULL, RIGHT, BOTTOM, bw, bh, pt],\r
+                    bl : [wrap, st, 0, 0, SETY, b.y + b.height, RIGHT, TOP, bw, bh, pt],\r
+                    br : [wrap, st, 0, 0, SETXY, [b.right, b.bottom], LEFT, TOP, bw, bh, pt],\r
+                    tr : [wrap, st, 0, 0, SETX, b.x + b.width, LEFT, BOTTOM, bw, bh, pt]\r
+                });\r
+            \r
+            st.visibility = VISIBLE;\r
+            fly(wrap).show();\r
 \r
-    \r
-    applyStyles : function(style){\r
-        Ext.DomHelper.applyStyles(this.dom, style);\r
-        return this;\r
-    },\r
+            arguments.callee.anim = fly(wrap).fxanim(args,\r
+                o,\r
+                MOTION,\r
+                .5,\r
+                EASEOUT, \r
+                after);\r
+        });\r
+        return me;\r
+    },\r
+    \r
+    /**\r
+     * Slides the element out of view.  An anchor point can be optionally passed to set the end point\r
+     * for the slide effect.  When the effect is completed, the element will be hidden (visibility = \r
+     * 'hidden') but block elements will still take up space in the document.  The element must be removed\r
+     * from the DOM using the 'remove' config option if desired.  This function automatically handles \r
+     * wrapping the element with a fixed-size container if needed.  See the Fx class overview for valid anchor point options.\r
+     * Usage:\r
+     *<pre><code>\r
+// default: slide the element out to the top\r
+el.slideOut();\r
+\r
+// custom: slide the element out to the right with a 2-second duration\r
+el.slideOut('r', { duration: 2 });\r
+\r
+// common config options shown with default values\r
+el.slideOut('t', {\r
+    easing: 'easeOut',\r
+    duration: .5,\r
+    remove: false,\r
+    useDisplay: false\r
+});\r
+</code></pre>\r
+     * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to top: 't')\r
+     * @param {Object} options (optional) Object literal with any of the Fx config options\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    slideOut : function(anchor, o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            st = dom.style,\r
+            xy = me.getXY(),\r
+            wrap,\r
+            r,\r
+            b,\r
+            a,\r
+            zero = {to: 0}; \r
+                    \r
+        anchor = anchor || "t";\r
 \r
-    \r
-    getX : function(){\r
-        return D.getX(this.dom);\r
-    },\r
+        me.queueFx(o, function(){\r
+            \r
+            // restore values after effect\r
+            r = fly(dom).getFxRestore(); \r
+            b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight};\r
+            b.right = b.x + b.width;\r
+            b.bottom = b.y + b.height;\r
+                \r
+            // fixed size for slide   \r
+            fly(dom).setWidth(b.width).setHeight(b.height);\r
 \r
-    \r
-    getY : function(){\r
-        return D.getY(this.dom);\r
-    },\r
+            // wrap if needed\r
+            wrap = fly(dom).fxWrap(r.pos, o, VISIBLE);\r
+                \r
+            st.visibility = VISIBLE;\r
+            st.position = ABSOLUTE;\r
+            fly(wrap).setWidth(b.width).setHeight(b.height);            \r
 \r
-    \r
-    getXY : function(){\r
-        return D.getXY(this.dom);\r
-    },\r
+            function after(){\r
+                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();                \r
+                fly(dom).fxUnwrap(wrap, r.pos, o);\r
+                st.width = r.width;\r
+                st.height = r.height;\r
+                fly(dom).afterFx(o);\r
+            }            \r
+            \r
+            function argCalc(style, s1, s2, p1, v1, p2, v2, p3, v3){                    \r
+                var ret = {};\r
+                \r
+                style[s1] = style[s2] = "0";\r
+                ret[p1] = v1;               \r
+                if(p2){\r
+                    ret[p2] = v2;               \r
+                }\r
+                if(p3){\r
+                    ret[p3] = v3;\r
+                }\r
+                \r
+                return ret;\r
+            };\r
+            \r
+            a = fly(dom).switchStatements(anchor.toLowerCase(), argCalc, {\r
+                t  : [st, LEFT, BOTTOM, HEIGHT, zero],\r
+                l  : [st, RIGHT, TOP, WIDTH, zero],\r
+                r  : [st, LEFT, TOP, WIDTH, zero, POINTS, {to : [b.right, b.y]}],\r
+                b  : [st, LEFT, TOP, HEIGHT, zero, POINTS, {to : [b.x, b.bottom]}],\r
+                tl : [st, RIGHT, BOTTOM, WIDTH, zero, HEIGHT, zero],\r
+                bl : [st, RIGHT, TOP, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.x, b.bottom]}],\r
+                br : [st, LEFT, TOP, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.x + b.width, b.bottom]}],\r
+                tr : [st, LEFT, BOTTOM, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.right, b.y]}]\r
+            });\r
+            \r
+            arguments.callee.anim = fly(wrap).fxanim(a,\r
+                o,\r
+                MOTION,\r
+                .5,\r
+                EASEOUT, \r
+                after);\r
+        });\r
+        return me;\r
+    },\r
+\r
+    /**\r
+     * Fades the element out while slowly expanding it in all directions.  When the effect is completed, the \r
+     * element will be hidden (visibility = 'hidden') but block elements will still take up space in the document. \r
+     * The element must be removed from the DOM using the 'remove' config option if desired.\r
+     * Usage:\r
+     *<pre><code>\r
+// default\r
+el.puff();\r
+\r
+// common config options shown with default values\r
+el.puff({\r
+    easing: 'easeOut',\r
+    duration: .5,\r
+    remove: false,\r
+    useDisplay: false\r
+});\r
+</code></pre>\r
+     * @param {Object} options (optional) Object literal with any of the Fx config options\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    puff : function(o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            st = dom.style,\r
+            width,\r
+            height,\r
+            r;\r
+\r
+        me.queueFx(o, function(){\r
+            width = fly(dom).getWidth();\r
+            height = fly(dom).getHeight();\r
+            fly(dom).clearOpacity();\r
+            fly(dom).show();\r
 \r
-    \r
-    getOffsetsTo : function(el){\r
-        var o = this.getXY();\r
-        var e = Ext.fly(el, '_internal').getXY();\r
-        return [o[0]-e[0],o[1]-e[1]];\r
-    },\r
+            // restore values after effect\r
+            r = fly(dom).getFxRestore();                   \r
+            \r
+            function after(){\r
+                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();                  \r
+                fly(dom).clearOpacity();  \r
+                fly(dom).setPositioning(r.pos);\r
+                st.width = r.width;\r
+                st.height = r.height;\r
+                st.fontSize = '';\r
+                fly(dom).afterFx(o);\r
+            }   \r
+\r
+            arguments.callee.anim = fly(dom).fxanim({\r
+                    width : {to : fly(dom).adjustWidth(width * 2)},\r
+                    height : {to : fly(dom).adjustHeight(height * 2)},\r
+                    points : {by : [-width * .5, -height * .5]},\r
+                    opacity : {to : 0},\r
+                    fontSize: {to : 200, unit: "%"}\r
+                },\r
+                o,\r
+                MOTION,\r
+                .5,\r
+                EASEOUT,\r
+                 after);\r
+        });\r
+        return me;\r
+    },\r
+\r
+    /**\r
+     * Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television).\r
+     * When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still \r
+     * take up space in the document. The element must be removed from the DOM using the 'remove' config option if desired.\r
+     * Usage:\r
+     *<pre><code>\r
+// default\r
+el.switchOff();\r
+\r
+// all config options shown with default values\r
+el.switchOff({\r
+    easing: 'easeIn',\r
+    duration: .3,\r
+    remove: false,\r
+    useDisplay: false\r
+});\r
+</code></pre>\r
+     * @param {Object} options (optional) Object literal with any of the Fx config options\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    switchOff : function(o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            st = dom.style,\r
+            r;\r
 \r
-    \r
-    setX : function(x, animate){\r
-        if(!animate || !A){\r
-            D.setX(this.dom, x);\r
-        }else{\r
-            this.setXY([x, this.getY()], this.preanim(arguments, 1));\r
-        }\r
-        return this;\r
-    },\r
+        me.queueFx(o, function(){\r
+            fly(dom).clearOpacity();\r
+            fly(dom).clip();\r
 \r
-    \r
-    setY : function(y, animate){\r
-        if(!animate || !A){\r
-            D.setY(this.dom, y);\r
-        }else{\r
-            this.setXY([this.getX(), y], this.preanim(arguments, 1));\r
-        }\r
-        return this;\r
-    },\r
+            // restore values after effect\r
+            r = fly(dom).getFxRestore();\r
+                \r
+            function after(){\r
+                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();  \r
+                fly(dom).clearOpacity();\r
+                fly(dom).setPositioning(r.pos);\r
+                st.width = r.width;\r
+                st.height = r.height;   \r
+                fly(dom).afterFx(o);\r
+            };\r
 \r
-    \r
-    setLeft : function(left){\r
-        this.setStyle("left", this.addUnits(left));\r
-        return this;\r
+            fly(dom).fxanim({opacity : {to : 0.3}}, \r
+                NULL, \r
+                NULL, \r
+                .1, \r
+                NULL, \r
+                function(){                                 \r
+                    fly(dom).clearOpacity();\r
+                        (function(){                            \r
+                            fly(dom).fxanim({\r
+                                height : {to : 1},\r
+                                points : {by : [0, fly(dom).getHeight() * .5]}\r
+                            }, \r
+                            o, \r
+                            MOTION, \r
+                            0.3, \r
+                            'easeIn', \r
+                            after);\r
+                        }).defer(100);\r
+                });\r
+        });\r
+        return me;\r
+    },\r
+\r
+    /**\r
+     * Highlights the Element by setting a color (applies to the background-color by default, but can be\r
+     * changed using the "attr" config option) and then fading back to the original color. If no original\r
+     * color is available, you should provide the "endColor" config option which will be cleared after the animation.\r
+     * Usage:\r
+<pre><code>\r
+// default: highlight background to yellow\r
+el.highlight();\r
+\r
+// custom: highlight foreground text to blue for 2 seconds\r
+el.highlight("0000ff", { attr: 'color', duration: 2 });\r
+\r
+// common config options shown with default values\r
+el.highlight("ffff9c", {\r
+    attr: "background-color", //can be any valid CSS property (attribute) that supports a color value\r
+    endColor: (current color) or "ffffff",\r
+    easing: 'easeIn',\r
+    duration: 1\r
+});\r
+</code></pre>\r
+     * @param {String} color (optional) The highlight color. Should be a 6 char hex color without the leading # (defaults to yellow: 'ffff9c')\r
+     * @param {Object} options (optional) Object literal with any of the Fx config options\r
+     * @return {Ext.Element} The Element\r
+     */ \r
+    highlight : function(color, o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            attr = o.attr || "backgroundColor",\r
+            a = {},\r
+            restore;\r
+\r
+        me.queueFx(o, function(){\r
+            fly(dom).clearOpacity();\r
+            fly(dom).show();\r
+\r
+            function after(){\r
+                dom.style[attr] = restore;\r
+                fly(dom).afterFx(o);\r
+            }            \r
+            restore = dom.style[attr];\r
+            a[attr] = {from: color || "ffff9c", to: o.endColor || fly(dom).getColor(attr) || "ffffff"};\r
+            arguments.callee.anim = fly(dom).fxanim(a,\r
+                o,\r
+                'color',\r
+                1,\r
+                'easeIn', \r
+                after);\r
+        });\r
+        return me;\r
     },\r
 \r
-    \r
-    setTop : function(top){\r
-        this.setStyle("top", this.addUnits(top));\r
-        return this;\r
-    },\r
+   /**\r
+    * Shows a ripple of exploding, attenuating borders to draw attention to an Element.\r
+    * Usage:\r
+<pre><code>\r
+// default: a single light blue ripple\r
+el.frame();\r
 \r
-    \r
-    setRight : function(right){\r
-        this.setStyle("right", this.addUnits(right));\r
-        return this;\r
-    },\r
+// custom: 3 red ripples lasting 3 seconds total\r
+el.frame("ff0000", 3, { duration: 3 });\r
 \r
-    \r
-    setBottom : function(bottom){\r
-        this.setStyle("bottom", this.addUnits(bottom));\r
+// common config options shown with default values\r
+el.frame("C3DAF9", 1, {\r
+    duration: 1 //duration of each individual ripple.\r
+    // Note: Easing is not configurable and will be ignored if included\r
+});\r
+</code></pre>\r
+    * @param {String} color (optional) The color of the border.  Should be a 6 char hex color without the leading # (defaults to light blue: 'C3DAF9').\r
+    * @param {Number} count (optional) The number of ripples to display (defaults to 1)\r
+    * @param {Object} options (optional) Object literal with any of the Fx config options\r
+    * @return {Ext.Element} The Element\r
+    */\r
+    frame : function(color, count, o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            proxy,\r
+            active;\r
+\r
+        me.queueFx(o, function(){\r
+            color = color || "#C3DAF9"\r
+            if(color.length == 6){\r
+                color = "#" + color;\r
+            }            \r
+            count = count || 1;\r
+            fly(dom).show();\r
+\r
+            var xy = fly(dom).getXY(),\r
+                b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight},\r
+                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
+                        }\r
+                    });\r
+                    return proxy.queueFx({}, animFn);\r
+                };\r
+            \r
+            \r
+            arguments.callee.anim = {\r
+                isAnimated: true,\r
+                stop: function() {\r
+                    count = 0;\r
+                    proxy.stopFx();\r
+                }\r
+            };\r
+            \r
+            function animFn(){\r
+                var scale = Ext.isBorderBox ? 2 : 1;\r
+                active = proxy.anim({\r
+                    top : {from : b.y, to : b.y - 20},\r
+                    left : {from : b.x, to : b.x - 20},\r
+                    borderWidth : {from : 0, to : 10},\r
+                    opacity : {from : 1, to : 0},\r
+                    height : {from : b.height, to : b.height + 20 * scale},\r
+                    width : {from : b.width, to : b.width + 20 * scale}\r
+                },{\r
+                    duration: o.duration || 1,\r
+                    callback: function() {\r
+                        proxy.remove();\r
+                        --count > 0 ? queue() : fly(dom).afterFx(o);\r
+                    }\r
+                });\r
+                arguments.callee.anim = {\r
+                    isAnimated: true,\r
+                    stop: function(){\r
+                        active.stop();\r
+                    }\r
+                };\r
+            };\r
+            queue();\r
+        });\r
+        return me;\r
+    },\r
+\r
+   /**\r
+    * Creates a pause before any subsequent queued effects begin.  If there are\r
+    * no effects queued after the pause it will have no effect.\r
+    * Usage:\r
+<pre><code>\r
+el.pause(1);\r
+</code></pre>\r
+    * @param {Number} seconds The length of time to pause (in seconds)\r
+    * @return {Ext.Element} The Element\r
+    */\r
+    pause : function(seconds){        \r
+        var dom = this.dom,\r
+            t;\r
+\r
+        this.queueFx({}, function(){\r
+            t = setTimeout(function(){\r
+                fly(dom).afterFx({});\r
+            }, seconds * 1000);\r
+            arguments.callee.anim = {\r
+                isAnimated: true,\r
+                stop: function(){\r
+                    clearTimeout(t);\r
+                    fly(dom).afterFx({});\r
+                }\r
+            };\r
+        });\r
         return this;\r
     },\r
 \r
-    \r
-    setXY : function(pos, animate){\r
-        if(!animate || !A){\r
-            D.setXY(this.dom, pos);\r
-        }else{\r
-            this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');\r
-        }\r
-        return this;\r
-    },\r
+   /**\r
+    * Fade an element in (from transparent to opaque).  The ending opacity can be specified\r
+    * using the <tt>{@link #endOpacity}</tt> config option.\r
+    * Usage:\r
+<pre><code>\r
+// default: fade in from opacity 0 to 100%\r
+el.fadeIn();\r
 \r
-    \r
-    setLocation : function(x, y, animate){\r
-        this.setXY([x, y], this.preanim(arguments, 2));\r
+// custom: fade in from opacity 0 to 75% over 2 seconds\r
+el.fadeIn({ endOpacity: .75, duration: 2});\r
+\r
+// common config options shown with default values\r
+el.fadeIn({\r
+    endOpacity: 1, //can be any value between 0 and 1 (e.g. .5)\r
+    easing: 'easeOut',\r
+    duration: .5\r
+});\r
+</code></pre>\r
+    * @param {Object} options (optional) Object literal with any of the Fx config options\r
+    * @return {Ext.Element} The Element\r
+    */\r
+    fadeIn : function(o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            to = o.endOpacity || 1;\r
+        \r
+        me.queueFx(o, function(){\r
+            fly(dom).setOpacity(0);\r
+            fly(dom).fixDisplay();\r
+            dom.style.visibility = VISIBLE;\r
+            arguments.callee.anim = fly(dom).fxanim({opacity:{to:to}},\r
+                o, NULL, .5, EASEOUT, function(){\r
+                if(to == 1){\r
+                    fly(dom).clearOpacity();\r
+                }\r
+                fly(dom).afterFx(o);\r
+            });\r
+        });\r
+        return me;\r
+    },\r
+\r
+   /**\r
+    * Fade an element out (from opaque to transparent).  The ending opacity can be specified\r
+    * using the <tt>{@link #endOpacity}</tt> config option.  Note that IE may require\r
+    * <tt>{@link #useDisplay}:true</tt> in order to redisplay correctly.\r
+    * Usage:\r
+<pre><code>\r
+// default: fade out from the element's current opacity to 0\r
+el.fadeOut();\r
+\r
+// custom: fade out from the element's current opacity to 25% over 2 seconds\r
+el.fadeOut({ endOpacity: .25, duration: 2});\r
+\r
+// common config options shown with default values\r
+el.fadeOut({\r
+    endOpacity: 0, //can be any value between 0 and 1 (e.g. .5)\r
+    easing: 'easeOut',\r
+    duration: .5,\r
+    remove: false,\r
+    useDisplay: false\r
+});\r
+</code></pre>\r
+    * @param {Object} options (optional) Object literal with any of the Fx config options\r
+    * @return {Ext.Element} The Element\r
+    */\r
+    fadeOut : function(o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            style = dom.style,\r
+            to = o.endOpacity || 0;         \r
+        \r
+        me.queueFx(o, function(){  \r
+            arguments.callee.anim = fly(dom).fxanim({ \r
+                opacity : {to : to}},\r
+                o, \r
+                NULL, \r
+                .5, \r
+                EASEOUT, \r
+                function(){\r
+                    if(to == 0){\r
+                        Ext.Element.data(dom, 'visibilityMode') == Ext.Element.DISPLAY || o.useDisplay ? \r
+                            style.display = "none" :\r
+                            style.visibility = HIDDEN;\r
+                            \r
+                        fly(dom).clearOpacity();\r
+                    }\r
+                    fly(dom).afterFx(o);\r
+            });\r
+        });\r
+        return me;\r
+    },\r
+\r
+   /**\r
+    * Animates the transition of an element's dimensions from a starting height/width\r
+    * to an ending height/width.  This method is a convenience implementation of {@link shift}.\r
+    * Usage:\r
+<pre><code>\r
+// change height and width to 100x100 pixels\r
+el.scale(100, 100);\r
+\r
+// common config options shown with default values.  The height and width will default to\r
+// the element&#39;s existing values if passed as null.\r
+el.scale(\r
+    [element&#39;s width],\r
+    [element&#39;s height], {\r
+        easing: 'easeOut',\r
+        duration: .35\r
+    }\r
+);\r
+</code></pre>\r
+    * @param {Number} width  The new width (pass undefined to keep the original width)\r
+    * @param {Number} height  The new height (pass undefined to keep the original height)\r
+    * @param {Object} options (optional) Object literal with any of the Fx config options\r
+    * @return {Ext.Element} The Element\r
+    */\r
+    scale : function(w, h, o){\r
+        this.shift(Ext.apply({}, o, {\r
+            width: w,\r
+            height: h\r
+        }));\r
         return this;\r
     },\r
 \r
-    \r
-    moveTo : function(x, y, animate){\r
-        this.setXY([x, y], this.preanim(arguments, 2));\r
+   /**\r
+    * Animates the transition of any combination of an element's dimensions, xy position and/or opacity.\r
+    * Any of these properties not specified in the config object will not be changed.  This effect \r
+    * requires that at least one new dimension, position or opacity setting must be passed in on\r
+    * the config object in order for the function to have any effect.\r
+    * Usage:\r
+<pre><code>\r
+// slide the element horizontally to x position 200 while changing the height and opacity\r
+el.shift({ x: 200, height: 50, opacity: .8 });\r
+\r
+// common config options shown with default values.\r
+el.shift({\r
+    width: [element&#39;s width],\r
+    height: [element&#39;s height],\r
+    x: [element&#39;s x position],\r
+    y: [element&#39;s y position],\r
+    opacity: [element&#39;s opacity],\r
+    easing: 'easeOut',\r
+    duration: .35\r
+});\r
+</code></pre>\r
+    * @param {Object} options  Object literal with any of the Fx config options\r
+    * @return {Ext.Element} The Element\r
+    */\r
+    shift : function(o){\r
+        o = getObject(o);\r
+        var dom = this.dom,\r
+            a = {};\r
+                \r
+        this.queueFx(o, function(){\r
+            for (var prop in o) {\r
+                if (o[prop] != UNDEFINED) {                                                 \r
+                    a[prop] = {to : o[prop]};                   \r
+                }\r
+            } \r
+            \r
+            a.width ? a.width.to = fly(dom).adjustWidth(o.width) : a;\r
+            a.height ? a.height.to = fly(dom).adjustWidth(o.height) : a;   \r
+            \r
+            if (a.x || a.y || a.xy) {\r
+                a.points = a.xy || \r
+                           {to : [ a.x ? a.x.to : fly(dom).getX(),\r
+                                   a.y ? a.y.to : fly(dom).getY()]};                  \r
+            }\r
+\r
+            arguments.callee.anim = fly(dom).fxanim(a,\r
+                o, \r
+                MOTION, \r
+                .35, \r
+                EASEOUT, \r
+                function(){\r
+                    fly(dom).afterFx(o);\r
+                });\r
+        });\r
         return this;\r
     },\r
 \r
-    \r
-    getRegion : function(){\r
-        return D.getRegion(this.dom);\r
-    },\r
+    /**\r
+     * Slides the element while fading it out of view.  An anchor point can be optionally passed to set the \r
+     * ending point of the effect.\r
+     * Usage:\r
+     *<pre><code>\r
+// default: slide the element downward while fading out\r
+el.ghost();\r
 \r
-    \r
-    getHeight : function(contentHeight){\r
-        var h = this.dom.offsetHeight || 0;\r
-        h = contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");\r
-        return h < 0 ? 0 : h;\r
-    },\r
+// custom: slide the element out to the right with a 2-second duration\r
+el.ghost('r', { duration: 2 });\r
 \r
-    \r
-    getWidth : function(contentWidth){\r
-        var w = this.dom.offsetWidth || 0;\r
-        w = contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");\r
-        return w < 0 ? 0 : w;\r
-    },\r
+// common config options shown with default values\r
+el.ghost('b', {\r
+    easing: 'easeOut',\r
+    duration: .5,\r
+    remove: false,\r
+    useDisplay: false\r
+});\r
+</code></pre>\r
+     * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to bottom: 'b')\r
+     * @param {Object} options (optional) Object literal with any of the Fx config options\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    ghost : function(anchor, o){\r
+        o = getObject(o);\r
+        var me = this,\r
+            dom = me.dom,\r
+            st = dom.style,\r
+            a = {opacity: {to: 0}, points: {}},\r
+            pt = a.points,\r
+            r,\r
+            w,\r
+            h;\r
+            \r
+        anchor = anchor || "b";\r
 \r
-    \r
-    getComputedHeight : function(){\r
-        var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);\r
-        if(!h){\r
-            h = parseInt(this.getStyle('height'), 10) || 0;\r
-            if(!this.isBorderBox()){\r
-                h += this.getFrameWidth('tb');\r
+        me.queueFx(o, function(){\r
+            // restore values after effect\r
+            r = fly(dom).getFxRestore();\r
+            w = fly(dom).getWidth();\r
+            h = fly(dom).getHeight();\r
+            \r
+            function after(){\r
+                o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide();   \r
+                fly(dom).clearOpacity();\r
+                fly(dom).setPositioning(r.pos);\r
+                st.width = r.width;\r
+                st.height = r.height;\r
+                fly(dom).afterFx(o);\r
             }\r
-        }\r
-        return h;\r
+                \r
+            pt.by = fly(dom).switchStatements(anchor.toLowerCase(), function(v1,v2){ return [v1, v2];}, {\r
+               t  : [0, -h],\r
+               l  : [-w, 0],\r
+               r  : [w, 0],\r
+               b  : [0, h],\r
+               tl : [-w, -h],\r
+               bl : [-w, h],\r
+               br : [w, h],\r
+               tr : [w, -h] \r
+            });\r
+                \r
+            arguments.callee.anim = fly(dom).fxanim(a,\r
+                o,\r
+                MOTION,\r
+                .5,\r
+                EASEOUT, after);\r
+        });\r
+        return me;\r
     },\r
 \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
+     * Ensures that all effects queued after syncFx is called on the element are\r
+     * run concurrently.  This is the opposite of {@link #sequenceFx}.\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    syncFx : function(){\r
+        var me = this;\r
+        me.fxDefaults = Ext.apply(me.fxDefaults || {}, {\r
+            block : FALSE,\r
+            concurrent : TRUE,\r
+            stopFx : FALSE\r
+        });\r
+        return me;\r
     },\r
 \r
-    \r
-    getSize : function(contentSize){\r
-        return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};\r
+    /**\r
+     * Ensures that all effects queued after sequenceFx is called on the element are\r
+     * run in sequence.  This is the opposite of {@link #syncFx}.\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    sequenceFx : function(){\r
+        var me = this;\r
+        me.fxDefaults = Ext.apply(me.fxDefaults || {}, {\r
+            block : FALSE,\r
+            concurrent : FALSE,\r
+            stopFx : FALSE\r
+        });\r
+        return me;\r
     },\r
 \r
-    getStyleSize : function(){\r
-        var w, h, d = this.dom, s = d.style;\r
-        if(s.width && s.width != 'auto'){\r
-            w = parseInt(s.width, 10);\r
-            if(Ext.isBorderBox){\r
-               w -= this.getFrameWidth('lr');\r
-            }\r
+    /* @private */\r
+    nextFx : function(){        \r
+        var ef = getQueue(this.dom.id)[0];\r
+        if(ef){\r
+            ef.call(this);\r
         }\r
-        if(s.height && s.height != 'auto'){\r
-            h = parseInt(s.height, 10);\r
-            if(Ext.isBorderBox){\r
-               h -= this.getFrameWidth('tb');\r
+    },\r
+\r
+    /**\r
+     * Returns true if the element has any effects actively running or queued, else returns false.\r
+     * @return {Boolean} True if element has active effects, else false\r
+     */\r
+    hasActiveFx : function(){\r
+        return getQueue(this.dom.id)[0];\r
+    },\r
+\r
+    /**\r
+     * Stops any running effects and clears the element's internal effects queue if it contains\r
+     * any additional effects that haven't started yet.\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    stopFx : function(finish){\r
+        var me = this,\r
+            id = me.dom.id;\r
+        if(me.hasActiveFx()){\r
+            var cur = getQueue(id)[0];\r
+            if(cur && cur.anim){\r
+                if(cur.anim.isAnimated){\r
+                    setQueue(id, [cur]); //clear\r
+                    cur.anim.stop(finish !== undefined ? finish : TRUE);\r
+                }else{\r
+                    setQueue(id, []);\r
+                }\r
             }\r
         }\r
-        return {width: w || this.getWidth(true), height: h || this.getHeight(true)};\r
-\r
+        return me;\r
     },\r
 \r
-    \r
-    getViewSize : function(){\r
-        var d = this.dom, doc = document, aw = 0, ah = 0;\r
-        if(d == doc || d == doc.body){\r
-            return {width : D.getViewWidth(), height: D.getViewHeight()};\r
-        }else{\r
-            return {\r
-                width : d.clientWidth,\r
-                height: d.clientHeight\r
-            };\r
+    /* @private */\r
+    beforeFx : function(o){\r
+        if(this.hasActiveFx() && !o.concurrent){\r
+           if(o.stopFx){\r
+               this.stopFx();\r
+               return TRUE;\r
+           }\r
+           return FALSE;\r
         }\r
+        return TRUE;\r
     },\r
 \r
-    \r
-    getValue : function(asNumber){\r
-        return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;\r
+    /**\r
+     * Returns true if the element is currently blocking so that no other effect can be queued\r
+     * until this effect is finished, else returns false if blocking is not set.  This is commonly\r
+     * used to ensure that an effect initiated by a user action runs to completion prior to the\r
+     * same effect being restarted (e.g., firing only one effect even if the user clicks several times).\r
+     * @return {Boolean} True if blocking, else false\r
+     */\r
+    hasFxBlock : function(){\r
+        var q = getQueue(this.dom.id);\r
+        return q && q[0] && q[0].block;\r
     },\r
 \r
-    // private\r
-    adjustWidth : function(width){\r
-        if(typeof width == "number"){\r
-            if(this.autoBoxAdjust && !this.isBorderBox()){\r
-               width -= (this.getBorderWidth("lr") + this.getPadding("lr"));\r
-            }\r
-            if(width < 0){\r
-                width = 0;\r
+    /* @private */\r
+    queueFx : function(o, fn){\r
+        var me = this;\r
+        if(!me.hasFxBlock()){\r
+            Ext.applyIf(o, me.fxDefaults);\r
+            if(!o.concurrent){\r
+                var run = me.beforeFx(o);\r
+                fn.block = o.block;\r
+                getQueue(me.dom.id).push(fn);\r
+                if(run){\r
+                    me.nextFx();\r
+                }\r
+            }else{\r
+                fn.call(me);\r
             }\r
         }\r
-        return width;\r
+        return me;\r
     },\r
 \r
-    // private\r
-    adjustHeight : function(height){\r
-        if(typeof height == "number"){\r
-           if(this.autoBoxAdjust && !this.isBorderBox()){\r
-               height -= (this.getBorderWidth("tb") + this.getPadding("tb"));\r
-           }\r
-           if(height < 0){\r
-               height = 0;\r
-           }\r
+    /* @private */\r
+    fxWrap : function(pos, o, vis){ \r
+        var dom = this.dom,\r
+            wrap,\r
+            wrapXY;\r
+        if(!o.wrap || !(wrap = Ext.getDom(o.wrap))){            \r
+            if(o.fixPosition){\r
+                wrapXY = fly(dom).getXY();\r
+            }\r
+            var div = document.createElement("div");\r
+            div.style.visibility = vis;\r
+            wrap = dom.parentNode.insertBefore(div, dom);\r
+            fly(wrap).setPositioning(pos);\r
+            if(fly(wrap).isStyle(POSITION, "static")){\r
+                fly(wrap).position("relative");\r
+            }\r
+            fly(dom).clearPositioning('auto');\r
+            fly(wrap).clip();\r
+            wrap.appendChild(dom);\r
+            if(wrapXY){\r
+                fly(wrap).setXY(wrapXY);\r
+            }\r
         }\r
-        return height;\r
+        return wrap;\r
     },\r
 \r
-    \r
-    setWidth : function(width, animate){\r
-        width = this.adjustWidth(width);\r
-        if(!animate || !A){\r
-            this.dom.style.width = this.addUnits(width);\r
-        }else{\r
-            this.anim({width: {to: width}}, this.preanim(arguments, 1));\r
+    /* @private */\r
+    fxUnwrap : function(wrap, pos, o){      \r
+        var dom = this.dom;\r
+        fly(dom).clearPositioning();\r
+        fly(dom).setPositioning(pos);\r
+        if(!o.wrap){\r
+            wrap.parentNode.insertBefore(dom, wrap);\r
+            fly(wrap).remove();\r
         }\r
-        return this;\r
     },\r
 \r
-    \r
-     setHeight : function(height, animate){\r
-        height = this.adjustHeight(height);\r
-        if(!animate || !A){\r
-            this.dom.style.height = this.addUnits(height);\r
-        }else{\r
-            this.anim({height: {to: height}}, this.preanim(arguments, 1));\r
-        }\r
-        return this;\r
+    /* @private */\r
+    getFxRestore : function(){\r
+        var st = this.dom.style;\r
+        return {pos: this.getPositioning(), width: st.width, height : st.height};\r
     },\r
 \r
-    \r
-     setSize : function(width, height, animate){\r
-        if(typeof width == "object"){ // in case of object from getSize()\r
-            height = width.height; width = width.width;\r
-        }\r
-        width = this.adjustWidth(width); height = this.adjustHeight(height);\r
-        if(!animate || !A){\r
-            this.dom.style.width = this.addUnits(width);\r
-            this.dom.style.height = this.addUnits(height);\r
-        }else{\r
-            this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));\r
+    /* @private */\r
+    afterFx : function(o){\r
+        var dom = this.dom,\r
+            id = dom.id,\r
+            notConcurrent = !o.concurrent;\r
+        if(o.afterStyle){\r
+            fly(dom).setStyle(o.afterStyle);            \r
         }\r
-        return this;\r
-    },\r
-\r
-    \r
-    setBounds : function(x, y, width, height, animate){\r
-        if(!animate || !A){\r
-            this.setSize(width, height);\r
-            this.setLocation(x, y);\r
-        }else{\r
-            width = this.adjustWidth(width); height = this.adjustHeight(height);\r
-            this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},\r
-                          this.preanim(arguments, 4), 'motion');\r
+        if(o.afterCls){\r
+            fly(dom).addClass(o.afterCls);\r
+        }\r
+        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
+            fly(dom).nextFx();\r
         }\r
-        return this;\r
     },\r
 \r
-    \r
-    setRegion : function(region, animate){\r
-        this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));\r
-        return this;\r
-    },\r
+    /* @private */\r
+    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){\r
+        animType = animType || 'run';\r
+        opt = opt || {};\r
+        var anim = Ext.lib.Anim[animType](\r
+                this.dom, \r
+                args,\r
+                (opt.duration || defaultDur) || .35,\r
+                (opt.easing || defaultEase) || EASEOUT,\r
+                cb,            \r
+                this\r
+            );\r
+        opt.anim = anim;\r
+        return anim;\r
+    }\r
+};\r
 \r
-    \r
-    addListener : function(eventName, fn, scope, options){\r
-        Ext.EventManager.on(this.dom,  eventName, fn, scope || this, options);\r
-    },\r
+// backwards compat\r
+Ext.Fx.resize = Ext.Fx.scale;\r
 \r
-    \r
-    removeListener : function(eventName, fn, scope){\r
-        Ext.EventManager.removeListener(this.dom,  eventName, fn, scope || this);\r
-        return this;\r
-    },\r
+//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
+ * @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
+ */\r
+Ext.CompositeElementLite = function(els, root){\r
+    this.elements = [];\r
+    this.add(els, root);\r
+    this.el = new Ext.Element.Flyweight();\r
+};\r
 \r
-    \r
-    removeAllListeners : function(){\r
-        Ext.EventManager.removeAll(this.dom);\r
+Ext.CompositeElementLite.prototype = {\r
+       isComposite: true,      \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
         return this;\r
     },\r
-\r
-    \r
-    relayEvent : function(eventName, observable){\r
-        this.on(eventName, function(e){\r
-            observable.fireEvent(eventName, e);\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
-    },\r
-\r
-    \r
-     setOpacity : function(opacity, animate){\r
-        if(!animate || !A){\r
-            var s = this.dom.style;\r
-            if(Ext.isIE){\r
-                s.zoom = 1;\r
-                s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +\r
-                           (opacity == 1 ? "" : " alpha(opacity=" + opacity * 100 + ")");\r
-            }else{\r
-                s.opacity = opacity;\r
-            }\r
-        }else{\r
-            this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');\r
-        }\r
         return this;\r
     },\r
-\r
-    \r
-    getLeft : function(local){\r
-        if(!local){\r
-            return this.getX();\r
-        }else{\r
-            return parseInt(this.getStyle("left"), 10) || 0;\r
+    /**\r
+     * Returns a flyweight Element of the dom element object at the specified index\r
+     * @param {Number} index\r
+     * @return {Ext.Element}\r
+     */\r
+    item : function(index){\r
+           var me = this;\r
+        if(!me.elements[index]){\r
+            return null;\r
         }\r
+        me.el.dom = me.elements[index];\r
+        return me.el;\r
     },\r
 \r
-    \r
-    getRight : function(local){\r
-        if(!local){\r
-            return this.getX() + this.getWidth();\r
-        }else{\r
-            return (this.getLeft(true) + this.getWidth()) || 0;\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
+        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
+    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
+        });\r
+        return me;\r
     },\r
-\r
     \r
-    getTop : function(local) {\r
-        if(!local){\r
-            return this.getY();\r
-        }else{\r
-            return parseInt(this.getStyle("top"), 10) || 0;\r
-        }\r
+    /**\r
+     * Find the index of the passed element within the composite collection.\r
+     * @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.\r
+     * @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
     },\r
-\r
     \r
-    getBottom : function(local){\r
-        if(!local){\r
-            return this.getY() + this.getHeight();\r
-        }else{\r
-            return (this.getTop(true) + this.getHeight()) || 0;\r
+    /**\r
+    * Replaces the specified element with the passed element.\r
+    * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite\r
+    * to replace.\r
+    * @param {Mixed} replacement The id of an element or the Element itself.\r
+    * @param {Boolean} domReplace (Optional) True to remove and replace the element in the document too.\r
+    * @return {CompositeElement} this\r
+    */    \r
+    replaceElement : function(el, replacement, domReplace){\r
+        var index = !isNaN(el) ? el : this.indexOf(el),\r
+               d;\r
+        if(index > -1){\r
+            replacement = Ext.getDom(replacement);\r
+            if(domReplace){\r
+                d = this.elements[index];\r
+                d.parentNode.insertBefore(replacement, d);\r
+                Ext.removeNode(d);\r
+            }\r
+            this.elements.splice(index, 1, replacement);\r
         }\r
+        return this;\r
     },\r
-\r
     \r
-    position : function(pos, zIndex, x, y){\r
-        if(!pos){\r
-           if(this.getStyle('position') == 'static'){\r
-               this.setStyle('position', 'relative');\r
-           }\r
-        }else{\r
-            this.setStyle("position", pos);\r
-        }\r
-        if(zIndex){\r
-            this.setStyle("z-index", zIndex);\r
+    /**\r
+     * Removes all elements.\r
+     */\r
+    clear : function(){\r
+        this.elements = [];\r
+    }\r
+};\r
+\r
+Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;\r
+\r
+(function(){\r
+var fnName,\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
+        \r
+    }\r
+}\r
+})();\r
+\r
+if(Ext.DomQuery){\r
+    Ext.Element.selectorFunction = Ext.DomQuery.select;\r
+} \r
+\r
+/**\r
+ * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
+ * 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
+    var els;\r
+    if(typeof selector == "string"){\r
+        els = Ext.Element.selectorFunction(selector, root);\r
+    }else if(selector.length !== undefined){\r
+        els = selector;\r
+    }else{\r
+        throw "Invalid selector";\r
+    }\r
+    return new Ext.CompositeElementLite(els);\r
+};\r
+/**\r
+ * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
+ * 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
+ * @method select\r
+ */\r
+Ext.select = Ext.Element.select;/**\r
+ * @class Ext.CompositeElementLite\r
+ */\r
+Ext.apply(Ext.CompositeElementLite.prototype, {        \r
+       addElements : function(els, root){\r
+        if(!els){\r
+            return this;\r
         }\r
-        if(x !== undefined && y !== undefined){\r
-            this.setXY([x, y]);\r
-        }else if(x !== undefined){\r
-            this.setX(x);\r
-        }else if(y !== undefined){\r
-            this.setY(y);\r
+        if(typeof els == "string"){\r
+            els = Ext.Element.selectorFunction(els, root);\r
         }\r
-    },\r
-\r
-    \r
-    clearPositioning : function(value){\r
-        value = value ||'';\r
-        this.setStyle({\r
-            "left": value,\r
-            "right": value,\r
-            "top": value,\r
-            "bottom": value,\r
-            "z-index": "",\r
-            "position" : "static"\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
-    getPositioning : function(){\r
-        var l = this.getStyle("left");\r
-        var t = this.getStyle("top");\r
-        return {\r
-            "position" : this.getStyle("position"),\r
-            "left" : l,\r
-            "right" : l ? "" : this.getStyle("right"),\r
-            "top" : t,\r
-            "bottom" : t ? "" : this.getStyle("bottom"),\r
-            "z-index" : this.getStyle("z-index")\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
-    getBorderWidth : function(side){\r
-        return this.addStyles(side, El.borders);\r
-    },\r
-\r
+    /**\r
+     * Returns the first Element\r
+     * @return {Ext.Element}\r
+     */\r
+    first : function(){\r
+        return this.item(0);\r
+    },   \r
     \r
-    getPadding : function(side){\r
-        return this.addStyles(side, El.paddings);\r
+    /**\r
+     * Returns the last Element\r
+     * @return {Ext.Element}\r
+     */\r
+    last : function(){\r
+        return this.item(this.getCount()-1);\r
     },\r
-\r
     \r
-    setPositioning : function(pc){\r
-        this.applyStyles(pc);\r
-        if(pc.right == "auto"){\r
-            this.dom.style.right = "";\r
-        }\r
-        if(pc.bottom == "auto"){\r
-            this.dom.style.bottom = "";\r
-        }\r
-        return this;\r
+    /**\r
+     * Returns true if this composite contains the passed element\r
+     * @param el {Mixed} The id of an element, or an Ext.Element, or an HtmlElement to find within the composite collection.\r
+     * @return Boolean\r
+     */\r
+    contains : function(el){\r
+        return this.indexOf(el) != -1;\r
     },\r
 \r
-    // private\r
-    fixDisplay : function(){\r
-        if(this.getStyle("display") == "none"){\r
-            this.setStyle("visibility", "hidden");\r
-            this.setStyle("display", this.originalDisplay); // first try reverting to default\r
-            if(this.getStyle("display") == "none"){ // if that fails, default to block\r
-                this.setStyle("display", "block");\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
-    },\r
-\r
-    // private\r
-       setOverflow : function(v){\r
-       if(v=='auto' && Ext.isMac && Ext.isGecko2){ // work around stupid FF 2.0/Mac scroll bar bug\r
-               this.dom.style.overflow = 'hidden';\r
-               (function(){this.dom.style.overflow = 'auto';}).defer(1, this);\r
-       }else{\r
-               this.dom.style.overflow = v;\r
-       }\r
-       },\r
-\r
-    \r
-     setLeftTop : function(left, top){\r
-        this.dom.style.left = this.addUnits(left);\r
-        this.dom.style.top = this.addUnits(top);\r
+        });\r
+        this.fill(els);\r
         return this;\r
-    },\r
+    },
+    
+    /**\r
+    * Removes the specified element(s).\r
+    * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite\r
+    * or an array of any of those.\r
+    * @param {Boolean} removeDom (optional) True to also remove the element from the document\r
+    * @return {CompositeElement} this\r
+    */\r
+    removeElement : function(keys, removeDom){\r
+        var me = this,\r
+               els = this.elements,        \r
+               el;             \r
+           Ext.each(keys, function(val){\r
+                   if ((el = (els[val] || els[val = me.indexOf(val)]))) {\r
+                       if(removeDom){\r
+                    if(el.dom){\r
+                        el.remove();\r
+                    }else{\r
+                        Ext.removeNode(el);\r
+                    }\r
+                }\r
+                       els.splice(val, 1);                     \r
+                       }\r
+           });\r
+        return this;\r
+    }    \r
+});
+/**\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
+ */\r
+Ext.CompositeElement = function(els, root){\r
+    this.elements = [];\r
+    this.add(els, root);\r
+};\r
 \r
-    \r
-     move : function(direction, distance, animate){\r
-        var xy = this.getXY();\r
-        direction = direction.toLowerCase();\r
-        switch(direction){\r
-            case "l":\r
-            case "left":\r
-                this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));\r
-                break;\r
-           case "r":\r
-           case "right":\r
-                this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));\r
-                break;\r
-           case "t":\r
-           case "top":\r
-           case "up":\r
-                this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));\r
-                break;\r
-           case "b":\r
-           case "bottom":\r
-           case "down":\r
-                this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));\r
-                break;\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
-\r
     \r
-    clip : function(){\r
-        if(!this.isClipped){\r
-           this.isClipped = true;\r
-           this.originalClip = {\r
-               "o": this.getStyle("overflow"),\r
-               "x": this.getStyle("overflow-x"),\r
-               "y": this.getStyle("overflow-y")\r
-           };\r
-           this.setStyle("overflow", "hidden");\r
-           this.setStyle("overflow-x", "hidden");\r
-           this.setStyle("overflow-y", "hidden");\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
+     * 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
-    unclip : function(){\r
-        if(this.isClipped){\r
-            this.isClipped = false;\r
-            var o = this.originalClip;\r
-            if(o.o){this.setStyle("overflow", o.o);}\r
-            if(o.x){this.setStyle("overflow-x", o.x);}\r
-            if(o.y){this.setStyle("overflow-y", o.y);}\r
-        }\r
-        return this;\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
 \r
+/**\r
+ * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
+ * 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.Element\r
+ * @method select\r
+ */\r
+Ext.Element.select = function(selector, unique, root){\r
+    var els;\r
+    if(typeof selector == "string"){\r
+        els = Ext.Element.selectorFunction(selector, root);\r
+    }else if(selector.length !== undefined){\r
+        els = selector;\r
+    }else{\r
+        throw "Invalid selector";\r
+    }\r
 \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
+    return (unique === true) ? new Ext.CompositeElement(els) : new Ext.CompositeElementLite(els);\r
+};
+\r
+/**\r
+ * Selects elements based on the passed CSS selector to enable {@link Ext.Element Element} methods\r
+ * 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.Element\r
+ * @method select\r
+ */\r
+Ext.select = Ext.Element.select;(function(){\r
+    var BEFOREREQUEST = "beforerequest",\r
+        REQUESTCOMPLETE = "requestcomplete",\r
+        REQUESTEXCEPTION = "requestexception",\r
+        UNDEFINED = undefined,\r
+        LOAD = 'load',\r
+        POST = 'POST',\r
+        GET = 'GET',\r
+        WINDOW = window;\r
+    \r
+    /**\r
+     * @class Ext.data.Connection\r
+     * @extends Ext.util.Observable\r
+     * <p>The class encapsulates a connection to the page's originating domain, allowing requests to be made\r
+     * either to a configured URL, or to a URL specified at request time.</p>\r
+     * <p>Requests made by this class are asynchronous, and will return immediately. No data from\r
+     * the server will be available to the statement immediately following the {@link #request} call.\r
+     * To process returned data, use a\r
+     * <a href="#request-option-success" ext:member="request-option-success" ext:cls="Ext.data.Connection">success callback</a>\r
+     * in the request options object,\r
+     * or an {@link #requestcomplete event listener}.</p>\r
+     * <p><h3>File Uploads</h3><a href="#request-option-isUpload" ext:member="request-option-isUpload" ext:cls="Ext.data.Connection">File uploads</a> are not performed using normal "Ajax" techniques, that\r
+     * is they are <b>not</b> performed using XMLHttpRequests. Instead the form is submitted in the standard\r
+     * manner with the DOM <tt>&lt;form></tt> element temporarily modified to have its\r
+     * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer\r
+     * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document\r
+     * but removed after the return data has been gathered.</p>\r
+     * <p>The server response is parsed by the browser to create the document for the IFRAME. If the\r
+     * server is using JSON to send the return object, then the\r
+     * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header\r
+     * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>\r
+     * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode\r
+     * "&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>\r
+     * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object\r
+     * is created containing a <tt>responseText</tt> property in order to conform to the\r
+     * requirements of event handlers and callbacks.</p>\r
+     * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>\r
+     * and some server technologies (notably JEE) may require some custom processing in order to\r
+     * retrieve parameter names and parameter values from the packet content.</p>\r
+     * @constructor\r
+     * @param {Object} config a configuration object.\r
+     */\r
+    Ext.data.Connection = function(config){    \r
+        Ext.apply(this, config);\r
+        this.addEvents(\r
+            /**\r
+             * @event beforerequest\r
+             * Fires before a network request is made to retrieve a data object.\r
+             * @param {Connection} conn This Connection object.\r
+             * @param {Object} options The options config object passed to the {@link #request} method.\r
+             */\r
+            BEFOREREQUEST,\r
+            /**\r
+             * @event requestcomplete\r
+             * Fires if the request was successfully completed.\r
+             * @param {Connection} conn This Connection object.\r
+             * @param {Object} response The XHR object containing the response data.\r
+             * See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>\r
+             * for details.\r
+             * @param {Object} options The options config object passed to the {@link #request} method.\r
+             */\r
+            REQUESTCOMPLETE,\r
+            /**\r
+             * @event requestexception\r
+             * Fires if an error HTTP status was returned from the server.\r
+             * See <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html">HTTP Status Code Definitions</a>\r
+             * for details of HTTP status codes.\r
+             * @param {Connection} conn This Connection object.\r
+             * @param {Object} response The XHR object containing the response data.\r
+             * See <a href="http://www.w3.org/TR/XMLHttpRequest/">The XMLHttpRequest Object</a>\r
+             * for details.\r
+             * @param {Object} options The options config object passed to the {@link #request} method.\r
+             */\r
+            REQUESTEXCEPTION\r
+        );\r
+        Ext.data.Connection.superclass.constructor.call(this);\r
+    };\r
 \r
-        var w, h, vp = false;\r
-        if(!s){\r
-            var d = this.dom;\r
-            if(d == document.body || d == document){\r
-                vp = true;\r
-                w = D.getViewWidth(); h = D.getViewHeight();\r
-            }else{\r
-                w = this.getWidth(); h = this.getHeight();\r
-            }\r
-        }else{\r
-            w = s.width;  h = s.height;\r
-        }\r
-        var x = 0, y = 0, r = Math.round;\r
-        switch((anchor || "tl").toLowerCase()){\r
-            case "c":\r
-                x = r(w*.5);\r
-                y = r(h*.5);\r
-            break;\r
-            case "t":\r
-                x = r(w*.5);\r
-                y = 0;\r
-            break;\r
-            case "l":\r
-                x = 0;\r
-                y = r(h*.5);\r
-            break;\r
-            case "r":\r
-                x = w;\r
-                y = r(h*.5);\r
-            break;\r
-            case "b":\r
-                x = r(w*.5);\r
-                y = h;\r
-            break;\r
-            case "tl":\r
-                x = 0;\r
-                y = 0;\r
-            break;\r
-            case "bl":\r
-                x = 0;\r
-                y = h;\r
-            break;\r
-            case "br":\r
-                x = w;\r
-                y = h;\r
-            break;\r
-            case "tr":\r
-                x = w;\r
-                y = 0;\r
-            break;\r
-        }\r
-        if(local === true){\r
-            return [x, y];\r
-        }\r
-        if(vp){\r
-            var sc = this.getScroll();\r
-            return [x + sc.left, y + sc.top];\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
-        //Add the element's offset xy\r
-        var o = this.getXY();\r
-        return [x+o[0], y+o[1]];\r
-    },\r
-\r
-    \r
-    getAlignToXY : function(el, p, o){\r
-        el = Ext.get(el);\r
-        if(!el || !el.dom){\r
-            throw "Element.alignToXY with an element that doesn't exist";\r
+        if(options.callback){\r
+            options.callback.call(options.scope, options, true, response);\r
         }\r
-        var d = this.dom;\r
-        var c = false; //constrain to viewport\r
-        var p1 = "", p2 = "";\r
-        o = o || [0,0];\r
+    }\r
 \r
-        if(!p){\r
-            p = "tl-bl";\r
-        }else if(p == "?"){\r
-            p = "tl-bl?";\r
-        }else if(p.indexOf("-") == -1){\r
-            p = "tl-" + p;\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
-        p = p.toLowerCase();\r
-        var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);\r
-        if(!m){\r
-           throw "Element.alignTo with an invalid alignment " + p;\r
+        if(options.callback){\r
+            options.callback.call(options.scope, options, false, response);\r
         }\r
-        p1 = m[1]; p2 = m[2]; 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
-        var a1 = this.getAnchorXY(p1, true);\r
-        var a2 = el.getAnchorXY(p2, false);\r
-\r
-        var x = a2[0] - a1[0] + o[0];\r
-        var y = a2[1] - a1[1] + o[1];\r
-\r
-        if(c){\r
-            //constrain the aligned el to viewport if necessary\r
-            var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();\r
-            // 5px of margin for ie\r
-            var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;\r
-\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
-            var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);\r
-           var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);\r
-           var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));\r
-           var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));\r
-\r
-           var doc = document;\r
-           var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;\r
-           var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;\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
     // private\r
-    getConstrainToXY : function(){\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
+    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
-            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
+        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
-            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
+            Ext.EventManager.removeListener(frame, LOAD, cb, me);\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
+            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
-            // only move it if it needs it\r
-            var moved = false;\r
+            runCallback(o.success, o.scope, [r, o]);\r
+            runCallback(o.callback, o.scope, [o, true, r]);\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
+            if(!me.debugUploads){\r
+                setTimeout(function(){Ext.removeNode(frame);}, 100);\r
             }\r
-            return moved ? [x, y] : false;\r
-        };\r
-    }(),\r
+        }\r
 \r
-    // private\r
-    adjustForConstraints : function(xy, parent, offsets){\r
-        return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;\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
+         * <p>The <code>url</code> config may be a function which <i>returns</i> the URL to use for the Ajax request. The scope\r
+         * (<code><b>this</b></code> reference) of the function is the <code>scope</code> option passed to the {@link #request} method.</p>\r
+         */\r
+        /**\r
+         * @cfg {Object} extraParams (Optional) An object containing properties which are used as\r
+         * extra parameters to each request made by this object. (defaults to undefined)\r
+         */\r
+        /**\r
+         * @cfg {Object} defaultHeaders (Optional) An object containing request headers which are added\r
+         *  to each request made by this object. (defaults to undefined)\r
+         */\r
+        /**\r
+         * @cfg {String} method (Optional) The default HTTP method to be used for requests.\r
+         * (defaults to undefined; if not set, but {@link #request} params are present, POST will be used;\r
+         * otherwise, GET will be used.)\r
+         */\r
+        /**\r
+         * @cfg {Number} timeout (Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)\r
+         */\r
+        timeout : 30000,\r
+        /**\r
+         * @cfg {Boolean} autoAbort (Optional) Whether this request should abort any pending requests. (defaults to false)\r
+         * @type Boolean\r
+         */\r
+        autoAbort:false,\r
+    \r
+        /**\r
+         * @cfg {Boolean} disableCaching (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)\r
+         * @type Boolean\r
+         */\r
+        disableCaching: true,\r
+        \r
+        /**\r
+         * @cfg {String} disableCachingParam (Optional) Change the parameter which is sent went disabling caching\r
+         * through a cache buster. Defaults to '_dc'\r
+         * @type String\r
+         */\r
+        disableCachingParam: '_dc',\r
+        \r
+        /**\r
+         * <p>Sends an HTTP request to a remote server.</p>\r
+         * <p><b>Important:</b> Ajax server requests are asynchronous, and this call will\r
+         * return before the response has been received. Process any returned data\r
+         * in a callback function.</p>\r
+         * <pre><code>\r
+Ext.Ajax.request({\r
+   url: 'ajax_demo/sample.json',\r
+   success: function(response, opts) {\r
+      var obj = Ext.decode(response.responseText);\r
+      console.dir(obj);\r
+   },\r
+   failure: function(response, opts) {\r
+      console.log('server-side failure with status code ' + response.status);\r
+   }\r
+});\r
+         * </code></pre>\r
+         * <p>To execute a callback function in the correct scope, use the <tt>scope</tt> option.</p>\r
+         * @param {Object} options An object which may contain the following properties:<ul>\r
+         * <li><b>url</b> : String/Function (Optional)<div class="sub-desc">The URL to\r
+         * which to send the request, or a function to call which returns a URL string. The scope of the\r
+         * function is specified by the <tt>scope</tt> option. Defaults to the configured\r
+         * <tt>{@link #url}</tt>.</div></li>\r
+         * <li><b>params</b> : Object/String/Function (Optional)<div class="sub-desc">\r
+         * An object containing properties which are used as parameters to the\r
+         * request, a url encoded string or a function to call to get either. The scope of the function\r
+         * is specified by the <tt>scope</tt> option.</div></li>\r
+         * <li><b>method</b> : String (Optional)<div class="sub-desc">The HTTP method to use\r
+         * for the request. Defaults to the configured method, or if no method was configured,\r
+         * "GET" if no parameters are being sent, and "POST" if parameters are being sent.  Note that\r
+         * the method name is case-sensitive and should be all caps.</div></li>\r
+         * <li><b>callback</b> : Function (Optional)<div class="sub-desc">The\r
+         * function to be called upon receipt of the HTTP response. The callback is\r
+         * called regardless of success or failure and is passed the following\r
+         * parameters:<ul>\r
+         * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>\r
+         * <li><b>success</b> : Boolean<div class="sub-desc">True if the request succeeded.</div></li>\r
+         * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data. \r
+         * See <a href="http://www.w3.org/TR/XMLHttpRequest/">http://www.w3.org/TR/XMLHttpRequest/</a> for details about \r
+         * accessing elements of the response.</div></li>\r
+         * </ul></div></li>\r
+         * <li><a id="request-option-success"></a><b>success</b> : Function (Optional)<div class="sub-desc">The function\r
+         * to be called upon success of the request. The callback is passed the following\r
+         * parameters:<ul>\r
+         * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>\r
+         * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>\r
+         * </ul></div></li>\r
+         * <li><b>failure</b> : Function (Optional)<div class="sub-desc">The function\r
+         * to be called upon failure of the request. The callback is passed the\r
+         * following parameters:<ul>\r
+         * <li><b>response</b> : Object<div class="sub-desc">The XMLHttpRequest object containing the response data.</div></li>\r
+         * <li><b>options</b> : Object<div class="sub-desc">The parameter to the request call.</div></li>\r
+         * </ul></div></li>\r
+         * <li><b>scope</b> : Object (Optional)<div class="sub-desc">The scope in\r
+         * which to execute the callbacks: The "this" object for the callback function. If the <tt>url</tt>, or <tt>params</tt> options were\r
+         * specified as functions from which to draw values, then this also serves as the scope for those function calls.\r
+         * Defaults to the browser window.</div></li>\r
+         * <li><b>timeout</b> : Number (Optional)<div class="sub-desc">The timeout in milliseconds to be used for this request. Defaults to 30 seconds.</div></li>\r
+         * <li><b>form</b> : Element/HTMLElement/String (Optional)<div class="sub-desc">The <tt>&lt;form&gt;</tt>\r
+         * Element or the id of the <tt>&lt;form&gt;</tt> to pull parameters from.</div></li>\r
+         * <li><a id="request-option-isUpload"></a><b>isUpload</b> : Boolean (Optional)<div class="sub-desc"><b>Only meaningful when used \r
+         * with the <tt>form</tt> option</b>.\r
+         * <p>True if the form object is a file upload (will be set automatically if the form was\r
+         * configured with <b><tt>enctype</tt></b> "multipart/form-data").</p>\r
+         * <p>File uploads are not performed using normal "Ajax" techniques, that is they are <b>not</b>\r
+         * performed using XMLHttpRequests. Instead the form is submitted in the standard manner with the\r
+         * DOM <tt>&lt;form></tt> element temporarily modified to have its\r
+         * <a href="http://www.w3.org/TR/REC-html40/present/frames.html#adef-target">target</a> set to refer\r
+         * to a dynamically generated, hidden <tt>&lt;iframe></tt> which is inserted into the document\r
+         * but removed after the return data has been gathered.</p>\r
+         * <p>The server response is parsed by the browser to create the document for the IFRAME. If the\r
+         * server is using JSON to send the return object, then the\r
+         * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header\r
+         * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>\r
+         * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object\r
+         * is created containing a <tt>responseText</tt> property in order to conform to the\r
+         * requirements of event handlers and callbacks.</p>\r
+         * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>\r
+         * and some server technologies (notably JEE) may require some custom processing in order to\r
+         * retrieve parameter names and parameter values from the packet content.</p>\r
+         * </div></li>\r
+         * <li><b>headers</b> : Object (Optional)<div class="sub-desc">Request\r
+         * headers to set for the request.</div></li>\r
+         * <li><b>xmlData</b> : Object (Optional)<div class="sub-desc">XML document\r
+         * to use for the post. Note: This will be used instead of params for the post\r
+         * data. Any params will be appended to the URL.</div></li>\r
+         * <li><b>jsonData</b> : Object/String (Optional)<div class="sub-desc">JSON\r
+         * data to use as the post. Note: This will be used instead of params for the post\r
+         * data. Any params will be appended to the URL.</div></li>\r
+         * <li><b>disableCaching</b> : Boolean (Optional)<div class="sub-desc">True\r
+         * to add a unique cache-buster param to GET requests.</div></li>\r
+         * </ul></p>\r
+         * <p>The options object may also contain any other property which might be needed to perform\r
+         * postprocessing in a callback because it is passed to callback functions.</p>\r
+         * @return {Number} transactionId The id of the server transaction. This may be used\r
+         * to cancel the request.\r
+         */\r
+        request : function(o){\r
+            var me = this;\r
+            if(me.fireEvent(BEFOREREQUEST, me, o)){\r
+                if (o.el) {\r
+                    if(!Ext.isEmpty(o.indicatorText)){\r
+                        me.indicatorText = '<div class="loading-indicator">'+o.indicatorText+"</div>";\r
+                    }\r
+                    if(me.indicatorText) {\r
+                        Ext.getDom(o.el).innerHTML = me.indicatorText;                        \r
+                    }\r
+                    o.success = (Ext.isFunction(o.success) ? o.success : function(){}).createInterceptor(function(response) {\r
+                        Ext.getDom(o.el).innerHTML = response.responseText;\r
+                    });\r
+                }\r
+                \r
+                var p = o.params,\r
+                    url = o.url || me.url,                \r
+                    method,\r
+                    cb = {success: handleResponse,\r
+                          failure: handleFailure,\r
+                          scope: me,\r
+                          argument: {options: o},\r
+                          timeout : o.timeout || me.timeout\r
+                    },\r
+                    form,                    \r
+                    serForm;                    \r
+                  \r
+                     \r
+                if (Ext.isFunction(p)) {\r
+                    p = p.call(o.scope||WINDOW, o);\r
+                }\r
+                                                           \r
+                p = Ext.urlEncode(me.extraParams, Ext.isObject(p) ? Ext.urlEncode(p) : p);    \r
+                \r
+                if (Ext.isFunction(url)) {\r
+                    url = url.call(o.scope || WINDOW, o);\r
+                }\r
     \r
-    alignTo : function(element, position, offsets, animate){\r
-        var xy = this.getAlignToXY(element, position, offsets);\r
-        this.setXY(xy, this.preanim(arguments, 3));\r
-        return this;\r
-    },\r
-\r
+                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
+                     }\r
+                    serForm = Ext.lib.Ajax.serializeForm(form);                    \r
+                    p = p ? (p + '&' + serForm) : serForm;\r
+                }\r
+                \r
+                method = o.method || me.method || ((p || o.xmlData || o.jsonData) ? POST : GET);\r
+                \r
+                if(method === GET && (me.disableCaching && o.disableCaching !== false) || o.disableCaching === true){\r
+                    var dcp = o.disableCachingParam || me.disableCachingParam;\r
+                    url = Ext.urlAppend(url, dcp + '=' + (new Date().getTime()));\r
+                }\r
+                \r
+                o.headers = Ext.apply(o.headers || {}, me.defaultHeaders || {});\r
+                \r
+                if(o.autoAbort === true || me.autoAbort) {\r
+                    me.abort();\r
+                }\r
+                 \r
+                if((method == GET || o.xmlData || o.jsonData) && p){\r
+                    url = Ext.urlAppend(url, p);  \r
+                    p = '';\r
+                }\r
+                return (me.transId = Ext.lib.Ajax.request(method, url, cb, p, o));\r
+            }else{                \r
+                return o.callback ? o.callback.apply(o.scope, [o,UNDEFINED,UNDEFINED]) : null;\r
+            }\r
+        },\r
     \r
-    anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){\r
-        var action = function(){\r
-            this.alignTo(el, alignment, offsets, animate);\r
-            Ext.callback(callback, this);\r
-        };\r
-        Ext.EventManager.onWindowResize(action, this);\r
-        var tm = typeof monitorScroll;\r
-        if(tm != 'undefined'){\r
-            Ext.EventManager.on(window, 'scroll', action, this,\r
-                {buffer: tm == 'number' ? monitorScroll : 50});\r
-        }\r
-        action.call(this); // align immediately\r
-        return this;\r
-    },\r
+        /**\r
+         * Determine whether this object has a request outstanding.\r
+         * @param {Number} transactionId (Optional) defaults to the last transaction\r
+         * @return {Boolean} True if there is an outstanding request.\r
+         */\r
+        isLoading : function(transId){\r
+            return transId ? Ext.lib.Ajax.isCallInProgress(transId) : !! this.transId;            \r
+        },\r
     \r
-    clearOpacity : function(){\r
-        if (window.ActiveXObject) {\r
-            if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){\r
-                this.dom.style.filter = "";\r
+        /**\r
+         * Aborts any outstanding request.\r
+         * @param {Number} transactionId (Optional) defaults to the last transaction\r
+         */\r
+        abort : function(transId){\r
+            if(transId || this.isLoading()){\r
+                Ext.lib.Ajax.abort(transId || this.transId);\r
             }\r
-        } else {\r
-            this.dom.style.opacity = "";\r
-            this.dom.style["-moz-opacity"] = "";\r
-            this.dom.style["-khtml-opacity"] = "";\r
         }\r
-        return this;\r
-    },\r
+    });\r
+})();\r
 \r
-    \r
-    hide : function(animate){\r
-        this.setVisible(false, this.preanim(arguments, 0));\r
-        return this;\r
-    },\r
+/**\r
+ * @class Ext.Ajax\r
+ * @extends Ext.data.Connection\r
+ * <p>The global Ajax request class that provides a simple way to make Ajax requests\r
+ * with maximum flexibility.</p>\r
+ * <p>Since Ext.Ajax is a singleton, you can set common properties/events for it once\r
+ * and override them at the request function level only if necessary.</p>\r
+ * <p>Common <b>Properties</b> you may want to set are:<div class="mdetail-params"><ul>\r
+ * <li><b><tt>{@link #method}</tt></b><p class="sub-desc"></p></li>\r
+ * <li><b><tt>{@link #extraParams}</tt></b><p class="sub-desc"></p></li>\r
+ * <li><b><tt>{@link #url}</tt></b><p class="sub-desc"></p></li>\r
+ * </ul></div>\r
+ * <pre><code>\r
+// Default headers to pass in every request\r
+Ext.Ajax.defaultHeaders = {\r
+    'Powered-By': 'Ext'\r
+};\r
+ * </code></pre> \r
+ * </p>\r
+ * <p>Common <b>Events</b> you may want to set are:<div class="mdetail-params"><ul>\r
+ * <li><b><tt>{@link Ext.data.Connection#beforerequest beforerequest}</tt></b><p class="sub-desc"></p></li>\r
+ * <li><b><tt>{@link Ext.data.Connection#requestcomplete requestcomplete}</tt></b><p class="sub-desc"></p></li>\r
+ * <li><b><tt>{@link Ext.data.Connection#requestexception requestexception}</tt></b><p class="sub-desc"></p></li>\r
+ * </ul></div>\r
+ * <pre><code>\r
+// Example: show a spinner during all Ajax requests\r
+Ext.Ajax.on('beforerequest', this.showSpinner, this);\r
+Ext.Ajax.on('requestcomplete', this.hideSpinner, this);\r
+Ext.Ajax.on('requestexception', this.hideSpinner, this);\r
+ * </code></pre> \r
+ * </p>\r
+ * <p>An example request:</p>\r
+ * <pre><code>\r
+// Basic request\r
+Ext.Ajax.{@link Ext.data.Connection#request request}({\r
+   url: 'foo.php',\r
+   success: someFn,\r
+   failure: otherFn,\r
+   headers: {\r
+       'my-header': 'foo'\r
+   },\r
+   params: { foo: 'bar' }\r
+});\r
 \r
-    \r
-    show : function(animate){\r
-        this.setVisible(true, this.preanim(arguments, 0));\r
-        return this;\r
-    },\r
+// Simple ajax form submission\r
+Ext.Ajax.{@link Ext.data.Connection#request request}({\r
+    form: 'some-form',\r
+    params: 'foo=bar'\r
+});\r
+ * </code></pre> \r
+ * </p>\r
+ * @singleton\r
+ */\r
+Ext.Ajax = new Ext.data.Connection({\r
+    /**\r
+     * @cfg {String} url @hide\r
+     */\r
+    /**\r
+     * @cfg {Object} extraParams @hide\r
+     */\r
+    /**\r
+     * @cfg {Object} defaultHeaders @hide\r
+     */\r
+    /**\r
+     * @cfg {String} method (Optional) @hide\r
+     */\r
+    /**\r
+     * @cfg {Number} timeout (Optional) @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} autoAbort (Optional) @hide\r
+     */\r
+\r
+    /**\r
+     * @cfg {Boolean} disableCaching (Optional) @hide\r
+     */\r
+\r
+    /**\r
+     * @property  disableCaching\r
+     * True to add a unique cache-buster param to GET requests. (defaults to true)\r
+     * @type Boolean\r
+     */\r
+    /**\r
+     * @property  url\r
+     * The default URL to be used for requests to the server. (defaults to undefined)\r
+     * If the server receives all requests through one URL, setting this once is easier than\r
+     * entering it on every request.\r
+     * @type String\r
+     */\r
+    /**\r
+     * @property  extraParams\r
+     * An object containing properties which are used as extra parameters to each request made\r
+     * by this object (defaults to undefined). Session information and other data that you need\r
+     * to pass with each request are commonly put here.\r
+     * @type Object\r
+     */\r
+    /**\r
+     * @property  defaultHeaders\r
+     * An object containing request headers which are added to each request made by this object\r
+     * (defaults to undefined).\r
+     * @type Object\r
+     */\r
+    /**\r
+     * @property  method\r
+     * The default HTTP method to be used for requests. Note that this is case-sensitive and\r
+     * should be all caps (defaults to undefined; if not set but params are present will use\r
+     * <tt>"POST"</tt>, otherwise will use <tt>"GET"</tt>.)\r
+     * @type String\r
+     */\r
+    /**\r
+     * @property  timeout\r
+     * The timeout in milliseconds to be used for requests. (defaults to 30000)\r
+     * @type Number\r
+     */\r
+\r
+    /**\r
+     * @property  autoAbort\r
+     * Whether a new request should abort any pending requests. (defaults to false)\r
+     * @type Boolean\r
+     */\r
+    autoAbort : false,\r
 \r
-    \r
-    addUnits : function(size){\r
-        return Ext.Element.addUnits(size, this.defaultUnit);\r
-    },\r
+    /**\r
+     * Serialize the passed form into a url encoded string\r
+     * @param {String/HTMLElement} form\r
+     * @return {String}\r
+     */\r
+    serializeForm : function(form){\r
+        return Ext.lib.Ajax.serializeForm(form);\r
+    }\r
+});\r
+/**
+ * @class Ext.Updater
+ * @extends Ext.util.Observable
+ * Provides AJAX-style update capabilities for Element objects.  Updater can be used to {@link #update}
+ * an {@link Ext.Element} once, or you can use {@link #startAutoRefresh} to set up an auto-updating
+ * {@link Ext.Element Element} on a specific interval.<br><br>
+ * Usage:<br>
+ * <pre><code>
+ * var el = Ext.get("foo"); // Get Ext.Element object
+ * var mgr = el.getUpdater();
+ * mgr.update({
+        url: "http://myserver.com/index.php",
+        params: {
+            param1: "foo",
+            param2: "bar"
+        }
+ * });
+ * ...
+ * mgr.formUpdate("myFormId", "http://myserver.com/index.php");
+ * <br>
+ * // or directly (returns the same Updater instance)
+ * var mgr = new Ext.Updater("myElementId");
+ * mgr.startAutoRefresh(60, "http://myserver.com/index.php");
+ * mgr.on("update", myFcnNeedsToKnow);
+ * <br>
+ * // short handed call directly from the element object
+ * Ext.get("foo").load({
+        url: "bar.php",
+        scripts: true,
+        params: "param1=foo&amp;param2=bar",
+        text: "Loading Foo..."
+ * });
+ * </code></pre>
+ * @constructor
+ * Create new Updater directly.
+ * @param {Mixed} el The element to update
+ * @param {Boolean} forceNew (optional) By default the constructor checks to see if the passed element already
+ * has an Updater and if it does it returns the same instance. This will skip that check (useful for extending this class).
+ */
+Ext.UpdateManager = Ext.Updater = Ext.extend(Ext.util.Observable, 
+function() {
+       var BEFOREUPDATE = "beforeupdate",
+               UPDATE = "update",
+               FAILURE = "failure";
+               
+       // private
+    function processSuccess(response){     
+           var me = this;
+        me.transaction = null;
+        if (response.argument.form && response.argument.reset) {
+            try { // put in try/catch since some older FF releases had problems with this
+                response.argument.form.reset();
+            } catch(e){}
+        }
+        if (me.loadScripts) {
+            me.renderer.render(me.el, response, me,
+               updateComplete.createDelegate(me, [response]));
+        } else {
+            me.renderer.render(me.el, response, me);
+            updateComplete.call(me, response);
+        }
+    }
+    
+    // private
+    function updateComplete(response, type, success){
+        this.fireEvent(type || UPDATE, this.el, response);
+        if(Ext.isFunction(response.argument.callback)){
+            response.argument.callback.call(response.argument.scope, this.el, Ext.isEmpty(success) ? true : false, response, response.argument.options);
+        }
+    }
+
+    // private
+    function processFailure(response){             
+        updateComplete.call(this, response, FAILURE, !!(this.transaction = null));
+    }
+           
+       return {
+           constructor: function(el, forceNew){
+                   var me = this;
+               el = Ext.get(el);
+               if(!forceNew && el.updateManager){
+                   return el.updateManager;
+               }
+               /**
+                * The Element object
+                * @type Ext.Element
+                */
+               me.el = el;
+               /**
+                * Cached url to use for refreshes. Overwritten every time update() is called unless "discardUrl" param is set to true.
+                * @type String
+                */
+               me.defaultUrl = null;
+       
+               me.addEvents(
+                   /**
+                    * @event beforeupdate
+                    * Fired before an update is made, return false from your handler and the update is cancelled.
+                    * @param {Ext.Element} el
+                    * @param {String/Object/Function} url
+                    * @param {String/Object} params
+                    */
+                   BEFOREUPDATE,
+                   /**
+                    * @event update
+                    * Fired after successful update is made.
+                    * @param {Ext.Element} el
+                    * @param {Object} oResponseObject The response Object
+                    */
+                   UPDATE,
+                   /**
+                    * @event failure
+                    * Fired on update failure.
+                    * @param {Ext.Element} el
+                    * @param {Object} oResponseObject The response Object
+                    */
+                   FAILURE
+               );
+       
+               Ext.apply(me, Ext.Updater.defaults);
+               /**
+                * Blank page URL to use with SSL file uploads (defaults to {@link Ext.Updater.defaults#sslBlankUrl}).
+                * @property sslBlankUrl
+                * @type String
+                */
+               /**
+                * Whether to append unique parameter on get request to disable caching (defaults to {@link Ext.Updater.defaults#disableCaching}).
+                * @property disableCaching
+                * @type Boolean
+                */
+               /**
+                * Text for loading indicator (defaults to {@link Ext.Updater.defaults#indicatorText}).
+                * @property indicatorText
+                * @type String
+                */
+               /**
+                * Whether to show indicatorText when loading (defaults to {@link Ext.Updater.defaults#showLoadIndicator}).
+                * @property showLoadIndicator
+                * @type String
+                */
+               /**
+                * Timeout for requests or form posts in seconds (defaults to {@link Ext.Updater.defaults#timeout}).
+                * @property timeout
+                * @type Number
+                */
+               /**
+                * True to process scripts in the output (defaults to {@link Ext.Updater.defaults#loadScripts}).
+                * @property loadScripts
+                * @type Boolean
+                */
+       
+               /**
+                * Transaction object of the current executing transaction, or null if there is no active transaction.
+                */
+               me.transaction = null;
+               /**
+                * Delegate for refresh() prebound to "this", use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments
+                * @type Function
+                */
+               me.refreshDelegate = me.refresh.createDelegate(me);
+               /**
+                * Delegate for update() prebound to "this", use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments
+                * @type Function
+                */
+               me.updateDelegate = me.update.createDelegate(me);
+               /**
+                * Delegate for formUpdate() prebound to "this", use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments
+                * @type Function
+                */
+               me.formUpdateDelegate = (me.formUpdate || function(){}).createDelegate(me);     
+               
+                       /**
+                        * The renderer for this Updater (defaults to {@link Ext.Updater.BasicRenderer}).
+                        */
+               me.renderer = me.renderer || me.getDefaultRenderer();
+               
+               Ext.Updater.superclass.constructor.call(me);
+           },
+        
+               /**
+            * Sets the content renderer for this Updater. See {@link Ext.Updater.BasicRenderer#render} for more details.
+            * @param {Object} renderer The object implementing the render() method
+            */
+           setRenderer : function(renderer){
+               this.renderer = renderer;
+           },  
+        
+           /**
+            * Returns the current content renderer for this Updater. See {@link Ext.Updater.BasicRenderer#render} for more details.
+            * @return {Object}
+            */
+           getRenderer : function(){
+              return this.renderer;
+           },
+
+           /**
+            * This is an overrideable method which returns a reference to a default
+            * renderer class if none is specified when creating the Ext.Updater.
+            * Defaults to {@link Ext.Updater.BasicRenderer}
+            */
+           getDefaultRenderer: function() {
+               return new Ext.Updater.BasicRenderer();
+           },
+                
+           /**
+            * Sets the default URL used for updates.
+            * @param {String/Function} defaultUrl The url or a function to call to get the url
+            */
+           setDefaultUrl : function(defaultUrl){
+               this.defaultUrl = defaultUrl;
+           },
+        
+           /**
+            * Get the Element this Updater is bound to
+            * @return {Ext.Element} The element
+            */
+           getEl : function(){
+               return this.el;
+           },
+       
+               /**
+            * Performs an <b>asynchronous</b> request, updating this element with the response.
+            * 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.
+            * @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>
+            * <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>
+            * 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>
+            * <li>callback : <b>Function</b><p class="sub-desc">A function to
+            * be called when the response from the server arrives. The following
+            * parameters are passed:<ul>
+            * <li><b>el</b> : Ext.Element<p class="sub-desc">The Element being updated.</p></li>
+            * <li><b>success</b> : Boolean<p class="sub-desc">True for success, false for failure.</p></li>
+            * <li><b>response</b> : XMLHttpRequest<p class="sub-desc">The XMLHttpRequest which processed the update.</p></li>
+            * <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>
+            * <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>
+            * <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
+            * {@link Ext.Updater.defaults#indicatorText} div (defaults to 'Loading...').  To replace the entire div, not
+            * just the text, override {@link Ext.Updater.defaults#indicatorText} directly.</p></li>
+            * <li>nocache : <b>Boolean</b><p class="sub-desc">Only needed for GET
+            * requests, this option causes an extra, auto-generated parameter to be appended to the request
+            * to defeat caching (defaults to {@link Ext.Updater.defaults#disableCaching}).</p></li></ul>
+            * <p>
+            * For example:
+       <pre><code>
+       um.update({
+           url: "your-url.php",
+           params: {param1: "foo", param2: "bar"}, // or a URL encoded string
+           callback: yourFunction,
+           scope: yourObject, //(optional scope)
+           discardUrl: true,
+           nocache: true,
+           text: "Loading...",
+           timeout: 60,
+           scripts: false // Save time by avoiding RegExp execution.
+       });
+       </code></pre>
+            */
+           update : function(url, params, callback, discardUrl){
+                   var me = this,
+                       cfg, 
+                       callerScope;
+                       
+               if(me.fireEvent(BEFOREUPDATE, me.el, url, params) !== false){               
+                   if(Ext.isObject(url)){ // must be config object
+                       cfg = url;
+                       url = cfg.url;
+                       params = params || cfg.params;
+                       callback = callback || cfg.callback;
+                       discardUrl = discardUrl || cfg.discardUrl;
+                       callerScope = cfg.scope;                        
+                       if(!Ext.isEmpty(cfg.nocache)){me.disableCaching = cfg.nocache;};
+                       if(!Ext.isEmpty(cfg.text)){me.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
+                       if(!Ext.isEmpty(cfg.scripts)){me.loadScripts = cfg.scripts;};
+                       if(!Ext.isEmpty(cfg.timeout)){me.timeout = cfg.timeout;};
+                   }
+                   me.showLoading();
+       
+                   if(!discardUrl){
+                       me.defaultUrl = url;
+                   }
+                   if(Ext.isFunction(url)){
+                       url = url.call(me);
+                   }
+       
+                   var o = Ext.apply({}, {
+                       url : url,
+                       params: (Ext.isFunction(params) && callerScope) ? params.createDelegate(callerScope) : params,
+                       success: processSuccess,
+                       failure: processFailure,
+                       scope: me,
+                       callback: undefined,
+                       timeout: (me.timeout*1000),
+                       disableCaching: me.disableCaching,
+                       argument: {
+                           "options": cfg,
+                           "url": url,
+                           "form": null,
+                           "callback": callback,
+                           "scope": callerScope || window,
+                           "params": params
+                       }
+                   }, cfg);
+       
+                   me.transaction = Ext.Ajax.request(o);
+               }
+           },          
+
+               /**
+            * <p>Performs an async 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
+            * <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
+            * 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
+            * retrieve parameter names and parameter values from the packet content.</p>
+            * @param {String/HTMLElement} form The form Id or form element
+            * @param {String} url (optional) The url to pass the form to. If omitted the action attribute on the form will be used.
+            * @param {Boolean} reset (optional) Whether to try to reset the form after the update
+            * @param {Function} callback (optional) Callback when transaction is complete. The following
+            * parameters are passed:<ul>
+            * <li><b>el</b> : Ext.Element<p class="sub-desc">The Element being updated.</p></li>
+            * <li><b>success</b> : Boolean<p class="sub-desc">True for success, false for failure.</p></li>
+            * <li><b>response</b> : XMLHttpRequest<p class="sub-desc">The XMLHttpRequest which processed the update.</p></li></ul>
+            */
+           formUpdate : function(form, url, reset, callback){
+                   var me = this;
+               if(me.fireEvent(BEFOREUPDATE, me.el, form, url) !== false){
+                   if(Ext.isFunction(url)){
+                       url = url.call(me);
+                   }
+                   form = Ext.getDom(form)
+                   me.transaction = Ext.Ajax.request({
+                       form: form,
+                       url:url,
+                       success: processSuccess,
+                       failure: processFailure,
+                       scope: me,
+                       timeout: (me.timeout*1000),
+                       argument: {
+                           "url": url,
+                           "form": form,
+                           "callback": callback,
+                           "reset": reset
+                       }
+                   });
+                   me.showLoading.defer(1, me);
+               }
+           },
+                       
+           /**
+            * Set this element to auto refresh.  Can be canceled by calling {@link #stopAutoRefresh}.
+            * @param {Number} interval How often to update (in seconds).
+            * @param {String/Object/Function} url (optional) The url for this request, a config object in the same format
+            * supported by {@link #load}, or a function to call to get the url (defaults to the last used url).  Note that while
+            * the url used in a load call can be reused by this method, other load config options will not be reused and must be
+            * sepcified as part of a config object passed as this paramter if needed.
+            * @param {String/Object} params (optional) The parameters to pass as either a url encoded string
+            * "&param1=1&param2=2" or as an object {param1: 1, param2: 2}
+            * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
+            * @param {Boolean} refreshNow (optional) Whether to execute the refresh now, or wait the interval
+            */
+           startAutoRefresh : function(interval, url, params, callback, refreshNow){
+                   var me = this;
+               if(refreshNow){
+                   me.update(url || me.defaultUrl, params, callback, true);
+               }
+               if(me.autoRefreshProcId){
+                   clearInterval(me.autoRefreshProcId);
+               }
+               me.autoRefreshProcId = setInterval(me.update.createDelegate(me, [url || me.defaultUrl, params, callback, true]), interval * 1000);
+           },
+       
+           /**
+            * Stop auto refresh on this element.
+            */
+           stopAutoRefresh : function(){
+               if(this.autoRefreshProcId){
+                   clearInterval(this.autoRefreshProcId);
+                   delete this.autoRefreshProcId;
+               }
+           },
+       
+           /**
+            * Returns true if the Updater is currently set to auto refresh its content (see {@link #startAutoRefresh}), otherwise false.
+            */
+           isAutoRefreshing : function(){
+              return !!this.autoRefreshProcId;
+           },
+       
+           /**
+            * Display the element's "loading" state. By default, the element is updated with {@link #indicatorText}. This
+            * method may be overridden to perform a custom action while this Updater is actively updating its contents.
+            */
+           showLoading : function(){
+               if(this.showLoadIndicator){
+               this.el.dom.innerHTML = this.indicatorText;
+               }
+           },
+       
+           /**
+            * Aborts the currently executing transaction, if any.
+            */
+           abort : function(){
+               if(this.transaction){
+                   Ext.Ajax.abort(this.transaction);
+               }
+           },
+       
+           /**
+            * Returns true if an update is in progress, otherwise false.
+            * @return {Boolean}
+            */
+           isUpdating : function(){        
+               return this.transaction ? Ext.Ajax.isLoading(this.transaction) : false;        
+           },
+           
+           /**
+            * Refresh the element with the last used url or defaultUrl. If there is no url, it returns immediately
+            * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
+            */
+           refresh : function(callback){
+               if(this.defaultUrl){
+                       this.update(this.defaultUrl, null, callback, true);
+               }
+           }
+    }
+}());
+
+/**
+ * @class Ext.Updater.defaults
+ * The defaults collection enables customizing the default properties of Updater
+ */
+Ext.Updater.defaults = {
+   /**
+     * Timeout for requests or form posts in seconds (defaults to 30 seconds).
+     * @type Number
+     */
+    timeout : 30,    
+    /**
+     * True to append a unique parameter to GET requests to disable caching (defaults to false).
+     * @type Boolean
+     */
+    disableCaching : false,
+    /**
+     * Whether or not to show {@link #indicatorText} during loading (defaults to true).
+     * @type Boolean
+     */
+    showLoadIndicator : true,
+    /**
+     * Text for loading indicator (defaults to '&lt;div class="loading-indicator"&gt;Loading...&lt;/div&gt;').
+     * @type String
+     */
+    indicatorText : '<div class="loading-indicator">Loading...</div>',
+     /**
+     * True to process scripts by default (defaults to false).
+     * @type Boolean
+     */
+    loadScripts : false,
+    /**
+    * 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")      
+};
+
+
+/**
+ * Static convenience method. <b>This method is deprecated in favor of el.load({url:'foo.php', ...})</b>.
+ * Usage:
+ * <pre><code>Ext.Updater.updateElement("my-div", "stuff.php");</code></pre>
+ * @param {Mixed} el The element to update
+ * @param {String} url The url
+ * @param {String/Object} params (optional) Url encoded param string or an object of name/value pairs
+ * @param {Object} options (optional) A config object with any of the Updater properties you want to set - for
+ * example: {disableCaching:true, indicatorText: "Loading data..."}
+ * @static
+ * @deprecated
+ * @member Ext.Updater
+ */
+Ext.Updater.updateElement = function(el, url, params, options){
+    var um = Ext.get(el).getUpdater();
+    Ext.apply(um, options);
+    um.update(url, params, options ? options.callback : null);
+};
+
+/**
+ * @class Ext.Updater.BasicRenderer
+ * Default Content renderer. Updates the elements innerHTML with the responseText.
+ */
+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.
+     * @param {Ext.Element} el The element being rendered
+     * @param {Object} response 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
+     */
+     render : function(el, response, updateManager, callback){      
+        el.update(response.responseText, updateManager.loadScripts, callback);
+    }
+};/**
+ * @class Date
+ *
+ * The date parsing and formatting syntax contains a subset of
+ * <a href="http://www.php.net/date">PHP's date() function</a>, and the formats that are
+ * supported will provide results equivalent to their PHP versions.
+ *
+ * The following is a list of all currently supported formats:
+ * <pre>
+Format  Description                                                               Example returned values
+------  -----------------------------------------------------------------------   -----------------------
+  d     Day of the month, 2 digits with leading zeros                             01 to 31
+  D     A short textual representation of the day of the week                     Mon to Sun
+  j     Day of the month without leading zeros                                    1 to 31
+  l     A full textual representation of the day of the week                      Sunday to Saturday
+  N     ISO-8601 numeric representation of the day of the week                    1 (for Monday) through 7 (for Sunday)
+  S     English ordinal suffix for the day of the month, 2 characters             st, nd, rd or th. Works well with j
+  w     Numeric representation of the day of the week                             0 (for Sunday) to 6 (for Saturday)
+  z     The day of the year (starting from 0)                                     0 to 364 (365 in leap years)
+  W     ISO-8601 week number of year, weeks starting on Monday                    01 to 53
+  F     A full textual representation of a month, such as January or March        January to December
+  m     Numeric representation of a month, with leading zeros                     01 to 12
+  M     A short textual representation of a month                                 Jan to Dec
+  n     Numeric representation of a month, without leading zeros                  1 to 12
+  t     Number of days in the given month                                         28 to 31
+  L     Whether it's a leap year                                                  1 if it is a leap year, 0 otherwise.
+  o     ISO-8601 year number (identical to (Y), but if the ISO week number (W)    Examples: 1998 or 2004
+        belongs to the previous or next year, that year is used instead)
+  Y     A full numeric representation of a year, 4 digits                         Examples: 1999 or 2003
+  y     A two digit representation of a year                                      Examples: 99 or 03
+  a     Lowercase Ante meridiem and Post meridiem                                 am or pm
+  A     Uppercase Ante meridiem and Post meridiem                                 AM or PM
+  g     12-hour format of an hour without leading zeros                           1 to 12
+  G     24-hour format of an hour without leading zeros                           0 to 23
+  h     12-hour format of an hour with leading zeros                              01 to 12
+  H     24-hour format of an hour with leading zeros                              00 to 23
+  i     Minutes, with leading zeros                                               00 to 59
+  s     Seconds, with leading zeros                                               00 to 59
+  u     Decimal fraction of a second                                              Examples:
+        (minimum 1 digit, arbitrary number of digits allowed)                     001 (i.e. 0.001s) or
+                                                                                  100 (i.e. 0.100s) or
+                                                                                  999 (i.e. 0.999s) or
+                                                                                  999876543210 (i.e. 0.999876543210s)
+  O     Difference to Greenwich time (GMT) in hours and minutes                   Example: +1030
+  P     Difference to Greenwich time (GMT) with colon between hours and minutes   Example: -08:00
+  T     Timezone abbreviation of the machine running the code                     Examples: EST, MDT, PDT ...
+  Z     Timezone offset in seconds (negative if west of UTC, positive if east)    -43200 to 50400
+  c     ISO 8601 date
+        Notes:                                                                    Examples:
+        1) If unspecified, the month / day defaults to the current month / day,   1991 or
+           the time defaults to midnight, while the timezone defaults to the      1992-10 or
+           browser's timezone. If a time is specified, it must include both hours 1993-09-20 or
+           and minutes. The "T" delimiter, seconds, milliseconds and timezone     1994-08-19T16:20+01:00 or
+           are optional.                                                          1995-07-18T17:21:28-02:00 or
+        2) The decimal fraction of a second, if specified, must contain at        1996-06-17T18:22:29.98765+03:00 or
+           least 1 digit (there is no limit to the maximum number                 1997-05-16T19:23:30,12345-0400 or
+           of digits allowed), and may be delimited by either a '.' or a ','      1998-04-15T20:24:31.2468Z or
+        Refer to the examples on the right for the various levels of              1999-03-14T20:24:32Z or
+        date-time granularity which are supported, or see                         2000-02-13T21:25:33
+        http://www.w3.org/TR/NOTE-datetime for more info.                         2001-01-12 22:26:34
+  U     Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)                1193432466 or -2138434463
+  M$    Microsoft AJAX serialized dates                                           \/Date(1238606590509)\/ (i.e. UTC milliseconds since epoch) or
+                                                                                  \/Date(1238606590509+0800)\/
+</pre>
+ *
+ * Example usage (note that you must escape format specifiers with '\\' to render them as character literals):
+ * <pre><code>
+// Sample date:
+// 'Wed Jan 10 2007 15:05:01 GMT-0600 (Central Standard Time)'
+
+var dt = new Date('1/10/2007 03:05:01 PM GMT-0600');
+document.write(dt.format('Y-m-d'));                           // 2007-01-10
+document.write(dt.format('F j, Y, g:i a'));                   // January 10, 2007, 3:05 pm
+document.write(dt.format('l, \\t\\he jS \\of F Y h:i:s A'));  // Wednesday, the 10th of January 2007 03:05:01 PM
+</code></pre>
+ *
+ * Here are some standard date/time patterns that you might find helpful.  They
+ * are not part of the source of Date.js, but to use them you can simply copy this
+ * block of code into any script that is included after Date.js and they will also become
+ * globally available on the Date object.  Feel free to add or remove patterns as needed in your code.
+ * <pre><code>
+Date.patterns = {
+    ISO8601Long:"Y-m-d H:i:s",
+    ISO8601Short:"Y-m-d",
+    ShortDate: "n/j/Y",
+    LongDate: "l, F d, Y",
+    FullDateTime: "l, F d, Y g:i:s A",
+    MonthDay: "F d",
+    ShortTime: "g:i A",
+    LongTime: "g:i:s A",
+    SortableDateTime: "Y-m-d\\TH:i:s",
+    UniversalSortableDateTime: "Y-m-d H:i:sO",
+    YearMonth: "F, Y"
+};
+</code></pre>
+ *
+ * Example usage:
+ * <pre><code>
+var dt = new Date();
+document.write(dt.format(Date.patterns.ShortDate));
+</code></pre>
+ * <p>Developer-written, custom formats may be used by supplying both a formatting and a parsing function
+ * which perform to specialized requirements. The functions are stored in {@link #parseFunctions} and {@link #formatFunctions}.</p>
+ */
+
+/*
+ * Most of the date-formatting functions below are the excellent work of Baron Schwartz.
+ * (see http://www.xaprb.com/blog/2005/12/12/javascript-closures-for-runtime-efficiency/)
+ * They generate precompiled functions from format patterns instead of parsing and
+ * processing each pattern every time a date is formatted. These functions are available
+ * on every Date object.
+ */
+
+(function() {
+
+/**
+ * Global flag which determines if strict date parsing should be used.
+ * Strict date parsing will not roll-over invalid dates, which is the
+ * default behaviour of javascript Date objects.
+ * (see {@link #parseDate} for more information)
+ * Defaults to <tt>false</tt>.
+ * @static
+ * @type Boolean
+*/
+Date.useStrict = false;
+
+
+// create private copy of Ext's String.format() method
+// - to remove unnecessary dependency
+// - to resolve namespace conflict with M$-Ajax's implementation
+function xf(format) {
+    var args = Array.prototype.slice.call(arguments, 1);
+    return format.replace(/\{(\d+)\}/g, function(m, i) {
+        return args[i];
+    });
+}
+
+
+// private
+Date.formatCodeToRegex = function(character, currentGroup) {
+    // Note: currentGroup - position in regex result array (see notes for Date.parseCodes below)
+    var p = Date.parseCodes[character];
+
+    if (p) {
+      p = typeof p == 'function'? p() : p;
+      Date.parseCodes[character] = p; // reassign function result to prevent repeated execution
+    }
+
+    return p? Ext.applyIf({
+      c: p.c? xf(p.c, currentGroup || "{0}") : p.c
+    }, p) : {
+        g:0,
+        c:null,
+        s:Ext.escapeRe(character) // treat unrecognised characters as literals
+    }
+}
+
+// private shorthand for Date.formatCodeToRegex since we'll be using it fairly often
+var $f = Date.formatCodeToRegex;
+
+Ext.apply(Date, {
+    /**
+     * <p>An object hash in which each property is a date parsing function. The property name is the
+     * format string which that function parses.</p>
+     * <p>This object is automatically populated with date parsing functions as
+     * date formats are requested for Ext standard formatting strings.</p>
+     * <p>Custom parsing functions may be inserted into this object, keyed by a name which from then on
+     * may be used as a format string to {@link #parseDate}.<p>
+     * <p>Example:</p><pre><code>
+Date.parseFunctions['x-date-format'] = myDateParser;
+</code></pre>
+     * <p>A parsing function should return a Date object, and is passed the following parameters:<div class="mdetail-params"><ul>
+     * <li><code>date</code> : String<div class="sub-desc">The date string to parse.</div></li>
+     * <li><code>strict</code> : Boolean<div class="sub-desc">True to validate date strings while parsing
+     * (i.e. prevent javascript Date "rollover") (The default must be false).
+     * Invalid date strings should return null when parsed.</div></li>
+     * </ul></div></p>
+     * <p>To enable Dates to also be <i>formatted</i> according to that format, a corresponding
+     * formatting function must be placed into the {@link #formatFunctions} property.
+     * @property parseFunctions
+     * @static
+     * @type Object
+     */
+    parseFunctions: {
+        "M$": function(input, strict) {
+            // note: the timezone offset is ignored since the M$ Ajax server sends
+            // a UTC milliseconds-since-Unix-epoch value (negative values are allowed)
+            var re = new RegExp('\\/Date\\(([-+])?(\\d+)(?:[+-]\\d{4})?\\)\\/');
+            var r = (input || '').match(re);
+            return r? new Date(((r[1] || '') + r[2]) * 1) : null;
+        }
+    },
+    parseRegexes: [],
+
+    /**
+     * <p>An object hash in which each property is a date formatting function. The property name is the
+     * format string which corresponds to the produced formatted date string.</p>
+     * <p>This object is automatically populated with date formatting functions as
+     * date formats are requested for Ext standard formatting strings.</p>
+     * <p>Custom formatting functions may be inserted into this object, keyed by a name which from then on
+     * may be used as a format string to {@link #format}. Example:</p><pre><code>
+Date.formatFunctions['x-date-format'] = myDateFormatter;
+</code></pre>
+     * <p>A formatting function should return a string repesentation of the passed Date object:<div class="mdetail-params"><ul>
+     * <li><code>date</code> : Date<div class="sub-desc">The Date to format.</div></li>
+     * </ul></div></p>
+     * <p>To enable date strings to also be <i>parsed</i> according to that format, a corresponding
+     * parsing function must be placed into the {@link #parseFunctions} property.
+     * @property formatFunctions
+     * @static
+     * @type Object
+     */
+    formatFunctions: {
+        "M$": function() {
+            // UTC milliseconds since Unix epoch (M$-AJAX serialized date format (MRSF))
+            return '\\/Date(' + this.getTime() + ')\\/';
+        }
+    },
+
+    y2kYear : 50,
+
+    /**
+     * Date interval constant
+     * @static
+     * @type String
+     */
+    MILLI : "ms",
+
+    /**
+     * Date interval constant
+     * @static
+     * @type String
+     */
+    SECOND : "s",
+
+    /**
+     * Date interval constant
+     * @static
+     * @type String
+     */
+    MINUTE : "mi",
+
+    /** Date interval constant
+     * @static
+     * @type String
+     */
+    HOUR : "h",
+
+    /**
+     * Date interval constant
+     * @static
+     * @type String
+     */
+    DAY : "d",
+
+    /**
+     * Date interval constant
+     * @static
+     * @type String
+     */
+    MONTH : "mo",
+
+    /**
+     * Date interval constant
+     * @static
+     * @type String
+     */
+    YEAR : "y",
+
+    /**
+     * <p>An object hash containing default date values used during date parsing.</p>
+     * <p>The following properties are available:<div class="mdetail-params"><ul>
+     * <li><code>y</code> : Number<div class="sub-desc">The default year value. (defaults to undefined)</div></li>
+     * <li><code>m</code> : Number<div class="sub-desc">The default 1-based month value. (defaults to undefined)</div></li>
+     * <li><code>d</code> : Number<div class="sub-desc">The default day value. (defaults to undefined)</div></li>
+     * <li><code>h</code> : Number<div class="sub-desc">The default hour value. (defaults to undefined)</div></li>
+     * <li><code>i</code> : Number<div class="sub-desc">The default minute value. (defaults to undefined)</div></li>
+     * <li><code>s</code> : Number<div class="sub-desc">The default second value. (defaults to undefined)</div></li>
+     * <li><code>ms</code> : Number<div class="sub-desc">The default millisecond value. (defaults to undefined)</div></li>
+     * </ul></div></p>
+     * <p>Override these properties to customize the default date values used by the {@link #parseDate} method.</p>
+     * <p><b>Note: In countries which experience Daylight Saving Time (i.e. DST), the <tt>h</tt>, <tt>i</tt>, <tt>s</tt>
+     * and <tt>ms</tt> properties may coincide with the exact time in which DST takes effect.
+     * It is the responsiblity of the developer to account for this.</b></p>
+     * Example Usage:
+     * <pre><code>
+// set default day value to the first day of the month
+Date.defaults.d = 1;
+
+// parse a February date string containing only year and month values.
+// setting the default day value to 1 prevents weird date rollover issues
+// when attempting to parse the following date string on, for example, March 31st 2009.
+Date.parseDate('2009-02', 'Y-m'); // returns a Date object representing February 1st 2009
+</code></pre>
+     * @property defaults
+     * @static
+     * @type Object
+     */
+    defaults: {},
+
+    /**
+     * An array of textual day names.
+     * Override these values for international dates.
+     * Example:
+     * <pre><code>
+Date.dayNames = [
+    'SundayInYourLang',
+    'MondayInYourLang',
+    ...
+];
+</code></pre>
+     * @type Array
+     * @static
+     */
+    dayNames : [
+        "Sunday",
+        "Monday",
+        "Tuesday",
+        "Wednesday",
+        "Thursday",
+        "Friday",
+        "Saturday"
+    ],
+
+    /**
+     * An array of textual month names.
+     * Override these values for international dates.
+     * Example:
+     * <pre><code>
+Date.monthNames = [
+    'JanInYourLang',
+    'FebInYourLang',
+    ...
+];
+</code></pre>
+     * @type Array
+     * @static
+     */
+    monthNames : [
+        "January",
+        "February",
+        "March",
+        "April",
+        "May",
+        "June",
+        "July",
+        "August",
+        "September",
+        "October",
+        "November",
+        "December"
+    ],
+
+    /**
+     * An object hash of zero-based javascript month numbers (with short month names as keys. note: keys are case-sensitive).
+     * Override these values for international dates.
+     * Example:
+     * <pre><code>
+Date.monthNumbers = {
+    'ShortJanNameInYourLang':0,
+    'ShortFebNameInYourLang':1,
+    ...
+};
+</code></pre>
+     * @type Object
+     * @static
+     */
+    monthNumbers : {
+        Jan:0,
+        Feb:1,
+        Mar:2,
+        Apr:3,
+        May:4,
+        Jun:5,
+        Jul:6,
+        Aug:7,
+        Sep:8,
+        Oct:9,
+        Nov:10,
+        Dec:11
+    },
+
+    /**
+     * Get the short month name for the given month number.
+     * Override this function for international dates.
+     * @param {Number} month A zero-based javascript month number.
+     * @return {String} The short month name.
+     * @static
+     */
+    getShortMonthName : function(month) {
+        return Date.monthNames[month].substring(0, 3);
+    },
+
+    /**
+     * Get the short day name for the given day number.
+     * Override this function for international dates.
+     * @param {Number} day A zero-based javascript day number.
+     * @return {String} The short day name.
+     * @static
+     */
+    getShortDayName : function(day) {
+        return Date.dayNames[day].substring(0, 3);
+    },
+
+    /**
+     * Get the zero-based javascript month number for the given short/full month name.
+     * Override this function for international dates.
+     * @param {String} name The short/full month name.
+     * @return {Number} The zero-based javascript month number.
+     * @static
+     */
+    getMonthNumber : function(name) {
+        // handle camel casing for english month names (since the keys for the Date.monthNumbers hash are case sensitive)
+        return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];
+    },
+
+    /**
+     * The base format-code to formatting-function hashmap used by the {@link #format} method.
+     * Formatting functions are strings (or functions which return strings) which
+     * will return the appropriate value when evaluated in the context of the Date object
+     * from which the {@link #format} method is called.
+     * Add to / override these mappings for custom date formatting.
+     * Note: Date.format() treats characters as literals if an appropriate mapping cannot be found.
+     * Example:
+     * <pre><code>
+Date.formatCodes.x = "String.leftPad(this.getDate(), 2, '0')";
+(new Date()).format("X"); // returns the current day of the month
+</code></pre>
+     * @type Object
+     * @static
+     */
+    formatCodes : {
+        d: "String.leftPad(this.getDate(), 2, '0')",
+        D: "Date.getShortDayName(this.getDay())", // get localised short day name
+        j: "this.getDate()",
+        l: "Date.dayNames[this.getDay()]",
+        N: "(this.getDay() ? this.getDay() : 7)",
+        S: "this.getSuffix()",
+        w: "this.getDay()",
+        z: "this.getDayOfYear()",
+        W: "String.leftPad(this.getWeekOfYear(), 2, '0')",
+        F: "Date.monthNames[this.getMonth()]",
+        m: "String.leftPad(this.getMonth() + 1, 2, '0')",
+        M: "Date.getShortMonthName(this.getMonth())", // get localised short month name
+        n: "(this.getMonth() + 1)",
+        t: "this.getDaysInMonth()",
+        L: "(this.isLeapYear() ? 1 : 0)",
+        o: "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0)))",
+        Y: "this.getFullYear()",
+        y: "('' + this.getFullYear()).substring(2, 4)",
+        a: "(this.getHours() < 12 ? 'am' : 'pm')",
+        A: "(this.getHours() < 12 ? 'AM' : 'PM')",
+        g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",
+        G: "this.getHours()",
+        h: "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",
+        H: "String.leftPad(this.getHours(), 2, '0')",
+        i: "String.leftPad(this.getMinutes(), 2, '0')",
+        s: "String.leftPad(this.getSeconds(), 2, '0')",
+        u: "String.leftPad(this.getMilliseconds(), 3, '0')",
+        O: "this.getGMTOffset()",
+        P: "this.getGMTOffset(true)",
+        T: "this.getTimezone()",
+        Z: "(this.getTimezoneOffset() * -60)",
+
+        c: function() { // ISO-8601 -- GMT format
+            for (var c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {
+                var e = c.charAt(i);
+                code.push(e == "T" ? "'T'" : Date.getFormatCode(e)); // treat T as a character literal
+            }
+            return code.join(" + ");
+        },
+        /*
+        c: function() { // ISO-8601 -- UTC format
+            return [
+              "this.getUTCFullYear()", "'-'",
+              "String.leftPad(this.getUTCMonth() + 1, 2, '0')", "'-'",
+              "String.leftPad(this.getUTCDate(), 2, '0')",
+              "'T'",
+              "String.leftPad(this.getUTCHours(), 2, '0')", "':'",
+              "String.leftPad(this.getUTCMinutes(), 2, '0')", "':'",
+              "String.leftPad(this.getUTCSeconds(), 2, '0')",
+              "'Z'"
+            ].join(" + ");
+        },
+        */
+
+        U: "Math.round(this.getTime() / 1000)"
+    },
+
+    /**
+     * Checks if the passed Date parameters will cause a javascript Date "rollover".
+     * @param {Number} year 4-digit year
+     * @param {Number} month 1-based month-of-year
+     * @param {Number} day Day of month
+     * @param {Number} hour (optional) Hour
+     * @param {Number} minute (optional) Minute
+     * @param {Number} second (optional) Second
+     * @param {Number} millisecond (optional) Millisecond
+     * @return {Boolean} true if the passed parameters do not cause a Date "rollover", false otherwise.
+     * @static
+     */
+    isValid : function(y, m, d, h, i, s, ms) {
+        // setup defaults
+        h = h || 0;
+        i = i || 0;
+        s = s || 0;
+        ms = ms || 0;
+
+        var dt = new Date(y, m - 1, d, h, i, s, ms);
+
+        return y == dt.getFullYear() &&
+            m == dt.getMonth() + 1 &&
+            d == dt.getDate() &&
+            h == dt.getHours() &&
+            i == dt.getMinutes() &&
+            s == dt.getSeconds() &&
+            ms == dt.getMilliseconds();
+    },
+
+    /**
+     * Parses the passed string using the specified date format.
+     * Note that this function expects normal calendar dates, meaning that months are 1-based (i.e. 1 = January).
+     * The {@link #defaults} hash will be used for any date value (i.e. year, month, day, hour, minute, second or millisecond)
+     * which cannot be found in the passed string. If a corresponding default date value has not been specified in the {@link #defaults} hash,
+     * the current date's year, month, day or DST-adjusted zero-hour time value will be used instead.
+     * Keep in mind that the input date string must precisely match the specified format string
+     * in order for the parse operation to be successful (failed parse operations return a null value).
+     * <p>Example:</p><pre><code>
+//dt = Fri May 25 2007 (current date)
+var dt = new Date();
+
+//dt = Thu May 25 2006 (today&#39;s month/day in 2006)
+dt = Date.parseDate("2006", "Y");
+
+//dt = Sun Jan 15 2006 (all date parts specified)
+dt = Date.parseDate("2006-01-15", "Y-m-d");
+
+//dt = Sun Jan 15 2006 15:20:01
+dt = Date.parseDate("2006-01-15 3:20:01 PM", "Y-m-d g:i:s A");
+
+// attempt to parse Sun Feb 29 2006 03:20:01 in strict mode
+dt = Date.parseDate("2006-02-29 03:20:01", "Y-m-d H:i:s", true); // returns null
+</code></pre>
+     * @param {String} input The raw date string.
+     * @param {String} format The expected date string format.
+     * @param {Boolean} strict (optional) True to validate date strings while parsing (i.e. prevents javascript Date "rollover")
+                        (defaults to false). Invalid date strings will return null when parsed.
+     * @return {Date} The parsed Date.
+     * @static
+     */
+    parseDate : function(input, format, strict) {
+        var p = Date.parseFunctions;
+        if (p[format] == null) {
+            Date.createParser(format);
+        }
+        return p[format](input, Ext.isDefined(strict) ? strict : Date.useStrict);
+    },
+
+    // private
+    getFormatCode : function(character) {
+        var f = Date.formatCodes[character];
+
+        if (f) {
+          f = typeof f == 'function'? f() : f;
+          Date.formatCodes[character] = f; // reassign function result to prevent repeated execution
+        }
+
+        // note: unknown characters are treated as literals
+        return f || ("'" + String.escape(character) + "'");
+    },
+
+    // private
+    createFormat : function(format) {
+        var code = [],
+            special = false,
+            ch = '';
+
+        for (var i = 0; i < format.length; ++i) {
+            ch = format.charAt(i);
+            if (!special && ch == "\\") {
+                special = true;
+            } else if (special) {
+                special = false;
+                code.push("'" + String.escape(ch) + "'");
+            } else {
+                code.push(Date.getFormatCode(ch))
+            }
+        }
+        Date.formatFunctions[format] = new Function("return " + code.join('+'));
+    },
+
+    // private
+    createParser : function() {
+        var code = [
+            "var dt, y, m, d, h, i, s, ms, o, z, zz, u, v,",
+                "def = Date.defaults,",
+                "results = String(input).match(Date.parseRegexes[{0}]);", // either null, or an array of matched strings
+
+            "if(results){",
+                "{1}",
+
+                "if(u != null){", // i.e. unix time is defined
+                    "v = new Date(u * 1000);", // give top priority to UNIX time
+                "}else{",
+                    // create Date object representing midnight of the current day;
+                    // this will provide us with our date defaults
+                    // (note: clearTime() handles Daylight Saving Time automatically)
+                    "dt = (new Date()).clearTime();",
+
+                    // date calculations (note: these calculations create a dependency on Ext.num())
+                    "y = y >= 0? y : Ext.num(def.y, dt.getFullYear());",
+                    "m = m >= 0? m : Ext.num(def.m - 1, dt.getMonth());",
+                    "d = d >= 0? d : Ext.num(def.d, dt.getDate());",
+
+                    // time calculations (note: these calculations create a dependency on Ext.num())
+                    "h  = h || Ext.num(def.h, dt.getHours());",
+                    "i  = i || Ext.num(def.i, dt.getMinutes());",
+                    "s  = s || Ext.num(def.s, dt.getSeconds());",
+                    "ms = ms || Ext.num(def.ms, dt.getMilliseconds());",
+
+                    "if(z >= 0 && y >= 0){",
+                        // both the year and zero-based day of year are defined and >= 0.
+                        // these 2 values alone provide sufficient info to create a full date object
+
+                        // create Date object representing January 1st for the given year
+                        "v = new Date(y, 0, 1, h, i, s, ms);",
+
+                        // then add day of year, checking for Date "rollover" if necessary
+                        "v = !strict? v : (strict === true && (z <= 364 || (v.isLeapYear() && z <= 365))? v.add(Date.DAY, z) : null);",
+                    "}else if(strict === true && !Date.isValid(y, m + 1, d, h, i, s, ms)){", // check for Date "rollover"
+                        "v = null;", // invalid date, so return null
+                    "}else{",
+                        // plain old Date object
+                        "v = new Date(y, m, d, h, i, s, ms);",
+                    "}",
+                "}",
+            "}",
+
+            "if(v){",
+                // favour UTC offset over GMT offset
+                "if(zz != null){",
+                    // reset to UTC, then add offset
+                    "v = v.add(Date.SECOND, -v.getTimezoneOffset() * 60 - zz);",
+                "}else if(o){",
+                    // reset to GMT, then add offset
+                    "v = v.add(Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn));",
+                "}",
+            "}",
+
+            "return v;"
+        ].join('\n');
+
+        return function(format) {
+            var regexNum = Date.parseRegexes.length,
+                currentGroup = 1,
+                calc = [],
+                regex = [],
+                special = false,
+                ch = "";
+
+            for (var i = 0; i < format.length; ++i) {
+                ch = format.charAt(i);
+                if (!special && ch == "\\") {
+                    special = true;
+                } else if (special) {
+                    special = false;
+                    regex.push(String.escape(ch));
+                } else {
+                    var obj = $f(ch, currentGroup);
+                    currentGroup += obj.g;
+                    regex.push(obj.s);
+                    if (obj.g && obj.c) {
+                        calc.push(obj.c);
+                    }
+                }
+            }
+
+            Date.parseRegexes[regexNum] = new RegExp("^" + regex.join('') + "$", "i");
+            Date.parseFunctions[format] = new Function("input", "strict", xf(code, regexNum, calc.join('')));
+        }
+    }(),
+
+    // private
+    parseCodes : {
+        /*
+         * Notes:
+         * g = {Number} calculation group (0 or 1. only group 1 contributes to date calculations.)
+         * c = {String} calculation method (required for group 1. null for group 0. {0} = currentGroup - position in regex result array)
+         * s = {String} regex pattern. all matches are stored in results[], and are accessible by the calculation mapped to 'c'
+         */
+        d: {
+            g:1,
+            c:"d = parseInt(results[{0}], 10);\n",
+            s:"(\\d{2})" // day of month with leading zeroes (01 - 31)
+        },
+        j: {
+            g:1,
+            c:"d = parseInt(results[{0}], 10);\n",
+            s:"(\\d{1,2})" // day of month without leading zeroes (1 - 31)
+        },
+        D: function() {
+            for (var a = [], i = 0; i < 7; a.push(Date.getShortDayName(i)), ++i); // get localised short day names
+            return {
+                g:0,
+                c:null,
+                s:"(?:" + a.join("|") +")"
+            }
+        },
+        l: function() {
+            return {
+                g:0,
+                c:null,
+                s:"(?:" + Date.dayNames.join("|") + ")"
+            }
+        },
+        N: {
+            g:0,
+            c:null,
+            s:"[1-7]" // ISO-8601 day number (1 (monday) - 7 (sunday))
+        },
+        S: {
+            g:0,
+            c:null,
+            s:"(?:st|nd|rd|th)"
+        },
+        w: {
+            g:0,
+            c:null,
+            s:"[0-6]" // javascript day number (0 (sunday) - 6 (saturday))
+        },
+        z: {
+            g:1,
+            c:"z = parseInt(results[{0}], 10);\n",
+            s:"(\\d{1,3})" // day of the year (0 - 364 (365 in leap years))
+        },
+        W: {
+            g:0,
+            c:null,
+            s:"(?:\\d{2})" // ISO-8601 week number (with leading zero)
+        },
+        F: function() {
+            return {
+                g:1,
+                c:"m = parseInt(Date.getMonthNumber(results[{0}]), 10);\n", // get localised month number
+                s:"(" + Date.monthNames.join("|") + ")"
+            }
+        },
+        M: function() {
+            for (var a = [], i = 0; i < 12; a.push(Date.getShortMonthName(i)), ++i); // get localised short month names
+            return Ext.applyIf({
+                s:"(" + a.join("|") + ")"
+            }, $f("F"));
+        },
+        m: {
+            g:1,
+            c:"m = parseInt(results[{0}], 10) - 1;\n",
+            s:"(\\d{2})" // month number with leading zeros (01 - 12)
+        },
+        n: {
+            g:1,
+            c:"m = parseInt(results[{0}], 10) - 1;\n",
+            s:"(\\d{1,2})" // month number without leading zeros (1 - 12)
+        },
+        t: {
+            g:0,
+            c:null,
+            s:"(?:\\d{2})" // no. of days in the month (28 - 31)
+        },
+        L: {
+            g:0,
+            c:null,
+            s:"(?:1|0)"
+        },
+        o: function() {
+            return $f("Y");
+        },
+        Y: {
+            g:1,
+            c:"y = parseInt(results[{0}], 10);\n",
+            s:"(\\d{4})" // 4-digit year
+        },
+        y: {
+            g:1,
+            c:"var ty = parseInt(results[{0}], 10);\n"
+                + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", // 2-digit year
+            s:"(\\d{1,2})"
+        },
+        a: {
+            g:1,
+            c:"if (results[{0}] == 'am') {\n"
+                + "if (h == 12) { h = 0; }\n"
+                + "} else { if (h < 12) { h += 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; }}",
+            s:"(AM|PM)"
+        },
+        g: function() {
+            return $f("G");
+        },
+        G: {
+            g:1,
+            c:"h = parseInt(results[{0}], 10);\n",
+            s:"(\\d{1,2})" // 24-hr format of an hour without leading zeroes (0 - 23)
+        },
+        h: function() {
+            return $f("H");
+        },
+        H: {
+            g:1,
+            c:"h = parseInt(results[{0}], 10);\n",
+            s:"(\\d{2})" //  24-hr format of an hour with leading zeroes (00 - 23)
+        },
+        i: {
+            g:1,
+            c:"i = parseInt(results[{0}], 10);\n",
+            s:"(\\d{2})" // minutes with leading zeros (00 - 59)
+        },
+        s: {
+            g:1,
+            c:"s = parseInt(results[{0}], 10);\n",
+            s:"(\\d{2})" // seconds with leading zeros (00 - 59)
+        },
+        u: {
+            g:1,
+            c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",
+            s:"(\\d+)" // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)
+        },
+        O: {
+            g:1,
+            c:[
+                "o = results[{0}];",
+                "var sn = o.substring(0,1),", // get + / - sign
+                    "hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60),", // get hours (performs minutes-to-hour conversion also, just in case)
+                    "mn = o.substring(3,5) % 60;", // get minutes
+                "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs
+            ].join("\n"),
+            s: "([+\-]\\d{4})" // GMT offset in hrs and mins
+        },
+        P: {
+            g:1,
+            c:[
+                "o = results[{0}];",
+                "var sn = o.substring(0,1),", // get + / - sign
+                    "hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60),", // get hours (performs minutes-to-hour conversion also, just in case)
+                    "mn = o.substring(4,6) % 60;", // get minutes
+                "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs
+            ].join("\n"),
+            s: "([+\-]\\d{2}:\\d{2})" // GMT offset in hrs and mins (with colon separator)
+        },
+        T: {
+            g:0,
+            c:null,
+            s:"[A-Z]{1,4}" // timezone abbrev. may be between 1 - 4 chars
+        },
+        Z: {
+            g:1,
+            c:"zz = results[{0}] * 1;\n" // -43200 <= UTC offset <= 50400
+                  + "zz = (-43200 <= zz && zz <= 50400)? zz : null;\n",
+            s:"([+\-]?\\d{1,5})" // leading '+' sign is optional for UTC offset
+        },
+        c: function() {
+            var calc = [],
+                arr = [
+                    $f("Y", 1), // year
+                    $f("m", 2), // month
+                    $f("d", 3), // day
+                    $f("h", 4), // hour
+                    $f("i", 5), // minute
+                    $f("s", 6), // second
+                    {c:"ms = results[7] || '0'; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"}, // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)
+                    {c:[ // allow either "Z" (i.e. UTC) or "-0530" or "+08:00" (i.e. UTC offset) timezone delimiters. assumes local timezone if no timezone is specified
+                        "if(results[8]) {", // timezone specified
+                            "if(results[8] == 'Z'){",
+                                "zz = 0;", // UTC
+                            "}else if (results[8].indexOf(':') > -1){",
+                                $f("P", 8).c, // timezone offset with colon separator
+                            "}else{",
+                                $f("O", 8).c, // timezone offset without colon separator
+                            "}",
+                        "}"
+                    ].join('\n')}
+                ];
+
+            for (var i = 0, l = arr.length; i < l; ++i) {
+                calc.push(arr[i].c);
+            }
+
+            return {
+                g:1,
+                c:calc.join(""),
+                s:[
+                    arr[0].s, // year (required)
+                    "(?:", "-", arr[1].s, // month (optional)
+                        "(?:", "-", arr[2].s, // day (optional)
+                            "(?:",
+                                "(?:T| )?", // time delimiter -- either a "T" or a single blank space
+                                arr[3].s, ":", arr[4].s,  // hour AND minute, delimited by a single colon (optional). MUST be preceded by either a "T" or a single blank space
+                                "(?::", arr[5].s, ")?", // seconds (optional)
+                                "(?:(?:\\.|,)(\\d+))?", // decimal fraction of a second (e.g. ",12345" or ".98765") (optional)
+                                "(Z|(?:[-+]\\d{2}(?::)?\\d{2}))?", // "Z" (UTC) or "-0530" (UTC offset without colon delimiter) or "+08:00" (UTC offset with colon delimiter) (optional)
+                            ")?",
+                        ")?",
+                    ")?"
+                ].join("")
+            }
+        },
+        U: {
+            g:1,
+            c:"u = parseInt(results[{0}], 10);\n",
+            s:"(-?\\d+)" // leading minus sign indicates seconds before UNIX epoch
+        }
+    }
+});
+
+}());
+
+Ext.apply(Date.prototype, {
+    // private
+    dateFormat : function(format) {
+        if (Date.formatFunctions[format] == null) {
+            Date.createFormat(format);
+        }
+        return Date.formatFunctions[format].call(this);
+    },
+
+    /**
+     * Get the timezone abbreviation of the current date (equivalent to the format specifier 'T').
+     *
+     * Note: The date string returned by the javascript Date object's toString() method varies
+     * between browsers (e.g. FF vs IE) and system region settings (e.g. IE in Asia vs IE in America).
+     * For a given date string e.g. "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)",
+     * getTimezone() first tries to get the timezone abbreviation from between a pair of parentheses
+     * (which may or may not be present), failing which it proceeds to get the timezone abbreviation
+     * from the GMT offset portion of the date string.
+     * @return {String} The abbreviated timezone name (e.g. 'CST', 'PDT', 'EDT', 'MPST' ...).
+     */
+    getTimezone : function() {
+        // the following list shows the differences between date strings from different browsers on a WinXP SP2 machine from an Asian locale:
+        //
+        // Opera  : "Thu, 25 Oct 2007 22:53:45 GMT+0800" -- shortest (weirdest) date string of the lot
+        // Safari : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone (same as FF)
+        // FF     : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone
+        // IE     : "Thu Oct 25 22:54:35 UTC+0800 2007" -- (Asian system setting) look for 3-4 letter timezone abbrev
+        // IE     : "Thu Oct 25 17:06:37 PDT 2007" -- (American system setting) look for 3-4 letter timezone abbrev
+        //
+        // this crazy regex attempts to guess the correct timezone abbreviation despite these differences.
+        // step 1: (?:\((.*)\) -- find timezone in parentheses
+        // step 2: ([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?) -- if nothing was found in step 1, find timezone from timezone offset portion of date string
+        // step 3: remove all non uppercase characters found in step 1 and 2
+        return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");
+    },
+
+    /**
+     * Get the offset from GMT of the current date (equivalent to the format specifier 'O').
+     * @param {Boolean} colon (optional) true to separate the hours and minutes with a colon (defaults to false).
+     * @return {String} The 4-character offset string prefixed with + or - (e.g. '-0600').
+     */
+    getGMTOffset : function(colon) {
+        return (this.getTimezoneOffset() > 0 ? "-" : "+")
+            + String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset()) / 60), 2, "0")
+            + (colon ? ":" : "")
+            + String.leftPad(Math.abs(this.getTimezoneOffset() % 60), 2, "0");
+    },
+
+    /**
+     * Get the numeric day number of the year, adjusted for leap year.
+     * @return {Number} 0 to 364 (365 in leap years).
+     */
+    getDayOfYear: function() {
+        var i = 0,
+            num = 0,
+            d = this.clone(),
+            m = this.getMonth();
+
+        for (i = 0, d.setMonth(0); i < m; d.setMonth(++i)) {
+            num += d.getDaysInMonth();
+        }
+        return num + this.getDate() - 1;
+    },
+
+    /**
+     * Get the numeric ISO-8601 week number of the year.
+     * (equivalent to the format specifier 'W', but without a leading zero).
+     * @return {Number} 1 to 53
+     */
+    getWeekOfYear : function() {
+        // adapted from http://www.merlyn.demon.co.uk/weekcalc.htm
+        var ms1d = 864e5, // milliseconds in a day
+            ms7d = 7 * ms1d; // milliseconds in a week
+
+        return function() { // return a closure so constants get calculated only once
+            var DC3 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate() + 3) / ms1d, // an Absolute Day Number
+                AWN = Math.floor(DC3 / 7), // an Absolute Week Number
+                Wyr = new Date(AWN * ms7d).getUTCFullYear();
+
+            return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;
+        }
+    }(),
+
+    /**
+     * Checks if the current date falls within a leap year.
+     * @return {Boolean} True if the current date falls within a leap year, false otherwise.
+     */
+    isLeapYear : function() {
+        var year = this.getFullYear();
+        return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));
+    },
+
+    /**
+     * Get the first day of the current month, adjusted for leap year.  The returned value
+     * is the numeric day index within the week (0-6) which can be used in conjunction with
+     * the {@link #monthNames} array to retrieve the textual day name.
+     * Example:
+     * <pre><code>
+var dt = new Date('1/10/2007');
+document.write(Date.dayNames[dt.getFirstDayOfMonth()]); //output: 'Monday'
+</code></pre>
+     * @return {Number} The day number (0-6).
+     */
+    getFirstDayOfMonth : function() {
+        var day = (this.getDay() - (this.getDate() - 1)) % 7;
+        return (day < 0) ? (day + 7) : day;
+    },
+
+    /**
+     * Get the last day of the current month, adjusted for leap year.  The returned value
+     * is the numeric day index within the week (0-6) which can be used in conjunction with
+     * the {@link #monthNames} array to retrieve the textual day name.
+     * Example:
+     * <pre><code>
+var dt = new Date('1/10/2007');
+document.write(Date.dayNames[dt.getLastDayOfMonth()]); //output: 'Wednesday'
+</code></pre>
+     * @return {Number} The day number (0-6).
+     */
+    getLastDayOfMonth : function() {
+        return this.getLastDateOfMonth().getDay();
+    },
+
+
+    /**
+     * Get the date of the first day of the month in which this date resides.
+     * @return {Date}
+     */
+    getFirstDateOfMonth : function() {
+        return new Date(this.getFullYear(), this.getMonth(), 1);
+    },
+
+    /**
+     * Get the date of the last day of the month in which this date resides.
+     * @return {Date}
+     */
+    getLastDateOfMonth : function() {
+        return new Date(this.getFullYear(), this.getMonth(), this.getDaysInMonth());
+    },
+
+    /**
+     * Get the number of days in the current month, adjusted for leap year.
+     * @return {Number} The number of days in the month.
+     */
+    getDaysInMonth: function() {
+        var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+
+        return function() { // return a closure for efficiency
+            var m = this.getMonth();
+
+            return m == 1 && this.isLeapYear() ? 29 : daysInMonth[m];
+        }
+    }(),
+
+    /**
+     * Get the English ordinal suffix of the current day (equivalent to the format specifier 'S').
+     * @return {String} 'st, 'nd', 'rd' or 'th'.
+     */
+    getSuffix : function() {
+        switch (this.getDate()) {
+            case 1:
+            case 21:
+            case 31:
+                return "st";
+            case 2:
+            case 22:
+                return "nd";
+            case 3:
+            case 23:
+                return "rd";
+            default:
+                return "th";
+        }
+    },
+
+    /**
+     * Creates and returns a new Date instance with the exact same date value as the called instance.
+     * Dates are copied and passed by reference, so if a copied date variable is modified later, the original
+     * variable will also be changed.  When the intention is to create a new variable that will not
+     * modify the original instance, you should create a clone.
+     *
+     * Example of correctly cloning a date:
+     * <pre><code>
+//wrong way:
+var orig = new Date('10/1/2006');
+var copy = orig;
+copy.setDate(5);
+document.write(orig);  //returns 'Thu Oct 05 2006'!
+
+//correct way:
+var orig = new Date('10/1/2006');
+var copy = orig.clone();
+copy.setDate(5);
+document.write(orig);  //returns 'Thu Oct 01 2006'
+</code></pre>
+     * @return {Date} The new Date instance.
+     */
+    clone : function() {
+        return new Date(this.getTime());
+    },
+
+    /**
+     * Checks if the current date is affected by Daylight Saving Time (DST).
+     * @return {Boolean} True if the current date is affected by DST.
+     */
+    isDST : function() {
+        // adapted from http://extjs.com/forum/showthread.php?p=247172#post247172
+        // courtesy of @geoffrey.mcgill
+        return new Date(this.getFullYear(), 0, 1).getTimezoneOffset() != this.getTimezoneOffset();
+    },
+
+    /**
+     * Attempts to clear all time information from this Date by setting the time to midnight of the same day,
+     * automatically adjusting for Daylight Saving Time (DST) where applicable.
+     * (note: DST timezone information for the browser's host operating system is assumed to be up-to-date)
+     * @param {Boolean} clone true to create a clone of this date, clear the time and return it (defaults to false).
+     * @return {Date} this or the clone.
+     */
+    clearTime : function(clone) {
+        if (clone) {
+            return this.clone().clearTime();
+        }
+
+        // get current date before clearing time
+        var d = this.getDate();
+
+        // clear time
+        this.setHours(0);
+        this.setMinutes(0);
+        this.setSeconds(0);
+        this.setMilliseconds(0);
+
+        if (this.getDate() != d) { // account for DST (i.e. day of month changed when setting hour = 0)
+            // note: DST adjustments are assumed to occur in multiples of 1 hour (this is almost always the case)
+            // refer to http://www.timeanddate.com/time/aboutdst.html for the (rare) exceptions to this rule
+
+            // increment hour until cloned date == current date
+            for (var hr = 1, c = this.add(Date.HOUR, hr); c.getDate() != d; hr++, c = this.add(Date.HOUR, hr));
+
+            this.setDate(d);
+            this.setHours(c.getHours());
+        }
+
+        return this;
+    },
+
+    /**
+     * Provides a convenient method for performing basic date arithmetic. This method
+     * does not modify the Date instance being called - it creates and returns
+     * a new Date instance containing the resulting date value.
+     *
+     * Examples:
+     * <pre><code>
+// Basic usage:
+var dt = new Date('10/29/2006').add(Date.DAY, 5);
+document.write(dt); //returns 'Fri Nov 03 2006 00:00:00'
+
+// Negative values will be subtracted:
+var dt2 = new Date('10/1/2006').add(Date.DAY, -5);
+document.write(dt2); //returns 'Tue Sep 26 2006 00:00:00'
+
+// You can even chain several calls together in one line:
+var dt3 = new Date('10/1/2006').add(Date.DAY, 5).add(Date.HOUR, 8).add(Date.MINUTE, -30);
+document.write(dt3); //returns 'Fri Oct 06 2006 07:30:00'
+</code></pre>
+     *
+     * @param {String} interval A valid date interval enum value.
+     * @param {Number} value The amount to add to the current date.
+     * @return {Date} The new Date instance.
+     */
+    add : function(interval, value) {
+        var d = this.clone();
+        if (!interval || value === 0) return d;
+
+        switch(interval.toLowerCase()) {
+            case Date.MILLI:
+                d.setMilliseconds(this.getMilliseconds() + value);
+                break;
+            case Date.SECOND:
+                d.setSeconds(this.getSeconds() + value);
+                break;
+            case Date.MINUTE:
+                d.setMinutes(this.getMinutes() + value);
+                break;
+            case Date.HOUR:
+                d.setHours(this.getHours() + value);
+                break;
+            case Date.DAY:
+                d.setDate(this.getDate() + value);
+                break;
+            case Date.MONTH:
+                var day = this.getDate();
+                if (day > 28) {
+                    day = Math.min(day, this.getFirstDateOfMonth().add('mo', value).getLastDateOfMonth().getDate());
+                }
+                d.setDate(day);
+                d.setMonth(this.getMonth() + value);
+                break;
+            case Date.YEAR:
+                d.setFullYear(this.getFullYear() + value);
+                break;
+        }
+        return d;
+    },
+
+    /**
+     * Checks if this date falls on or between the given start and end dates.
+     * @param {Date} start Start date
+     * @param {Date} end End date
+     * @return {Boolean} true if this date falls on or between the given start and end dates.
+     */
+    between : function(start, end) {
+        var t = this.getTime();
+        return start.getTime() <= t && t <= end.getTime();
+    }
+});
+
+
+/**
+ * Formats a date given the supplied format string.
+ * @param {String} format The format string.
+ * @return {String} The formatted date.
+ * @method format
+ */
+Date.prototype.format = Date.prototype.dateFormat;
+
+
+// private
+if (Ext.isSafari && (navigator.userAgent.match(/WebKit\/(\d+)/)[1] || NaN) < 420) {
+    Ext.apply(Date.prototype, {
+        _xMonth : Date.prototype.setMonth,
+        _xDate  : Date.prototype.setDate,
+
+        // Bug in Safari 1.3, 2.0 (WebKit build < 420)
+        // Date.setMonth does not work consistently if iMonth is not 0-11
+        setMonth : function(num) {
+            if (num <= -1) {
+                var n = Math.ceil(-num),
+                    back_year = Math.ceil(n / 12),
+                    month = (n % 12) ? 12 - n % 12 : 0;
+
+                this.setFullYear(this.getFullYear() - back_year);
+
+                return this._xMonth(month);
+            } else {
+                return this._xMonth(num);
+            }
+        },
+
+        // Bug in setDate() method (resolved in WebKit build 419.3, so to be safe we target Webkit builds < 420)
+        // The parameter for Date.setDate() is converted to a signed byte integer in Safari
+        // http://brianary.blogspot.com/2006/03/safari-date-bug.html
+        setDate : function(d) {
+            // use setTime() to workaround setDate() bug
+            // subtract current day of month in milliseconds, then add desired day of month in milliseconds
+            return this.setTime(this.getTime() - (this.getDate() - d) * 864e5);
+        }
+    });
+}
+
+
+
+/* Some basic Date tests... (requires Firebug)
+
+Date.parseDate('', 'c'); // call Date.parseDate() once to force computation of regex string so we can console.log() it
+console.log('Insane Regex for "c" format: %o', Date.parseCodes.c.s); // view the insane regex for the "c" format specifier
+
+// standard tests
+console.group('Standard Date.parseDate() Tests');
+    console.log('Date.parseDate("2009-01-05T11:38:56", "c")               = %o', Date.parseDate("2009-01-05T11:38:56", "c")); // assumes browser's timezone setting
+    console.log('Date.parseDate("2009-02-04T12:37:55.001000", "c")        = %o', Date.parseDate("2009-02-04T12:37:55.001000", "c")); // assumes browser's timezone setting
+    console.log('Date.parseDate("2009-03-03T13:36:54,101000Z", "c")       = %o', Date.parseDate("2009-03-03T13:36:54,101000Z", "c")); // UTC
+    console.log('Date.parseDate("2009-04-02T14:35:53.901000-0530", "c")   = %o', Date.parseDate("2009-04-02T14:35:53.901000-0530", "c")); // GMT-0530
+    console.log('Date.parseDate("2009-05-01T15:34:52,9876000+08:00", "c") = %o', Date.parseDate("2009-05-01T15:34:52,987600+08:00", "c")); // GMT+08:00
+console.groupEnd();
+
+// ISO-8601 format as specified in http://www.w3.org/TR/NOTE-datetime
+// -- accepts ALL 6 levels of date-time granularity
+console.group('ISO-8601 Granularity Test (see http://www.w3.org/TR/NOTE-datetime)');
+    console.log('Date.parseDate("1997", "c")                              = %o', Date.parseDate("1997", "c")); // YYYY (e.g. 1997)
+    console.log('Date.parseDate("1997-07", "c")                           = %o', Date.parseDate("1997-07", "c")); // YYYY-MM (e.g. 1997-07)
+    console.log('Date.parseDate("1997-07-16", "c")                        = %o', Date.parseDate("1997-07-16", "c")); // YYYY-MM-DD (e.g. 1997-07-16)
+    console.log('Date.parseDate("1997-07-16T19:20+01:00", "c")            = %o', Date.parseDate("1997-07-16T19:20+01:00", "c")); // YYYY-MM-DDThh:mmTZD (e.g. 1997-07-16T19:20+01:00)
+    console.log('Date.parseDate("1997-07-16T19:20:30+01:00", "c")         = %o', Date.parseDate("1997-07-16T19:20:30+01:00", "c")); // YYYY-MM-DDThh:mm:ssTZD (e.g. 1997-07-16T19:20:30+01:00)
+    console.log('Date.parseDate("1997-07-16T19:20:30.45+01:00", "c")      = %o', Date.parseDate("1997-07-16T19:20:30.45+01:00", "c")); // YYYY-MM-DDThh:mm:ss.sTZD (e.g. 1997-07-16T19:20:30.45+01:00)
+    console.log('Date.parseDate("1997-07-16 19:20:30.45+01:00", "c")      = %o', Date.parseDate("1997-07-16 19:20:30.45+01:00", "c")); // YYYY-MM-DD hh:mm:ss.sTZD (e.g. 1997-07-16T19:20:30.45+01:00)
+    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
+ */
+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
+     * @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;
+        }
+    };
+};/**\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
-    \r
-    update : function(html, loadScripts, callback){\r
-        if(typeof html == "undefined"){\r
-            html = "";\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(loadScripts !== true){\r
-            this.dom.innerHTML = html;\r
-            if(typeof callback == "function"){\r
-                callback();\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
-            return this;\r
+            this.map[key] = o;\r
         }\r
-        var id = Ext.id();\r
-        var dom = this.dom;\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
-        html += '<span id="' + id + '"></span>';\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
-        E.onAvailable(id, function(){\r
-            var hd = document.getElementsByTagName("head")[0];\r
-            var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;\r
-            var srcRe = /\ssrc=([\'\"])(.*?)\1/i;\r
-            var typeRe = /\stype=([\'\"])(.*?)\1/i;\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
-            var match;\r
-            while(match = re.exec(html)){\r
-                var attrs = match[1];\r
-                var srcMatch = attrs ? attrs.match(srcRe) : false;\r
-                if(srcMatch && srcMatch[2]){\r
-                   var s = document.createElement("script");\r
-                   s.src = srcMatch[2];\r
-                   var 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
+ * 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
-            var el = document.getElementById(id);\r
-            if(el){Ext.removeNode(el);}\r
-            if(typeof callback == "function"){\r
-                callback();\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
-        dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");\r
-        return this;\r
+        }\r
     },\r
 \r
-    \r
-    load : function(){\r
-        var um = this.getUpdater();\r
-        um.update.apply(um, arguments);\r
-        return this;\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
-    getUpdater : function(){\r
-        if(!this.updateManager){\r
-            this.updateManager = new Ext.Updater(this);\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
-        return this.updateManager;\r
     },\r
 \r
-    \r
-    unselectable : function(){\r
-        this.dom.unselectable = "on";\r
-        this.swallowEvent("selectstart", true);\r
-        this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");\r
-        this.addClass("x-unselectable");\r
-        return this;\r
-    },\r
-\r
-    \r
-    getCenterXY : function(){\r
-        return this.getAlignToXY(document, 'c-c');\r
-    },\r
-\r
-    \r
-    center : function(centerIn){\r
-        this.alignTo(centerIn || document, 'c-c');\r
-        return this;\r
-    },\r
-\r
-    \r
-    isBorderBox : function(){\r
-        return noBoxAdjust[this.dom.tagName.toLowerCase()] || Ext.isBorderBox;\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
-    getBox : function(contentBox, local){\r
-        var xy;\r
-        if(!local){\r
-            xy = this.getXY();\r
-        }else{\r
-            var left = parseInt(this.getStyle("left"), 10) || 0;\r
-            var top = parseInt(this.getStyle("top"), 10) || 0;\r
-            xy = [left, top];\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
-        var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;\r
-        if(!contentBox){\r
-            bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};\r
-        }else{\r
-            var l = this.getBorderWidth("l")+this.getPadding("l");\r
-            var r = this.getBorderWidth("r")+this.getPadding("r");\r
-            var t = this.getBorderWidth("t")+this.getPadding("t");\r
-            var b = this.getBorderWidth("b")+this.getPadding("b");\r
-            bx = {x: xy[0]+l, y: xy[1]+t, 0: xy[0]+l, 1: xy[1]+t, width: w-(l+r), height: h-(t+b)};\r
+        if(this.containsKey(key)){\r
+            this.suspendEvents();\r
+            this.removeKey(key);\r
+            this.resumeEvents();\r
         }\r
-        bx.right = bx.x + bx.width;\r
-        bx.bottom = bx.y + bx.height;\r
-        return bx;\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
-    getFrameWidth : function(sides, onlyContentBox){\r
-        return onlyContentBox && Ext.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));\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
-    setBox : function(box, adjust, animate){\r
-        var w = box.width, h = box.height;\r
-        if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){\r
-           w -= (this.getBorderWidth("lr") + this.getPadding("lr"));\r
-           h -= (this.getBorderWidth("tb") + this.getPadding("tb"));\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
-        this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));\r
-        return this;\r
+        return false;\r
     },\r
 \r
-    \r
-     repaint : function(){\r
-        var dom = this.dom;\r
-        this.addClass("x-repaint");\r
-        setTimeout(function(){\r
-            Ext.get(dom).removeClass("x-repaint");\r
-        }, 1);\r
-        return this;\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
-    getMargins : function(side){\r
-        if(!side){\r
-            return {\r
-                top: parseInt(this.getStyle("margin-top"), 10) || 0,\r
-                left: parseInt(this.getStyle("margin-left"), 10) || 0,\r
-                bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,\r
-                right: parseInt(this.getStyle("margin-right"), 10) || 0\r
-            };\r
-        }else{\r
-            return this.addStyles(side, El.margins);\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
-    // private\r
-    addStyles : function(sides, styles){\r
-        var val = 0, v, w;\r
-        for(var i = 0, len = sides.length; i < len; i++){\r
-            v = this.getStyle(styles[sides.charAt(i)]);\r
-            if(v){\r
-                 w = parseInt(v, 10);\r
-                 if(w){ val += (w >= 0 ? w : -1 * w); }\r
-            }\r
-        }\r
-        return val;\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
-    createProxy : function(config, renderTo, matchBox){\r
-        config = typeof config == "object" ?\r
-            config : {tag : "div", cls: config};\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
-        var proxy;\r
-        if(renderTo){\r
-            proxy = Ext.DomHelper.append(renderTo, config, true);\r
-        }else {\r
-            proxy = Ext.DomHelper.insertBefore(this.dom, config, true);\r
-        }\r
-        if(matchBox){\r
-           proxy.setBox(this.getBox());\r
-        }\r
-        return proxy;\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
-    mask : function(msg, msgCls){\r
-        if(this.getStyle("position") == "static"){\r
-            this.addClass("x-masked-relative");\r
-        }\r
-        if(this._maskMsg){\r
-            this._maskMsg.remove();\r
-        }\r
-        if(this._mask){\r
-            this._mask.remove();\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
-        this._mask = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask"}, true);\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
-        this.addClass("x-masked");\r
-        this._mask.setDisplayed(true);\r
-        if(typeof msg == 'string'){\r
-            this._maskMsg = Ext.DomHelper.append(this.dom, {cls:"ext-el-mask-msg", cn:{tag:'div'}}, true);\r
-            var mm = this._maskMsg;\r
-            mm.dom.className = msgCls ? "ext-el-mask-msg " + msgCls : "ext-el-mask-msg";\r
-            mm.dom.firstChild.innerHTML = msg;\r
-            mm.setDisplayed(true);\r
-            mm.center(this);\r
-        }\r
-        if(Ext.isIE && !(Ext.isIE7 && Ext.isStrict) && this.getStyle('height') == 'auto'){ // ie will not expand full height automatically\r
-            this._mask.setSize(this.getWidth(), this.getHeight());\r
-        }\r
-        return this._mask;\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
-    unmask : function(){\r
-        if(this._mask){\r
-            if(this._maskMsg){\r
-                this._maskMsg.remove();\r
-                delete this._maskMsg;\r
-            }\r
-            this._mask.remove();\r
-            delete this._mask;\r
-        }\r
-        this.removeClass(["x-masked", "x-masked-relative"]);\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
-    isMasked : function(){\r
-        return this._mask && this._mask.isVisible();\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
-    createShim : function(){\r
-        var el = document.createElement('iframe');\r
-        el.frameBorder = '0';\r
-        el.className = 'ext-shim';\r
-        if(Ext.isIE && Ext.isSecure){\r
-            el.src = Ext.SSL_SECURE_URL;\r
-        }\r
-        var shim = Ext.get(this.dom.parentNode.insertBefore(el, this.dom));\r
-        shim.autoBoxAdjust = false;\r
-        return shim;\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
-    remove : function(){\r
-        Ext.removeNode(this.dom);\r
-        delete El.cache[this.dom.id];\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
-    \r
-    hover : function(overFn, outFn, scope){\r
-        var preOverFn = function(e){\r
-            if(!e.within(this, true)){\r
-                overFn.apply(scope || this, arguments);\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
-        var preOutFn = function(e){\r
-            if(!e.within(this, true)){\r
-                outFn.apply(scope || this, arguments);\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
-        };\r
-        this.on("mouseover", preOverFn, this.dom);\r
-        this.on("mouseout", preOutFn, this.dom);\r
-        return this;\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
-    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
+     * 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
-    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
-    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
-            var fn = function(){\r
-                Ext.fly(dom, '_internal').removeClass(className);\r
-                d.removeListener("mouseup", fn);\r
-            };\r
-            d.on("mouseup", fn);\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
-        return this;\r
     },\r
 \r
-    \r
-    swallowEvent : function(eventName, preventDefault){\r
-        var fn = function(e){\r
-            e.stopPropagation();\r
-            if(preventDefault){\r
-                e.preventDefault();\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
-        };\r
-        if(Ext.isArray(eventName)){\r
-            for(var i = 0, len = eventName.length; i < len; i++){\r
-                 this.on(eventName[i], fn);\r
+        }else{\r
+            for(i = start; i >= end; i--) {\r
+                r[r.length] = items[i];\r
             }\r
-            return this;\r
         }\r
-        this.on(eventName, fn);\r
-        return this;\r
-    },\r
-\r
-    \r
-    parent : function(selector, returnDom){\r
-        return this.matchNode('parentNode', 'parentNode', selector, returnDom);\r
-    },\r
-\r
-     \r
-    next : function(selector, returnDom){\r
-        return this.matchNode('nextSibling', 'nextSibling', selector, returnDom);\r
+        return r;\r
     },\r
 \r
-    \r
-    prev : function(selector, returnDom){\r
-        return this.matchNode('previousSibling', 'previousSibling', selector, returnDom);\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
-    \r
-    first : function(selector, returnDom){\r
-        return this.matchNode('nextSibling', 'firstChild', selector, returnDom);\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
-    last : function(selector, returnDom){\r
-        return this.matchNode('previousSibling', 'lastChild', selector, returnDom);\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
-    matchNode : function(dir, start, selector, returnDom){\r
-        var n = this.dom[start];\r
-        while(n){\r
-            if(n.nodeType == 1 && (!selector || Ext.DomQuery.is(n, selector))){\r
-                return !returnDom ? Ext.get(n) : n;\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
-            n = n[dir];\r
         }\r
-        return null;\r
-    },\r
-\r
-    \r
-    appendChild: function(el){\r
-        el = Ext.get(el);\r
-        el.appendTo(this);\r
-        return this;\r
+        return -1;\r
     },\r
 \r
-    \r
-    createChild: function(config, insertBefore, returnDom){\r
-        config = config || {tag:'div'};\r
-        if(insertBefore){\r
-            return Ext.DomHelper.insertBefore(insertBefore, config, returnDom !== true);\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 Ext.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);\r
+        return value;\r
     },\r
 \r
-    \r
-    appendTo: function(el){\r
-        el = Ext.getDom(el);\r
-        el.appendChild(this.dom);\r
-        return this;\r
-    },\r
-\r
-    \r
-    insertBefore: function(el){\r
-        el = Ext.getDom(el);\r
-        el.parentNode.insertBefore(this.dom, el);\r
-        return this;\r
-    },\r
-\r
-    \r
-    insertAfter: function(el){\r
-        el = Ext.getDom(el);\r
-        el.parentNode.insertBefore(this.dom, el.nextSibling);\r
-        return this;\r
-    },\r
-\r
-    \r
-    insertFirst: function(el, returnDom){\r
-        el = el || {};\r
-        if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config\r
-            return this.createChild(el, this.dom.firstChild, returnDom);\r
-        }else{\r
-            el = Ext.getDom(el);\r
-            this.dom.insertBefore(el, this.dom.firstChild);\r
-            return !returnDom ? Ext.get(el) : el;\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
-\r
-    \r
-    insertSibling: function(el, where, returnDom){\r
-        var rt;\r
-        if(Ext.isArray(el)){\r
-            for(var i = 0, len = el.length; i < len; i++){\r
-                rt = this.insertSibling(el[i], where, returnDom);\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
+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
+ * mess with the Object prototype
+ * http://www.json.org/js.html
+ * @singleton
+ */
+Ext.util.JSON = new (function(){
+    var useHasOwn = !!{}.hasOwnProperty,
+        isNative = function() {
+            var useNative = null;
+
+            return function() {
+                if (useNative === null) {
+                    useNative = Ext.USE_NATIVE_JSON && window.JSON && JSON.toString() == '[object JSON]';
+                }
+        
+                return useNative;
+            };
+        }(),
+        pad = function(n) {
+            return n < 10 ? "0" + n : n;
+        },
+        doDecode = function(json){
+            return eval("(" + json + ')');    
+        },
+        doEncode = function(o){
+            if(typeof o == "undefined" || o === null){
+                return "null";
+            }else if(Ext.isArray(o)){
+                return encodeArray(o);
+            }else if(Object.prototype.toString.apply(o) === '[object Date]'){
+                return Ext.util.JSON.encodeDate(o);
+            }else if(typeof o == "string"){
+                return encodeString(o);
+            }else if(typeof o == "number"){
+                return isFinite(o) ? String(o) : "null";
+            }else if(typeof o == "boolean"){
+                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(',');
+                            }
+                            a.push(doEncode(i), ":",
+                                    v === null ? "null" : doEncode(v));
+                            b = true;
+                        }
+                    }
+                }
+                a.push("}");
+                return a.join("");
+            }    
+        },
+        m = {
+            "\b": '\\b',
+            "\t": '\\t',
+            "\n": '\\n',
+            "\f": '\\f',
+            "\r": '\\r',
+            '"' : '\\"',
+            "\\": '\\\\'
+        },
+        encodeString = function(s){
+            if (/["\\\x00-\x1f]/.test(s)) {
+                return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {
+                    var c = m[b];
+                    if(c){
+                        return c;
+                    }
+                    c = b.charCodeAt();
+                    return "\\u00" +
+                        Math.floor(c / 16).toString(16) +
+                        (c % 16).toString(16);
+                }) + '"';
+            }
+            return '"' + s + '"';
+        },
+        encodeArray = function(o){
+            var a = ["["], b, i, l = o.length, v;
+                for (i = 0; i < l; i += 1) {
+                    v = o[i];
+                    switch (typeof v) {
+                        case "undefined":
+                        case "function":
+                        case "unknown":
+                            break;
+                        default:
+                            if (b) {
+                                a.push(',');
+                            }
+                            a.push(v === null ? "null" : Ext.util.JSON.encode(v));
+                            b = true;
+                    }
+                }
+                a.push("]");
+                return a.join("");
+        };
+
+    this.encodeDate = function(o){
+        return '"' + o.getFullYear() + "-" +
+                pad(o.getMonth() + 1) + "-" +
+                pad(o.getDate()) + "T" +
+                pad(o.getHours()) + ":" +
+                pad(o.getMinutes()) + ":" +
+                pad(o.getSeconds()) + '"';
+    };
+
+    /**
+     * Encodes an Object, Array or other value
+     * @param {Mixed} o The variable to encode
+     * @return {String} The JSON string
+     */
+    this.encode = function() {
+        var ec;
+        return function(o) {
+            if (!ec) {
+                // setup encoding function on first access
+                ec = isNative() ? JSON.stringify : doEncode;
+            }
+            return ec(o);
+        };
+    }();
+
+
+    /**
+     * Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError unless the safe option is set.
+     * @param {String} json The JSON string
+     * @return {Object} The resulting object
+     */
+    this.decode = function() {
+        var dc;
+        return function(json) {
+            if (!dc) {
+                // setup decoding function on first access
+                dc = isNative() ? JSON.parse : doDecode;
+            }
+            return dc(json);
+        };
+    }();
+
+})();
+/**
+ * Shorthand for {@link Ext.util.JSON#encode}
+ * @param {Mixed} o The variable to encode
+ * @return {String} The JSON string
+ * @member Ext
+ * @method encode
+ */
+Ext.encode = Ext.util.JSON.encode;
+/**
+ * Shorthand for {@link Ext.util.JSON#decode}
+ * @param {String} json The JSON string
+ * @param {Boolean} safe (optional) Whether to return null or throw an exception if the JSON is invalid.
+ * @return {Object} The resulting object
+ * @member Ext
+ * @method decode
+ */
+Ext.decode = Ext.util.JSON.decode;
+/**\r
+ * @class Ext.util.Format\r
+ * Reusable data formatting functions\r
+ * @singleton\r
+ */\r
+Ext.util.Format = function(){\r
+    var trimRe = /^\s+|\s+$/g;\r
+    return {\r
+        /**\r
+         * Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length\r
+         * @param {String} value The string to truncate\r
+         * @param {Number} length The maximum length to allow before truncating\r
+         * @param {Boolean} word True to try to find a common work break\r
+         * @return {String} The converted text\r
+         */\r
+        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
+                    if(index == -1 || index < (len - 15)){\r
+                        return value.substr(0, len - 3) + "...";\r
+                    }else{\r
+                        return vs.substr(0, index) + "...";\r
+                    }\r
+                } else{\r
+                    return value.substr(0, len - 3) + "...";\r
+                }\r
             }\r
-            return rt;\r
-        }\r
-        where = where ? where.toLowerCase() : 'before';\r
-        el = el || {};\r
-        var refNode = where == 'before' ? this.dom : this.dom.nextSibling;\r
+            return value;\r
+        },\r
 \r
-        if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config\r
-            if(where == 'after' && !this.dom.nextSibling){\r
-                rt = Ext.DomHelper.append(this.dom.parentNode, el, !returnDom);\r
-            }else{\r
-                rt = Ext.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);\r
-            }\r
+        /**\r
+         * Checks a reference and converts it to empty string if it is undefined\r
+         * @param {Mixed} value Reference to check\r
+         * @return {Mixed} Empty string if converted, otherwise the original value\r
+         */\r
+        undef : function(value){\r
+            return value !== undefined ? value : "";\r
+        },\r
 \r
-        }else{\r
-            rt = this.dom.parentNode.insertBefore(Ext.getDom(el), refNode);\r
-            if(!returnDom){\r
-                rt = Ext.get(rt);\r
-            }\r
-        }\r
-        return rt;\r
-    },\r
+        /**\r
+         * Checks a reference and converts it to the default value if it's empty\r
+         * @param {Mixed} value Reference to check\r
+         * @param {String} defaultValue The value to insert of it's undefined (defaults to "")\r
+         * @return {String}\r
+         */\r
+        defaultValue : function(value, defaultValue){\r
+            return value !== undefined && value !== '' ? value : defaultValue;\r
+        },\r
 \r
-    \r
-    wrap: function(config, returnDom){\r
-        if(!config){\r
-            config = {tag: "div"};\r
-        }\r
-        var newEl = Ext.DomHelper.insertBefore(this.dom, config, !returnDom);\r
-        newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);\r
-        return newEl;\r
-    },\r
+        /**\r
+         * Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.\r
+         * @param {String} value The string to encode\r
+         * @return {String} The encoded text\r
+         */\r
+        htmlEncode : function(value){\r
+            return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");\r
+        },\r
 \r
-    \r
-    replace: function(el){\r
-        el = Ext.get(el);\r
-        this.insertBefore(el);\r
-        el.remove();\r
-        return this;\r
-    },\r
+        /**\r
+         * Convert certain characters (&, <, >, and ') from their HTML character equivalents.\r
+         * @param {String} value The string to decode\r
+         * @return {String} The decoded text\r
+         */\r
+        htmlDecode : function(value){\r
+            return !value ? value : String(value).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");\r
+        },\r
 \r
-    \r
-    replaceWith: function(el){\r
-        if(typeof el == 'object' && !el.nodeType && !el.dom){ // dh config\r
-            el = this.insertSibling(el, 'before');\r
-        }else{\r
-            el = Ext.getDom(el);\r
-            this.dom.parentNode.insertBefore(el, this.dom);\r
-        }\r
-        El.uncache(this.id);\r
-        Ext.removeNode(this.dom);\r
-        this.dom = el;\r
-        this.id = Ext.id(el);\r
-        El.cache[this.id] = this;\r
-        return this;\r
-    },\r
+        /**\r
+         * Trims any whitespace from either side of a string\r
+         * @param {String} value The text to trim\r
+         * @return {String} The trimmed text\r
+         */\r
+        trim : function(value){\r
+            return String(value).replace(trimRe, "");\r
+        },\r
 \r
-    \r
-    insertHtml : function(where, html, returnEl){\r
-        var el = Ext.DomHelper.insertHtml(where, this.dom, html);\r
-        return returnEl ? Ext.get(el) : el;\r
-    },\r
+        /**\r
+         * Returns a substring from within an original string\r
+         * @param {String} value The original text\r
+         * @param {Number} start The start index of the substring\r
+         * @param {Number} length The length of the substring\r
+         * @return {String} The substring\r
+         */\r
+        substr : function(value, start, length){\r
+            return String(value).substr(start, length);\r
+        },\r
 \r
-    \r
-    set : function(o, useSet){\r
-        var el = this.dom;\r
-        useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;\r
-        for(var attr in o){\r
-            if(attr == "style" || typeof o[attr] == "function") continue;\r
-            if(attr=="cls"){\r
-                el.className = o["cls"];\r
-            }else if(o.hasOwnProperty(attr)){\r
-                if(useSet) el.setAttribute(attr, o[attr]);\r
-                else el[attr] = o[attr];\r
-            }\r
-        }\r
-        if(o.style){\r
-            Ext.DomHelper.applyStyles(el, o.style);\r
-        }\r
-        return this;\r
-    },\r
+        /**\r
+         * Converts a string to all lower case letters\r
+         * @param {String} value The text to convert\r
+         * @return {String} The converted text\r
+         */\r
+        lowercase : function(value){\r
+            return String(value).toLowerCase();\r
+        },\r
 \r
-    \r
-    addKeyListener : function(key, fn, scope){\r
-        var config;\r
-        if(typeof key != "object" || Ext.isArray(key)){\r
-            config = {\r
-                key: key,\r
-                fn: fn,\r
-                scope: scope\r
-            };\r
-        }else{\r
-            config = {\r
-                key : key.key,\r
-                shift : key.shift,\r
-                ctrl : key.ctrl,\r
-                alt : key.alt,\r
-                fn: fn,\r
-                scope: scope\r
-            };\r
-        }\r
-        return new Ext.KeyMap(this, config);\r
-    },\r
+        /**\r
+         * Converts a string to all upper case letters\r
+         * @param {String} value The text to convert\r
+         * @return {String} The converted text\r
+         */\r
+        uppercase : function(value){\r
+            return String(value).toUpperCase();\r
+        },\r
 \r
-    \r
-    addKeyMap : function(config){\r
-        return new Ext.KeyMap(this, config);\r
-    },\r
+        /**\r
+         * Converts the first character only of a string to upper case\r
+         * @param {String} value The text to convert\r
+         * @return {String} The converted text\r
+         */\r
+        capitalize : function(value){\r
+            return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();\r
+        },\r
 \r
-    \r
-     isScrollable : function(){\r
-        var dom = this.dom;\r
-        return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;\r
-    },\r
+        // private\r
+        call : function(value, fn){\r
+            if(arguments.length > 2){\r
+                var args = Array.prototype.slice.call(arguments, 2);\r
+                args.unshift(value);\r
+                return eval(fn).apply(window, args);\r
+            }else{\r
+                return eval(fn).call(window, value);\r
+            }\r
+        },\r
 \r
-    \r
-    scrollTo : function(side, value, animate){\r
-        var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";\r
-        if(!animate || !A){\r
-            this.dom[prop] = value;\r
-        }else{\r
-            var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];\r
-            this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');\r
-        }\r
-        return this;\r
-    },\r
+        /**\r
+         * Format a number as US currency\r
+         * @param {Number/String} value The numeric value to format\r
+         * @return {String} The formatted currency string\r
+         */\r
+        usMoney : function(v){\r
+            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
+            while (r.test(whole)) {\r
+                whole = whole.replace(r, '$1' + ',' + '$2');\r
+            }\r
+            v = whole + sub;\r
+            if(v.charAt(0) == '-'){\r
+                return '-$' + v.substr(1);\r
+            }\r
+            return "$" +  v;\r
+        },\r
 \r
-    \r
-     scroll : function(direction, distance, animate){\r
-         if(!this.isScrollable()){\r
-             return;\r
-         }\r
-         var el = this.dom;\r
-         var l = el.scrollLeft, t = el.scrollTop;\r
-         var w = el.scrollWidth, h = el.scrollHeight;\r
-         var cw = el.clientWidth, ch = el.clientHeight;\r
-         direction = direction.toLowerCase();\r
-         var scrolled = false;\r
-         var a = this.preanim(arguments, 2);\r
-         switch(direction){\r
-             case "l":\r
-             case "left":\r
-                 if(w - l > cw){\r
-                     var v = Math.min(l + distance, w-cw);\r
-                     this.scrollTo("left", v, a);\r
-                     scrolled = true;\r
-                 }\r
-                 break;\r
-            case "r":\r
-            case "right":\r
-                 if(l > 0){\r
-                     var v = Math.max(l - distance, 0);\r
-                     this.scrollTo("left", v, a);\r
-                     scrolled = true;\r
-                 }\r
-                 break;\r
-            case "t":\r
-            case "top":\r
-            case "up":\r
-                 if(t > 0){\r
-                     var v = Math.max(t - distance, 0);\r
-                     this.scrollTo("top", v, a);\r
-                     scrolled = true;\r
-                 }\r
-                 break;\r
-            case "b":\r
-            case "bottom":\r
-            case "down":\r
-                 if(h - t > ch){\r
-                     var v = Math.min(t + distance, h-ch);\r
-                     this.scrollTo("top", v, a);\r
-                     scrolled = true;\r
-                 }\r
-                 break;\r
-         }\r
-         return scrolled;\r
-    },\r
+        /**\r
+         * Parse a value into a formatted date using the specified format pattern.\r
+         * @param {String/Date} value The value to format (Strings must conform to the format expected by the javascript Date object's <a href="http://www.w3schools.com/jsref/jsref_parse.asp">parse()</a> method)\r
+         * @param {String} format (optional) Any valid date format string (defaults to 'm/d/Y')\r
+         * @return {String} The formatted date string\r
+         */\r
+        date : function(v, format){\r
+            if(!v){\r
+                return "";\r
+            }\r
+            if(!Ext.isDate(v)){\r
+                v = new Date(Date.parse(v));\r
+            }\r
+            return v.dateFormat(format || "m/d/Y");\r
+        },\r
 \r
-    \r
-    translatePoints : function(x, y){\r
-        if(typeof x == 'object' || Ext.isArray(x)){\r
-            y = x[1]; x = x[0];\r
-        }\r
-        var p = this.getStyle('position');\r
-        var o = this.getXY();\r
+        /**\r
+         * Returns a date rendering function that can be reused to apply a date format multiple times efficiently\r
+         * @param {String} format Any valid date format string\r
+         * @return {Function} The date formatting function\r
+         */\r
+        dateRenderer : function(format){\r
+            return function(v){\r
+                return Ext.util.Format.date(v, format);\r
+            };\r
+        },\r
 \r
-        var l = parseInt(this.getStyle('left'), 10);\r
-        var t = parseInt(this.getStyle('top'), 10);\r
+        // private\r
+        stripTagsRE : /<\/?[^>]+>/gi,\r
+        \r
+        /**\r
+         * Strips all HTML tags\r
+         * @param {Mixed} value The text from which to strip tags\r
+         * @return {String} The stripped text\r
+         */\r
+        stripTags : function(v){\r
+            return !v ? v : String(v).replace(this.stripTagsRE, "");\r
+        },\r
 \r
-        if(isNaN(l)){\r
-            l = (p == "relative") ? 0 : this.dom.offsetLeft;\r
-        }\r
-        if(isNaN(t)){\r
-            t = (p == "relative") ? 0 : this.dom.offsetTop;\r
-        }\r
+        stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,\r
 \r
-        return {left: (x - o[0] + l), top: (y - o[1] + t)};\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
+        },\r
 \r
-    \r
-    getScroll : function(){\r
-        var d = this.dom, doc = document;\r
-        if(d == doc || d == doc.body){\r
-            var l, t;\r
-            if(Ext.isIE && Ext.isStrict){\r
-                l = doc.documentElement.scrollLeft || (doc.body.scrollLeft || 0);\r
-                t = doc.documentElement.scrollTop || (doc.body.scrollTop || 0);\r
-            }else{\r
-                l = window.pageXOffset || (doc.body.scrollLeft || 0);\r
-                t = window.pageYOffset || (doc.body.scrollTop || 0);\r
+        /**\r
+         * Simple format for a file size (xxx bytes, xxx KB, xxx MB)\r
+         * @param {Number/String} size The numeric value to format\r
+         * @return {String} The formatted file size\r
+         */\r
+        fileSize : function(size){\r
+            if(size < 1024) {\r
+                return size + " bytes";\r
+            } else if(size < 1048576) {\r
+                return (Math.round(((size*10) / 1024))/10) + " KB";\r
+            } else {\r
+                return (Math.round(((size*10) / 1048576))/10) + " MB";\r
             }\r
-            return {left: l, top: t};\r
-        }else{\r
-            return {left: d.scrollLeft, top: d.scrollTop};\r
-        }\r
-    },\r
+        },\r
 \r
-    \r
-    getColor : function(attr, defaultValue, prefix){\r
-        var v = this.getStyle(attr);\r
-        if(!v || v == "transparent" || v == "inherit") {\r
-            return defaultValue;\r
-        }\r
-        var color = typeof prefix == "undefined" ? "#" : prefix;\r
-        if(v.substr(0, 4) == "rgb("){\r
-            var rvs = v.slice(4, v.length -1).split(",");\r
-            for(var i = 0; i < 3; i++){\r
-                var h = parseInt(rvs[i]);\r
-                var s = h.toString(16);\r
-                if(h < 16){\r
-                    s = "0" + s;\r
+        /**\r
+         * It does simple math for use in a template, for example:<pre><code>\r
+         * var tpl = new Ext.Template('{value} * 10 = {value:math("* 10")}');\r
+         * </code></pre>\r
+         * @return {Function} A function that operates on the passed value.\r
+         */\r
+        math : function(){\r
+            var fns = {};\r
+            return function(v, a){\r
+                if(!fns[a]){\r
+                    fns[a] = new Function('v', 'return v ' + a + ';');\r
                 }\r
-                color += s;\r
+                return fns[a](v);\r
             }\r
-        } else {\r
-            if(v.substr(0, 1) == "#"){\r
-                if(v.length == 4) {\r
-                    for(var i = 1; i < 4; i++){\r
-                        var c = v.charAt(i);\r
-                        color +=  c + c;\r
-                    }\r
-                }else if(v.length == 7){\r
-                    color += v.substr(1);\r
-                }\r
+        }(),\r
+\r
+        /**\r
+         * Rounds the passed number to the required decimal precision.\r
+         * @param {Number/String} value The numeric value to round.\r
+         * @param {Number} precision The number of decimal places to which to round the first parameter's value.\r
+         * @return {Number} The rounded value.\r
+         */\r
+        round : function(value, precision) {\r
+            var result = Number(value);\r
+            if (typeof precision == 'number') {\r
+                precision = Math.pow(10, precision);\r
+                result = Math.round(value * precision) / precision;\r
             }\r
-        }\r
-        return(color.length > 5 ? color.toLowerCase() : defaultValue);\r
-    },\r
+            return result;\r
+        },\r
 \r
-    \r
-    boxWrap : function(cls){\r
-        cls = cls || 'x-box';\r
-        var el = Ext.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));\r
-        el.child('.'+cls+'-mc').dom.appendChild(this.dom);\r
-        return el;\r
-    },\r
+        /**\r
+         * Formats the number according to the format string.\r
+         * <div style="margin-left:40px">examples (123456.789):\r
+         * <div style="margin-left:10px">\r
+         * 0 - (123456) show only digits, no precision<br>\r
+         * 0.00 - (123456.78) show only digits, 2 precision<br>\r
+         * 0.0000 - (123456.7890) show only digits, 4 precision<br>\r
+         * 0,000 - (123,456) show comma and digits, no precision<br>\r
+         * 0,000.00 - (123,456.78) show comma and digits, 2 precision<br>\r
+         * 0,0.00 - (123,456.78) shortcut method, show comma and digits, 2 precision<br>\r
+         * To reverse the grouping (,) and decimal (.) for international numbers, add /i to the end.\r
+         * For example: 0.000,00/i\r
+         * </div></div>\r
+         * @param {Number} v The number to format.\r
+         * @param {String} format The way you would like to format this text.\r
+         * @return {String} The formatted number.\r
+         */\r
+        number: function(v, format) {\r
+            if(!format){\r
+                       return v;\r
+                   }\r
+                   v = Ext.num(v, NaN);\r
+            if (isNaN(v)){\r
+                return '';\r
+            }\r
+                   var comma = ',',\r
+                       dec = '.',\r
+                       i18n = false,\r
+                       neg = v < 0;\r
+               \r
+                   v = Math.abs(v);\r
+                   if(format.substr(format.length - 2) == '/i'){\r
+                       format = format.substr(0, format.length - 2);\r
+                       i18n = true;\r
+                       comma = '.';\r
+                       dec = ',';\r
+                   }\r
+               \r
+                   var hasComma = format.indexOf(comma) != -1, \r
+                       psplit = (i18n ? format.replace(/[^\d\,]/g, '') : format.replace(/[^\d\.]/g, '')).split(dec);\r
+               \r
+                   if(1 < psplit.length){\r
+                       v = v.toFixed(psplit[1].length);\r
+                   }else if(2 < psplit.length){\r
+                       throw ('NumberFormatException: invalid format, formats should have no more than 1 period: ' + format);\r
+                   }else{\r
+                       v = v.toFixed(0);\r
+                   }\r
+               \r
+                   var fnum = v.toString();\r
+                   if(hasComma){\r
+                       psplit = fnum.split('.');\r
+               \r
+                       var cnum = psplit[0], parr = [], j = cnum.length, m = Math.floor(j / 3), n = cnum.length % 3 || 3;\r
+               \r
+                       for(var i = 0; i < j; i += n){\r
+                           if(i != 0){\r
+                               n = 3;\r
+                           }\r
+                           parr[parr.length] = cnum.substr(i, n);\r
+                           m -= 1;\r
+                       }\r
+                       fnum = parr.join(comma);\r
+                       if(psplit[1]){\r
+                           fnum += dec + psplit[1];\r
+                       }\r
+                   }\r
+               \r
+                   return (neg ? '-' : '') + format.replace(/[\d,?\.?]+/, fnum);\r
+        },\r
 \r
-    \r
-    getAttributeNS : Ext.isIE ? function(ns, name){\r
-        var d = this.dom;\r
-        var type = typeof d[ns+":"+name];\r
-        if(type != 'undefined' && type != 'unknown'){\r
-            return d[ns+":"+name];\r
-        }\r
-        return d[name];\r
-    } : function(ns, name){\r
-        var d = this.dom;\r
-        return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];\r
-    },\r
+        /**\r
+         * Returns a number rendering function that can be reused to apply a number format multiple times efficiently\r
+         * @param {String} format Any valid number format string for {@link #number}\r
+         * @return {Function} The number formatting function\r
+         */\r
+        numberRenderer : function(format){\r
+            return function(v){\r
+                return Ext.util.Format.number(v, format);\r
+            };\r
+        },\r
 \r
-    \r
-    getTextWidth : function(text, min, max){\r
-        return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);\r
+        /**\r
+         * Selectively do a plural form of a word based on a numeric value. For example, in a template,\r
+         * {commentCount:plural("Comment")}  would result in "1 Comment" if commentCount was 1 or would be "x Comments"\r
+         * if the value is 0 or greater than 1.\r
+         * @param {Number} value The value to compare against\r
+         * @param {String} singular The singular form of the word\r
+         * @param {String} plural (optional) The plural form of the word (defaults to the singular with an "s")\r
+         */\r
+        plural : function(v, s, p){\r
+            return v +' ' + (v == 1 ? s : (p ? p : s+'s'));\r
+        },\r
+        \r
+        /**\r
+         * Converts newline characters to the HTML tag &lt;br/>\r
+         * @param {String} The string value to format.\r
+         * @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
+        }\r
     }\r
-};\r
-\r
-var ep = El.prototype;\r
-\r
-\r
-ep.on = ep.addListener;\r
-    // backwards compat\r
-ep.mon = ep.addListener;\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>
+ * <pre><code>
+var data = {
+    name: 'Jack Slocum',
+    title: 'Lead Developer',
+    company: 'Ext JS, LLC',
+    email: 'jack@extjs.com',
+    address: '4 Red Bulls Drive',
+    city: 'Cleveland',
+    state: 'Ohio',
+    zip: '44102',
+    drinks: ['Red Bull', 'Coffee', 'Water'],
+    kids: [{
+        name: 'Sara Grace',
+        age:3
+    },{
+        name: 'Zachary',
+        age:2
+    },{
+        name: 'John James',
+        age:0
+    }]
+};
+ * </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>
+ * <pre><code>
+var tpl = new Ext.XTemplate(
+    '&lt;p>Kids: ',
+    '&lt;tpl for=".">',
+        '&lt;p>{name}&lt;/p>',
+    '&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>
+ * <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;p>{name}&lt;/p>',
+    '&lt;/tpl>&lt;/p>'
+);
+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>
+ * <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>Dad: {parent.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>
+ * <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>',
+    '&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>
+ * <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;/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:
+ * <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>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>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>
+ * <pre><code>
+var tpl = new Ext.XTemplate(
+    '&lt;p>Name: {name}&lt;/p>',
+    '&lt;p>Company: {[values.company.toUpperCase() + ", " + values.title]}&lt;/p>',
+    '&lt;p>Kids: ',
+    '&lt;tpl for="kids">',
+       '&lt;div class="{[xindex % 2 === 0 ? "even" : "odd"]}">',
+        '{name}',
+        '&lt;/div>',
+    '&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
+ * object passed into the XTemplate constructor for more complex processing:</p>
+ * <pre><code>
+var tpl = new Ext.XTemplate(
+    '&lt;p>Name: {name}&lt;/p>',
+    '&lt;p>Kids: ',
+    '&lt;tpl for="kids">',
+        '&lt;tpl if="this.isGirl(name)">',
+            '&lt;p>Girl: {name} - {age}&lt;/p>',
+        '&lt;/tpl>',
+        '&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;
+     }
+});
+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
+ */
+Ext.XTemplate = function(){
+    Ext.XTemplate.superclass.constructor.apply(this, arguments);
+
+    var me = this,
+       s = me.html,
+       re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/,
+       nameRe = /^<tpl\b[^>]*?for="(.*?)"/,
+       ifRe = /^<tpl\b[^>]*?if="(.*?)"/,
+       execRe = /^<tpl\b[^>]*?exec="(.*?)"/,
+       m,
+       id = 0,
+       tpls = [],
+       VALUES = 'values',
+       PARENT = 'parent',
+       XINDEX = 'xindex',
+       XCOUNT = 'xcount',
+       RETURN = 'return ',
+       WITHVALUES = 'with(values){ ';
+
+    s = ['<tpl>', s, '</tpl>'].join('');
+
+    while((m = s.match(re))){
+               var m2 = m[0].match(nameRe),
+                       m3 = m[0].match(ifRe),
+                       m4 = m[0].match(execRe),
+                       exp = null,
+                       fn = null,
+                       exec = null,
+                       name = m2 && m2[1] ? m2[1] : '';
+
+       if (m3) {
+           exp = m3 && m3[1] ? m3[1] : null;
+           if(exp){
+               fn = new Function(VALUES, PARENT, XINDEX, XCOUNT, WITHVALUES + RETURN +(Ext.util.Format.htmlDecode(exp))+'; }');
+           }
+       }
+       if (m4) {
+           exp = m4 && m4[1] ? m4[1] : null;
+           if(exp){
+               exec = new Function(VALUES, PARENT, XINDEX, XCOUNT, WITHVALUES +(Ext.util.Format.htmlDecode(exp))+'; }');
+           }
+       }
+       if(name){
+           switch(name){
+               case '.': name = new Function(VALUES, PARENT, WITHVALUES + RETURN + VALUES + '; }'); break;
+               case '..': name = new Function(VALUES, PARENT, WITHVALUES + RETURN + PARENT + '; }'); break;
+               default: name = new Function(VALUES, PARENT, WITHVALUES + RETURN + name + '; }');
+           }
+       }
+       tpls.push({
+            id: id,
+            target: name,
+            exec: exec,
+            test: fn,
+            body: m[1]||''
+        });
+       s = s.replace(m[0], '{xtpl'+ id + '}');
+       ++id;
+    }
+       Ext.each(tpls, function(t) {
+        me.compileTpl(t);
+    });
+    me.master = tpls[tpls.length-1];
+    me.tpls = tpls;
+};
+Ext.extend(Ext.XTemplate, Ext.Template, {
+    // private
+    re : /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,
+    // private
+    codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g,
+
+    // private
+    applySubTemplate : function(id, values, parent, xindex, xcount){
+        var me = this,
+               len,
+               t = me.tpls[id],
+               vs,
+               buf = [];
+        if ((t.test && !t.test.call(me, values, parent, xindex, xcount)) ||
+            (t.exec && t.exec.call(me, values, parent, xindex, xcount))) {
+            return '';
+        }
+        vs = t.target ? t.target.call(me, values, parent) : values;
+        len = vs.length;
+        parent = t.target ? values : parent;
+        if(t.target && Ext.isArray(vs)){
+               Ext.each(vs, function(v, i) {
+                buf[buf.length] = t.compiled.call(me, v, parent, i+1, len);
+            });
+            return buf.join('');
+        }
+        return t.compiled.call(me, vs, parent, xindex, xcount);
+    },
+
+    // private
+    compileTpl : function(tpl){
+        var fm = Ext.util.Format,
+                       useF = this.disableFormats !== true,
+            sep = Ext.isGecko ? "+" : ",",
+            body;
+
+        function fn(m, name, format, args, math){
+            if(name.substr(0, 4) == 'xtpl'){
+                return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'";
+            }
+            var v;
+            if(name === '.'){
+                v = 'values';
+            }else if(name === '#'){
+                v = 'xindex';
+            }else if(name.indexOf('.') != -1){
+                v = name;
+            }else{
+                v = "values['" + name + "']";
+            }
+            if(math){
+                v = '(' + v + math + ')';
+            }
+            if (format && useF) {
+                args = args ? ',' + args : "";
+                if(format.substr(0, 5) != "this."){
+                    format = "fm." + format + '(';
+                }else{
+                    format = 'this.call("'+ format.substr(5) + '", ';
+                    args = ", values";
+                }
+            } else {
+                args= ''; format = "("+v+" === undefined ? '' : ";
+            }
+            return "'"+ sep + format + v + args + ")"+sep+"'";
+        }
+
+        function codeFn(m, code){
+            return "'"+ sep +'('+code+')'+sep+"'";
+        }
+
+        // branched to use + in gecko and [].join() in others
+        if(Ext.isGecko){
+            body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" +
+                   tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn) +
+                    "';};";
+        }else{
+            body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];
+            body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn));
+            body.push("'].join('');};");
+            body = body.join('');
+        }
+        eval(body);
+        return this;
+    },
+
+    /**
+     * Returns an HTML fragment of this template with the specified values applied.
+     * @param {Object} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
+     * @return {String} The HTML fragment
+     */
+    applyTemplate : function(values){
+        return this.master.compiled.call(this, values, {}, 1, 1);
+    },
+
+    /**
+     * Compile the template to a function for optimized performance.  Recommended if the template will be used frequently.
+     * @return {Function} The compiled function
+     */
+    compile : function(){return this;}
+
+    /**
+     * @property re
+     * @hide
+     */
+    /**
+     * @property disableFormats
+     * @hide
+     */
+    /**
+     * @method set
+     * @hide
+     */
+
+});
+/**
+ * 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'})
+ * @return {String} The HTML fragment
+ * @member Ext.XTemplate
+ * @method apply
+ */
+Ext.XTemplate.prototype.apply = Ext.XTemplate.prototype.applyTemplate;
+
+/**
+ * Creates a template from the passed element's value (<i>display:none</i> textarea, preferred) or innerHTML.
+ * @param {String/HTMLElement} el A DOM element or its id
+ * @return {Ext.Template} The created template
+ * @static
+ */
+Ext.XTemplate.from = function(el){
+    el = Ext.getDom(el);
+    return new Ext.XTemplate(el.value || el.innerHTML);
+};/**\r
+ * @class Ext.util.CSS\r
+ * Utility class for manipulating CSS rules\r
+ * @singleton\r
+ */\r
+Ext.util.CSS = function(){\r
+       var rules = null;\r
+       var doc = document;\r
 \r
-ep.getUpdateManager = ep.getUpdater;\r
+    var camelRe = /(-[a-z])/gi;\r
+    var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };\r
 \r
+   return {\r
+   /**\r
+    * Creates a stylesheet from a text blob of rules.\r
+    * These rules will be wrapped in a STYLE tag and appended to the HEAD of the document.\r
+    * @param {String} cssText The text containing the css rules\r
+    * @param {String} id An id to add to the stylesheet for later removal\r
+    * @return {StyleSheet}\r
+    */\r
+   createStyleSheet : function(cssText, id){\r
+       var ss;\r
+       var head = doc.getElementsByTagName("head")[0];\r
+       var rules = doc.createElement("style");\r
+       rules.setAttribute("type", "text/css");\r
+       if(id){\r
+           rules.setAttribute("id", id);\r
+       }\r
+       if(Ext.isIE){\r
+           head.appendChild(rules);\r
+           ss = rules.styleSheet;\r
+           ss.cssText = cssText;\r
+       }else{\r
+           try{\r
+                rules.appendChild(doc.createTextNode(cssText));\r
+           }catch(e){\r
+               rules.cssText = cssText;\r
+           }\r
+           head.appendChild(rules);\r
+           ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]);\r
+       }\r
+       this.cacheStyleSheet(ss);\r
+       return ss;\r
+   },\r
 \r
-ep.un = ep.removeListener;\r
+   /**\r
+    * Removes a style or link tag by id\r
+    * @param {String} id The id of the tag\r
+    */\r
+   removeStyleSheet : function(id){\r
+       var existing = doc.getElementById(id);\r
+       if(existing){\r
+           existing.parentNode.removeChild(existing);\r
+       }\r
+   },\r
 \r
+   /**\r
+    * Dynamically swaps an existing stylesheet reference for a new one\r
+    * @param {String} id The id of an existing link tag to remove\r
+    * @param {String} url The href of the new stylesheet to include\r
+    */\r
+   swapStyleSheet : function(id, url){\r
+       this.removeStyleSheet(id);\r
+       var ss = doc.createElement("link");\r
+       ss.setAttribute("rel", "stylesheet");\r
+       ss.setAttribute("type", "text/css");\r
+       ss.setAttribute("id", id);\r
+       ss.setAttribute("href", url);\r
+       doc.getElementsByTagName("head")[0].appendChild(ss);\r
+   },\r
+   \r
+   /**\r
+    * Refresh the rule cache if you have dynamically added stylesheets\r
+    * @return {Object} An object (hash) of rules indexed by selector\r
+    */\r
+   refreshCache : function(){\r
+       return this.getRules(true);\r
+   },\r
 \r
-ep.autoBoxAdjust = true;\r
+   // private\r
+   cacheStyleSheet : function(ss){\r
+       if(!rules){\r
+           rules = {};\r
+       }\r
+       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
+           }\r
+       }catch(e){}\r
+   },\r
+   \r
+   /**\r
+    * Gets all css rules for the document\r
+    * @param {Boolean} refreshCache true to refresh the internal cache\r
+    * @return {Object} An object (hash) of rules indexed by selector\r
+    */\r
+   getRules : function(refreshCache){\r
+               if(rules === null || refreshCache){\r
+                       rules = {};\r
+                       var ds = doc.styleSheets;\r
+                       for(var i =0, len = ds.length; i < len; i++){\r
+                           try{\r
+                       this.cacheStyleSheet(ds[i]);\r
+                   }catch(e){} \r
+               }\r
+               }\r
+               return rules;\r
+       },\r
+       \r
+       /**\r
+    * Gets an an individual CSS rule by selector(s)\r
+    * @param {String/Array} selector The CSS selector or an array of selectors to try. The first selector that is found is returned.\r
+    * @param {Boolean} refreshCache true to refresh the internal cache if you have recently updated any rules or added styles dynamically\r
+    * @return {CSSRule} The CSS rule or null if one is not found\r
+    */\r
+   getRule : function(selector, refreshCache){\r
+               var rs = this.getRules(refreshCache);\r
+               if(!Ext.isArray(selector)){\r
+                   return rs[selector];\r
+               }\r
+               for(var i = 0; i < selector.length; i++){\r
+                       if(rs[selector[i]]){\r
+                               return rs[selector[i]];\r
+                       }\r
+               }\r
+               return null;\r
+       },\r
+       \r
+       \r
+       /**\r
+    * Updates a rule property\r
+    * @param {String/Array} selector If it's an array it tries each selector until it finds one. Stops immediately once one is found.\r
+    * @param {String} property The css property\r
+    * @param {String} value The new value for the property\r
+    * @return {Boolean} true If a rule was found and updated\r
+    */\r
+   updateRule : function(selector, property, value){\r
+               if(!Ext.isArray(selector)){\r
+                       var rule = this.getRule(selector);\r
+                       if(rule){\r
+                               rule.style[property.replace(camelRe, camelFn)] = value;\r
+                               return true;\r
+                       }\r
+               }else{\r
+                       for(var i = 0; i < selector.length; i++){\r
+                               if(this.updateRule(selector[i], property, value)){\r
+                                       return true;\r
+                               }\r
+                       }\r
+               }\r
+               return false;\r
+       }\r
+   };  \r
+}();/**
+ @class Ext.util.ClickRepeater
+ @extends Ext.util.Observable
+
+ A wrapper class which can be applied to any element. Fires a "click" event while the
+ mouse is pressed. The interval between firings may be specified in the config but
+ defaults to 20 milliseconds.
+
+ Optionally, a CSS class may be applied to the element during the time it is pressed.
+
+ @cfg {Mixed} el The element to act as a button.
+ @cfg {Number} delay The initial delay before the repeating event begins firing.
+ Similar to an autorepeat key delay.
+ @cfg {Number} interval The interval between firings of the "click" event. Default 20 ms.
+ @cfg {String} pressClass A CSS class name to be applied to the element while pressed.
+ @cfg {Boolean} accelerate True if autorepeating should start slowly and accelerate.
+           "interval" and "delay" are ignored.
+ @cfg {Boolean} preventDefault True to prevent the default click event
+ @cfg {Boolean} stopDefault True to stop the default click event
+
+ @history
+    2007-02-02 jvs Original code contributed by Nige "Animal" White
+    2007-02-02 jvs Renamed to ClickRepeater
+    2007-02-03 jvs Modifications for FF Mac and Safari
+
+ @constructor
+ @param {Mixed} el The element to listen on
+ @param {Object} config
+ */
+Ext.util.ClickRepeater = function(el, config)
+{
+    this.el = Ext.get(el);
+    this.el.unselectable();
+
+    Ext.apply(this, config);
+
+    this.addEvents(
+    /**
+     * @event mousedown
+     * Fires when the mouse button is depressed.
+     * @param {Ext.util.ClickRepeater} this
+     */
+        "mousedown",
+    /**
+     * @event click
+     * Fires on a specified interval during the time the element is pressed.
+     * @param {Ext.util.ClickRepeater} this
+     */
+        "click",
+    /**
+     * @event mouseup
+     * Fires when the mouse key is released.
+     * @param {Ext.util.ClickRepeater} this
+     */
+        "mouseup"
+    );
+
+    if(!this.disabled){
+        this.disabled = true;
+        this.enable();
+    }
+
+    // allow inline handler
+    if(this.handler){
+        this.on("click", this.handler,  this.scope || this);
+    }
+
+    Ext.util.ClickRepeater.superclass.constructor.call(this);
+};
+
+Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, {
+    interval : 20,
+    delay: 250,
+    preventDefault : true,
+    stopDefault : false,
+    timer : 0,
+
+    /**
+     * Enables the repeater and allows events to fire.
+     */
+    enable: function(){
+        if(this.disabled){
+            this.el.on('mousedown', this.handleMouseDown, this);
+            if(this.preventDefault || this.stopDefault){
+                this.el.on('click', this.eventOptions, this);
+            }
+        }
+        this.disabled = false;
+    },
+    
+    /**
+     * Disables the repeater and stops events from firing.
+     */
+    disable: function(/* private */ force){
+        if(force || !this.disabled){
+            clearTimeout(this.timer);
+            if(this.pressClass){
+                this.el.removeClass(this.pressClass);
+            }
+            Ext.getDoc().un('mouseup', this.handleMouseUp, this);
+            this.el.removeAllListeners();
+        }
+        this.disabled = true;
+    },
+    
+    /**
+     * Convenience function for setting disabled/enabled by boolean.
+     * @param {Boolean} disabled
+     */
+    setDisabled: function(disabled){
+        this[disabled ? 'disable' : 'enable']();    
+    },
+    
+    eventOptions: function(e){
+        if(this.preventDefault){
+            e.preventDefault();
+        }
+        if(this.stopDefault){
+            e.stopEvent();
+        }       
+    },
+    
+    // private
+    destroy : function() {
+        this.disable(true);
+        Ext.destroy(this.el);
+        this.purgeListeners();
+    },
+    
+    // private
+    handleMouseDown : function(){
+        clearTimeout(this.timer);
+        this.el.blur();
+        if(this.pressClass){
+            this.el.addClass(this.pressClass);
+        }
+        this.mousedownTime = new Date();
+
+        Ext.getDoc().on("mouseup", this.handleMouseUp, this);
+        this.el.on("mouseout", this.handleMouseOut, this);
+
+        this.fireEvent("mousedown", this);
+        this.fireEvent("click", this);
+
+//      Do not honor delay or interval if acceleration wanted.
+        if (this.accelerate) {
+            this.delay = 400;
+           }
+        this.timer = this.click.defer(this.delay || this.interval, this);
+    },
+
+    // private
+    click : function(){
+        this.fireEvent("click", this);
+        this.timer = this.click.defer(this.accelerate ?
+            this.easeOutExpo(this.mousedownTime.getElapsed(),
+                400,
+                -390,
+                12000) :
+            this.interval, this);
+    },
+
+    easeOutExpo : function (t, b, c, d) {
+        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
+    },
+
+    // private
+    handleMouseOut : function(){
+        clearTimeout(this.timer);
+        if(this.pressClass){
+            this.el.removeClass(this.pressClass);
+        }
+        this.el.on("mouseover", this.handleMouseReturn, this);
+    },
+
+    // private
+    handleMouseReturn : function(){
+        this.el.un("mouseover", this.handleMouseReturn, this);
+        if(this.pressClass){
+            this.el.addClass(this.pressClass);
+        }
+        this.click();
+    },
+
+    // private
+    handleMouseUp : function(){
+        clearTimeout(this.timer);
+        this.el.un("mouseover", this.handleMouseReturn, this);
+        this.el.un("mouseout", this.handleMouseOut, this);
+        Ext.getDoc().un("mouseup", this.handleMouseUp, this);
+        this.el.removeClass(this.pressClass);
+        this.fireEvent("mouseup", this);
+    }
+});/**
+ * @class Ext.KeyNav
+ * <p>Provides a convenient wrapper for normalized keyboard navigation.  KeyNav allows you to bind
+ * navigation keys to function calls that will get called when the keys are pressed, providing an easy
+ * way to implement custom navigation schemes for any UI component.</p>
+ * <p>The following are all of the possible keys that can be implemented: enter, left, right, up, down, tab, esc,
+ * pageUp, pageDown, del, home, end.  Usage:</p>
+ <pre><code>
+var nav = new Ext.KeyNav("my-element", {
+    "left" : function(e){
+        this.moveLeft(e.ctrlKey);
+    },
+    "right" : function(e){
+        this.moveRight(e.ctrlKey);
+    },
+    "enter" : function(e){
+        this.save();
+    },
+    scope : this
+});
+</code></pre>
+ * @constructor
+ * @param {Mixed} el The element to bind to
+ * @param {Object} config The config
+ */
+Ext.KeyNav = function(el, config){
+    this.el = Ext.get(el);
+    Ext.apply(this, config);
+    if(!this.disabled){
+        this.disabled = true;
+        this.enable();
+    }
+};
+
+Ext.KeyNav.prototype = {
+    /**
+     * @cfg {Boolean} disabled
+     * True to disable this KeyNav instance (defaults to false)
+     */
+    disabled : false,
+    /**
+     * @cfg {String} defaultEventAction
+     * The method to call on the {@link Ext.EventObject} after this KeyNav intercepts a key.  Valid values are
+     * {@link Ext.EventObject#stopEvent}, {@link Ext.EventObject#preventDefault} and
+     * {@link Ext.EventObject#stopPropagation} (defaults to 'stopEvent')
+     */
+    defaultEventAction: "stopEvent",
+    /**
+     * @cfg {Boolean} forceKeyDown
+     * Handle the keydown event instead of keypress (defaults to false).  KeyNav automatically does this for IE since
+     * IE does not propagate special keys on keypress, but setting this to true will force other browsers to also
+     * handle keydown instead of keypress.
+     */
+    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();
+        var h = this.keyToHandler[k];
+        if(h && this[h]){
+            if(this.doRelay(e, this[h], h) !== true){
+                e[this.defaultEventAction]();
+            }
+        }
+    },
+
+    // private
+    doRelay : function(e, h, hname){
+        return h.call(this.scope || this, e);
+    },
+
+    // possible handlers
+    enter : false,
+    left : false,
+    right : false,
+    up : false,
+    down : false,
+    tab : false,
+    esc : false,
+    pageUp : false,
+    pageDown : false,
+    del : false,
+    home : false,
+    end : false,
+
+    // quick lookup hash
+    keyToHandler : {
+        37 : "left",
+        39 : "right",
+        38 : "up",
+        40 : "down",
+        33 : "pageUp",
+        34 : "pageDown",
+        46 : "del",
+        36 : "home",
+        35 : "end",
+        13 : "enter",
+        27 : "esc",
+        9  : "tab"
+    },
+
+       /**
+        * 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);
+            }
+                   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);
+            }
+                   this.disabled = true;
+               }
+       },
+    
+    /**
+     * Convenience function for setting disabled/enabled by boolean.
+     * @param {Boolean} disabled
+     */
+    setDisabled : function(disabled){
+        this[disabled ? "disable" : "enable"]();
+    },
+    
+    // private
+    isKeydown: function(){
+        return this.forceKeyDown || Ext.EventManager.useKeydown;
+    }
+};
+/**\r
+ * @class Ext.KeyMap\r
+ * Handles mapping keys to actions for an element. One key map can be used for multiple actions.\r
+ * The constructor accepts the same config object as defined by {@link #addBinding}.\r
+ * If you bind a callback function to a KeyMap, anytime the KeyMap handles an expected key\r
+ * combination it will call the function with this signature (if the match is a multi-key\r
+ * combination the callback will still be called only once): (String key, Ext.EventObject e)\r
+ * A KeyMap can also handle a string representation of keys.<br />\r
+ * Usage:\r
+ <pre><code>\r
+// map one key by key code\r
+var map = new Ext.KeyMap("my-element", {\r
+    key: 13, // or Ext.EventObject.ENTER\r
+    fn: myHandler,\r
+    scope: myObject\r
+});\r
 \r
-// private\r
-El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;\r
+// map multiple keys to one action by string\r
+var map = new Ext.KeyMap("my-element", {\r
+    key: "a\r\n\t",\r
+    fn: myHandler,\r
+    scope: myObject\r
+});\r
 \r
-// private\r
-El.addUnits = function(v, defaultUnit){\r
-    if(v === "" || v == "auto"){\r
-        return v;\r
+// map multiple keys to multiple actions by strings and array of codes\r
+var map = new Ext.KeyMap("my-element", [\r
+    {\r
+        key: [10,13],\r
+        fn: function(){ alert("Return was pressed"); }\r
+    }, {\r
+        key: "abc",\r
+        fn: function(){ alert('a, b or c was pressed'); }\r
+    }, {\r
+        key: "\t",\r
+        ctrl:true,\r
+        shift:true,\r
+        fn: function(){ alert('Control + shift + tab was pressed.'); }\r
     }\r
-    if(v === undefined){\r
-        return '';\r
-    }\r
-    if(typeof v == "number" || !El.unitPattern.test(v)){\r
-        return v + (defaultUnit || 'px');\r
+]);\r
+</code></pre>\r
+ * <b>Note: A KeyMap starts enabled</b>\r
+ * @constructor\r
+ * @param {Mixed} el The element to bind to\r
+ * @param {Object} config The config (see {@link #addBinding})\r
+ * @param {String} eventName (optional) The event to bind to (defaults to "keydown")\r
+ */\r
+Ext.KeyMap = function(el, config, eventName){\r
+    this.el  = Ext.get(el);\r
+    this.eventName = eventName || "keydown";\r
+    this.bindings = [];\r
+    if(config){\r
+        this.addBinding(config);\r
     }\r
-    return v;\r
+    this.enable();\r
 };\r
 \r
-// special markup used throughout Ext when box wrapping elements\r
-El.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
+Ext.KeyMap.prototype = {\r
+    /**\r
+     * True to stop the event from bubbling and prevent the default browser action if the\r
+     * key was handled by the KeyMap (defaults to false)\r
+     * @type Boolean\r
+     */\r
+    stopEvent : false,\r
 \r
-El.VISIBILITY = 1;\r
+    /**\r
+     * Add a new binding to this KeyMap. The following config object properties are supported:\r
+     * <pre>\r
+Property    Type             Description\r
+----------  ---------------  ----------------------------------------------------------------------\r
+key         String/Array     A single keycode or an array of keycodes to handle\r
+shift       Boolean          True to handle key only when shift is pressed, False to handle the key only when shift is not pressed (defaults to undefined)\r
+ctrl        Boolean          True to handle key only when ctrl is pressed, False to handle the key only when ctrl is not pressed (defaults to undefined)\r
+alt         Boolean          True to handle key only when alt is pressed, False to handle the key only when alt is not pressed (defaults to undefined)\r
+handler     Function         The function to call when KeyMap finds the expected key combination\r
+fn          Function         Alias of handler (for backwards-compatibility)\r
+scope       Object           The scope of the callback function\r
+stopEvent   Boolean          True to stop the event from bubbling and prevent the default browser action if the key was handled by the KeyMap (defaults to false)\r
+</pre>\r
+     *\r
+     * Usage:\r
+     * <pre><code>\r
+// Create a KeyMap\r
+var map = new Ext.KeyMap(document, {\r
+    key: Ext.EventObject.ENTER,\r
+    fn: handleKey,\r
+    scope: this\r
+});\r
 \r
-El.DISPLAY = 2;\r
+//Add a new binding to the existing KeyMap later\r
+map.addBinding({\r
+    key: 'abc',\r
+    shift: true,\r
+    fn: handleKey,\r
+    scope: this\r
+});\r
+</code></pre>\r
+     * @param {Object/Array} config A single KeyMap config or an array of configs\r
+     */\r
+       addBinding : function(config){\r
+        if(Ext.isArray(config)){\r
+            Ext.each(config, function(c){\r
+                this.addBinding(c);\r
+            }, this);\r
+            return;\r
+        }\r
+        var keyCode = config.key,\r
+            fn = config.fn || config.handler,\r
+            scope = config.scope;\r
 \r
-El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};\r
-El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};\r
-El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};\r
+       if (config.stopEvent) {\r
+           this.stopEvent = config.stopEvent;    \r
+       }       \r
 \r
+        if(typeof keyCode == "string"){\r
+            var ks = [];\r
+            var keyString = keyCode.toUpperCase();\r
+            for(var j = 0, len = keyString.length; j < len; j++){\r
+                ks.push(keyString.charCodeAt(j));\r
+            }\r
+            keyCode = ks;\r
+        }\r
+        var keyArray = Ext.isArray(keyCode);\r
+        \r
+        var handler = function(e){\r
+            if(this.checkModifiers(config, e)){\r
+                var k = e.getKey();\r
+                if(keyArray){\r
+                    for(var i = 0, len = keyCode.length; i < len; i++){\r
+                        if(keyCode[i] == k){\r
+                          if(this.stopEvent){\r
+                              e.stopEvent();\r
+                          }\r
+                          fn.call(scope || window, k, e);\r
+                          return;\r
+                        }\r
+                    }\r
+                }else{\r
+                    if(k == keyCode){\r
+                        if(this.stopEvent){\r
+                           e.stopEvent();\r
+                        }\r
+                        fn.call(scope || window, k, e);\r
+                    }\r
+                }\r
+            }\r
+        };\r
+        this.bindings.push(handler);\r
+       },\r
+    \r
+    // private\r
+    checkModifiers: function(config, e){\r
+        var val, key, keys = ['shift', 'ctrl', 'alt'];\r
+        for (var i = 0, len = keys.length; i < len; ++i){\r
+            key = keys[i];\r
+            val = config[key];\r
+            if(!(val === undefined || (val === e[key + 'Key']))){\r
+                return false;\r
+            }\r
+        }\r
+        return true;\r
+    },\r
 \r
+    /**\r
+     * Shorthand for adding a single key listener\r
+     * @param {Number/Array/Object} key Either the numeric key code, array of key codes or an object with the\r
+     * 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
+     */\r
+    on : function(key, fn, scope){\r
+        var keyCode, shift, ctrl, alt;\r
+        if(typeof key == "object" && !Ext.isArray(key)){\r
+            keyCode = key.key;\r
+            shift = key.shift;\r
+            ctrl = key.ctrl;\r
+            alt = key.alt;\r
+        }else{\r
+            keyCode = key;\r
+        }\r
+        this.addBinding({\r
+            key: keyCode,\r
+            shift: shift,\r
+            ctrl: ctrl,\r
+            alt: alt,\r
+            fn: fn,\r
+            scope: scope\r
+        });\r
+    },\r
 \r
+    // private\r
+    handleKeyDown : function(e){\r
+           if(this.enabled){ //just in case\r
+           var b = this.bindings;\r
+           for(var i = 0, len = b.length; i < len; i++){\r
+               b[i].call(this, e);\r
+           }\r
+           }\r
+       },\r
 \r
-El.cache = {};\r
+       /**\r
+        * Returns true if this KeyMap is enabled\r
+        * @return {Boolean}\r
+        */\r
+       isEnabled : function(){\r
+           return this.enabled;\r
+       },\r
 \r
-var docEl;\r
+       /**\r
+        * Enables this KeyMap\r
+        */\r
+       enable: function(){\r
+               if(!this.enabled){\r
+                   this.el.on(this.eventName, this.handleKeyDown, this);\r
+                   this.enabled = true;\r
+               }\r
+       },\r
 \r
+       /**\r
+        * Disable this KeyMap\r
+        */\r
+       disable: function(){\r
+               if(this.enabled){\r
+                   this.el.removeListener(this.eventName, this.handleKeyDown, this);\r
+                   this.enabled = false;\r
+               }\r
+       },\r
+    \r
+    /**\r
+     * Convenience function for setting disabled/enabled by boolean.\r
+     * @param {Boolean} disabled\r
+     */\r
+    setDisabled : function(disabled){\r
+        this[disabled ? "disable" : "enable"]();\r
+    }\r
+};/**
+ * @class Ext.util.TextMetrics
+ * Provides precise pixel measurements for blocks of text so that you can determine exactly how high and
+ * wide, in pixels, a given block of text will be. Note that when measuring text, it should be plain text and
+ * should not contain any HTML, otherwise it may not be measured correctly.
+ * @singleton
+ */
+Ext.util.TextMetrics = function(){
+    var shared;
+    return {
+        /**
+         * Measures the size of the specified text
+         * @param {String/HTMLElement} el The element, dom node or id from which to copy existing CSS styles
+         * that can affect the size of the rendered text
+         * @param {String} text The text to measure
+         * @param {Number} fixedWidth (optional) If the text will be multiline, you have to set a fixed width
+         * in order to accurately measure the text height
+         * @return {Object} An object containing the text's size {width: (width), height: (height)}
+         */
+        measure : function(el, text, fixedWidth){
+            if(!shared){
+                shared = Ext.util.TextMetrics.Instance(el, fixedWidth);
+            }
+            shared.bind(el);
+            shared.setFixedWidth(fixedWidth || 'auto');
+            return shared.getSize(text);
+        },
+
+        /**
+         * Return a unique TextMetrics instance that can be bound directly to an element and reused.  This reduces
+         * the overhead of multiple calls to initialize the style properties on each measurement.
+         * @param {String/HTMLElement} el The element, dom node or id that the instance will be bound to
+         * @param {Number} fixedWidth (optional) If the text will be multiline, you have to set a fixed width
+         * in order to accurately measure the text height
+         * @return {Ext.util.TextMetrics.Instance} instance The new instance
+         */
+        createInstance : function(el, fixedWidth){
+            return Ext.util.TextMetrics.Instance(el, fixedWidth);
+        }
+    };
+}();
+
+Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){
+    var ml = new Ext.Element(document.createElement('div'));
+    document.body.appendChild(ml.dom);
+    ml.position('absolute');
+    ml.setLeftTop(-1000, -1000);
+    ml.hide();
+
+    if(fixedWidth){
+        ml.setWidth(fixedWidth);
+    }
+
+    var instance = {
+        /**
+         * 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)}
+         */
+        getSize : function(text){
+            ml.update(text);
+            var s = ml.getSize();
+            ml.update('');
+            return s;
+        },
+
+        /**
+         * 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
+         */
+        bind : function(el){
+            ml.setStyle(
+                Ext.fly(el).getStyles('font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing')
+            );
+        },
+
+        /**
+         * 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
+         */
+        setFixedWidth : function(width){
+            ml.setWidth(width);
+        },
+
+        /**
+         * Returns the measured width of the specified text
+         * @param {String} text The text to measure
+         * @return {Number} width The width in pixels
+         */
+        getWidth : function(text){
+            ml.dom.style.width = 'auto';
+            return this.getSize(text).width;
+        },
+
+        /**
+         * 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
+         * @return {Number} height The height in pixels
+         */
+        getHeight : function(text){
+            return this.getSize(text).height;
+        }
+    };
+
+    instance.bind(bindTo);
+
+    return instance;
+};
+
+Ext.Element.addMethods({
+    /**
+     * Returns the width in pixels of the passed text, or the width of the text in this Element.
+     * @param {String} text The text to measure. Defaults to the innerHTML of the element.
+     * @param {Number} min (Optional) The minumum value to return.
+     * @param {Number} max (Optional) The maximum value to return.
+     * @return {Number} The text width in pixels.
+     * @member Ext.Element getTextWidth
+     */
+    getTextWidth : function(text, min, max){
+        return (Ext.util.TextMetrics.measure(this.dom, Ext.value(text, this.dom.innerHTML, true)).width).constrain(min || 0, max || 1000000);
+    }
+});
+/**\r
+ * @class Ext.util.Cookies\r
+ * Utility class for managing and interacting with cookies.\r
+ * @singleton\r
+ */\r
+Ext.util.Cookies = {\r
+    /**\r
+     * 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 {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
+     * @param {String} path (Optional) Setting a path on the cookie restricts\r
+     * access to pages that match that path. Defaults to all pages (<tt>'/'</tt>). \r
+     * @param {String} domain (Optional) Setting a domain restricts access to\r
+     * pages on a given domain (typically used to allow cookie access across\r
+     * subdomains). For example, "extjs.com" will create a cookie that can be\r
+     * accessed from any subdomain of extjs.com, including www.extjs.com,\r
+     * support.extjs.com, etc.\r
+     * @param {Boolean} secure (Optional) Specify true to indicate that the cookie\r
+     * should only be accessible via SSL on a page using the HTTPS protocol.\r
+     * Defaults to <tt>false</tt>. Note that this will only work if the page\r
+     * calling this code uses the HTTPS protocol, otherwise the cookie will be\r
+     * created with default options.\r
+     */\r
+    set : function(name, value){\r
+        var argv = arguments;\r
+        var argc = arguments.length;\r
+        var expires = (argc > 2) ? argv[2] : null;\r
+        var path = (argc > 3) ? argv[3] : '/';\r
+        var domain = (argc > 4) ? argv[4] : null;\r
+        var secure = (argc > 5) ? argv[5] : false;\r
+        document.cookie = name + "=" + escape(value) + ((expires === null) ? "" : ("; expires=" + expires.toGMTString())) + ((path === null) ? "" : ("; path=" + path)) + ((domain === null) ? "" : ("; domain=" + domain)) + ((secure === true) ? "; secure" : "");\r
+    },\r
+\r
+    /**\r
+     * Retrieves cookies that are accessible by the current page. If a cookie\r
+     * does not exist, <code>get()</code> returns <tt>null</tt>.  The following\r
+     * example retrieves the cookie called "valid" and stores the String value\r
+     * in the variable <tt>validStatus</tt>.\r
+     * <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
+     * @return {Mixed} Returns the cookie value for the specified name;\r
+     * null if the cookie name does not exist.\r
+     */\r
+    get : function(name){\r
+        var arg = name + "=";\r
+        var alen = arg.length;\r
+        var clen = document.cookie.length;\r
+        var i = 0;\r
+        var j = 0;\r
+        while(i < clen){\r
+            j = i + alen;\r
+            if(document.cookie.substring(i, j) == arg){\r
+                return Ext.util.Cookies.getCookieVal(j);\r
+            }\r
+            i = document.cookie.indexOf(" ", i) + 1;\r
+            if(i === 0){\r
+                break;\r
+            }\r
+        }\r
+        return null;\r
+    },\r
 \r
-El.get = function(el){\r
-    var ex, elm, id;\r
-    if(!el){ return null; }\r
-    if(typeof el == "string"){ // element id\r
-        if(!(elm = document.getElementById(el))){\r
-            return null;\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
+     */\r
+    clear : function(name){\r
+        if(Ext.util.Cookies.get(name)){\r
+            document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";\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 = document.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 == document){\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 = document;\r
-        }\r
-        return docEl;\r
-    }\r
-    return null;\r
-};\r
-\r
-// private\r
-El.uncache = function(el){\r
-    for(var i = 0, a = arguments, len = a.length; i < len; i++) {\r
-        if(a[i]){\r
-            delete El.cache[a[i].id || a[i]];\r
+    },\r
+    /**\r
+     * @private\r
+     */\r
+    getCookieVal : function(offset){\r
+        var endstr = document.cookie.indexOf(";", offset);\r
+        if(endstr == -1){\r
+            endstr = document.cookie.length;\r
         }\r
+        return unescape(document.cookie.substring(offset, endstr));\r
     }\r
-};\r
+};/**
+ * Framework-wide error-handler.  Developers can override this method to provide
+ * custom exception-handling.  Framework errors will often extend from the base
+ * Ext.Error class.
+ * @param {Object/Error} e The thrown exception object.
+ */
+Ext.handleError = function(e) {
+    throw e;
+};
+
+/**
+ * @class Ext.Error
+ * @extends Error
+ * <p>A base error class. Future implementations are intended to provide more
+ * robust error handling throughout the framework (<b>in the debug build only</b>)
+ * to check for common errors and problems. The messages issued by this class
+ * will aid error checking. Error checks will be automatically removed in the
+ * production build so that performance is not negatively impacted.</p>
+ * <p>Some sample messages currently implemented:</p><pre>
+"DataProxy attempted to execute an API-action but found an undefined
+url / function. Please review your Proxy url/api-configuration."
+ * </pre><pre>
+"Could not locate your "root" property in your server response.
+Please review your JsonReader config to ensure the config-property
+"root" matches the property your server-response.  See the JsonReader
+docs for additional assistance."
+ * </pre>
+ * <p>An example of the code used for generating error messages:</p><pre><code>
+try {
+    generateError({
+        foo: 'bar'
+    });
+}
+catch (e) {
+    console.error(e);
+}
+function generateError(data) {
+    throw new Ext.Error('foo-error', data);
+}
+ * </code></pre>
+ * @param {String} message
+ */
+Ext.Error = function(message) {
+    // Try to read the message from Ext.Error.lang
+    this.message = (this.lang[message]) ? this.lang[message] : message;
+}
+Ext.Error.prototype = new Error();
+Ext.apply(Ext.Error.prototype, {
+    // protected.  Extensions place their error-strings here.
+    lang: {},
+
+    name: 'Ext.Error',
+    /**
+     * getName
+     * @return {String}
+     */
+    getName : function() {
+        return this.name;
+    },
+    /**
+     * getMessage
+     * @return {String}
+     */
+    getMessage : function() {
+        return this.message;
+    },
+    /**
+     * toJson
+     * @return {String}
+     */
+    toJson : function() {
+        return Ext.encode(this);
+    }
+});
+
+/**
+ * @class Ext.ComponentMgr
+ * <p>Provides a registry of all Components (instances of {@link Ext.Component} or any subclass
+ * thereof) on a page so that they can be easily accessed by {@link Ext.Component component}
+ * {@link Ext.Component#id id} (see {@link #get}, or the convenience method {@link Ext#getCmp Ext.getCmp}).</p>
+ * <p>This object also provides a registry of available Component <i>classes</i>
+ * indexed by a mnemonic code known as the Component's {@link Ext.Component#xtype xtype}.
+ * The <tt>{@link Ext.Component#xtype xtype}</tt> provides a way to avoid instantiating child Components
+ * when creating a full, nested config object for a complete Ext page.</p>
+ * <p>A child Component may be specified simply as a <i>config object</i>
+ * as long as the correct <tt>{@link Ext.Component#xtype xtype}</tt> is specified so that if and when the Component
+ * needs rendering, the correct type can be looked up for lazy instantiation.</p>
+ * <p>For a list of all available <tt>{@link Ext.Component#xtype xtypes}</tt>, see {@link Ext.Component}.</p>
+ * @singleton
+ */
+Ext.ComponentMgr = function(){
+    var all = new Ext.util.MixedCollection();
+    var types = {};
+    var ptypes = {};
+
+    return {
+        /**
+         * Registers a component.
+         * @param {Ext.Component} c The component
+         */
+        register : function(c){
+            all.add(c);
+        },
+
+        /**
+         * Unregisters a component.
+         * @param {Ext.Component} c The component
+         */
+        unregister : function(c){
+            all.remove(c);
+        },
+
+        /**
+         * Returns a component by {@link Ext.Component#id id}.
+         * For additional details see {@link Ext.util.MixedCollection#get}.
+         * @param {String} id The component {@link Ext.Component#id id}
+         * @return Ext.Component The Component, <tt>undefined</tt> if not found, or <tt>null</tt> if a
+         * Class was found.
+         */
+        get : function(id){
+            return all.get(id);
+        },
+
+        /**
+         * Registers a function that will be called when a specified component is added to ComponentMgr
+         * @param {String} id The component {@link Ext.Component#id id}
+         * @param {Function} fn The callback function
+         * @param {Object} scope The scope of the callback
+         */
+        onAvailable : function(id, fn, scope){
+            all.on("add", function(index, o){
+                if(o.id == id){
+                    fn.call(scope || o, o);
+                    all.un("add", fn, scope);
+                }
+            });
+        },
+
+        /**
+         * The MixedCollection used internally for the component cache. An example usage may be subscribing to
+         * events on the MixedCollection to monitor addition or removal.  Read-only.
+         * @type {MixedCollection}
+         */
+        all : all,
+        
+        /**
+         * Checks if a Component type is registered.
+         * @param {Ext.Component} xtype The mnemonic string by which the Component class may be looked up
+         * @return {Boolean} Whether the type is registered.
+         */
+        isRegistered : function(xtype){
+            return types[xtype] !== undefined;    
+        },
+
+        /**
+         * <p>Registers a new Component constructor, keyed by a new
+         * {@link Ext.Component#xtype}.</p>
+         * <p>Use this method (or its alias {@link Ext#reg Ext.reg}) to register new
+         * subclasses of {@link Ext.Component} so that lazy instantiation may be used when specifying
+         * child Components.
+         * see {@link Ext.Container#items}</p>
+         * @param {String} xtype The mnemonic string by which the Component class may be looked up.
+         * @param {Constructor} cls The new Component class.
+         */
+        registerType : function(xtype, cls){
+            types[xtype] = cls;
+            cls.xtype = xtype;
+        },
+
+        /**
+         * Creates a new Component from the specified config object using the
+         * config object's {@link Ext.component#xtype xtype} to determine the class to instantiate.
+         * @param {Object} config A configuration object for the Component you wish to create.
+         * @param {Constructor} defaultType The constructor to provide the default Component type if
+         * the config object does not contain a <tt>xtype</tt>. (Optional if the config contains a <tt>xtype</tt>).
+         * @return {Ext.Component} The newly instantiated Component.
+         */
+        create : function(config, defaultType){
+            return config.render ? config : new types[config.xtype || defaultType](config);
+        },
+
+        /**
+         * <p>Registers a new Plugin constructor, keyed by a new
+         * {@link Ext.Component#ptype}.</p>
+         * <p>Use this method (or its alias {@link Ext#preg Ext.preg}) to register new
+         * plugins for {@link Ext.Component}s so that lazy instantiation may be used when specifying
+         * Plugins.</p>
+         * @param {String} ptype The mnemonic string by which the Plugin class may be looked up.
+         * @param {Constructor} cls The new Plugin class.
+         */
+        registerPlugin : function(ptype, cls){
+            ptypes[ptype] = cls;
+            cls.ptype = ptype;
+        },
+
+        /**
+         * Creates a new Plugin from the specified config object using the
+         * config object's {@link Ext.component#ptype ptype} to determine the class to instantiate.
+         * @param {Object} config A configuration object for the Plugin you wish to create.
+         * @param {Constructor} defaultType The constructor to provide the default Plugin type if
+         * the config object does not contain a <tt>ptype</tt>. (Optional if the config contains a <tt>ptype</tt>).
+         * @return {Ext.Component} The newly instantiated Plugin.
+         */
+        createPlugin : function(config, defaultType){
+            return new ptypes[config.ptype || defaultType](config);
+        }
+    };
+}();
+
+/**
+ * Shorthand for {@link Ext.ComponentMgr#registerType}
+ * @param {String} xtype The {@link Ext.component#xtype mnemonic string} by which the Component class
+ * may be looked up.
+ * @param {Constructor} cls The new Component class.
+ * @member Ext
+ * @method reg
+ */
+Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally, shorthand to keep the bytes down
+/**
+ * Shorthand for {@link Ext.ComponentMgr#registerPlugin}
+ * @param {String} ptype The {@link Ext.component#ptype mnemonic string} by which the Plugin class
+ * may be looked up.
+ * @param {Constructor} cls The new Plugin class.
+ * @member Ext
+ * @method preg
+ */
+Ext.preg = Ext.ComponentMgr.registerPlugin;
+Ext.create = Ext.ComponentMgr.create;
+/**
+ * @class Ext.Component
+ * @extends Ext.util.Observable
+ * <p>Base class for all Ext components.  All subclasses of Component may participate in the automated
+ * Ext component lifecycle of creation, rendering and destruction which is provided by the {@link Ext.Container Container} class.
+ * Components may be added to a Container through the {@link Ext.Container#items items} config option at the time the Container is created,
+ * or they may be added dynamically via the {@link Ext.Container#add add} method.</p>
+ * <p>The Component base class has built-in support for basic hide/show and enable/disable behavior.</p>
+ * <p>All Components are registered with the {@link Ext.ComponentMgr} on construction so that they can be referenced at any time via
+ * {@link Ext#getCmp}, passing the {@link #id}.</p>
+ * <p>All user-developed visual widgets that are required to participate in automated lifecycle and size management should subclass Component (or
+ * {@link Ext.BoxComponent} if managed box model handling is required, ie height and width management).</p>
+ * <p>See the <a href="http://extjs.com/learn/Tutorial:Creating_new_UI_controls">Creating new UI controls</a> tutorial for details on how
+ * and to either extend or augment ExtJs base classes to create custom Components.</p>
+ * <p>Every component has a specific xtype, which is its Ext-specific type name, along with methods for checking the
+ * xtype like {@link #getXType} and {@link #isXType}. This is the list of all valid xtypes:</p>
+ * <pre>
+xtype            Class
+-------------    ------------------
+box              {@link Ext.BoxComponent}
+button           {@link Ext.Button}
+buttongroup      {@link Ext.ButtonGroup}
+colorpalette     {@link Ext.ColorPalette}
+component        {@link Ext.Component}
+container        {@link Ext.Container}
+cycle            {@link Ext.CycleButton}
+dataview         {@link Ext.DataView}
+datepicker       {@link Ext.DatePicker}
+editor           {@link Ext.Editor}
+editorgrid       {@link Ext.grid.EditorGridPanel}
+flash            {@link Ext.FlashComponent}
+grid             {@link Ext.grid.GridPanel}
+listview         {@link Ext.ListView}
+panel            {@link Ext.Panel}
+progress         {@link Ext.ProgressBar}
+propertygrid     {@link Ext.grid.PropertyGrid}
+slider           {@link Ext.Slider}
+spacer           {@link Ext.Spacer}
+splitbutton      {@link Ext.SplitButton}
+tabpanel         {@link Ext.TabPanel}
+treepanel        {@link Ext.tree.TreePanel}
+viewport         {@link Ext.ViewPort}
+window           {@link Ext.Window}
+
+Toolbar components
+---------------------------------------
+paging           {@link Ext.PagingToolbar}
+toolbar          {@link Ext.Toolbar}
+tbbutton         {@link Ext.Toolbar.Button}        (deprecated; use button)
+tbfill           {@link Ext.Toolbar.Fill}
+tbitem           {@link Ext.Toolbar.Item}
+tbseparator      {@link Ext.Toolbar.Separator}
+tbspacer         {@link Ext.Toolbar.Spacer}
+tbsplit          {@link Ext.Toolbar.SplitButton}   (deprecated; use splitbutton)
+tbtext           {@link Ext.Toolbar.TextItem}
+
+Menu components
+---------------------------------------
+menu             {@link Ext.menu.Menu}
+colormenu        {@link Ext.menu.ColorMenu}
+datemenu         {@link Ext.menu.DateMenu}
+menubaseitem     {@link Ext.menu.BaseItem}
+menucheckitem    {@link Ext.menu.CheckItem}
+menuitem         {@link Ext.menu.Item}
+menuseparator    {@link Ext.menu.Separator}
+menutextitem     {@link Ext.menu.TextItem}
+
+Form components
+---------------------------------------
+form             {@link Ext.FormPanel}
+checkbox         {@link Ext.form.Checkbox}
+checkboxgroup    {@link Ext.form.CheckboxGroup}
+combo            {@link Ext.form.ComboBox}
+datefield        {@link Ext.form.DateField}
+displayfield     {@link Ext.form.DisplayField}
+field            {@link Ext.form.Field}
+fieldset         {@link Ext.form.FieldSet}
+hidden           {@link Ext.form.Hidden}
+htmleditor       {@link Ext.form.HtmlEditor}
+label            {@link Ext.form.Label}
+numberfield      {@link Ext.form.NumberField}
+radio            {@link Ext.form.Radio}
+radiogroup       {@link Ext.form.RadioGroup}
+textarea         {@link Ext.form.TextArea}
+textfield        {@link Ext.form.TextField}
+timefield        {@link Ext.form.TimeField}
+trigger          {@link Ext.form.TriggerField}
+
+Chart components
+---------------------------------------
+chart            {@link Ext.chart.Chart}
+barchart         {@link Ext.chart.BarChart}
+cartesianchart   {@link Ext.chart.CartesianChart}
+columnchart      {@link Ext.chart.ColumnChart}
+linechart        {@link Ext.chart.LineChart}
+piechart         {@link Ext.chart.PieChart}
+
+Store xtypes
+---------------------------------------
+arraystore       {@link Ext.data.ArrayStore}
+directstore      {@link Ext.data.DirectStore}
+groupingstore    {@link Ext.data.GroupingStore}
+jsonstore        {@link Ext.data.JsonStore}
+simplestore      {@link Ext.data.SimpleStore}      (deprecated; use arraystore)
+store            {@link Ext.data.Store}
+xmlstore         {@link Ext.data.XmlStore}
+</pre>
+ * @constructor
+ * @param {Ext.Element/String/Object} config The configuration options may be specified as either:
+ * <div class="mdetail-params"><ul>
+ * <li><b>an element</b> :
+ * <p class="sub-desc">it is set as the internal element and its id used as the component id</p></li>
+ * <li><b>a string</b> :
+ * <p class="sub-desc">it is assumed to be the id of an existing element and is used as the component id</p></li>
+ * <li><b>anything else</b> :
+ * <p class="sub-desc">it is assumed to be a standard config object and is applied to the component</p></li>
+ * </ul></div>
+ */
+Ext.Component = function(config){
+    config = config || {};
+    if(config.initialConfig){
+        if(config.isAction){           // actions
+            this.baseAction = config;
+        }
+        config = config.initialConfig; // component cloning / action set up
+    }else if(config.tagName || config.dom || Ext.isString(config)){ // element object
+        config = {applyTo: config, id: config.id || config};
+    }
+
+    /**
+     * This Component's initial configuration specification. Read-only.
+     * @type Object
+     * @property initialConfig
+     */
+    this.initialConfig = config;
+
+    Ext.apply(this, config);
+    this.addEvents(
+        /**
+         * @event disable
+         * Fires after the component is disabled.
+         * @param {Ext.Component} this
+         */
+        'disable',
+        /**
+         * @event enable
+         * Fires after the component is enabled.
+         * @param {Ext.Component} this
+         */
+        'enable',
+        /**
+         * @event beforeshow
+         * Fires before the component is shown by calling the {@link #show} method.
+         * Return false from an event handler to stop the show.
+         * @param {Ext.Component} this
+         */
+        'beforeshow',
+        /**
+         * @event show
+         * Fires after the component is shown when calling the {@link #show} method.
+         * @param {Ext.Component} this
+         */
+        'show',
+        /**
+         * @event beforehide
+         * Fires before the component is hidden by calling the {@link #hide} method.
+         * Return false from an event handler to stop the hide.
+         * @param {Ext.Component} this
+         */
+        'beforehide',
+        /**
+         * @event hide
+         * Fires after the component is hidden.
+         * Fires after the component is hidden when calling the {@link #hide} method.
+         * @param {Ext.Component} this
+         */
+        'hide',
+        /**
+         * @event beforerender
+         * Fires before the component is {@link #rendered}. Return false from an
+         * event handler to stop the {@link #render}.
+         * @param {Ext.Component} this
+         */
+        'beforerender',
+        /**
+         * @event render
+         * Fires after the component markup is {@link #rendered}.
+         * @param {Ext.Component} this
+         */
+        'render',
+        /**
+         * @event afterrender
+         * <p>Fires after the component rendering is finished.</p>
+         * <p>The afterrender event is fired after this Component has been {@link #rendered}, been postprocesed
+         * by any afterRender method defined for the Component, and, if {@link #stateful}, after state
+         * has been restored.</p>
+         * @param {Ext.Component} this
+         */
+        'afterrender',
+        /**
+         * @event beforedestroy
+         * Fires before the component is {@link #destroy}ed. Return false from an event handler to stop the {@link #destroy}.
+         * @param {Ext.Component} this
+         */
+        'beforedestroy',
+        /**
+         * @event destroy
+         * Fires after the component is {@link #destroy}ed.
+         * @param {Ext.Component} this
+         */
+        'destroy',
+        /**
+         * @event beforestaterestore
+         * Fires before the state of the component is restored. Return false from an event handler to stop the restore.
+         * @param {Ext.Component} this
+         * @param {Object} state The hash of state values returned from the StateProvider. If this
+         * event is not vetoed, then the state object is passed to <b><tt>applyState</tt></b>. By default,
+         * that simply copies property values into this Component. The method maybe overriden to
+         * provide custom state restoration.
+         */
+        'beforestaterestore',
+        /**
+         * @event staterestore
+         * Fires after the state of the component is restored.
+         * @param {Ext.Component} this
+         * @param {Object} state The hash of state values returned from the StateProvider. This is passed
+         * to <b><tt>applyState</tt></b>. By default, that simply copies property values into this
+         * Component. The method maybe overriden to provide custom state restoration.
+         */
+        'staterestore',
+        /**
+         * @event beforestatesave
+         * Fires before the state of the component is saved to the configured state provider. Return false to stop the save.
+         * @param {Ext.Component} this
+         * @param {Object} state The hash of state values. This is determined by calling
+         * <b><tt>getState()</tt></b> on the Component. This method must be provided by the
+         * developer to return whetever representation of state is required, by default, Ext.Component
+         * has a null implementation.
+         */
+        'beforestatesave',
+        /**
+         * @event statesave
+         * Fires after the state of the component is saved to the configured state provider.
+         * @param {Ext.Component} this
+         * @param {Object} state The hash of state values. This is determined by calling
+         * <b><tt>getState()</tt></b> on the Component. This method must be provided by the
+         * developer to return whetever representation of state is required, by default, Ext.Component
+         * has a null implementation.
+         */
+        'statesave'
+    );
+    this.getId();
+    Ext.ComponentMgr.register(this);
+    Ext.Component.superclass.constructor.call(this);
+
+    if(this.baseAction){
+        this.baseAction.addComponent(this);
+    }
+
+    this.initComponent();
+
+    if(this.plugins){
+        if(Ext.isArray(this.plugins)){
+            for(var i = 0, len = this.plugins.length; i < len; i++){
+                this.plugins[i] = this.initPlugin(this.plugins[i]);
+            }
+        }else{
+            this.plugins = this.initPlugin(this.plugins);
+        }
+    }
+
+    if(this.stateful !== false){
+        this.initState(config);
+    }
+
+    if(this.applyTo){
+        this.applyToMarkup(this.applyTo);
+        delete this.applyTo;
+    }else if(this.renderTo){
+        this.render(this.renderTo);
+        delete this.renderTo;
+    }
+};
+
+// private
+Ext.Component.AUTO_ID = 1000;
+
+Ext.extend(Ext.Component, Ext.util.Observable, {
+       // Configs below are used for all Components when rendered by FormLayout.
+    /**
+     * @cfg {String} fieldLabel <p>The label text to display next to this Component (defaults to '').</p>
+     * <br><p><b>Note</b>: this config is only used when this Component is rendered by a Container which
+     * has been configured to use the <b>{@link Ext.layout.FormLayout FormLayout}</b> layout manager (e.g.
+     * {@link Ext.form.FormPanel} or specifying <tt>layout:'form'</tt>).</p><br>
+     * <p>Also see <tt>{@link #hideLabel}</tt> and
+     * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}.</p>
+     * Example use:<pre><code>
+new Ext.FormPanel({
+    height: 100,
+    renderTo: Ext.getBody(),
+    items: [{
+        xtype: 'textfield',
+        fieldLabel: 'Name'
+    }]
+});
+</code></pre>
+     */
+    /**
+     * @cfg {String} labelStyle <p>A CSS style specification string to apply directly to this field's
+     * label.  Defaults to the container's labelStyle value if set (e.g.,
+     * <tt>{@link Ext.layout.FormLayout#labelStyle}</tt> , or '').</p>
+     * <br><p><b>Note</b>: see the note for <code>{@link #clearCls}</code>.</p><br>
+     * <p>Also see <code>{@link #hideLabel}</code> and
+     * <code>{@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}.</code></p>
+     * Example use:<pre><code>
+new Ext.FormPanel({
+    height: 100,
+    renderTo: Ext.getBody(),
+    items: [{
+        xtype: 'textfield',
+        fieldLabel: 'Name',
+        labelStyle: 'font-weight:bold;'
+    }]
+});
+</code></pre>
+     */
+    /**
+     * @cfg {String} labelSeparator <p>The separator to display after the text of each
+     * <tt>{@link #fieldLabel}</tt>.  This property may be configured at various levels.
+     * The order of precedence is:
+     * <div class="mdetail-params"><ul>
+     * <li>field / component level</li>
+     * <li>container level</li>
+     * <li>{@link Ext.layout.FormLayout#labelSeparator layout level} (defaults to colon <tt>':'</tt>)</li>
+     * </ul></div>
+     * To display no separator for this field's label specify empty string ''.</p>
+     * <br><p><b>Note</b>: see the note for <tt>{@link #clearCls}</tt>.</p><br>
+     * <p>Also see <tt>{@link #hideLabel}</tt> and
+     * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}.</p>
+     * Example use:<pre><code>
+new Ext.FormPanel({
+    height: 100,
+    renderTo: Ext.getBody(),
+    layoutConfig: {
+        labelSeparator: '~'   // layout config has lowest priority (defaults to ':')
+    },
+    {@link Ext.layout.FormLayout#labelSeparator labelSeparator}: '>>',     // config at container level
+    items: [{
+        xtype: 'textfield',
+        fieldLabel: 'Field 1',
+        labelSeparator: '...' // field/component level config supersedes others
+    },{
+        xtype: 'textfield',
+        fieldLabel: 'Field 2' // labelSeparator will be '='
+    }]
+});
+</code></pre>
+     */
+    /**
+     * @cfg {Boolean} hideLabel <p><tt>true</tt> to completely hide the label element
+     * ({@link #fieldLabel label} and {@link #labelSeparator separator}). Defaults to <tt>false</tt>.
+     * By default, even if you do not specify a <tt>{@link #fieldLabel}</tt> the space will still be
+     * reserved so that the field will line up with other fields that do have labels.
+     * Setting this to <tt>true</tt> will cause the field to not reserve that space.</p>
+     * <br><p><b>Note</b>: see the note for <tt>{@link #clearCls}</tt>.</p><br>
+     * Example use:<pre><code>
+new Ext.FormPanel({
+    height: 100,
+    renderTo: Ext.getBody(),
+    items: [{
+        xtype: 'textfield'
+        hideLabel: true
+    }]
+});
+</code></pre>
+     */
+    /**
+     * @cfg {String} clearCls <p>The CSS class used to to apply to the special clearing div rendered
+     * directly after each form field wrapper to provide field clearing (defaults to
+     * <tt>'x-form-clear-left'</tt>).</p>
+     * <br><p><b>Note</b>: this config is only used when this Component is rendered by a Container
+     * which has been configured to use the <b>{@link Ext.layout.FormLayout FormLayout}</b> layout
+     * manager (e.g. {@link Ext.form.FormPanel} or specifying <tt>layout:'form'</tt>) and either a
+     * <tt>{@link #fieldLabel}</tt> is specified or <tt>isFormField=true</tt> is specified.</p><br>
+     * <p>See {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl} also.</p>
+     */
+    /**
+     * @cfg {String} itemCls <p>An additional CSS class to apply to the div wrapping the form item
+     * element of this field.  If supplied, <tt>itemCls</tt> at the <b>field</b> level will override
+     * the default <tt>itemCls</tt> supplied at the <b>container</b> level. The value specified for
+     * <tt>itemCls</tt> will be added to the default class (<tt>'x-form-item'</tt>).</p>
+     * <p>Since it is applied to the item wrapper (see
+     * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl}), it allows
+     * you to write standard CSS rules that can apply to the field, the label (if specified), or
+     * any other element within the markup for the field.</p>
+     * <br><p><b>Note</b>: see the note for <tt>{@link #fieldLabel}</tt>.</p><br>
+     * Example use:<pre><code>
+// Apply a style to the field's label:
+&lt;style>
+    .required .x-form-item-label {font-weight:bold;color:red;}
+&lt;/style>
+
+new Ext.FormPanel({
+       height: 100,
+       renderTo: Ext.getBody(),
+       items: [{
+               xtype: 'textfield',
+               fieldLabel: 'Name',
+               itemCls: 'required' //this label will be styled
+       },{
+               xtype: 'textfield',
+               fieldLabel: 'Favorite Color'
+       }]
+});
+</code></pre>
+     */
+
+       // Configs below are used for all Components when rendered by AnchorLayout.
+    /**
+     * @cfg {String} anchor <p><b>Note</b>: this config is only used when this Component is rendered
+     * by a Container which has been configured to use an <b>{@link Ext.layout.AnchorLayout AnchorLayout}</b>
+     * based layout manager, for example:<div class="mdetail-params"><ul>
+     * <li>{@link Ext.form.FormPanel}</li>
+     * <li>specifying <code>layout: 'anchor' // or 'form', or 'absolute'</code></li>
+     * </ul></div></p>
+     * <p>See {@link Ext.layout.AnchorLayout}.{@link Ext.layout.AnchorLayout#anchor anchor} also.</p>
+     */
+
+    /**
+     * @cfg {String} id
+     * <p>The <b>unique</b> id of this component (defaults to an {@link #getId auto-assigned id}).
+     * You should assign an id if you need to be able to access the component later and you do
+     * not have an object reference available (e.g., using {@link Ext}.{@link Ext#getCmp getCmp}).</p>
+     * <p>Note that this id will also be used as the element id for the containing HTML element
+     * that is rendered to the page for this component. This allows you to write id-based CSS
+     * rules to style the specific instance of this component uniquely, and also to select
+     * sub-elements using this component's id as the parent.</p>
+     * <p><b>Note</b>: to avoid complications imposed by a unique <tt>id</tt> also see
+     * <code>{@link #itemId}</code> and <code>{@link #ref}</code>.</p>
+     * <p><b>Note</b>: to access the container of an item see <code>{@link #ownerCt}</code>.</p>
+     */
+    /**
+     * @cfg {String} itemId
+     * <p>An <tt>itemId</tt> can be used as an alternative way to get a reference to a component
+     * when no object reference is available.  Instead of using an <code>{@link #id}</code> with
+     * {@link Ext}.{@link Ext#getCmp getCmp}, use <code>itemId</code> with
+     * {@link Ext.Container}.{@link Ext.Container#getComponent getComponent} which will retrieve
+     * <code>itemId</code>'s or <tt>{@link #id}</tt>'s. Since <code>itemId</code>'s are an index to the
+     * container's internal MixedCollection, the <code>itemId</code> is scoped locally to the container --
+     * avoiding potential conflicts with {@link Ext.ComponentMgr} which requires a <b>unique</b>
+     * <code>{@link #id}</code>.</p>
+     * <pre><code>
+var c = new Ext.Panel({ //
+    {@link Ext.BoxComponent#height height}: 300,
+    {@link #renderTo}: document.body,
+    {@link Ext.Container#layout layout}: 'auto',
+    {@link Ext.Container#items items}: [
+        {
+            itemId: 'p1',
+            {@link Ext.Panel#title title}: 'Panel 1',
+            {@link Ext.BoxComponent#height height}: 150
+        },
+        {
+            itemId: 'p2',
+            {@link Ext.Panel#title title}: 'Panel 2',
+            {@link Ext.BoxComponent#height height}: 150
+        }
+    ]
+})
+p1 = c.{@link Ext.Container#getComponent getComponent}('p1'); // not the same as {@link Ext#getCmp Ext.getCmp()}
+p2 = p1.{@link #ownerCt}.{@link Ext.Container#getComponent getComponent}('p2'); // reference via a sibling
+     * </code></pre>
+     * <p>Also see <tt>{@link #id}</tt> and <code>{@link #ref}</code>.</p>
+     * <p><b>Note</b>: to access the container of an item see <tt>{@link #ownerCt}</tt>.</p>
+     */
+    /**
+     * @cfg {String} xtype
+     * The registered <tt>xtype</tt> to create. This config option is not used when passing
+     * a config object into a constructor. This config option is used only when
+     * lazy instantiation is being used, and a child item of a Container is being
+     * specified not as a fully instantiated Component, but as a <i>Component config
+     * object</i>. The <tt>xtype</tt> will be looked up at render time up to determine what
+     * type of child Component to create.<br><br>
+     * The predefined xtypes are listed {@link Ext.Component here}.
+     * <br><br>
+     * If you subclass Components to create your own Components, you may register
+     * them using {@link Ext.ComponentMgr#registerType} in order to be able to
+     * take advantage of lazy instantiation and rendering.
+     */
+    /**
+     * @cfg {String} ptype
+     * The registered <tt>ptype</tt> to create. This config option is not used when passing
+     * a config object into a constructor. This config option is used only when
+     * lazy instantiation is being used, and a Plugin is being
+     * specified not as a fully instantiated Component, but as a <i>Component config
+     * object</i>. The <tt>ptype</tt> will be looked up at render time up to determine what
+     * type of Plugin to create.<br><br>
+     * If you create your own Plugins, you may register them using
+     * {@link Ext.ComponentMgr#registerPlugin} in order to be able to
+     * take advantage of lazy instantiation and rendering.
+     */
+    /**
+     * @cfg {String} cls
+     * An optional extra CSS class that will be added to this component's Element (defaults to '').  This can be
+     * useful for adding customized styles to the component or any of its children using standard CSS rules.
+     */
+    /**
+     * @cfg {String} overCls
+     * An optional extra CSS class that will be added to this component's Element when the mouse moves
+     * over the Element, and removed when the mouse moves out. (defaults to '').  This can be
+     * useful for adding customized 'active' or 'hover' styles to the component or any of its children using standard CSS rules.
+     */
+    /**
+     * @cfg {String} style
+     * A custom style specification to be applied to this component's Element.  Should be a valid argument to
+     * {@link Ext.Element#applyStyles}.
+     * <pre><code>
+new Ext.Panel({
+    title: 'Some Title',
+    renderTo: Ext.getBody(),
+    width: 400, height: 300,
+    layout: 'form',
+    items: [{
+        xtype: 'textarea',
+        style: {
+            width: '95%',
+            marginBottom: '10px'
+        }
+    },
+        new Ext.Button({
+            text: 'Send',
+            minWidth: '100',
+            style: {
+                marginBottom: '10px'
+            }
+        })
+    ]
+});
+     * </code></pre>
+     */
+    /**
+     * @cfg {String} ctCls
+     * <p>An optional extra CSS class that will be added to this component's container. This can be useful for
+     * adding customized styles to the container or any of its children using standard CSS rules.  See
+     * {@link Ext.layout.ContainerLayout}.{@link Ext.layout.ContainerLayout#extraCls extraCls} also.</p>
+     * <p><b>Note</b>: <tt>ctCls</tt> defaults to <tt>''</tt> except for the following class
+     * which assigns a value by default:
+     * <div class="mdetail-params"><ul>
+     * <li>{@link Ext.layout.Box Box Layout} : <tt>'x-box-layout-ct'</tt></li>
+     * </ul></div>
+     * To configure the above Class with an extra CSS class append to the default.  For example,
+     * for BoxLayout (Hbox and Vbox):<pre><code>
+     * ctCls: 'x-box-layout-ct custom-class'
+     * </code></pre>
+     * </p>
+     */
+    /**
+     * @cfg {Boolean} disabled
+     * Render this component disabled (default is false).
+     */
+    disabled : false,
+    /**
+     * @cfg {Boolean} hidden
+     * Render this component hidden (default is false). If <tt>true</tt>, the
+     * {@link #hide} method will be called internally.
+     */
+    hidden : false,
+    /**
+     * @cfg {Object/Array} plugins
+     * An object or array of objects that will provide custom functionality for this component.  The only
+     * requirement for a valid plugin is that it contain an init method that accepts a reference of type Ext.Component.
+     * When a component is created, if any plugins are available, the component will call the init method on each
+     * plugin, passing a reference to itself.  Each plugin can then call methods or respond to events on the
+     * component as needed to provide its functionality.
+     */
+    /**
+     * @cfg {Mixed} applyTo
+     * <p>Specify the id of the element, a DOM element or an existing Element corresponding to a DIV
+     * that is already present in the document that specifies some structural markup for this
+     * component.</p><div><ul>
+     * <li><b>Description</b> : <ul>
+     * <div class="sub-desc">When <tt>applyTo</tt> is used, constituent parts of the component can also be specified
+     * by id or CSS class name within the main element, and the component being created may attempt
+     * to create its subcomponents from that markup if applicable.</div>
+     * </ul></li>
+     * <li><b>Notes</b> : <ul>
+     * <div class="sub-desc">When using this config, a call to render() is not required.</div>
+     * <div class="sub-desc">If applyTo is specified, any value passed for {@link #renderTo} will be ignored and the target
+     * element's parent node will automatically be used as the component's container.</div>
+     * </ul></li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {Mixed} renderTo
+     * <p>Specify the id of the element, a DOM element or an existing Element that this component
+     * will be rendered into.</p><div><ul>
+     * <li><b>Notes</b> : <ul>
+     * <div class="sub-desc">Do <u>not</u> use this option if the Component is to be a child item of
+     * a {@link Ext.Container Container}. It is the responsibility of the
+     * {@link Ext.Container Container}'s {@link Ext.Container#layout layout manager}
+     * to render and manage its child items.</div>
+     * <div class="sub-desc">When using this config, a call to render() is not required.</div>
+     * </ul></li>
+     * </ul></div>
+     * <p>See <tt>{@link #render}</tt> also.</p>
+     */
+    /**
+     * @cfg {Boolean} stateful
+     * <p>A flag which causes the Component to attempt to restore the state of
+     * internal properties from a saved state on startup. The component must have
+     * either a <code>{@link #stateId}</code> or <code>{@link #id}</code> assigned
+     * for state to be managed. Auto-generated ids are not guaranteed to be stable
+     * across page loads and cannot be relied upon to save and restore the same
+     * state for a component.<p>
+     * <p>For state saving to work, the state manager's provider must have been
+     * set to an implementation of {@link Ext.state.Provider} which overrides the
+     * {@link Ext.state.Provider#set set} and {@link Ext.state.Provider#get get}
+     * methods to save and recall name/value pairs. A built-in implementation,
+     * {@link Ext.state.CookieProvider} is available.</p>
+     * <p>To set the state provider for the current page:</p>
+     * <pre><code>
+Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
+    expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
+}));
+     * </code></pre>
+     * <p>A stateful Component attempts to save state when one of the events
+     * listed in the <code>{@link #stateEvents}</code> configuration fires.</p>
+     * <p>To save state, a stateful Component first serializes its state by
+     * calling <b><code>getState</code></b>. By default, this function does
+     * nothing. The developer must provide an implementation which returns an
+     * object hash which represents the Component's restorable state.</p>
+     * <p>The value yielded by getState is passed to {@link Ext.state.Manager#set}
+     * which uses the configured {@link Ext.state.Provider} to save the object
+     * keyed by the Component's <code>{@link stateId}</code>, or, if that is not
+     * specified, its <code>{@link #id}</code>.</p>
+     * <p>During construction, a stateful Component attempts to <i>restore</i>
+     * its state by calling {@link Ext.state.Manager#get} passing the
+     * <code>{@link #stateId}</code>, or, if that is not specified, the
+     * <code>{@link #id}</code>.</p>
+     * <p>The resulting object is passed to <b><code>applyState</code></b>.
+     * The default implementation of <code>applyState</code> simply copies
+     * properties into the object, but a developer may override this to support
+     * more behaviour.</p>
+     * <p>You can perform extra processing on state save and restore by attaching
+     * handlers to the {@link #beforestaterestore}, {@link #staterestore},
+     * {@link #beforestatesave} and {@link #statesave} events.</p>
+     */
+    /**
+     * @cfg {String} stateId
+     * The unique id for this component to use for state management purposes
+     * (defaults to the component id if one was set, otherwise null if the
+     * component is using a generated id).
+     * <p>See <code>{@link #stateful}</code> for an explanation of saving and
+     * restoring Component state.</p>
+     */
+    /**
+     * @cfg {Array} stateEvents
+     * <p>An array of events that, when fired, should trigger this component to
+     * save its state (defaults to none). <code>stateEvents</code> may be any type
+     * of event supported by this component, including browser or custom events
+     * (e.g., <tt>['click', 'customerchange']</tt>).</p>
+     * <p>See <code>{@link #stateful}</code> for an explanation of saving and
+     * restoring Component state.</p>
+     */
+    /**
+     * @cfg {Mixed} autoEl
+     * <p>A tag name or {@link Ext.DomHelper DomHelper} spec used to create the {@link #getEl Element} which will
+     * encapsulate this Component.</p>
+     * <p>You do not normally need to specify this. For the base classes {@link Ext.Component}, {@link Ext.BoxComponent},
+     * and {@link Ext.Container}, this defaults to <b><tt>'div'</tt></b>. The more complex Ext classes use a more complex
+     * DOM structure created by their own onRender methods.</p>
+     * <p>This is intended to allow the developer to create application-specific utility Components encapsulated by
+     * different DOM elements. Example usage:</p><pre><code>
+{
+    xtype: 'box',
+    autoEl: {
+        tag: 'img',
+        src: 'http://www.example.com/example.jpg'
+    }
+}, {
+    xtype: 'box',
+    autoEl: {
+        tag: 'blockquote',
+        html: 'autoEl is cool!'
+    }
+}, {
+    xtype: 'container',
+    autoEl: 'ul',
+    cls: 'ux-unordered-list',
+    items: {
+        xtype: 'box',
+        autoEl: 'li',
+        html: 'First list item'
+    }
+}
+</code></pre>
+     */
+    autoEl : 'div',
+
+    /**
+     * @cfg {String} disabledClass
+     * CSS class added to the component when it is disabled (defaults to 'x-item-disabled').
+     */
+    disabledClass : 'x-item-disabled',
+    /**
+     * @cfg {Boolean} allowDomMove
+     * Whether the component can move the Dom node when rendering (defaults to true).
+     */
+    allowDomMove : true,
+    /**
+     * @cfg {Boolean} autoShow
+     * True if the component should check for hidden classes (e.g. 'x-hidden' or 'x-hide-display') and remove
+     * them on render (defaults to false).
+     */
+    autoShow : false,
+    /**
+     * @cfg {String} hideMode
+     * <p>How this component should be hidden. Supported values are <tt>'visibility'</tt>
+     * (css visibility), <tt>'offsets'</tt> (negative offset position) and <tt>'display'</tt>
+     * (css display).</p>
+     * <br><p><b>Note</b>: the default of <tt>'display'</tt> is generally preferred
+     * since items are automatically laid out when they are first shown (no sizing
+     * is done while hidden).</p>
+     */
+    hideMode : 'display',
+    /**
+     * @cfg {Boolean} hideParent
+     * True to hide and show the component's container when hide/show is called on the component, false to hide
+     * and show the component itself (defaults to false).  For example, this can be used as a shortcut for a hide
+     * button on a window by setting hide:true on the button when adding it to its parent container.
+     */
+    hideParent : false,
+    /**
+     * <p>The {@link Ext.Element} which encapsulates this Component. Read-only.</p>
+     * <p>This will <i>usually</i> be a &lt;DIV> element created by the class's onRender method, but
+     * that may be overridden using the <code>{@link #autoEl}</code> config.</p>
+     * <br><p><b>Note</b>: this element will not be available until this Component has been rendered.</p><br>
+     * <p>To add listeners for <b>DOM events</b> to this Component (as opposed to listeners
+     * for this Component's own Observable events), see the {@link Ext.util.Observable#listeners listeners}
+     * config for a suggestion, or use a render listener directly:</p><pre><code>
+new Ext.Panel({
+    title: 'The Clickable Panel',
+    listeners: {
+        render: function(p) {
+            // Append the Panel to the click handler&#39;s argument list.
+            p.getEl().on('click', handlePanelClick.createDelegate(null, [p], true));
+        },
+        single: true  // Remove the listener after first invocation
+    }
+});
+</code></pre>
+     * <p>See also <tt>{@link #getEl getEl}</p>
+     * @type Ext.Element
+     * @property el
+     */
+    /**
+     * The component's owner {@link Ext.Container} (defaults to undefined, and is set automatically when
+     * the component is added to a container).  Read-only.
+     * <p><b>Note</b>: to access items within the container see <tt>{@link #itemId}</tt>.</p>
+     * @type Ext.Container
+     * @property ownerCt
+     */
+    /**
+     * True if this component is hidden. Read-only.
+     * @type Boolean
+     * @property
+     */
+    /**
+     * True if this component is disabled. Read-only.
+     * @type Boolean
+     * @property
+     */
+    /**
+     * True if this component has been rendered. Read-only.
+     * @type Boolean
+     * @property
+     */
+    rendered : false,
+
+    // private
+    ctype : 'Ext.Component',
+
+    // private
+    actionMode : 'el',
+
+    // private
+    getActionEl : function(){
+        return this[this.actionMode];
+    },
+
+    initPlugin : function(p){
+        if(p.ptype && !Ext.isFunction(p.init)){
+            p = Ext.ComponentMgr.createPlugin(p);
+        }else if(Ext.isString(p)){
+            p = Ext.ComponentMgr.createPlugin({
+                ptype: p
+            });
+        }
+        p.init(this);
+        return p;
+    },
+
+    /* // protected
+     * Function to be implemented by Component subclasses to be part of standard component initialization flow (it is empty by default).
+     * <pre><code>
+// Traditional constructor:
+Ext.Foo = function(config){
+    // call superclass constructor:
+    Ext.Foo.superclass.constructor.call(this, config);
+
+    this.addEvents({
+        // add events
+    });
+};
+Ext.extend(Ext.Foo, Ext.Bar, {
+   // class body
+}
+
+// initComponent replaces the constructor:
+Ext.Foo = Ext.extend(Ext.Bar, {
+    initComponent : function(){
+        // call superclass initComponent
+        Ext.Container.superclass.initComponent.call(this);
+
+        this.addEvents({
+            // add events
+        });
+    }
+}
+</code></pre>
+     */
+    initComponent : Ext.emptyFn,
+
+    /**
+     * <p>Render this Component into the passed HTML element.</p>
+     * <p><b>If you are using a {@link Ext.Container Container} object to house this Component, then
+     * do not use the render method.</b></p>
+     * <p>A Container's child Components are rendered by that Container's
+     * {@link Ext.Container#layout layout} manager when the Container is first rendered.</p>
+     * <p>Certain layout managers allow dynamic addition of child components. Those that do
+     * include {@link Ext.layout.CardLayout}, {@link Ext.layout.AnchorLayout},
+     * {@link Ext.layout.FormLayout}, {@link Ext.layout.TableLayout}.</p>
+     * <p>If the Container is already rendered when a new child Component is added, you may need to call
+     * the Container's {@link Ext.Container#doLayout doLayout} to refresh the view which causes any
+     * unrendered child Components to be rendered. This is required so that you can add multiple
+     * child components if needed while only refreshing the layout once.</p>
+     * <p>When creating complex UIs, it is important to remember that sizing and positioning
+     * of child items is the responsibility of the Container's {@link Ext.Container#layout layout} manager.
+     * If you expect child items to be sized in response to user interactions, you must
+     * configure the Container with a layout manager which creates and manages the type of layout you
+     * have in mind.</p>
+     * <p><b>Omitting the Container's {@link Ext.Container#layout layout} config means that a basic
+     * layout manager is used which does nothing but render child components sequentially into the
+     * Container. No sizing or positioning will be performed in this situation.</b></p>
+     * @param {Element/HTMLElement/String} container (optional) The element this Component should be
+     * rendered into. If it is being created from existing markup, this should be omitted.
+     * @param {String/Number} position (optional) The element ID or DOM node index within the container <b>before</b>
+     * which this component will be inserted (defaults to appending to the end of the container)
+     */
+    render : function(container, position){
+        if(!this.rendered && this.fireEvent('beforerender', this) !== false){
+            if(!container && this.el){
+                this.el = Ext.get(this.el);
+                container = this.el.dom.parentNode;
+                this.allowDomMove = false;
+            }
+            this.container = Ext.get(container);
+            if(this.ctCls){
+                this.container.addClass(this.ctCls);
+            }
+            this.rendered = true;
+            if(position !== undefined){
+                if(Ext.isNumber(position)){
+                    position = this.container.dom.childNodes[position];
+                }else{
+                    position = Ext.getDom(position);
+                }
+            }
+            this.onRender(this.container, position || null);
+            if(this.autoShow){
+                this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]);
+            }
+            if(this.cls){
+                this.el.addClass(this.cls);
+                delete this.cls;
+            }
+            if(this.style){
+                this.el.applyStyles(this.style);
+                delete this.style;
+            }
+            if(this.overCls){
+                this.el.addClassOnOver(this.overCls);
+            }
+            this.fireEvent('render', this);
+            this.afterRender(this.container);
+            if(this.hidden){
+                // call this so we don't fire initial hide events.
+                this.doHide();
+            }
+            if(this.disabled){
+                // pass silent so the event doesn't fire the first time.
+                this.disable(true);
+            }
+
+            if(this.stateful !== false){
+                this.initStateEvents();
+            }
+            this.initRef();
+            this.fireEvent('afterrender', this);
+        }
+        return this;
+    },
+
+    initRef : function(){
+        /**
+         * @cfg {String} ref
+         * <p>A path specification, relative to the Component's {@link #ownerCt} specifying into which
+         * ancestor Container to place a named reference to this Component.</p>
+         * <p>The ancestor axis can be traversed by using '/' characters in the path.
+         * For example, to put a reference to a Toolbar Button into <i>the Panel which owns the Toolbar</i>:</p><pre><code>
+var myGrid = new Ext.grid.EditorGridPanel({
+    title: 'My EditorGridPanel',
+    store: myStore,
+    colModel: myColModel,
+    tbar: [{
+        text: 'Save',
+        handler: saveChanges,
+        disabled: true,
+        ref: '../saveButton'
+    }],
+    listeners: {
+        afteredit: function() {
+//          The button reference is in the GridPanel
+            myGrid.saveButton.enable();
+        }
+    }
+});
+</code></pre>
+         * <p>In the code above, if the ref had been <code>'saveButton'</code> the reference would
+         * have been placed into the Toolbar. Each '/' in the ref moves up one level from the
+         * Component's {@link #ownerCt}.</p>
+         */
+        if(this.ref){
+            var levels = this.ref.split('/');
+            var last = levels.length, i = 0;
+            var t = this;
+            while(i < last){
+                if(t.ownerCt){
+                    t = t.ownerCt;
+                }
+                i++;
+            }
+            t[levels[--i]] = this;
+        }
+    },
+
+    // private
+    initState : function(config){
+        if(Ext.state.Manager){
+            var id = this.getStateId();
+            if(id){
+                var state = Ext.state.Manager.get(id);
+                if(state){
+                    if(this.fireEvent('beforestaterestore', this, state) !== false){
+                        this.applyState(state);
+                        this.fireEvent('staterestore', this, state);
+                    }
+                }
+            }
+        }
+    },
+
+    // private
+    getStateId : function(){
+        return this.stateId || ((this.id.indexOf('ext-comp-') == 0 || this.id.indexOf('ext-gen') == 0) ? null : this.id);
+    },
+
+    // private
+    initStateEvents : function(){
+        if(this.stateEvents){
+            for(var i = 0, e; e = this.stateEvents[i]; i++){
+                this.on(e, this.saveState, this, {delay:100});
+            }
+        }
+    },
+
+    // private
+    applyState : function(state, config){
+        if(state){
+            Ext.apply(this, state);
+        }
+    },
+
+    // private
+    getState : function(){
+        return null;
+    },
+
+    // private
+    saveState : function(){
+        if(Ext.state.Manager && this.stateful !== false){
+            var id = this.getStateId();
+            if(id){
+                var state = this.getState();
+                if(this.fireEvent('beforestatesave', this, state) !== false){
+                    Ext.state.Manager.set(id, state);
+                    this.fireEvent('statesave', this, state);
+                }
+            }
+        }
+    },
+
+    /**
+     * Apply this component to existing markup that is valid. With this function, no call to render() is required.
+     * @param {String/HTMLElement} el
+     */
+    applyToMarkup : function(el){
+        this.allowDomMove = false;
+        this.el = Ext.get(el);
+        this.render(this.el.dom.parentNode);
+    },
+
+    /**
+     * Adds a CSS class to the component's underlying element.
+     * @param {string} cls The CSS class name to add
+     * @return {Ext.Component} this
+     */
+    addClass : function(cls){
+        if(this.el){
+            this.el.addClass(cls);
+        }else{
+            this.cls = this.cls ? this.cls + ' ' + cls : cls;
+        }
+        return this;
+    },
+
+    /**
+     * Removes a CSS class from the component's underlying element.
+     * @param {string} cls The CSS class name to remove
+     * @return {Ext.Component} this
+     */
+    removeClass : function(cls){
+        if(this.el){
+            this.el.removeClass(cls);
+        }else if(this.cls){
+            this.cls = this.cls.split(' ').remove(cls).join(' ');
+        }
+        return this;
+    },
+
+    // private
+    // default function is not really useful
+    onRender : function(ct, position){
+        if(!this.el && this.autoEl){
+            if(Ext.isString(this.autoEl)){
+                this.el = document.createElement(this.autoEl);
+            }else{
+                var div = document.createElement('div');
+                Ext.DomHelper.overwrite(div, this.autoEl);
+                this.el = div.firstChild;
+            }
+            if (!this.el.id) {
+                this.el.id = this.getId();
+            }
+        }
+        if(this.el){
+            this.el = Ext.get(this.el);
+            if(this.allowDomMove !== false){
+                ct.dom.insertBefore(this.el.dom, position);
+            }
+        }
+    },
+
+    // private
+    getAutoCreate : function(){
+        var cfg = Ext.isObject(this.autoCreate) ?
+                      this.autoCreate : Ext.apply({}, this.defaultAutoCreate);
+        if(this.id && !cfg.id){
+            cfg.id = this.id;
+        }
+        return cfg;
+    },
+
+    // private
+    afterRender : Ext.emptyFn,
+
+    /**
+     * Destroys this component by purging any event listeners, removing the component's element from the DOM,
+     * removing the component from its {@link Ext.Container} (if applicable) and unregistering it from
+     * {@link Ext.ComponentMgr}.  Destruction is generally handled automatically by the framework and this method
+     * should usually not need to be called directly.
+     *
+     */
+    destroy : function(){
+        if(this.fireEvent('beforedestroy', this) !== false){
+            this.beforeDestroy();
+            if(this.rendered){
+                this.el.removeAllListeners();
+                this.el.remove();
+                if(this.actionMode == 'container' || this.removeMode == 'container'){
+                    this.container.remove();
+                }
+            }
+            this.onDestroy();
+            Ext.ComponentMgr.unregister(this);
+            this.fireEvent('destroy', this);
+            this.purgeListeners();
+        }
+    },
+
+    // private
+    beforeDestroy : Ext.emptyFn,
+
+    // private
+    onDestroy  : Ext.emptyFn,
+
+    /**
+     * <p>Returns the {@link Ext.Element} which encapsulates this Component.</p>
+     * <p>This will <i>usually</i> be a &lt;DIV> element created by the class's onRender method, but
+     * that may be overridden using the {@link #autoEl} config.</p>
+     * <br><p><b>Note</b>: this element will not be available until this Component has been rendered.</p><br>
+     * <p>To add listeners for <b>DOM events</b> to this Component (as opposed to listeners
+     * for this Component's own Observable events), see the {@link #listeners} config for a suggestion,
+     * or use a render listener directly:</p><pre><code>
+new Ext.Panel({
+    title: 'The Clickable Panel',
+    listeners: {
+        render: function(p) {
+            // Append the Panel to the click handler&#39;s argument list.
+            p.getEl().on('click', handlePanelClick.createDelegate(null, [p], true));
+        },
+        single: true  // Remove the listener after first invocation
+    }
+});
+</code></pre>
+     * @return {Ext.Element} The Element which encapsulates this Component.
+     */
+    getEl : function(){
+        return this.el;
+    },
+
+    /**
+     * Returns the <code>id</code> of this component or automatically generates and
+     * returns an <code>id</code> if an <code>id</code> is not defined yet:<pre><code>
+     * 'ext-comp-' + (++Ext.Component.AUTO_ID)
+     * </code></pre>
+     * @return {String} id
+     */
+    getId : function(){
+        return this.id || (this.id = 'ext-comp-' + (++Ext.Component.AUTO_ID));
+    },
+
+    /**
+     * Returns the <code>{@link #itemId}</code> of this component.  If an
+     * <code>{@link #itemId}</code> was not assigned through configuration the
+     * <code>id</code> is returned using <code>{@link #getId}</code>.
+     * @return {String}
+     */
+    getItemId : function(){
+        return this.itemId || this.getId();
+    },
+
+    /**
+     * Try to focus this component.
+     * @param {Boolean} selectText (optional) If applicable, true to also select the text in this component
+     * @param {Boolean/Number} delay (optional) Delay the focus this number of milliseconds (true for 10 milliseconds)
+     * @return {Ext.Component} this
+     */
+    focus : function(selectText, delay){
+        if(delay){
+            this.focus.defer(Ext.isNumber(delay) ? delay : 10, this, [selectText, false]);
+            return;
+        }
+        if(this.rendered){
+            this.el.focus();
+            if(selectText === true){
+                this.el.dom.select();
+            }
+        }
+        return this;
+    },
+
+    // private
+    blur : function(){
+        if(this.rendered){
+            this.el.blur();
+        }
+        return this;
+    },
+
+    /**
+     * Disable this component and fire the 'disable' event.
+     * @return {Ext.Component} this
+     */
+    disable : function(/* private */ silent){
+        if(this.rendered){
+            this.onDisable();
+        }
+        this.disabled = true;
+        if(silent !== true){
+            this.fireEvent('disable', this);
+        }
+        return this;
+    },
+
+    // private
+    onDisable : function(){
+        this.getActionEl().addClass(this.disabledClass);
+        this.el.dom.disabled = true;
+    },
+
+    /**
+     * Enable this component and fire the 'enable' event.
+     * @return {Ext.Component} this
+     */
+    enable : function(){
+        if(this.rendered){
+            this.onEnable();
+        }
+        this.disabled = false;
+        this.fireEvent('enable', this);
+        return this;
+    },
+
+    // private
+    onEnable : function(){
+        this.getActionEl().removeClass(this.disabledClass);
+        this.el.dom.disabled = false;
+    },
+
+    /**
+     * Convenience function for setting disabled/enabled by boolean.
+     * @param {Boolean} disabled
+     * @return {Ext.Component} this
+     */
+    setDisabled : function(disabled){
+        return this[disabled ? 'disable' : 'enable']();
+    },
+
+    /**
+     * Show this component.  Listen to the '{@link #beforeshow}' event and return
+     * <tt>false</tt> to cancel showing the component.  Fires the '{@link #show}'
+     * event after showing the component.
+     * @return {Ext.Component} this
+     */
+    show : function(){
+        if(this.fireEvent('beforeshow', this) !== false){
+            this.hidden = false;
+            if(this.autoRender){
+                this.render(Ext.isBoolean(this.autoRender) ? Ext.getBody() : this.autoRender);
+            }
+            if(this.rendered){
+                this.onShow();
+            }
+            this.fireEvent('show', this);
+        }
+        return this;
+    },
+
+    // private
+    onShow : function(){
+        this.getVisibiltyEl().removeClass('x-hide-' + this.hideMode);
+    },
+
+    /**
+     * Hide this component.  Listen to the '{@link #beforehide}' event and return
+     * <tt>false</tt> to cancel hiding the component.  Fires the '{@link #hide}'
+     * event after hiding the component. Note this method is called internally if
+     * the component is configured to be <code>{@link #hidden}</code>.
+     * @return {Ext.Component} this
+     */
+    hide : function(){
+        if(this.fireEvent('beforehide', this) !== false){
+            this.doHide();
+            this.fireEvent('hide', this);
+        }
+        return this;
+    },
+
+    // private
+    doHide: function(){
+        this.hidden = true;
+        if(this.rendered){
+            this.onHide();
+        }
+    },
+
+    // private
+    onHide : function(){
+        this.getVisibiltyEl().addClass('x-hide-' + this.hideMode);
+    },
+
+    // private
+    getVisibiltyEl : function(){
+        return this.hideParent ? this.container : this.getActionEl();
+    },
+
+    /**
+     * Convenience function to hide or show this component by boolean.
+     * @param {Boolean} visible True to show, false to hide
+     * @return {Ext.Component} this
+     */
+    setVisible : function(visible){
+        return this[visible ? 'show' : 'hide']();
+    },
+
+    /**
+     * Returns true if this component is visible.
+     * @return {Boolean} True if this component is visible, false otherwise.
+     */
+    isVisible : function(){
+        return this.rendered && this.getVisibiltyEl().isVisible();
+    },
+
+    /**
+     * Clone the current component using the original config values passed into this instance by default.
+     * @param {Object} overrides A new config containing any properties to override in the cloned version.
+     * An id property can be passed on this object, otherwise one will be generated to avoid duplicates.
+     * @return {Ext.Component} clone The cloned copy of this component
+     */
+    cloneConfig : function(overrides){
+        overrides = overrides || {};
+        var id = overrides.id || Ext.id();
+        var cfg = Ext.applyIf(overrides, this.initialConfig);
+        cfg.id = id; // prevent dup id
+        return new this.constructor(cfg);
+    },
+
+    /**
+     * Gets the xtype for this component as registered with {@link Ext.ComponentMgr}. For a list of all
+     * available xtypes, see the {@link Ext.Component} header. Example usage:
+     * <pre><code>
+var t = new Ext.form.TextField();
+alert(t.getXType());  // alerts 'textfield'
+</code></pre>
+     * @return {String} The xtype
+     */
+    getXType : function(){
+        return this.constructor.xtype;
+    },
+
+    /**
+     * <p>Tests whether or not this Component is of a specific xtype. This can test whether this Component is descended
+     * from the xtype (default) or whether it is directly of the xtype specified (shallow = true).</p>
+     * <p><b>If using your own subclasses, be aware that a Component must register its own xtype
+     * to participate in determination of inherited xtypes.</b></p>
+     * <p>For a list of all available xtypes, see the {@link Ext.Component} header.</p>
+     * <p>Example usage:</p>
+     * <pre><code>
+var t = new Ext.form.TextField();
+var isText = t.isXType('textfield');        // true
+var isBoxSubclass = t.isXType('box');       // true, descended from BoxComponent
+var isBoxInstance = t.isXType('box', true); // false, not a direct BoxComponent instance
+</code></pre>
+     * @param {String} xtype The xtype to check for this Component
+     * @param {Boolean} shallow (optional) False to check whether this Component is descended from the xtype (this is
+     * the default), or true to check whether this Component is directly of the specified xtype.
+     * @return {Boolean} True if this component descends from the specified xtype, false otherwise.
+     */
+    isXType : function(xtype, shallow){
+        //assume a string by default
+        if (Ext.isFunction(xtype)){
+            xtype = xtype.xtype; //handle being passed the class, e.g. Ext.Component
+        }else if (Ext.isObject(xtype)){
+            xtype = xtype.constructor.xtype; //handle being passed an instance
+        }
+
+        return !shallow ? ('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 : this.constructor.xtype == xtype;
+    },
+
+    /**
+     * <p>Returns this Component's xtype hierarchy as a slash-delimited string. For a list of all
+     * available xtypes, see the {@link Ext.Component} header.</p>
+     * <p><b>If using your own subclasses, be aware that a Component must register its own xtype
+     * to participate in determination of inherited xtypes.</b></p>
+     * <p>Example usage:</p>
+     * <pre><code>
+var t = new Ext.form.TextField();
+alert(t.getXTypes());  // alerts 'component/box/field/textfield'
+</code></pre>
+     * @return {String} The xtype hierarchy string
+     */
+    getXTypes : function(){
+        var tc = this.constructor;
+        if(!tc.xtypes){
+            var c = [], sc = this;
+            while(sc && sc.constructor.xtype){
+                c.unshift(sc.constructor.xtype);
+                sc = sc.constructor.superclass;
+            }
+            tc.xtypeChain = c;
+            tc.xtypes = c.join('/');
+        }
+        return tc.xtypes;
+    },
+
+    /**
+     * Find a container above this component at any level by a custom function. If the passed function returns
+     * true, the container will be returned.
+     * @param {Function} fn The custom function to call with the arguments (container, this component).
+     * @return {Ext.Container} The first Container for which the custom function returns true
+     */
+    findParentBy : function(fn) {
+        for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt);
+        return p || null;
+    },
+
+    /**
+     * Find a container above this component at any level by xtype or class
+     * @param {String/Class} xtype The xtype string for a component, or the class of the component directly
+     * @return {Ext.Container} The first Container which matches the given xtype or class
+     */
+    findParentByType : function(xtype) {
+        return Ext.isFunction(xtype) ?
+            this.findParentBy(function(p){
+                return p.constructor === xtype;
+            }) :
+            this.findParentBy(function(p){
+                return p.constructor.xtype === xtype;
+            });
+    },
+
+    getDomPositionEl : function(){
+        return this.getPositionEl ? this.getPositionEl() : this.getEl();
+    },
+
+    // private
+    purgeListeners : function(){
+        Ext.Component.superclass.purgeListeners.call(this);
+        if(this.mons){
+            this.on('beforedestroy', this.clearMons, this, {single: true});
+        }
+    },
+
+    // private
+    clearMons : function(){
+        Ext.each(this.mons, function(m){
+            m.item.un(m.ename, m.fn, m.scope);
+        }, this);
+        this.mons = [];
+    },
+
+    // internal function for auto removal of assigned event handlers on destruction
+    mon : function(item, ename, fn, scope, opt){
+        if(!this.mons){
+            this.mons = [];
+            this.on('beforedestroy', this.clearMons, this, {single: true});
+        }
+
+        if(Ext.isObject(ename)){
+               var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;
+
+            var o = ename;
+            for(var e in o){
+                if(propRe.test(e)){
+                    continue;
+                }
+                if(Ext.isFunction(o[e])){
+                    // shared options
+                               this.mons.push({
+                                   item: item, ename: e, fn: o[e], scope: o.scope
+                               });
+                               item.on(e, o[e], o.scope, o);
+                }else{
+                    // individual options
+                               this.mons.push({
+                                   item: item, ename: e, fn: o[e], scope: o.scope
+                               });
+                               item.on(e, o[e]);
+                }
+            }
+            return;
+        }
+
+
+        this.mons.push({
+            item: item, ename: ename, fn: fn, scope: scope
+        });
+        item.on(ename, fn, scope, opt);
+    },
+
+    // protected, opposite of mon
+    mun : function(item, ename, fn, scope){
+        var found, mon;
+        for(var i = 0, len = this.mons.length; i < len; ++i){
+            mon = this.mons[i];
+            if(item === mon.item && ename == mon.ename && fn === mon.fn && scope === mon.scope){
+                this.mons.splice(i, 1);
+                item.un(ename, fn, scope);
+                found = true;
+                break;
+            }
+        }
+        return found;
+    },
+
+    /**
+     * Returns the next component in the owning container
+     * @return Ext.Component
+     */
+    nextSibling : function(){
+        if(this.ownerCt){
+            var index = this.ownerCt.items.indexOf(this);
+            if(index != -1 && index+1 < this.ownerCt.items.getCount()){
+                return this.ownerCt.items.itemAt(index+1);
+            }
+        }
+        return null;
+    },
+
+    /**
+     * Returns the previous component in the owning container
+     * @return Ext.Component
+     */
+    previousSibling : function(){
+        if(this.ownerCt){
+            var index = this.ownerCt.items.indexOf(this);
+            if(index > 0){
+                return this.ownerCt.items.itemAt(index-1);
+            }
+        }
+        return null;
+    },
+
+    /**
+     * Provides the link for Observable's fireEvent method to bubble up the ownership hierarchy.
+     * @return {Ext.Container} the Container which owns this Component.
+     */
+    getBubbleTarget : function(){
+        return this.ownerCt;
+    }
+});
+
+Ext.reg('component', Ext.Component);
+/**\r
+ * @class Ext.Action\r
+ * <p>An Action is a piece of reusable functionality that can be abstracted out of any particular component so that it\r
+ * can be usefully shared among multiple components.  Actions let you share handlers, configuration options and UI\r
+ * updates across any components that support the Action interface (primarily {@link Ext.Toolbar}, {@link Ext.Button}\r
+ * and {@link Ext.menu.Menu} components).</p>\r
+ * <p>Aside from supporting the config object interface, any component that needs to use Actions must also support\r
+ * the following method list, as these will be called as needed by the Action class: setText(string), setIconCls(string),\r
+ * setDisabled(boolean), setVisible(boolean) and setHandler(function).</p>\r
+ * Example usage:<br>\r
+ * <pre><code>\r
+// Define the shared action.  Each component below will have the same\r
+// display text and icon, and will display the same message on click.\r
+var action = new Ext.Action({\r
+    {@link #text}: 'Do something',\r
+    {@link #handler}: function(){\r
+        Ext.Msg.alert('Click', 'You did something.');\r
+    },\r
+    {@link #iconCls}: 'do-something',\r
+    {@link #itemId}: 'myAction'\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
-El.garbageCollect = function(){\r
-    if(!Ext.enableGarbageCollector){\r
-        clearInterval(El.collectorThread);\r
-        return;\r
-    }\r
-    for(var eid in El.cache){\r
-        var el = El.cache[eid], 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 && !document.getElementById(eid))){\r
-            delete El.cache[eid];\r
-            if(d && Ext.enableListenerCollection){\r
-                Ext.EventManager.removeAll(d);\r
-            }\r
+var panel = new Ext.Panel({\r
+    title: 'Actions',\r
+    width: 500,\r
+    height: 300,\r
+    tbar: [\r
+        // Add the action directly to a toolbar as a menu button\r
+        action,\r
+        {\r
+            text: 'Action Menu',\r
+            // Add the action to a menu as a text item\r
+            menu: [action]\r
         }\r
-    }\r
-}\r
-El.collectorThreadId = setInterval(El.garbageCollect, 30000);\r
-\r
-var flyFn = function(){};\r
-flyFn.prototype = El.prototype;\r
-var _cls = new flyFn();\r
-\r
-// dom is optional\r
-El.Flyweight = function(dom){\r
-    this.dom = dom;\r
-};\r
-\r
-El.Flyweight.prototype = _cls;\r
-El.Flyweight.prototype.isFlyweight = true;\r
-\r
-El._flyweights = {};\r
-\r
-El.fly = function(el, named){\r
-    named = named || '_global';\r
-    el = Ext.getDom(el);\r
-    if(!el){\r
-        return null;\r
-    }\r
-    if(!El._flyweights[named]){\r
-        El._flyweights[named] = new El.Flyweight();\r
-    }\r
-    El._flyweights[named].dom = el;\r
-    return El._flyweights[named];\r
-};\r
-\r
-\r
-Ext.get = El.get;\r
-\r
-Ext.fly = El.fly;\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
-\r
-Ext.EventManager.on(window, 'unload', function(){\r
-    delete El.cache;\r
-    delete El._flyweights;\r
+    ],\r
+    items: [\r
+        // Add the action to the panel body as a standard button\r
+        new Ext.Button(action)\r
+    ],\r
+    renderTo: Ext.getBody()\r
 });\r
-})();\r
-\r
-//Notifies Element that fx methods are available\r
-Ext.enableFx = true;\r
-\r
 \r
-Ext.Fx = {\r
-       \r
-    slideIn : function(anchor, o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-\r
-        el.queueFx(o, function(){\r
-\r
-            anchor = anchor || "t";\r
-\r
-            // fix display to visibility\r
-            this.fixDisplay();\r
-\r
-            // restore values after effect\r
-            var r = this.getFxRestore();\r
-            var b = this.getBox();\r
-            // fixed size for slide\r
-            this.setSize(b);\r
+// Change the text for all components using the action\r
+action.setText('Something else');\r
 \r
-            // wrap if needed\r
-            var wrap = this.fxWrap(r.pos, o, "hidden");\r
+// Reference an action through a container using the itemId\r
+var btn = panel.getComponent('myAction');\r
+var aRef = btn.baseAction;\r
+aRef.setText('New text');\r
+</code></pre>\r
+ * @constructor\r
+ * @param {Object} config The configuration options\r
+ */\r
+Ext.Action = function(config){\r
+    this.initialConfig = config;\r
+    this.itemId = config.itemId = (config.itemId || config.id || Ext.id());\r
+    this.items = [];\r
+}\r
 \r
-            var st = this.dom.style;\r
-            st.visibility = "visible";\r
-            st.position = "absolute";\r
+Ext.Action.prototype = {\r
+    /**\r
+     * @cfg {String} text The text to set for all components using this action (defaults to '').\r
+     */\r
+    /**\r
+     * @cfg {String} iconCls\r
+     * The CSS class selector that specifies a background image to be used as the header icon for\r
+     * all components using this action (defaults to '').\r
+     * <p>An example of specifying a custom icon class would be something like:\r
+     * </p><pre><code>\r
+// specify the property in the config for the class:\r
+     ...\r
+     iconCls: 'do-something'\r
+\r
+// css class that specifies background image to be used as the icon image:\r
+.do-something { background-image: url(../images/my-icon.gif) 0 6px no-repeat !important; }\r
+</code></pre>\r
+     */\r
+    /**\r
+     * @cfg {Boolean} disabled True to disable all components using this action, false to enable them (defaults to false).\r
+     */\r
+    /**\r
+     * @cfg {Boolean} hidden True to hide all components using this action, false to show them (defaults to false).\r
+     */\r
+    /**\r
+     * @cfg {Function} handler The function that will be invoked by each component tied to this action\r
+     * when the component's primary event is triggered (defaults to undefined).\r
+     */\r
+    /**\r
+     * @cfg {String} itemId\r
+     * See {@link Ext.Component}.{@link Ext.Component#itemId itemId}.\r
+     */\r
+    /**\r
+     * @cfg {Object} scope The scope in which the {@link #handler} function will execute.\r
+     */\r
 \r
-            // clear out temp styles after slide and unwrap\r
-            var after = function(){\r
-                el.fxUnwrap(wrap, r.pos, o);\r
-                st.width = r.width;\r
-                st.height = r.height;\r
-                el.afterFx(o);\r
-            };\r
-            // time to calc the positions\r
-            var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};\r
-\r
-            switch(anchor.toLowerCase()){\r
-                case "t":\r
-                    wrap.setSize(b.width, 0);\r
-                    st.left = st.bottom = "0";\r
-                    a = {height: bh};\r
-                break;\r
-                case "l":\r
-                    wrap.setSize(0, b.height);\r
-                    st.right = st.top = "0";\r
-                    a = {width: bw};\r
-                break;\r
-                case "r":\r
-                    wrap.setSize(0, b.height);\r
-                    wrap.setX(b.right);\r
-                    st.left = st.top = "0";\r
-                    a = {width: bw, points: pt};\r
-                break;\r
-                case "b":\r
-                    wrap.setSize(b.width, 0);\r
-                    wrap.setY(b.bottom);\r
-                    st.left = st.top = "0";\r
-                    a = {height: bh, points: pt};\r
-                break;\r
-                case "tl":\r
-                    wrap.setSize(0, 0);\r
-                    st.right = st.bottom = "0";\r
-                    a = {width: bw, height: bh};\r
-                break;\r
-                case "bl":\r
-                    wrap.setSize(0, 0);\r
-                    wrap.setY(b.y+b.height);\r
-                    st.right = st.top = "0";\r
-                    a = {width: bw, height: bh, points: pt};\r
-                break;\r
-                case "br":\r
-                    wrap.setSize(0, 0);\r
-                    wrap.setXY([b.right, b.bottom]);\r
-                    st.left = st.top = "0";\r
-                    a = {width: bw, height: bh, points: pt};\r
-                break;\r
-                case "tr":\r
-                    wrap.setSize(0, 0);\r
-                    wrap.setX(b.x+b.width);\r
-                    st.left = st.bottom = "0";\r
-                    a = {width: bw, height: bh, points: pt};\r
-                break;\r
-            }\r
-            this.dom.style.visibility = "visible";\r
-            wrap.show();\r
+    // private\r
+    isAction : true,\r
 \r
-            arguments.callee.anim = wrap.fxanim(a,\r
-                o,\r
-                'motion',\r
-                .5,\r
-                'easeOut', after);\r
-        });\r
-        return this;\r
+    /**\r
+     * Sets the text to be displayed by all components using this action.\r
+     * @param {String} text The text to display\r
+     */\r
+    setText : function(text){\r
+        this.initialConfig.text = text;\r
+        this.callEach('setText', [text]);\r
     },\r
-    \r
-       \r
-    slideOut : function(anchor, o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-\r
-        el.queueFx(o, function(){\r
-\r
-            anchor = anchor || "t";\r
-\r
-            // restore values after effect\r
-            var r = this.getFxRestore();\r
-            \r
-            var b = this.getBox();\r
-            // fixed size for slide\r
-            this.setSize(b);\r
-\r
-            // wrap if needed\r
-            var wrap = this.fxWrap(r.pos, o, "visible");\r
-\r
-            var st = this.dom.style;\r
-            st.visibility = "visible";\r
-            st.position = "absolute";\r
-\r
-            wrap.setSize(b);\r
-\r
-            var after = function(){\r
-                if(o.useDisplay){\r
-                    el.setDisplayed(false);\r
-                }else{\r
-                    el.hide();\r
-                }\r
-\r
-                el.fxUnwrap(wrap, r.pos, o);\r
-\r
-                st.width = r.width;\r
-                st.height = r.height;\r
-\r
-                el.afterFx(o);\r
-            };\r
-\r
-            var a, zero = {to: 0};\r
-            switch(anchor.toLowerCase()){\r
-                case "t":\r
-                    st.left = st.bottom = "0";\r
-                    a = {height: zero};\r
-                break;\r
-                case "l":\r
-                    st.right = st.top = "0";\r
-                    a = {width: zero};\r
-                break;\r
-                case "r":\r
-                    st.left = st.top = "0";\r
-                    a = {width: zero, points: {to:[b.right, b.y]}};\r
-                break;\r
-                case "b":\r
-                    st.left = st.top = "0";\r
-                    a = {height: zero, points: {to:[b.x, b.bottom]}};\r
-                break;\r
-                case "tl":\r
-                    st.right = st.bottom = "0";\r
-                    a = {width: zero, height: zero};\r
-                break;\r
-                case "bl":\r
-                    st.right = st.top = "0";\r
-                    a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};\r
-                break;\r
-                case "br":\r
-                    st.left = st.top = "0";\r
-                    a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};\r
-                break;\r
-                case "tr":\r
-                    st.left = st.bottom = "0";\r
-                    a = {width: zero, height: zero, points: {to:[b.right, b.y]}};\r
-                break;\r
-            }\r
 \r
-            arguments.callee.anim = wrap.fxanim(a,\r
-                o,\r
-                'motion',\r
-                .5,\r
-                "easeOut", after);\r
-        });\r
-        return this;\r
+    /**\r
+     * Gets the text currently displayed by all components using this action.\r
+     */\r
+    getText : function(){\r
+        return this.initialConfig.text;\r
     },\r
 \r
-       \r
-    puff : function(o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
+    /**\r
+     * Sets the icon CSS class for all components using this action.  The class should supply\r
+     * a background image that will be used as the icon image.\r
+     * @param {String} cls The CSS class supplying the icon image\r
+     */\r
+    setIconClass : function(cls){\r
+        this.initialConfig.iconCls = cls;\r
+        this.callEach('setIconClass', [cls]);\r
+    },\r
 \r
-        el.queueFx(o, function(){\r
-            this.clearOpacity();\r
-            this.show();\r
+    /**\r
+     * Gets the icon CSS class currently used by all components using this action.\r
+     */\r
+    getIconClass : function(){\r
+        return this.initialConfig.iconCls;\r
+    },\r
 \r
-            // restore values after effect\r
-            var r = this.getFxRestore();\r
-            var st = this.dom.style;\r
+    /**\r
+     * Sets the disabled state of all components using this action.  Shortcut method\r
+     * for {@link #enable} and {@link #disable}.\r
+     * @param {Boolean} disabled True to disable the component, false to enable it\r
+     */\r
+    setDisabled : function(v){\r
+        this.initialConfig.disabled = v;\r
+        this.callEach('setDisabled', [v]);\r
+    },\r
 \r
-            var after = function(){\r
-                if(o.useDisplay){\r
-                    el.setDisplayed(false);\r
-                }else{\r
-                    el.hide();\r
-                }\r
+    /**\r
+     * Enables all components using this action.\r
+     */\r
+    enable : function(){\r
+        this.setDisabled(false);\r
+    },\r
 \r
-                el.clearOpacity();\r
+    /**\r
+     * Disables all components using this action.\r
+     */\r
+    disable : function(){\r
+        this.setDisabled(true);\r
+    },\r
 \r
-                el.setPositioning(r.pos);\r
-                st.width = r.width;\r
-                st.height = r.height;\r
-                st.fontSize = '';\r
-                el.afterFx(o);\r
-            };\r
+    /**\r
+     * Returns true if the components using this action are currently disabled, else returns false.  \r
+     */\r
+    isDisabled : function(){\r
+        return this.initialConfig.disabled;\r
+    },\r
 \r
-            var width = this.getWidth();\r
-            var height = this.getHeight();\r
+    /**\r
+     * Sets the hidden state of all components using this action.  Shortcut method\r
+     * for <code>{@link #hide}</code> and <code>{@link #show}</code>.\r
+     * @param {Boolean} hidden True to hide the component, false to show it\r
+     */\r
+    setHidden : function(v){\r
+        this.initialConfig.hidden = v;\r
+        this.callEach('setVisible', [!v]);\r
+    },\r
 \r
-            arguments.callee.anim = this.fxanim({\r
-                    width : {to: this.adjustWidth(width * 2)},\r
-                    height : {to: this.adjustHeight(height * 2)},\r
-                    points : {by: [-(width * .5), -(height * .5)]},\r
-                    opacity : {to: 0},\r
-                    fontSize: {to:200, unit: "%"}\r
-                },\r
-                o,\r
-                'motion',\r
-                .5,\r
-                "easeOut", after);\r
-        });\r
-        return this;\r
+    /**\r
+     * Shows all components using this action.\r
+     */\r
+    show : function(){\r
+        this.setHidden(false);\r
     },\r
 \r
-       \r
-    switchOff : function(o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
+    /**\r
+     * Hides all components using this action.\r
+     */\r
+    hide : function(){\r
+        this.setHidden(true);\r
+    },\r
 \r
-        el.queueFx(o, function(){\r
-            this.clearOpacity();\r
-            this.clip();\r
+    /**\r
+     * Returns true if the components using this action are currently hidden, else returns false.  \r
+     */\r
+    isHidden : function(){\r
+        return this.initialConfig.hidden;\r
+    },\r
 \r
-            // restore values after effect\r
-            var r = this.getFxRestore();\r
-            var st = this.dom.style;\r
+    /**\r
+     * Sets the function that will be called by each component using this action when its primary event is triggered.\r
+     * @param {Function} fn The function that will be invoked by the action's components.  The function\r
+     * will be called with no arguments.\r
+     * @param {Object} scope The scope in which the function will execute\r
+     */\r
+    setHandler : function(fn, scope){\r
+        this.initialConfig.handler = fn;\r
+        this.initialConfig.scope = scope;\r
+        this.callEach('setHandler', [fn, scope]);\r
+    },\r
 \r
-            var after = function(){\r
-                if(o.useDisplay){\r
-                    el.setDisplayed(false);\r
-                }else{\r
-                    el.hide();\r
-                }\r
+    /**\r
+     * Executes the specified function once for each component currently tied to this action.  The function passed\r
+     * in should accept a single argument that will be an object that supports the basic Action config/method interface.\r
+     * @param {Function} fn The function to execute for each component\r
+     * @param {Object} scope The scope in which the function will execute\r
+     */\r
+    each : function(fn, scope){\r
+        Ext.each(this.items, fn, scope);\r
+    },\r
 \r
-                el.clearOpacity();\r
-                el.setPositioning(r.pos);\r
-                st.width = r.width;\r
-                st.height = r.height;\r
+    // private\r
+    callEach : function(fnName, args){\r
+        var cs = this.items;\r
+        for(var i = 0, len = cs.length; i < len; i++){\r
+            cs[i][fnName].apply(cs[i], args);\r
+        }\r
+    },\r
 \r
-                el.afterFx(o);\r
-            };\r
+    // private\r
+    addComponent : function(comp){\r
+        this.items.push(comp);\r
+        comp.on('destroy', this.removeComponent, this);\r
+    },\r
 \r
-            this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){\r
-                this.clearOpacity();\r
-                (function(){\r
-                    this.fxanim({\r
-                        height:{to:1},\r
-                        points:{by:[0, this.getHeight() * .5]}\r
-                    }, o, 'motion', 0.3, 'easeIn', after);\r
-                }).defer(100, this);\r
-            });\r
-        });\r
-        return this;\r
+    // private\r
+    removeComponent : function(comp){\r
+        this.items.remove(comp);\r
     },\r
 \r
-       \r
-    highlight : function(color, o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
+    /**\r
+     * Executes this action manually using the handler function specified in the original config object\r
+     * or the handler function set with <code>{@link #setHandler}</code>.  Any arguments passed to this\r
+     * function will be passed on to the handler function.\r
+     * @param {Mixed} arg1 (optional) Variable number of arguments passed to the handler function\r
+     * @param {Mixed} arg2 (optional)\r
+     * @param {Mixed} etc... (optional)\r
+     */\r
+    execute : function(){\r
+        this.initialConfig.handler.apply(this.initialConfig.scope || window, arguments);\r
+    }\r
+};
+/**
+ * @class Ext.Layer
+ * @extends Ext.Element
+ * An extended {@link Ext.Element} object that supports a shadow and shim, constrain to viewport and
+ * automatic maintaining of shadow/shim positions.
+ * @cfg {Boolean} shim False to disable the iframe shim in browsers which need one (defaults to true)
+ * @cfg {String/Boolean} shadow True to automatically create an {@link Ext.Shadow}, or a string indicating the
+ * shadow's display {@link Ext.Shadow#mode}. False to disable the shadow. (defaults to false)
+ * @cfg {Object} dh DomHelper object config to create element with (defaults to {tag: 'div', cls: 'x-layer'}).
+ * @cfg {Boolean} constrain False to disable constrain to viewport (defaults to true)
+ * @cfg {String} cls CSS class to add to the element
+ * @cfg {Number} zindex Starting z-index (defaults to 11000)
+ * @cfg {Number} shadowOffset Number of pixels to offset the shadow (defaults to 4)
+ * @cfg {Boolean} useDisplay
+ * Defaults to use css offsets to hide the Layer. Specify <tt>true</tt>
+ * to use css style <tt>'display:none;'</tt> to hide the Layer.
+ * @constructor
+ * @param {Object} config An object with config options.
+ * @param {String/HTMLElement} existingEl (optional) Uses an existing DOM element. If the element is not found it creates it.
+ */
+(function(){
+Ext.Layer = function(config, existingEl){
+    config = config || {};
+    var dh = Ext.DomHelper;
+    var cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body;
+    if(existingEl){
+        this.dom = Ext.getDom(existingEl);
+    }
+    if(!this.dom){
+        var o = config.dh || {tag: 'div', cls: 'x-layer'};
+        this.dom = dh.append(pel, o);
+    }
+    if(config.cls){
+        this.addClass(config.cls);
+    }
+    this.constrain = config.constrain !== false;
+    this.setVisibilityMode(Ext.Element.VISIBILITY);
+    if(config.id){
+        this.id = this.dom.id = config.id;
+    }else{
+        this.id = Ext.id(this.dom);
+    }
+    this.zindex = config.zindex || this.getZIndex();
+    this.position('absolute', this.zindex);
+    if(config.shadow){
+        this.shadowOffset = config.shadowOffset || 4;
+        this.shadow = new Ext.Shadow({
+            offset : this.shadowOffset,
+            mode : config.shadow
+        });
+    }else{
+        this.shadowOffset = 0;
+    }
+    this.useShim = config.shim !== false && Ext.useShims;
+    this.useDisplay = config.useDisplay;
+    this.hide();
+};
+
+var supr = Ext.Element.prototype;
+
+// shims are shared among layer to keep from having 100 iframes
+var shims = [];
+
+Ext.extend(Ext.Layer, Ext.Element, {
+
+    getZIndex : function(){
+        return this.zindex || parseInt((this.getShim() || this).getStyle('z-index'), 10) || 11000;
+    },
+
+    getShim : function(){
+        if(!this.useShim){
+            return null;
+        }
+        if(this.shim){
+            return this.shim;
+        }
+        var shim = shims.shift();
+        if(!shim){
+            shim = this.createShim();
+            shim.enableDisplayMode('block');
+            shim.dom.style.display = 'none';
+            shim.dom.style.visibility = 'visible';
+        }
+        var pn = this.dom.parentNode;
+        if(shim.dom.parentNode != pn){
+            pn.insertBefore(shim.dom, this.dom);
+        }
+        shim.setStyle('z-index', this.getZIndex()-2);
+        this.shim = shim;
+        return shim;
+    },
+
+    hideShim : function(){
+        if(this.shim){
+            this.shim.setDisplayed(false);
+            shims.push(this.shim);
+            delete this.shim;
+        }
+    },
+
+    disableShadow : function(){
+        if(this.shadow){
+            this.shadowDisabled = true;
+            this.shadow.hide();
+            this.lastShadowOffset = this.shadowOffset;
+            this.shadowOffset = 0;
+        }
+    },
+
+    enableShadow : function(show){
+        if(this.shadow){
+            this.shadowDisabled = false;
+            this.shadowOffset = this.lastShadowOffset;
+            delete this.lastShadowOffset;
+            if(show){
+                this.sync(true);
+            }
+        }
+    },
+
+    // private
+    // this code can execute repeatedly in milliseconds (i.e. during a drag) so
+    // code size was sacrificed for effeciency (e.g. no getBox/setBox, no XY calls)
+    sync : function(doShow){
+        var sw = this.shadow;
+        if(!this.updating && this.isVisible() && (sw || this.useShim)){
+            var sh = this.getShim();
+
+            var w = this.getWidth(),
+                h = this.getHeight();
+
+            var l = this.getLeft(true),
+                t = this.getTop(true);
+
+            if(sw && !this.shadowDisabled){
+                if(doShow && !sw.isVisible()){
+                    sw.show(this);
+                }else{
+                    sw.realign(l, t, w, h);
+                }
+                if(sh){
+                    if(doShow){
+                       sh.show();
+                    }
+                    // fit the shim behind the shadow, so it is shimmed too
+                    var a = sw.adjusts, s = sh.dom.style;
+                    s.left = (Math.min(l, l+a.l))+'px';
+                    s.top = (Math.min(t, t+a.t))+'px';
+                    s.width = (w+a.w)+'px';
+                    s.height = (h+a.h)+'px';
+                }
+            }else if(sh){
+                if(doShow){
+                   sh.show();
+                }
+                sh.setSize(w, h);
+                sh.setLeftTop(l, t);
+            }
+
+        }
+    },
+
+    // private
+    destroy : function(){
+        this.hideShim();
+        if(this.shadow){
+            this.shadow.hide();
+        }
+        this.removeAllListeners();
+        Ext.removeNode(this.dom);
+        Ext.Element.uncache(this.id);
+    },
+
+    remove : function(){
+        this.destroy();
+    },
+
+    // private
+    beginUpdate : function(){
+        this.updating = true;
+    },
+
+    // private
+    endUpdate : function(){
+        this.updating = false;
+        this.sync(true);
+    },
+
+    // private
+    hideUnders : function(negOffset){
+        if(this.shadow){
+            this.shadow.hide();
+        }
+        this.hideShim();
+    },
+
+    // private
+    constrainXY : function(){
+        if(this.constrain){
+            var vw = Ext.lib.Dom.getViewWidth(),
+                vh = Ext.lib.Dom.getViewHeight();
+            var s = Ext.getDoc().getScroll();
+
+            var xy = this.getXY();
+            var x = xy[0], y = xy[1];
+            var so = this.shadowOffset;
+            var w = this.dom.offsetWidth+so, h = this.dom.offsetHeight+so;
+            // only move it if it needs it
+            var moved = false;
+            // first validate right/bottom
+            if((x + w) > vw+s.left){
+                x = vw - w - so;
+                moved = true;
+            }
+            if((y + h) > vh+s.top){
+                y = vh - h - so;
+                moved = true;
+            }
+            // then make sure top/left isn't negative
+            if(x < s.left){
+                x = s.left;
+                moved = true;
+            }
+            if(y < s.top){
+                y = s.top;
+                moved = true;
+            }
+            if(moved){
+                if(this.avoidY){
+                    var ay = this.avoidY;
+                    if(y <= ay && (y+h) >= ay){
+                        y = ay-h-5;
+                    }
+                }
+                xy = [x, y];
+                this.storeXY(xy);
+                supr.setXY.call(this, xy);
+                this.sync();
+            }
+        }
+        return this;
+    },
+
+    isVisible : function(){
+        return this.visible;
+    },
+
+    // private
+    showAction : function(){
+        this.visible = true; // track visibility to prevent getStyle calls
+        if(this.useDisplay === true){
+            this.setDisplayed('');
+        }else if(this.lastXY){
+            supr.setXY.call(this, this.lastXY);
+        }else if(this.lastLT){
+            supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]);
+        }
+    },
+
+    // private
+    hideAction : function(){
+        this.visible = false;
+        if(this.useDisplay === true){
+            this.setDisplayed(false);
+        }else{
+            this.setLeftTop(-10000,-10000);
+        }
+    },
+
+    // overridden Element method
+    setVisible : function(v, a, d, c, e){
+        if(v){
+            this.showAction();
+        }
+        if(a && v){
+            var cb = function(){
+                this.sync(true);
+                if(c){
+                    c();
+                }
+            }.createDelegate(this);
+            supr.setVisible.call(this, true, true, d, cb, e);
+        }else{
+            if(!v){
+                this.hideUnders(true);
+            }
+            var cb = c;
+            if(a){
+                cb = function(){
+                    this.hideAction();
+                    if(c){
+                        c();
+                    }
+                }.createDelegate(this);
+            }
+            supr.setVisible.call(this, v, a, d, cb, e);
+            if(v){
+                this.sync(true);
+            }else if(!a){
+                this.hideAction();
+            }
+        }
+        return this;
+    },
+
+    storeXY : function(xy){
+        delete this.lastLT;
+        this.lastXY = xy;
+    },
+
+    storeLeftTop : function(left, top){
+        delete this.lastXY;
+        this.lastLT = [left, top];
+    },
+
+    // private
+    beforeFx : function(){
+        this.beforeAction();
+        return Ext.Layer.superclass.beforeFx.apply(this, arguments);
+    },
+
+    // private
+    afterFx : function(){
+        Ext.Layer.superclass.afterFx.apply(this, arguments);
+        this.sync(this.isVisible());
+    },
+
+    // private
+    beforeAction : function(){
+        if(!this.updating && this.shadow){
+            this.shadow.hide();
+        }
+    },
+
+    // overridden Element method
+    setLeft : function(left){
+        this.storeLeftTop(left, this.getTop(true));
+        supr.setLeft.apply(this, arguments);
+        this.sync();
+        return this;
+    },
+
+    setTop : function(top){
+        this.storeLeftTop(this.getLeft(true), top);
+        supr.setTop.apply(this, arguments);
+        this.sync();
+        return this;
+    },
+
+    setLeftTop : function(left, top){
+        this.storeLeftTop(left, top);
+        supr.setLeftTop.apply(this, arguments);
+        this.sync();
+        return this;
+    },
+
+    setXY : function(xy, a, d, c, e){
+        this.fixDisplay();
+        this.beforeAction();
+        this.storeXY(xy);
+        var cb = this.createCB(c);
+        supr.setXY.call(this, xy, a, d, cb, e);
+        if(!a){
+            cb();
+        }
+        return this;
+    },
+
+    // private
+    createCB : function(c){
+        var el = this;
+        return function(){
+            el.constrainXY();
+            el.sync(true);
+            if(c){
+                c();
+            }
+        };
+    },
+
+    // overridden Element method
+    setX : function(x, a, d, c, e){
+        this.setXY([x, this.getY()], a, d, c, e);
+        return this;
+    },
+
+    // overridden Element method
+    setY : function(y, a, d, c, e){
+        this.setXY([this.getX(), y], a, d, c, e);
+        return this;
+    },
+
+    // overridden Element method
+    setSize : function(w, h, a, d, c, e){
+        this.beforeAction();
+        var cb = this.createCB(c);
+        supr.setSize.call(this, w, h, a, d, cb, e);
+        if(!a){
+            cb();
+        }
+        return this;
+    },
+
+    // overridden Element method
+    setWidth : function(w, a, d, c, e){
+        this.beforeAction();
+        var cb = this.createCB(c);
+        supr.setWidth.call(this, w, a, d, cb, e);
+        if(!a){
+            cb();
+        }
+        return this;
+    },
+
+    // overridden Element method
+    setHeight : function(h, a, d, c, e){
+        this.beforeAction();
+        var cb = this.createCB(c);
+        supr.setHeight.call(this, h, a, d, cb, e);
+        if(!a){
+            cb();
+        }
+        return this;
+    },
+
+    // overridden Element method
+    setBounds : function(x, y, w, h, a, d, c, e){
+        this.beforeAction();
+        var cb = this.createCB(c);
+        if(!a){
+            this.storeXY([x, y]);
+            supr.setXY.call(this, [x, y]);
+            supr.setSize.call(this, w, h, a, d, cb, e);
+            cb();
+        }else{
+            supr.setBounds.call(this, x, y, w, h, a, d, cb, e);
+        }
+        return this;
+    },
+
+    /**
+     * Sets the z-index of this layer and adjusts any shadow and shim z-indexes. The layer z-index is automatically
+     * incremented by two more than the value passed in so that it always shows above any shadow or shim (the shadow
+     * element, if any, will be assigned z-index + 1, and the shim element, if any, will be assigned the unmodified z-index).
+     * @param {Number} zindex The new z-index to set
+     * @return {this} The Layer
+     */
+    setZIndex : function(zindex){
+        this.zindex = zindex;
+        this.setStyle('z-index', zindex + 2);
+        if(this.shadow){
+            this.shadow.setZIndex(zindex + 1);
+        }
+        if(this.shim){
+            this.shim.setStyle('z-index', zindex);
+        }
+        return this;
+    }
+});
+})();/**
+ * @class Ext.Shadow
+ * Simple class that can provide a shadow effect for any element.  Note that the element MUST be absolutely positioned,
+ * and the shadow does not provide any shimming.  This should be used only in simple cases -- for more advanced
+ * functionality that can also provide the same shadow effect, see the {@link Ext.Layer} class.
+ * @constructor
+ * Create a new Shadow
+ * @param {Object} config The config object
+ */
+Ext.Shadow = function(config){
+    Ext.apply(this, config);
+    if(typeof this.mode != "string"){
+        this.mode = this.defaultMode;
+    }
+    var o = this.offset, a = {h: 0};
+    var rad = Math.floor(this.offset/2);
+    switch(this.mode.toLowerCase()){ // all this hideous nonsense calculates the various offsets for shadows
+        case "drop":
+            a.w = 0;
+            a.l = a.t = o;
+            a.t -= 1;
+            if(Ext.isIE){
+                a.l -= this.offset + rad;
+                a.t -= this.offset + rad;
+                a.w -= rad;
+                a.h -= rad;
+                a.t += 1;
+            }
+        break;
+        case "sides":
+            a.w = (o*2);
+            a.l = -o;
+            a.t = o-1;
+            if(Ext.isIE){
+                a.l -= (this.offset - rad);
+                a.t -= this.offset + rad;
+                a.l += 1;
+                a.w -= (this.offset - rad)*2;
+                a.w -= rad + 1;
+                a.h -= 1;
+            }
+        break;
+        case "frame":
+            a.w = a.h = (o*2);
+            a.l = a.t = -o;
+            a.t += 1;
+            a.h -= 2;
+            if(Ext.isIE){
+                a.l -= (this.offset - rad);
+                a.t -= (this.offset - rad);
+                a.l += 1;
+                a.w -= (this.offset + rad + 1);
+                a.h -= (this.offset + rad);
+                a.h += 1;
+            }
+        break;
+    };
+
+    this.adjusts = a;
+};
+
+Ext.Shadow.prototype = {
+    /**
+     * @cfg {String} mode
+     * The shadow display mode.  Supports the following options:<div class="mdetail-params"><ul>
+     * <li><b><tt>sides</tt></b> : Shadow displays on both sides and bottom only</li>
+     * <li><b><tt>frame</tt></b> : Shadow displays equally on all four sides</li>
+     * <li><b><tt>drop</tt></b> : Traditional bottom-right drop shadow</li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {String} offset
+     * The number of pixels to offset the shadow from the element (defaults to <tt>4</tt>)
+     */
+    offset: 4,
+
+    // private
+    defaultMode: "drop",
+
+    /**
+     * Displays the shadow under the target element
+     * @param {Mixed} targetEl The id or element under which the shadow should display
+     */
+    show : function(target){
+        target = Ext.get(target);
+        if(!this.el){
+            this.el = Ext.Shadow.Pool.pull();
+            if(this.el.dom.nextSibling != target.dom){
+                this.el.insertBefore(target);
+            }
+        }
+        this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);
+        if(Ext.isIE){
+            this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";
+        }
+        this.realign(
+            target.getLeft(true),
+            target.getTop(true),
+            target.getWidth(),
+            target.getHeight()
+        );
+        this.el.dom.style.display = "block";
+    },
+
+    /**
+     * Returns true if the shadow is visible, else false
+     */
+    isVisible : function(){
+        return this.el ? true : false;  
+    },
+
+    /**
+     * Direct alignment when values are already available. Show must be called at least once before
+     * calling this method to ensure it is initialized.
+     * @param {Number} left The target element left position
+     * @param {Number} top The target element top position
+     * @param {Number} width The target element width
+     * @param {Number} height The target element height
+     */
+    realign : function(l, t, w, h){
+        if(!this.el){
+            return;
+        }
+        var a = this.adjusts, d = this.el.dom, s = d.style;
+        var iea = 0;
+        s.left = (l+a.l)+"px";
+        s.top = (t+a.t)+"px";
+        var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";
+        if(s.width != sws || s.height != shs){
+            s.width = sws;
+            s.height = shs;
+            if(!Ext.isIE){
+                var cn = d.childNodes;
+                var sww = Math.max(0, (sw-12))+"px";
+                cn[0].childNodes[1].style.width = sww;
+                cn[1].childNodes[1].style.width = sww;
+                cn[2].childNodes[1].style.width = sww;
+                cn[1].style.height = Math.max(0, (sh-12))+"px";
+            }
+        }
+    },
+
+    /**
+     * Hides this shadow
+     */
+    hide : function(){
+        if(this.el){
+            this.el.dom.style.display = "none";
+            Ext.Shadow.Pool.push(this.el);
+            delete this.el;
+        }
+    },
+
+    /**
+     * Adjust the z-index of this shadow
+     * @param {Number} zindex The new z-index
+     */
+    setZIndex : function(z){
+        this.zIndex = z;
+        if(this.el){
+            this.el.setStyle("z-index", z);
+        }
+    }
+};
+
+// Private utility class that manages the internal Shadow cache
+Ext.Shadow.Pool = function(){
+    var p = [];
+    var markup = Ext.isIE ?
+                 '<div class="x-ie-shadow"></div>' :
+                 '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';
+    return {
+        pull : function(){
+            var sh = p.shift();
+            if(!sh){
+                sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));
+                sh.autoBoxAdjust = false;
+            }
+            return sh;
+        },
+
+        push : function(sh){
+            p.push(sh);
+        }
+    };
+}();/**
+ * @class Ext.BoxComponent
+ * @extends Ext.Component
+ * <p>Base class for any {@link Ext.Component Component} that is to be sized as a box, using width and height.</p>
+ * <p>BoxComponent provides automatic box model adjustments for sizing and positioning and will work correctly
+ * within the Component rendering model.</p>
+ * <p>A BoxComponent may be created as a custom Component which encapsulates any HTML element, either a pre-existing
+ * element, or one that is created to your specifications at render time. Usually, to participate in layouts,
+ * a Component will need to be a <b>Box</b>Component in order to have its width and height managed.</p>
+ * <p>To use a pre-existing element as a BoxComponent, configure it so that you preset the <b>el</b> property to the
+ * element to reference:<pre><code>
+var pageHeader = new Ext.BoxComponent({
+    el: 'my-header-div'
+});</code></pre>
+ * This may then be {@link Ext.Container#add added} to a {@link Ext.Container Container} as a child item.</p>
+ * <p>To create a BoxComponent based around a HTML element to be created at render time, use the
+ * {@link Ext.Component#autoEl autoEl} config option which takes the form of a
+ * {@link Ext.DomHelper DomHelper} specification:<pre><code>
+var myImage = new Ext.BoxComponent({
+    autoEl: {
+        tag: 'img',
+        src: '/images/my-image.jpg'
+    }
+});</code></pre></p>
+ * @constructor
+ * @param {Ext.Element/String/Object} config The configuration options.
+ * @xtype box
+ */
+Ext.BoxComponent = Ext.extend(Ext.Component, {
+
+    // Configs below are used for all Components when rendered by BorderLayout.
+    /**
+     * @cfg {String} region <p><b>Note</b>: this config is only used when this BoxComponent is rendered
+     * by a Container which has been configured to use the <b>{@link Ext.layout.BorderLayout BorderLayout}</b>
+     * layout manager (e.g. specifying <tt>layout:'border'</tt>).</p><br>
+     * <p>See {@link Ext.layout.BorderLayout} also.</p>
+     */
+    // margins config is used when a BoxComponent is rendered by BorderLayout or BoxLayout.
+    /**
+     * @cfg {Object} margins <p><b>Note</b>: this config is only used when this BoxComponent is rendered
+     * by a Container which has been configured to use the <b>{@link Ext.layout.BorderLayout BorderLayout}</b>
+     * or one of the two <b>{@link Ext.layout.BoxLayout BoxLayout} subclasses.</b></p>
+     * <p>An object containing margins to apply to this BoxComponent in the
+     * format:</p><pre><code>
+{
+    top: (top margin),
+    right: (right margin),
+    bottom: (bottom margin),
+    left: (left margin)
+}</code></pre>
+     * <p>May also be a string containing space-separated, numeric margin values. The order of the
+     * sides associated with each value matches the way CSS processes margin values:</p>
+     * <p><div class="mdetail-params"><ul>
+     * <li>If there is only one value, it applies to all sides.</li>
+     * <li>If there are two values, the top and bottom borders are set to the first value and the
+     * right and left are set to the second.</li>
+     * <li>If there are three values, the top is set to the first value, the left and right are set
+     * to the second, and the bottom is set to the third.</li>
+     * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
+     * </ul></div></p>
+     * <p>Defaults to:</p><pre><code>
+     * {top:0, right:0, bottom:0, left:0}
+     * </code></pre>
+     */
+    /**
+     * @cfg {Number} x
+     * The local x (left) coordinate for this component if contained within a positioning container.
+     */
+    /**
+     * @cfg {Number} y
+     * The local y (top) coordinate for this component if contained within a positioning container.
+     */
+    /**
+     * @cfg {Number} pageX
+     * The page level x coordinate for this component if contained within a positioning container.
+     */
+    /**
+     * @cfg {Number} pageY
+     * The page level y coordinate for this component if contained within a positioning container.
+     */
+    /**
+     * @cfg {Number} height
+     * The height of this component in pixels (defaults to auto).
+     * <b>Note</b> to express this dimension as a percentage or offset see {@link Ext.Component#anchor}.
+     */
+    /**
+     * @cfg {Number} width
+     * The width of this component in pixels (defaults to auto).
+     * <b>Note</b> to express this dimension as a percentage or offset see {@link Ext.Component#anchor}.
+     */
+    /**
+     * @cfg {Boolean} autoHeight
+     * <p>True to use height:'auto', false to use fixed height (or allow it to be managed by its parent
+     * Container's {@link Ext.Container#layout layout manager}. Defaults to false.</p>
+     * <p><b>Note</b>: Although many components inherit this config option, not all will
+     * function as expected with a height of 'auto'. Setting autoHeight:true means that the
+     * browser will manage height based on the element's contents, and that Ext will not manage it at all.</p>
+     * <p>If the <i>browser</i> is managing the height, be aware that resizes performed by the browser in response
+     * to changes within the structure of the Component cannot be detected. Therefore changes to the height might
+     * result in elements needing to be synchronized with the new height. Example:</p><pre><code>
+var w = new Ext.Window({
+    title: 'Window',
+    width: 600,
+    autoHeight: true,
+    items: {
+        title: 'Collapse Me',
+        height: 400,
+        collapsible: true,
+        border: false,
+        listeners: {
+            beforecollapse: function() {
+                w.el.shadow.hide();
+            },
+            beforeexpand: function() {
+                w.el.shadow.hide();
+            },
+            collapse: function() {
+                w.syncShadow();
+            },
+            expand: function() {
+                w.syncShadow();
+            }
+        }
+    }
+}).show();
+</code></pre>
+     */
+    /**
+     * @cfg {Boolean} autoWidth
+     * <p>True to use width:'auto', false to use fixed width (or allow it to be managed by its parent
+     * Container's {@link Ext.Container#layout layout manager}. Defaults to false.</p>
+     * <p><b>Note</b>: Although many components  inherit this config option, not all will
+     * function as expected with a width of 'auto'. Setting autoWidth:true means that the
+     * browser will manage width based on the element's contents, and that Ext will not manage it at all.</p>
+     * <p>If the <i>browser</i> is managing the width, be aware that resizes performed by the browser in response
+     * to changes within the structure of the Component cannot be detected. Therefore changes to the width might
+     * result in elements needing to be synchronized with the new width. For example, where the target element is:</p><pre><code>
+&lt;div id='grid-container' style='margin-left:25%;width:50%'>&lt;/div>
+</code></pre>
+     * A Panel rendered into that target element must listen for browser window resize in order to relay its
+      * child items when the browser changes its width:<pre><code>
+var myPanel = new Ext.Panel({
+    renderTo: 'grid-container',
+    monitorResize: true, // relay on browser resize
+    title: 'Panel',
+    height: 400,
+    autoWidth: true,
+    layout: 'hbox',
+    layoutConfig: {
+        align: 'stretch'
+    },
+    defaults: {
+        flex: 1
+    },
+    items: [{
+        title: 'Box 1',
+    }, {
+        title: 'Box 2'
+    }, {
+        title: 'Box 3'
+    }],
+});
+</code></pre>
+     */
+
+    /* // private internal config
+     * {Boolean} deferHeight
+     * True to defer height calculations to an external component, false to allow this component to set its own
+     * height (defaults to false).
+     */
+
+    // private
+    initComponent : function(){
+        Ext.BoxComponent.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event resize
+             * Fires after the component is resized.
+             * @param {Ext.Component} this
+             * @param {Number} adjWidth The box-adjusted width that was set
+             * @param {Number} adjHeight The box-adjusted height that was set
+             * @param {Number} rawWidth The width that was originally specified
+             * @param {Number} rawHeight The height that was originally specified
+             */
+            'resize',
+            /**
+             * @event move
+             * Fires after the component is moved.
+             * @param {Ext.Component} this
+             * @param {Number} x The new x position
+             * @param {Number} y The new y position
+             */
+            'move'
+        );
+    },
+
+    // private, set in afterRender to signify that the component has been rendered
+    boxReady : false,
+    // private, used to defer height settings to subclasses
+    deferHeight: false,
+
+    /**
+     * Sets the width and height of this BoxComponent. This method fires the {@link #resize} event. This method can accept
+     * either width and height as separate arguments, or you can pass a size object like <code>{width:10, height:20}</code>.
+     * @param {Mixed} width The new width to set. This may be one of:<div class="mdetail-params"><ul>
+     * <li>A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).</li>
+     * <li>A String used to set the CSS width style.</li>
+     * <li>A size object in the format <code>{width: widthValue, height: heightValue}</code>.</li>
+     * <li><code>undefined</code> to leave the width unchanged.</li>
+     * </ul></div>
+     * @param {Mixed} height The new height to set (not required if a size object is passed as the first arg).
+     * This may be one of:<div class="mdetail-params"><ul>
+     * <li>A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).</li>
+     * <li>A String used to set the CSS height style. Animation may <b>not</b> be used.</li>
+     * <li><code>undefined</code> to leave the height unchanged.</li>
+     * </ul></div>
+     * @return {Ext.BoxComponent} this
+     */
+    setSize : function(w, h){
+        // support for standard size objects
+        if(typeof w == 'object'){
+            h = w.height;
+            w = w.width;
+        }
+        // not rendered
+        if(!this.boxReady){
+            this.width = w;
+            this.height = h;
+            return this;
+        }
+
+        // prevent recalcs when not needed
+        if(this.cacheSizes !== false && this.lastSize && this.lastSize.width == w && this.lastSize.height == h){
+            return this;
+        }
+        this.lastSize = {width: w, height: h};
+        var adj = this.adjustSize(w, h);
+        var aw = adj.width, ah = adj.height;
+        if(aw !== undefined || ah !== undefined){ // this code is nasty but performs better with floaters
+            var rz = this.getResizeEl();
+            if(!this.deferHeight && aw !== undefined && ah !== undefined){
+                rz.setSize(aw, ah);
+            }else if(!this.deferHeight && ah !== undefined){
+                rz.setHeight(ah);
+            }else if(aw !== undefined){
+                rz.setWidth(aw);
+            }
+            this.onResize(aw, ah, w, h);
+            this.fireEvent('resize', this, aw, ah, w, h);
+        }
+        return this;
+    },
+
+    /**
+     * Sets the width of the component.  This method fires the {@link #resize} event.
+     * @param {Number} width The new width to setThis may be one of:<div class="mdetail-params"><ul>
+     * <li>A Number specifying the new width in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).</li>
+     * <li>A String used to set the CSS width style.</li>
+     * </ul></div>
+     * @return {Ext.BoxComponent} this
+     */
+    setWidth : function(width){
+        return this.setSize(width);
+    },
+
+    /**
+     * Sets the height of the component.  This method fires the {@link #resize} event.
+     * @param {Number} height The new height to set. This may be one of:<div class="mdetail-params"><ul>
+     * <li>A Number specifying the new height in the {@link #getEl Element}'s {@link Ext.Element#defaultUnit}s (by default, pixels).</li>
+     * <li>A String used to set the CSS height style.</li>
+     * <li><i>undefined</i> to leave the height unchanged.</li>
+     * </ul></div>
+     * @return {Ext.BoxComponent} this
+     */
+    setHeight : function(height){
+        return this.setSize(undefined, height);
+    },
+
+    /**
+     * Gets the current size of the component's underlying element.
+     * @return {Object} An object containing the element's size {width: (element width), height: (element height)}
+     */
+    getSize : function(){
+        return this.getResizeEl().getSize();
+    },
+
+    /**
+     * Gets the current width of the component's underlying element.
+     * @return {Number}
+     */
+    getWidth : function(){
+        return this.getResizeEl().getWidth();
+    },
+
+    /**
+     * Gets the current height of the component's underlying element.
+     * @return {Number}
+     */
+    getHeight : function(){
+        return this.getResizeEl().getHeight();
+    },
+
+    /**
+     * Gets the current size of the component's underlying element, including space taken by its margins.
+     * @return {Object} An object containing the element's size {width: (element width + left/right margins), height: (element height + top/bottom margins)}
+     */
+    getOuterSize : function(){
+        var el = this.getResizeEl();
+        return {width: el.getWidth() + el.getMargins('lr'),
+                height: el.getHeight() + el.getMargins('tb')};
+    },
+
+    /**
+     * Gets the current XY position of the component's underlying element.
+     * @param {Boolean} local (optional) If true the element's left and top are returned instead of page XY (defaults to false)
+     * @return {Array} The XY position of the element (e.g., [100, 200])
+     */
+    getPosition : function(local){
+        var el = this.getPositionEl();
+        if(local === true){
+            return [el.getLeft(true), el.getTop(true)];
+        }
+        return this.xy || el.getXY();
+    },
+
+    /**
+     * Gets the current box measurements of the component's underlying element.
+     * @param {Boolean} local (optional) If true the element's left and top are returned instead of page XY (defaults to false)
+     * @return {Object} box An object in the format {x, y, width, height}
+     */
+    getBox : function(local){
+        var pos = this.getPosition(local);
+        var s = this.getSize();
+        s.x = pos[0];
+        s.y = pos[1];
+        return s;
+    },
+
+    /**
+     * Sets the current box measurements of the component's underlying element.
+     * @param {Object} box An object in the format {x, y, width, height}
+     * @return {Ext.BoxComponent} this
+     */
+    updateBox : function(box){
+        this.setSize(box.width, box.height);
+        this.setPagePosition(box.x, box.y);
+        return this;
+    },
+
+    /**
+     * <p>Returns the outermost Element of this Component which defines the Components overall size.</p>
+     * <p><i>Usually</i> this will return the same Element as <code>{@link #getEl}</code>,
+     * but in some cases, a Component may have some more wrapping Elements around its main
+     * active Element.</p>
+     * <p>An example is a ComboBox. It is encased in a <i>wrapping</i> Element which
+     * contains both the <code>&lt;input></code> Element (which is what would be returned
+     * by its <code>{@link #getEl}</code> method, <i>and</i> the trigger button Element.
+     * This Element is returned as the <code>resizeEl</code>.
+     */
+    getResizeEl : function(){
+        return this.resizeEl || this.el;
+    },
+
+    // protected
+    getPositionEl : function(){
+        return this.positionEl || this.el;
+    },
+
+    /**
+     * Sets the left and top of the component.  To set the page XY position instead, use {@link #setPagePosition}.
+     * This method fires the {@link #move} event.
+     * @param {Number} left The new left
+     * @param {Number} top The new top
+     * @return {Ext.BoxComponent} this
+     */
+    setPosition : function(x, y){
+        if(x && typeof x[1] == 'number'){
+            y = x[1];
+            x = x[0];
+        }
+        this.x = x;
+        this.y = y;
+        if(!this.boxReady){
+            return this;
+        }
+        var adj = this.adjustPosition(x, y);
+        var ax = adj.x, ay = adj.y;
+
+        var el = this.getPositionEl();
+        if(ax !== undefined || ay !== undefined){
+            if(ax !== undefined && ay !== undefined){
+                el.setLeftTop(ax, ay);
+            }else if(ax !== undefined){
+                el.setLeft(ax);
+            }else if(ay !== undefined){
+                el.setTop(ay);
+            }
+            this.onPosition(ax, ay);
+            this.fireEvent('move', this, ax, ay);
+        }
+        return this;
+    },
+
+    /**
+     * Sets the page XY position of the component.  To set the left and top instead, use {@link #setPosition}.
+     * This method fires the {@link #move} event.
+     * @param {Number} x The new x position
+     * @param {Number} y The new y position
+     * @return {Ext.BoxComponent} this
+     */
+    setPagePosition : function(x, y){
+        if(x && typeof x[1] == 'number'){
+            y = x[1];
+            x = x[0];
+        }
+        this.pageX = x;
+        this.pageY = y;
+        if(!this.boxReady){
+            return;
+        }
+        if(x === undefined || y === undefined){ // cannot translate undefined points
+            return;
+        }
+        var p = this.getPositionEl().translatePoints(x, y);
+        this.setPosition(p.left, p.top);
+        return this;
+    },
+
+    // private
+    onRender : function(ct, position){
+        Ext.BoxComponent.superclass.onRender.call(this, ct, position);
+        if(this.resizeEl){
+            this.resizeEl = Ext.get(this.resizeEl);
+        }
+        if(this.positionEl){
+            this.positionEl = Ext.get(this.positionEl);
+        }
+    },
+
+    // private
+    afterRender : function(){
+        Ext.BoxComponent.superclass.afterRender.call(this);
+        this.boxReady = true;
+        this.setSize(this.width, this.height);
+        if(this.x || this.y){
+            this.setPosition(this.x, this.y);
+        }else if(this.pageX || this.pageY){
+            this.setPagePosition(this.pageX, this.pageY);
+        }
+    },
+
+    /**
+     * Force the component's size to recalculate based on the underlying element's current height and width.
+     * @return {Ext.BoxComponent} this
+     */
+    syncSize : function(){
+        delete this.lastSize;
+        this.setSize(this.autoWidth ? undefined : this.getResizeEl().getWidth(), this.autoHeight ? undefined : this.getResizeEl().getHeight());
+        return this;
+    },
+
+    /* // protected
+     * Called after the component is resized, this method is empty by default but can be implemented by any
+     * subclass that needs to perform custom logic after a resize occurs.
+     * @param {Number} adjWidth The box-adjusted width that was set
+     * @param {Number} adjHeight The box-adjusted height that was set
+     * @param {Number} rawWidth The width that was originally specified
+     * @param {Number} rawHeight The height that was originally specified
+     */
+    onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){
+
+    },
+
+    /* // protected
+     * Called after the component is moved, this method is empty by default but can be implemented by any
+     * subclass that needs to perform custom logic after a move occurs.
+     * @param {Number} x The new x position
+     * @param {Number} y The new y position
+     */
+    onPosition : function(x, y){
+
+    },
+
+    // private
+    adjustSize : function(w, h){
+        if(this.autoWidth){
+            w = 'auto';
+        }
+        if(this.autoHeight){
+            h = 'auto';
+        }
+        return {width : w, height: h};
+    },
+
+    // private
+    adjustPosition : function(x, y){
+        return {x : x, y: y};
+    }
+});
+Ext.reg('box', Ext.BoxComponent);
+
+
+/**
+ * @class Ext.Spacer
+ * @extends Ext.BoxComponent
+ * <p>Used to provide a sizable space in a layout.</p>
+ * @constructor
+ * @param {Object} config
+ */
+Ext.Spacer = Ext.extend(Ext.BoxComponent, {
+    autoEl:'div'
+});
+Ext.reg('spacer', Ext.Spacer);/**\r
+ * @class Ext.SplitBar\r
+ * @extends Ext.util.Observable\r
+ * Creates draggable splitter bar functionality from two elements (element to be dragged and element to be resized).\r
+ * <br><br>\r
+ * Usage:\r
+ * <pre><code>\r
+var split = new Ext.SplitBar("elementToDrag", "elementToSize",\r
+                   Ext.SplitBar.HORIZONTAL, Ext.SplitBar.LEFT);\r
+split.setAdapter(new Ext.SplitBar.AbsoluteLayoutAdapter("container"));\r
+split.minSize = 100;\r
+split.maxSize = 600;\r
+split.animate = true;\r
+split.on('moved', splitterMoved);\r
+</code></pre>\r
+ * @constructor\r
+ * Create a new SplitBar\r
+ * @param {Mixed} dragElement The element to be dragged and act as the SplitBar.\r
+ * @param {Mixed} resizingElement The element to be resized based on where the SplitBar element is dragged\r
+ * @param {Number} orientation (optional) Either Ext.SplitBar.HORIZONTAL or Ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL)\r
+ * @param {Number} placement (optional) Either Ext.SplitBar.LEFT or Ext.SplitBar.RIGHT for horizontal or  \r
+                        Ext.SplitBar.TOP or Ext.SplitBar.BOTTOM for vertical. (By default, this is determined automatically by the initial\r
+                        position of the SplitBar).\r
+ */\r
+Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){\r
+    \r
+    /** @private */\r
+    this.el = Ext.get(dragElement, true);\r
+    this.el.dom.unselectable = "on";\r
+    /** @private */\r
+    this.resizingEl = Ext.get(resizingElement, true);\r
 \r
-        el.queueFx(o, function(){\r
-            color = color || "ffff9c";\r
-            var attr = o.attr || "backgroundColor";\r
-\r
-            this.clearOpacity();\r
-            this.show();\r
+    /**\r
+     * @private\r
+     * The orientation of the split. Either Ext.SplitBar.HORIZONTAL or Ext.SplitBar.VERTICAL. (Defaults to HORIZONTAL)\r
+     * Note: If this is changed after creating the SplitBar, the placement property must be manually updated\r
+     * @type Number\r
+     */\r
+    this.orientation = orientation || Ext.SplitBar.HORIZONTAL;\r
+    \r
+    /**\r
+     * The increment, in pixels by which to move this SplitBar. When <i>undefined</i>, the SplitBar moves smoothly.\r
+     * @type Number\r
+     * @property tickSize\r
+     */\r
+    /**\r
+     * The minimum size of the resizing element. (Defaults to 0)\r
+     * @type Number\r
+     */\r
+    this.minSize = 0;\r
+    \r
+    /**\r
+     * The maximum size of the resizing element. (Defaults to 2000)\r
+     * @type Number\r
+     */\r
+    this.maxSize = 2000;\r
+    \r
+    /**\r
+     * Whether to animate the transition to the new size\r
+     * @type Boolean\r
+     */\r
+    this.animate = false;\r
+    \r
+    /**\r
+     * Whether to create a transparent shim that overlays the page when dragging, enables dragging across iframes.\r
+     * @type Boolean\r
+     */\r
+    this.useShim = false;\r
+    \r
+    /** @private */\r
+    this.shim = null;\r
+    \r
+    if(!existingProxy){\r
+        /** @private */\r
+        this.proxy = Ext.SplitBar.createProxy(this.orientation);\r
+    }else{\r
+        this.proxy = Ext.get(existingProxy).dom;\r
+    }\r
+    /** @private */\r
+    this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id});\r
+    \r
+    /** @private */\r
+    this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);\r
+    \r
+    /** @private */\r
+    this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);\r
+    \r
+    /** @private */\r
+    this.dragSpecs = {};\r
+    \r
+    /**\r
+     * @private The adapter to use to positon and resize elements\r
+     */\r
+    this.adapter = new Ext.SplitBar.BasicLayoutAdapter();\r
+    this.adapter.init(this);\r
+    \r
+    if(this.orientation == Ext.SplitBar.HORIZONTAL){\r
+        /** @private */\r
+        this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);\r
+        this.el.addClass("x-splitbar-h");\r
+    }else{\r
+        /** @private */\r
+        this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);\r
+        this.el.addClass("x-splitbar-v");\r
+    }\r
+    \r
+    this.addEvents(\r
+        /**\r
+         * @event resize\r
+         * Fires when the splitter is moved (alias for {@link #moved})\r
+         * @param {Ext.SplitBar} this\r
+         * @param {Number} newSize the new width or height\r
+         */\r
+        "resize",\r
+        /**\r
+         * @event moved\r
+         * Fires when the splitter is moved\r
+         * @param {Ext.SplitBar} this\r
+         * @param {Number} newSize the new width or height\r
+         */\r
+        "moved",\r
+        /**\r
+         * @event beforeresize\r
+         * Fires before the splitter is dragged\r
+         * @param {Ext.SplitBar} this\r
+         */\r
+        "beforeresize",\r
 \r
-            var origColor = this.getColor(attr);\r
-            var restoreColor = this.dom.style[attr];\r
-            var endColor = (o.endColor || origColor) || "ffffff";\r
+        "beforeapply"\r
+    );\r
 \r
-            var after = function(){\r
-                el.dom.style[attr] = restoreColor;\r
-                el.afterFx(o);\r
-            };\r
+    Ext.SplitBar.superclass.constructor.call(this);\r
+};\r
 \r
-            var a = {};\r
-            a[attr] = {from: color, to: endColor};\r
-            arguments.callee.anim = this.fxanim(a,\r
-                o,\r
-                'color',\r
-                1,\r
-                'easeIn', after);\r
-        });\r
-        return this;\r
+Ext.extend(Ext.SplitBar, Ext.util.Observable, {\r
+    onStartProxyDrag : function(x, y){\r
+        this.fireEvent("beforeresize", this);\r
+        this.overlay =  Ext.DomHelper.append(document.body,  {cls: "x-drag-overlay", html: "&#160;"}, true);\r
+        this.overlay.unselectable();\r
+        this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));\r
+        this.overlay.show();\r
+        Ext.get(this.proxy).setDisplayed("block");\r
+        var size = this.adapter.getElementSize(this);\r
+        this.activeMinSize = this.getMinimumSize();\r
+        this.activeMaxSize = this.getMaximumSize();\r
+        var c1 = size - this.activeMinSize;\r
+        var c2 = Math.max(this.activeMaxSize - size, 0);\r
+        if(this.orientation == Ext.SplitBar.HORIZONTAL){\r
+            this.dd.resetConstraints();\r
+            this.dd.setXConstraint(\r
+                this.placement == Ext.SplitBar.LEFT ? c1 : c2, \r
+                this.placement == Ext.SplitBar.LEFT ? c2 : c1,\r
+                this.tickSize\r
+            );\r
+            this.dd.setYConstraint(0, 0);\r
+        }else{\r
+            this.dd.resetConstraints();\r
+            this.dd.setXConstraint(0, 0);\r
+            this.dd.setYConstraint(\r
+                this.placement == Ext.SplitBar.TOP ? c1 : c2, \r
+                this.placement == Ext.SplitBar.TOP ? c2 : c1,\r
+                this.tickSize\r
+            );\r
+         }\r
+        this.dragSpecs.startSize = size;\r
+        this.dragSpecs.startPoint = [x, y];\r
+        Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);\r
     },\r
-\r
-   \r
-    frame : function(color, count, o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-\r
-        el.queueFx(o, function(){\r
-            color = color || "#C3DAF9";\r
-            if(color.length == 6){\r
-                color = "#" + color;\r
+    \r
+    /** \r
+     * @private Called after the drag operation by the DDProxy\r
+     */\r
+    onEndProxyDrag : function(e){\r
+        Ext.get(this.proxy).setDisplayed(false);\r
+        var endPoint = Ext.lib.Event.getXY(e);\r
+        if(this.overlay){\r
+            Ext.destroy(this.overlay);\r
+            delete this.overlay;\r
+        }\r
+        var newSize;\r
+        if(this.orientation == Ext.SplitBar.HORIZONTAL){\r
+            newSize = this.dragSpecs.startSize + \r
+                (this.placement == Ext.SplitBar.LEFT ?\r
+                    endPoint[0] - this.dragSpecs.startPoint[0] :\r
+                    this.dragSpecs.startPoint[0] - endPoint[0]\r
+                );\r
+        }else{\r
+            newSize = this.dragSpecs.startSize + \r
+                (this.placement == Ext.SplitBar.TOP ?\r
+                    endPoint[1] - this.dragSpecs.startPoint[1] :\r
+                    this.dragSpecs.startPoint[1] - endPoint[1]\r
+                );\r
+        }\r
+        newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize);\r
+        if(newSize != this.dragSpecs.startSize){\r
+            if(this.fireEvent('beforeapply', this, newSize) !== false){\r
+                this.adapter.setElementSize(this, newSize);\r
+                this.fireEvent("moved", this, newSize);\r
+                this.fireEvent("resize", this, newSize);\r
             }\r
-            count = count || 1;\r
-            var duration = o.duration || 1;\r
-            this.show();\r
-\r
-            var b = this.getBox();\r
-            var animFn = function(){\r
-                var proxy = Ext.getBody().createChild({\r
-                     style:{\r
-                        visbility:"hidden",\r
-                        position:"absolute",\r
-                        "z-index":"35000", // yee haw\r
-                        border:"0px solid " + color\r
-                     }\r
-                  });\r
-                var scale = Ext.isBorderBox ? 2 : 1;\r
-                proxy.animate({\r
-                    top:{from:b.y, to:b.y - 20},\r
-                    left:{from:b.x, to:b.x - 20},\r
-                    borderWidth:{from:0, to:10},\r
-                    opacity:{from:1, to:0},\r
-                    height:{from:b.height, to:(b.height + (20*scale))},\r
-                    width:{from:b.width, to:(b.width + (20*scale))}\r
-                }, duration, function(){\r
-                    proxy.remove();\r
-                    if(--count > 0){\r
-                         animFn();\r
-                    }else{\r
-                        el.afterFx(o);\r
-                    }\r
-                });\r
-            };\r
-            animFn.call(this);\r
-        });\r
-        return this;\r
-    },\r
-\r
-   \r
-    pause : function(seconds){\r
-        var el = this.getFxEl();\r
-        var o = {};\r
-\r
-        el.queueFx(o, function(){\r
-            setTimeout(function(){\r
-                el.afterFx(o);\r
-            }, seconds * 1000);\r
-        });\r
-        return this;\r
+        }\r
     },\r
-\r
-   \r
-    fadeIn : function(o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-        el.queueFx(o, function(){\r
-            this.setOpacity(0);\r
-            this.fixDisplay();\r
-            this.dom.style.visibility = 'visible';\r
-            var to = o.endOpacity || 1;\r
-            arguments.callee.anim = this.fxanim({opacity:{to:to}},\r
-                o, null, .5, "easeOut", function(){\r
-                if(to == 1){\r
-                    this.clearOpacity();\r
-                }\r
-                el.afterFx(o);\r
-            });\r
-        });\r
-        return this;\r
+    \r
+    /**\r
+     * Get the adapter this SplitBar uses\r
+     * @return The adapter object\r
+     */\r
+    getAdapter : function(){\r
+        return this.adapter;\r
     },\r
-\r
-   \r
-    fadeOut : function(o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-        el.queueFx(o, function(){\r
-            var to = o.endOpacity || 0;\r
-            arguments.callee.anim = this.fxanim({opacity:{to:to}},\r
-                o, null, .5, "easeOut", function(){\r
-                if(to === 0){\r
-                    if(this.visibilityMode == Ext.Element.DISPLAY || o.useDisplay){\r
-                         this.dom.style.display = "none";\r
-                    }else{\r
-                         this.dom.style.visibility = "hidden";\r
-                    }\r
-                    this.clearOpacity();\r
-                }\r
-                el.afterFx(o);\r
-            });\r
-        });\r
-        return this;\r
+    \r
+    /**\r
+     * Set the adapter this SplitBar uses\r
+     * @param {Object} adapter A SplitBar adapter object\r
+     */\r
+    setAdapter : function(adapter){\r
+        this.adapter = adapter;\r
+        this.adapter.init(this);\r
     },\r
-\r
-   \r
-    scale : function(w, h, o){\r
-        this.shift(Ext.apply({}, o, {\r
-            width: w,\r
-            height: h\r
-        }));\r
-        return this;\r
+    \r
+    /**\r
+     * Gets the minimum size for the resizing element\r
+     * @return {Number} The minimum size\r
+     */\r
+    getMinimumSize : function(){\r
+        return this.minSize;\r
     },\r
-\r
-   \r
-    shift : function(o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-        el.queueFx(o, function(){\r
-            var a = {}, w = o.width, h = o.height, x = o.x, y = o.y,  op = o.opacity;\r
-            if(w !== undefined){\r
-                a.width = {to: this.adjustWidth(w)};\r
-            }\r
-            if(h !== undefined){\r
-                a.height = {to: this.adjustHeight(h)};\r
-            }\r
-            if(o.left !== undefined){\r
-                a.left = {to: o.left};\r
-            }\r
-            if(o.top !== undefined){\r
-                a.top = {to: o.top};\r
-            }\r
-            if(o.right !== undefined){\r
-                a.right = {to: o.right};\r
-            }\r
-            if(o.bottom !== undefined){\r
-                a.bottom = {to: o.bottom};\r
-            }\r
-            if(x !== undefined || y !== undefined){\r
-                a.points = {to: [\r
-                    x !== undefined ? x : this.getX(),\r
-                    y !== undefined ? y : this.getY()\r
-                ]};\r
-            }\r
-            if(op !== undefined){\r
-                a.opacity = {to: op};\r
-            }\r
-            if(o.xy !== undefined){\r
-                a.points = {to: o.xy};\r
-            }\r
-            arguments.callee.anim = this.fxanim(a,\r
-                o, 'motion', .35, "easeOut", function(){\r
-                el.afterFx(o);\r
-            });\r
-        });\r
-        return this;\r
+    \r
+    /**\r
+     * Sets the minimum size for the resizing element\r
+     * @param {Number} minSize The minimum size\r
+     */\r
+    setMinimumSize : function(minSize){\r
+        this.minSize = minSize;\r
     },\r
-\r
-       \r
-    ghost : function(anchor, o){\r
-        var el = this.getFxEl();\r
-        o = o || {};\r
-\r
-        el.queueFx(o, function(){\r
-            anchor = anchor || "b";\r
-\r
-            // restore values after effect\r
-            var r = this.getFxRestore();\r
-            var w = this.getWidth(),\r
-                h = this.getHeight();\r
-\r
-            var st = this.dom.style;\r
-\r
-            var after = function(){\r
-                if(o.useDisplay){\r
-                    el.setDisplayed(false);\r
-                }else{\r
-                    el.hide();\r
-                }\r
-\r
-                el.clearOpacity();\r
-                el.setPositioning(r.pos);\r
-                st.width = r.width;\r
-                st.height = r.height;\r
-\r
-                el.afterFx(o);\r
-            };\r
-\r
-            var a = {opacity: {to: 0}, points: {}}, pt = a.points;\r
-            switch(anchor.toLowerCase()){\r
-                case "t":\r
-                    pt.by = [0, -h];\r
-                break;\r
-                case "l":\r
-                    pt.by = [-w, 0];\r
-                break;\r
-                case "r":\r
-                    pt.by = [w, 0];\r
-                break;\r
-                case "b":\r
-                    pt.by = [0, h];\r
-                break;\r
-                case "tl":\r
-                    pt.by = [-w, -h];\r
-                break;\r
-                case "bl":\r
-                    pt.by = [-w, h];\r
-                break;\r
-                case "br":\r
-                    pt.by = [w, h];\r
-                break;\r
-                case "tr":\r
-                    pt.by = [w, -h];\r
-                break;\r
-            }\r
-\r
-            arguments.callee.anim = this.fxanim(a,\r
-                o,\r
-                'motion',\r
-                .5,\r
-                "easeOut", after);\r
-        });\r
-        return this;\r
+    \r
+    /**\r
+     * Gets the maximum size for the resizing element\r
+     * @return {Number} The maximum size\r
+     */\r
+    getMaximumSize : function(){\r
+        return this.maxSize;\r
     },\r
-\r
-       \r
-    syncFx : function(){\r
-        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {\r
-            block : false,\r
-            concurrent : true,\r
-            stopFx : false\r
-        });\r
-        return this;\r
+    \r
+    /**\r
+     * Sets the maximum size for the resizing element\r
+     * @param {Number} maxSize The maximum size\r
+     */\r
+    setMaximumSize : function(maxSize){\r
+        this.maxSize = maxSize;\r
     },\r
-\r
-       \r
-    sequenceFx : function(){\r
-        this.fxDefaults = Ext.apply(this.fxDefaults || {}, {\r
-            block : false,\r
-            concurrent : false,\r
-            stopFx : false\r
-        });\r
-        return this;\r
+    \r
+    /**\r
+     * Sets the initialize size for the resizing element\r
+     * @param {Number} size The initial size\r
+     */\r
+    setCurrentSize : function(size){\r
+        var oldAnimate = this.animate;\r
+        this.animate = false;\r
+        this.adapter.setElementSize(this, size);\r
+        this.animate = oldAnimate;\r
     },\r
-\r
-       \r
-    nextFx : function(){\r
-        var ef = this.fxQueue[0];\r
-        if(ef){\r
-            ef.call(this);\r
+    \r
+    /**\r
+     * Destroy this splitbar. \r
+     * @param {Boolean} removeEl True to remove the element\r
+     */\r
+    destroy : function(removeEl){\r
+               Ext.destroy(this.shim, Ext.get(this.proxy));\r
+        this.dd.unreg();\r
+        if(removeEl){\r
+            this.el.remove();\r
         }\r
-    },\r
-\r
-       \r
-    hasActiveFx : function(){\r
-        return this.fxQueue && this.fxQueue[0];\r
-    },\r
+               this.purgeListeners();\r
+    }\r
+});\r
 \r
-       \r
-    stopFx : function(){\r
-        if(this.hasActiveFx()){\r
-            var cur = this.fxQueue[0];\r
-            if(cur && cur.anim && cur.anim.isAnimated()){\r
-                this.fxQueue = [cur]; // clear out others\r
-                cur.anim.stop(true);\r
-            }\r
-        }\r
-        return this;\r
-    },\r
+/**\r
+ * @private static Create our own proxy element element. So it will be the same same size on all browsers, we won't use borders. Instead we use a background color.\r
+ */\r
+Ext.SplitBar.createProxy = function(dir){\r
+    var proxy = new Ext.Element(document.createElement("div"));\r
+    proxy.unselectable();\r
+    var cls = 'x-splitbar-proxy';\r
+    proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v'));\r
+    document.body.appendChild(proxy.dom);\r
+    return proxy.dom;\r
+};\r
 \r
-       \r
-    beforeFx : function(o){\r
-        if(this.hasActiveFx() && !o.concurrent){\r
-           if(o.stopFx){\r
-               this.stopFx();\r
-               return true;\r
-           }\r
-           return false;\r
-        }\r
-        return true;\r
-    },\r
+/** \r
+ * @class Ext.SplitBar.BasicLayoutAdapter\r
+ * Default Adapter. It assumes the splitter and resizing element are not positioned\r
+ * elements and only gets/sets the width of the element. Generally used for table based layouts.\r
+ */\r
+Ext.SplitBar.BasicLayoutAdapter = function(){\r
+};\r
 \r
-       \r
-    hasFxBlock : function(){\r
-        var q = this.fxQueue;\r
-        return q && q[0] && q[0].block;\r
+Ext.SplitBar.BasicLayoutAdapter.prototype = {\r
+    // do nothing for now\r
+    init : function(s){\r
+    \r
     },\r
-\r
-       \r
-    queueFx : function(o, fn){\r
-        if(!this.fxQueue){\r
-            this.fxQueue = [];\r
+    /**\r
+     * Called before drag operations to get the current size of the resizing element. \r
+     * @param {Ext.SplitBar} s The SplitBar using this adapter\r
+     */\r
+     getElementSize : function(s){\r
+        if(s.orientation == Ext.SplitBar.HORIZONTAL){\r
+            return s.resizingEl.getWidth();\r
+        }else{\r
+            return s.resizingEl.getHeight();\r
         }\r
-        if(!this.hasFxBlock()){\r
-            Ext.applyIf(o, this.fxDefaults);\r
-            if(!o.concurrent){\r
-                var run = this.beforeFx(o);\r
-                fn.block = o.block;\r
-                this.fxQueue.push(fn);\r
-                if(run){\r
-                    this.nextFx();\r
+    },\r
+    \r
+    /**\r
+     * Called after drag operations to set the size of the resizing element.\r
+     * @param {Ext.SplitBar} s The SplitBar using this adapter\r
+     * @param {Number} newSize The new size to set\r
+     * @param {Function} onComplete A function to be invoked when resizing is complete\r
+     */\r
+    setElementSize : function(s, newSize, onComplete){\r
+        if(s.orientation == Ext.SplitBar.HORIZONTAL){\r
+            if(!s.animate){\r
+                s.resizingEl.setWidth(newSize);\r
+                if(onComplete){\r
+                    onComplete(s, newSize);\r
                 }\r
             }else{\r
-                fn.call(this);\r
-            }\r
-        }\r
-        return this;\r
-    },\r
-\r
-       \r
-    fxWrap : function(pos, o, vis){\r
-        var wrap;\r
-        if(!o.wrap || !(wrap = Ext.get(o.wrap))){\r
-            var wrapXY;\r
-            if(o.fixPosition){\r
-                wrapXY = this.getXY();\r
+                s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut');\r
             }\r
-            var div = document.createElement("div");\r
-            div.style.visibility = vis;\r
-            wrap = Ext.get(this.dom.parentNode.insertBefore(div, this.dom));\r
-            wrap.setPositioning(pos);\r
-            if(wrap.getStyle("position") == "static"){\r
-                wrap.position("relative");\r
-            }\r
-            this.clearPositioning('auto');\r
-            wrap.clip();\r
-            wrap.dom.appendChild(this.dom);\r
-            if(wrapXY){\r
-                wrap.setXY(wrapXY);\r
+        }else{\r
+            \r
+            if(!s.animate){\r
+                s.resizingEl.setHeight(newSize);\r
+                if(onComplete){\r
+                    onComplete(s, newSize);\r
+                }\r
+            }else{\r
+                s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut');\r
             }\r
         }\r
-        return wrap;\r
-    },\r
-\r
-       \r
-    fxUnwrap : function(wrap, pos, o){\r
-        this.clearPositioning();\r
-        this.setPositioning(pos);\r
-        if(!o.wrap){\r
-            wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);\r
-            wrap.remove();\r
-        }\r
-    },\r
-\r
-       \r
-    getFxRestore : function(){\r
-        var st = this.dom.style;\r
-        return {pos: this.getPositioning(), width: st.width, height : st.height};\r
-    },\r
-\r
-       \r
-    afterFx : function(o){\r
-        if(o.afterStyle){\r
-            this.applyStyles(o.afterStyle);\r
-        }\r
-        if(o.afterCls){\r
-            this.addClass(o.afterCls);\r
-        }\r
-        if(o.remove === true){\r
-            this.remove();\r
-        }\r
-        Ext.callback(o.callback, o.scope, [this]);\r
-        if(!o.concurrent){\r
-            this.fxQueue.shift();\r
-            this.nextFx();\r
-        }\r
-    },\r
-\r
-       \r
-    getFxEl : function(){ // support for composite element fx\r
-        return Ext.get(this.dom);\r
-    },\r
-\r
-       \r
-    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){\r
-        animType = animType || 'run';\r
-        opt = opt || {};\r
-        var anim = Ext.lib.Anim[animType](\r
-            this.dom, args,\r
-            (opt.duration || defaultDur) || .35,\r
-            (opt.easing || defaultEase) || 'easeOut',\r
-            function(){\r
-                Ext.callback(cb, this);\r
-            },\r
-            this\r
-        );\r
-        opt.anim = anim;\r
-        return anim;\r
     }\r
 };\r
 \r
-// backwords compat\r
-Ext.Fx.resize = Ext.Fx.scale;\r
-\r
-//When included, Ext.Fx is automatically applied to Element so that all basic\r
-//effects are available directly via the Element API\r
-Ext.apply(Ext.Element.prototype, Ext.Fx);\r
-\r
-\r
-Ext.CompositeElement = function(els){\r
-    this.elements = [];\r
-    this.addElements(els);\r
+/** \r
+ *@class Ext.SplitBar.AbsoluteLayoutAdapter\r
+ * @extends Ext.SplitBar.BasicLayoutAdapter\r
+ * Adapter that  moves the splitter element to align with the resized sizing element. \r
+ * Used with an absolute positioned SplitBar.\r
+ * @param {Mixed} container The container that wraps around the absolute positioned content. If it's\r
+ * document.body, make sure you assign an id to the body element.\r
+ */\r
+Ext.SplitBar.AbsoluteLayoutAdapter = function(container){\r
+    this.basic = new Ext.SplitBar.BasicLayoutAdapter();\r
+    this.container = Ext.get(container);\r
 };\r
-Ext.CompositeElement.prototype = {\r
-    isComposite: true,\r
-    addElements : function(els){\r
-        if(!els) return this;\r
-        if(typeof els == "string"){\r
-            els = Ext.Element.selectorFunction(els);\r
-        }\r
-        var yels = this.elements;\r
-        var index = yels.length-1;\r
-        for(var i = 0, len = els.length; i < len; i++) {\r
-               yels[++index] = Ext.get(els[i]);\r
-        }\r
-        return this;\r
-    },\r
 \r
-    \r
-    fill : function(els){\r
-        this.elements = [];\r
-        this.add(els);\r
-        return this;\r
+Ext.SplitBar.AbsoluteLayoutAdapter.prototype = {\r
+    init : function(s){\r
+        this.basic.init(s);\r
     },\r
-\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
-\r
-    invoke : function(fn, args){\r
-        var els = this.elements;\r
-        for(var i = 0, len = els.length; i < len; i++) {\r
-               Ext.Element.prototype[fn].apply(els[i], args);\r
-        }\r
-        return this;\r
+    getElementSize : function(s){\r
+        return this.basic.getElementSize(s);\r
     },\r
     \r
-    add : function(els){\r
-        if(typeof els == "string"){\r
-            this.addElements(Ext.Element.selectorFunction(els));\r
-        }else if(els.length !== undefined){\r
-            this.addElements(els);\r
-        }else{\r
-            this.addElements([els]);\r
-        }\r
-        return this;\r
+    setElementSize : function(s, newSize, onComplete){\r
+        this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));\r
     },\r
     \r
-    each : function(fn, scope){\r
-        var els = this.elements;\r
-        for(var i = 0, len = els.length; i < len; i++){\r
-            if(fn.call(scope || els[i], els[i], this, i) === false) {\r
+    moveSplitter : function(s){\r
+        var yes = Ext.SplitBar;\r
+        switch(s.placement){\r
+            case yes.LEFT:\r
+                s.el.setX(s.resizingEl.getRight());\r
+                break;\r
+            case yes.RIGHT:\r
+                s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px");\r
+                break;\r
+            case yes.TOP:\r
+                s.el.setY(s.resizingEl.getBottom());\r
+                break;\r
+            case yes.BOTTOM:\r
+                s.el.setY(s.resizingEl.getTop() - s.el.getHeight());\r
                 break;\r
-            }\r
         }\r
-        return this;\r
-    },\r
+    }\r
+};\r
 \r
-    \r
-    item : function(index){\r
-        return this.elements[index] || null;\r
-    },\r
+/**\r
+ * Orientation constant - Create a vertical SplitBar\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.SplitBar.VERTICAL = 1;\r
 \r
-    \r
-    first : function(){\r
-        return this.item(0);\r
-    },\r
+/**\r
+ * Orientation constant - Create a horizontal SplitBar\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.SplitBar.HORIZONTAL = 2;\r
 \r
-    \r
-    last : function(){\r
-        return this.item(this.elements.length-1);\r
-    },\r
+/**\r
+ * Placement constant - The resizing element is to the left of the splitter element\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.SplitBar.LEFT = 1;\r
 \r
-    \r
-    getCount : function(){\r
-        return this.elements.length;\r
+/**\r
+ * Placement constant - The resizing element is to the right of the splitter element\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.SplitBar.RIGHT = 2;\r
+\r
+/**\r
+ * Placement constant - The resizing element is positioned above the splitter element\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.SplitBar.TOP = 3;\r
+\r
+/**\r
+ * Placement constant - The resizing element is positioned under splitter element\r
+ * @static\r
+ * @type Number\r
+ */\r
+Ext.SplitBar.BOTTOM = 4;\r
+/**
+ * @class Ext.Container
+ * @extends Ext.BoxComponent
+ * <p>Base class for any {@link Ext.BoxComponent} that may contain other Components. Containers handle the
+ * basic behavior of containing items, namely adding, inserting and removing items.</p>
+ *
+ * <p>The most commonly used Container classes are {@link Ext.Panel}, {@link Ext.Window} and {@link Ext.TabPanel}.
+ * If you do not need the capabilities offered by the aforementioned classes you can create a lightweight
+ * Container to be encapsulated by an HTML element to your specifications by using the
+ * <tt><b>{@link Ext.Component#autoEl autoEl}</b></tt> config option. This is a useful technique when creating
+ * embedded {@link Ext.layout.ColumnLayout column} layouts inside {@link Ext.form.FormPanel FormPanels}
+ * for example.</p>
+ *
+ * <p>The code below illustrates both how to explicitly create a Container, and how to implicitly
+ * create one using the <b><tt>'container'</tt></b> xtype:<pre><code>
+// explicitly create a Container
+var embeddedColumns = new Ext.Container({
+    autoEl: 'div',  // This is the default
+    layout: 'column',
+    defaults: {
+        // implicitly create Container by specifying xtype
+        xtype: 'container',
+        autoEl: 'div', // This is the default.
+        layout: 'form',
+        columnWidth: 0.5,
+        style: {
+            padding: '10px'
+        }
+    },
+//  The two items below will be Ext.Containers, each encapsulated by a &lt;DIV> element.
+    items: [{
+        items: {
+            xtype: 'datefield',
+            name: 'startDate',
+            fieldLabel: 'Start date'
+        }
+    }, {
+        items: {
+            xtype: 'datefield',
+            name: 'endDate',
+            fieldLabel: 'End date'
+        }
+    }]
+});</code></pre></p>
+ *
+ * <p><u><b>Layout</b></u></p>
+ * <p>Container classes delegate the rendering of child Components to a layout
+ * manager class which must be configured into the Container using the
+ * <code><b>{@link #layout}</b></code> configuration property.</p>
+ * <p>When either specifying child <code>{@link #items}</code> of a Container,
+ * or dynamically {@link #add adding} Components to a Container, remember to
+ * consider how you wish the Container to arrange those child elements, and
+ * whether those child elements need to be sized using one of Ext's built-in
+ * <b><code>{@link #layout}</code></b> schemes. By default, Containers use the
+ * {@link Ext.layout.ContainerLayout ContainerLayout} scheme which only
+ * renders child components, appending them one after the other inside the
+ * Container, and <b>does not apply any sizing</b> at all.</p>
+ * <p>A common mistake is when a developer neglects to specify a
+ * <b><code>{@link #layout}</code></b> (e.g. widgets like GridPanels or
+ * TreePanels are added to Containers for which no <tt><b>{@link #layout}</b></tt>
+ * has been specified). If a Container is left to use the default
+ * {@link Ext.layout.ContainerLayout ContainerLayout} scheme, none of its
+ * child components will be resized, or changed in any way when the Container
+ * is resized.</p>
+ * <p>Certain layout managers allow dynamic addition of child components.
+ * Those that do include {@link Ext.layout.CardLayout},
+ * {@link Ext.layout.AnchorLayout}, {@link Ext.layout.FormLayout}, and
+ * {@link Ext.layout.TableLayout}. For example:<pre><code>
+//  Create the GridPanel.
+var myNewGrid = new Ext.grid.GridPanel({
+    store: myStore,
+    columns: myColumnModel,
+    title: 'Results', // the title becomes the title of the tab
+});
+
+myTabPanel.add(myNewGrid); // {@link Ext.TabPanel} implicitly uses {@link Ext.layout.CardLayout CardLayout}
+myTabPanel.{@link Ext.TabPanel#setActiveTab setActiveTab}(myNewGrid);
+ * </code></pre></p>
+ * <p>The example above adds a newly created GridPanel to a TabPanel. Note that
+ * a TabPanel uses {@link Ext.layout.CardLayout} as its layout manager which
+ * means all its child items are sized to {@link Ext.layout.FitLayout fit}
+ * exactly into its client area.
+ * <p><b><u>Overnesting is a common problem</u></b>.
+ * An example of overnesting occurs when a GridPanel is added to a TabPanel
+ * by wrapping the GridPanel <i>inside</i> a wrapping Panel (that has no
+ * <tt><b>{@link #layout}</b></tt> specified) and then add that wrapping Panel
+ * to the TabPanel. The point to realize is that a GridPanel <b>is</b> a
+ * Component which can be added directly to a Container. If the wrapping Panel
+ * has no <tt><b>{@link #layout}</b></tt> configuration, then the overnested
+ * GridPanel will not be sized as expected.<p>
+</code></pre>
+ *
+ * <p><u><b>Adding via remote configuration</b></u></p>
+ *
+ * <p>A server side script can be used to add Components which are generated dynamically on the server.
+ * An example of adding a GridPanel to a TabPanel where the GridPanel is generated by the server
+ * based on certain parameters:
+ * </p><pre><code>
+// execute an Ajax request to invoke server side script:
+Ext.Ajax.request({
+    url: 'gen-invoice-grid.php',
+    // send additional parameters to instruct server script
+    params: {
+        startDate: Ext.getCmp('start-date').getValue(),
+        endDate: Ext.getCmp('end-date').getValue()
+    },
+    // process the response object to add it to the TabPanel:
+    success: function(xhr) {
+        var newComponent = eval(xhr.responseText); // see discussion below
+        myTabPanel.add(newComponent); // add the component to the TabPanel
+        myTabPanel.setActiveTab(newComponent);
+    },
+    failure: function() {
+        Ext.Msg.alert("Grid create failed", "Server communication failure");
+    }
+});
+</code></pre>
+ * <p>The server script needs to return an executable Javascript statement which, when processed
+ * using <tt>eval()</tt>, will return either a config object with an {@link Ext.Component#xtype xtype},
+ * or an instantiated Component. The server might return this for example:</p><pre><code>
+(function() {
+    function formatDate(value){
+        return value ? value.dateFormat('M d, Y') : '';
+    };
+
+    var store = new Ext.data.Store({
+        url: 'get-invoice-data.php',
+        baseParams: {
+            startDate: '01/01/2008',
+            endDate: '01/31/2008'
+        },
+        reader: new Ext.data.JsonReader({
+            record: 'transaction',
+            idProperty: 'id',
+            totalRecords: 'total'
+        }, [
+           'customer',
+           'invNo',
+           {name: 'date', type: 'date', dateFormat: 'm/d/Y'},
+           {name: 'value', type: 'float'}
+        ])
+    });
+
+    var grid = new Ext.grid.GridPanel({
+        title: 'Invoice Report',
+        bbar: new Ext.PagingToolbar(store),
+        store: store,
+        columns: [
+            {header: "Customer", width: 250, dataIndex: 'customer', sortable: true},
+            {header: "Invoice Number", width: 120, dataIndex: 'invNo', sortable: true},
+            {header: "Invoice Date", width: 100, dataIndex: 'date', renderer: formatDate, sortable: true},
+            {header: "Value", width: 120, dataIndex: 'value', renderer: 'usMoney', sortable: true}
+        ],
+    });
+    store.load();
+    return grid;  // return instantiated component
+})();
+</code></pre>
+ * <p>When the above code fragment is passed through the <tt>eval</tt> function in the success handler
+ * of the Ajax request, the code is executed by the Javascript processor, and the anonymous function
+ * runs, and returns the instantiated grid component.</p>
+ * <p>Note: since the code above is <i>generated</i> by a server script, the <tt>baseParams</tt> for
+ * the Store, the metadata to allow generation of the Record layout, and the ColumnModel
+ * can all be generated into the code since these are all known on the server.</p>
+ *
+ * @xtype container
+ */
+Ext.Container = Ext.extend(Ext.BoxComponent, {
+    /**
+     * @cfg {Boolean} monitorResize
+     * True to automatically monitor window resize events to handle anything that is sensitive to the current size
+     * of the viewport.  This value is typically managed by the chosen <code>{@link #layout}</code> and should not need
+     * to be set manually.
+     */
+    /**
+     * @cfg {String/Object} layout
+     * When creating complex UIs, it is important to remember that sizing and
+     * positioning of child items is the responsibility of the Container's
+     * layout manager. If you expect child items to be sized in response to
+     * user interactions, <b>you must specify a layout manager</b> which
+     * creates and manages the type of layout you have in mind.  For example:<pre><code>
+new Ext.Window({
+    width:300, height: 300,
+    layout: 'fit', // explicitly set layout manager: override the default (layout:'auto')
+    items: [{
+        title: 'Panel inside a Window'
+    }]
+}).show();
+     * </code></pre>
+     * <p>Omitting the {@link #layout} config means that the
+     * {@link Ext.layout.ContainerLayout default layout manager} will be used which does
+     * nothing but render child components sequentially into the Container (no sizing or
+     * positioning will be performed in this situation).</p>
+     * <p>The layout manager class for this container may be specified as either as an
+     * Object or as a String:</p>
+     * <div><ul class="mdetail-params">
+     *
+     * <li><u>Specify as an Object</u></li>
+     * <div><ul class="mdetail-params">
+     * <li>Example usage:</li>
+<pre><code>
+layout: {
+    type: 'vbox',
+    padding: '5',
+    align: 'left'
+}
+</code></pre>
+     *
+     * <li><tt><b>type</b></tt></li>
+     * <br/><p>The layout type to be used for this container.  If not specified,
+     * a default {@link Ext.layout.ContainerLayout} will be created and used.</p>
+     * <br/><p>Valid layout <tt>type</tt> values are:</p>
+     * <div class="sub-desc"><ul class="mdetail-params">
+     * <li><tt><b>{@link Ext.layout.AbsoluteLayout absolute}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.AccordionLayout accordion}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.AnchorLayout anchor}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.ContainerLayout auto}</b></tt> &nbsp;&nbsp;&nbsp; <b>Default</b></li>
+     * <li><tt><b>{@link Ext.layout.BorderLayout border}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.CardLayout card}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.ColumnLayout column}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.FitLayout fit}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.FormLayout form}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.HBoxLayout hbox}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.MenuLayout menu}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.TableLayout table}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.ToolbarLayout toolbar}</b></tt></li>
+     * <li><tt><b>{@link Ext.layout.VBoxLayout vbox}</b></tt></li>
+     * </ul></div>
+     *
+     * <li>Layout specific configuration properties</li>
+     * <br/><p>Additional layout specific configuration properties may also be
+     * specified. For complete details regarding the valid config options for
+     * each layout type, see the layout class corresponding to the <tt>type</tt>
+     * specified.</p>
+     *
+     * </ul></div>
+     *
+     * <li><u>Specify as a String</u></li>
+     * <div><ul class="mdetail-params">
+     * <li>Example usage:</li>
+<pre><code>
+layout: 'vbox',
+layoutConfig: {
+    padding: '5',
+    align: 'left'
+}
+</code></pre>
+     * <li><tt><b>layout</b></tt></li>
+     * <br/><p>The layout <tt>type</tt> to be used for this container (see list
+     * of valid layout type values above).</p><br/>
+     * <li><tt><b>{@link #layoutConfig}</b></tt></li>
+     * <br/><p>Additional layout specific configuration properties. For complete
+     * details regarding the valid config options for each layout type, see the
+     * layout class corresponding to the <tt>layout</tt> specified.</p>
+     * </ul></div></ul></div>
+     */
+    /**
+     * @cfg {Object} layoutConfig
+     * This is a config object containing properties specific to the chosen
+     * <b><code>{@link #layout}</code></b> if <b><code>{@link #layout}</code></b>
+     * has been specified as a <i>string</i>.</p>
+     */
+    /**
+     * @cfg {Boolean/Number} bufferResize
+     * When set to true (100 milliseconds) or a number of milliseconds, the layout assigned for this container will buffer
+     * the frequency it calculates and does a re-layout of components. This is useful for heavy containers or containers
+     * with a large quantity of sub-components for which frequent layout calls would be expensive.
+     */
+    bufferResize: 100,
+    
+    /**
+     * @cfg {String/Number} activeItem
+     * A string component id or the numeric index of the component that should be initially activated within the
+     * container's layout on render.  For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first
+     * item in the container's collection).  activeItem only applies to layout styles that can display
+     * items one at a time (like {@link Ext.layout.AccordionLayout}, {@link Ext.layout.CardLayout} and
+     * {@link Ext.layout.FitLayout}).  Related to {@link Ext.layout.ContainerLayout#activeItem}.
+     */
+    /**
+     * @cfg {Object/Array} items
+     * <pre><b>** IMPORTANT</b>: be sure to specify a <b><code>{@link #layout}</code> ! **</b></pre>
+     * <p>A single item, or an array of child Components to be added to this container,
+     * for example:</p>
+     * <pre><code>
+// specifying a single item
+items: {...},
+layout: 'fit',    // specify a layout!
+
+// specifying multiple items
+items: [{...}, {...}],
+layout: 'anchor', // specify a layout!
+     * </code></pre>
+     * <p>Each item may be:</p>
+     * <div><ul class="mdetail-params">
+     * <li>any type of object based on {@link Ext.Component}</li>
+     * <li>a fully instanciated object or</li>
+     * <li>an object literal that:</li>
+     * <div><ul class="mdetail-params">
+     * <li>has a specified <code>{@link Ext.Component#xtype xtype}</code></li>
+     * <li>the {@link Ext.Component#xtype} specified is associated with the Component
+     * desired and should be chosen from one of the available xtypes as listed
+     * in {@link Ext.Component}.</li>
+     * <li>If an <code>{@link Ext.Component#xtype xtype}</code> is not explicitly
+     * specified, the {@link #defaultType} for that Container is used.</li>
+     * <li>will be "lazily instanciated", avoiding the overhead of constructing a fully
+     * instanciated Component object</li>
+     * </ul></div></ul></div>
+     * <p><b>Notes</b>:</p>
+     * <div><ul class="mdetail-params">
+     * <li>Ext uses lazy rendering. Child Components will only be rendered
+     * should it become necessary. Items are automatically laid out when they are first
+     * shown (no sizing is done while hidden), or in response to a {@link #doLayout} call.</li>
+     * <li>Do not specify <code>{@link Ext.Panel#contentEl contentEl}</code>/
+     * <code>{@link Ext.Panel#html html}</code> with <code>items</code>.</li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {Object} defaults
+     * <p>A config object that will be applied to all components added to this container either via the {@link #items}
+     * config or via the {@link #add} or {@link #insert} methods.  The <tt>defaults</tt> config can contain any
+     * number of name/value property pairs to be added to each item, and should be valid for the types of items
+     * being added to the container.  For example, to automatically apply padding to the body of each of a set of
+     * contained {@link Ext.Panel} items, you could pass: <tt>defaults: {bodyStyle:'padding:15px'}</tt>.</p><br/>
+     * <p><b>Note</b>: <tt>defaults</tt> will not be applied to config objects if the option is already specified.
+     * For example:</p><pre><code>
+defaults: {               // defaults are applied to items, not the container
+    autoScroll:true
+},
+items: [
+    {
+        xtype: 'panel',   // defaults <b>do not</b> have precedence over
+        id: 'panel1',     // options in config objects, so the defaults
+        autoScroll: false // will not be applied here, panel1 will be autoScroll:false
+    },
+    new Ext.Panel({       // defaults <b>do</b> have precedence over options
+        id: 'panel2',     // options in components, so the defaults
+        autoScroll: false // will be applied here, panel2 will be autoScroll:true.
+    })
+]
+     * </code></pre>
+     */
+
+
+    /** @cfg {Boolean} autoDestroy
+     * If true the container will automatically destroy any contained component that is removed from it, else
+     * destruction must be handled manually (defaults to true).
+     */
+    autoDestroy : true,
+
+    /** @cfg {Boolean} forceLayout
+     * If true the container will force a layout initially even if hidden or collapsed. This option
+     * is useful for forcing forms to render in collapsed or hidden containers. (defaults to false).
+     */
+    forceLayout: false,
+
+    /** @cfg {Boolean} hideBorders
+     * True to hide the borders of each contained component, false to defer to the component's existing
+     * border settings (defaults to false).
+     */
+    /** @cfg {String} defaultType
+     * <p>The default {@link Ext.Component xtype} of child Components to create in this Container when
+     * a child item is specified as a raw configuration object, rather than as an instantiated Component.</p>
+     * <p>Defaults to <tt>'panel'</tt>, except {@link Ext.menu.Menu} which defaults to <tt>'menuitem'</tt>,
+     * and {@link Ext.Toolbar} and {@link Ext.ButtonGroup} which default to <tt>'button'</tt>.</p>
+     */
+    defaultType : 'panel',
+
+    // private
+    initComponent : function(){
+        Ext.Container.superclass.initComponent.call(this);
+
+        this.addEvents(
+            /**
+             * @event afterlayout
+             * Fires when the components in this container are arranged by the associated layout manager.
+             * @param {Ext.Container} this
+             * @param {ContainerLayout} layout The ContainerLayout implementation for this container
+             */
+            'afterlayout',
+            /**
+             * @event beforeadd
+             * Fires before any {@link Ext.Component} is added or inserted into the container.
+             * A handler can return false to cancel the add.
+             * @param {Ext.Container} this
+             * @param {Ext.Component} component The component being added
+             * @param {Number} index The index at which the component will be added to the container's items collection
+             */
+            'beforeadd',
+            /**
+             * @event beforeremove
+             * Fires before any {@link Ext.Component} is removed from the container.  A handler can return
+             * false to cancel the remove.
+             * @param {Ext.Container} this
+             * @param {Ext.Component} component The component being removed
+             */
+            'beforeremove',
+            /**
+             * @event add
+             * @bubbles
+             * Fires after any {@link Ext.Component} is added or inserted into the container.
+             * @param {Ext.Container} this
+             * @param {Ext.Component} component The component that was added
+             * @param {Number} index The index at which the component was added to the container's items collection
+             */
+            'add',
+            /**
+             * @event remove
+             * @bubbles
+             * Fires after any {@link Ext.Component} is removed from the container.
+             * @param {Ext.Container} this
+             * @param {Ext.Component} component The component that was removed
+             */
+            'remove'
+        );
+
+               this.enableBubble('add', 'remove');
+
+        /**
+         * The collection of components in this container as a {@link Ext.util.MixedCollection}
+         * @type MixedCollection
+         * @property items
+         */
+        var items = this.items;
+        if(items){
+            delete this.items;
+            if(Ext.isArray(items) && items.length > 0){
+                this.add.apply(this, items);
+            }else{
+                this.add(items);
+            }
+        }
+    },
+
+    // private
+    initItems : function(){
+        if(!this.items){
+            this.items = new Ext.util.MixedCollection(false, this.getComponentId);
+            this.getLayout(); // initialize the layout
+        }
+    },
+
+    // private
+    setLayout : function(layout){
+        if(this.layout && this.layout != layout){
+            this.layout.setContainer(null);
+        }
+        this.initItems();
+        this.layout = layout;
+        layout.setContainer(this);
+    },
+
+    // private
+    render : function(){
+        Ext.Container.superclass.render.apply(this, arguments);
+        if(this.layout){
+            if(Ext.isObject(this.layout) && !this.layout.layout){
+                this.layoutConfig = this.layout;
+                this.layout = this.layoutConfig.type;
+            }
+            if(typeof this.layout == 'string'){
+                this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);
+            }
+            this.setLayout(this.layout);
+
+            if(this.activeItem !== undefined){
+                var item = this.activeItem;
+                delete this.activeItem;
+                this.layout.setActiveItem(item);
+            }
+        }
+        if(!this.ownerCt){
+            // force a layout if no ownerCt is set
+            this.doLayout(false, true);
+        }
+        if(this.monitorResize === true){
+            Ext.EventManager.onWindowResize(this.doLayout, this, [false]);
+        }
+    },
+
+    /**
+     * <p>Returns the Element to be used to contain the child Components of this Container.</p>
+     * <p>An implementation is provided which returns the Container's {@link #getEl Element}, but
+     * if there is a more complex structure to a Container, this may be overridden to return
+     * the element into which the {@link #layout layout} renders child Components.</p>
+     * @return {Ext.Element} The Element to render child Components into.
+     */
+    getLayoutTarget : function(){
+        return this.el;
+    },
+
+    // private - used as the key lookup function for the items collection
+    getComponentId : function(comp){
+        return comp.getItemId();
+    },
+
+    /**
+     * <p>Adds {@link Ext.Component Component}(s) to this Container.</p>
+     * <br><p><b>Description</b></u> :
+     * <div><ul class="mdetail-params">
+     * <li>Fires the {@link #beforeadd} event before adding</li>
+     * <li>The Container's {@link #defaults default config values} will be applied
+     * accordingly (see <code>{@link #defaults}</code> for details).</li>
+     * <li>Fires the {@link #add} event after the component has been added.</li>
+     * </ul></div>
+     * <br><p><b>Notes</b></u> :
+     * <div><ul class="mdetail-params">
+     * <li>If the Container is <i>already rendered</i> when <tt>add</tt>
+     * is called, you may need to call {@link #doLayout} to refresh the view which causes
+     * any unrendered child Components to be rendered. This is required so that you can
+     * <tt>add</tt> multiple child components if needed while only refreshing the layout
+     * once. For example:<pre><code>
+var tb = new {@link Ext.Toolbar}();
+tb.render(document.body);  // toolbar is rendered
+tb.add({text:'Button 1'}); // add multiple items ({@link #defaultType} for {@link Ext.Toolbar Toolbar} is 'button')
+tb.add({text:'Button 2'});
+tb.{@link #doLayout}();             // refresh the layout
+     * </code></pre></li>
+     * <li><i>Warning:</i> Containers directly managed by the BorderLayout layout manager
+     * may not be removed or added.  See the Notes for {@link Ext.layout.BorderLayout BorderLayout}
+     * for more details.</li>
+     * </ul></div>
+     * @param {Object/Array} component
+     * <p>Either a single component or an Array of components to add.  See
+     * <code>{@link #items}</code> for additional information.</p>
+     * @param {Object} (Optional) component_2
+     * @param {Object} (Optional) component_n
+     * @return {Ext.Component} component The Component (or config object) that was added.
+     */
+    add : function(comp){
+        this.initItems();
+        var args = arguments.length > 1;
+        if(args || Ext.isArray(comp)){
+            Ext.each(args ? arguments : comp, function(c){
+                this.add(c);
+            }, this);
+            return;
+        }
+        var c = this.lookupComponent(this.applyDefaults(comp));
+        var pos = this.items.length;
+        if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){
+            this.items.add(c);
+            c.ownerCt = this;
+            this.fireEvent('add', this, c, pos);
+        }
+        return c;
+    },
+
+    /**
+     * Inserts a Component into this Container at a specified index. Fires the
+     * {@link #beforeadd} event before inserting, then fires the {@link #add} event after the
+     * Component has been inserted.
+     * @param {Number} index The index at which the Component will be inserted
+     * into the Container's items collection
+     * @param {Ext.Component} component The child Component to insert.<br><br>
+     * Ext uses lazy rendering, and will only render the inserted Component should
+     * it become necessary.<br><br>
+     * A Component config object may be passed in order to avoid the overhead of
+     * constructing a real Component object if lazy rendering might mean that the
+     * inserted Component will not be rendered immediately. To take advantage of
+     * this 'lazy instantiation', set the {@link Ext.Component#xtype} config
+     * property to the registered type of the Component wanted.<br><br>
+     * For a list of all available xtypes, see {@link Ext.Component}.
+     * @return {Ext.Component} component The Component (or config object) that was
+     * inserted with the Container's default config values applied.
+     */
+    insert : function(index, comp){
+        this.initItems();
+        var a = arguments, len = a.length;
+        if(len > 2){
+            for(var i = len-1; i >= 1; --i) {
+                this.insert(index, a[i]);
+            }
+            return;
+        }
+        var c = this.lookupComponent(this.applyDefaults(comp));
+
+        if(c.ownerCt == this && this.items.indexOf(c) < index){
+            --index;
+        }
+
+        if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){
+            this.items.insert(index, c);
+            c.ownerCt = this;
+            this.fireEvent('add', this, c, index);
+        }
+        return c;
+    },
+
+    // private
+    applyDefaults : function(c){
+        if(this.defaults){
+            if(typeof c == 'string'){
+                c = Ext.ComponentMgr.get(c);
+                Ext.apply(c, this.defaults);
+            }else if(!c.events){
+                Ext.applyIf(c, this.defaults);
+            }else{
+                Ext.apply(c, this.defaults);
+            }
+        }
+        return c;
+    },
+
+    // private
+    onBeforeAdd : function(item){
+        if(item.ownerCt){
+            item.ownerCt.remove(item, false);
+        }
+        if(this.hideBorders === true){
+            item.border = (item.border === true);
+        }
+    },
+
+    /**
+     * Removes a component from this container.  Fires the {@link #beforeremove} event before removing, then fires
+     * the {@link #remove} event after the component has been removed.
+     * @param {Component/String} component The component reference or id to remove.
+     * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
+     * Defaults to the value of this Container's {@link #autoDestroy} config.
+     * @return {Ext.Component} component The Component that was removed.
+     */
+    remove : function(comp, autoDestroy){
+        this.initItems();
+        var c = this.getComponent(comp);
+        if(c && this.fireEvent('beforeremove', this, c) !== false){
+            this.items.remove(c);
+            delete c.ownerCt;
+            if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){
+                c.destroy();
+            }
+            if(this.layout && this.layout.activeItem == c){
+                delete this.layout.activeItem;
+            }
+            this.fireEvent('remove', this, c);
+        }
+        return c;
+    },
+
+    /**
+     * Removes all components from this container.
+     * @param {Boolean} autoDestroy (optional) True to automatically invoke the removed Component's {@link Ext.Component#destroy} function.
+     * Defaults to the value of this Container's {@link #autoDestroy} config.
+     * @return {Array} Array of the destroyed components
+     */
+    removeAll: function(autoDestroy){
+        this.initItems();
+        var item, rem = [], items = [];
+        this.items.each(function(i){
+            rem.push(i);
+        });
+        for (var i = 0, len = rem.length; i < len; ++i){
+            item = rem[i];
+            this.remove(item, autoDestroy);
+            if(item.ownerCt !== this){
+                items.push(item);
+            }
+        }
+        return items;
+    },
+
+    /**
+     * Examines this container's <code>{@link #items}</code> <b>property</b>
+     * and gets a direct child component of this container.
+     * @param {String/Number} comp This parameter may be any of the following:
+     * <div><ul class="mdetail-params">
+     * <li>a <b><tt>String</tt></b> : representing the <code>{@link Ext.Component#itemId itemId}</code>
+     * or <code>{@link Ext.Component#id id}</code> of the child component </li>
+     * <li>a <b><tt>Number</tt></b> : representing the position of the child component
+     * within the <code>{@link #items}</code> <b>property</b></li>
+     * </ul></div>
+     * <p>For additional information see {@link Ext.util.MixedCollection#get}.
+     * @return Ext.Component The component (if found).
+     */
+    getComponent : function(comp){
+        if(Ext.isObject(comp)){
+            return comp;
+        }
+        return this.items.get(comp);
+    },
+
+    // private
+    lookupComponent : function(comp){
+        if(typeof comp == 'string'){
+            return Ext.ComponentMgr.get(comp);
+        }else if(!comp.events){
+            return this.createComponent(comp);
+        }
+        return comp;
+    },
+
+    // private
+    createComponent : function(config){
+        return Ext.create(config, this.defaultType);
+    },
+
+    /**
+     * Force this container's layout to be recalculated. A call to this function is required after adding a new component
+     * to an already rendered container, or possibly after changing sizing/position properties of child components.
+     * @param {Boolean} shallow (optional) True to only calc the layout of this component, and let child components auto
+     * calc layouts as required (defaults to false, which calls doLayout recursively for each subcontainer)
+     * @param {Boolean} force (optional) True to force a layout to occur, even if the item is hidden.
+     * @return {Ext.Container} this
+     */
+    doLayout: function(shallow, force){
+        var rendered = this.rendered,
+            forceLayout = this.forceLayout;
+
+        if(!this.isVisible() || this.collapsed){
+            this.deferLayout = this.deferLayout || !shallow;
+            if(!(force || forceLayout)){
+                return;
+            }
+            shallow = shallow && !this.deferLayout;
+        } else {
+            delete this.deferLayout;
+        }
+        if(rendered && this.layout){
+            this.layout.layout();
+        }
+        if(shallow !== true && this.items){
+            var cs = this.items.items;
+            for(var i = 0, len = cs.length; i < len; i++){
+                var c = cs[i];
+                if(c.doLayout){
+                    c.forceLayout = forceLayout;
+                    c.doLayout();
+                }
+            }
+        }
+        if(rendered){
+            this.onLayout(shallow, force);
+        }
+        delete this.forceLayout;
+    },
+
+    //private
+    onLayout : Ext.emptyFn,
+
+    onShow : function(){
+        Ext.Container.superclass.onShow.call(this);
+        if(this.deferLayout !== undefined){
+            this.doLayout(true);
+        }
+    },
+
+    /**
+     * Returns the layout currently in use by the container.  If the container does not currently have a layout
+     * set, a default {@link Ext.layout.ContainerLayout} will be created and set as the container's layout.
+     * @return {ContainerLayout} layout The container's layout
+     */
+    getLayout : function(){
+        if(!this.layout){
+            var layout = new Ext.layout.ContainerLayout(this.layoutConfig);
+            this.setLayout(layout);
+        }
+        return this.layout;
+    },
+
+    // private
+    beforeDestroy : function(){
+        if(this.items){
+            Ext.destroy.apply(Ext, this.items.items);
+        }
+        if(this.monitorResize){
+            Ext.EventManager.removeResizeListener(this.doLayout, this);
+        }
+        Ext.destroy(this.layout);
+        Ext.Container.superclass.beforeDestroy.call(this);
+    },
+
+    /**
+     * Bubbles up the component/container heirarchy, calling the specified function with each component. The scope (<i>this</i>) of
+     * function call will be the scope provided or the current component. The arguments to the function
+     * will be the args provided or the current component. If the function returns false at any point,
+     * the bubble is stopped.
+     * @param {Function} fn The function to call
+     * @param {Object} scope (optional) The scope of the function (defaults to current node)
+     * @param {Array} args (optional) The args to call the function with (default to passing the current component)
+     * @return {Ext.Container} this
+     */
+    bubble : function(fn, scope, args){
+        var p = this;
+        while(p){
+            if(fn.apply(scope || p, args || [p]) === false){
+                break;
+            }
+            p = p.ownerCt;
+        }
+        return this;
+    },
+
+    /**
+     * Cascades down the component/container heirarchy from this component (called first), calling the specified function with
+     * each component. The scope (<i>this</i>) of
+     * function call will be the scope provided or the current component. The arguments to the function
+     * will be the args provided or the current component. If the function returns false at any point,
+     * the cascade is stopped on that branch.
+     * @param {Function} fn The function to call
+     * @param {Object} scope (optional) The scope of the function (defaults to current component)
+     * @param {Array} args (optional) The args to call the function with (defaults to passing the current component)
+     * @return {Ext.Container} this
+     */
+    cascade : function(fn, scope, args){
+        if(fn.apply(scope || this, args || [this]) !== false){
+            if(this.items){
+                var cs = this.items.items;
+                for(var i = 0, len = cs.length; i < len; i++){
+                    if(cs[i].cascade){
+                        cs[i].cascade(fn, scope, args);
+                    }else{
+                        fn.apply(scope || cs[i], args || [cs[i]]);
+                    }
+                }
+            }
+        }
+        return this;
+    },
+
+    /**
+     * Find a component under this container at any level by id
+     * @param {String} id
+     * @return Ext.Component
+     */
+    findById : function(id){
+        var m, ct = this;
+        this.cascade(function(c){
+            if(ct != c && c.id === id){
+                m = c;
+                return false;
+            }
+        });
+        return m || null;
+    },
+
+    /**
+     * Find a component under this container at any level by xtype or class
+     * @param {String/Class} xtype The xtype string for a component, or the class of the component directly
+     * @param {Boolean} shallow (optional) False to check whether this Component is descended from the xtype (this is
+     * the default), or true to check whether this Component is directly of the specified xtype.
+     * @return {Array} Array of Ext.Components
+     */
+    findByType : function(xtype, shallow){
+        return this.findBy(function(c){
+            return c.isXType(xtype, shallow);
+        });
+    },
+
+    /**
+     * Find a component under this container at any level by property
+     * @param {String} prop
+     * @param {String} value
+     * @return {Array} Array of Ext.Components
+     */
+    find : function(prop, value){
+        return this.findBy(function(c){
+            return c[prop] === value;
+        });
+    },
+
+    /**
+     * Find a component under this container at any level by a custom function. If the passed function returns
+     * true, the component will be included in the results. The passed function is called with the arguments (component, this container).
+     * @param {Function} fn The function to call
+     * @param {Object} scope (optional)
+     * @return {Array} Array of Ext.Components
+     */
+    findBy : function(fn, scope){
+        var m = [], ct = this;
+        this.cascade(function(c){
+            if(ct != c && fn.call(scope || c, c, ct) === true){
+                m.push(c);
+            }
+        });
+        return m;
+    },
+
+    /**
+     * Get a component contained by this container (alias for items.get(key))
+     * @param {String/Number} key The index or id of the component
+     * @return {Ext.Component} Ext.Component
+     */
+    get : function(key){
+        return this.items.get(key);
+    }
+});
+
+Ext.Container.LAYOUTS = {};
+Ext.reg('container', Ext.Container);
+/**
+ * @class Ext.layout.ContainerLayout
+ * <p>The ContainerLayout class is the default layout manager delegated by {@link Ext.Container} to
+ * render any child Components when no <tt>{@link Ext.Container#layout layout}</tt> is configured into
+ * a {@link Ext.Container Container}. ContainerLayout provides the basic foundation for all other layout
+ * classes in Ext. It simply renders all child Components into the Container, performing no sizing or
+ * positioning services. To utilize a layout that provides sizing and positioning of child Components,
+ * specify an appropriate <tt>{@link Ext.Container#layout layout}</tt>.</p>
+ * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>
+ * configuration property.  See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>
+ */
+Ext.layout.ContainerLayout = function(config){
+    Ext.apply(this, config);
+};
+
+Ext.layout.ContainerLayout.prototype = {
+    /**
+     * @cfg {String} extraCls
+     * <p>An optional extra CSS class that will be added to the container. This can be useful for adding
+     * customized styles to the container or any of its children using standard CSS rules. See
+     * {@link Ext.Component}.{@link Ext.Component#ctCls ctCls} also.</p>
+     * <p><b>Note</b>: <tt>extraCls</tt> defaults to <tt>''</tt> except for the following classes
+     * which assign a value by default:
+     * <div class="mdetail-params"><ul>
+     * <li>{@link Ext.layout.AbsoluteLayout Absolute Layout} : <tt>'x-abs-layout-item'</tt></li>
+     * <li>{@link Ext.layout.Box Box Layout} : <tt>'x-box-item'</tt></li>
+     * <li>{@link Ext.layout.ColumnLayout Column Layout} : <tt>'x-column'</tt></li>
+     * </ul></div>
+     * To configure the above Classes with an extra CSS class append to the default.  For example,
+     * for ColumnLayout:<pre><code>
+     * extraCls: 'x-column custom-class'
+     * </code></pre>
+     * </p>
+     */
+    /**
+     * @cfg {Boolean} renderHidden
+     * True to hide each contained item on render (defaults to false).
+     */
+
+    /**
+     * A reference to the {@link Ext.Component} that is active.  For example, <pre><code>
+     * if(myPanel.layout.activeItem.id == 'item-1') { ... }
+     * </code></pre>
+     * <tt>activeItem</tt> only applies to layout styles that can display items one at a time
+     * (like {@link Ext.layout.AccordionLayout}, {@link Ext.layout.CardLayout}
+     * and {@link Ext.layout.FitLayout}).  Read-only.  Related to {@link Ext.Container#activeItem}.
+     * @type {Ext.Component}
+     * @property activeItem
+     */
+
+    // private
+    monitorResize:false,
+    // private
+    activeItem : null,
+
+    // private
+    layout : function(){
+        var target = this.container.getLayoutTarget();
+        this.onLayout(this.container, target);
+        this.container.fireEvent('afterlayout', this.container, this);
+    },
+
+    // private
+    onLayout : function(ct, target){
+        this.renderAll(ct, target);
+    },
+
+    // private
+    isValidParent : function(c, target){
+               return target && c.getDomPositionEl().dom.parentNode == (target.dom || target);
+    },
+
+    // private
+    renderAll : function(ct, target){
+        var items = ct.items.items;
+        for(var i = 0, len = items.length; i < len; i++) {
+            var c = items[i];
+            if(c && (!c.rendered || !this.isValidParent(c, target))){
+                this.renderItem(c, i, target);
+            }
+        }
+    },
+
+    // private
+    renderItem : function(c, position, target){
+        if(c && !c.rendered){
+            c.render(target, position);
+            this.configureItem(c, position);
+        }else if(c && !this.isValidParent(c, target)){
+            if(typeof position == 'number'){
+                position = target.dom.childNodes[position];
+            }
+            target.dom.insertBefore(c.getDomPositionEl().dom, position || null);
+            c.container = target;
+            this.configureItem(c, position);
+        }
+    },
+    
+    // private
+    configureItem: function(c, position){
+        if(this.extraCls){
+            var t = c.getPositionEl ? c.getPositionEl() : c;
+            t.addClass(this.extraCls);
+        }
+        if (this.renderHidden && c != this.activeItem) {
+            c.hide();
+        }
+        if(c.doLayout){
+            c.doLayout(false, this.forceLayout);
+        }
+    },
+
+    // private
+    onResize: function(){
+        if(this.container.collapsed){
+            return;
+        }
+        var b = this.container.bufferResize;
+        if(b){
+            if(!this.resizeTask){
+                this.resizeTask = new Ext.util.DelayedTask(this.runLayout, this);
+                this.resizeBuffer = typeof b == 'number' ? b : 100;
+            }
+            this.resizeTask.delay(this.resizeBuffer);
+        }else{
+            this.runLayout();
+        }
+    },
+    
+    // private
+    runLayout: function(){
+        this.layout();
+        this.container.onLayout();
+    },
+
+    // private
+    setContainer : function(ct){
+        if(this.monitorResize && ct != this.container){
+            if(this.container){
+                this.container.un('resize', this.onResize, this);
+                this.container.un('bodyresize', this.onResize, this);
+            }
+            if(ct){
+                ct.on({
+                    scope: this,
+                    resize: this.onResize,
+                    bodyresize: this.onResize
+                });
+            }
+        }
+        this.container = ct;
+    },
+
+    // private
+    parseMargins : function(v){
+        if(typeof v == 'number'){
+            v = v.toString();
+        }
+        var ms = v.split(' ');
+        var len = ms.length;
+        if(len == 1){
+            ms[1] = ms[0];
+            ms[2] = ms[0];
+            ms[3] = ms[0];
+        }
+        if(len == 2){
+            ms[2] = ms[0];
+            ms[3] = ms[1];
+        }
+        if(len == 3){
+            ms[3] = ms[1];
+        }
+        return {
+            top:parseInt(ms[0], 10) || 0,
+            right:parseInt(ms[1], 10) || 0,
+            bottom:parseInt(ms[2], 10) || 0,
+            left:parseInt(ms[3], 10) || 0
+        };
+    },
+
+    /**
+     * The {@link Template Ext.Template} used by Field rendering layout classes (such as
+     * {@link Ext.layout.FormLayout}) to create the DOM structure of a fully wrapped,
+     * labeled and styled form Field. A default Template is supplied, but this may be
+     * overriden to create custom field structures. The template processes values returned from
+     * {@link Ext.layout.FormLayout#getTemplateArgs}.
+     * @property fieldTpl
+     * @type Ext.Template
+     */
+    fieldTpl: (function() {
+        var t = new Ext.Template(
+            '<div class="x-form-item {itemCls}" tabIndex="-1">',
+                '<label for="{id}" style="{labelStyle}" class="x-form-item-label">{label}{labelSeparator}</label>',
+                '<div class="x-form-element" id="x-form-el-{id}" style="{elementStyle}">',
+                '</div><div class="{clearCls}"></div>',
+            '</div>'
+        );
+        t.disableFormats = true;
+        return t.compile();
+    })(),
+       
+    /*
+     * Destroys this layout. This is a template method that is empty by default, but should be implemented
+     * by subclasses that require explicit destruction to purge event handlers or remove DOM nodes.
+     * @protected
+     */
+    destroy : Ext.emptyFn
+};
+Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;/**\r
+ * @class Ext.layout.FitLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * <p>This is a base class for layouts that contain <b>a single item</b> that automatically expands to fill the layout's\r
+ * container.  This class is intended to be extended or created via the <tt>layout:'fit'</tt> {@link Ext.Container#layout}\r
+ * config, and should generally not need to be created directly via the new keyword.</p>\r
+ * <p>FitLayout does not have any direct config options (other than inherited ones).  To fit a panel to a container\r
+ * using FitLayout, simply set layout:'fit' on the container and add a single panel to it.  If the container has\r
+ * multiple panels, only the first one will be displayed.  Example usage:</p>\r
+ * <pre><code>\r
+var p = new Ext.Panel({\r
+    title: 'Fit Layout',\r
+    layout:'fit',\r
+    items: {\r
+        title: 'Inner Panel',\r
+        html: '&lt;p&gt;This is the inner panel content&lt;/p&gt;',\r
+        border: false\r
+    }\r
+});\r
+</code></pre>\r
+ */\r
+Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
+    // private\r
+    monitorResize:true,\r
+\r
+    // private\r
+    onLayout : function(ct, target){\r
+        Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);\r
+        if(!this.container.collapsed){\r
+            var sz = (Ext.isIE6 && Ext.isStrict && target.dom == document.body) ? target.getViewSize() : target.getStyleSize();\r
+            this.setItemSize(this.activeItem || ct.items.itemAt(0), sz);\r
+        }\r
     },\r
 \r
+    // private\r
+    setItemSize : function(item, size){\r
+        if(item && size.height > 0){ // display none?\r
+            item.setSize(size);\r
+        }\r
+    }\r
+});\r
+Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;/**\r
+ * @class Ext.layout.CardLayout\r
+ * @extends Ext.layout.FitLayout\r
+ * <p>This layout manages multiple child Components, each fitted to the Container, where only a single child Component can be\r
+ * visible at any given time.  This layout style is most commonly used for wizards, tab implementations, etc.\r
+ * This class is intended to be extended or created via the layout:'card' {@link Ext.Container#layout} config,\r
+ * and should generally not need to be created directly via the new keyword.</p>\r
+ * <p>The CardLayout's focal method is {@link #setActiveItem}.  Since only one panel is displayed at a time,\r
+ * the only way to move from one Component to the next is by calling setActiveItem, passing the id or index of\r
+ * the next panel to display.  The layout itself does not provide a user interface for handling this navigation,\r
+ * so that functionality must be provided by the developer.</p>\r
+ * <p>In the following example, a simplistic wizard setup is demonstrated.  A button bar is added\r
+ * to the footer of the containing panel to provide navigation buttons.  The buttons will be handled by a\r
+ * common navigation routine -- for this example, the implementation of that routine has been ommitted since\r
+ * it can be any type of custom logic.  Note that other uses of a CardLayout (like a tab control) would require a\r
+ * completely different implementation.  For serious implementations, a better approach would be to extend\r
+ * CardLayout to provide the custom functionality needed.  Example usage:</p>\r
+ * <pre><code>\r
+var navHandler = function(direction){\r
+    // This routine could contain business logic required to manage the navigation steps.\r
+    // It would call setActiveItem as needed, manage navigation button state, handle any\r
+    // branching logic that might be required, handle alternate actions like cancellation\r
+    // or finalization, etc.  A complete wizard implementation could get pretty\r
+    // sophisticated depending on the complexity required, and should probably be\r
+    // done as a subclass of CardLayout in a real-world implementation.\r
+};\r
+\r
+var card = new Ext.Panel({\r
+    title: 'Example Wizard',\r
+    layout:'card',\r
+    activeItem: 0, // make sure the active item is set on the container config!\r
+    bodyStyle: 'padding:15px',\r
+    defaults: {\r
+        // applied to each contained panel\r
+        border:false\r
+    },\r
+    // just an example of one possible navigation scheme, using buttons\r
+    bbar: [\r
+        {\r
+            id: 'move-prev',\r
+            text: 'Back',\r
+            handler: navHandler.createDelegate(this, [-1]),\r
+            disabled: true\r
+        },\r
+        '->', // greedy spacer so that the buttons are aligned to each side\r
+        {\r
+            id: 'move-next',\r
+            text: 'Next',\r
+            handler: navHandler.createDelegate(this, [1])\r
+        }\r
+    ],\r
+    // the panels (or "cards") within the layout\r
+    items: [{\r
+        id: 'card-0',\r
+        html: '&lt;h1&gt;Welcome to the Wizard!&lt;/h1&gt;&lt;p&gt;Step 1 of 3&lt;/p&gt;'\r
+    },{\r
+        id: 'card-1',\r
+        html: '&lt;p&gt;Step 2 of 3&lt;/p&gt;'\r
+    },{\r
+        id: 'card-2',\r
+        html: '&lt;h1&gt;Congratulations!&lt;/h1&gt;&lt;p&gt;Step 3 of 3 - Complete&lt;/p&gt;'\r
+    }]\r
+});\r
+</code></pre>\r
+ */\r
+Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, {\r
+    /**\r
+     * @cfg {Boolean} deferredRender\r
+     * True to render each contained item at the time it becomes active, false to render all contained items\r
+     * as soon as the layout is rendered (defaults to false).  If there is a significant amount of content or\r
+     * a lot of heavy controls being rendered into panels that are not displayed by default, setting this to\r
+     * true might improve performance.\r
+     */\r
+    deferredRender : false,\r
     \r
-    contains : function(el){\r
-        return this.indexOf(el) !== -1;\r
-    },\r
+    /**\r
+     * @cfg {Boolean} layoutOnCardChange\r
+     * True to force a layout of the active item when the active card is changed. Defaults to false.\r
+     */\r
+    layoutOnCardChange : false,\r
 \r
+    /**\r
+     * @cfg {Boolean} renderHidden @hide\r
+     */\r
+    // private\r
+    renderHidden : true,\r
     \r
-    indexOf : function(el){\r
-        return this.elements.indexOf(Ext.get(el));\r
+    constructor: function(config){\r
+        Ext.layout.CardLayout.superclass.constructor.call(this, config);\r
+        this.forceLayout = (this.deferredRender === false);\r
     },\r
 \r
-\r
-    \r
-    removeElement : function(el, removeDom){\r
-        if(Ext.isArray(el)){\r
-            for(var i = 0, len = el.length; i < len; i++){\r
-                this.removeElement(el[i]);\r
+    /**\r
+     * Sets the active (visible) item in the layout.\r
+     * @param {String/Number} item The string component id or numeric index of the item to activate\r
+     */\r
+    setActiveItem : function(item){\r
+        item = this.container.getComponent(item);\r
+        if(this.activeItem != item){\r
+            if(this.activeItem){\r
+                this.activeItem.hide();\r
             }\r
-            return this;\r
-        }\r
-        var index = typeof el == 'number' ? el : this.indexOf(el);\r
-        if(index !== -1 && this.elements[index]){\r
-            if(removeDom){\r
-                var d = this.elements[index];\r
-                if(d.dom){\r
-                    d.remove();\r
-                }else{\r
-                    Ext.removeNode(d);\r
-                }\r
+            this.activeItem = item;\r
+            item.show();\r
+            this.container.doLayout();\r
+            if(this.layoutOnCardChange && item.doLayout){\r
+                item.doLayout();\r
             }\r
-            this.elements.splice(index, 1);\r
         }\r
-        return this;\r
     },\r
 \r
-    \r
-    replaceElement : function(el, replacement, domReplace){\r
-        var index = typeof el == 'number' ? el : this.indexOf(el);\r
-        if(index !== -1){\r
-            if(domReplace){\r
-                this.elements[index].replaceWith(replacement);\r
-            }else{\r
-                this.elements.splice(index, 1, Ext.get(replacement))\r
-            }\r
+    // private\r
+    renderAll : function(ct, target){\r
+        if(this.deferredRender){\r
+            this.renderItem(this.activeItem, undefined, target);\r
+        }else{\r
+            Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target);\r
         }\r
-        return this;\r
-    },\r
-\r
-    \r
-    clear : function(){\r
-        this.elements = [];\r
-    }\r
-};\r
-(function(){\r
-Ext.CompositeElement.createCall = function(proto, fnName){\r
-    if(!proto[fnName]){\r
-        proto[fnName] = function(){\r
-            return this.invoke(fnName, arguments);\r
-        };\r
     }\r
-};\r
-for(var fnName in Ext.Element.prototype){\r
-    if(typeof Ext.Element.prototype[fnName] == "function"){\r
-        Ext.CompositeElement.createCall(Ext.CompositeElement.prototype, fnName);\r
-    }\r
-};\r
-})();\r
-\r
-\r
-Ext.CompositeElementLite = function(els){\r
-    Ext.CompositeElementLite.superclass.constructor.call(this, els);\r
-    this.el = new Ext.Element.Flyweight();\r
-};\r
-Ext.extend(Ext.CompositeElementLite, Ext.CompositeElement, {\r
-    addElements : 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
-                var index = yels.length-1;\r
-                for(var i = 0, len = els.length; i < len; i++) {\r
-                    yels[++index] = els[i];\r
-                }\r
-            }\r
-        }\r
-        return this;\r
-    },\r
-    invoke : function(fn, args){\r
-        var els = this.elements;\r
-        var el = this.el;\r
-        for(var i = 0, len = els.length; i < len; i++) {\r
-            el.dom = els[i];\r
-               Ext.Element.prototype[fn].apply(el, args);\r
-        }\r
-        return this;\r
-    },\r
-    \r
-    item : function(index){\r
-        if(!this.elements[index]){\r
-            return null;\r
-        }\r
-        this.el.dom = this.elements[index];\r
-        return this.el;\r
-    },\r
-\r
-    // fixes scope with flyweight\r
-    addListener : function(eventName, handler, scope, opt){\r
-        var els = this.elements;\r
-        for(var i = 0, len = els.length; i < len; i++) {\r
-            Ext.EventManager.on(els[i], eventName, handler, scope || els[i], opt);\r
-        }\r
-        return this;\r
-    },\r
-\r
+});\r
+Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout;/**\r
+ * @class Ext.layout.AnchorLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * <p>This is a layout that enables anchoring of contained elements relative to the container's dimensions.\r
+ * If the container is resized, all anchored items are automatically rerendered according to their\r
+ * <b><tt>{@link #anchor}</tt></b> rules.</p>\r
+ * <p>This class is intended to be extended or created via the layout:'anchor' {@link Ext.Container#layout}\r
+ * config, and should generally not need to be created directly via the new keyword.</p>\r
+ * <p>AnchorLayout does not have any direct config options (other than inherited ones). By default,\r
+ * AnchorLayout will calculate anchor measurements based on the size of the container itself. However, the\r
+ * container using the AnchorLayout can supply an anchoring-specific config property of <b>anchorSize</b>.\r
+ * If anchorSize is specifed, the layout will use it as a virtual container for the purposes of calculating\r
+ * anchor measurements based on it instead, allowing the container to be sized independently of the anchoring\r
+ * logic if necessary.  For example:</p>\r
+ * <pre><code>\r
+var viewport = new Ext.Viewport({\r
+    layout:'anchor',\r
+    anchorSize: {width:800, height:600},\r
+    items:[{\r
+        title:'Item 1',\r
+        html:'Content 1',\r
+        width:800,\r
+        anchor:'right 20%'\r
+    },{\r
+        title:'Item 2',\r
+        html:'Content 2',\r
+        width:300,\r
+        anchor:'50% 30%'\r
+    },{\r
+        title:'Item 3',\r
+        html:'Content 3',\r
+        width:600,\r
+        anchor:'-100 50%'\r
+    }]\r
+});\r
+ * </code></pre>\r
+ */\r
+Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
+    /**\r
+     * @cfg {String} anchor\r
+     * <p>This configuation option is to be applied to <b>child <tt>items</tt></b> of a container managed by\r
+     * this layout (ie. configured with <tt>layout:'anchor'</tt>).</p><br/>\r
+     * \r
+     * <p>This value is what tells the layout how an item should be anchored to the container. <tt>items</tt>\r
+     * added to an AnchorLayout accept an anchoring-specific config property of <b>anchor</b> which is a string\r
+     * containing two values: the horizontal anchor value and the vertical anchor value (for example, '100% 50%').\r
+     * The following types of anchor values are supported:<div class="mdetail-params"><ul>\r
+     * \r
+     * <li><b>Percentage</b> : Any value between 1 and 100, expressed as a percentage.<div class="sub-desc">\r
+     * The first anchor is the percentage width that the item should take up within the container, and the\r
+     * second is the percentage height.  For example:<pre><code>\r
+// two values specified\r
+anchor: '100% 50%' // render item complete width of the container and\r
+                   // 1/2 height of the container\r
+// one value specified\r
+anchor: '100%'     // the width value; the height will default to auto\r
+     * </code></pre></div></li>\r
+     * \r
+     * <li><b>Offsets</b> : Any positive or negative integer value.<div class="sub-desc">\r
+     * This is a raw adjustment where the first anchor is the offset from the right edge of the container,\r
+     * and the second is the offset from the bottom edge. For example:<pre><code>\r
+// two values specified\r
+anchor: '-50 -100' // render item the complete width of the container\r
+                   // minus 50 pixels and\r
+                   // the complete height minus 100 pixels.\r
+// one value specified\r
+anchor: '-50'      // anchor value is assumed to be the right offset value\r
+                   // bottom offset will default to 0\r
+     * </code></pre></div></li>\r
+     * \r
+     * <li><b>Sides</b> : Valid values are <tt>'right'</tt> (or <tt>'r'</tt>) and <tt>'bottom'</tt>\r
+     * (or <tt>'b'</tt>).<div class="sub-desc">\r
+     * Either the container must have a fixed size or an anchorSize config value defined at render time in\r
+     * order for these to have any effect.</div></li>\r
+     *\r
+     * <li><b>Mixed</b> : <div class="sub-desc">\r
+     * Anchor values can also be mixed as needed.  For example, to render the width offset from the container\r
+     * right edge by 50 pixels and 75% of the container's height use:\r
+     * <pre><code>\r
+anchor: '-50 75%' \r
+     * </code></pre></div></li>\r
+     * \r
+     * \r
+     * </ul></div>\r
+     */\r
     \r
-    each : function(fn, scope){\r
-        var els = this.elements;\r
-        var el = this.el;\r
-        for(var i = 0, len = els.length; i < len; i++){\r
-            el.dom = els[i];\r
-               if(fn.call(scope || el, el, this, i) === false){\r
-                break;\r
-            }\r
-        }\r
-        return this;\r
-    },\r
+    // private\r
+    monitorResize:true,\r
 \r
-    indexOf : function(el){\r
-        return this.elements.indexOf(Ext.getDom(el));\r
+    // private\r
+    getAnchorViewSize : function(ct, target){\r
+        return target.dom == document.body ?\r
+                   target.getViewSize() : target.getStyleSize();\r
     },\r
 \r
-    replaceElement : function(el, replacement, domReplace){\r
-        var index = typeof el == 'number' ? el : this.indexOf(el);\r
-        if(index !== -1){\r
-            replacement = Ext.getDom(replacement);\r
-            if(domReplace){\r
-                var d = this.elements[index];\r
-                d.parentNode.insertBefore(replacement, d);\r
-                Ext.removeNode(d);\r
-            }\r
-            this.elements.splice(index, 1, replacement);\r
-        }\r
-        return this;\r
-    }\r
-});\r
-Ext.CompositeElementLite.prototype.on = Ext.CompositeElementLite.prototype.addListener;\r
-if(Ext.DomQuery){\r
-    Ext.Element.selectorFunction = Ext.DomQuery.select;\r
-}\r
-\r
-Ext.Element.select = function(selector, unique, root){\r
-    var els;\r
-    if(typeof selector == "string"){\r
-        els = Ext.Element.selectorFunction(selector, root);\r
-    }else if(selector.length !== undefined){\r
-        els = selector;\r
-    }else{\r
-        throw "Invalid selector";\r
-    }\r
-    if(unique === true){\r
-        return new Ext.CompositeElement(els);\r
-    }else{\r
-        return new Ext.CompositeElementLite(els);\r
-    }\r
-};\r
-\r
-Ext.select = Ext.Element.select;\r
-\r
-Ext.data.Connection = function(config){\r
-    Ext.apply(this, config);\r
-    this.addEvents(\r
-        \r
-        "beforerequest",\r
-        \r
-        "requestcomplete",\r
-        \r
-        "requestexception"\r
-    );\r
-    Ext.data.Connection.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.data.Connection, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    timeout : 30000,\r
-    \r
-    autoAbort:false,\r
+    // private\r
+    onLayout : function(ct, target){\r
+        Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target);\r
 \r
-    \r
-    disableCaching: true,\r
-    \r
-    \r
-    disableCachingParam: '_dc',\r
-    \r
+        var size = this.getAnchorViewSize(ct, target);\r
 \r
-    \r
-    request : function(o){\r
-        if(this.fireEvent("beforerequest", this, o) !== false){\r
-            var p = o.params;\r
+        var w = size.width, h = size.height;\r
 \r
-            if(typeof p == "function"){\r
-                p = p.call(o.scope||window, o);\r
-            }\r
-            if(typeof p == "object"){\r
-                p = Ext.urlEncode(p);\r
-            }\r
-            if(this.extraParams){\r
-                var extras = Ext.urlEncode(this.extraParams);\r
-                p = p ? (p + '&' + extras) : extras;\r
-            }\r
+        if(w < 20 && h < 20){\r
+            return;\r
+        }\r
 \r
-            var url = o.url || this.url;\r
-            if(typeof url == 'function'){\r
-                url = url.call(o.scope||window, o);\r
+        // find the container anchoring size\r
+        var aw, ah;\r
+        if(ct.anchorSize){\r
+            if(typeof ct.anchorSize == 'number'){\r
+                aw = ct.anchorSize;\r
+            }else{\r
+                aw = ct.anchorSize.width;\r
+                ah = ct.anchorSize.height;\r
             }\r
+        }else{\r
+            aw = ct.initialConfig.width;\r
+            ah = ct.initialConfig.height;\r
+        }\r
 \r
-            if(o.form){\r
-                var form = Ext.getDom(o.form);\r
-                url = url || form.action;\r
-\r
-                var enctype = form.getAttribute("enctype");\r
-                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){\r
-                    return this.doFormUpload(o, p, url);\r
+        var cs = ct.items.items, len = cs.length, i, c, a, cw, ch;\r
+        for(i = 0; i < len; i++){\r
+            c = cs[i];\r
+            if(c.anchor){\r
+                a = c.anchorSpec;\r
+                if(!a){ // cache all anchor values\r
+                    var vs = c.anchor.split(' ');\r
+                    c.anchorSpec = a = {\r
+                        right: this.parseAnchor(vs[0], c.initialConfig.width, aw),\r
+                        bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah)\r
+                    };\r
                 }\r
-                var f = Ext.lib.Ajax.serializeForm(form);\r
-                p = p ? (p + '&' + f) : f;\r
-            }\r
+                cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined;\r
+                ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined;\r
 \r
-            var hs = o.headers;\r
-            if(this.defaultHeaders){\r
-                hs = Ext.apply(hs || {}, this.defaultHeaders);\r
-                if(!o.headers){\r
-                    o.headers = hs;\r
+                if(cw || ch){\r
+                    c.setSize(cw || undefined, ch || undefined);\r
                 }\r
             }\r
+        }\r
+    },\r
 \r
-            var cb = {\r
-                success: this.handleResponse,\r
-                failure: this.handleFailure,\r
-                scope: this,\r
-                argument: {options: o},\r
-                timeout : o.timeout || this.timeout\r
-            };\r
-\r
-            var method = o.method||this.method||((p || o.xmlData || o.jsonData) ? "POST" : "GET");\r
-\r
-            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){\r
-                var dcp = o.disableCachingParam || this.disableCachingParam;\r
-                url += (url.indexOf('?') != -1 ? '&' : '?') + dcp + '=' + (new Date().getTime());\r
-            }\r
-\r
-            if(typeof o.autoAbort == 'boolean'){ // options gets top priority\r
-                if(o.autoAbort){\r
-                    this.abort();\r
+    // private\r
+    parseAnchor : function(a, start, cstart){\r
+        if(a && a != 'none'){\r
+            var last;\r
+            if(/^(r|right|b|bottom)$/i.test(a)){   // standard anchor\r
+                var diff = cstart - start;\r
+                return function(v){\r
+                    if(v !== last){\r
+                        last = v;\r
+                        return v - diff;\r
+                    }\r
+                }\r
+            }else if(a.indexOf('%') != -1){\r
+                var ratio = parseFloat(a.replace('%', ''))*.01;   // percentage\r
+                return function(v){\r
+                    if(v !== last){\r
+                        last = v;\r
+                        return Math.floor(v*ratio);\r
+                    }\r
+                }\r
+            }else{\r
+                a = parseInt(a, 10);\r
+                if(!isNaN(a)){                            // simple offset adjustment\r
+                    return function(v){\r
+                        if(v !== last){\r
+                            last = v;\r
+                            return v + a;\r
+                        }\r
+                    }\r
                 }\r
-            }else if(this.autoAbort !== false){\r
-                this.abort();\r
-            }\r
-            if((method == 'GET' || o.xmlData || o.jsonData) && p){\r
-                url += (url.indexOf('?') != -1 ? '&' : '?') + p;\r
-                p = '';\r
             }\r
-            this.transId = Ext.lib.Ajax.request(method, url, cb, p, o);\r
-            return this.transId;\r
-        }else{\r
-            Ext.callback(o.callback, o.scope, [o, null, null]);\r
-            return null;\r
         }\r
+        return false;\r
     },\r
 \r
-    \r
-    isLoading : function(transId){\r
-        if(transId){\r
-            return Ext.lib.Ajax.isCallInProgress(transId);\r
-        }else{\r
-            return this.transId ? true : false;\r
-        }\r
+    // private\r
+    adjustWidthAnchor : function(value, comp){\r
+        return value;\r
     },\r
 \r
+    // private\r
+    adjustHeightAnchor : function(value, comp){\r
+        return value;\r
+    }\r
     \r
-    abort : function(transId){\r
-        if(transId || this.isLoading()){\r
-            Ext.lib.Ajax.abort(transId || this.transId);\r
-        }\r
-    },\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
+Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout;/**\r
+ * @class Ext.layout.ColumnLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * <p>This is the layout style of choice for creating structural layouts in a multi-column format where the width of\r
+ * each column can be specified as a percentage or fixed width, but the height is allowed to vary based on the content.\r
+ * This class is intended to be extended or created via the layout:'column' {@link Ext.Container#layout} config,\r
+ * and should generally not need to be created directly via the new keyword.</p>\r
+ * <p>ColumnLayout does not have any direct config options (other than inherited ones), but it does support a\r
+ * specific config property of <b><tt>columnWidth</tt></b> that can be included in the config of any panel added to it.  The\r
+ * layout will use the columnWidth (if present) or width of each panel during layout to determine how to size each panel.\r
+ * If width or columnWidth is not specified for a given panel, its width will default to the panel's width (or auto).</p>\r
+ * <p>The width property is always evaluated as pixels, and must be a number greater than or equal to 1.\r
+ * The columnWidth property is always evaluated as a percentage, and must be a decimal value greater than 0 and\r
+ * less than 1 (e.g., .25).</p>\r
+ * <p>The basic rules for specifying column widths are pretty simple.  The logic makes two passes through the\r
+ * set of contained panels.  During the first layout pass, all panels that either have a fixed width or none\r
+ * specified (auto) are skipped, but their widths are subtracted from the overall container width.  During the second\r
+ * pass, all panels with columnWidths are assigned pixel widths in proportion to their percentages based on\r
+ * the total <b>remaining</b> container width.  In other words, percentage width panels are designed to fill the space\r
+ * left over by all the fixed-width and/or auto-width panels.  Because of this, while you can specify any number of columns\r
+ * with different percentages, the columnWidths must always add up to 1 (or 100%) when added together, otherwise your\r
+ * layout may not render as expected.  Example usage:</p>\r
+ * <pre><code>\r
+// All columns are percentages -- they must add up to 1\r
+var p = new Ext.Panel({\r
+    title: 'Column Layout - Percentage Only',\r
+    layout:'column',\r
+    items: [{\r
+        title: 'Column 1',\r
+        columnWidth: .25 \r
+    },{\r
+        title: 'Column 2',\r
+        columnWidth: .6\r
+    },{\r
+        title: 'Column 3',\r
+        columnWidth: .15\r
+    }]\r
+});\r
 \r
+// Mix of width and columnWidth -- all columnWidth values must add up\r
+// to 1. The first column will take up exactly 120px, and the last two\r
+// columns will fill the remaining container width.\r
+var p = new Ext.Panel({\r
+    title: 'Column Layout - Mixed',\r
+    layout:'column',\r
+    items: [{\r
+        title: 'Column 1',\r
+        width: 120\r
+    },{\r
+        title: 'Column 2',\r
+        columnWidth: .8\r
+    },{\r
+        title: 'Column 3',\r
+        columnWidth: .2\r
+    }]\r
+});\r
+</code></pre>\r
+ */\r
+Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {\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
-        Ext.callback(options.success, options.scope, [response, options]);\r
-        Ext.callback(options.callback, options.scope, [options, true, response]);\r
-    },\r
+    monitorResize:true,\r
+    \r
+    extraCls: 'x-column',\r
+\r
+    scrollOffset : 0,\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
-        Ext.callback(options.failure, options.scope, [response, options]);\r
-        Ext.callback(options.callback, options.scope, [options, false, response]);\r
+    isValidParent : function(c, target){\r
+        return (c.getPositionEl ? c.getPositionEl() : c.getEl()).dom.parentNode == this.innerCt.dom;\r
     },\r
 \r
     // private\r
-    doFormUpload : function(o, ps, url){\r
-        var id = Ext.id();\r
-        var frame = document.createElement('iframe');\r
-        frame.id = id;\r
-        frame.name = id;\r
-        frame.className = 'x-hidden';\r
-        if(Ext.isIE){\r
-            frame.src = Ext.SSL_SECURE_URL;\r
-        }\r
-        document.body.appendChild(frame);\r
+    onLayout : function(ct, target){\r
+        var cs = ct.items.items, len = cs.length, c, i;\r
 \r
-        if(Ext.isIE){\r
-           document.frames[id].name = id;\r
-        }\r
+        if(!this.innerCt){\r
+            target.addClass('x-column-layout-ct');\r
 \r
-        var form = Ext.getDom(o.form);\r
-        form.target = id;\r
-        form.method = 'POST';\r
-        form.enctype = form.encoding = 'multipart/form-data';\r
-        if(url){\r
-            form.action = url;\r
-        }\r
-\r
-        var hiddens, hd;\r
-        if(ps){ // add dynamic params\r
-            hiddens = [];\r
-            ps = Ext.urlDecode(ps, false);\r
-            for(var k in ps){\r
-                if(ps.hasOwnProperty(k)){\r
-                    hd = document.createElement('input');\r
-                    hd.type = 'hidden';\r
-                    hd.name = k;\r
-                    hd.value = ps[k];\r
-                    form.appendChild(hd);\r
-                    hiddens.push(hd);\r
-                }\r
-            }\r
+            // the innerCt prevents wrapping and shuffling while\r
+            // the container is resizing\r
+            this.innerCt = target.createChild({cls:'x-column-inner'});\r
+            this.innerCt.createChild({cls:'x-clear'});\r
         }\r
+        this.renderAll(ct, this.innerCt);\r
 \r
-        function cb(){\r
-            var r = {  // bogus response object\r
-                responseText : '',\r
-                responseXML : null\r
-            };\r
+        var size = Ext.isIE && target.dom != Ext.getBody().dom ? target.getStyleSize() : target.getViewSize();\r
 \r
-            r.argument = o ? o.argument : null;\r
+        if(size.width < 1 && size.height < 1){ // display none?\r
+            return;\r
+        }\r
 \r
-            try { //\r
-                var doc;\r
-                if(Ext.isIE){\r
-                    doc = frame.contentWindow.document;\r
-                }else {\r
-                    doc = (frame.contentDocument || window.frames[id].document);\r
-                }\r
-                if(doc && doc.body){\r
-                    r.responseText = doc.body.innerHTML;\r
-                }\r
-                if(doc && doc.XMLDocument){\r
-                    r.responseXML = doc.XMLDocument;\r
-                }else {\r
-                    r.responseXML = doc;\r
-                }\r
-            }\r
-            catch(e) {\r
-                // ignore\r
-            }\r
-\r
-            Ext.EventManager.removeListener(frame, 'load', cb, this);\r
-\r
-            this.fireEvent("requestcomplete", this, r, o);\r
+        var w = size.width - target.getPadding('lr') - this.scrollOffset,\r
+            h = size.height - target.getPadding('tb'),\r
+            pw = w;\r
 \r
-            Ext.callback(o.success, o.scope, [r, o]);\r
-            Ext.callback(o.callback, o.scope, [o, true, r]);\r
+        this.innerCt.setWidth(w);\r
+        \r
+        // some columns can be percentages while others are fixed\r
+        // so we need to make 2 passes\r
 \r
-            setTimeout(function(){Ext.removeNode(frame);}, 100);\r
+        for(i = 0; i < len; i++){\r
+            c = cs[i];\r
+            if(!c.columnWidth){\r
+                pw -= (c.getSize().width + c.getEl().getMargins('lr'));\r
+            }\r
         }\r
 \r
-        Ext.EventManager.on(frame, 'load', cb, this);\r
-        form.submit();\r
+        pw = pw < 0 ? 0 : pw;\r
 \r
-        if(hiddens){ // remove dynamic params\r
-            for(var i = 0, len = hiddens.length; i < len; i++){\r
-                Ext.removeNode(hiddens[i]);\r
+        for(i = 0; i < len; i++){\r
+            c = cs[i];\r
+            if(c.columnWidth){\r
+                c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr'));\r
             }\r
         }\r
     }\r
-});\r
-\r
-\r
-Ext.Ajax = new Ext.data.Connection({\r
-    \r
-    \r
-    \r
-    \r
-    \r
     \r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
 \r
-    \r
-\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    \r
-    autoAbort : false,\r
-\r
-    \r
-    serializeForm : function(form){\r
-        return Ext.lib.Ajax.serializeForm(form);\r
-    }\r
+Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout;/**
+ * @class Ext.layout.BorderLayout
+ * @extends Ext.layout.ContainerLayout
+ * <p>This is a multi-pane, application-oriented UI layout style that supports multiple
+ * nested panels, automatic {@link Ext.layout.BorderLayout.Region#split split} bars between
+ * {@link Ext.layout.BorderLayout.Region#BorderLayout.Region regions} and built-in
+ * {@link Ext.layout.BorderLayout.Region#collapsible expanding and collapsing} of regions.</p>
+ * <p>This class is intended to be extended or created via the <tt>layout:'border'</tt>
+ * {@link Ext.Container#layout} config, and should generally not need to be created directly
+ * via the new keyword.</p>
+ * <p>BorderLayout does not have any direct config options (other than inherited ones).
+ * All configuration options available for customizing the BorderLayout are at the
+ * {@link Ext.layout.BorderLayout.Region} and {@link Ext.layout.BorderLayout.SplitRegion}
+ * levels.</p>
+ * <p>Example usage:</p>
+ * <pre><code>
+var myBorderPanel = new Ext.Panel({
+    {@link Ext.Component#renderTo renderTo}: document.body,
+    {@link Ext.BoxComponent#width width}: 700,
+    {@link Ext.BoxComponent#height height}: 500,
+    {@link Ext.Panel#title title}: 'Border Layout',
+    {@link Ext.Container#layout layout}: 'border',
+    {@link Ext.Container#items items}: [{
+        {@link Ext.Panel#title title}: 'South Region is resizable',
+        {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}: 'south',     // position for region
+        {@link Ext.BoxComponent#height height}: 100,
+        {@link Ext.layout.BorderLayout.Region#split split}: true,         // enable resizing
+        {@link Ext.SplitBar#minSize minSize}: 75,         // defaults to {@link Ext.layout.BorderLayout.Region#minHeight 50} 
+        {@link Ext.SplitBar#maxSize maxSize}: 150,
+        {@link Ext.layout.BorderLayout.Region#margins margins}: '0 5 5 5'
+    },{
+        // xtype: 'panel' implied by default
+        {@link Ext.Panel#title title}: 'West Region is collapsible',
+        {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}:'west',
+        {@link Ext.layout.BorderLayout.Region#margins margins}: '5 0 0 5',
+        {@link Ext.BoxComponent#width width}: 200,
+        {@link Ext.layout.BorderLayout.Region#collapsible collapsible}: true,   // make collapsible
+        {@link Ext.layout.BorderLayout.Region#cmargins cmargins}: '5 5 0 5', // adjust top margin when collapsed
+        {@link Ext.Component#id id}: 'west-region-container',
+        {@link Ext.Container#layout layout}: 'fit',
+        {@link Ext.Panel#unstyled unstyled}: true
+    },{
+        {@link Ext.Panel#title title}: 'Center Region',
+        {@link Ext.layout.BorderLayout.Region#BorderLayout.Region region}: 'center',     // center region is required, no width/height specified
+        {@link Ext.Component#xtype xtype}: 'container',
+        {@link Ext.Container#layout layout}: 'fit',
+        {@link Ext.layout.BorderLayout.Region#margins margins}: '5 5 0 0'
+    }]
+});
+</code></pre>
+ * <p><b><u>Notes</u></b>:</p><div class="mdetail-params"><ul>
+ * <li>Any container using the BorderLayout <b>must</b> have a child item with <tt>region:'center'</tt>.
+ * The child item in the center region will always be resized to fill the remaining space not used by
+ * the other regions in the layout.</li>
+ * <li>Any child items with a region of <tt>west</tt> or <tt>east</tt> must have <tt>width</tt> defined
+ * (an integer representing the number of pixels that the region should take up).</li>
+ * <li>Any child items with a region of <tt>north</tt> or <tt>south</tt> must have <tt>height</tt> defined.</li>
+ * <li>The regions of a BorderLayout are <b>fixed at render time</b> and thereafter, its child Components may not be removed or added</b>.  To add/remove
+ * Components within a BorderLayout, have them wrapped by an additional Container which is directly
+ * managed by the BorderLayout.  If the region is to be collapsible, the Container used directly
+ * by the BorderLayout manager should be a Panel.  In the following example a Container (an Ext.Panel)
+ * is added to the west region:
+ * <div style="margin-left:16px"><pre><code>
+wrc = {@link Ext#getCmp Ext.getCmp}('west-region-container');
+wrc.{@link Ext.Panel#removeAll removeAll}();
+wrc.{@link Ext.Container#add add}({
+    title: 'Added Panel',
+    html: 'Some content'
+});
+wrc.{@link Ext.Container#doLayout doLayout}();
+ * </code></pre></div>
+ * </li>
+ * <li> To reference a {@link Ext.layout.BorderLayout.Region Region}:
+ * <div style="margin-left:16px"><pre><code>
+wr = myBorderPanel.layout.west;
+ * </code></pre></div>
+ * </li>
+ * </ul></div>
+ */
+Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {
+    // private
+    monitorResize:true,
+    // private
+    rendered : false,
+
+    // private
+    onLayout : function(ct, target){
+        var collapsed;
+        if(!this.rendered){
+            target.addClass('x-border-layout-ct');
+            var items = ct.items.items;
+            collapsed = [];
+            for(var i = 0, len = items.length; i < len; i++) {
+                var c = items[i];
+                var pos = c.region;
+                if(c.collapsed){
+                    collapsed.push(c);
+                }
+                c.collapsed = false;
+                if(!c.rendered){
+                    c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';
+                    c.render(target, i);
+                }
+                this[pos] = pos != 'center' && c.split ?
+                    new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :
+                    new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);
+                this[pos].render(target, c);
+            }
+            this.rendered = true;
+        }
+
+        var size = target.getViewSize();
+        if(size.width < 20 || size.height < 20){ // display none?
+            if(collapsed){
+                this.restoreCollapsed = collapsed;
+            }
+            return;
+        }else if(this.restoreCollapsed){
+            collapsed = this.restoreCollapsed;
+            delete this.restoreCollapsed;
+        }
+
+        var w = size.width, h = size.height;
+        var centerW = w, centerH = h, centerY = 0, centerX = 0;
+
+        var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;
+        if(!c && Ext.layout.BorderLayout.WARN !== false){
+            throw 'No center region defined in BorderLayout ' + ct.id;
+        }
+
+        if(n && n.isVisible()){
+            var b = n.getSize();
+            var m = n.getMargins();
+            b.width = w - (m.left+m.right);
+            b.x = m.left;
+            b.y = m.top;
+            centerY = b.height + b.y + m.bottom;
+            centerH -= centerY;
+            n.applyLayout(b);
+        }
+        if(s && s.isVisible()){
+            var b = s.getSize();
+            var m = s.getMargins();
+            b.width = w - (m.left+m.right);
+            b.x = m.left;
+            var totalHeight = (b.height + m.top + m.bottom);
+            b.y = h - totalHeight + m.top;
+            centerH -= totalHeight;
+            s.applyLayout(b);
+        }
+        if(west && west.isVisible()){
+            var b = west.getSize();
+            var m = west.getMargins();
+            b.height = centerH - (m.top+m.bottom);
+            b.x = m.left;
+            b.y = centerY + m.top;
+            var totalWidth = (b.width + m.left + m.right);
+            centerX += totalWidth;
+            centerW -= totalWidth;
+            west.applyLayout(b);
+        }
+        if(e && e.isVisible()){
+            var b = e.getSize();
+            var m = e.getMargins();
+            b.height = centerH - (m.top+m.bottom);
+            var totalWidth = (b.width + m.left + m.right);
+            b.x = w - totalWidth + m.left;
+            b.y = centerY + m.top;
+            centerW -= totalWidth;
+            e.applyLayout(b);
+        }
+        if(c){
+            var m = c.getMargins();
+            var centerBox = {
+                x: centerX + m.left,
+                y: centerY + m.top,
+                width: centerW - (m.left+m.right),
+                height: centerH - (m.top+m.bottom)
+            };
+            c.applyLayout(centerBox);
+        }
+        if(collapsed){
+            for(var i = 0, len = collapsed.length; i < len; i++){
+                collapsed[i].collapse(false);
+            }
+        }
+        if(Ext.isIE && Ext.isStrict){ // workaround IE strict repainting issue
+            target.repaint();
+        }
+    },
+
+    destroy: function() {
+        var r = ['north', 'south', 'east', 'west'];
+        for (var i = 0; i < r.length; i++) {
+            var region = this[r[i]];
+            if(region){
+                if(region.destroy){
+                    region.destroy();
+                }else if (region.split){
+                    region.split.destroy(true);
+                }
+            }
+        }
+        Ext.layout.BorderLayout.superclass.destroy.call(this);
+    }
+
+    /**
+     * @property activeItem
+     * @hide
+     */
+});
+
+/**
+ * @class Ext.layout.BorderLayout.Region
+ * <p>This is a region of a {@link Ext.layout.BorderLayout BorderLayout} that acts as a subcontainer
+ * within the layout.  Each region has its own {@link Ext.layout.ContainerLayout layout} that is
+ * independent of other regions and the containing BorderLayout, and can be any of the
+ * {@link Ext.layout.ContainerLayout valid Ext layout types}.</p>
+ * <p>Region size is managed automatically and cannot be changed by the user -- for
+ * {@link #split resizable regions}, see {@link Ext.layout.BorderLayout.SplitRegion}.</p>
+ * @constructor
+ * Create a new Region.
+ * @param {Layout} layout The {@link Ext.layout.BorderLayout BorderLayout} instance that is managing this Region.
+ * @param {Object} config The configuration options
+ * @param {String} position The region position.  Valid values are: <tt>north</tt>, <tt>south</tt>,
+ * <tt>east</tt>, <tt>west</tt> and <tt>center</tt>.  Every {@link Ext.layout.BorderLayout BorderLayout}
+ * <b>must have a center region</b> for the primary content -- all other regions are optional.
+ */
+Ext.layout.BorderLayout.Region = function(layout, config, pos){
+    Ext.apply(this, config);
+    this.layout = layout;
+    this.position = pos;
+    this.state = {};
+    if(typeof this.margins == 'string'){
+        this.margins = this.layout.parseMargins(this.margins);
+    }
+    this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);
+    if(this.collapsible){
+        if(typeof this.cmargins == 'string'){
+            this.cmargins = this.layout.parseMargins(this.cmargins);
+        }
+        if(this.collapseMode == 'mini' && !this.cmargins){
+            this.cmargins = {left:0,top:0,right:0,bottom:0};
+        }else{
+            this.cmargins = Ext.applyIf(this.cmargins || {},
+                pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);
+        }
+    }
+};
+
+Ext.layout.BorderLayout.Region.prototype = {
+    /**
+     * @cfg {Boolean} animFloat
+     * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
+     * panel that will close again once the user mouses out of that panel (or clicks out if
+     * <tt>{@link #autoHide} = false</tt>).  Setting <tt>{@link #animFloat} = false</tt> will
+     * prevent the open and close of these floated panels from being animated (defaults to <tt>true</tt>).
+     */
+    /**
+     * @cfg {Boolean} autoHide
+     * When a collapsed region's bar is clicked, the region's panel will be displayed as a floated
+     * panel.  If <tt>autoHide = true</tt>, the panel will automatically hide after the user mouses
+     * out of the panel.  If <tt>autoHide = false</tt>, the panel will continue to display until the
+     * user clicks outside of the panel (defaults to <tt>true</tt>).
+     */
+    /**
+     * @cfg {String} collapseMode
+     * <tt>collapseMode</tt> supports two configuration values:<div class="mdetail-params"><ul>
+     * <li><b><tt>undefined</tt></b> (default)<div class="sub-desc">By default, {@link #collapsible}
+     * regions are collapsed by clicking the expand/collapse tool button that renders into the region's
+     * title bar.</div></li>
+     * <li><b><tt>'mini'</tt></b><div class="sub-desc">Optionally, when <tt>collapseMode</tt> is set to
+     * <tt>'mini'</tt> the region's split bar will also display a small collapse button in the center of
+     * the bar. In <tt>'mini'</tt> mode the region will collapse to a thinner bar than in normal mode.
+     * </div></li>
+     * </ul></div></p>
+     * <p><b>Note</b>: if a collapsible region does not have a title bar, then set <tt>collapseMode =
+     * 'mini'</tt> and <tt>{@link #split} = true</tt> in order for the region to be {@link #collapsible}
+     * by the user as the expand/collapse tool button (that would go in the title bar) will not be rendered.</p>
+     * <p>See also <tt>{@link #cmargins}</tt>.</p>
+     */
+    /**
+     * @cfg {Object} margins
+     * An object containing margins to apply to the region when in the expanded state in the
+     * format:<pre><code>
+{
+    top: (top margin),
+    right: (right margin),
+    bottom: (bottom margin),
+    left: (left margin)
+}</code></pre>
+     * <p>May also be a string containing space-separated, numeric margin values. The order of the
+     * sides associated with each value matches the way CSS processes margin values:</p>
+     * <p><div class="mdetail-params"><ul>
+     * <li>If there is only one value, it applies to all sides.</li>
+     * <li>If there are two values, the top and bottom borders are set to the first value and the
+     * right and left are set to the second.</li>
+     * <li>If there are three values, the top is set to the first value, the left and right are set
+     * to the second, and the bottom is set to the third.</li>
+     * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
+     * </ul></div></p>
+     * <p>Defaults to:</p><pre><code>
+     * {top:0, right:0, bottom:0, left:0}
+     * </code></pre>
+     */
+    /**
+     * @cfg {Object} cmargins
+     * An object containing margins to apply to the region when in the collapsed state in the
+     * format:<pre><code>
+{
+    top: (top margin),
+    right: (right margin),
+    bottom: (bottom margin),
+    left: (left margin)
+}</code></pre>
+     * <p>May also be a string containing space-separated, numeric margin values. The order of the
+     * sides associated with each value matches the way CSS processes margin values.</p>
+     * <p><ul>
+     * <li>If there is only one value, it applies to all sides.</li>
+     * <li>If there are two values, the top and bottom borders are set to the first value and the
+     * right and left are set to the second.</li>
+     * <li>If there are three values, the top is set to the first value, the left and right are set
+     * to the second, and the bottom is set to the third.</li>
+     * <li>If there are four values, they apply to the top, right, bottom, and left, respectively.</li>
+     * </ul></p>
+     */
+    /**
+     * @cfg {Boolean} collapsible
+     * <p><tt>true</tt> to allow the user to collapse this region (defaults to <tt>false</tt>).  If
+     * <tt>true</tt>, an expand/collapse tool button will automatically be rendered into the title
+     * bar of the region, otherwise the button will not be shown.</p>
+     * <p><b>Note</b>: that a title bar is required to display the collapse/expand toggle button -- if
+     * no <tt>title</tt> is specified for the region's panel, the region will only be collapsible if
+     * <tt>{@link #collapseMode} = 'mini'</tt> and <tt>{@link #split} = true</tt>.
+     */
+    collapsible : false,
+    /**
+     * @cfg {Boolean} split
+     * <p><tt>true</tt> to create a {@link Ext.layout.BorderLayout.SplitRegion SplitRegion} and 
+     * display a 5px wide {@link Ext.SplitBar} between this region and its neighbor, allowing the user to
+     * resize the regions dynamically.  Defaults to <tt>false</tt> creating a
+     * {@link Ext.layout.BorderLayout.Region Region}.</p><br>
+     * <p><b>Notes</b>:</p><div class="mdetail-params"><ul>
+     * <li>this configuration option is ignored if <tt>region='center'</tt></li> 
+     * <li>when <tt>split == true</tt>, it is common to specify a
+     * <tt>{@link Ext.SplitBar#minSize minSize}</tt> and <tt>{@link Ext.SplitBar#maxSize maxSize}</tt>
+     * for the {@link Ext.BoxComponent BoxComponent} representing the region. These are not native
+     * configs of {@link Ext.BoxComponent BoxComponent}, and are used only by this class.</li>
+     * <li>if <tt>{@link #collapseMode} = 'mini'</tt> requires <tt>split = true</tt> to reserve space
+     * for the collapse tool</tt></li> 
+     * </ul></div> 
+     */
+    split:false,
+    /**
+     * @cfg {Boolean} floatable
+     * <tt>true</tt> to allow clicking a collapsed region's bar to display the region's panel floated
+     * above the layout, <tt>false</tt> to force the user to fully expand a collapsed region by
+     * clicking the expand button to see it again (defaults to <tt>true</tt>).
+     */
+    floatable: true,
+    /**
+     * @cfg {Number} minWidth
+     * <p>The minimum allowable width in pixels for this region (defaults to <tt>50</tt>).
+     * <tt>maxWidth</tt> may also be specified.</p><br>
+     * <p><b>Note</b>: setting the <tt>{@link Ext.SplitBar#minSize minSize}</tt> / 
+     * <tt>{@link Ext.SplitBar#maxSize maxSize}</tt> supersedes any specified 
+     * <tt>minWidth</tt> / <tt>maxWidth</tt>.</p>
+     */
+    minWidth:50,
+    /**
+     * @cfg {Number} minHeight
+     * The minimum allowable height in pixels for this region (defaults to <tt>50</tt>)
+     * <tt>maxHeight</tt> may also be specified.</p><br>
+     * <p><b>Note</b>: setting the <tt>{@link Ext.SplitBar#minSize minSize}</tt> / 
+     * <tt>{@link Ext.SplitBar#maxSize maxSize}</tt> supersedes any specified 
+     * <tt>minHeight</tt> / <tt>maxHeight</tt>.</p>
+     */
+    minHeight:50,
+
+    // private
+    defaultMargins : {left:0,top:0,right:0,bottom:0},
+    // private
+    defaultNSCMargins : {left:5,top:5,right:5,bottom:5},
+    // private
+    defaultEWCMargins : {left:5,top:0,right:5,bottom:0},
+    floatingZIndex: 100,
+
+    /**
+     * True if this region is collapsed. Read-only.
+     * @type Boolean
+     * @property
+     */
+    isCollapsed : false,
+
+    /**
+     * This region's panel.  Read-only.
+     * @type Ext.Panel
+     * @property panel
+     */
+    /**
+     * This region's layout.  Read-only.
+     * @type Layout
+     * @property layout
+     */
+    /**
+     * This region's layout position (north, south, east, west or center).  Read-only.
+     * @type String
+     * @property position
+     */
+
+    // private
+    render : function(ct, p){
+        this.panel = p;
+        p.el.enableDisplayMode();
+        this.targetEl = ct;
+        this.el = p.el;
+
+        var gs = p.getState, ps = this.position;
+        p.getState = function(){
+            return Ext.apply(gs.call(p) || {}, this.state);
+        }.createDelegate(this);
+
+        if(ps != 'center'){
+            p.allowQueuedExpand = false;
+            p.on({
+                beforecollapse: this.beforeCollapse,
+                collapse: this.onCollapse,
+                beforeexpand: this.beforeExpand,
+                expand: this.onExpand,
+                hide: this.onHide,
+                show: this.onShow,
+                scope: this
+            });
+            if(this.collapsible || this.floatable){
+                p.collapseEl = 'el';
+                p.slideAnchor = this.getSlideAnchor();
+            }
+            if(p.tools && p.tools.toggle){
+                p.tools.toggle.addClass('x-tool-collapse-'+ps);
+                p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');
+            }
+        }
+    },
+
+    // private
+    getCollapsedEl : function(){
+        if(!this.collapsedEl){
+            if(!this.toolTemplate){
+                var tt = new Ext.Template(
+                     '<div class="x-tool x-tool-{id}">&#160;</div>'
+                );
+                tt.disableFormats = true;
+                tt.compile();
+                Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;
+            }
+            this.collapsedEl = this.targetEl.createChild({
+                cls: "x-layout-collapsed x-layout-collapsed-"+this.position,
+                id: this.panel.id + '-xcollapsed'
+            });
+            this.collapsedEl.enableDisplayMode('block');
+
+            if(this.collapseMode == 'mini'){
+                this.collapsedEl.addClass('x-layout-cmini-'+this.position);
+                this.miniCollapsedEl = this.collapsedEl.createChild({
+                    cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;"
+                });
+                this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');
+                this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
+                this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});
+            }else {
+                if(this.collapsible !== false && !this.hideCollapseTool) {
+                    var t = this.toolTemplate.append(
+                            this.collapsedEl.dom,
+                            {id:'expand-'+this.position}, true);
+                    t.addClassOnOver('x-tool-expand-'+this.position+'-over');
+                    t.on('click', this.onExpandClick, this, {stopEvent:true});
+                }
+                if(this.floatable !== false || this.titleCollapse){
+                   this.collapsedEl.addClassOnOver("x-layout-collapsed-over");
+                   this.collapsedEl.on("click", this[this.floatable ? 'collapseClick' : 'onExpandClick'], this);
+                }
+            }
+        }
+        return this.collapsedEl;
+    },
+
+    // private
+    onExpandClick : function(e){
+        if(this.isSlid){
+            this.afterSlideIn();
+            this.panel.expand(false);
+        }else{
+            this.panel.expand();
+        }
+    },
+
+    // private
+    onCollapseClick : function(e){
+        this.panel.collapse();
+    },
+
+    // private
+    beforeCollapse : function(p, animate){
+        this.lastAnim = animate;
+        if(this.splitEl){
+            this.splitEl.hide();
+        }
+        this.getCollapsedEl().show();
+        this.panel.el.setStyle('z-index', 100);
+        this.isCollapsed = true;
+        this.layout.layout();
+    },
+
+    // private
+    onCollapse : function(animate){
+        this.panel.el.setStyle('z-index', 1);
+        if(this.lastAnim === false || this.panel.animCollapse === false){
+            this.getCollapsedEl().dom.style.visibility = 'visible';
+        }else{
+            this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});
+        }
+        this.state.collapsed = true;
+        this.panel.saveState();
+    },
+
+    // private
+    beforeExpand : function(animate){
+        var c = this.getCollapsedEl();
+        this.el.show();
+        if(this.position == 'east' || this.position == 'west'){
+            this.panel.setSize(undefined, c.getHeight());
+        }else{
+            this.panel.setSize(c.getWidth(), undefined);
+        }
+        c.hide();
+        c.dom.style.visibility = 'hidden';
+        this.panel.el.setStyle('z-index', this.floatingZIndex);
+    },
+
+    // private
+    onExpand : function(){
+        this.isCollapsed = false;
+        if(this.splitEl){
+            this.splitEl.show();
+        }
+        this.layout.layout();
+        this.panel.el.setStyle('z-index', 1);
+        this.state.collapsed = false;
+        this.panel.saveState();
+    },
+
+    // private
+    collapseClick : function(e){
+        if(this.isSlid){
+           e.stopPropagation();
+           this.slideIn();
+        }else{
+           e.stopPropagation();
+           this.slideOut();
+        }
+    },
+
+    // private
+    onHide : function(){
+        if(this.isCollapsed){
+            this.getCollapsedEl().hide();
+        }else if(this.splitEl){
+            this.splitEl.hide();
+        }
+    },
+
+    // private
+    onShow : function(){
+        if(this.isCollapsed){
+            this.getCollapsedEl().show();
+        }else if(this.splitEl){
+            this.splitEl.show();
+        }
+    },
+
+    /**
+     * True if this region is currently visible, else false.
+     * @return {Boolean}
+     */
+    isVisible : function(){
+        return !this.panel.hidden;
+    },
+
+    /**
+     * Returns the current margins for this region.  If the region is collapsed, the
+     * {@link #cmargins} (collapsed margins) value will be returned, otherwise the
+     * {@link #margins} value will be returned.
+     * @return {Object} An object containing the element's margins: <tt>{left: (left
+     * margin), top: (top margin), right: (right margin), bottom: (bottom margin)}</tt>
+     */
+    getMargins : function(){
+        return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;
+    },
+
+    /**
+     * Returns the current size of this region.  If the region is collapsed, the size of the
+     * collapsedEl will be returned, otherwise the size of the region's panel will be returned.
+     * @return {Object} An object containing the element's size: <tt>{width: (element width),
+     * height: (element height)}</tt>
+     */
+    getSize : function(){
+        return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();
+    },
+
+    /**
+     * Sets the specified panel as the container element for this region.
+     * @param {Ext.Panel} panel The new panel
+     */
+    setPanel : function(panel){
+        this.panel = panel;
+    },
+
+    /**
+     * Returns the minimum allowable width for this region.
+     * @return {Number} The minimum width
+     */
+    getMinWidth: function(){
+        return this.minWidth;
+    },
+
+    /**
+     * Returns the minimum allowable height for this region.
+     * @return {Number} The minimum height
+     */
+    getMinHeight: function(){
+        return this.minHeight;
+    },
+
+    // private
+    applyLayoutCollapsed : function(box){
+        var ce = this.getCollapsedEl();
+        ce.setLeftTop(box.x, box.y);
+        ce.setSize(box.width, box.height);
+    },
+
+    // private
+    applyLayout : function(box){
+        if(this.isCollapsed){
+            this.applyLayoutCollapsed(box);
+        }else{
+            this.panel.setPosition(box.x, box.y);
+            this.panel.setSize(box.width, box.height);
+        }
+    },
+
+    // private
+    beforeSlide: function(){
+        this.panel.beforeEffect();
+    },
+
+    // private
+    afterSlide : function(){
+        this.panel.afterEffect();
+    },
+
+    // private
+    initAutoHide : function(){
+        if(this.autoHide !== false){
+            if(!this.autoHideHd){
+                var st = new Ext.util.DelayedTask(this.slideIn, this);
+                this.autoHideHd = {
+                    "mouseout": function(e){
+                        if(!e.within(this.el, true)){
+                            st.delay(500);
+                        }
+                    },
+                    "mouseover" : function(e){
+                        st.cancel();
+                    },
+                    scope : this
+                };
+            }
+            this.el.on(this.autoHideHd);
+        }
+    },
+
+    // private
+    clearAutoHide : function(){
+        if(this.autoHide !== false){
+            this.el.un("mouseout", this.autoHideHd.mouseout);
+            this.el.un("mouseover", this.autoHideHd.mouseover);
+        }
+    },
+
+    // private
+    clearMonitor : function(){
+        Ext.getDoc().un("click", this.slideInIf, this);
+    },
+
+    /**
+     * If this Region is {@link #floatable}, this method slides this Region into full visibility <i>over the top
+     * of the center Region</i> where it floats until either {@link #slideIn} is called, or other regions of the layout
+     * are clicked, or the mouse exits the Region.
+     */
+    slideOut : function(){
+        if(this.isSlid || this.el.hasActiveFx()){
+            return;
+        }
+        this.isSlid = true;
+        var ts = this.panel.tools;
+        if(ts && ts.toggle){
+            ts.toggle.hide();
+        }
+        this.el.show();
+        if(this.position == 'east' || this.position == 'west'){
+            this.panel.setSize(undefined, this.collapsedEl.getHeight());
+        }else{
+            this.panel.setSize(this.collapsedEl.getWidth(), undefined);
+        }
+        this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];
+        this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());
+        this.el.setStyle("z-index", this.floatingZIndex+2);
+        this.panel.el.replaceClass('x-panel-collapsed', 'x-panel-floating');
+        if(this.animFloat !== false){
+            this.beforeSlide();
+            this.el.slideIn(this.getSlideAnchor(), {
+                callback: function(){
+                    this.afterSlide();
+                    this.initAutoHide();
+                    Ext.getDoc().on("click", this.slideInIf, this);
+                },
+                scope: this,
+                block: true
+            });
+        }else{
+            this.initAutoHide();
+             Ext.getDoc().on("click", this.slideInIf, this);
+        }
+    },
+
+    // private
+    afterSlideIn : function(){
+        this.clearAutoHide();
+        this.isSlid = false;
+        this.clearMonitor();
+        this.el.setStyle("z-index", "");
+        this.panel.el.replaceClass('x-panel-floating', 'x-panel-collapsed');
+        this.el.dom.style.left = this.restoreLT[0];
+        this.el.dom.style.top = this.restoreLT[1];
+
+        var ts = this.panel.tools;
+        if(ts && ts.toggle){
+            ts.toggle.show();
+        }
+    },
+
+    /**
+     * If this Region is {@link #floatable}, and this Region has been slid into floating visibility, then this method slides
+     * this region back into its collapsed state.
+     */
+    slideIn : function(cb){
+        if(!this.isSlid || this.el.hasActiveFx()){
+            Ext.callback(cb);
+            return;
+        }
+        this.isSlid = false;
+        if(this.animFloat !== false){
+            this.beforeSlide();
+            this.el.slideOut(this.getSlideAnchor(), {
+                callback: function(){
+                    this.el.hide();
+                    this.afterSlide();
+                    this.afterSlideIn();
+                    Ext.callback(cb);
+                },
+                scope: this,
+                block: true
+            });
+        }else{
+            this.el.hide();
+            this.afterSlideIn();
+        }
+    },
+
+    // private
+    slideInIf : function(e){
+        if(!e.within(this.el)){
+            this.slideIn();
+        }
+    },
+
+    // private
+    anchors : {
+        "west" : "left",
+        "east" : "right",
+        "north" : "top",
+        "south" : "bottom"
+    },
+
+    // private
+    sanchors : {
+        "west" : "l",
+        "east" : "r",
+        "north" : "t",
+        "south" : "b"
+    },
+
+    // private
+    canchors : {
+        "west" : "tl-tr",
+        "east" : "tr-tl",
+        "north" : "tl-bl",
+        "south" : "bl-tl"
+    },
+
+    // private
+    getAnchor : function(){
+        return this.anchors[this.position];
+    },
+
+    // private
+    getCollapseAnchor : function(){
+        return this.canchors[this.position];
+    },
+
+    // private
+    getSlideAnchor : function(){
+        return this.sanchors[this.position];
+    },
+
+    // private
+    getAlignAdj : function(){
+        var cm = this.cmargins;
+        switch(this.position){
+            case "west":
+                return [0, 0];
+            break;
+            case "east":
+                return [0, 0];
+            break;
+            case "north":
+                return [0, 0];
+            break;
+            case "south":
+                return [0, 0];
+            break;
+        }
+    },
+
+    // private
+    getExpandAdj : function(){
+        var c = this.collapsedEl, cm = this.cmargins;
+        switch(this.position){
+            case "west":
+                return [-(cm.right+c.getWidth()+cm.left), 0];
+            break;
+            case "east":
+                return [cm.right+c.getWidth()+cm.left, 0];
+            break;
+            case "north":
+                return [0, -(cm.top+cm.bottom+c.getHeight())];
+            break;
+            case "south":
+                return [0, cm.top+cm.bottom+c.getHeight()];
+            break;
+        }
+    }
+};
+
+/**
+ * @class Ext.layout.BorderLayout.SplitRegion
+ * @extends Ext.layout.BorderLayout.Region
+ * <p>This is a specialized type of {@link Ext.layout.BorderLayout.Region BorderLayout region} that
+ * has a built-in {@link Ext.SplitBar} for user resizing of regions.  The movement of the split bar
+ * is configurable to move either {@link #tickSize smooth or incrementally}.</p>
+ * @constructor
+ * Create a new SplitRegion.
+ * @param {Layout} layout The {@link Ext.layout.BorderLayout BorderLayout} instance that is managing this Region.
+ * @param {Object} config The configuration options
+ * @param {String} position The region position.  Valid values are: north, south, east, west and center.  Every
+ * BorderLayout must have a center region for the primary content -- all other regions are optional.
+ */
+Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){
+    Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);
+    // prevent switch
+    this.applyLayout = this.applyFns[pos];
+};
+
+Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {
+    /**
+     * @cfg {Number} tickSize
+     * The increment, in pixels by which to move this Region's {@link Ext.SplitBar SplitBar}.
+     * By default, the {@link Ext.SplitBar SplitBar} moves smoothly.
+     */
+    /**
+     * @cfg {String} splitTip
+     * The tooltip to display when the user hovers over a
+     * {@link Ext.layout.BorderLayout.Region#collapsible non-collapsible} region's split bar
+     * (defaults to <tt>"Drag to resize."</tt>).  Only applies if
+     * <tt>{@link #useSplitTips} = true</tt>.
+     */
+    splitTip : "Drag to resize.",
+    /**
+     * @cfg {String} collapsibleSplitTip
+     * The tooltip to display when the user hovers over a
+     * {@link Ext.layout.BorderLayout.Region#collapsible collapsible} region's split bar
+     * (defaults to "Drag to resize. Double click to hide."). Only applies if
+     * <tt>{@link #useSplitTips} = true</tt>.
+     */
+    collapsibleSplitTip : "Drag to resize. Double click to hide.",
+    /**
+     * @cfg {Boolean} useSplitTips
+     * <tt>true</tt> to display a tooltip when the user hovers over a region's split bar
+     * (defaults to <tt>false</tt>).  The tooltip text will be the value of either
+     * <tt>{@link #splitTip}</tt> or <tt>{@link #collapsibleSplitTip}</tt> as appropriate.
+     */
+    useSplitTips : false,
+
+    // private
+    splitSettings : {
+        north : {
+            orientation: Ext.SplitBar.VERTICAL,
+            placement: Ext.SplitBar.TOP,
+            maxFn : 'getVMaxSize',
+            minProp: 'minHeight',
+            maxProp: 'maxHeight'
+        },
+        south : {
+            orientation: Ext.SplitBar.VERTICAL,
+            placement: Ext.SplitBar.BOTTOM,
+            maxFn : 'getVMaxSize',
+            minProp: 'minHeight',
+            maxProp: 'maxHeight'
+        },
+        east : {
+            orientation: Ext.SplitBar.HORIZONTAL,
+            placement: Ext.SplitBar.RIGHT,
+            maxFn : 'getHMaxSize',
+            minProp: 'minWidth',
+            maxProp: 'maxWidth'
+        },
+        west : {
+            orientation: Ext.SplitBar.HORIZONTAL,
+            placement: Ext.SplitBar.LEFT,
+            maxFn : 'getHMaxSize',
+            minProp: 'minWidth',
+            maxProp: 'maxWidth'
+        }
+    },
+
+    // private
+    applyFns : {
+        west : function(box){
+            if(this.isCollapsed){
+                return this.applyLayoutCollapsed(box);
+            }
+            var sd = this.splitEl.dom, s = sd.style;
+            this.panel.setPosition(box.x, box.y);
+            var sw = sd.offsetWidth;
+            s.left = (box.x+box.width-sw)+'px';
+            s.top = (box.y)+'px';
+            s.height = Math.max(0, box.height)+'px';
+            this.panel.setSize(box.width-sw, box.height);
+        },
+        east : function(box){
+            if(this.isCollapsed){
+                return this.applyLayoutCollapsed(box);
+            }
+            var sd = this.splitEl.dom, s = sd.style;
+            var sw = sd.offsetWidth;
+            this.panel.setPosition(box.x+sw, box.y);
+            s.left = (box.x)+'px';
+            s.top = (box.y)+'px';
+            s.height = Math.max(0, box.height)+'px';
+            this.panel.setSize(box.width-sw, box.height);
+        },
+        north : function(box){
+            if(this.isCollapsed){
+                return this.applyLayoutCollapsed(box);
+            }
+            var sd = this.splitEl.dom, s = sd.style;
+            var sh = sd.offsetHeight;
+            this.panel.setPosition(box.x, box.y);
+            s.left = (box.x)+'px';
+            s.top = (box.y+box.height-sh)+'px';
+            s.width = Math.max(0, box.width)+'px';
+            this.panel.setSize(box.width, box.height-sh);
+        },
+        south : function(box){
+            if(this.isCollapsed){
+                return this.applyLayoutCollapsed(box);
+            }
+            var sd = this.splitEl.dom, s = sd.style;
+            var sh = sd.offsetHeight;
+            this.panel.setPosition(box.x, box.y+sh);
+            s.left = (box.x)+'px';
+            s.top = (box.y)+'px';
+            s.width = Math.max(0, box.width)+'px';
+            this.panel.setSize(box.width, box.height-sh);
+        }
+    },
+
+    // private
+    render : function(ct, p){
+        Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);
+
+        var ps = this.position;
+
+        this.splitEl = ct.createChild({
+            cls: "x-layout-split x-layout-split-"+ps, html: "&#160;",
+            id: this.panel.id + '-xsplit'
+        });
+
+        if(this.collapseMode == 'mini'){
+            this.miniSplitEl = this.splitEl.createChild({
+                cls: "x-layout-mini x-layout-mini-"+ps, html: "&#160;"
+            });
+            this.miniSplitEl.addClassOnOver('x-layout-mini-over');
+            this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});
+        }
+
+        var s = this.splitSettings[ps];
+
+        this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);
+        this.split.tickSize = this.tickSize;
+        this.split.placement = s.placement;
+        this.split.getMaximumSize = this[s.maxFn].createDelegate(this);
+        this.split.minSize = this.minSize || this[s.minProp];
+        this.split.on("beforeapply", this.onSplitMove, this);
+        this.split.useShim = this.useShim === true;
+        this.maxSize = this.maxSize || this[s.maxProp];
+
+        if(p.hidden){
+            this.splitEl.hide();
+        }
+
+        if(this.useSplitTips){
+            this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;
+        }
+        if(this.collapsible){
+            this.splitEl.on("dblclick", this.onCollapseClick,  this);
+        }
+    },
+
+    //docs inherit from superclass
+    getSize : function(){
+        if(this.isCollapsed){
+            return this.collapsedEl.getSize();
+        }
+        var s = this.panel.getSize();
+        if(this.position == 'north' || this.position == 'south'){
+            s.height += this.splitEl.dom.offsetHeight;
+        }else{
+            s.width += this.splitEl.dom.offsetWidth;
+        }
+        return s;
+    },
+
+    // private
+    getHMaxSize : function(){
+         var cmax = this.maxSize || 10000;
+         var center = this.layout.center;
+         return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());
+    },
+
+    // private
+    getVMaxSize : function(){
+        var cmax = this.maxSize || 10000;
+        var center = this.layout.center;
+        return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());
+    },
+
+    // private
+    onSplitMove : function(split, newSize){
+        var s = this.panel.getSize();
+        this.lastSplitSize = newSize;
+        if(this.position == 'north' || this.position == 'south'){
+            this.panel.setSize(s.width, newSize);
+            this.state.height = newSize;
+        }else{
+            this.panel.setSize(newSize, s.height);
+            this.state.width = newSize;
+        }
+        this.layout.layout();
+        this.panel.saveState();
+        return false;
+    },
+
+    /**
+     * Returns a reference to the split bar in use by this region.
+     * @return {Ext.SplitBar} The split bar
+     */
+    getSplitBar : function(){
+        return this.split;
+    },
+
+    // inherit docs
+    destroy : function() {
+        Ext.destroy(
+            this.miniSplitEl,
+            this.split,
+            this.splitEl
+        );
+    }
+});
+
+Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;/**
+ * @class Ext.layout.FormLayout
+ * @extends Ext.layout.AnchorLayout
+ * <p>This layout manager is specifically designed for rendering and managing child Components of
+ * {@link Ext.form.FormPanel forms}. It is responsible for rendering the labels of
+ * {@link Ext.form.Field Field}s.</p>
+ *
+ * <p>This layout manager is used when a Container is configured with the <tt>layout:'form'</tt>
+ * {@link Ext.Container#layout layout} config option, and should generally not need to be created directly
+ * via the new keyword. See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>
+ *
+ * <p>In an application, it will usually be preferrable to use a {@link Ext.form.FormPanel FormPanel}
+ * (which is configured with FormLayout as its layout class by default) since it also provides built-in
+ * functionality for {@link Ext.form.BasicForm#doAction loading, validating and submitting} the form.</p>
+ *
+ * <p>A {@link Ext.Container Container} <i>using</i> the FormLayout layout manager (e.g.
+ * {@link Ext.form.FormPanel} or specifying <tt>layout:'form'</tt>) can also accept the following
+ * layout-specific config properties:<div class="mdetail-params"><ul>
+ * <li><b><tt>{@link Ext.form.FormPanel#hideLabels hideLabels}</tt></b></li>
+ * <li><b><tt>{@link Ext.form.FormPanel#labelAlign labelAlign}</tt></b></li>
+ * <li><b><tt>{@link Ext.form.FormPanel#labelPad labelPad}</tt></b></li>
+ * <li><b><tt>{@link Ext.form.FormPanel#labelSeparator labelSeparator}</tt></b></li>
+ * <li><b><tt>{@link Ext.form.FormPanel#labelWidth labelWidth}</tt></b></li>
+ * </ul></div></p>
+ *
+ * <p>Any Component (including Fields) managed by FormLayout accepts the following as a config option:
+ * <div class="mdetail-params"><ul>
+ * <li><b><tt>{@link Ext.Component#anchor anchor}</tt></b></li>
+ * </ul></div></p>
+ *
+ * <p>Any Component managed by FormLayout may be rendered as a form field (with an associated label) by
+ * configuring it with a non-null <b><tt>{@link Ext.Component#fieldLabel fieldLabel}</tt></b>. Components configured
+ * in this way may be configured with the following options which affect the way the FormLayout renders them:
+ * <div class="mdetail-params"><ul>
+ * <li><b><tt>{@link Ext.Component#clearCls clearCls}</tt></b></li>
+ * <li><b><tt>{@link Ext.Component#fieldLabel fieldLabel}</tt></b></li>
+ * <li><b><tt>{@link Ext.Component#hideLabel hideLabel}</tt></b></li>
+ * <li><b><tt>{@link Ext.Component#itemCls itemCls}</tt></b></li>
+ * <li><b><tt>{@link Ext.Component#labelSeparator labelSeparator}</tt></b></li>
+ * <li><b><tt>{@link Ext.Component#labelStyle labelStyle}</tt></b></li>
+ * </ul></div></p>
+ *
+ * <p>Example usage:</p>
+ * <pre><code>
+// Required if showing validation messages
+Ext.QuickTips.init();
+
+// While you can create a basic Panel with layout:'form', practically
+// you should usually use a FormPanel to also get its form functionality
+// since it already creates a FormLayout internally.
+var form = new Ext.form.FormPanel({
+    title: 'Form Layout',
+    bodyStyle: 'padding:15px',
+    width: 350,
+    defaultType: 'textfield',
+    defaults: {
+        // applied to each contained item
+        width: 230,
+        msgTarget: 'side'
+    },
+    items: [{
+            fieldLabel: 'First Name',
+            name: 'first',
+            allowBlank: false,
+            {@link Ext.Component#labelSeparator labelSeparator}: ':' // override labelSeparator layout config
+        },{
+            fieldLabel: 'Last Name',
+            name: 'last'
+        },{
+            fieldLabel: 'Email',
+            name: 'email',
+            vtype:'email'
+        }, {
+            xtype: 'textarea',
+            hideLabel: true,     // override hideLabels layout config
+            name: 'msg',
+            anchor: '100% -53'
+        }
+    ],
+    buttons: [
+        {text: 'Save'},
+        {text: 'Cancel'}
+    ],
+    layoutConfig: {
+        {@link #labelSeparator}: '~' // superseded by assignment below
+    },
+    // config options applicable to container when layout='form':
+    hideLabels: false,
+    labelAlign: 'left',   // or 'right' or 'top'
+    {@link Ext.form.FormPanel#labelSeparator labelSeparator}: '>>', // takes precedence over layoutConfig value
+    labelWidth: 65,       // defaults to 100
+    labelPad: 8           // defaults to 5, must specify labelWidth to be honored
+});
+</code></pre>
+ */
+Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {
+
+    /**
+     * @cfg {String} labelSeparator
+     * See {@link Ext.form.FormPanel}.{@link Ext.form.FormPanel#labelSeparator labelSeparator}.  Configuration
+     * of this property at the <b>container</b> level takes precedence.
+     */
+    labelSeparator : ':',
+
+    /**
+     * Read only. The CSS style specification string added to field labels in this layout if not
+     * otherwise {@link Ext.Component#labelStyle specified by each contained field}.
+     * @type String
+     * @property labelStyle
+     */
+
+    // private
+    setContainer : function(ct){
+        Ext.layout.FormLayout.superclass.setContainer.call(this, ct);
+        if(ct.labelAlign){
+            ct.addClass('x-form-label-'+ct.labelAlign);
+        }
+
+        if(ct.hideLabels){
+            this.labelStyle = "display:none";
+            this.elementStyle = "padding-left:0;";
+            this.labelAdjust = 0;
+        }else{
+            this.labelSeparator = ct.labelSeparator || this.labelSeparator;
+            ct.labelWidth = ct.labelWidth || 100;
+            if(typeof ct.labelWidth == 'number'){
+                var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5);
+                this.labelAdjust = ct.labelWidth+pad;
+                this.labelStyle = "width:"+ct.labelWidth+"px;";
+                this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px';
+            }
+            if(ct.labelAlign == 'top'){
+                this.labelStyle = "width:auto;";
+                this.labelAdjust = 0;
+                this.elementStyle = "padding-left:0;";
+            }
+        }
+    },
+
+    //private
+    getLabelStyle: function(s){
+        var ls = '', items = [this.labelStyle, s];
+        for (var i = 0, len = items.length; i < len; ++i){
+            if (items[i]){
+                ls += items[i];
+                if (ls.substr(-1, 1) != ';'){
+                    ls += ';'
+                }
+            }
+        }
+        return ls;
+    },
+
+    /**
+     * @cfg {Ext.Template} fieldTpl
+     * A {@link Ext.Template#compile compile}d {@link Ext.Template} for rendering
+     * the fully wrapped, labeled and styled form Field. Defaults to:</p><pre><code>
+new Ext.Template(
+    &#39;&lt;div class="x-form-item {itemCls}" tabIndex="-1">&#39;,
+        &#39;&lt;&#108;abel for="{id}" style="{labelStyle}" class="x-form-item-&#108;abel">{&#108;abel}{labelSeparator}&lt;/&#108;abel>&#39;,
+        &#39;&lt;div class="x-form-element" id="x-form-el-{id}" style="{elementStyle}">&#39;,
+        &#39;&lt;/div>&lt;div class="{clearCls}">&lt;/div>&#39;,
+    '&lt;/div>'
+);
+</code></pre>
+     * <p>This may be specified to produce a different DOM structure when rendering form Fields.</p>
+     * <p>A description of the properties within the template follows:</p><div class="mdetail-params"><ul>
+     * <li><b><tt>itemCls</tt></b> : String<div class="sub-desc">The CSS class applied to the outermost div wrapper
+     * that contains this field label and field element (the default class is <tt>'x-form-item'</tt> and <tt>itemCls</tt>
+     * will be added to that). If supplied, <tt>itemCls</tt> at the field level will override the default <tt>itemCls</tt>
+     * supplied at the container level.</div></li>
+     * <li><b><tt>id</tt></b> : String<div class="sub-desc">The id of the Field</div></li>
+     * <li><b><tt>{@link #labelStyle}</tt></b> : String<div class="sub-desc">
+     * A CSS style specification string to add to the field label for this field (defaults to <tt>''</tt> or the
+     * {@link #labelStyle layout's value for <tt>labelStyle</tt>}).</div></li>
+     * <li><b><tt>label</tt></b> : String<div class="sub-desc">The text to display as the label for this
+     * field (defaults to <tt>''</tt>)</div></li>
+     * <li><b><tt>{@link #labelSeparator}</tt></b> : String<div class="sub-desc">The separator to display after
+     * the text of the label for this field (defaults to a colon <tt>':'</tt> or the
+     * {@link #labelSeparator layout's value for labelSeparator}). To hide the separator use empty string ''.</div></li>
+     * <li><b><tt>elementStyle</tt></b> : String<div class="sub-desc">The styles text for the input element's wrapper.</div></li>
+     * <li><b><tt>clearCls</tt></b> : String<div class="sub-desc">The CSS class to apply to the special clearing div
+     * rendered directly after each form field wrapper (defaults to <tt>'x-form-clear-left'</tt>)</div></li>
+     * </ul></div>
+     * <p>Also see <tt>{@link #getTemplateArgs}</tt></p>
+     */
+
+    // private
+    renderItem : function(c, position, target){
+        if(c && !c.rendered && (c.isFormField || c.fieldLabel) && c.inputType != 'hidden'){
+            var args = this.getTemplateArgs(c);
+            if(typeof position == 'number'){
+                position = target.dom.childNodes[position] || null;
+            }
+            if(position){
+                this.fieldTpl.insertBefore(position, args);
+            }else{
+                this.fieldTpl.append(target, args);
+            }
+            c.render('x-form-el-'+c.id);
+        }else {
+            Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);
+        }
+    },
+
+    /**
+     * <p>Provides template arguments for rendering the fully wrapped, labeled and styled form Field.</p>
+     * <p>This method returns an object hash containing properties used by the layout's {@link #fieldTpl}
+     * to create a correctly wrapped, labeled and styled form Field. This may be overriden to
+     * create custom layouts. The properties which must be returned are:</p><div class="mdetail-params"><ul>
+     * <li><b><tt>itemCls</tt></b> : String<div class="sub-desc">The CSS class applied to the outermost div wrapper
+     * that contains this field label and field element (the default class is <tt>'x-form-item'</tt> and <tt>itemCls</tt>
+     * will be added to that). If supplied, <tt>itemCls</tt> at the field level will override the default <tt>itemCls</tt>
+     * supplied at the container level.</div></li>
+     * <li><b><tt>id</tt></b> : String<div class="sub-desc">The id of the Field</div></li>
+     * <li><b><tt>{@link #labelStyle}</tt></b> : String<div class="sub-desc">
+     * A CSS style specification string to add to the field label for this field (defaults to <tt>''</tt> or the
+     * {@link #labelStyle layout's value for <tt>labelStyle</tt>}).</div></li>
+     * <li><b><tt>label</tt></b> : String<div class="sub-desc">The text to display as the label for this
+     * field (defaults to <tt>''</tt>)</div></li>
+     * <li><b><tt>{@link #labelSeparator}</tt></b> : String<div class="sub-desc">The separator to display after
+     * the text of the label for this field (defaults to a colon <tt>':'</tt> or the
+     * {@link #labelSeparator layout's value for labelSeparator}). To hide the separator use empty string ''.</div></li>
+     * <li><b><tt>elementStyle</tt></b> : String<div class="sub-desc">The styles text for the input element's wrapper.</div></li>
+     * <li><b><tt>clearCls</tt></b> : String<div class="sub-desc">The CSS class to apply to the special clearing div
+     * rendered directly after each form field wrapper (defaults to <tt>'x-form-clear-left'</tt>)</div></li>
+     * </ul></div>
+     * @param field The {@link Field Ext.form.Field} being rendered.
+     * @return An object hash containing the properties required to render the Field.
+     */
+    getTemplateArgs: function(field) {
+        var noLabelSep = !field.fieldLabel || field.hideLabel;
+        return {
+            id: field.id,
+            label: field.fieldLabel,
+            labelStyle: field.labelStyle||this.labelStyle||'',
+            elementStyle: this.elementStyle||'',
+            labelSeparator: noLabelSep ? '' : (typeof field.labelSeparator == 'undefined' ? this.labelSeparator : field.labelSeparator),
+            itemCls: (field.itemCls||this.container.itemCls||'') + (field.hideLabel ? ' x-hide-label' : ''),
+            clearCls: field.clearCls || 'x-form-clear-left'
+        };
+    },
+
+    // private
+    adjustWidthAnchor : function(value, comp){
+        return value - (comp.isFormField || comp.fieldLabel  ? (comp.hideLabel ? 0 : this.labelAdjust) : 0);
+    },
+
+    // private
+    isValidParent : function(c, target){
+        return true;
+    }
+
+    /**
+     * @property activeItem
+     * @hide
+     */
+});
+
+Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;/**\r
+ * @class Ext.layout.AccordionLayout\r
+ * @extends Ext.layout.FitLayout\r
+ * <p>This is a layout that contains multiple panels in an expandable accordion style such that only\r
+ * <b>one panel can be open at any given time</b>.  Each panel has built-in support for expanding and collapsing.\r
+ * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>\r
+ * configuration property.  See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>\r
+ * <p>Example usage:</p>\r
+ * <pre><code>\r
+var accordion = new Ext.Panel({\r
+    title: 'Accordion Layout',\r
+    layout:'accordion',\r
+    defaults: {\r
+        // applied to each contained panel\r
+        bodyStyle: 'padding:15px'\r
+    },\r
+    layoutConfig: {\r
+        // layout-specific configs go here\r
+        titleCollapse: false,\r
+        animate: true,\r
+        activeOnTop: true\r
+    },\r
+    items: [{\r
+        title: 'Panel 1',\r
+        html: '&lt;p&gt;Panel content!&lt;/p&gt;'\r
+    },{\r
+        title: 'Panel 2',\r
+        html: '&lt;p&gt;Panel content!&lt;/p&gt;'\r
+    },{\r
+        title: 'Panel 3',\r
+        html: '&lt;p&gt;Panel content!&lt;/p&gt;'\r
+    }]\r
 });\r
+</code></pre>\r
+ */\r
+Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, {\r
+    /**\r
+     * @cfg {Boolean} fill\r
+     * True to adjust the active item's height to fill the available space in the container, false to use the\r
+     * item's current height, or auto height if not explicitly set (defaults to true).\r
+     */\r
+    fill : true,\r
+    /**\r
+     * @cfg {Boolean} autoWidth\r
+     * True to set each contained item's width to 'auto', false to use the item's current width (defaults to true).\r
+     * Note that some components, in particular the {@link Ext.grid.GridPanel grid}, will not function properly within\r
+     * layouts if they have auto width, so in such cases this config should be set to false.\r
+     */\r
+    autoWidth : true,\r
+    /**\r
+     * @cfg {Boolean} titleCollapse\r
+     * True to allow expand/collapse of each contained panel by clicking anywhere on the title bar, false to allow\r
+     * expand/collapse only when the toggle tool button is clicked (defaults to true).  When set to false,\r
+     * {@link #hideCollapseTool} should be false also.\r
+     */\r
+    titleCollapse : true,\r
+    /**\r
+     * @cfg {Boolean} hideCollapseTool\r
+     * True to hide the contained panels' collapse/expand toggle buttons, false to display them (defaults to false).\r
+     * When set to true, {@link #titleCollapse} should be true also.\r
+     */\r
+    hideCollapseTool : false,\r
+    /**\r
+     * @cfg {Boolean} collapseFirst\r
+     * True to make sure the collapse/expand toggle button always renders first (to the left of) any other tools\r
+     * in the contained panels' title bars, false to render it last (defaults to false).\r
+     */\r
+    collapseFirst : false,\r
+    /**\r
+     * @cfg {Boolean} animate\r
+     * True to slide the contained panels open and closed during expand/collapse using animation, false to open and\r
+     * close directly with no animation (defaults to false).  Note: to defer to the specific config setting of each\r
+     * contained panel for this property, set this to undefined at the layout level.\r
+     */\r
+    animate : false,\r
+    /**\r
+     * @cfg {Boolean} sequence\r
+     * <b>Experimental</b>. If animate is set to true, this will result in each animation running in sequence.\r
+     */\r
+    sequence : false,\r
+    /**\r
+     * @cfg {Boolean} activeOnTop\r
+     * True to swap the position of each panel as it is expanded so that it becomes the first item in the container,\r
+     * false to keep the panels in the rendered order. <b>This is NOT compatible with "animate:true"</b> (defaults to false).\r
+     */\r
+    activeOnTop : false,\r
 \r
-Ext.Updater = Ext.extend(Ext.util.Observable, {\r
-    constructor: function(el, forceNew){\r
-        el = Ext.get(el);\r
-        if(!forceNew && el.updateManager){\r
-            return el.updateManager;\r
+    renderItem : function(c){\r
+        if(this.animate === false){\r
+            c.animCollapse = false;\r
         }\r
-        \r
-        this.el = el;\r
-        \r
-        this.defaultUrl = null;\r
-\r
-        this.addEvents(\r
-            \r
-            "beforeupdate",\r
-            \r
-            "update",\r
-            \r
-            "failure"\r
-        );\r
-        var d = Ext.Updater.defaults;\r
-        \r
-        this.sslBlankUrl = d.sslBlankUrl;\r
-        \r
-        this.disableCaching = d.disableCaching;\r
-        \r
-        this.indicatorText = d.indicatorText;\r
-        \r
-        this.showLoadIndicator = d.showLoadIndicator;\r
-        \r
-        this.timeout = d.timeout;\r
-        \r
-        this.loadScripts = d.loadScripts;\r
-        \r
-        this.transaction = null;\r
-        \r
-        this.refreshDelegate = this.refresh.createDelegate(this);\r
-        \r
-        this.updateDelegate = this.update.createDelegate(this);\r
-        \r
-        this.formUpdateDelegate = this.formUpdate.createDelegate(this);\r
-\r
-        if(!this.renderer){\r
-         \r
-        this.renderer = this.getDefaultRenderer();\r
+        c.collapsible = true;\r
+        if(this.autoWidth){\r
+            c.autoWidth = true;\r
         }\r
-        Ext.Updater.superclass.constructor.call(this);\r
-    },\r
-    \r
-    getDefaultRenderer: function() {\r
-        return new Ext.Updater.BasicRenderer();\r
-    },\r
-    \r
-    getEl : function(){\r
-        return this.el;\r
+        if(this.titleCollapse){\r
+            c.titleCollapse = true;\r
+        }\r
+        if(this.hideCollapseTool){\r
+            c.hideCollapseTool = true;\r
+        }\r
+        if(this.collapseFirst !== undefined){\r
+            c.collapseFirst = this.collapseFirst;\r
+        }\r
+        if(!this.activeItem && !c.collapsed){\r
+            this.activeItem = c;\r
+        }else if(this.activeItem && this.activeItem != c){\r
+            c.collapsed = true;\r
+        }\r
+        Ext.layout.AccordionLayout.superclass.renderItem.apply(this, arguments);\r
+        c.header.addClass('x-accordion-hd');\r
+        c.on('beforeexpand', this.beforeExpand, this);\r
     },\r
 \r
-    \r
-    update : function(url, params, callback, discardUrl){\r
-        if(this.fireEvent("beforeupdate", this.el, url, params) !== false){\r
-            var cfg, callerScope;\r
-            if(typeof url == "object"){ // must be config object\r
-                cfg = url;\r
-                url = cfg.url;\r
-                params = params || cfg.params;\r
-                callback = callback || cfg.callback;\r
-                discardUrl = discardUrl || cfg.discardUrl;\r
-                callerScope = cfg.scope;\r
-                if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};\r
-                if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};\r
-                if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};\r
-                if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};\r
-            }\r
-            this.showLoading();\r
-\r
-            if(!discardUrl){\r
-                this.defaultUrl = url;\r
-            }\r
-            if(typeof url == "function"){\r
-                url = url.call(this);\r
-            }\r
-\r
-            var o = Ext.apply({}, {\r
-                url : url,\r
-                params: (typeof params == "function" && callerScope) ? params.createDelegate(callerScope) : params,\r
-                success: this.processSuccess,\r
-                failure: this.processFailure,\r
-                scope: this,\r
-                callback: undefined,\r
-                timeout: (this.timeout*1000),\r
-                disableCaching: this.disableCaching,\r
-                argument: {\r
-                    "options": cfg,\r
-                    "url": url,\r
-                    "form": null,\r
-                    "callback": callback,\r
-                    "scope": callerScope || window,\r
-                    "params": params\r
+    // private\r
+    beforeExpand : function(p, anim){\r
+        var ai = this.activeItem;\r
+        if(ai){\r
+            if(this.sequence){\r
+                delete this.activeItem;\r
+                if (!ai.collapsed){\r
+                    ai.collapse({callback:function(){\r
+                        p.expand(anim || true);\r
+                    }, scope: this});\r
+                    return false;\r
                 }\r
-            }, cfg);\r
-\r
-            this.transaction = Ext.Ajax.request(o);\r
+            }else{\r
+                ai.collapse(this.animate);\r
+            }\r
+        }\r
+        this.activeItem = p;\r
+        if(this.activeOnTop){\r
+            p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);\r
         }\r
+        this.layout();\r
     },\r
 \r
-    \r
-    formUpdate : function(form, url, reset, callback){\r
-        if(this.fireEvent("beforeupdate", this.el, form, url) !== false){\r
-            if(typeof url == "function"){\r
-                url = url.call(this);\r
-            }\r
-            form = Ext.getDom(form)\r
-            this.transaction = Ext.Ajax.request({\r
-                form: form,\r
-                url:url,\r
-                success: this.processSuccess,\r
-                failure: this.processFailure,\r
-                scope: this,\r
-                timeout: (this.timeout*1000),\r
-                argument: {\r
-                    "url": url,\r
-                    "form": form,\r
-                    "callback": callback,\r
-                    "reset": reset\r
-                }\r
+    // private\r
+    setItemSize : function(item, size){\r
+        if(this.fill && item){\r
+            var hh = 0;\r
+            this.container.items.each(function(p){\r
+                if(p != item){\r
+                    hh += p.header.getHeight();\r
+                }    \r
             });\r
-            this.showLoading.defer(1, this);\r
+            size.height -= hh;\r
+            item.setSize(size);\r
         }\r
     },\r
 \r
-    \r
-    refresh : function(callback){\r
-        if(this.defaultUrl == null){\r
-            return;\r
+    /**\r
+     * Sets the active (expanded) item in the layout.\r
+     * @param {String/Number} item The string component id or numeric index of the item to activate\r
+     */\r
+    setActiveItem : function(item){\r
+        item = this.container.getComponent(item);\r
+        if(this.activeItem != item){\r
+            if(item.rendered && item.collapsed){\r
+                item.expand();\r
+            }else{\r
+                this.activeItem = item;\r
+            }\r
         }\r
-        this.update(this.defaultUrl, null, callback, true);\r
-    },\r
 \r
-    \r
-    startAutoRefresh : function(interval, url, params, callback, refreshNow){\r
-        if(refreshNow){\r
-            this.update(url || this.defaultUrl, params, callback, true);\r
-        }\r
-        if(this.autoRefreshProcId){\r
-            clearInterval(this.autoRefreshProcId);\r
-        }\r
-        this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);\r
-    },\r
+    }\r
+});\r
+Ext.Container.LAYOUTS.accordion = Ext.layout.AccordionLayout;\r
+\r
+//backwards compat\r
+Ext.layout.Accordion = Ext.layout.AccordionLayout;/**\r
+ * @class Ext.layout.TableLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * <p>This layout allows you to easily render content into an HTML table.  The total number of columns can be\r
+ * specified, and rowspan and colspan can be used to create complex layouts within the table.\r
+ * This class is intended to be extended or created via the layout:'table' {@link Ext.Container#layout} config,\r
+ * and should generally not need to be created directly via the new keyword.</p>\r
+ * <p>Note that when creating a layout via config, the layout-specific config properties must be passed in via\r
+ * the {@link Ext.Container#layoutConfig} object which will then be applied internally to the layout.  In the\r
+ * case of TableLayout, the only valid layout config property is {@link #columns}.  However, the items added to a\r
+ * TableLayout can supply the following table-specific config properties:</p>\r
+ * <ul>\r
+ * <li><b>rowspan</b> Applied to the table cell containing the item.</li>\r
+ * <li><b>colspan</b> Applied to the table cell containing the item.</li>\r
+ * <li><b>cellId</b> An id applied to the table cell containing the item.</li>\r
+ * <li><b>cellCls</b> A CSS class name added to the table cell containing the item.</li>\r
+ * </ul>\r
+ * <p>The basic concept of building up a TableLayout is conceptually very similar to building up a standard\r
+ * HTML table.  You simply add each panel (or "cell") that you want to include along with any span attributes\r
+ * specified as the special config properties of rowspan and colspan which work exactly like their HTML counterparts.\r
+ * Rather than explicitly creating and nesting rows and columns as you would in HTML, you simply specify the\r
+ * total column count in the layoutConfig and start adding panels in their natural order from left to right,\r
+ * top to bottom.  The layout will automatically figure out, based on the column count, rowspans and colspans,\r
+ * how to position each panel within the table.  Just like with HTML tables, your rowspans and colspans must add\r
+ * up correctly in your overall layout or you'll end up with missing and/or extra cells!  Example usage:</p>\r
+ * <pre><code>\r
+// This code will generate a layout table that is 3 columns by 2 rows\r
+// with some spanning included.  The basic layout will be:\r
+// +--------+-----------------+\r
+// |   A    |   B             |\r
+// |        |--------+--------|\r
+// |        |   C    |   D    |\r
+// +--------+--------+--------+\r
+var table = new Ext.Panel({\r
+    title: 'Table Layout',\r
+    layout:'table',\r
+    defaults: {\r
+        // applied to each contained panel\r
+        bodyStyle:'padding:20px'\r
+    },\r
+    layoutConfig: {\r
+        // The total column count must be specified here\r
+        columns: 3\r
+    },\r
+    items: [{\r
+        html: '&lt;p&gt;Cell A content&lt;/p&gt;',\r
+        rowspan: 2\r
+    },{\r
+        html: '&lt;p&gt;Cell B content&lt;/p&gt;',\r
+        colspan: 2\r
+    },{\r
+        html: '&lt;p&gt;Cell C content&lt;/p&gt;',\r
+        cellCls: 'highlight'\r
+    },{\r
+        html: '&lt;p&gt;Cell D content&lt;/p&gt;'\r
+    }]\r
+});\r
+</code></pre>\r
+ */\r
+Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
+    /**\r
+     * @cfg {Number} columns\r
+     * The total number of columns to create in the table for this layout.  If not specified, all Components added to\r
+     * this layout will be rendered into a single row using one column per Component.\r
+     */\r
 \r
-    \r
-     stopAutoRefresh : function(){\r
-        if(this.autoRefreshProcId){\r
-            clearInterval(this.autoRefreshProcId);\r
-            delete this.autoRefreshProcId;\r
-        }\r
-    },\r
+    // private\r
+    monitorResize:false,\r
 \r
+    /**\r
+     * @cfg {Object} tableAttrs\r
+     * <p>An object containing properties which are added to the {@link Ext.DomHelper DomHelper} specification\r
+     * used to create the layout's <tt>&lt;table&gt;</tt> element. Example:</p><pre><code>\r
+{\r
+    xtype: 'panel',\r
+    layout: 'table',\r
+    layoutConfig: {\r
+        tableAttrs: {\r
+               style: {\r
+                       width: '100%'\r
+               }\r
+        },\r
+        columns: 3\r
+    }\r
+}</code></pre>\r
+     */\r
+    tableAttrs:null,\r
     \r
-    isAutoRefreshing : function(){\r
-       return this.autoRefreshProcId ? true : false;\r
-    },\r
+    // private\r
+    setContainer : function(ct){\r
+        Ext.layout.TableLayout.superclass.setContainer.call(this, ct);\r
 \r
-    \r
-    showLoading : function(){\r
-        if(this.showLoadIndicator){\r
-            this.el.update(this.indicatorText);\r
-        }\r
+        this.currentRow = 0;\r
+        this.currentColumn = 0;\r
+        this.cells = [];\r
     },\r
 \r
     // private\r
-    processSuccess : function(response){\r
-        this.transaction = null;\r
-        if(response.argument.form && response.argument.reset){\r
-            try{ // put in try/catch since some older FF releases had problems with this\r
-                response.argument.form.reset();\r
-            }catch(e){}\r
-        }\r
-        if(this.loadScripts){\r
-            this.renderer.render(this.el, response, this,\r
-                this.updateComplete.createDelegate(this, [response]));\r
-        }else{\r
-            this.renderer.render(this.el, response, this);\r
-            this.updateComplete(response);\r
+    onLayout : function(ct, target){\r
+        var cs = ct.items.items, len = cs.length, c, i;\r
+\r
+        if(!this.table){\r
+            target.addClass('x-table-layout-ct');\r
+\r
+            this.table = target.createChild(\r
+                Ext.apply({tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, this.tableAttrs), null, true);\r
         }\r
+        this.renderAll(ct, target);\r
     },\r
 \r
     // private\r
-    updateComplete : function(response){\r
-        this.fireEvent("update", this.el, response);\r
-        if(typeof response.argument.callback == "function"){\r
-            response.argument.callback.call(response.argument.scope, this.el, true, response, response.argument.options);\r
+    getRow : function(index){\r
+        var row = this.table.tBodies[0].childNodes[index];\r
+        if(!row){\r
+            row = document.createElement('tr');\r
+            this.table.tBodies[0].appendChild(row);\r
         }\r
+        return row;\r
     },\r
 \r
     // private\r
-    processFailure : function(response){\r
-        this.transaction = null;\r
-        this.fireEvent("failure", this.el, response);\r
-        if(typeof response.argument.callback == "function"){\r
-            response.argument.callback.call(response.argument.scope, this.el, false, response, response.argument.options);\r
+    getNextCell : function(c){\r
+        var cell = this.getNextNonSpan(this.currentColumn, this.currentRow);\r
+        var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1];\r
+        for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){\r
+            if(!this.cells[rowIndex]){\r
+                this.cells[rowIndex] = [];\r
+            }\r
+            for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){\r
+                this.cells[rowIndex][colIndex] = true;\r
+            }\r
         }\r
+        var td = document.createElement('td');\r
+        if(c.cellId){\r
+            td.id = c.cellId;\r
+        }\r
+        var cls = 'x-table-layout-cell';\r
+        if(c.cellCls){\r
+            cls += ' ' + c.cellCls;\r
+        }\r
+        td.className = cls;\r
+        if(c.colspan){\r
+            td.colSpan = c.colspan;\r
+        }\r
+        if(c.rowspan){\r
+            td.rowSpan = c.rowspan;\r
+        }\r
+        this.getRow(curRow).appendChild(td);\r
+        return td;\r
     },\r
-\r
-    \r
-    setRenderer : function(renderer){\r
-        this.renderer = renderer;\r
-    },\r
-\r
-    \r
-    getRenderer : function(){\r
-       return this.renderer;\r
-    },\r
-\r
     \r
-    setDefaultUrl : function(defaultUrl){\r
-        this.defaultUrl = defaultUrl;\r
+    // private\r
+    getNextNonSpan: function(colIndex, rowIndex){\r
+        var cols = this.columns;\r
+        while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) {\r
+            if(cols && colIndex >= cols){\r
+                rowIndex++;\r
+                colIndex = 0;\r
+            }else{\r
+                colIndex++;\r
+            }\r
+        }\r
+        return [colIndex, rowIndex];\r
     },\r
 \r
-    \r
-    abort : function(){\r
-        if(this.transaction){\r
-            Ext.Ajax.abort(this.transaction);\r
+    // private\r
+    renderItem : function(c, position, target){\r
+        if(c && !c.rendered){\r
+            c.render(this.getNextCell(c));\r
+            if(this.extraCls){\r
+                var t = c.getPositionEl ? c.getPositionEl() : c;\r
+                t.addClass(this.extraCls);\r
+            }\r
         }\r
     },\r
 \r
-    \r
-    isUpdating : function(){\r
-        if(this.transaction){\r
-            return Ext.Ajax.isLoading(this.transaction);\r
-        }\r
-        return false;\r
+    // private\r
+    isValidParent : function(c, target){\r
+        return true;\r
     }\r
+\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
 });\r
 \r
+Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout;/**\r
+ * @class Ext.layout.AbsoluteLayout\r
+ * @extends Ext.layout.AnchorLayout\r
+ * <p>This is a layout that inherits the anchoring of <b>{@link Ext.layout.AnchorLayout}</b> and adds the\r
+ * ability for x/y positioning using the standard x and y component config options.</p>\r
+ * <p>This class is intended to be extended or created via the <tt><b>{@link Ext.Container#layout layout}</b></tt>\r
+ * configuration property.  See <tt><b>{@link Ext.Container#layout}</b></tt> for additional details.</p>\r
+ * <p>Example usage:</p>\r
+ * <pre><code>\r
+var form = new Ext.form.FormPanel({\r
+    title: 'Absolute Layout',\r
+    layout:'absolute',\r
+    layoutConfig: {\r
+        // layout-specific configs go here\r
+        extraCls: 'x-abs-layout-item',\r
+    },\r
+    baseCls: 'x-plain',\r
+    url:'save-form.php',\r
+    defaultType: 'textfield',\r
+    items: [{\r
+        x: 0,\r
+        y: 5,\r
+        xtype:'label',\r
+        text: 'Send To:'\r
+    },{\r
+        x: 60,\r
+        y: 0,\r
+        name: 'to',\r
+        anchor:'100%'  // anchor width by percentage\r
+    },{\r
+        x: 0,\r
+        y: 35,\r
+        xtype:'label',\r
+        text: 'Subject:'\r
+    },{\r
+        x: 60,\r
+        y: 30,\r
+        name: 'subject',\r
+        anchor: '100%'  // anchor width by percentage\r
+    },{\r
+        x:0,\r
+        y: 60,\r
+        xtype: 'textarea',\r
+        name: 'msg',\r
+        anchor: '100% 100%'  // anchor width and height\r
+    }]\r
+});\r
+</code></pre>\r
+ */\r
+Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {\r
 \r
-   Ext.Updater.defaults = {\r
-       \r
-         timeout : 30,\r
-         \r
-        loadScripts : false,\r
-        \r
-        sslBlankUrl : (Ext.SSL_SECURE_URL || "javascript:false"),\r
-        \r
-        disableCaching : false,\r
-        \r
-        showLoadIndicator : true,\r
-        \r
-        indicatorText : '<div class="loading-indicator">Loading...</div>'\r
-   };\r
+    extraCls: 'x-abs-layout-item',\r
 \r
+    onLayout : function(ct, target){\r
+        target.position();\r
+        this.paddingLeft = target.getPadding('l');\r
+        this.paddingTop = target.getPadding('t');\r
 \r
-Ext.Updater.updateElement = function(el, url, params, options){\r
-    var um = Ext.get(el).getUpdater();\r
-    Ext.apply(um, options);\r
-    um.update(url, params, options ? options.callback : null);\r
-};\r
+        Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);\r
+    },\r
 \r
-Ext.Updater.BasicRenderer = function(){};\r
+    // private\r
+    adjustWidthAnchor : function(value, comp){\r
+        return value ? value - comp.getPosition(true)[0] + this.paddingLeft : value;\r
+    },\r
 \r
-Ext.Updater.BasicRenderer.prototype = {\r
-    \r
-     render : function(el, response, updateManager, callback){\r
-        el.update(response.responseText, updateManager.loadScripts, callback);\r
+    // private\r
+    adjustHeightAnchor : function(value, comp){\r
+        return  value ? value - comp.getPosition(true)[1] + this.paddingTop : value;\r
     }\r
-};\r
-\r
-Ext.UpdateManager = Ext.Updater;\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
+Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;
+/**\r
+ * @class Ext.layout.BoxLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * <p>Base Class for HBoxLayout and VBoxLayout Classes. Generally it should not need to be used directly.</p>\r
+ */\r
+Ext.layout.BoxLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
+    /**\r
+     * @cfg {Object} defaultMargins\r
+     * <p>If the individual contained items do not have a <tt>margins</tt>\r
+     * property specified, the default margins from this property will be\r
+     * applied to each item.</p>\r
+     * <br><p>This property may be specified as an object containing margins\r
+     * to apply in the format:</p><pre><code>\r
+{\r
+    top: (top margin),\r
+    right: (right margin),\r
+    bottom: (bottom margin),\r
+    left: (left margin)\r
+}</code></pre>\r
+     * <p>This property may also be specified as a string containing\r
+     * space-separated, numeric margin values. The order of the sides associated\r
+     * with each value matches the way CSS processes margin values:</p>\r
+     * <div class="mdetail-params"><ul>\r
+     * <li>If there is only one value, it applies to all sides.</li>\r
+     * <li>If there are two values, the top and bottom borders are set to the\r
+     * first value and the right and left are set to the second.</li>\r
+     * <li>If there are three values, the top is set to the first value, the left\r
+     * and right are set to the second, and the bottom is set to the third.</li>\r
+     * <li>If there are four values, they apply to the top, right, bottom, and\r
+     * left, respectively.</li>\r
+     * </ul></div>\r
+     * <p>Defaults to:</p><pre><code>\r
+     * {top:0, right:0, bottom:0, left:0}\r
+     * </code></pre>\r
+     */\r
+    defaultMargins : {left:0,top:0,right:0,bottom:0},\r
+    /**\r
+     * @cfg {String} padding\r
+     * Defaults to <tt>'0'</tt>. Sets the padding to be applied to all child items managed by this\r
+     * container's layout. \r
+     */\r
+    padding : '0',\r
+    // documented in subclasses\r
+    pack : 'start',\r
 \r
+    // private\r
+    monitorResize : true,\r
+    scrollOffset : 0,\r
+    extraCls : 'x-box-item',\r
+    ctCls : 'x-box-layout-ct',\r
+    innerCls : 'x-box-inner',\r
 \r
+    // private\r
+    isValidParent : function(c, target){\r
+        return c.getEl().dom.parentNode == this.innerCt.dom;\r
+    },\r
 \r
-\r
-\r
-(function() {\r
-\r
-// create private copy of Ext's String.format() method\r
-// - to remove unnecessary dependency\r
-// - to resolve namespace conflict with M$-Ajax's implementation\r
-function xf(format) {\r
-    var args = Array.prototype.slice.call(arguments, 1);\r
-    return format.replace(/\{(\d+)\}/g, function(m, i) {\r
-        return args[i];\r
-    });\r
-}\r
-\r
-\r
-// private\r
-Date.formatCodeToRegex = function(character, currentGroup) {\r
-    // Note: currentGroup - position in regex result array (see notes for Date.parseCodes below)\r
-    var p = Date.parseCodes[character];\r
-\r
-    if (p) {\r
-      p = Ext.type(p) == 'function'? p() : p;\r
-      Date.parseCodes[character] = p; // reassign function result to prevent repeated execution\r
-    }\r
-\r
-    return p? Ext.applyIf({\r
-      c: p.c? xf(p.c, currentGroup || "{0}") : p.c\r
-    }, p) : {\r
-        g:0,\r
-        c:null,\r
-        s:Ext.escapeRe(character) // treat unrecognised characters as literals\r
-    }\r
-}\r
-\r
-// private shorthand for Date.formatCodeToRegex since we'll be using it fairly often\r
-var $f = Date.formatCodeToRegex;\r
-\r
-Ext.apply(Date, {\r
     // private\r
-    parseFunctions: {count:0},\r
-    parseRegexes: [],\r
-    formatFunctions: {count:0},\r
-    daysInMonth : [31,28,31,30,31,30,31,31,30,31,30,31],\r
-    y2kYear : 50,\r
-\r
-    \r
-    MILLI : "ms",\r
-\r
-    \r
-    SECOND : "s",\r
-\r
-    \r
-    MINUTE : "mi",\r
-\r
-    \r
-    HOUR : "h",\r
-\r
-    \r
-    DAY : "d",\r
-\r
-    \r
-    MONTH : "mo",\r
-\r
-    \r
-    YEAR : "y",\r
-\r
-    \r
-    dayNames : [\r
-        "Sunday",\r
-        "Monday",\r
-        "Tuesday",\r
-        "Wednesday",\r
-        "Thursday",\r
-        "Friday",\r
-        "Saturday"\r
-    ],\r
+    onLayout : function(ct, target){\r
+        var cs = ct.items.items, len = cs.length, c, i, last = len-1, cm;\r
 \r
-    \r
-    monthNames : [\r
-        "January",\r
-        "February",\r
-        "March",\r
-        "April",\r
-        "May",\r
-        "June",\r
-        "July",\r
-        "August",\r
-        "September",\r
-        "October",\r
-        "November",\r
-        "December"\r
-    ],\r
+        if(!this.innerCt){\r
+            target.addClass(this.ctCls);\r
 \r
-    \r
-    monthNumbers : {\r
-        Jan:0,\r
-        Feb:1,\r
-        Mar:2,\r
-        Apr:3,\r
-        May:4,\r
-        Jun:5,\r
-        Jul:6,\r
-        Aug:7,\r
-        Sep:8,\r
-        Oct:9,\r
-        Nov:10,\r
-        Dec:11\r
+            // the innerCt prevents wrapping and shuffling while\r
+            // the container is resizing\r
+            this.innerCt = target.createChild({cls:this.innerCls});\r
+            this.padding = this.parseMargins(this.padding); \r
+        }\r
+        this.renderAll(ct, this.innerCt);\r
     },\r
 \r
-    \r
-    getShortMonthName : function(month) {\r
-        return Date.monthNames[month].substring(0, 3);\r
+    // private\r
+    renderItem : function(c){\r
+        if(typeof c.margins == 'string'){\r
+            c.margins = this.parseMargins(c.margins);\r
+        }else if(!c.margins){\r
+            c.margins = this.defaultMargins;\r
+        }\r
+        Ext.layout.BoxLayout.superclass.renderItem.apply(this, arguments);\r
     },\r
 \r
-    \r
-    getShortDayName : function(day) {\r
-        return Date.dayNames[day].substring(0, 3);\r
+    getTargetSize : function(target){
+        return (Ext.isIE6 && Ext.isStrict && target.dom == document.body) ? target.getStyleSize() : target.getViewSize();\r
     },\r
-\r
     \r
-    getMonthNumber : function(name) {\r
-        // handle camel casing for english month names (since the keys for the Date.monthNumbers hash are case sensitive)\r
-        return Date.monthNumbers[name.substring(0, 1).toUpperCase() + name.substring(1, 3).toLowerCase()];\r
-    },\r
+    getItems: function(ct){\r
+        var items = [];\r
+        ct.items.each(function(c){\r
+            if(c.isVisible()){\r
+                items.push(c);\r
+            }\r
+        });\r
+        return items;\r
+    }\r
 \r
-    \r
-    formatCodes : {\r
-        d: "String.leftPad(this.getDate(), 2, '0')",\r
-        D: "Date.getShortDayName(this.getDay())", // get localised short day name\r
-        j: "this.getDate()",\r
-        l: "Date.dayNames[this.getDay()]",\r
-        N: "(this.getDay() ? this.getDay() : 7)",\r
-        S: "this.getSuffix()",\r
-        w: "this.getDay()",\r
-        z: "this.getDayOfYear()",\r
-        W: "String.leftPad(this.getWeekOfYear(), 2, '0')",\r
-        F: "Date.monthNames[this.getMonth()]",\r
-        m: "String.leftPad(this.getMonth() + 1, 2, '0')",\r
-        M: "Date.getShortMonthName(this.getMonth())", // get localised short month name\r
-        n: "(this.getMonth() + 1)",\r
-        t: "this.getDaysInMonth()",\r
-        L: "(this.isLeapYear() ? 1 : 0)",\r
-        o: "(this.getFullYear() + (this.getWeekOfYear() == 1 && this.getMonth() > 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0)))",\r
-        Y: "this.getFullYear()",\r
-        y: "('' + this.getFullYear()).substring(2, 4)",\r
-        a: "(this.getHours() < 12 ? 'am' : 'pm')",\r
-        A: "(this.getHours() < 12 ? 'AM' : 'PM')",\r
-        g: "((this.getHours() % 12) ? this.getHours() % 12 : 12)",\r
-        G: "this.getHours()",\r
-        h: "String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0')",\r
-        H: "String.leftPad(this.getHours(), 2, '0')",\r
-        i: "String.leftPad(this.getMinutes(), 2, '0')",\r
-        s: "String.leftPad(this.getSeconds(), 2, '0')",\r
-        u: "String.leftPad(this.getMilliseconds(), 3, '0')",\r
-        O: "this.getGMTOffset()",\r
-        P: "this.getGMTOffset(true)",\r
-        T: "this.getTimezone()",\r
-        Z: "(this.getTimezoneOffset() * -60)",\r
-        c: function() { // ISO-8601 -- GMT format\r
-            for (var c = "Y-m-dTH:i:sP", code = [], i = 0, l = c.length; i < l; ++i) {\r
-                var e = c.charAt(i);\r
-                code.push(e == "T" ? "'T'" : Date.getFormatCode(e)); // treat T as a character literal\r
-            }\r
-            return code.join(" + ");\r
-        },\r
-        \r
-        U: "Math.round(this.getTime() / 1000)"\r
-    },\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
 \r
-    \r
-    parseDate : function(input, format) {\r
-        var p = Date.parseFunctions;\r
-        if (p[format] == null) {\r
-            Date.createParser(format);\r
-        }\r
-        var func = p[format];\r
-        return Date[func](input);\r
-    },\r
+/**\r
+ * @class Ext.layout.VBoxLayout\r
+ * @extends Ext.layout.BoxLayout\r
+ * A layout that arranges items vertically\r
+ */\r
+Ext.layout.VBoxLayout = Ext.extend(Ext.layout.BoxLayout, {\r
+    /**\r
+     * @cfg {String} align\r
+     * Controls how the child items of the container are aligned. Acceptable configuration values for this\r
+     * property are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>left</tt></b> : <b>Default</b><div class="sub-desc">child items are aligned horizontally\r
+     * at the <b>left</b> side of the container</div></li>\r
+     * <li><b><tt>center</tt></b> : <div class="sub-desc">child items are aligned horizontally at the\r
+     * <b>mid-width</b> of the container</div></li>\r
+     * <li><b><tt>stretch</tt></b> : <div class="sub-desc">child items are stretched horizontally to fill\r
+     * the width of the container</div></li>\r
+     * <li><b><tt>stretchmax</tt></b> : <div class="sub-desc">child items are stretched horizontally to\r
+     * the size of the largest item.</div></li>\r
+     * </ul></div>\r
+     */\r
+    align : 'left', // left, center, stretch, strechmax\r
+    /**\r
+     * @cfg {String} pack\r
+     * Controls how the child items of the container are packed together. Acceptable configuration values\r
+     * for this property are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>start</tt></b> : <b>Default</b><div class="sub-desc">child items are packed together at\r
+     * <b>top</b> side of container</div></li>\r
+     * <li><b><tt>center</tt></b> : <div class="sub-desc">child items are packed together at\r
+     * <b>mid-height</b> of container</div></li>\r
+     * <li><b><tt>end</tt></b> : <div class="sub-desc">child items are packed together at <b>bottom</b>\r
+     * side of container</div></li>\r
+     * </ul></div>\r
+     */\r
+    /**\r
+     * @cfg {Number} flex\r
+     * This configuation option is to be applied to <b>child <tt>items</tt></b> of the container managed\r
+     * by this layout. Each child item with a <tt>flex</tt> property will be flexed <b>vertically</b>\r
+     * according to each item's <b>relative</b> <tt>flex</tt> value compared to the sum of all items with\r
+     * a <tt>flex</tt> value specified.  Any child items that have either a <tt>flex = 0</tt> or\r
+     * <tt>flex = undefined</tt> will not be 'flexed' (the initial size will not be changed).\r
+     */\r
 \r
     // private\r
-    getFormatCode : function(character) {\r
-        var f = Date.formatCodes[character];\r
-\r
-        if (f) {\r
-          f = Ext.type(f) == 'function'? f() : f;\r
-          Date.formatCodes[character] = f; // reassign function result to prevent repeated execution\r
+    onLayout : function(ct, target){\r
+        Ext.layout.VBoxLayout.superclass.onLayout.call(this, ct, target);\r
+                    \r
+        \r
+        var cs = this.getItems(ct), cm, ch, margin,\r
+            size = this.getTargetSize(target),\r
+            w = size.width - target.getPadding('lr') - this.scrollOffset,\r
+            h = size.height - target.getPadding('tb'),\r
+            l = this.padding.left, t = this.padding.top,\r
+            isStart = this.pack == 'start',\r
+            isRestore = ['stretch', 'stretchmax'].indexOf(this.align) == -1,\r
+            stretchWidth = w - (this.padding.left + this.padding.right),\r
+            extraHeight = 0,\r
+            maxWidth = 0,\r
+            totalFlex = 0,\r
+            flexHeight = 0,\r
+            usedHeight = 0;\r
+            \r
+        Ext.each(cs, function(c){\r
+            cm = c.margins;\r
+            totalFlex += c.flex || 0;\r
+            ch = c.getHeight();\r
+            margin = cm.top + cm.bottom;\r
+            extraHeight += ch + margin;\r
+            flexHeight += margin + (c.flex ? 0 : ch);\r
+            maxWidth = Math.max(maxWidth, c.getWidth() + cm.left + cm.right);\r
+        });\r
+        extraHeight = h - extraHeight - this.padding.top - this.padding.bottom;\r
+        \r
+        var innerCtWidth = maxWidth + this.padding.left + this.padding.right;\r
+        switch(this.align){\r
+            case 'stretch':\r
+                this.innerCt.setSize(w, h);\r
+                break;\r
+            case 'stretchmax':\r
+            case 'left':\r
+                this.innerCt.setSize(innerCtWidth, h);\r
+                break;\r
+            case 'center':\r
+                this.innerCt.setSize(w = Math.max(w, innerCtWidth), h);\r
+                break;\r
         }\r
 \r
-        // note: unknown characters are treated as literals\r
-        return f || ("'" + String.escape(character) + "'");\r
-    },\r
-\r
-    // private\r
-    createNewFormat : function(format) {\r
-        var funcName = "format" + Date.formatFunctions.count++,\r
-            code = "Date.prototype." + funcName + " = function(){return ",\r
-            special = false,\r
-            ch = '';\r
-\r
-        Date.formatFunctions[format] = funcName;\r
+        var availHeight = Math.max(0, h - this.padding.top - this.padding.bottom - flexHeight),\r
+            leftOver = availHeight,\r
+            heights = [],\r
+            restore = [],\r
+            idx = 0,\r
+            availableWidth = Math.max(0, w - this.padding.left - this.padding.right);\r
+            \r
 \r
-        for (var i = 0; i < format.length; ++i) {\r
-            ch = format.charAt(i);\r
-            if (!special && ch == "\\") {\r
-                special = true;\r
-            }\r
-            else if (special) {\r
-                special = false;\r
-                code += "'" + String.escape(ch) + "' + ";\r
+        Ext.each(cs, function(c){\r
+            if(isStart && c.flex){\r
+                ch = Math.floor(availHeight * (c.flex / totalFlex));\r
+                leftOver -= ch;\r
+                heights.push(ch);\r
             }\r
-            else {\r
-                code += Date.getFormatCode(ch) + " + ";\r
-            }\r
-        }\r
-        eval(code.substring(0, code.length - 3) + ";}");\r
-    },\r
-\r
-    // private\r
-    createParser : function() {\r
-        var code = [\r
-            "Date.{0} = function(input){",\r
-                "var y, m, d, h = 0, i = 0, s = 0, ms = 0, o, z, u, v;",\r
-                "input = String(input);",\r
-                "d = new Date();",\r
-                "y = d.getFullYear();",\r
-                "m = d.getMonth();",\r
-                "d = d.getDate();",\r
-                "var results = input.match(Date.parseRegexes[{1}]);",\r
-                "if(results && results.length > 0){",\r
-                    "{2}",\r
-                    "if(u){",\r
-                        "v = new Date(u * 1000);", // give top priority to UNIX time\r
-                    "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0){",\r
-                        "v = new Date(y, m, d, h, i, s, ms);",\r
-                    "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0){",\r
-                        "v = new Date(y, m, d, h, i, s);",\r
-                    "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0){",\r
-                        "v = new Date(y, m, d, h, i);",\r
-                    "}else if (y >= 0 && m >= 0 && d > 0 && h >= 0){",\r
-                        "v = new Date(y, m, d, h);",\r
-                    "}else if (y >= 0 && m >= 0 && d > 0){",\r
-                        "v = new Date(y, m, d);",\r
-                    "}else if (y >= 0 && m >= 0){",\r
-                        "v = new Date(y, m);",\r
-                    "}else if (y >= 0){",\r
-                        "v = new Date(y);",\r
-                    "}",\r
-                "}",\r
-                "return (v && (z != null || o != null))?" // favour UTC offset over GMT offset\r
-                    + " (Ext.type(z) == 'number' ? v.add(Date.SECOND, -v.getTimezoneOffset() * 60 - z) :" // reset to UTC, then add offset\r
-                    + " v.add(Date.MINUTE, -v.getTimezoneOffset() + (sn == '+'? -1 : 1) * (hr * 60 + mn))) : v;", // reset to GMT, then add offset\r
-            "}"\r
-        ].join('\n');\r
-\r
-        return function(format) {\r
-            var funcName = "parse" + Date.parseFunctions.count++,\r
-                regexNum = Date.parseRegexes.length,\r
-                currentGroup = 1,\r
-                calc = "",\r
-                regex = "",\r
-                special = false,\r
-                ch = "";\r
-\r
-            Date.parseFunctions[format] = funcName;\r
-\r
-            for (var i = 0; i < format.length; ++i) {\r
-                ch = format.charAt(i);\r
-                if (!special && ch == "\\") {\r
-                    special = true;\r
-                }\r
-                else if (special) {\r
-                    special = false;\r
-                    regex += String.escape(ch);\r
+        }); \r
+        \r
+        if(this.pack == 'center'){\r
+            t += extraHeight ? extraHeight / 2 : 0;\r
+        }else if(this.pack == 'end'){\r
+            t += extraHeight;\r
+        }\r
+        Ext.each(cs, function(c){\r
+            cm = c.margins;\r
+            t += cm.top;\r
+            c.setPosition(l + cm.left, t);\r
+            if(isStart && c.flex){\r
+                ch = Math.max(0, heights[idx++] + (leftOver-- > 0 ? 1 : 0));\r
+                if(isRestore){\r
+                    restore.push(c.getWidth());\r
                 }\r
-                else {\r
-                    var obj = $f(ch, currentGroup);\r
-                    currentGroup += obj.g;\r
-                    regex += obj.s;\r
-                    if (obj.g && obj.c) {\r
-                        calc += obj.c;\r
+                c.setSize(availableWidth, ch);\r
+            }else{\r
+                ch = c.getHeight();\r
+            }\r
+            t += ch + cm.bottom;\r
+        });\r
+        \r
+        idx = 0;\r
+        Ext.each(cs, function(c){\r
+            cm = c.margins;\r
+            if(this.align == 'stretch'){\r
+                c.setWidth((stretchWidth - (cm.left + cm.right)).constrain(\r
+                    c.minWidth || 0, c.maxWidth || 1000000));\r
+            }else if(this.align == 'stretchmax'){\r
+                c.setWidth((maxWidth - (cm.left + cm.right)).constrain(\r
+                    c.minWidth || 0, c.maxWidth || 1000000));\r
+            }else{\r
+                if(this.align == 'center'){\r
+                    var diff = availableWidth - (c.getWidth() + cm.left + cm.right);\r
+                    if(diff > 0){\r
+                        c.setPosition(l + cm.left + (diff/2), c.y);\r
                     }\r
                 }\r
+                if(isStart && c.flex){\r
+                    c.setWidth(restore[idx++]);\r
+                }\r
             }\r
+        }, this);\r
+    }\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
 \r
-            Date.parseRegexes[regexNum] = new RegExp("^" + regex + "$", "i");\r
-            eval(xf(code, funcName, regexNum, calc));\r
-        }\r
-    }(),\r
+Ext.Container.LAYOUTS.vbox = Ext.layout.VBoxLayout;\r
+\r
+/**\r
+ * @class Ext.layout.HBoxLayout\r
+ * @extends Ext.layout.BoxLayout\r
+ * A layout that arranges items horizontally\r
+ */\r
+Ext.layout.HBoxLayout = Ext.extend(Ext.layout.BoxLayout, {\r
+    /**\r
+     * @cfg {String} align\r
+     * Controls how the child items of the container are aligned. Acceptable configuration values for this\r
+     * property are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>top</tt></b> : <b>Default</b><div class="sub-desc">child items are aligned vertically\r
+     * at the <b>left</b> side of the container</div></li>\r
+     * <li><b><tt>middle</tt></b> : <div class="sub-desc">child items are aligned vertically at the\r
+     * <b>mid-height</b> of the container</div></li>\r
+     * <li><b><tt>stretch</tt></b> : <div class="sub-desc">child items are stretched vertically to fill\r
+     * the height of the container</div></li>\r
+     * <li><b><tt>stretchmax</tt></b> : <div class="sub-desc">child items are stretched vertically to\r
+     * the size of the largest item.</div></li>\r
+     */\r
+    align : 'top', // top, middle, stretch, strechmax\r
+    /**\r
+     * @cfg {String} pack\r
+     * Controls how the child items of the container are packed together. Acceptable configuration values\r
+     * for this property are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>start</tt></b> : <b>Default</b><div class="sub-desc">child items are packed together at\r
+     * <b>left</b> side of container</div></li>\r
+     * <li><b><tt>center</tt></b> : <div class="sub-desc">child items are packed together at\r
+     * <b>mid-width</b> of container</div></li>\r
+     * <li><b><tt>end</tt></b> : <div class="sub-desc">child items are packed together at <b>right</b>\r
+     * side of container</div></li>\r
+     * </ul></div>\r
+     */\r
+    /**\r
+     * @cfg {Number} flex\r
+     * This configuation option is to be applied to <b>child <tt>items</tt></b> of the container managed\r
+     * by this layout. Each child item with a <tt>flex</tt> property will be flexed <b>horizontally</b>\r
+     * according to each item's <b>relative</b> <tt>flex</tt> value compared to the sum of all items with\r
+     * a <tt>flex</tt> value specified.  Any child items that have either a <tt>flex = 0</tt> or\r
+     * <tt>flex = undefined</tt> will not be 'flexed' (the initial size will not be changed).\r
+     */\r
 \r
     // private\r
-    parseCodes : {\r
+    onLayout : function(ct, target){\r
+        Ext.layout.HBoxLayout.superclass.onLayout.call(this, ct, target);\r
         \r
-        d: {\r
-            g:1,\r
-            c:"d = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{2})" // day of month with leading zeroes (01 - 31)\r
-        },\r
-        j: {\r
-            g:1,\r
-            c:"d = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{1,2})" // day of month without leading zeroes (1 - 31)\r
-        },\r
-        D: function() {\r
-            for (var a = [], i = 0; i < 7; a.push(Date.getShortDayName(i)), ++i); // get localised short day names\r
-            return {\r
-                g:0,\r
-                c:null,\r
-                s:"(?:" + a.join("|") +")"\r
-            }\r
-        },\r
-        l: function() {\r
-            return {\r
-                g:0,\r
-                c:null,\r
-                s:"(?:" + Date.dayNames.join("|") + ")"\r
-            }\r
-        },\r
-        N: {\r
-            g:0,\r
-            c:null,\r
-            s:"[1-7]" // ISO-8601 day number (1 (monday) - 7 (sunday))\r
-        },\r
-        S: {\r
-            g:0,\r
-            c:null,\r
-            s:"(?:st|nd|rd|th)"\r
-        },\r
-        w: {\r
-            g:0,\r
-            c:null,\r
-            s:"[0-6]" // javascript day number (0 (sunday) - 6 (saturday))\r
-        },\r
-        z: {\r
-            g:0,\r
-            c:null,\r
-            s:"(?:\\d{1,3})" // day of the year (0 - 364 (365 in leap years))\r
-        },\r
-        W: {\r
-            g:0,\r
-            c:null,\r
-            s:"(?:\\d{2})" // ISO-8601 week number (with leading zero)\r
-        },\r
-        F: function() {\r
-            return {\r
-                g:1,\r
-                c:"m = parseInt(Date.getMonthNumber(results[{0}]), 10);\n", // get localised month number\r
-                s:"(" + Date.monthNames.join("|") + ")"\r
+        var cs = this.getItems(ct), cm, cw, margin,\r
+            size = this.getTargetSize(target),\r
+            w = size.width - target.getPadding('lr') - this.scrollOffset,\r
+            h = size.height - target.getPadding('tb'),\r
+            l = this.padding.left, t = this.padding.top,\r
+            isStart = this.pack == 'start',\r
+            isRestore = ['stretch', 'stretchmax'].indexOf(this.align) == -1,\r
+            stretchHeight = h - (this.padding.top + this.padding.bottom),\r
+            extraWidth = 0,\r
+            maxHeight = 0,\r
+            totalFlex = 0,\r
+            flexWidth = 0,\r
+            usedWidth = 0;\r
+        \r
+        Ext.each(cs, function(c){\r
+            cm = c.margins;\r
+            totalFlex += c.flex || 0;\r
+            cw = c.getWidth();\r
+            margin = cm.left + cm.right;\r
+            extraWidth += cw + margin;\r
+            flexWidth += margin + (c.flex ? 0 : cw);\r
+            maxHeight = Math.max(maxHeight, c.getHeight() + cm.top + cm.bottom);\r
+        });\r
+        extraWidth = w - extraWidth - this.padding.left - this.padding.right;\r
+        \r
+        var innerCtHeight = maxHeight + this.padding.top + this.padding.bottom;\r
+        switch(this.align){\r
+            case 'stretch':\r
+                this.innerCt.setSize(w, h);\r
+                break;\r
+            case 'stretchmax':\r
+            case 'top':\r
+                this.innerCt.setSize(w, innerCtHeight);\r
+                break;\r
+            case 'middle':\r
+                this.innerCt.setSize(w, h = Math.max(h, innerCtHeight));\r
+                break;\r
+        }\r
+        \r
+\r
+        var availWidth = Math.max(0, w - this.padding.left - this.padding.right - flexWidth),\r
+            leftOver = availWidth,\r
+            widths = [],\r
+            restore = [],\r
+            idx = 0,\r
+            availableHeight = Math.max(0, h - this.padding.top - this.padding.bottom);\r
+            \r
+\r
+        Ext.each(cs, function(c){\r
+            if(isStart && c.flex){\r
+                cw = Math.floor(availWidth * (c.flex / totalFlex));\r
+                leftOver -= cw;\r
+                widths.push(cw);\r
             }\r
-        },\r
-        M: function() {\r
-            for (var a = [], i = 0; i < 12; a.push(Date.getShortMonthName(i)), ++i); // get localised short month names\r
-            return Ext.applyIf({\r
-                s:"(" + a.join("|") + ")"\r
-            }, $f("F"));\r
-        },\r
-        m: {\r
-            g:1,\r
-            c:"m = parseInt(results[{0}], 10) - 1;\n",\r
-            s:"(\\d{2})" // month number with leading zeros (01 - 12)\r
-        },\r
-        n: {\r
-            g:1,\r
-            c:"m = parseInt(results[{0}], 10) - 1;\n",\r
-            s:"(\\d{1,2})" // month number without leading zeros (1 - 12)\r
-        },\r
-        t: {\r
-            g:0,\r
-            c:null,\r
-            s:"(?:\\d{2})" // no. of days in the month (28 - 31)\r
-        },\r
-        L: {\r
-            g:0,\r
-            c:null,\r
-            s:"(?:1|0)"\r
-        },\r
-        o: function() {\r
-            return $f("Y");\r
-        },\r
-        Y: {\r
-            g:1,\r
-            c:"y = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{4})" // 4-digit year\r
-        },\r
-        y: {\r
-            g:1,\r
-            c:"var ty = parseInt(results[{0}], 10);\n"\r
-                + "y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n", // 2-digit year\r
-            s:"(\\d{1,2})"\r
-        },\r
-        a: {\r
-            g:1,\r
-            c:"if (results[{0}] == 'am') {\n"\r
-                + "if (h == 12) { h = 0; }\n"\r
-                + "} else { if (h < 12) { h += 12; }}",\r
-            s:"(am|pm)"\r
-        },\r
-        A: {\r
-            g:1,\r
-            c:"if (results[{0}] == 'AM') {\n"\r
-                + "if (h == 12) { h = 0; }\n"\r
-                + "} else { if (h < 12) { h += 12; }}",\r
-            s:"(AM|PM)"\r
-        },\r
-        g: function() {\r
-            return $f("G");\r
-        },\r
-        G: {\r
-            g:1,\r
-            c:"h = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{1,2})" // 24-hr format of an hour without leading zeroes (0 - 23)\r
-        },\r
-        h: function() {\r
-            return $f("H");\r
-        },\r
-        H: {\r
-            g:1,\r
-            c:"h = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{2})" //  24-hr format of an hour with leading zeroes (00 - 23)\r
-        },\r
-        i: {\r
-            g:1,\r
-            c:"i = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{2})" // minutes with leading zeros (00 - 59)\r
-        },\r
-        s: {\r
-            g:1,\r
-            c:"s = parseInt(results[{0}], 10);\n",\r
-            s:"(\\d{2})" // seconds with leading zeros (00 - 59)\r
-        },\r
-        u: {\r
-            g:1,\r
-            c:"ms = results[{0}]; ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n",\r
-            s:"(\\d+)" // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)\r
-        },\r
-        O: {\r
-            g:1,\r
-            c:[\r
-                "o = results[{0}];",\r
-                "var sn = o.substring(0,1);", // get + / - sign\r
-                "var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);", // get hours (performs minutes-to-hour conversion also, just in case)\r
-                "var mn = o.substring(3,5) % 60;", // get minutes\r
-                "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs\r
-            ].join("\n"),\r
-            s: "([+\-]\\d{4})" // GMT offset in hrs and mins\r
-        },\r
-        P: {\r
-            g:1,\r
-            c:[\r
-                "o = results[{0}];",\r
-                "var sn = o.substring(0,1);", // get + / - sign\r
-                "var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);", // get hours (performs minutes-to-hour conversion also, just in case)\r
-                "var mn = o.substring(4,6) % 60;", // get minutes\r
-                "o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))? (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n" // -12hrs <= GMT offset <= 14hrs\r
-            ].join("\n"),\r
-            s: "([+\-]\\d{2}:\\d{2})" // GMT offset in hrs and mins (with colon separator)\r
-        },\r
-        T: {\r
-            g:0,\r
-            c:null,\r
-            s:"[A-Z]{1,4}" // timezone abbrev. may be between 1 - 4 chars\r
-        },\r
-        Z: {\r
-            g:1,\r
-            c:"z = results[{0}] * 1;\n" // -43200 <= UTC offset <= 50400\r
-                  + "z = (-43200 <= z && z <= 50400)? z : null;\n",\r
-            s:"([+\-]?\\d{1,5})" // leading '+' sign is optional for UTC offset\r
-        },\r
-        c: function() {\r
-            var calc = [],\r
-                arr = [\r
-                    $f("Y", 1), // year\r
-                    $f("m", 2), // month\r
-                    $f("d", 3), // day\r
-                    $f("h", 4), // hour\r
-                    $f("i", 5), // minute\r
-                    $f("s", 6), // second\r
-                    {c:"ms = (results[7] || '.0').substring(1); ms = parseInt(ms, 10)/Math.pow(10, ms.length - 3);\n"}, // decimal fraction of a second (minimum = 1 digit, maximum = unlimited)\r
-                    {c:[ // allow both "Z" (i.e. UTC) and "+08:00" (i.e. UTC offset) time zone delimiters\r
-                        "if(results[9] == 'Z'){",\r
-                            "z = 0;",\r
-                        "}else{",\r
-                            $f("P", 9).c,\r
-                        "}"\r
-                    ].join('\n')}\r
-                ];\r
-\r
-            for (var i = 0, l = arr.length; i < l; ++i) {\r
-                calc.push(arr[i].c);\r
+        }); \r
+        \r
+        if(this.pack == 'center'){\r
+            l += extraWidth ? extraWidth / 2 : 0;\r
+        }else if(this.pack == 'end'){\r
+            l += extraWidth;\r
+        }\r
+        Ext.each(cs, function(c){\r
+            cm = c.margins;\r
+            l += cm.left;\r
+            c.setPosition(l, t + cm.top);\r
+            if(isStart && c.flex){\r
+                cw = Math.max(0, widths[idx++] + (leftOver-- > 0 ? 1 : 0));\r
+                if(isRestore){\r
+                    restore.push(c.getHeight());\r
+                }\r
+                c.setSize(cw, availableHeight);\r
+            }else{\r
+                cw = c.getWidth();\r
             }\r
-\r
-            return {\r
-                g:1,\r
-                c:calc.join(""),\r
-                s:arr[0].s + "-" + arr[1].s + "-" + arr[2].s + "T" + arr[3].s + ":" + arr[4].s + ":" + arr[5].s\r
-                      + "((\.|,)\\d+)?" // decimal fraction of a second (e.g. ",998465" or ".998465")\r
-                      + "(Z|([+\-]\\d{2}:\\d{2}))" // "Z" (UTC) or "+08:00" (UTC offset)\r
+            l += cw + cm.right;\r
+        });\r
+        \r
+        idx = 0;\r
+        Ext.each(cs, function(c){\r
+            var cm = c.margins;\r
+            if(this.align == 'stretch'){\r
+                c.setHeight((stretchHeight - (cm.top + cm.bottom)).constrain(\r
+                    c.minHeight || 0, c.maxHeight || 1000000));\r
+            }else if(this.align == 'stretchmax'){\r
+                c.setHeight((maxHeight - (cm.top + cm.bottom)).constrain(\r
+                    c.minHeight || 0, c.maxHeight || 1000000));\r
+            }else{\r
+                if(this.align == 'middle'){\r
+                    var diff = availableHeight - (c.getHeight() + cm.top + cm.bottom);\r
+                    if(diff > 0){\r
+                        c.setPosition(c.x, t + cm.top + (diff/2));\r
+                    }\r
+                }\r
+                if(isStart && c.flex){\r
+                    c.setHeight(restore[idx++]);\r
+                }\r
             }\r
-        },\r
-        U: {\r
-            g:1,\r
-            c:"u = parseInt(results[{0}], 10);\n",\r
-            s:"(-?\\d+)" // leading minus sign indicates seconds before UNIX epoch\r
-        }\r
+        }, this);\r
     }\r
-});\r
-\r
-}());\r
 \r
-Ext.apply(Date.prototype, {\r
-    // private\r
-    dateFormat : function(format) {\r
-        if (Date.formatFunctions[format] == null) {\r
-            Date.createNewFormat(format);\r
-        }\r
-        var func = Date.formatFunctions[format];\r
-        return this[func]();\r
-    },\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
 \r
-    \r
-    getTimezone : function() {\r
-        // the following list shows the differences between date strings from different browsers on a WinXP SP2 machine from an Asian locale:\r
-        //\r
-        // Opera  : "Thu, 25 Oct 2007 22:53:45 GMT+0800" -- shortest (weirdest) date string of the lot\r
-        // Safari : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone (same as FF)\r
-        // FF     : "Thu Oct 25 2007 22:55:35 GMT+0800 (Malay Peninsula Standard Time)" -- value in parentheses always gives the correct timezone\r
-        // IE     : "Thu Oct 25 22:54:35 UTC+0800 2007" -- (Asian system setting) look for 3-4 letter timezone abbrev\r
-        // IE     : "Thu Oct 25 17:06:37 PDT 2007" -- (American system setting) look for 3-4 letter timezone abbrev\r
-        //\r
-        // this crazy regex attempts to guess the correct timezone abbreviation despite these differences.\r
-        // step 1: (?:\((.*)\) -- find timezone in parentheses\r
-        // step 2: ([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?) -- if nothing was found in step 1, find timezone from timezone offset portion of date string\r
-        // step 3: remove all non uppercase characters found in step 1 and 2\r
-        return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, "");\r
+Ext.Container.LAYOUTS.hbox = Ext.layout.HBoxLayout;
+/**\r
+ * @class Ext.Viewport\r
+ * @extends Ext.Container\r
+ * <p>A specialized container representing the viewable application area (the browser viewport).</p>\r
+ * <p>The Viewport renders itself to the document body, and automatically sizes itself to the size of\r
+ * the browser viewport and manages window resizing. There may only be one Viewport created\r
+ * in a page. Inner layouts are available by virtue of the fact that all {@link Ext.Panel Panel}s\r
+ * added to the Viewport, either through its {@link #items}, or through the items, or the {@link #add}\r
+ * method of any of its child Panels may themselves have a layout.</p>\r
+ * <p>The Viewport does not provide scrolling, so child Panels within the Viewport should provide\r
+ * for scrolling if needed using the {@link #autoScroll} config.</p>\r
+ * <p>An example showing a classic application border layout:</p><pre><code>\r
+new Ext.Viewport({\r
+    layout: 'border',\r
+    items: [{\r
+        region: 'north',\r
+        html: '&lt;h1 class="x-panel-header">Page Title&lt;/h1>',\r
+        autoHeight: true,\r
+        border: false,\r
+        margins: '0 0 5 0'\r
+    }, {\r
+        region: 'west',\r
+        collapsible: true,\r
+        title: 'Navigation',\r
+        width: 200\r
+        // the west region might typically utilize a {@link Ext.tree.TreePanel TreePanel} or a Panel with {@link Ext.layout.AccordionLayout Accordion layout} \r
+    }, {\r
+        region: 'south',\r
+        title: 'Title for Panel',\r
+        collapsible: true,\r
+        html: 'Information goes here',\r
+        split: true,\r
+        height: 100,\r
+        minHeight: 100\r
+    }, {\r
+        region: 'east',\r
+        title: 'Title for the Grid Panel',\r
+        collapsible: true,\r
+        split: true,\r
+        width: 200,\r
+        xtype: 'grid',\r
+        // remaining grid configuration not shown ...\r
+        // notice that the GridPanel is added directly as the region\r
+        // it is not "overnested" inside another Panel\r
+    }, {\r
+        region: 'center',\r
+        xtype: 'tabpanel', // TabPanel itself has no title\r
+        items: {\r
+            title: 'Default Tab',\r
+            html: 'The first tab\'s content. Others may be added dynamically'\r
+        }\r
+    }]\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Create a new Viewport\r
+ * @param {Object} config The config object\r
+ * @xtype viewport\r
+ */\r
+Ext.Viewport = Ext.extend(Ext.Container, {\r
+       /*\r
+        * Privatize config options which, if used, would interfere with the\r
+        * correct operation of the Viewport as the sole manager of the\r
+        * layout of the document body.\r
+        */\r
+    /**\r
+     * @cfg {Mixed} applyTo @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} allowDomMove @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} hideParent @hide\r
+        */\r
+    /**\r
+     * @cfg {Mixed} renderTo @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} hideParent @hide\r
+        */\r
+    /**\r
+     * @cfg {Number} height @hide\r
+        */\r
+    /**\r
+     * @cfg {Number} width @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} autoHeight @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} autoWidth @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} deferHeight @hide\r
+        */\r
+    /**\r
+     * @cfg {Boolean} monitorResize @hide\r
+        */\r
+    initComponent : function() {\r
+        Ext.Viewport.superclass.initComponent.call(this);\r
+        document.getElementsByTagName('html')[0].className += ' x-viewport';\r
+        this.el = Ext.getBody();\r
+        this.el.setHeight = Ext.emptyFn;\r
+        this.el.setWidth = Ext.emptyFn;\r
+        this.el.setSize = Ext.emptyFn;\r
+        this.el.dom.scroll = 'no';\r
+        this.allowDomMove = false;\r
+        this.autoWidth = true;\r
+        this.autoHeight = true;\r
+        Ext.EventManager.onWindowResize(this.fireResize, this);\r
+        this.renderTo = this.el;\r
     },\r
 \r
-    \r
-    getGMTOffset : function(colon) {\r
-        return (this.getTimezoneOffset() > 0 ? "-" : "+")\r
-            + String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset()) / 60), 2, "0")\r
-            + (colon ? ":" : "")\r
-            + String.leftPad(Math.abs(this.getTimezoneOffset() % 60), 2, "0");\r
-    },\r
+    fireResize : function(w, h){\r
+        this.fireEvent('resize', this, w, h, w, h);\r
+    }\r
+});\r
+Ext.reg('viewport', Ext.Viewport);/**
+ * @class Ext.Panel
+ * @extends Ext.Container
+ * <p>Panel is a container that has specific functionality and structural components that make
+ * it the perfect building block for application-oriented user interfaces.</p>
+ * <p>Panels are, by virtue of their inheritance from {@link Ext.Container}, capable
+ * of being configured with a {@link Ext.Container#layout layout}, and containing child Components.</p>
+ * <p>When either specifying child {@link Ext.Component#items items} of a Panel, or dynamically {@link Ext.Container#add adding} Components
+ * to a Panel, remember to consider how you wish the Panel to arrange those child elements, and whether
+ * those child elements need to be sized using one of Ext's built-in <tt><b>{@link Ext.Container#layout layout}</b></tt> schemes. By
+ * default, Panels use the {@link Ext.layout.ContainerLayout ContainerLayout} scheme. This simply renders
+ * child components, appending them one after the other inside the Container, and <b>does not apply any sizing</b>
+ * at all.</p>
+ * <p>A Panel may also contain {@link #bbar bottom} and {@link #tbar top} toolbars, along with separate
+ * {@link #header}, {@link #footer} and {@link #body} sections (see {@link #frame} for additional
+ * information).</p>
+ * <p>Panel also provides built-in {@link #collapsible expandable and collapsible behavior}, along with
+ * a variety of {@link #tools prebuilt tool buttons} that can be wired up to provide other customized
+ * behavior.  Panels can be easily dropped into any {@link Ext.Container Container} or layout, and the
+ * layout and rendering pipeline is {@link Ext.Container#add completely managed by the framework}.</p>
+ * @constructor
+ * @param {Object} config The config object
+ * @xtype panel
+ */
+Ext.Panel = Ext.extend(Ext.Container, {
+    /**
+     * The Panel's header {@link Ext.Element Element}. Read-only.
+     * <p>This Element is used to house the {@link #title} and {@link #tools}</p>
+     * <br><p><b>Note</b>: see the Note for <tt>{@link Ext.Component#el el} also.</p>
+     * @type Ext.Element
+     * @property header
+     */
+    /**
+     * The Panel's body {@link Ext.Element Element} which may be used to contain HTML content.
+     * The content may be specified in the {@link #html} config, or it may be loaded using the
+     * {@link autoLoad} config, or through the Panel's {@link #getUpdater Updater}. Read-only.
+     * <p>If this is used to load visible HTML elements in either way, then
+     * the Panel may not be used as a Layout for hosting nested Panels.</p>
+     * <p>If this Panel is intended to be used as the host of a Layout (See {@link #layout}
+     * then the body Element must not be loaded or changed - it is under the control
+     * of the Panel's Layout.
+     * <br><p><b>Note</b>: see the Note for <tt>{@link Ext.Component#el el} also.</p>
+     * @type Ext.Element
+     * @property body
+     */
+    /**
+     * The Panel's bwrap {@link Ext.Element Element} used to contain other Panel elements
+     * (tbar, body, bbar, footer). See {@link #bodyCfg}. Read-only.
+     * @type Ext.Element
+     * @property bwrap
+     */
+    /**
+     * True if this panel is collapsed. Read-only.
+     * @type Boolean
+     * @property collapsed
+     */
+    /**
+     * @cfg {Object} bodyCfg
+     * <p>A {@link Ext.DomHelper DomHelper} element specification object may be specified for any
+     * Panel Element.</p>
+     * <p>By default, the Default element in the table below will be used for the html markup to
+     * create a child element with the commensurate Default class name (<tt>baseCls</tt> will be
+     * replaced by <tt>{@link #baseCls}</tt>):</p>
+     * <pre>
+     * Panel      Default  Default             Custom      Additional       Additional
+     * Element    element  class               element     class            style
+     * ========   ==========================   =========   ==============   ===========
+     * {@link #header}     div      {@link #baseCls}+'-header'   {@link #headerCfg}   headerCssClass   headerStyle
+     * {@link #bwrap}      div      {@link #baseCls}+'-bwrap'     {@link #bwrapCfg}    bwrapCssClass    bwrapStyle
+     * + tbar     div      {@link #baseCls}+'-tbar'       {@link #tbarCfg}     tbarCssClass     tbarStyle
+     * + {@link #body}     div      {@link #baseCls}+'-body'       {@link #bodyCfg}     {@link #bodyCssClass}     {@link #bodyStyle}
+     * + bbar     div      {@link #baseCls}+'-bbar'       {@link #bbarCfg}     bbarCssClass     bbarStyle
+     * + {@link #footer}   div      {@link #baseCls}+'-footer'   {@link #footerCfg}   footerCssClass   footerStyle
+     * </pre>
+     * <p>Configuring a Custom element may be used, for example, to force the {@link #body} Element
+     * to use a different form of markup than is created by default. An example of this might be
+     * to {@link Ext.Element#createChild create a child} Panel containing a custom content, such as
+     * a header, or forcing centering of all Panel content by having the body be a &lt;center&gt;
+     * element:</p>
+     * <pre><code>
+new Ext.Panel({
+    title: 'Message Title',
+    renderTo: Ext.getBody(),
+    width: 200, height: 130,
+    <b>bodyCfg</b>: {
+        tag: 'center',
+        cls: 'x-panel-body',  // Default class not applied if Custom element specified
+        html: 'Message'
+    },
+    footerCfg: {
+        tag: 'h2',
+        cls: 'x-panel-footer'        // same as the Default class
+        html: 'footer html'
+    },
+    footerCssClass: 'custom-footer', // additional css class, see {@link Ext.element#addClass addClass}
+    footerStyle:    'background-color:red' // see {@link #bodyStyle}
+});
+     * </code></pre>
+     * <p>The example above also explicitly creates a <tt>{@link #footer}</tt> with custom markup and
+     * styling applied.</p>
+     */
+    /**
+     * @cfg {Object} headerCfg
+     * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
+     * of this Panel's {@link #header} Element.  See <tt>{@link #bodyCfg}</tt> also.</p>
+     */
+    /**
+     * @cfg {Object} bwrapCfg
+     * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
+     * of this Panel's {@link #bwrap} Element.  See <tt>{@link #bodyCfg}</tt> also.</p>
+     */
+    /**
+     * @cfg {Object} tbarCfg
+     * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
+     * of this Panel's {@link #tbar} Element.  See <tt>{@link #bodyCfg}</tt> also.</p>
+     */
+    /**
+     * @cfg {Object} bbarCfg
+     * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
+     * of this Panel's {@link #bbar} Element.  See <tt>{@link #bodyCfg}</tt> also.</p>
+     */
+    /**
+     * @cfg {Object} footerCfg
+     * <p>A {@link Ext.DomHelper DomHelper} element specification object specifying the element structure
+     * of this Panel's {@link #footer} Element.  See <tt>{@link #bodyCfg}</tt> also.</p>
+     */
+    /**
+     * @cfg {Boolean} closable
+     * Panels themselves do not directly support being closed, but some Panel subclasses do (like
+     * {@link Ext.Window}) or a Panel Class within an {@link Ext.TabPanel}.  Specify <tt>true</tt>
+     * to enable closing in such situations. Defaults to <tt>false</tt>.
+     */
+    /**
+     * The Panel's footer {@link Ext.Element Element}. Read-only.
+     * <p>This Element is used to house the Panel's <tt>{@link #buttons}</tt> or <tt>{@link #fbar}</tt>.</p>
+     * <br><p><b>Note</b>: see the Note for <tt>{@link Ext.Component#el el} also.</p>
+     * @type Ext.Element
+     * @property footer
+     */
+    /**
+     * @cfg {Mixed} applyTo
+     * <p>The id of the node, a DOM node or an existing Element corresponding to a DIV that is already present in
+     * the document that specifies some panel-specific structural markup.  When <tt>applyTo</tt> is used,
+     * constituent parts of the panel can be specified by CSS class name within the main element, and the panel
+     * will automatically create those components from that markup. Any required components not specified in the
+     * markup will be autogenerated if necessary.</p>
+     * <p>The following class names are supported (baseCls will be replaced by {@link #baseCls}):</p>
+     * <ul><li>baseCls + '-header'</li>
+     * <li>baseCls + '-header-text'</li>
+     * <li>baseCls + '-bwrap'</li>
+     * <li>baseCls + '-tbar'</li>
+     * <li>baseCls + '-body'</li>
+     * <li>baseCls + '-bbar'</li>
+     * <li>baseCls + '-footer'</li></ul>
+     * <p>Using this config, a call to render() is not required.  If applyTo is specified, any value passed for
+     * {@link #renderTo} will be ignored and the target element's parent node will automatically be used as the
+     * panel's container.</p>
+     */
+    /**
+     * @cfg {Object/Array} tbar
+     * <p>The top toolbar of the panel. This can be a {@link Ext.Toolbar} object, a toolbar config, or an array of
+     * buttons/button configs to be added to the toolbar.  Note that this is not available as a property after render.
+     * To access the top toolbar after render, use {@link #getTopToolbar}.</p>
+     * <p><b>Note:</b> Although a Toolbar may contain Field components, these will <b>not</b> be updated by a load
+     * of an ancestor FormPanel. A Panel's toolbars are not part of the standard Container->Component hierarchy, and
+     * so are not scanned to collect form items. However, the values <b>will</b> be submitted because form
+     * submission parameters are collected from the DOM tree.</p>
+     */
+    /**
+     * @cfg {Object/Array} bbar
+     * <p>The bottom toolbar of the panel. This can be a {@link Ext.Toolbar} object, a toolbar config, or an array of
+     * buttons/button configs to be added to the toolbar.  Note that this is not available as a property after render.
+     * To access the bottom toolbar after render, use {@link #getBottomToolbar}.</p>
+     * <p><b>Note:</b> Although a Toolbar may contain Field components, these will <b>not<b> be updated by a load
+     * of an ancestor FormPanel. A Panel's toolbars are not part of the standard Container->Component hierarchy, and
+     * so are not scanned to collect form items. However, the values <b>will</b> be submitted because form
+     * submission parameters are collected from the DOM tree.</p>
+     */
+    /** @cfg {Object/Array} fbar
+     * <p>A {@link Ext.Toolbar Toolbar} object, a Toolbar config, or an array of
+     * {@link Ext.Button Button}s/{@link Ext.Button Button} configs, describing a {@link Ext.Toolbar Toolbar} to be rendered into this Panel's footer element.</p>
+     * <p>After render, the <code>fbar</code> property will be an {@link Ext.Toolbar Toolbar} instance.</p>
+     * <p>If <tt>{@link #buttons}</tt> are specified, they will supersede the <tt>fbar</tt> configuration property.</p>
+     * The Panel's <tt>{@link #buttonAlign}</tt> configuration affects the layout of these items, for example:
+     * <pre><code>
+var w = new Ext.Window({
+    height: 250,
+    width: 500,
+    bbar: new Ext.Toolbar({
+        items: [{
+            text: 'bbar Left'
+        },'->',{
+            text: 'bbar Right'
+        }]
+    }),
+    {@link #buttonAlign}: 'left', // anything but 'center' or 'right' and you can use "-", and "->"
+                                  // to control the alignment of fbar items
+    fbar: [{
+        text: 'fbar Left'
+    },'->',{
+        text: 'fbar Right'
+    }]
+}).show();
+     * </code></pre>
+     * <p><b>Note:</b> Although a Toolbar may contain Field components, these will <b>not<b> be updated by a load
+     * of an ancestor FormPanel. A Panel's toolbars are not part of the standard Container->Component hierarchy, and
+     * so are not scanned to collect form items. However, the values <b>will</b> be submitted because form
+     * submission parameters are collected from the DOM tree.</p>
+     */
+    /**
+     * @cfg {Boolean} header
+     * <tt>true</tt> to create the Panel's header element explicitly, <tt>false</tt> to skip creating
+     * it.  If a <tt>{@link #title}</tt> is set the header will be created automatically, otherwise it will not.
+     * If a <tt>{@link #title}</tt> is set but <tt>header</tt> is explicitly set to <tt>false</tt>, the header
+     * will not be rendered.
+     */
+    /**
+     * @cfg {Boolean} footer
+     * <tt>true</tt> to create the footer element explicitly, false to skip creating it. The footer
+     * will be created automatically if <tt>{@link #buttons}</tt> or a <tt>{@link #fbar}</tt> have
+     * been configured.  See <tt>{@link #bodyCfg}</tt> for an example.
+     */
+    /**
+     * @cfg {String} title
+     * The title text to be used as innerHTML (html tags are accepted) to display in the panel
+     * <tt>{@link #header}</tt> (defaults to ''). When a <tt>title</tt> is specified the
+     * <tt>{@link #header}</tt> element will automatically be created and displayed unless
+     * {@link #header} is explicitly set to <tt>false</tt>.  If you do not want to specify a
+     * <tt>title</tt> at config time, but you may want one later, you must either specify a non-empty
+     * <tt>title</tt> (a blank space ' ' will do) or <tt>header:true</tt> so that the container
+     * element will get created.
+     */
+    /**
+     * @cfg {Array} buttons
+     * <tt>buttons</tt> will be used as <tt>{@link Ext.Container#items items}</tt> for the toolbar in
+     * the footer (<tt>{@link #fbar}</tt>). Typically the value of this configuration property will be
+     * an array of {@link Ext.Button}s or {@link Ext.Button} configuration objects.
+     * If an item is configured with <tt>minWidth</tt> or the Panel is configured with <tt>minButtonWidth</tt>,
+     * that width will be applied to the item.
+     */
+    /**
+     * @cfg {Object/String/Function} autoLoad
+     * A valid url spec according to the Updater {@link Ext.Updater#update} method.
+     * If autoLoad is not null, the panel will attempt to load its contents
+     * immediately upon render.<p>
+     * The URL will become the default URL for this panel's {@link #body} element,
+     * so it may be {@link Ext.Element#refresh refresh}ed at any time.</p>
+     */
+    /**
+     * @cfg {Boolean} frame
+     * <tt>false</tt> by default to render with plain 1px square borders. <tt>true</tt> to render with
+     * 9 elements, complete with custom rounded corners (also see {@link Ext.Element#boxWrap}).
+     * <p>The template generated for each condition is depicted below:</p><pre><code>
+     *
+// frame = false
+&lt;div id="developer-specified-id-goes-here" class="x-panel">
+
+    &lt;div class="x-panel-header">&lt;span class="x-panel-header-text">Title: (frame:false)&lt;/span>&lt;/div>
+
+    &lt;div class="x-panel-bwrap">
+        &lt;div class="x-panel-body">&lt;p>html value goes here&lt;/p>&lt;/div>
+    &lt;/div>
+&lt;/div>
+
+// frame = true (create 9 elements)
+&lt;div id="developer-specified-id-goes-here" class="x-panel">
+    &lt;div class="x-panel-tl">&lt;div class="x-panel-tr">&lt;div class="x-panel-tc">
+        &lt;div class="x-panel-header">&lt;span class="x-panel-header-text">Title: (frame:true)&lt;/span>&lt;/div>
+    &lt;/div>&lt;/div>&lt;/div>
+
+    &lt;div class="x-panel-bwrap">
+        &lt;div class="x-panel-ml">&lt;div class="x-panel-mr">&lt;div class="x-panel-mc">
+            &lt;div class="x-panel-body">&lt;p>html value goes here&lt;/p>&lt;/div>
+        &lt;/div>&lt;/div>&lt;/div>
+
+        &lt;div class="x-panel-bl">&lt;div class="x-panel-br">&lt;div class="x-panel-bc"/>
+        &lt;/div>&lt;/div>&lt;/div>
+&lt;/div>
+     * </code></pre>
+     */
+    /**
+     * @cfg {Boolean} border
+     * True to display the borders of the panel's body element, false to hide them (defaults to true).  By default,
+     * the border is a 2px wide inset border, but this can be further altered by setting {@link #bodyBorder} to false.
+     */
+    /**
+     * @cfg {Boolean} bodyBorder
+     * True to display an interior border on the body element of the panel, false to hide it (defaults to true).
+     * This only applies when {@link #border} == true.  If border == true and bodyBorder == false, the border will display
+     * as a 1px wide inset border, giving the entire body element an inset appearance.
+     */
+    /**
+     * @cfg {String/Object/Function} bodyCssClass
+     * Additional css class selector to be applied to the {@link #body} element in the format expected by
+     * {@link Ext.Element#addClass} (defaults to null). See {@link #bodyCfg}.
+     */
+    /**
+     * @cfg {String/Object/Function} bodyStyle
+     * Custom CSS styles to be applied to the {@link #body} element in the format expected by
+     * {@link Ext.Element#applyStyles} (defaults to null). See {@link #bodyCfg}.
+     */
+    /**
+     * @cfg {String} iconCls
+     * The CSS class selector that specifies a background image to be used as the header icon (defaults to '').
+     * <p>An example of specifying a custom icon class would be something like:
+     * </p><pre><code>
+// specify the property in the config for the class:
+     ...
+     iconCls: 'my-icon'
+
+// css class that specifies background image to be used as the icon image:
+.my-icon { background-image: url(../images/my-icon.gif) 0 6px no-repeat !important; }
+</code></pre>
+     */
+    /**
+     * @cfg {Boolean} collapsible
+     * True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into
+     * the header tool button area, false to keep the panel statically sized with no button (defaults to false).
+     */
+    /**
+     * @cfg {Array} tools
+     * An array of tool button configs to be added to the header tool area. When rendered, each tool is
+     * stored as an {@link Ext.Element Element} referenced by a public property called <tt><b></b>tools.<i>&lt;tool-type&gt;</i></tt>
+     * <p>Each tool config may contain the following properties:
+     * <div class="mdetail-params"><ul>
+     * <li><b>id</b> : String<div class="sub-desc"><b>Required.</b> The type
+     * of tool to create. By default, this assigns a CSS class of the form <tt>x-tool-<i>&lt;tool-type&gt;</i></tt> to the
+     * resulting tool Element. Ext provides CSS rules, and an icon sprite containing images for the tool types listed below.
+     * The developer may implement custom tools by supplying alternate CSS rules and background images:
+     * <ul>
+     * <div class="x-tool x-tool-toggle" style="float:left; margin-right:5;"> </div><div><tt> toggle</tt> (Created by default when {@link #collapsible} is <tt>true</tt>)</div>
+     * <div class="x-tool x-tool-close" style="float:left; margin-right:5;"> </div><div><tt> close</tt></div>
+     * <div class="x-tool x-tool-minimize" style="float:left; margin-right:5;"> </div><div><tt> minimize</tt></div>
+     * <div class="x-tool x-tool-maximize" style="float:left; margin-right:5;"> </div><div><tt> maximize</tt></div>
+     * <div class="x-tool x-tool-restore" style="float:left; margin-right:5;"> </div><div><tt> restore</tt></div>
+     * <div class="x-tool x-tool-gear" style="float:left; margin-right:5;"> </div><div><tt> gear</tt></div>
+     * <div class="x-tool x-tool-pin" style="float:left; margin-right:5;"> </div><div><tt> pin</tt></div>
+     * <div class="x-tool x-tool-unpin" style="float:left; margin-right:5;"> </div><div><tt> unpin</tt></div>
+     * <div class="x-tool x-tool-right" style="float:left; margin-right:5;"> </div><div><tt> right</tt></div>
+     * <div class="x-tool x-tool-left" style="float:left; margin-right:5;"> </div><div><tt> left</tt></div>
+     * <div class="x-tool x-tool-up" style="float:left; margin-right:5;"> </div><div><tt> up</tt></div>
+     * <div class="x-tool x-tool-down" style="float:left; margin-right:5;"> </div><div><tt> down</tt></div>
+     * <div class="x-tool x-tool-refresh" style="float:left; margin-right:5;"> </div><div><tt> refresh</tt></div>
+     * <div class="x-tool x-tool-minus" style="float:left; margin-right:5;"> </div><div><tt> minus</tt></div>
+     * <div class="x-tool x-tool-plus" style="float:left; margin-right:5;"> </div><div><tt> plus</tt></div>
+     * <div class="x-tool x-tool-help" style="float:left; margin-right:5;"> </div><div><tt> help</tt></div>
+     * <div class="x-tool x-tool-search" style="float:left; margin-right:5;"> </div><div><tt> search</tt></div>
+     * <div class="x-tool x-tool-save" style="float:left; margin-right:5;"> </div><div><tt> save</tt></div>
+     * <div class="x-tool x-tool-print" style="float:left; margin-right:5;"> </div><div><tt> print</tt></div>
+     * </ul></div></li>
+     * <li><b>handler</b> : Function<div class="sub-desc"><b>Required.</b> The function to
+     * call when clicked. Arguments passed are:<ul>
+     * <li><b>event</b> : Ext.EventObject<div class="sub-desc">The click event.</div></li>
+     * <li><b>toolEl</b> : Ext.Element<div class="sub-desc">The tool Element.</div></li>
+     * <li><b>panel</b> : Ext.Panel<div class="sub-desc">The host Panel</div></li>
+     * <li><b>tc</b> : Ext.Panel<div class="sub-desc">The tool configuration object</div></li>
+     * </ul></div></li>
+     * <li><b>stopEvent</b> : Boolean<div class="sub-desc">Defaults to true. Specify as false to allow click event to propagate.</div></li>
+     * <li><b>scope</b> : Object<div class="sub-desc">The scope in which to call the handler.</div></li>
+     * <li><b>qtip</b> : String/Object<div class="sub-desc">A tip string, or
+     * a config argument to {@link Ext.QuickTip#register}</div></li>
+     * <li><b>hidden</b> : Boolean<div class="sub-desc">True to initially render hidden.</div></li>
+     * <li><b>on</b> : Object<div class="sub-desc">A listener config object specifiying
+     * event listeners in the format of an argument to {@link #addListener}</div></li>
+     * </ul></div>
+     * <p>Note that, apart from the toggle tool which is provided when a panel is collapsible, these
+     * tools only provide the visual button. Any required functionality must be provided by adding
+     * handlers that implement the necessary behavior.</p>
+     * <p>Example usage:</p>
+     * <pre><code>
+tools:[{
+    id:'refresh',
+    qtip: 'Refresh form Data',
+    // hidden:true,
+    handler: function(event, toolEl, panel){
+        // refresh logic
+    }
+},
+{
+    id:'help',
+    qtip: 'Get Help',
+    handler: function(event, toolEl, panel){
+        // whatever
+    }
+}]
+</code></pre>
+     * <p>For the custom id of <tt>'help'</tt> define two relevant css classes with a link to
+     * a 15x15 image:</p>
+     * <pre><code>
+.x-tool-help {background-image: url(images/help.png);}
+.x-tool-help-over {background-image: url(images/help_over.png);}
+// if using an image sprite:
+.x-tool-help {background-image: url(images/help.png) no-repeat 0 0;}
+.x-tool-help-over {background-position:-15px 0;}
+</code></pre>
+     */
+    /**
+     * @cfg {Ext.Template/Ext.XTemplate} toolTemplate
+     * <p>A Template used to create {@link #tools} in the {@link #header} Element. Defaults to:</p><pre><code>
+new Ext.Template('&lt;div class="x-tool x-tool-{id}">&amp;#160;&lt;/div>')</code></pre>
+     * <p>This may may be overridden to provide a custom DOM structure for tools based upon a more
+     * complex XTemplate. The template's data is a single tool configuration object (Not the entire Array)
+     * as specified in {@link #tools}.  In the following example an &lt;a> tag is used to provide a
+     * visual indication when hovering over the tool:</p><pre><code>
+var win = new Ext.Window({
+    tools: [{
+        id: 'download',
+        href: '/MyPdfDoc.pdf'
+    }],
+    toolTemplate: new Ext.XTemplate(
+        '&lt;tpl if="id==\'download\'">',
+            '&lt;a class="x-tool x-tool-pdf" href="{href}">&lt;/a>',
+        '&lt;/tpl>',
+        '&lt;tpl if="id!=\'download\'">',
+            '&lt;div class="x-tool x-tool-{id}">&amp;#160;&lt;/div>',
+        '&lt;/tpl>'
+    ),
+    width:500,
+    height:300,
+    closeAction:'hide'
+});</code></pre>
+     * <p>Note that the CSS class "x-tool-pdf" should have an associated style rule which provides an
+     * appropriate background image, something like:</p>
+    <pre><code>
+    a.x-tool-pdf {background-image: url(../shared/extjs/images/pdf.gif)!important;}
+    </code></pre>
+     */
+    /**
+     * @cfg {Boolean} hideCollapseTool
+     * <tt>true</tt> to hide the expand/collapse toggle button when <code>{@link #collapsible} == true</code>,
+     * <tt>false</tt> to display it (defaults to <tt>false</tt>).
+     */
+    /**
+     * @cfg {Boolean} titleCollapse
+     * <tt>true</tt> to allow expanding and collapsing the panel (when <tt>{@link #collapsible} = true</tt>)
+     * by clicking anywhere in the header bar, <tt>false</tt>) to allow it only by clicking to tool button
+     * (defaults to <tt>false</tt>)). If this panel is a child item of a border layout also see the
+     * {@link Ext.layout.BorderLayout.Region BorderLayout.Region}
+     * <tt>{@link Ext.layout.BorderLayout.Region#floatable floatable}</tt> config option.
+     */
+    /**
+     * @cfg {Boolean} autoScroll
+     * <tt>true</tt> to use overflow:'auto' on the panel's body element and show scroll bars automatically when
+     * necessary, <tt>false</tt> to clip any overflowing content (defaults to <tt>false</tt>).
+     */
+    /**
+     * @cfg {Mixed} floating
+     * <p>This property is used to configure the underlying {@link Ext.Layer}. Acceptable values for this
+     * configuration property are:</p><div class="mdetail-params"><ul>
+     * <li><b><tt>false</tt></b> : <b>Default.</b><div class="sub-desc">Display the panel inline where it is
+     * rendered.</div></li>
+     * <li><b><tt>true</tt></b> : <div class="sub-desc">Float the panel (absolute position it with automatic
+     * shimming and shadow).<ul>
+     * <div class="sub-desc">Setting floating to true will create an Ext.Layer for this panel and display the
+     * panel at negative offsets so that it is hidden.</div>
+     * <div class="sub-desc">Since the panel will be absolute positioned, the position must be set explicitly
+     * <i>after</i> render (e.g., <tt>myPanel.setPosition(100,100);</tt>).</div>
+     * <div class="sub-desc"><b>Note</b>: when floating a panel you should always assign a fixed width,
+     * otherwise it will be auto width and will expand to fill to the right edge of the viewport.</div>
+     * </ul></div></li>
+     * <li><b><tt>{@link Ext.Layer object}</tt></b> : <div class="sub-desc">The specified object will be used
+     * as the configuration object for the {@link Ext.Layer} that will be created.</div></li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {Boolean/String} shadow
+     * <tt>true</tt> (or a valid Ext.Shadow {@link Ext.Shadow#mode} value) to display a shadow behind the
+     * panel, <tt>false</tt> to display no shadow (defaults to <tt>'sides'</tt>).  Note that this option
+     * only applies when <tt>{@link #floating} = true</tt>.
+     */
+    /**
+     * @cfg {Number} shadowOffset
+     * The number of pixels to offset the shadow if displayed (defaults to <tt>4</tt>). Note that this
+     * option only applies when <tt>{@link #floating} = true</tt>.
+     */
+    /**
+     * @cfg {Boolean} shim
+     * <tt>false</tt> to disable the iframe shim in browsers which need one (defaults to <tt>true</tt>).
+     * Note that this option only applies when <tt>{@link #floating} = true</tt>.
+     */
+    /**
+     * @cfg {String/Object} html
+     * An HTML fragment, or a {@link Ext.DomHelper DomHelper} specification to use as the panel's body
+     * content (defaults to ''). The HTML content is added by the Panel's {@link #afterRender} method,
+     * and so the document will not contain this HTML at the time the {@link #render} event is fired.
+     * This content is inserted into the body <i>before</i> any configured {@link #contentEl} is appended.
+     */
+    /**
+     * @cfg {String} contentEl
+     * <p>Specify the <tt>id</tt> of an existing HTML node to use as the panel's body content
+     * (defaults to '').</p><div><ul>
+     * <li><b>Description</b> : <ul>
+     * <div class="sub-desc">This config option is used to take an existing HTML element and place it in the body
+     * of a new panel (it simply moves the specified DOM element into the body element of the Panel
+     * <i>when the Panel is rendered</i> to use as the content (it is not going to be the
+     * actual panel itself).</div>
+     * </ul></li>
+     * <li><b>Notes</b> : <ul>
+     * <div class="sub-desc">The specified HTML Element is appended to the Panel's {@link #body} Element by the
+     * Panel's {@link #afterRender} method <i>after any configured {@link #html HTML} has
+     * been inserted</i>, and so the document will not contain this HTML at the time the
+     * {@link #render} event is fired.</div>
+     * <div class="sub-desc">The specified HTML element used will not participate in any layout scheme that the
+     * Panel may use. It's just HTML. Layouts operate on child items.</div>
+     * <div class="sub-desc">Add either the <tt>x-hidden</tt> or the <tt>x-hide-display</tt> CSS class to
+     * prevent a brief flicker of the content before it is rendered to the panel.</div>
+     * </ul></li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {Object/Array} keys
+     * A {@link Ext.KeyMap} config object (in the format expected by {@link Ext.KeyMap#addBinding}
+     * used to assign custom key handling to this panel (defaults to <tt>null</tt>).
+     */
+    /**
+     * @cfg {Boolean/Object} draggable
+     * <p><tt>true</tt> to enable dragging of this Panel (defaults to <tt>false</tt>).</p>
+     * <p>For custom drag/drop implementations, an <b>Ext.Panel.DD</b> config could also be passed
+     * in this config instead of <tt>true</tt>. Ext.Panel.DD is an internal, undocumented class which
+     * moves a proxy Element around in place of the Panel's element, but provides no other behaviour
+     * during dragging or on drop. It is a subclass of {@link Ext.dd.DragSource}, so behaviour may be
+     * added by implementing the interface methods of {@link Ext.dd.DragDrop} e.g.:
+     * <pre><code>
+new Ext.Panel({
+    title: 'Drag me',
+    x: 100,
+    y: 100,
+    renderTo: Ext.getBody(),
+    floating: true,
+    frame: true,
+    width: 400,
+    height: 200,
+    draggable: {
+//      Config option of Ext.Panel.DD class.
+//      It&#39;s a floating Panel, so do not show a placeholder proxy in the original position.
+        insertProxy: false,
+
+//      Called for each mousemove event while dragging the DD object.
+        onDrag : function(e){
+//          Record the x,y position of the drag proxy so that we can
+//          position the Panel at end of drag.
+            var pel = this.proxy.getEl();
+            this.x = pel.getLeft(true);
+            this.y = pel.getTop(true);
+
+//          Keep the Shadow aligned if there is one.
+            var s = this.panel.getEl().shadow;
+            if (s) {
+                s.realign(this.x, this.y, pel.getWidth(), pel.getHeight());
+            }
+        },
+
+//      Called on the mouseup event.
+        endDrag : function(e){
+            this.panel.setPosition(this.x, this.y);
+        }
+    }
+}).show();
+</code></pre>
+     */
+    /**
+     * @cfg {String} tabTip
+     * A string to be used as innerHTML (html tags are accepted) to show in a tooltip when mousing over
+     * the tab of a Ext.Panel which is an item of a {@link Ext.TabPanel}. {@link Ext.QuickTips}.init()
+     * must be called in order for the tips to render.
+     */
+    /**
+     * @cfg {Boolean} disabled
+     * Render this panel disabled (default is <tt>false</tt>). An important note when using the disabled
+     * config on panels is that IE will often fail to initialize the disabled mask element correectly if
+     * the panel's layout has not yet completed by the time the Panel is disabled during the render process.
+     * If you experience this issue, you may need to instead use the {@link #afterlayout} event to initialize
+     * the disabled state:
+     * <pre><code>
+new Ext.Panel({
+    ...
+    listeners: {
+        'afterlayout': {
+            fn: function(p){
+                p.disable();
+            },
+            single: true // important, as many layouts can occur
+        }
+    }
+});
+</code></pre>
+     */
+    /**
+     * @cfg {Boolean} autoHeight
+     * <tt>true</tt> to use height:'auto', <tt>false</tt> to use fixed height (defaults to <tt>false</tt>).
+     * <b>Note</b>: Setting <tt>autoHeight:true</tt> means that the browser will manage the panel's height
+     * based on its contents, and that Ext will not manage it at all. If the panel is within a layout that
+     * manages dimensions (<tt>fit</tt>, <tt>border</tt>, etc.) then setting <tt>autoHeight:true</tt>
+     * can cause issues with scrolling and will not generally work as expected since the panel will take
+     * on the height of its contents rather than the height required by the Ext layout.
+     */
+
+
+    /**
+     * @cfg {String} baseCls
+     * The base CSS class to apply to this panel's element (defaults to <tt>'x-panel'</tt>).
+     * <p>Another option available by default is to specify <tt>'x-plain'</tt> which strips all styling
+     * except for required attributes for Ext layouts to function (e.g. overflow:hidden).
+     * See <tt>{@link #unstyled}</tt> also.</p>
+     */
+    baseCls : 'x-panel',
+    /**
+     * @cfg {String} collapsedCls
+     * A CSS class to add to the panel's element after it has been collapsed (defaults to
+     * <tt>'x-panel-collapsed'</tt>).
+     */
+    collapsedCls : 'x-panel-collapsed',
+    /**
+     * @cfg {Boolean} maskDisabled
+     * <tt>true</tt> to mask the panel when it is {@link #disabled}, <tt>false</tt> to not mask it (defaults
+     * to <tt>true</tt>).  Either way, the panel will always tell its contained elements to disable themselves
+     * when it is disabled, but masking the panel can provide an additional visual cue that the panel is
+     * disabled.
+     */
+    maskDisabled : true,
+    /**
+     * @cfg {Boolean} animCollapse
+     * <tt>true</tt> to animate the transition when the panel is collapsed, <tt>false</tt> to skip the
+     * animation (defaults to <tt>true</tt> if the {@link Ext.Fx} class is available, otherwise <tt>false</tt>).
+     */
+    animCollapse : Ext.enableFx,
+    /**
+     * @cfg {Boolean} headerAsText
+     * <tt>true</tt> to display the panel <tt>{@link #title}</tt> in the <tt>{@link #header}</tt>,
+     * <tt>false</tt> to hide it (defaults to <tt>true</tt>).
+     */
+    headerAsText : true,
+    /**
+     * @cfg {String} buttonAlign
+     * The alignment of any {@link #buttons} added to this panel.  Valid values are <tt>'right'</tt>,
+     * <tt>'left'</tt> and <tt>'center'</tt> (defaults to <tt>'right'</tt>).
+     */
+    buttonAlign : 'right',
+    /**
+     * @cfg {Boolean} collapsed
+     * <tt>true</tt> to render the panel collapsed, <tt>false</tt> to render it expanded (defaults to
+     * <tt>false</tt>).
+     */
+    collapsed : false,
+    /**
+     * @cfg {Boolean} collapseFirst
+     * <tt>true</tt> to make sure the collapse/expand toggle button always renders first (to the left of)
+     * any other tools in the panel's title bar, <tt>false</tt> to render it last (defaults to <tt>true</tt>).
+     */
+    collapseFirst : true,
+    /**
+     * @cfg {Number} minButtonWidth
+     * Minimum width in pixels of all {@link #buttons} in this panel (defaults to <tt>75</tt>)
+     */
+    minButtonWidth : 75,
+    /**
+     * @cfg {Boolean} unstyled
+     * Overrides the <tt>{@link #baseCls}</tt> setting to <tt>{@link #baseCls} = 'x-plain'</tt> which renders
+     * the panel unstyled except for required attributes for Ext layouts to function (e.g. overflow:hidden).
+     */
+    /**
+     * @cfg {String} elements
+     * A comma-delimited list of panel elements to initialize when the panel is rendered.  Normally, this list will be
+     * generated automatically based on the items added to the panel at config time, but sometimes it might be useful to
+     * make sure a structural element is rendered even if not specified at config time (for example, you may want
+     * to add a button or toolbar dynamically after the panel has been rendered).  Adding those elements to this
+     * list will allocate the required placeholders in the panel when it is rendered.  Valid values are<div class="mdetail-params"><ul>
+     * <li><tt>header</tt></li>
+     * <li><tt>tbar</tt> (top bar)</li>
+     * <li><tt>body</tt></li>
+     * <li><tt>bbar</tt> (bottom bar)</li>
+     * <li><tt>footer</tt></li>
+     * </ul></div>
+     * Defaults to '<tt>body</tt>'.
+     */
+    elements : 'body',
+    /**
+     * @cfg {Boolean} preventBodyReset
+     * Defaults to <tt>false</tt>.  When set to <tt>true</tt>, an extra css class <tt>'x-panel-normal'</tt>
+     * will be added to the panel's element, effectively applying css styles suggested by the W3C
+     * (see http://www.w3.org/TR/CSS21/sample.html) to the Panel's <b>body</b> element (not the header,
+     * footer, etc.).
+     */
+    preventBodyReset : false,
+
+    // protected - these could be used to customize the behavior of the window,
+    // but changing them would not be useful without further mofifications and
+    // could lead to unexpected or undesirable results.
+    toolTarget : 'header',
+    collapseEl : 'bwrap',
+    slideAnchor : 't',
+    disabledClass : '',
+
+    // private, notify box this class will handle heights
+    deferHeight : true,
+    // private
+    expandDefaults: {
+        duration : 0.25
+    },
+    // private
+    collapseDefaults : {
+        duration : 0.25
+    },
+
+    // private
+    initComponent : function(){
+        Ext.Panel.superclass.initComponent.call(this);
+
+        this.addEvents(
+            /**
+             * @event bodyresize
+             * Fires after the Panel has been resized.
+             * @param {Ext.Panel} p the Panel which has been resized.
+             * @param {Number} width The Panel's new width.
+             * @param {Number} height The Panel's new height.
+             */
+            'bodyresize',
+            /**
+             * @event titlechange
+             * Fires after the Panel title has been {@link #title set} or {@link #setTitle changed}.
+             * @param {Ext.Panel} p the Panel which has had its title changed.
+             * @param {String} The new title.
+             */
+            'titlechange',
+            /**
+             * @event iconchange
+             * Fires after the Panel icon class has been {@link #iconCls set} or {@link #setIconClass changed}.
+             * @param {Ext.Panel} p the Panel which has had its {@link #iconCls icon class} changed.
+             * @param {String} The new icon class.
+             * @param {String} The old icon class.
+             */
+            'iconchange',
+            /**
+             * @event collapse
+             * Fires after the Panel has been collapsed.
+             * @param {Ext.Panel} p the Panel that has been collapsed.
+             */
+            'collapse',
+            /**
+             * @event expand
+             * Fires after the Panel has been expanded.
+             * @param {Ext.Panel} p The Panel that has been expanded.
+             */
+            'expand',
+            /**
+             * @event beforecollapse
+             * Fires before the Panel is collapsed.  A handler can return false to cancel the collapse.
+             * @param {Ext.Panel} p the Panel being collapsed.
+             * @param {Boolean} animate True if the collapse is animated, else false.
+             */
+            'beforecollapse',
+            /**
+             * @event beforeexpand
+             * Fires before the Panel is expanded.  A handler can return false to cancel the expand.
+             * @param {Ext.Panel} p The Panel being expanded.
+             * @param {Boolean} animate True if the expand is animated, else false.
+             */
+            'beforeexpand',
+            /**
+             * @event beforeclose
+             * Fires before the Panel is closed.  Note that Panels do not directly support being closed, but some
+             * Panel subclasses do (like {@link Ext.Window}) or a Panel within a Ext.TabPanel.  This event only
+             * applies to such subclasses.
+             * A handler can return false to cancel the close.
+             * @param {Ext.Panel} p The Panel being closed.
+             */
+            'beforeclose',
+            /**
+             * @event close
+             * Fires after the Panel is closed.  Note that Panels do not directly support being closed, but some
+             * Panel subclasses do (like {@link Ext.Window}) or a Panel within a Ext.TabPanel.
+             * @param {Ext.Panel} p The Panel that has been closed.
+             */
+            'close',
+            /**
+             * @event activate
+             * Fires after the Panel has been visually activated.
+             * Note that Panels do not directly support being activated, but some Panel subclasses
+             * do (like {@link Ext.Window}). Panels which are child Components of a TabPanel fire the
+             * activate and deactivate events under the control of the TabPanel.
+             * @param {Ext.Panel} p The Panel that has been activated.
+             */
+            'activate',
+            /**
+             * @event deactivate
+             * Fires after the Panel has been visually deactivated.
+             * Note that Panels do not directly support being deactivated, but some Panel subclasses
+             * do (like {@link Ext.Window}). Panels which are child Components of a TabPanel fire the
+             * activate and deactivate events under the control of the TabPanel.
+             * @param {Ext.Panel} p The Panel that has been deactivated.
+             */
+            'deactivate'
+        );
+
+        if(this.unstyled){
+            this.baseCls = 'x-plain';
+        }
+
+        // shortcuts
+        if(this.tbar){
+            this.elements += ',tbar';
+            if(Ext.isObject(this.tbar)){
+                this.topToolbar = this.tbar;
+            }
+            delete this.tbar;
+        }
+        if(this.bbar){
+            this.elements += ',bbar';
+            if(Ext.isObject(this.bbar)){
+                this.bottomToolbar = this.bbar;
+            }
+            delete this.bbar;
+        }
+
+        if(this.header === true){
+            this.elements += ',header';
+            delete this.header;
+        }else if(this.headerCfg || (this.title && this.header !== false)){
+            this.elements += ',header';
+        }
+
+        if(this.footerCfg || this.footer === true){
+            this.elements += ',footer';
+            delete this.footer;
+        }
+
+        if(this.buttons){
+            this.elements += ',footer';
+            var btns = this.buttons;
+            /**
+             * This Panel's Array of buttons as created from the <tt>{@link #buttons}</tt>
+             * config property. Read only.
+             * @type Array
+             * @property buttons
+             */
+            this.buttons = [];
+            for(var i = 0, len = btns.length; i < len; i++) {
+                if(btns[i].render){ // button instance
+                    this.buttons.push(btns[i]);
+                }else if(btns[i].xtype){
+                    this.buttons.push(Ext.create(btns[i], 'button'));
+                }else{
+                    this.addButton(btns[i]);
+                }
+            }
+        }
+        if(this.fbar){
+            this.elements += ',footer';
+        }
+        if(this.autoLoad){
+            this.on('render', this.doAutoLoad, this, {delay:10});
+        }
+    },
+
+    // private
+    createElement : function(name, pnode){
+        if(this[name]){
+            pnode.appendChild(this[name].dom);
+            return;
+        }
+
+        if(name === 'bwrap' || this.elements.indexOf(name) != -1){
+            if(this[name+'Cfg']){
+                this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);
+            }else{
+                var el = document.createElement('div');
+                el.className = this[name+'Cls'];
+                this[name] = Ext.get(pnode.appendChild(el));
+            }
+            if(this[name+'CssClass']){
+                this[name].addClass(this[name+'CssClass']);
+            }
+            if(this[name+'Style']){
+                this[name].applyStyles(this[name+'Style']);
+            }
+        }
+    },
+
+    // private
+    onRender : function(ct, position){
+        Ext.Panel.superclass.onRender.call(this, ct, position);
+        this.createClasses();
+
+        var el = this.el,
+            d = el.dom,
+            bw;
+        el.addClass(this.baseCls);
+        if(d.firstChild){ // existing markup
+            this.header = el.down('.'+this.headerCls);
+            this.bwrap = el.down('.'+this.bwrapCls);
+            var cp = this.bwrap ? this.bwrap : el;
+            this.tbar = cp.down('.'+this.tbarCls);
+            this.body = cp.down('.'+this.bodyCls);
+            this.bbar = cp.down('.'+this.bbarCls);
+            this.footer = cp.down('.'+this.footerCls);
+            this.fromMarkup = true;
+        }
+        if (this.preventBodyReset === true) {
+            el.addClass('x-panel-reset');
+        }
+        if(this.cls){
+            el.addClass(this.cls);
+        }
+
+        if(this.buttons){
+            this.elements += ',footer';
+        }
+
+        // This block allows for maximum flexibility and performance when using existing markup
+
+        // framing requires special markup
+        if(this.frame){
+            el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));
+
+            this.createElement('header', d.firstChild.firstChild.firstChild);
+            this.createElement('bwrap', d);
+
+            // append the mid and bottom frame to the bwrap
+            bw = this.bwrap.dom;
+            var ml = d.childNodes[1], bl = d.childNodes[2];
+            bw.appendChild(ml);
+            bw.appendChild(bl);
+
+            var mc = bw.firstChild.firstChild.firstChild;
+            this.createElement('tbar', mc);
+            this.createElement('body', mc);
+            this.createElement('bbar', mc);
+            this.createElement('footer', bw.lastChild.firstChild.firstChild);
+
+            if(!this.footer){
+                this.bwrap.dom.lastChild.className += ' x-panel-nofooter';
+            }
+        }else{
+            this.createElement('header', d);
+            this.createElement('bwrap', d);
+
+            // append the mid and bottom frame to the bwrap
+            bw = this.bwrap.dom;
+            this.createElement('tbar', bw);
+            this.createElement('body', bw);
+            this.createElement('bbar', bw);
+            this.createElement('footer', bw);
+
+            if(!this.header){
+                this.body.addClass(this.bodyCls + '-noheader');
+                if(this.tbar){
+                    this.tbar.addClass(this.tbarCls + '-noheader');
+                }
+            }
+        }
+
+        if(this.padding !== undefined) {
+            this.body.setStyle('padding', this.body.addUnits(this.padding));
+        }
+
+        if(this.border === false){
+            this.el.addClass(this.baseCls + '-noborder');
+            this.body.addClass(this.bodyCls + '-noborder');
+            if(this.header){
+                this.header.addClass(this.headerCls + '-noborder');
+            }
+            if(this.footer){
+                this.footer.addClass(this.footerCls + '-noborder');
+            }
+            if(this.tbar){
+                this.tbar.addClass(this.tbarCls + '-noborder');
+            }
+            if(this.bbar){
+                this.bbar.addClass(this.bbarCls + '-noborder');
+            }
+        }
+
+        if(this.bodyBorder === false){
+           this.body.addClass(this.bodyCls + '-noborder');
+        }
+
+        this.bwrap.enableDisplayMode('block');
+
+        if(this.header){
+            this.header.unselectable();
+
+            // for tools, we need to wrap any existing header markup
+            if(this.headerAsText){
+                this.header.dom.innerHTML =
+                    '<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';
+
+                if(this.iconCls){
+                    this.setIconClass(this.iconCls);
+                }
+            }
+        }
+
+        if(this.floating){
+            this.makeFloating(this.floating);
+        }
+
+        if(this.collapsible){
+            this.tools = this.tools ? this.tools.slice(0) : [];
+            if(!this.hideCollapseTool){
+                this.tools[this.collapseFirst?'unshift':'push']({
+                    id: 'toggle',
+                    handler : this.toggleCollapse,
+                    scope: this
+                });
+            }
+            if(this.titleCollapse && this.header){
+                this.mon(this.header, 'click', this.toggleCollapse, this);
+                this.header.setStyle('cursor', 'pointer');
+            }
+        }
+        if(this.tools){
+            var ts = this.tools;
+            this.tools = {};
+            this.addTool.apply(this, ts);
+        }else{
+            this.tools = {};
+        }
+
+        if(this.buttons && this.buttons.length > 0){
+            this.fbar = new Ext.Toolbar({
+                items: this.buttons,
+                toolbarCls: 'x-panel-fbar'
+            });
+        }
+        this.toolbars = [];
+        if(this.fbar){
+            this.fbar = Ext.create(this.fbar, 'toolbar');
+            this.fbar.enableOverflow = false;
+            if(this.fbar.items){
+                this.fbar.items.each(function(c){
+                    c.minWidth = c.minWidth || this.minButtonWidth;
+                }, this);
+            }
+            this.fbar.toolbarCls = 'x-panel-fbar';
+
+            var bct = this.footer.createChild({cls: 'x-panel-btns x-panel-btns-'+this.buttonAlign});
+            this.fbar.ownerCt = this;
+            this.fbar.render(bct);
+            bct.createChild({cls:'x-clear'});
+            this.toolbars.push(this.fbar);
+        }
+
+        if(this.tbar && this.topToolbar){
+            if(Ext.isArray(this.topToolbar)){
+                this.topToolbar = new Ext.Toolbar(this.topToolbar);
+            }else if(!this.topToolbar.events){
+                this.topToolbar = Ext.create(this.topToolbar, 'toolbar');
+            }
+            this.topToolbar.ownerCt = this;
+            this.topToolbar.render(this.tbar);
+            this.toolbars.push(this.topToolbar);
+        }
+        if(this.bbar && this.bottomToolbar){
+            if(Ext.isArray(this.bottomToolbar)){
+                this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);
+            }else if(!this.bottomToolbar.events){
+                this.bottomToolbar = Ext.create(this.bottomToolbar, 'toolbar');
+            }
+            this.bottomToolbar.ownerCt = this;
+            this.bottomToolbar.render(this.bbar);
+            this.toolbars.push(this.bottomToolbar);
+        }
+        Ext.each(this.toolbars, function(tb){
+            tb.on({
+                scope: this,
+                afterlayout: this.syncHeight,
+                remove: this.syncHeight
+            });
+        }, this);
+    },
+
+    /**
+     * Sets the CSS class that provides the icon image for this panel.  This method will replace any existing
+     * icon class if one has already been set and fire the {@link #iconchange} event after completion.
+     * @param {String} cls The new CSS class name
+     */
+    setIconClass : function(cls){
+        var old = this.iconCls;
+        this.iconCls = cls;
+        if(this.rendered && this.header){
+            if(this.frame){
+                this.header.addClass('x-panel-icon');
+                this.header.replaceClass(old, this.iconCls);
+            }else{
+                var hd = this.header.dom;
+                var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null;
+                if(img){
+                    Ext.fly(img).replaceClass(old, this.iconCls);
+                }else{
+                    Ext.DomHelper.insertBefore(hd.firstChild, {
+                        tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls
+                    });
+                 }
+            }
+        }
+        this.fireEvent('iconchange', this, cls, old);
+    },
+
+    // private
+    makeFloating : function(cfg){
+        this.floating = true;
+        this.el = new Ext.Layer(
+            Ext.isObject(cfg) ? cfg : {
+                shadow: this.shadow !== undefined ? this.shadow : 'sides',
+                shadowOffset: this.shadowOffset,
+                constrain:false,
+                shim: this.shim === false ? false : undefined
+            }, this.el
+        );
+    },
+
+    /**
+     * Returns the {@link Ext.Toolbar toolbar} from the top (<tt>{@link #tbar}</tt>) section of the panel.
+     * @return {Ext.Toolbar} The toolbar
+     */
+    getTopToolbar : function(){
+        return this.topToolbar;
+    },
+
+    /**
+     * Returns the {@link Ext.Toolbar toolbar} from the bottom (<tt>{@link #bbar}</tt>) section of the panel.
+     * @return {Ext.Toolbar} The toolbar
+     */
+    getBottomToolbar : function(){
+        return this.bottomToolbar;
+    },
+
+    /**
+     * Adds a button to this panel.  Note that this method must be called prior to rendering.  The preferred
+     * approach is to add buttons via the {@link #buttons} config.
+     * @param {String/Object} config A valid {@link Ext.Button} config.  A string will become the text for a default
+     * button config, an object will be treated as a button config object.
+     * @param {Function} handler The function to be called on button {@link Ext.Button#click}
+     * @param {Object} scope The scope to use for the button handler function
+     * @return {Ext.Button} The button that was added
+     */
+    addButton : function(config, handler, scope){
+        var bc = {
+            handler: handler,
+            scope: scope,
+            minWidth: this.minButtonWidth,
+            hideParent:true
+        };
+        if(typeof config == "string"){
+            bc.text = config;
+        }else{
+            Ext.apply(bc, config);
+        }
+        var btn = new Ext.Button(bc);
+        if(!this.buttons){
+            this.buttons = [];
+        }
+        this.buttons.push(btn);
+        return btn;
+    },
+
+    // private
+    addTool : function(){
+        if(!this[this.toolTarget]) { // no where to render tools!
+            return;
+        }
+        if(!this.toolTemplate){
+            // initialize the global tool template on first use
+            var tt = new Ext.Template(
+                 '<div class="x-tool x-tool-{id}">&#160;</div>'
+            );
+            tt.disableFormats = true;
+            tt.compile();
+            Ext.Panel.prototype.toolTemplate = tt;
+        }
+        for(var i = 0, a = arguments, len = a.length; i < len; i++) {
+            var tc = a[i];
+            if(!this.tools[tc.id]){
+                var overCls = 'x-tool-'+tc.id+'-over';
+                var t = this.toolTemplate.insertFirst((tc.align !== 'left') ? this[this.toolTarget] : this[this.toolTarget].child('span'), tc, true);
+                this.tools[tc.id] = t;
+                t.enableDisplayMode('block');
+                this.mon(t, 'click',  this.createToolHandler(t, tc, overCls, this));
+                if(tc.on){
+                    this.mon(t, tc.on);
+                }
+                if(tc.hidden){
+                    t.hide();
+                }
+                if(tc.qtip){
+                    if(Ext.isObject(tc.qtip)){
+                        Ext.QuickTips.register(Ext.apply({
+                              target: t.id
+                        }, tc.qtip));
+                    } else {
+                        t.dom.qtip = tc.qtip;
+                    }
+                }
+                t.addClassOnOver(overCls);
+            }
+        }
+    },
+
+    onLayout : function(){
+        if(this.toolbars.length > 0){
+            this.duringLayout = true;
+            Ext.each(this.toolbars, function(tb){
+                tb.doLayout();
+            });
+            delete this.duringLayout;
+            this.syncHeight();
+        }
+    },
+
+    syncHeight : function(){
+        if(!(this.autoHeight || this.duringLayout)){
+            var last = this.lastSize;
+            if(last && !Ext.isEmpty(last.height)){
+                var old = last.height, h = this.el.getHeight();
+                if(old != 'auto' && old != h){
+                    var bd = this.body, bdh = bd.getHeight();
+                    h = Math.max(bdh + old - h, 0);
+                    if(bdh > 0 && bdh != h){
+                        bd.setHeight(h);
+                        if(Ext.isIE && h <= 0){
+                            return;
+                        }
+                        var sz = bd.getSize();
+                        this.fireEvent('bodyresize', sz.width, sz.height);
+                    }
+                }
+            }
+        }
+    },
+
+    // private
+    onShow : function(){
+        if(this.floating){
+            return this.el.show();
+        }
+        Ext.Panel.superclass.onShow.call(this);
+    },
+
+    // private
+    onHide : function(){
+        if(this.floating){
+            return this.el.hide();
+        }
+        Ext.Panel.superclass.onHide.call(this);
+    },
+
+    // private
+    createToolHandler : function(t, tc, overCls, panel){
+        return function(e){
+            t.removeClass(overCls);
+            if(tc.stopEvent !== false){
+                e.stopEvent();
+            }
+            if(tc.handler){
+                tc.handler.call(tc.scope || t, e, t, panel, tc);
+            }
+        };
+    },
+
+    // private
+    afterRender : function(){
+        if(this.floating && !this.hidden){
+            this.el.show();
+        }
+        if(this.title){
+            this.setTitle(this.title);
+        }
+        this.setAutoScroll();
+        if(this.html){
+            this.body.update(Ext.isObject(this.html) ?
+                             Ext.DomHelper.markup(this.html) :
+                             this.html);
+            delete this.html;
+        }
+        if(this.contentEl){
+            var ce = Ext.getDom(this.contentEl);
+            Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);
+            this.body.dom.appendChild(ce);
+        }
+        if(this.collapsed){
+            this.collapsed = false;
+            this.collapse(false);
+        }
+        Ext.Panel.superclass.afterRender.call(this); // do sizing calcs last
+        this.initEvents();
+    },
+
+    // private
+    setAutoScroll : function(){
+        if(this.rendered && this.autoScroll){
+            var el = this.body || this.el;
+            if(el){
+                el.setOverflow('auto');
+            }
+        }
+    },
+
+    // private
+    getKeyMap : function(){
+        if(!this.keyMap){
+            this.keyMap = new Ext.KeyMap(this.el, this.keys);
+        }
+        return this.keyMap;
+    },
+
+    // private
+    initEvents : function(){
+        if(this.keys){
+            this.getKeyMap();
+        }
+        if(this.draggable){
+            this.initDraggable();
+        }
+    },
+
+    // private
+    initDraggable : function(){
+        /**
+         * <p>If this Panel is configured {@link #draggable}, this property will contain
+         * an instance of {@link Ext.dd.DragSource} which handles dragging the Panel.</p>
+         * The developer must provide implementations of the abstract methods of {@link Ext.dd.DragSource}
+         * in order to supply behaviour for each stage of the drag/drop process. See {@link #draggable}.
+         * @type Ext.dd.DragSource.
+         * @property dd
+         */
+        this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);
+    },
+
+    // private
+    beforeEffect : function(){
+        if(this.floating){
+            this.el.beforeAction();
+        }
+        this.el.addClass('x-panel-animated');
+    },
+
+    // private
+    afterEffect : function(){
+        this.syncShadow();
+        this.el.removeClass('x-panel-animated');
+    },
+
+    // private - wraps up an animation param with internal callbacks
+    createEffect : function(a, cb, scope){
+        var o = {
+            scope:scope,
+            block:true
+        };
+        if(a === true){
+            o.callback = cb;
+            return o;
+        }else if(!a.callback){
+            o.callback = cb;
+        }else { // wrap it up
+            o.callback = function(){
+                cb.call(scope);
+                Ext.callback(a.callback, a.scope);
+            };
+        }
+        return Ext.applyIf(o, a);
+    },
+
+    /**
+     * Collapses the panel body so that it becomes hidden.  Fires the {@link #beforecollapse} event which will
+     * cancel the collapse action if it returns false.
+     * @param {Boolean} animate True to animate the transition, else false (defaults to the value of the
+     * {@link #animCollapse} panel config)
+     * @return {Ext.Panel} this
+     */
+    collapse : function(animate){
+        if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){
+            return;
+        }
+        var doAnim = animate === true || (animate !== false && this.animCollapse);
+        this.beforeEffect();
+        this.onCollapse(doAnim, animate);
+        return this;
+    },
+
+    // private
+    onCollapse : function(doAnim, animArg){
+        if(doAnim){
+            this[this.collapseEl].slideOut(this.slideAnchor,
+                    Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),
+                        this.collapseDefaults));
+        }else{
+            this[this.collapseEl].hide();
+            this.afterCollapse();
+        }
+    },
+
+    // private
+    afterCollapse : function(){
+        this.collapsed = true;
+        this.el.addClass(this.collapsedCls);
+        this.afterEffect();
+        this.fireEvent('collapse', this);
+    },
+
+    /**
+     * Expands the panel body so that it becomes visible.  Fires the {@link #beforeexpand} event which will
+     * cancel the expand action if it returns false.
+     * @param {Boolean} animate True to animate the transition, else false (defaults to the value of the
+     * {@link #animCollapse} panel config)
+     * @return {Ext.Panel} this
+     */
+    expand : function(animate){
+        if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){
+            return;
+        }
+        var doAnim = animate === true || (animate !== false && this.animCollapse);
+        this.el.removeClass(this.collapsedCls);
+        this.beforeEffect();
+        this.onExpand(doAnim, animate);
+        return this;
+    },
+
+    // private
+    onExpand : function(doAnim, animArg){
+        if(doAnim){
+            this[this.collapseEl].slideIn(this.slideAnchor,
+                    Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),
+                        this.expandDefaults));
+        }else{
+            this[this.collapseEl].show();
+            this.afterExpand();
+        }
+    },
+
+    // private
+    afterExpand : function(){
+        this.collapsed = false;
+        this.afterEffect();
+        if(this.deferLayout !== undefined){
+            this.doLayout(true);
+        }
+        this.fireEvent('expand', this);
+    },
+
+    /**
+     * Shortcut for performing an {@link #expand} or {@link #collapse} based on the current state of the panel.
+     * @param {Boolean} animate True to animate the transition, else false (defaults to the value of the
+     * {@link #animCollapse} panel config)
+     * @return {Ext.Panel} this
+     */
+    toggleCollapse : function(animate){
+        this[this.collapsed ? 'expand' : 'collapse'](animate);
+        return this;
+    },
+
+    // private
+    onDisable : function(){
+        if(this.rendered && this.maskDisabled){
+            this.el.mask();
+        }
+        Ext.Panel.superclass.onDisable.call(this);
+    },
+
+    // private
+    onEnable : function(){
+        if(this.rendered && this.maskDisabled){
+            this.el.unmask();
+        }
+        Ext.Panel.superclass.onEnable.call(this);
+    },
+
+    // private
+    onResize : function(w, h){
+        if(w !== undefined || h !== undefined){
+            if(!this.collapsed){
+                if(typeof w == 'number'){
+                    w = this.adjustBodyWidth(w - this.getFrameWidth());
+                    if(this.tbar){
+                        this.tbar.setWidth(w);
+                        if(this.topToolbar){
+                            this.topToolbar.setSize(w);
+                        }
+                    }
+                    if(this.bbar){
+                        this.bbar.setWidth(w);
+                        if(this.bottomToolbar){
+                            this.bottomToolbar.setSize(w);
+                        }
+                    }
+                    if(this.fbar){
+                        var f = this.fbar,
+                            fWidth = 1,
+                            strict = Ext.isStrict;
+                        if(this.buttonAlign == 'left'){
+                           fWidth = w - f.container.getFrameWidth('lr');
+                        }else{
+                            //center/right alignment off in webkit
+                            if(Ext.isIE || Ext.isWebKit){
+                                //center alignment ok on webkit.
+                                //right broken in both, center on IE
+                                if(!(this.buttonAlign == 'center' && Ext.isWebKit) && (!strict || (!Ext.isIE8 && strict))){
+                                    (function(){
+                                        f.setWidth(f.getEl().child('.x-toolbar-ct').getWidth());
+                                    }).defer(1);
+                                }else{
+                                    fWidth = 'auto';
+                                }
+                            }else{
+                                fWidth = 'auto';
+                            }
+                        }
+                        f.setWidth(fWidth);
+                    }
+                    this.body.setWidth(w);
+                }else if(w == 'auto'){
+                    this.body.setWidth(w);
+                }
+
+                if(typeof h == 'number'){
+                    h = Math.max(0, this.adjustBodyHeight(h - this.getFrameHeight()));
+                    this.body.setHeight(h);
+                }else if(h == 'auto'){
+                    this.body.setHeight(h);
+                }
+
+                if(this.disabled && this.el._mask){
+                    this.el._mask.setSize(this.el.dom.clientWidth, this.el.getHeight());
+                }
+            }else{
+                this.queuedBodySize = {width: w, height: h};
+                if(!this.queuedExpand && this.allowQueuedExpand !== false){
+                    this.queuedExpand = true;
+                    this.on('expand', function(){
+                        delete this.queuedExpand;
+                        this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);
+                        this.doLayout();
+                    }, this, {single:true});
+                }
+            }
+            this.fireEvent('bodyresize', this, w, h);
+        }
+        this.syncShadow();
+    },
+
+    // private
+    adjustBodyHeight : function(h){
+        return h;
+    },
+
+    // private
+    adjustBodyWidth : function(w){
+        return w;
+    },
+
+    // private
+    onPosition : function(){
+        this.syncShadow();
+    },
+
+    /**
+     * Returns the width in pixels of the framing elements of this panel (not including the body width).  To
+     * retrieve the body width see {@link #getInnerWidth}.
+     * @return {Number} The frame width
+     */
+    getFrameWidth : function(){
+        var w = this.el.getFrameWidth('lr')+this.bwrap.getFrameWidth('lr');
+
+        if(this.frame){
+            var l = this.bwrap.dom.firstChild;
+            w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));
+            var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
+            w += Ext.fly(mc).getFrameWidth('lr');
+        }
+        return w;
+    },
+
+    /**
+     * Returns the height in pixels of the framing elements of this panel (including any top and bottom bars and
+     * header and footer elements, but not including the body height).  To retrieve the body height see {@link #getInnerHeight}.
+     * @return {Number} The frame height
+     */
+    getFrameHeight : function(){
+        var h  = this.el.getFrameWidth('tb')+this.bwrap.getFrameWidth('tb');
+        h += (this.tbar ? this.tbar.getHeight() : 0) +
+             (this.bbar ? this.bbar.getHeight() : 0);
+
+        if(this.frame){
+            var hd = this.el.dom.firstChild;
+            var ft = this.bwrap.dom.lastChild;
+            h += (hd.offsetHeight + ft.offsetHeight);
+            var mc = this.bwrap.dom.firstChild.firstChild.firstChild;
+            h += Ext.fly(mc).getFrameWidth('tb');
+        }else{
+            h += (this.header ? this.header.getHeight() : 0) +
+                (this.footer ? this.footer.getHeight() : 0);
+        }
+        return h;
+    },
+
+    /**
+     * Returns the width in pixels of the body element (not including the width of any framing elements).
+     * For the frame width see {@link #getFrameWidth}.
+     * @return {Number} The body width
+     */
+    getInnerWidth : function(){
+        return this.getSize().width - this.getFrameWidth();
+    },
+
+    /**
+     * Returns the height in pixels of the body element (not including the height of any framing elements).
+     * For the frame height see {@link #getFrameHeight}.
+     * @return {Number} The body height
+     */
+    getInnerHeight : function(){
+        return this.getSize().height - this.getFrameHeight();
+    },
+
+    // private
+    syncShadow : function(){
+        if(this.floating){
+            this.el.sync(true);
+        }
+    },
+
+    // private
+    getLayoutTarget : function(){
+        return this.body;
+    },
+
+    /**
+     * <p>Sets the title text for the panel and optionally the {@link #iconCls icon class}.</p>
+     * <p>In order to be able to set the title, a header element must have been created
+     * for the Panel. This is triggered either by configuring the Panel with a non-blank <tt>{@link #title}</tt>,
+     * or configuring it with <tt><b>{@link #header}: true</b></tt>.</p>
+     * @param {String} title The title text to set
+     * @param {String} iconCls (optional) {@link #iconCls iconCls} A user-defined CSS class that provides the icon image for this panel
+     */
+    setTitle : function(title, iconCls){
+        this.title = title;
+        if(this.header && this.headerAsText){
+            this.header.child('span').update(title);
+        }
+        if(iconCls){
+            this.setIconClass(iconCls);
+        }
+        this.fireEvent('titlechange', this, title);
+        return this;
+    },
+
+    /**
+     * Get the {@link Ext.Updater} for this panel. Enables you to perform Ajax updates of this panel's body.
+     * @return {Ext.Updater} The Updater
+     */
+    getUpdater : function(){
+        return this.body.getUpdater();
+    },
+
+     /**
+     * Loads this content panel immediately with content returned from an XHR call.
+     * @param {Object/String/Function} config A config object containing any of the following options:
+<pre><code>
+panel.load({
+    url: "your-url.php",
+    params: {param1: "foo", param2: "bar"}, // or a URL encoded string
+    callback: yourFunction,
+    scope: yourObject, // optional scope for the callback
+    discardUrl: false,
+    nocache: false,
+    text: "Loading...",
+    timeout: 30,
+    scripts: false
+});
+</code></pre>
+     * The only required property is url. The optional properties nocache, text and scripts
+     * are shorthand for disableCaching, indicatorText and loadScripts and are used to set their
+     * associated property on this panel Updater instance.
+     * @return {Ext.Panel} this
+     */
+    load : function(){
+        var um = this.body.getUpdater();
+        um.update.apply(um, arguments);
+        return this;
+    },
+
+    // private
+    beforeDestroy : function(){
+        if(this.header){
+            this.header.removeAllListeners();
+            if(this.headerAsText){
+                Ext.Element.uncache(this.header.child('span'));
+            }
+        }
+        Ext.Element.uncache(
+            this.header,
+            this.tbar,
+            this.bbar,
+            this.footer,
+            this.body,
+            this.bwrap
+        );
+        if(this.tools){
+            for(var k in this.tools){
+                Ext.destroy(this.tools[k]);
+            }
+        }
+        if(this.buttons){
+            for(var b in this.buttons){
+                Ext.destroy(this.buttons[b]);
+            }
+        }
+        Ext.destroy(this.toolbars);
+        Ext.Panel.superclass.beforeDestroy.call(this);
+    },
+
+    // private
+    createClasses : function(){
+        this.headerCls = this.baseCls + '-header';
+        this.headerTextCls = this.baseCls + '-header-text';
+        this.bwrapCls = this.baseCls + '-bwrap';
+        this.tbarCls = this.baseCls + '-tbar';
+        this.bodyCls = this.baseCls + '-body';
+        this.bbarCls = this.baseCls + '-bbar';
+        this.footerCls = this.baseCls + '-footer';
+    },
+
+    // private
+    createGhost : function(cls, useShim, appendTo){
+        var el = document.createElement('div');
+        el.className = 'x-panel-ghost ' + (cls ? cls : '');
+        if(this.header){
+            el.appendChild(this.el.dom.firstChild.cloneNode(true));
+        }
+        Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());
+        el.style.width = this.el.dom.offsetWidth + 'px';;
+        if(!appendTo){
+            this.container.dom.appendChild(el);
+        }else{
+            Ext.getDom(appendTo).appendChild(el);
+        }
+        if(useShim !== false && this.el.useShim !== false){
+            var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);
+            layer.show();
+            return layer;
+        }else{
+            return new Ext.Element(el);
+        }
+    },
+
+    // private
+    doAutoLoad : function(){
+        var u = this.body.getUpdater();
+        if(this.renderer){
+            u.setRenderer(this.renderer);
+        }
+        u.update(Ext.isObject(this.autoLoad) ? this.autoLoad : {url: this.autoLoad});
+    },
+
+    /**
+     * Retrieve a tool by id.
+     * @param {String} id
+     * @return {Object} tool
+     */
+    getTool : function(id) {
+        return this.tools[id];
+    }
+
+/**
+ * @cfg {String} autoEl @hide
+ */
+});
+Ext.reg('panel', Ext.Panel);
+/**
+ * @class Ext.Editor
+ * @extends Ext.Component
+ * A base editor field that handles displaying/hiding on demand and has some built-in sizing and event handling logic.
+ * @constructor
+ * Create a new Editor
+ * @param {Object} config The config object
+ * @xtype editor
+ */
+Ext.Editor = function(field, config){
+    if(field.field){
+        this.field = Ext.create(field.field, 'textfield');
+        config = Ext.apply({}, field); // copy so we don't disturb original config
+        delete config.field;
+    }else{
+        this.field = field;
+    }
+    Ext.Editor.superclass.constructor.call(this, config);
+};
+
+Ext.extend(Ext.Editor, Ext.Component, {
+    /**
+    * @cfg {Ext.form.Field} field
+    * The Field object (or descendant) or config object for field
+    */
+    /**
+     * @cfg {Boolean} allowBlur
+     * True to {@link #completeEdit complete the editing process} if in edit mode when the
+     * field is blurred. Defaults to <tt>false</tt>.
+     */
+    /**
+     * @cfg {Boolean/String} autoSize
+     * True for the editor to automatically adopt the size of the element being edited, "width" to adopt the width only,
+     * or "height" to adopt the height only (defaults to false)
+     */
+    /**
+     * @cfg {Boolean} revertInvalid
+     * True to automatically revert the field value and cancel the edit when the user completes an edit and the field
+     * validation fails (defaults to true)
+     */
+    /**
+     * @cfg {Boolean} ignoreNoChange
+     * True to skip the edit completion process (no save, no events fired) if the user completes an edit and
+     * the value has not changed (defaults to false).  Applies only to string values - edits for other data types
+     * will never be ignored.
+     */
+    /**
+     * @cfg {Boolean} hideEl
+     * False to keep the bound element visible while the editor is displayed (defaults to true)
+     */
+    /**
+     * @cfg {Mixed} value
+     * The data value of the underlying field (defaults to "")
+     */
+    value : "",
+    /**
+     * @cfg {String} alignment
+     * The position to align to (see {@link Ext.Element#alignTo} for more details, defaults to "c-c?").
+     */
+    alignment: "c-c?",
+    /**
+     * @cfg {Boolean/String} shadow "sides" for sides/bottom only, "frame" for 4-way shadow, and "drop"
+     * for bottom-right shadow (defaults to "frame")
+     */
+    shadow : "frame",
+    /**
+     * @cfg {Boolean} constrain True to constrain the editor to the viewport
+     */
+    constrain : false,
+    /**
+     * @cfg {Boolean} swallowKeys Handle the keydown/keypress events so they don't propagate (defaults to true)
+     */
+    swallowKeys : true,
+    /**
+     * @cfg {Boolean} completeOnEnter True to complete the edit when the enter key is pressed (defaults to false)
+     */
+    completeOnEnter : false,
+    /**
+     * @cfg {Boolean} cancelOnEsc True to cancel the edit when the escape key is pressed (defaults to false)
+     */
+    cancelOnEsc : false,
+    /**
+     * @cfg {Boolean} updateEl True to update the innerHTML of the bound element when the update completes (defaults to false)
+     */
+    updateEl : false,
+
+    initComponent : function(){
+        Ext.Editor.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event beforestartedit
+             * Fires when editing is initiated, but before the value changes.  Editing can be canceled by returning
+             * false from the handler of this event.
+             * @param {Editor} this
+             * @param {Ext.Element} boundEl The underlying element bound to this editor
+             * @param {Mixed} value The field value being set
+             */
+            "beforestartedit",
+            /**
+             * @event startedit
+             * Fires when this editor is displayed
+             * @param {Ext.Element} boundEl The underlying element bound to this editor
+             * @param {Mixed} value The starting field value
+             */
+            "startedit",
+            /**
+             * @event beforecomplete
+             * Fires after a change has been made to the field, but before the change is reflected in the underlying
+             * field.  Saving the change to the field can be canceled by returning false from the handler of this event.
+             * Note that if the value has not changed and ignoreNoChange = true, the editing will still end but this
+             * event will not fire since no edit actually occurred.
+             * @param {Editor} this
+             * @param {Mixed} value The current field value
+             * @param {Mixed} startValue The original field value
+             */
+            "beforecomplete",
+            /**
+             * @event complete
+             * Fires after editing is complete and any changed value has been written to the underlying field.
+             * @param {Editor} this
+             * @param {Mixed} value The current field value
+             * @param {Mixed} startValue The original field value
+             */
+            "complete",
+            /**
+             * @event canceledit
+             * Fires after editing has been canceled and the editor's value has been reset.
+             * @param {Editor} this
+             * @param {Mixed} value The user-entered field value that was discarded
+             * @param {Mixed} startValue The original field value that was set back into the editor after cancel
+             */
+            "canceledit",
+            /**
+             * @event specialkey
+             * Fires when any key related to navigation (arrows, tab, enter, esc, etc.) is pressed.  You can check
+             * {@link Ext.EventObject#getKey} to determine which key was pressed.
+             * @param {Ext.form.Field} this
+             * @param {Ext.EventObject} e The event object
+             */
+            "specialkey"
+        );
+    },
+
+    // private
+    onRender : function(ct, position){
+        this.el = new Ext.Layer({
+            shadow: this.shadow,
+            cls: "x-editor",
+            parentEl : ct,
+            shim : this.shim,
+            shadowOffset: this.shadowOffset || 4,
+            id: this.id,
+            constrain: this.constrain
+        });
+        if(this.zIndex){
+            this.el.setZIndex(this.zIndex);
+        }
+        this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");
+        if(this.field.msgTarget != 'title'){
+            this.field.msgTarget = 'qtip';
+        }
+        this.field.inEditor = true;
+        this.field.render(this.el);
+        if(Ext.isGecko){
+            this.field.el.dom.setAttribute('autocomplete', 'off');
+        }
+        this.mon(this.field, "specialkey", this.onSpecialKey, this);
+        if(this.swallowKeys){
+            this.field.el.swallowEvent(['keydown','keypress']);
+        }
+        this.field.show();
+        this.mon(this.field, "blur", this.onBlur, this);
+        if(this.field.grow){
+               this.mon(this.field, "autosize", this.el.sync,  this.el, {delay:1});
+        }
+    },
+
+    // private
+    onSpecialKey : function(field, e){
+        var key = e.getKey();
+        if(this.completeOnEnter && key == e.ENTER){
+            e.stopEvent();
+            this.completeEdit();
+        }else if(this.cancelOnEsc && key == e.ESC){
+            this.cancelEdit();
+        }else{
+            this.fireEvent('specialkey', field, e);
+        }
+        if(this.field.triggerBlur && (key == e.ENTER || key == e.ESC || key == e.TAB)){
+            this.field.triggerBlur();
+        }
+    },
+
+    /**
+     * Starts the editing process and shows the editor.
+     * @param {Mixed} el The element to edit
+     * @param {String} value (optional) A value to initialize the editor with. If a value is not provided, it defaults
+      * to the innerHTML of el.
+     */
+    startEdit : function(el, value){
+        if(this.editing){
+            this.completeEdit();
+        }
+        this.boundEl = Ext.get(el);
+        var v = value !== undefined ? value : this.boundEl.dom.innerHTML;
+        if(!this.rendered){
+            this.render(this.parentEl || document.body);
+        }
+        if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){
+            return;
+        }
+        this.startValue = v;
+        this.field.setValue(v);
+        this.doAutoSize();
+        this.el.alignTo(this.boundEl, this.alignment);
+        this.editing = true;
+        this.show();
+    },
+
+    // private
+    doAutoSize : function(){
+        if(this.autoSize){
+            var sz = this.boundEl.getSize();
+            switch(this.autoSize){
+                case "width":
+                    this.setSize(sz.width,  "");
+                break;
+                case "height":
+                    this.setSize("",  sz.height);
+                break;
+                default:
+                    this.setSize(sz.width,  sz.height);
+            }
+        }
+    },
+
+    /**
+     * Sets the height and width of this editor.
+     * @param {Number} width The new width
+     * @param {Number} height The new height
+     */
+    setSize : function(w, h){
+        delete this.field.lastSize;
+        this.field.setSize(w, h);
+        if(this.el){
+            if(Ext.isGecko2 || Ext.isOpera){
+                // prevent layer scrollbars
+                this.el.setSize(w, h);
+            }
+            this.el.sync();
+        }
+    },
+
+    /**
+     * Realigns the editor to the bound field based on the current alignment config value.
+     */
+    realign : function(){
+        this.el.alignTo(this.boundEl, this.alignment);
+    },
+
+    /**
+     * Ends the editing process, persists the changed value to the underlying field, and hides the editor.
+     * @param {Boolean} remainVisible Override the default behavior and keep the editor visible after edit (defaults to false)
+     */
+    completeEdit : function(remainVisible){
+        if(!this.editing){
+            return;
+        }
+        var v = this.getValue();
+        if(!this.field.isValid()){
+            if(this.revertInvalid !== false){
+                this.cancelEdit(remainVisible);
+            }
+            return;
+        }
+        if(String(v) === String(this.startValue) && this.ignoreNoChange){
+            this.hideEdit(remainVisible);
+            return;
+        }
+        if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){
+            v = this.getValue();
+            if(this.updateEl && this.boundEl){
+                this.boundEl.update(v);
+            }
+            this.hideEdit(remainVisible);
+            this.fireEvent("complete", this, v, this.startValue);
+        }
+    },
+
+    // private
+    onShow : function(){
+        this.el.show();
+        if(this.hideEl !== false){
+            this.boundEl.hide();
+        }
+        this.field.show();
+        if(Ext.isIE && !this.fixIEFocus){ // IE has problems with focusing the first time
+            this.fixIEFocus = true;
+            this.deferredFocus.defer(50, this);
+        }else{
+            this.field.focus();
+        }
+        this.fireEvent("startedit", this.boundEl, this.startValue);
+    },
+
+    deferredFocus : function(){
+        if(this.editing){
+            this.field.focus();
+        }
+    },
+
+    /**
+     * Cancels the editing process and hides the editor without persisting any changes.  The field value will be
+     * reverted to the original starting value.
+     * @param {Boolean} remainVisible Override the default behavior and keep the editor visible after
+     * cancel (defaults to false)
+     */
+    cancelEdit : function(remainVisible){
+        if(this.editing){
+            var v = this.getValue();
+            this.setValue(this.startValue);
+            this.hideEdit(remainVisible);
+            this.fireEvent("canceledit", this, v, this.startValue);
+        }
+    },
+    
+    // private
+    hideEdit: function(remainVisible){
+        if(remainVisible !== true){
+            this.editing = false;
+            this.hide();
+        }
+    },
+
+    // private
+    onBlur : function(){
+        if(this.allowBlur !== true && this.editing){
+            this.completeEdit();
+        }
+    },
+
+    // private
+    onHide : function(){
+        if(this.editing){
+            this.completeEdit();
+            return;
+        }
+        this.field.blur();
+        if(this.field.collapse){
+            this.field.collapse();
+        }
+        this.el.hide();
+        if(this.hideEl !== false){
+            this.boundEl.show();
+        }
+    },
+
+    /**
+     * Sets the data value of the editor
+     * @param {Mixed} value Any valid value supported by the underlying field
+     */
+    setValue : function(v){
+        this.field.setValue(v);
+    },
+
+    /**
+     * Gets the data value of the editor
+     * @return {Mixed} The data value
+     */
+    getValue : function(){
+        return this.field.getValue();
+    },
+
+    beforeDestroy : function(){
+        Ext.destroy(this.field);
+        this.field = null;
+    }
+});
+Ext.reg('editor', Ext.Editor);/**
+ * @class Ext.ColorPalette
+ * @extends Ext.Component
+ * Simple color palette class for choosing colors.  The palette can be rendered to any container.<br />
+ * Here's an example of typical usage:
+ * <pre><code>
+var cp = new Ext.ColorPalette({value:'993300'});  // initial selected color
+cp.render('my-div');
+
+cp.on('select', function(palette, selColor){
+    // do something with selColor
+});
+</code></pre>
+ * @constructor
+ * Create a new ColorPalette
+ * @param {Object} config The config object
+ * @xtype colorpalette
+ */
+Ext.ColorPalette = function(config){
+    Ext.ColorPalette.superclass.constructor.call(this, config);
+    this.addEvents(
+        /**
+            * @event select
+            * Fires when a color is selected
+            * @param {ColorPalette} this
+            * @param {String} color The 6-digit color hex code (without the # symbol)
+            */
+        'select'
+    );
+
+    if(this.handler){
+        this.on("select", this.handler, this.scope, true);
+    }
+};
+Ext.extend(Ext.ColorPalette, Ext.Component, {
+       /**
+        * @cfg {String} tpl An existing XTemplate instance to be used in place of the default template for rendering the component.
+        */
+    /**
+     * @cfg {String} itemCls
+     * The CSS class to apply to the containing element (defaults to "x-color-palette")
+     */
+    itemCls : "x-color-palette",
+    /**
+     * @cfg {String} value
+     * The initial color to highlight (should be a valid 6-digit color hex code without the # symbol).  Note that
+     * the hex codes are case-sensitive.
+     */
+    value : null,
+    clickEvent:'click',
+    // private
+    ctype: "Ext.ColorPalette",
+
+    /**
+     * @cfg {Boolean} allowReselect If set to true then reselecting a color that is already selected fires the {@link #select} event
+     */
+    allowReselect : false,
+
+    /**
+     * <p>An array of 6-digit color hex code strings (without the # symbol).  This array can contain any number
+     * of colors, and each hex code should be unique.  The width of the palette is controlled via CSS by adjusting
+     * the width property of the 'x-color-palette' class (or assigning a custom class), so you can balance the number
+     * of colors with the width setting until the box is symmetrical.</p>
+     * <p>You can override individual colors if needed:</p>
+     * <pre><code>
+var cp = new Ext.ColorPalette();
+cp.colors[0] = "FF0000";  // change the first box to red
+</code></pre>
+
+Or you can provide a custom array of your own for complete control:
+<pre><code>
+var cp = new Ext.ColorPalette();
+cp.colors = ["000000", "993300", "333300"];
+</code></pre>
+     * @type Array
+     */
+    colors : [
+        "000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",
+        "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",
+        "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",
+        "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",
+        "FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"
+    ],
+
+    // private
+    onRender : function(container, position){
+        var t = this.tpl || new Ext.XTemplate(
+            '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>'
+        );
+        var el = document.createElement("div");
+        el.id = this.getId();
+        el.className = this.itemCls;
+        t.overwrite(el, this.colors);
+        container.dom.insertBefore(el, position);
+        this.el = Ext.get(el);
+        this.mon(this.el, this.clickEvent, this.handleClick, this, {delegate: 'a'});
+        if(this.clickEvent != 'click'){
+               this.mon(this.el, 'click', Ext.emptyFn, this, {delegate: 'a', preventDefault: true});
+        }
+    },
+
+    // private
+    afterRender : function(){
+        Ext.ColorPalette.superclass.afterRender.call(this);
+        if(this.value){
+            var s = this.value;
+            this.value = null;
+            this.select(s);
+        }
+    },
+
+    // private
+    handleClick : function(e, t){
+        e.preventDefault();
+        if(!this.disabled){
+            var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];
+            this.select(c.toUpperCase());
+        }
+    },
+
+    /**
+     * Selects the specified color in the palette (fires the {@link #select} event)
+     * @param {String} color A valid 6-digit color hex code (# will be stripped if included)
+     */
+    select : function(color){
+        color = color.replace("#", "");
+        if(color != this.value || this.allowReselect){
+            var el = this.el;
+            if(this.value){
+                el.child("a.color-"+this.value).removeClass("x-color-palette-sel");
+            }
+            el.child("a.color-"+color).addClass("x-color-palette-sel");
+            this.value = color;
+            this.fireEvent("select", this, color);
+        }
+    }
+
+    /**
+     * @cfg {String} autoEl @hide
+     */
+});
+Ext.reg('colorpalette', Ext.ColorPalette);/**\r
+ * @class Ext.DatePicker\r
+ * @extends Ext.Component\r
+ * Simple date picker class.\r
+ * @constructor\r
+ * Create a new DatePicker\r
+ * @param {Object} config The config object\r
+ * @xtype datepicker\r
+ */\r
+Ext.DatePicker = Ext.extend(Ext.BoxComponent, {\r
+    /**\r
+     * @cfg {String} todayText\r
+     * The text to display on the button that selects the current date (defaults to <tt>'Today'</tt>)\r
+     */\r
+    todayText : 'Today',\r
+    /**\r
+     * @cfg {String} okText\r
+     * The text to display on the ok button (defaults to <tt>'&#160;OK&#160;'</tt> to give the user extra clicking room)\r
+     */\r
+    okText : '&#160;OK&#160;',\r
+    /**\r
+     * @cfg {String} cancelText\r
+     * The text to display on the cancel button (defaults to <tt>'Cancel'</tt>)\r
+     */\r
+    cancelText : 'Cancel',\r
+    /**\r
+     * @cfg {String} todayTip\r
+     * The tooltip to display for the button that selects the current date (defaults to <tt>'{current date} (Spacebar)'</tt>)\r
+     */\r
+    todayTip : '{0} (Spacebar)',\r
+    /**\r
+     * @cfg {String} minText\r
+     * The error text to display if the minDate validation fails (defaults to <tt>'This date is before the minimum date'</tt>)\r
+     */\r
+    minText : 'This date is before the minimum date',\r
+    /**\r
+     * @cfg {String} maxText\r
+     * The error text to display if the maxDate validation fails (defaults to <tt>'This date is after the maximum date'</tt>)\r
+     */\r
+    maxText : 'This date is after the maximum date',\r
+    /**\r
+     * @cfg {String} format\r
+     * The default date format string which can be overriden for localization support.  The format must be\r
+     * valid according to {@link Date#parseDate} (defaults to <tt>'m/d/y'</tt>).\r
+     */\r
+    format : 'm/d/y',\r
+    /**\r
+     * @cfg {String} disabledDaysText\r
+     * The tooltip to display when the date falls on a disabled day (defaults to <tt>'Disabled'</tt>)\r
+     */\r
+    disabledDaysText : 'Disabled',\r
+    /**\r
+     * @cfg {String} disabledDatesText\r
+     * The tooltip text to display when the date falls on a disabled date (defaults to <tt>'Disabled'</tt>)\r
+     */\r
+    disabledDatesText : 'Disabled',\r
+    /**\r
+     * @cfg {Array} monthNames\r
+     * An array of textual month names which can be overriden for localization support (defaults to Date.monthNames)\r
+     */\r
+    monthNames : Date.monthNames,\r
+    /**\r
+     * @cfg {Array} dayNames\r
+     * An array of textual day names which can be overriden for localization support (defaults to Date.dayNames)\r
+     */\r
+    dayNames : Date.dayNames,\r
+    /**\r
+     * @cfg {String} nextText\r
+     * The next month navigation button tooltip (defaults to <tt>'Next Month (Control+Right)'</tt>)\r
+     */\r
+    nextText : 'Next Month (Control+Right)',\r
+    /**\r
+     * @cfg {String} prevText\r
+     * The previous month navigation button tooltip (defaults to <tt>'Previous Month (Control+Left)'</tt>)\r
+     */\r
+    prevText : 'Previous Month (Control+Left)',\r
+    /**\r
+     * @cfg {String} monthYearText\r
+     * The header month selector tooltip (defaults to <tt>'Choose a month (Control+Up/Down to move years)'</tt>)\r
+     */\r
+    monthYearText : 'Choose a month (Control+Up/Down to move years)',\r
+    /**\r
+     * @cfg {Number} startDay\r
+     * Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)\r
+     */\r
+    startDay : 0,\r
+    /**\r
+     * @cfg {Boolean} showToday\r
+     * False to hide the footer area containing the Today button and disable the keyboard handler for spacebar\r
+     * that selects the current date (defaults to <tt>true</tt>).\r
+     */\r
+    showToday : true,\r
+    /**\r
+     * @cfg {Date} minDate\r
+     * Minimum allowable date (JavaScript date object, defaults to null)\r
+     */\r
+    /**\r
+     * @cfg {Date} maxDate\r
+     * Maximum allowable date (JavaScript date object, defaults to null)\r
+     */\r
+    /**\r
+     * @cfg {Array} disabledDays\r
+     * An array of days to disable, 0-based. For example, [0, 6] disables Sunday and Saturday (defaults to null).\r
+     */\r
+    /**\r
+     * @cfg {RegExp} disabledDatesRE\r
+     * JavaScript regular expression used to disable a pattern of dates (defaults to null).  The {@link #disabledDates}\r
+     * config will generate this regex internally, but if you specify disabledDatesRE it will take precedence over the\r
+     * disabledDates value.\r
+     */\r
+    /**\r
+     * @cfg {Array} disabledDates\r
+     * An array of 'dates' to disable, as strings. These strings will be used to build a dynamic regular\r
+     * expression so they are very powerful. Some examples:\r
+     * <ul>\r
+     * <li>['03/08/2003', '09/16/2003'] would disable those exact dates</li>\r
+     * <li>['03/08', '09/16'] would disable those days for every year</li>\r
+     * <li>['^03/08'] would only match the beginning (useful if you are using short years)</li>\r
+     * <li>['03/../2006'] would disable every day in March 2006</li>\r
+     * <li>['^03'] would disable every day in every March</li>\r
+     * </ul>\r
+     * Note that the format of the dates included in the array should exactly match the {@link #format} config.\r
+     * In order to support regular expressions, if you are using a date format that has '.' in it, you will have to\r
+     * escape the dot when restricting dates. For example: ['03\\.08\\.03'].\r
+     */\r
 \r
-    \r
-    getDayOfYear : function() {\r
-        var num = 0;\r
-        Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;\r
-        for (var i = 0; i < this.getMonth(); ++i) {\r
-            num += Date.daysInMonth[i];\r
-        }\r
-        return num + this.getDate() - 1;\r
-    },\r
+    // private\r
+    initComponent : function(){\r
+        Ext.DatePicker.superclass.initComponent.call(this);\r
 \r
-    \r
-    getWeekOfYear : function() {\r
-        // adapted from http://www.merlyn.demon.co.uk/weekcalc.htm\r
-        var ms1d = 864e5, // milliseconds in a day\r
-            ms7d = 7 * ms1d; // milliseconds in a week\r
+        this.value = this.value ?\r
+                 this.value.clearTime() : new Date().clearTime();\r
 \r
-        return function() { // return a closure so constants get calculated only once\r
-            var DC3 = Date.UTC(this.getFullYear(), this.getMonth(), this.getDate() + 3) / ms1d, // an Absolute Day Number\r
-                AWN = Math.floor(DC3 / 7), // an Absolute Week Number\r
-                Wyr = new Date(AWN * ms7d).getUTCFullYear();\r
+        this.addEvents(\r
+            /**\r
+             * @event select\r
+             * Fires when a date is selected\r
+             * @param {DatePicker} this\r
+             * @param {Date} date The selected date\r
+             */\r
+            'select'\r
+        );\r
 \r
-            return AWN - Math.floor(Date.UTC(Wyr, 0, 7) / ms7d) + 1;\r
+        if(this.handler){\r
+            this.on('select', this.handler,  this.scope || this);\r
         }\r
-    }(),\r
 \r
-    \r
-    isLeapYear : function() {\r
-        var year = this.getFullYear();\r
-        return !!((year & 3) == 0 && (year % 100 || (year % 400 == 0 && year)));\r
+        this.initDisabledDays();\r
     },\r
 \r
-    \r
-    getFirstDayOfMonth : function() {\r
-        var day = (this.getDay() - (this.getDate() - 1)) % 7;\r
-        return (day < 0) ? (day + 7) : day;\r
+    // private\r
+    initDisabledDays : function(){\r
+        if(!this.disabledDatesRE && this.disabledDates){\r
+            var dd = this.disabledDates,\r
+                len = dd.length - 1,\r
+                re = '(?:';\r
+                \r
+            Ext.each(dd, function(d, i){\r
+                re += Ext.isDate(d) ? '^' + Ext.escapeRe(d.dateFormat(this.format)) + '$' : dd[i];\r
+                if(i != len){\r
+                    re += '|';\r
+                }\r
+            }, this);\r
+            this.disabledDatesRE = new RegExp(re + ')');\r
+        }\r
     },\r
 \r
-    \r
-    getLastDayOfMonth : function() {\r
-        var day = (this.getDay() + (Date.daysInMonth[this.getMonth()] - this.getDate())) % 7;\r
-        return (day < 0) ? (day + 7) : day;\r
+    /**\r
+     * Replaces any existing disabled dates with new values and refreshes the DatePicker.\r
+     * @param {Array/RegExp} disabledDates An array of date strings (see the {@link #disabledDates} config\r
+     * for details on supported values), or a JavaScript regular expression used to disable a pattern of dates.\r
+     */\r
+    setDisabledDates : function(dd){\r
+        if(Ext.isArray(dd)){\r
+            this.disabledDates = dd;\r
+            this.disabledDatesRE = null;\r
+        }else{\r
+            this.disabledDatesRE = dd;\r
+        }\r
+        this.initDisabledDays();\r
+        this.update(this.value, true);\r
     },\r
 \r
-\r
-    \r
-    getFirstDateOfMonth : function() {\r
-        return new Date(this.getFullYear(), this.getMonth(), 1);\r
+    /**\r
+     * Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.\r
+     * @param {Array} disabledDays An array of disabled day indexes. See the {@link #disabledDays} config\r
+     * for details on supported values.\r
+     */\r
+    setDisabledDays : function(dd){\r
+        this.disabledDays = dd;\r
+        this.update(this.value, true);\r
     },\r
 \r
-    \r
-    getLastDateOfMonth : function() {\r
-        return new Date(this.getFullYear(), this.getMonth(), this.getDaysInMonth());\r
+    /**\r
+     * Replaces any existing {@link #minDate} with the new value and refreshes the DatePicker.\r
+     * @param {Date} value The minimum date that can be selected\r
+     */\r
+    setMinDate : function(dt){\r
+        this.minDate = dt;\r
+        this.update(this.value, true);\r
     },\r
 \r
-    \r
-    getDaysInMonth : function() {\r
-        Date.daysInMonth[1] = this.isLeapYear() ? 29 : 28;\r
-        return Date.daysInMonth[this.getMonth()];\r
+    /**\r
+     * Replaces any existing {@link #maxDate} with the new value and refreshes the DatePicker.\r
+     * @param {Date} value The maximum date that can be selected\r
+     */\r
+    setMaxDate : function(dt){\r
+        this.maxDate = dt;\r
+        this.update(this.value, true);\r
     },\r
 \r
-    \r
-    getSuffix : function() {\r
-        switch (this.getDate()) {\r
-            case 1:\r
-            case 21:\r
-            case 31:\r
-                return "st";\r
-            case 2:\r
-            case 22:\r
-                return "nd";\r
-            case 3:\r
-            case 23:\r
-                return "rd";\r
-            default:\r
-                return "th";\r
+    /**\r
+     * Sets the value of the date field\r
+     * @param {Date} value The date to set\r
+     */\r
+    setValue : function(value){\r
+        var old = this.value;\r
+        this.value = value.clearTime(true);\r
+        if(this.el){\r
+            this.update(this.value);\r
         }\r
     },\r
 \r
-    \r
-    clone : function() {\r
-        return new Date(this.getTime());\r
+    /**\r
+     * Gets the current selected value of the date field\r
+     * @return {Date} The selected date\r
+     */\r
+    getValue : function(){\r
+        return this.value;\r
     },\r
 \r
-    \r
-    clearTime : function(clone){\r
-        if(clone){\r
-            return this.clone().clearTime();\r
-        }\r
-        this.setHours(0);\r
-        this.setMinutes(0);\r
-        this.setSeconds(0);\r
-        this.setMilliseconds(0);\r
-        return this;\r
-    },\r
-\r
-    \r
-    add : function(interval, value){\r
-        var d = this.clone();\r
-        if (!interval || value === 0) return d;\r
-\r
-        switch(interval.toLowerCase()){\r
-            case Date.MILLI:\r
-                d.setMilliseconds(this.getMilliseconds() + value);\r
-                break;\r
-            case Date.SECOND:\r
-                d.setSeconds(this.getSeconds() + value);\r
-                break;\r
-            case Date.MINUTE:\r
-                d.setMinutes(this.getMinutes() + value);\r
-                break;\r
-            case Date.HOUR:\r
-                d.setHours(this.getHours() + value);\r
-                break;\r
-            case Date.DAY:\r
-                d.setDate(this.getDate() + value);\r
-                break;\r
-            case Date.MONTH:\r
-                var day = this.getDate();\r
-                if(day > 28){\r
-                    day = Math.min(day, this.getFirstDateOfMonth().add('mo', value).getLastDateOfMonth().getDate());\r
-                }\r
-                d.setDate(day);\r
-                d.setMonth(this.getMonth() + value);\r
-                break;\r
-            case Date.YEAR:\r
-                d.setFullYear(this.getFullYear() + value);\r
-                break;\r
+    // private\r
+    focus : function(){\r
+        if(this.el){\r
+            this.update(this.activeDate);\r
         }\r
-        return d;\r
     },\r
-\r
-    \r
-    between : function(start, end){\r
-        var t = this.getTime();\r
-        return start.getTime() <= t && t <= end.getTime();\r
-    }\r
-});\r
-\r
-\r
-\r
-Date.prototype.format = Date.prototype.dateFormat;\r
-\r
-\r
-// private\r
-// safari setMonth is broken\r
-if(Ext.isSafari){\r
-    Date.brokenSetMonth = Date.prototype.setMonth;\r
-    Date.prototype.setMonth = function(num){\r
-        if(num <= -1){\r
-            var n = Math.ceil(-num);\r
-            var back_year = Math.ceil(n/12);\r
-            var month = (n % 12) ? 12 - n % 12 : 0 ;\r
-            this.setFullYear(this.getFullYear() - back_year);\r
-            return Date.brokenSetMonth.call(this, month);\r
-        } else {\r
-            return Date.brokenSetMonth.apply(this, arguments);\r
-        }\r
-    };\r
-}\r
-\r
-Ext.util.DelayedTask = function(fn, scope, args){\r
-    var id = null, d, t;\r
-\r
-    var call = function(){\r
-        var now = new Date().getTime();\r
-        if(now - t >= d){\r
-            clearInterval(id);\r
-            id = null;\r
-            fn.apply(scope, args || []);\r
-        }\r
-    };\r
     \r
-    this.delay = function(delay, newFn, newScope, newArgs){\r
-        if(id && delay != d){\r
-            this.cancel();\r
-        }\r
-        d = delay;\r
-        t = new Date().getTime();\r
-        fn = newFn || fn;\r
-        scope = newScope || scope;\r
-        args = newArgs || args;\r
-        if(!id){\r
-            id = setInterval(call, d);\r
+    // private\r
+    onEnable: function(initial){\r
+        Ext.DatePicker.superclass.onEnable.call(this);    \r
+        this.doDisabled(false);\r
+        this.update(initial ? this.value : this.activeDate);\r
+        if(Ext.isIE){\r
+            this.el.repaint();\r
         }\r
-    };\r
-\r
+        \r
+    },\r
     \r
-    this.cancel = function(){\r
-        if(id){\r
-            clearInterval(id);\r
-            id = null;\r
-        }\r
-    };\r
-};\r
-\r
-Ext.util.TaskRunner = function(interval){\r
-    interval = interval || 10;\r
-    var tasks = [], removeQueue = [];\r
-    var id = 0;\r
-    var running = false;\r
-\r
-    // private\r
-    var stopThread = function(){\r
-        running = false;\r
-        clearInterval(id);\r
-        id = 0;\r
-    };\r
-\r
     // private\r
-    var startThread = function(){\r
-        if(!running){\r
-            running = true;\r
-            id = setInterval(runTasks, interval);\r
+    onDisable: function(){\r
+        Ext.DatePicker.superclass.onDisable.call(this);   \r
+        this.doDisabled(true);\r
+        if(Ext.isIE && !Ext.isIE8){\r
+            /* Really strange problem in IE6/7, when disabled, have to explicitly\r
+             * repaint each of the nodes to get them to display correctly, simply\r
+             * calling repaint on the main element doesn't appear to be enough.\r
+             */\r
+             Ext.each([].concat(this.textNodes, this.el.query('th span')), function(el){\r
+                 Ext.fly(el).repaint();\r
+             });\r
         }\r
-    };\r
-\r
+    },\r
+    \r
     // private\r
-    var removeTask = function(t){\r
-        removeQueue.push(t);\r
-        if(t.onStop){\r
-            t.onStop.apply(t.scope || t);\r
+    doDisabled: function(disabled){\r
+        this.keyNav.setDisabled(disabled);\r
+        this.prevRepeater.setDisabled(disabled);\r
+        this.nextRepeater.setDisabled(disabled);\r
+        if(this.showToday){\r
+            this.todayKeyListener.setDisabled(disabled);\r
+            this.todayBtn.setDisabled(disabled);\r
         }\r
-    };\r
+    },\r
 \r
     // private\r
-    var runTasks = function(){\r
-        if(removeQueue.length > 0){\r
-            for(var i = 0, len = removeQueue.length; i < len; i++){\r
-                tasks.remove(removeQueue[i]);\r
-            }\r
-            removeQueue = [];\r
-            if(tasks.length < 1){\r
-                stopThread();\r
-                return;\r
+    onRender : function(container, position){\r
+        var m = [\r
+             '<table cellspacing="0">',\r
+                '<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'">&#160;</a></td></tr>',\r
+                '<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'],\r
+                dn = this.dayNames,\r
+                i;\r
+        for(i = 0; i < 7; i++){\r
+            var d = this.startDay+i;\r
+            if(d > 6){\r
+                d = d-7;\r
             }\r
+            m.push('<th><span>', dn[d].substr(0,1), '</span></th>');\r
         }\r
-        var now = new Date().getTime();\r
-        for(var i = 0, len = tasks.length; i < len; ++i){\r
-            var t = tasks[i];\r
-            var itime = now - t.taskRunTime;\r
-            if(t.interval <= itime){\r
-                var rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);\r
-                t.taskRunTime = now;\r
-                if(rt === false || t.taskRunCount === t.repeat){\r
-                    removeTask(t);\r
-                    return;\r
-                }\r
-            }\r
-            if(t.duration && t.duration <= (now - t.taskStartTime)){\r
-                removeTask(t);\r
+        m[m.length] = '</tr></thead><tbody><tr>';\r
+        for(i = 0; i < 42; i++) {\r
+            if(i % 7 === 0 && i !== 0){\r
+                m[m.length] = '</tr><tr>';\r
             }\r
+            m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';\r
         }\r
-    };\r
+        m.push('</tr></tbody></table></td></tr>',\r
+                this.showToday ? '<tr><td colspan="3" class="x-date-bottom" align="center"></td></tr>' : '',\r
+                '</table><div class="x-date-mp"></div>');\r
 \r
-    \r
-    this.start = function(task){\r
-        tasks.push(task);\r
-        task.taskStartTime = new Date().getTime();\r
-        task.taskRunTime = 0;\r
-        task.taskRunCount = 0;\r
-        startThread();\r
-        return task;\r
-    };\r
+        var el = document.createElement('div');\r
+        el.className = 'x-date-picker';\r
+        el.innerHTML = m.join('');\r
 \r
-    \r
-    this.stop = function(task){\r
-        removeTask(task);\r
-        return task;\r
-    };\r
+        container.dom.insertBefore(el, position);\r
 \r
-    \r
-    this.stopAll = function(){\r
-        stopThread();\r
-        for(var i = 0, len = tasks.length; i < len; i++){\r
-            if(tasks[i].onStop){\r
-                tasks[i].onStop();\r
-            }\r
-        }\r
-        tasks = [];\r
-        removeQueue = [];\r
-    };\r
-};\r
+        this.el = Ext.get(el);\r
+        this.eventEl = Ext.get(el.firstChild);\r
+\r
+        this.prevRepeater = new Ext.util.ClickRepeater(this.el.child('td.x-date-left a'), {\r
+            handler: this.showPrevMonth,\r
+            scope: this,\r
+            preventDefault:true,\r
+            stopDefault:true\r
+        });\r
 \r
+        this.nextRepeater = new Ext.util.ClickRepeater(this.el.child('td.x-date-right a'), {\r
+            handler: this.showNextMonth,\r
+            scope: this,\r
+            preventDefault:true,\r
+            stopDefault:true\r
+        });\r
 \r
-Ext.TaskMgr = new Ext.util.TaskRunner();\r
+        this.monthPicker = this.el.down('div.x-date-mp');\r
+        this.monthPicker.enableDisplayMode('block');\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
-        "clear",\r
-        \r
-        "add",\r
-        \r
-        "replace",\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
+        this.keyNav = new Ext.KeyNav(this.eventEl, {\r
+            'left' : function(e){\r
+                if(e.ctrlKey){\r
+                    this.showPrevMonth();\r
+                }else{\r
+                    this.update(this.activeDate.add('d', -1));    \r
+                }\r
+            },\r
 \r
-Ext.extend(Ext.util.MixedCollection, Ext.util.Observable, {\r
-    allowFunctions : false,\r
+            'right' : function(e){\r
+                if(e.ctrlKey){\r
+                    this.showNextMonth();\r
+                }else{\r
+                    this.update(this.activeDate.add('d', 1));    \r
+                }\r
+            },\r
 \r
+            'up' : function(e){\r
+                if(e.ctrlKey){\r
+                    this.showNextYear();\r
+                }else{\r
+                    this.update(this.activeDate.add('d', -7));\r
+                }\r
+            },\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
-            this.length++;\r
-            this.items.push(o);\r
-            this.keys.push(null);\r
-        }else{\r
-            var old = this.map[key];\r
-            if(old){\r
-                return this.replace(key, o);\r
-            }\r
-            this.length++;\r
-            this.items.push(o);\r
-            this.map[key] = o;\r
-            this.keys.push(key);\r
-        }\r
-        this.fireEvent("add", this.length-1, o, key);\r
-        return o;\r
-    },\r
+            'down' : function(e){\r
+                if(e.ctrlKey){\r
+                    this.showPrevYear();\r
+                }else{\r
+                    this.update(this.activeDate.add('d', 7));\r
+                }\r
+            },\r
 \r
+            'pageUp' : function(e){\r
+                this.showNextMonth();\r
+            },\r
 \r
-    getKey : function(o){\r
-         return o.id;\r
-    },\r
+            'pageDown' : function(e){\r
+                this.showPrevMonth();\r
+            },\r
 \r
+            'enter' : function(e){\r
+                e.stopPropagation();\r
+                return true;\r
+            },\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.item(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
+            scope : this\r
+        });\r
 \r
+        this.el.unselectable();\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
+        this.cells = this.el.select('table.x-date-inner tbody td');\r
+        this.textNodes = this.el.query('table.x-date-inner tbody span');\r
 \r
+        this.mbtn = new Ext.Button({\r
+            text: '&#160;',\r
+            tooltip: this.monthYearText,\r
+            renderTo: this.el.child('td.x-date-middle', true)\r
+        });\r
+        this.mbtn.el.child('em').addClass('x-btn-arrow');\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
+        if(this.showToday){\r
+            this.todayKeyListener = this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday,  this);\r
+            var today = (new Date()).dateFormat(this.format);\r
+            this.todayBtn = new Ext.Button({\r
+                renderTo: this.el.child('td.x-date-bottom', true),\r
+                text: String.format(this.todayText, today),\r
+                tooltip: String.format(this.todayTip, today),\r
+                handler: this.selectToday,\r
+                scope: this\r
+            });\r
         }\r
+        this.mon(this.eventEl, 'mousewheel', this.handleMouseWheel, this);\r
+        this.mon(this.eventEl, 'click', this.handleDateClick,  this, {delegate: 'a.x-date-date'});\r
+        this.mon(this.mbtn, 'click', this.showMonthPicker, this);\r
+        this.onEnable(true);\r
     },\r
 \r
+    // private\r
+    createMonthPicker : function(){\r
+        if(!this.monthPicker.dom.firstChild){\r
+            var buf = ['<table border="0" cellspacing="0">'];\r
+            for(var i = 0; i < 6; i++){\r
+                buf.push(\r
+                    '<tr><td class="x-date-mp-month"><a href="#">', Date.getShortMonthName(i), '</a></td>',\r
+                    '<td class="x-date-mp-month x-date-mp-sep"><a href="#">', Date.getShortMonthName(i + 6), '</a></td>',\r
+                    i === 0 ?\r
+                    '<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' :\r
+                    '<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>'\r
+                );\r
+            }\r
+            buf.push(\r
+                '<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',\r
+                    this.okText,\r
+                    '</button><button type="button" class="x-date-mp-cancel">',\r
+                    this.cancelText,\r
+                    '</button></td></tr>',\r
+                '</table>'\r
+            );\r
+            this.monthPicker.update(buf.join(''));\r
+\r
+            this.mon(this.monthPicker, 'click', this.onMonthClick, this);\r
+            this.mon(this.monthPicker, 'dblclick', this.onMonthDblClick, this);\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
+            this.mpMonths = this.monthPicker.select('td.x-date-mp-month');\r
+            this.mpYears = this.monthPicker.select('td.x-date-mp-year');\r
+\r
+            this.mpMonths.each(function(m, a, i){\r
+                i += 1;\r
+                if((i%2) === 0){\r
+                    m.dom.xmonth = 5 + Math.round(i * 0.5);\r
+                }else{\r
+                    m.dom.xmonth = Math.round((i-1) * 0.5);\r
+                }\r
+            });\r
         }\r
     },\r
 \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
+    // private\r
+    showMonthPicker : function(){\r
+        if(!this.disabled){\r
+            this.createMonthPicker();\r
+            var size = this.el.getSize();\r
+            this.monthPicker.setSize(size);\r
+            this.monthPicker.child('table').setSize(size);\r
+\r
+            this.mpSelMonth = (this.activeDate || this.value).getMonth();\r
+            this.updateMPMonth(this.mpSelMonth);\r
+            this.mpSelYear = (this.activeDate || this.value).getFullYear();\r
+            this.updateMPYear(this.mpSelYear);\r
+\r
+            this.monthPicker.slideIn('t', {duration:0.2});\r
         }\r
-        return null;\r
     },\r
 \r
-\r
-    insert : function(index, key, o){\r
-        if(arguments.length == 2){\r
-            o = arguments[1];\r
-            key = this.getKey(o);\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 : function(o){\r
-        return this.removeAt(this.indexOf(o));\r
-    },\r
-\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
+    // private\r
+    updateMPYear : function(y){\r
+        this.mpyear = y;\r
+        var ys = this.mpYears.elements;\r
+        for(var i = 1; i <= 10; i++){\r
+            var td = ys[i-1], y2;\r
+            if((i%2) === 0){\r
+                y2 = y + Math.round(i * 0.5);\r
+                td.firstChild.innerHTML = y2;\r
+                td.xyear = y2;\r
+            }else{\r
+                y2 = y - (5-Math.round(i * 0.5));\r
+                td.firstChild.innerHTML = y2;\r
+                td.xyear = y2;\r
             }\r
-            this.keys.splice(index, 1);\r
-            this.fireEvent("remove", o, key);\r
-            return o;\r
+            this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');\r
         }\r
-        return false;\r
-    },\r
-\r
-\r
-    removeKey : function(key){\r
-        return this.removeAt(this.indexOfKey(key));\r
-    },\r
-\r
-\r
-    getCount : function(){\r
-        return this.length;\r
-    },\r
-\r
-\r
-    indexOf : function(o){\r
-        return this.items.indexOf(o);\r
     },\r
 \r
-\r
-    indexOfKey : function(key){\r
-        return this.keys.indexOf(key);\r
+    // private\r
+    updateMPMonth : function(sm){\r
+        this.mpMonths.each(function(m, a, i){\r
+            m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel');\r
+        });\r
     },\r
 \r
+    // private\r
+    selectMPMonth : function(m){\r
 \r
-    item : function(key){\r
-        var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key];\r
-        return typeof item != 'function' || this.allowFunctions ? item : null; // for prototype!\r
     },\r
 \r
-\r
-    itemAt : function(index){\r
-        return this.items[index];\r
+    // private\r
+    onMonthClick : function(e, t){\r
+        e.stopEvent();\r
+        var el = new Ext.Element(t), pn;\r
+        if(el.is('button.x-date-mp-cancel')){\r
+            this.hideMonthPicker();\r
+        }\r
+        else if(el.is('button.x-date-mp-ok')){\r
+            var d = new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate());\r
+            if(d.getMonth() != this.mpSelMonth){\r
+                // 'fix' the JS rolling date conversion if needed\r
+                d = new Date(this.mpSelYear, this.mpSelMonth, 1).getLastDateOfMonth();\r
+            }\r
+            this.update(d);\r
+            this.hideMonthPicker();\r
+        }\r
+        else if((pn = el.up('td.x-date-mp-month', 2))){\r
+            this.mpMonths.removeClass('x-date-mp-sel');\r
+            pn.addClass('x-date-mp-sel');\r
+            this.mpSelMonth = pn.dom.xmonth;\r
+        }\r
+        else if((pn = el.up('td.x-date-mp-year', 2))){\r
+            this.mpYears.removeClass('x-date-mp-sel');\r
+            pn.addClass('x-date-mp-sel');\r
+            this.mpSelYear = pn.dom.xyear;\r
+        }\r
+        else if(el.is('a.x-date-mp-prev')){\r
+            this.updateMPYear(this.mpyear-10);\r
+        }\r
+        else if(el.is('a.x-date-mp-next')){\r
+            this.updateMPYear(this.mpyear+10);\r
+        }\r
     },\r
 \r
-\r
-    key : function(key){\r
-        return this.map[key];\r
+    // private\r
+    onMonthDblClick : function(e, t){\r
+        e.stopEvent();\r
+        var el = new Ext.Element(t), pn;\r
+        if((pn = el.up('td.x-date-mp-month', 2))){\r
+            this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate()));\r
+            this.hideMonthPicker();\r
+        }\r
+        else if((pn = el.up('td.x-date-mp-year', 2))){\r
+            this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate()));\r
+            this.hideMonthPicker();\r
+        }\r
     },\r
 \r
-\r
-    contains : function(o){\r
-        return this.indexOf(o) != -1;\r
+    // private\r
+    hideMonthPicker : function(disableAnim){\r
+        if(this.monthPicker){\r
+            if(disableAnim === true){\r
+                this.monthPicker.hide();\r
+            }else{\r
+                this.monthPicker.slideOut('t', {duration:0.2});\r
+            }\r
+        }\r
     },\r
 \r
-\r
-    containsKey : function(key){\r
-        return typeof this.map[key] != "undefined";\r
+    // private\r
+    showPrevMonth : function(e){\r
+        this.update(this.activeDate.add('mo', -1));\r
     },\r
 \r
-\r
-    clear : function(){\r
-        this.length = 0;\r
-        this.items = [];\r
-        this.keys = [];\r
-        this.map = {};\r
-        this.fireEvent("clear");\r
+    // private\r
+    showNextMonth : function(e){\r
+        this.update(this.activeDate.add('mo', 1));\r
     },\r
 \r
-\r
-    first : function(){\r
-        return this.items[0];\r
+    // private\r
+    showPrevYear : function(){\r
+        this.update(this.activeDate.add('y', -1));\r
     },\r
 \r
-\r
-    last : function(){\r
-        return this.items[this.length-1];\r
+    // private\r
+    showNextYear : function(){\r
+        this.update(this.activeDate.add('y', 1));\r
     },\r
 \r
     // private\r
-    _sort : function(property, dir, fn){\r
-        var dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1;\r
-        fn = fn || function(a, b){\r
-            return a-b;\r
-        };\r
-        var c = [], k = this.keys, items = this.items;\r
-        for(var 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
+    handleMouseWheel : function(e){\r
+        e.stopEvent();\r
+        if(!this.disabled){\r
+            var delta = e.getWheelDelta();\r
+            if(delta > 0){\r
+                this.showPrevMonth();\r
+            } else if(delta < 0){\r
+                this.showNextMonth();\r
             }\r
-            return v;\r
-        });\r
-        for(var 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
-    sort : function(dir, fn){\r
-        this._sort("value", dir, fn);\r
+    // private\r
+    handleDateClick : function(e, t){\r
+        e.stopEvent();\r
+        if(!this.disabled && t.dateValue && !Ext.fly(t.parentNode).hasClass('x-date-disabled')){\r
+            this.setValue(new Date(t.dateValue));\r
+            this.fireEvent('select', this, this.value);\r
+        }\r
     },\r
 \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
+    // private\r
+    selectToday : function(){\r
+        if(this.todayBtn && !this.todayBtn.disabled){\r
+            this.setValue(new Date().clearTime());\r
+            this.fireEvent('select', this, this.value);\r
+        }\r
     },\r
 \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 r = [];\r
-        if(start <= end){\r
-            for(var i = start; i <= end; i++) {\r
-                   r[r.length] = items[i];\r
-            }\r
-        }else{\r
-            for(var i = start; i >= end; i--) {\r
-                   r[r.length] = items[i];\r
+    // private\r
+    update : function(date, forceRefresh){\r
+        var vd = this.activeDate, vis = this.isVisible();\r
+        this.activeDate = date;\r
+        if(!forceRefresh && vd && this.el){\r
+            var t = date.getTime();\r
+            if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){\r
+                this.cells.removeClass('x-date-selected');\r
+                this.cells.each(function(c){\r
+                   if(c.dom.firstChild.dateValue == t){\r
+                       c.addClass('x-date-selected');\r
+                       if(vis){\r
+                           Ext.fly(c.dom.firstChild).focus(50);\r
+                       }\r
+                       return false;\r
+                   }\r
+                });\r
+                return;\r
             }\r
         }\r
-        return r;\r
-    },\r
+        var days = date.getDaysInMonth();\r
+        var firstOfMonth = date.getFirstDateOfMonth();\r
+        var startingPos = firstOfMonth.getDay()-this.startDay;\r
 \r
-    \r
-    filter : function(property, value, anyMatch, caseSensitive){\r
-        if(Ext.isEmpty(value, false)){\r
-            return this.clone();\r
+        if(startingPos <= this.startDay){\r
+            startingPos += 7;\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
-    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
+        var pm = date.add('mo', -1);\r
+        var prevStart = pm.getDaysInMonth()-startingPos;\r
 \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
+        var cells = this.cells.elements;\r
+        var textEls = this.textNodes;\r
+        days += startingPos;\r
 \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
+        // convert everything to numbers so it's fast\r
+        var day = 86400000;\r
+        var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();\r
+        var today = new Date().clearTime().getTime();\r
+        var sel = date.clearTime().getTime();\r
+        var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;\r
+        var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;\r
+        var ddMatch = this.disabledDatesRE;\r
+        var ddText = this.disabledDatesText;\r
+        var ddays = this.disabledDays ? this.disabledDays.join('') : false;\r
+        var ddaysText = this.disabledDaysText;\r
+        var format = this.format;\r
+\r
+        if(this.showToday){\r
+            var td = new Date().clearTime();\r
+            var disable = (td < min || td > max ||\r
+                (ddMatch && format && ddMatch.test(td.dateFormat(format))) ||\r
+                (ddays && ddays.indexOf(td.getDay()) != -1));\r
+\r
+            if(!this.disabled){\r
+                this.todayBtn.setDisabled(disable);\r
+                this.todayKeyListener[disable ? 'disable' : 'enable']();\r
             }\r
         }\r
-        if(typeof start == 'number' && start > 0){\r
-            for(var i = 0; i < start; i++){\r
-                if(fn.call(scope||this, it[i], k[i])){\r
-                    return i;\r
+\r
+        var setCellClass = function(cal, cell){\r
+            cell.title = '';\r
+            var t = d.getTime();\r
+            cell.firstChild.dateValue = t;\r
+            if(t == today){\r
+                cell.className += ' x-date-today';\r
+                cell.title = cal.todayText;\r
+            }\r
+            if(t == sel){\r
+                cell.className += ' x-date-selected';\r
+                if(vis){\r
+                    Ext.fly(cell.firstChild).focus(50);\r
+                }\r
+            }\r
+            // disabling\r
+            if(t < min) {\r
+                cell.className = ' x-date-disabled';\r
+                cell.title = cal.minText;\r
+                return;\r
+            }\r
+            if(t > max) {\r
+                cell.className = ' x-date-disabled';\r
+                cell.title = cal.maxText;\r
+                return;\r
+            }\r
+            if(ddays){\r
+                if(ddays.indexOf(d.getDay()) != -1){\r
+                    cell.title = ddaysText;\r
+                    cell.className = ' x-date-disabled';\r
+                }\r
+            }\r
+            if(ddMatch && format){\r
+                var fvalue = d.dateFormat(format);\r
+                if(ddMatch.test(fvalue)){\r
+                    cell.title = ddText.replace('%0', fvalue);\r
+                    cell.className = ' x-date-disabled';\r
                 }\r
             }\r
+        };\r
+\r
+        var i = 0;\r
+        for(; i < startingPos; i++) {\r
+            textEls[i].innerHTML = (++prevStart);\r
+            d.setDate(d.getDate()+1);\r
+            cells[i].className = 'x-date-prevday';\r
+            setCellClass(this, cells[i]);\r
+        }\r
+        for(; i < days; i++){\r
+            var intDay = i - startingPos + 1;\r
+            textEls[i].innerHTML = (intDay);\r
+            d.setDate(d.getDate()+1);\r
+            cells[i].className = 'x-date-active';\r
+            setCellClass(this, cells[i]);\r
+        }\r
+        var extraDays = 0;\r
+        for(; i < 42; i++) {\r
+             textEls[i].innerHTML = (++extraDays);\r
+             d.setDate(d.getDate()+1);\r
+             cells[i].className = 'x-date-nextday';\r
+             setCellClass(this, cells[i]);\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
+        this.mbtn.setText(this.monthNames[date.getMonth()] + ' ' + date.getFullYear());\r
+\r
+        if(!this.internalRender){\r
+            var main = this.el.dom.firstChild;\r
+            var w = main.offsetWidth;\r
+            this.el.setWidth(w + this.el.getBorderWidth('lr'));\r
+            Ext.fly(main).setWidth(w);\r
+            this.internalRender = true;\r
+            // opera does not respect the auto grow header center column\r
+            // then, after it gets a width opera refuses to recalculate\r
+            // without a second pass\r
+            if(Ext.isOpera && !this.secondPass){\r
+                main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + 'px';\r
+                this.secondPass = true;\r
+                this.update.defer(10, this, [date]);\r
+            }\r
         }\r
-        return value;\r
     },\r
 \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
+    // private\r
+    beforeDestroy : function() {\r
+        if(this.rendered){\r
+            this.keyNav.disable();\r
+            this.keyNav = null;\r
+            Ext.destroy(\r
+                this.leftClickRpt,\r
+                this.rightClickRpt,\r
+                this.monthPicker,\r
+                this.eventEl,\r
+                this.mbtn,\r
+                this.todayBtn\r
+            );\r
         }\r
-        r.getKey = this.getKey;\r
-        return r;\r
     }\r
-});\r
 \r
-Ext.util.MixedCollection.prototype.get = Ext.util.MixedCollection.prototype.item;\r
-\r
-Ext.util.JSON = new (function(){\r
-    var useHasOwn = !!{}.hasOwnProperty;\r
+    /**\r
+     * @cfg {String} autoEl @hide\r
+     */\r
+});\r
 \r
-    // crashes Safari in some instances\r
-    //var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/;\r
+Ext.reg('datepicker', Ext.DatePicker);\r
+/**
+ * @class Ext.LoadMask
+ * A simple utility class for generically masking elements while loading data.  If the {@link #store}
+ * config option is specified, the masking will be automatically synchronized with the store's loading
+ * process and the mask element will be cached for reuse.  For all other elements, this mask will replace the
+ * element's Updater load indicator and will be destroyed after the initial load.
+ * <p>Example usage:</p>
+ *<pre><code>
+// Basic mask:
+var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
+myMask.show();
+</code></pre>
+ * @constructor
+ * Create a new LoadMask
+ * @param {Mixed} el The element or DOM node, or its id
+ * @param {Object} config The config object
+ */
+Ext.LoadMask = function(el, config){
+    this.el = Ext.get(el);
+    Ext.apply(this, config);
+    if(this.store){
+        this.store.on('beforeload', this.onBeforeLoad, this);
+        this.store.on('load', this.onLoad, this);
+        this.store.on('exception', this.onLoad, this);
+        this.removeMask = Ext.value(this.removeMask, false);
+    }else{
+        var um = this.el.getUpdater();
+        um.showLoadIndicator = false; // disable the default indicator
+        um.on('beforeupdate', this.onBeforeLoad, this);
+        um.on('update', this.onLoad, this);
+        um.on('failure', this.onLoad, this);
+        this.removeMask = Ext.value(this.removeMask, true);
+    }
+};
+
+Ext.LoadMask.prototype = {
+    /**
+     * @cfg {Ext.data.Store} store
+     * Optional Store to which the mask is bound. The mask is displayed when a load request is issued, and
+     * hidden on either load sucess, or load fail.
+     */
+    /**
+     * @cfg {Boolean} removeMask
+     * True to create a single-use mask that is automatically destroyed after loading (useful for page loads),
+     * False to persist the mask element reference for multiple uses (e.g., for paged data widgets).  Defaults to false.
+     */
+    /**
+     * @cfg {String} msg
+     * The text to display in a centered loading message box (defaults to 'Loading...')
+     */
+    msg : 'Loading...',
+    /**
+     * @cfg {String} msgCls
+     * The CSS class to apply to the loading message element (defaults to "x-mask-loading")
+     */
+    msgCls : 'x-mask-loading',
+
+    /**
+     * Read-only. True if the mask is currently disabled so that it will not be displayed (defaults to false)
+     * @type Boolean
+     */
+    disabled: false,
+
+    /**
+     * Disables the mask to prevent it from being displayed
+     */
+    disable : function(){
+       this.disabled = true;
+    },
+
+    /**
+     * Enables the mask so that it can be displayed
+     */
+    enable : function(){
+        this.disabled = false;
+    },
+
+    // private
+    onLoad : function(){
+        this.el.unmask(this.removeMask);
+    },
+
+    // private
+    onBeforeLoad : function(){
+        if(!this.disabled){
+            this.el.mask(this.msg, this.msgCls);
+        }
+    },
+
+    /**
+     * Show this LoadMask over the configured Element.
+     */
+    show: function(){
+        this.onBeforeLoad();
+    },
+
+    /**
+     * Hide this LoadMask.
+     */
+    hide: function(){
+        this.onLoad();
+    },
+
+    // private
+    destroy : function(){
+        if(this.store){
+            this.store.un('beforeload', this.onBeforeLoad, this);
+            this.store.un('load', this.onLoad, this);
+            this.store.un('exception', this.onLoad, this);
+        }else{
+            var um = this.el.getUpdater();
+            um.un('beforeupdate', this.onBeforeLoad, this);
+            um.un('update', this.onLoad, this);
+            um.un('failure', this.onLoad, this);
+        }
+    }
+};/**\r
+ * @class Ext.Slider\r
+ * @extends Ext.BoxComponent\r
+ * Slider which supports vertical or horizontal orientation, keyboard adjustments,\r
+ * configurable snapping, axis clicking and animation. Can be added as an item to\r
+ * any container. Example usage:\r
+<pre><code>\r
+new Ext.Slider({\r
+    renderTo: Ext.getBody(),\r
+    width: 200,\r
+    value: 50,\r
+    increment: 10,\r
+    minValue: 0,\r
+    maxValue: 100\r
+});\r
+</code></pre>\r
+ */\r
+Ext.Slider = Ext.extend(Ext.BoxComponent, {\r
+       /**\r
+        * @cfg {Number} value The value to initialize the slider with. Defaults to minValue.\r
+        */\r
+       /**\r
+        * @cfg {Boolean} vertical Orient the Slider vertically rather than horizontally, defaults to false.\r
+        */\r
+    vertical: false,\r
+       /**\r
+        * @cfg {Number} minValue The minimum value for the Slider. Defaults to 0.\r
+        */\r
+    minValue: 0,\r
+       /**\r
+        * @cfg {Number} maxValue The maximum value for the Slider. Defaults to 100.\r
+        */\r
+    maxValue: 100,\r
+    /**\r
+     * @cfg {Number/Boolean} decimalPrecision.\r
+     * <p>The number of decimal places to which to round the Slider's value. Defaults to 0.</p>\r
+     * <p>To disable rounding, configure as <tt><b>false</b></tt>.</p>\r
+     */\r
+    decimalPrecision: 0,\r
+       /**\r
+        * @cfg {Number} keyIncrement How many units to change the Slider when adjusting with keyboard navigation. Defaults to 1. If the increment config is larger, it will be used instead.\r
+        */\r
+    keyIncrement: 1,\r
+       /**\r
+        * @cfg {Number} increment How many units to change the slider when adjusting by drag and drop. Use this option to enable 'snapping'.\r
+        */\r
+    increment: 0,\r
+       // private\r
+    clickRange: [5,15],\r
+       /**\r
+        * @cfg {Boolean} clickToChange Determines whether or not clicking on the Slider axis will change the slider. Defaults to true\r
+        */\r
+    clickToChange : true,\r
+       /**\r
+        * @cfg {Boolean} animate Turn on or off animation. Defaults to true\r
+        */\r
+    animate: true,\r
 \r
-    var pad = function(n) {\r
-        return n < 10 ? "0" + n : n;\r
-    };\r
+    /**\r
+     * True while the thumb is in a drag operation\r
+     * @type boolean\r
+     */\r
+    dragging: false,\r
 \r
-    var m = {\r
-        "\b": '\\b',\r
-        "\t": '\\t',\r
-        "\n": '\\n',\r
-        "\f": '\\f',\r
-        "\r": '\\r',\r
-        '"' : '\\"',\r
-        "\\": '\\\\'\r
-    };\r
+    // private override\r
+    initComponent : function(){\r
+        if(!Ext.isDefined(this.value)){\r
+            this.value = this.minValue;\r
+        }\r
+        Ext.Slider.superclass.initComponent.call(this);\r
+        this.keyIncrement = Math.max(this.increment, this.keyIncrement);\r
+        this.addEvents(\r
+            /**\r
+             * @event beforechange\r
+             * Fires before the slider value is changed. By returning false from an event handler,\r
+             * you can cancel the event and prevent the slider from changing.\r
+                        * @param {Ext.Slider} slider The slider\r
+                        * @param {Number} newValue The new value which the slider is being changed to.\r
+                        * @param {Number} oldValue The old value which the slider was previously.\r
+             */\r
+                       'beforechange',\r
+                       /**\r
+                        * @event change\r
+                        * Fires when the slider value is changed.\r
+                        * @param {Ext.Slider} slider The slider\r
+                        * @param {Number} newValue The new value which the slider has been changed to.\r
+                        */\r
+                       'change',\r
+                       /**\r
+                        * @event changecomplete\r
+                        * Fires when the slider value is changed by the user and any drag operations have completed.\r
+                        * @param {Ext.Slider} slider The slider\r
+                        * @param {Number} newValue The new value which the slider has been changed to.\r
+                        */\r
+                       'changecomplete',\r
+                       /**\r
+                        * @event dragstart\r
+             * Fires after a drag operation has started.\r
+                        * @param {Ext.Slider} slider The slider\r
+                        * @param {Ext.EventObject} e The event fired from Ext.dd.DragTracker\r
+                        */\r
+                       'dragstart',\r
+                       /**\r
+                        * @event drag\r
+             * Fires continuously during the drag operation while the mouse is moving.\r
+                        * @param {Ext.Slider} slider The slider\r
+                        * @param {Ext.EventObject} e The event fired from Ext.dd.DragTracker\r
+                        */\r
+                       'drag',\r
+                       /**\r
+                        * @event dragend\r
+             * Fires after the drag operation has completed.\r
+                        * @param {Ext.Slider} slider The slider\r
+                        * @param {Ext.EventObject} e The event fired from Ext.dd.DragTracker\r
+                        */\r
+                       'dragend'\r
+               );\r
 \r
-    var encodeString = function(s){\r
-        if (/["\\\x00-\x1f]/.test(s)) {\r
-            return '"' + s.replace(/([\x00-\x1f\\"])/g, function(a, b) {\r
-                var c = m[b];\r
-                if(c){\r
-                    return c;\r
-                }\r
-                c = b.charCodeAt();\r
-                return "\\u00" +\r
-                    Math.floor(c / 16).toString(16) +\r
-                    (c % 16).toString(16);\r
-            }) + '"';\r
+        if(this.vertical){\r
+            Ext.apply(this, Ext.Slider.Vertical);\r
         }\r
-        return '"' + s + '"';\r
-    };\r
+    },\r
 \r
-    var encodeArray = function(o){\r
-        var a = ["["], b, i, l = o.length, v;\r
-            for (i = 0; i < l; i += 1) {\r
-                v = o[i];\r
-                switch (typeof v) {\r
-                    case "undefined":\r
-                    case "function":\r
-                    case "unknown":\r
-                        break;\r
-                    default:\r
-                        if (b) {\r
-                            a.push(',');\r
-                        }\r
-                        a.push(v === null ? "null" : Ext.util.JSON.encode(v));\r
-                        b = true;\r
-                }\r
-            }\r
-            a.push("]");\r
-            return a.join("");\r
-    };\r
+       // private override\r
+    onRender : function(){\r
+        this.autoEl = {\r
+            cls: 'x-slider ' + (this.vertical ? 'x-slider-vert' : 'x-slider-horz'),\r
+            cn:{cls:'x-slider-end',cn:{cls:'x-slider-inner',cn:[{cls:'x-slider-thumb'},{tag:'a', cls:'x-slider-focus', href:"#", tabIndex: '-1', hidefocus:'on'}]}}\r
+        };\r
+        Ext.Slider.superclass.onRender.apply(this, arguments);\r
+        this.endEl = this.el.first();\r
+        this.innerEl = this.endEl.first();\r
+        this.thumb = this.innerEl.first();\r
+        this.halfThumb = (this.vertical ? this.thumb.getHeight() : this.thumb.getWidth())/2;\r
+        this.focusEl = this.thumb.next();\r
+        this.initEvents();\r
+    },\r
 \r
-    this.encodeDate = function(o){\r
-        return '"' + o.getFullYear() + "-" +\r
-                pad(o.getMonth() + 1) + "-" +\r
-                pad(o.getDate()) + "T" +\r
-                pad(o.getHours()) + ":" +\r
-                pad(o.getMinutes()) + ":" +\r
-                pad(o.getSeconds()) + '"';\r
-    };\r
+       // private override\r
+    initEvents : function(){\r
+        this.thumb.addClassOnOver('x-slider-thumb-over');\r
+        this.mon(this.el, {\r
+            scope: this,\r
+            mousedown: this.onMouseDown,\r
+            keydown: this.onKeyDown\r
+        });\r
 \r
-    \r
-    this.encode = function(o){\r
-        if(typeof o == "undefined" || o === null){\r
-            return "null";\r
-        }else if(Ext.isArray(o)){\r
-            return encodeArray(o);\r
-        }else if(Ext.isDate(o)){\r
-            return Ext.util.JSON.encodeDate(o);\r
-        }else if(typeof o == "string"){\r
-            return encodeString(o);\r
-        }else if(typeof o == "number"){\r
-            return isFinite(o) ? String(o) : "null";\r
-        }else if(typeof o == "boolean"){\r
-            return String(o);\r
-        }else {\r
-            var a = ["{"], b, i, v;\r
-            for (i in o) {\r
-                if(!useHasOwn || o.hasOwnProperty(i)) {\r
-                    v = o[i];\r
-                    switch (typeof v) {\r
-                    case "undefined":\r
-                    case "function":\r
-                    case "unknown":\r
-                        break;\r
-                    default:\r
-                        if(b){\r
-                            a.push(',');\r
-                        }\r
-                        a.push(this.encode(i), ":",\r
-                                v === null ? "null" : this.encode(v));\r
-                        b = true;\r
-                    }\r
-                }\r
-            }\r
-            a.push("}");\r
-            return a.join("");\r
-        }\r
-    };\r
+        this.focusEl.swallowEvent("click", true);\r
 \r
-    \r
-    this.decode = function(json){\r
-        return eval("(" + json + ')');\r
-    };\r
-})();\r
+        this.tracker = new Ext.dd.DragTracker({\r
+            onBeforeStart: this.onBeforeDragStart.createDelegate(this),\r
+            onStart: this.onDragStart.createDelegate(this),\r
+            onDrag: this.onDrag.createDelegate(this),\r
+            onEnd: this.onDragEnd.createDelegate(this),\r
+            tolerance: 3,\r
+            autoStart: 300\r
+        });\r
+        this.tracker.initEl(this.thumb);\r
+        this.on('beforedestroy', this.tracker.destroy, this.tracker);\r
+    },\r
 \r
-Ext.encode = Ext.util.JSON.encode;\r
+       // private override\r
+    onMouseDown : function(e){\r
+        if(this.disabled) {return;}\r
+        if(this.clickToChange && e.target != this.thumb.dom){\r
+            var local = this.innerEl.translatePoints(e.getXY());\r
+            this.onClickChange(local);\r
+        }\r
+        this.focus();\r
+    },\r
 \r
-Ext.decode = Ext.util.JSON.decode;\r
+       // private\r
+    onClickChange : function(local){\r
+        if(local.top > this.clickRange[0] && local.top < this.clickRange[1]){\r
+            this.setValue(Ext.util.Format.round(this.reverseValue(local.left), this.decimalPrecision), undefined, true);\r
+        }\r
+    },\r
 \r
+       // private\r
+    onKeyDown : function(e){\r
+        if(this.disabled){e.preventDefault();return;}\r
+        var k = e.getKey();\r
+        switch(k){\r
+            case e.UP:\r
+            case e.RIGHT:\r
+                e.stopEvent();\r
+                if(e.ctrlKey){\r
+                    this.setValue(this.maxValue, undefined, true);\r
+                }else{\r
+                    this.setValue(this.value+this.keyIncrement, undefined, true);\r
+                }\r
+            break;\r
+            case e.DOWN:\r
+            case e.LEFT:\r
+                e.stopEvent();\r
+                if(e.ctrlKey){\r
+                    this.setValue(this.minValue, undefined, true);\r
+                }else{\r
+                    this.setValue(this.value-this.keyIncrement, undefined, true);\r
+                }\r
+            break;\r
+            default:\r
+                e.preventDefault();\r
+        }\r
+    },\r
 \r
-Ext.util.Format = function(){\r
-    var trimRe = /^\s+|\s+$/g;\r
-    return {\r
-        \r
-        ellipsis : function(value, len){\r
-            if(value && value.length > len){\r
-                return value.substr(0, len-3)+"...";\r
-            }\r
+       // private\r
+    doSnap : function(value){\r
+        if(!this.increment || this.increment == 1 || !value) {\r
             return value;\r
-        },\r
-\r
-        \r
-        undef : function(value){\r
-            return value !== undefined ? value : "";\r
-        },\r
+        }\r
+        var newValue = value, inc = this.increment;\r
+        var m = value % inc;\r
+        if(m != 0){\r
+            newValue -= m;\r
+            if(m * 2 > inc){\r
+                newValue += inc;\r
+            }else if(m * 2 < -inc){\r
+                newValue -= inc;\r
+            }\r
+        }\r
+        return newValue.constrain(this.minValue,  this.maxValue);\r
+    },\r
 \r
-        \r
-        defaultValue : function(value, defaultValue){\r
-            return value !== undefined && value !== '' ? value : defaultValue;\r
-        },\r
-\r
-        \r
-        htmlEncode : function(value){\r
-            return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");\r
-        },\r
-\r
-        \r
-        htmlDecode : function(value){\r
-            return !value ? value : String(value).replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");\r
-        },\r
-\r
-        \r
-        trim : function(value){\r
-            return String(value).replace(trimRe, "");\r
-        },\r
-\r
-        \r
-        substr : function(value, start, length){\r
-            return String(value).substr(start, length);\r
-        },\r
-\r
-        \r
-        lowercase : function(value){\r
-            return String(value).toLowerCase();\r
-        },\r
-\r
-        \r
-        uppercase : function(value){\r
-            return String(value).toUpperCase();\r
-        },\r
-\r
-        \r
-        capitalize : function(value){\r
-            return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();\r
-        },\r
-\r
-        // private\r
-        call : function(value, fn){\r
-            if(arguments.length > 2){\r
-                var args = Array.prototype.slice.call(arguments, 2);\r
-                args.unshift(value);\r
-                return eval(fn).apply(window, args);\r
+       // private\r
+    afterRender : function(){\r
+        Ext.Slider.superclass.afterRender.apply(this, arguments);\r
+        if(this.value !== undefined){\r
+            var v = this.normalizeValue(this.value);\r
+            if(v !== this.value){\r
+                delete this.value;\r
+                this.setValue(v, false);\r
             }else{\r
-                return eval(fn).call(window, value);\r
-            }\r
-        },\r
-\r
-        \r
-        usMoney : function(v){\r
-            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
-            while (r.test(whole)) {\r
-                whole = whole.replace(r, '$1' + ',' + '$2');\r
-            }\r
-            v = whole + sub;\r
-            if(v.charAt(0) == '-'){\r
-                return '-$' + v.substr(1);\r
-            }\r
-            return "$" +  v;\r
-        },\r
-\r
-        \r
-        date : function(v, format){\r
-            if(!v){\r
-                return "";\r
-            }\r
-            if(!Ext.isDate(v)){\r
-                v = new Date(Date.parse(v));\r
+                this.moveThumb(this.translateValue(v), false);\r
             }\r
-            return v.dateFormat(format || "m/d/Y");\r
-        },\r
-\r
-        \r
-        dateRenderer : function(format){\r
-            return function(v){\r
-                return Ext.util.Format.date(v, format);\r
-            };\r
-        },\r
-\r
-        // private\r
-        stripTagsRE : /<\/?[^>]+>/gi,\r
-        \r
-        \r
-        stripTags : function(v){\r
-            return !v ? v : String(v).replace(this.stripTagsRE, "");\r
-        },\r
-\r
-        // private\r
-        stripScriptsRe : /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,\r
+        }\r
+    },\r
 \r
-        \r
-        stripScripts : function(v){\r
-            return !v ? v : String(v).replace(this.stripScriptsRe, "");\r
-        },\r
+       // private\r
+    getRatio : function(){\r
+        var w = this.innerEl.getWidth();\r
+        var v = this.maxValue - this.minValue;\r
+        return v == 0 ? w : (w/v);\r
+    },\r
 \r
-        \r
-        fileSize : function(size){\r
-            if(size < 1024) {\r
-                return size + " bytes";\r
-            } else if(size < 1048576) {\r
-                return (Math.round(((size*10) / 1024))/10) + " KB";\r
-            } else {\r
-                return (Math.round(((size*10) / 1048576))/10) + " MB";\r
-            }\r
-        },\r
+       // private\r
+    normalizeValue : function(v){\r
+        v = this.doSnap(v);\r
+        v = Ext.util.Format.round(v, this.decimalPrecision);\r
+        v = v.constrain(this.minValue, this.maxValue);\r
+        return v;\r
+    },\r
 \r
-        math : function(){\r
-            var fns = {};\r
-            return function(v, a){\r
-                if(!fns[a]){\r
-                    fns[a] = new Function('v', 'return v ' + a + ';');\r
-                }\r
-                return fns[a](v);\r
+       /**\r
+        * Programmatically sets the value of the Slider. Ensures that the value is constrained within\r
+        * the minValue and maxValue.\r
+        * @param {Number} value The value to set the slider to. (This will be constrained within minValue and maxValue)\r
+        * @param {Boolean} animate Turn on or off animation, defaults to true\r
+        */\r
+    setValue : function(v, animate, changeComplete){\r
+        v = this.normalizeValue(v);\r
+        if(v !== this.value && this.fireEvent('beforechange', this, v, this.value) !== false){\r
+            this.value = v;\r
+            this.moveThumb(this.translateValue(v), animate !== false);\r
+            this.fireEvent('change', this, v);\r
+            if(changeComplete){\r
+                this.fireEvent('changecomplete', this, v);\r
             }\r
-        }(),\r
-\r
-               \r
-        nl2br : function(v){\r
-            return v === undefined || v === null ? '' : v.replace(/\n/g, '<br/>');\r
         }\r
-    };\r
-}();\r
-\r
-Ext.XTemplate = function(){\r
-    Ext.XTemplate.superclass.constructor.apply(this, arguments);\r
-    var s = this.html;\r
-\r
-    s = ['<tpl>', s, '</tpl>'].join('');\r
-\r
-    var re = /<tpl\b[^>]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;\r
-\r
-    var nameRe = /^<tpl\b[^>]*?for="(.*?)"/;\r
-    var ifRe = /^<tpl\b[^>]*?if="(.*?)"/;\r
-    var execRe = /^<tpl\b[^>]*?exec="(.*?)"/;\r
-    var m, id = 0;\r
-    var tpls = [];\r
-\r
-    while(m = s.match(re)){\r
-       var m2 = m[0].match(nameRe);\r
-       var m3 = m[0].match(ifRe);\r
-       var m4 = m[0].match(execRe);\r
-       var exp = null, fn = null, exec = null;\r
-       var name = m2 && m2[1] ? m2[1] : '';\r
-       if(m3){\r
-           exp = m3 && m3[1] ? m3[1] : null;\r
-           if(exp){\r
-               fn = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ return '+(Ext.util.Format.htmlDecode(exp))+'; }');\r
-           }\r
-       }\r
-       if(m4){\r
-           exp = m4 && m4[1] ? m4[1] : null;\r
-           if(exp){\r
-               exec = new Function('values', 'parent', 'xindex', 'xcount', 'with(values){ '+(Ext.util.Format.htmlDecode(exp))+'; }');\r
-           }\r
-       }\r
-       if(name){\r
-           switch(name){\r
-               case '.': name = new Function('values', 'parent', 'with(values){ return values; }'); break;\r
-               case '..': name = new Function('values', 'parent', 'with(values){ return parent; }'); break;\r
-               default: name = new Function('values', 'parent', 'with(values){ return '+name+'; }');\r
-           }\r
-       }\r
-       tpls.push({\r
-            id: id,\r
-            target: name,\r
-            exec: exec,\r
-            test: fn,\r
-            body: m[1]||''\r
-        });\r
-       s = s.replace(m[0], '{xtpl'+ id + '}');\r
-       ++id;\r
-    }\r
-    for(var i = tpls.length-1; i >= 0; --i){\r
-        this.compileTpl(tpls[i]);\r
-    }\r
-    this.master = tpls[tpls.length-1];\r
-    this.tpls = tpls;\r
-};\r
-Ext.extend(Ext.XTemplate, Ext.Template, {\r
-    // private\r
-    re : /\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,\r
-    // private\r
-    codeRe : /\{\[((?:\\\]|.|\n)*?)\]\}/g,\r
+    },\r
 \r
-    // private\r
-    applySubTemplate : function(id, values, parent, xindex, xcount){\r
-        var t = this.tpls[id];\r
-        if(t.test && !t.test.call(this, values, parent, xindex, xcount)){\r
-            return '';\r
-        }\r
-        if(t.exec && t.exec.call(this, values, parent, xindex, xcount)){\r
-            return '';\r
-        }\r
-        var vs = t.target ? t.target.call(this, values, parent) : values;\r
-        parent = t.target ? values : parent;\r
-        if(t.target && Ext.isArray(vs)){\r
-            var buf = [];\r
-            for(var i = 0, len = vs.length; i < len; i++){\r
-                buf[buf.length] = t.compiled.call(this, vs[i], parent, i+1, len);\r
-            }\r
-            return buf.join('');\r
-        }\r
-        return t.compiled.call(this, vs, parent, xindex, xcount);\r
+       // private\r
+    translateValue : function(v){\r
+        var ratio = this.getRatio();\r
+        return (v * ratio)-(this.minValue * ratio)-this.halfThumb;\r
     },\r
 \r
-    // private\r
-    compileTpl : function(tpl){\r
-        var fm = Ext.util.Format;\r
-        var useF = this.disableFormats !== true;\r
-        var sep = Ext.isGecko ? "+" : ",";\r
-        var fn = function(m, name, format, args, math){\r
-            if(name.substr(0, 4) == 'xtpl'){\r
-                return "'"+ sep +'this.applySubTemplate('+name.substr(4)+', values, parent, xindex, xcount)'+sep+"'";\r
-            }\r
-            var v;\r
-            if(name === '.'){\r
-                v = 'values';\r
-            }else if(name === '#'){\r
-                v = 'xindex';\r
-            }else if(name.indexOf('.') != -1){\r
-                v = name;\r
-            }else{\r
-                v = "values['" + name + "']";\r
-            }\r
-            if(math){\r
-                v = '(' + v + math + ')';\r
-            }\r
-            if(format && useF){\r
-                args = args ? ',' + args : "";\r
-                if(format.substr(0, 5) != "this."){\r
-                    format = "fm." + format + '(';\r
-                }else{\r
-                    format = 'this.call("'+ format.substr(5) + '", ';\r
-                    args = ", values";\r
-                }\r
-            }else{\r
-                args= ''; format = "("+v+" === undefined ? '' : ";\r
-            }\r
-            return "'"+ sep + format + v + args + ")"+sep+"'";\r
-        };\r
-        var codeFn = function(m, code){\r
-            return "'"+ sep +'('+code+')'+sep+"'";\r
-        };\r
+       reverseValue : function(pos){\r
+        var ratio = this.getRatio();\r
+        return (pos+this.halfThumb+(this.minValue * ratio))/ratio;\r
+    },\r
 \r
-        var body;\r
-        // branched to use + in gecko and [].join() in others\r
-        if(Ext.isGecko){\r
-            body = "tpl.compiled = function(values, parent, xindex, xcount){ return '" +\r
-                   tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn) +\r
-                    "';};";\r
+       // private\r
+    moveThumb: function(v, animate){\r
+        if(!animate || this.animate === false){\r
+            this.thumb.setLeft(v);\r
         }else{\r
-            body = ["tpl.compiled = function(values, parent, xindex, xcount){ return ['"];\r
-            body.push(tpl.body.replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn).replace(this.codeRe, codeFn));\r
-            body.push("'].join('');};");\r
-            body = body.join('');\r
+            this.thumb.shift({left: v, stopFx: true, duration:.35});\r
         }\r
-        eval(body);\r
-        return this;\r
     },\r
 \r
-    \r
-    applyTemplate : function(values){\r
-        return this.master.compiled.call(this, values, {}, 1, 1);\r
+       // private\r
+    focus : function(){\r
+        this.focusEl.focus(10);\r
     },\r
 \r
-    \r
-    compile : function(){return this;}\r
-\r
-    \r
-    \r
-    \r
-\r
-});\r
-\r
-Ext.XTemplate.prototype.apply = Ext.XTemplate.prototype.applyTemplate;\r
-\r
+       // private\r
+    onBeforeDragStart : function(e){\r
+        return !this.disabled;\r
+    },\r
 \r
-Ext.XTemplate.from = function(el){\r
-    el = Ext.getDom(el);\r
-    return new Ext.XTemplate(el.value || el.innerHTML);\r
-};\r
+       // private\r
+    onDragStart: function(e){\r
+        this.thumb.addClass('x-slider-thumb-drag');\r
+        this.dragging = true;\r
+        this.dragStartValue = this.value;\r
+        this.fireEvent('dragstart', this, e);\r
+    },\r
 \r
-Ext.util.CSS = function(){\r
-       var rules = null;\r
-       var doc = document;\r
+       // private\r
+    onDrag: function(e){\r
+        var pos = this.innerEl.translatePoints(this.tracker.getXY());\r
+        this.setValue(Ext.util.Format.round(this.reverseValue(pos.left), this.decimalPrecision), false);\r
+        this.fireEvent('drag', this, e);\r
+    },\r
 \r
-    var camelRe = /(-[a-z])/gi;\r
-    var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };\r
+       // private\r
+    onDragEnd: function(e){\r
+        this.thumb.removeClass('x-slider-thumb-drag');\r
+        this.dragging = false;\r
+        this.fireEvent('dragend', this, e);\r
+        if(this.dragStartValue != this.value){\r
+            this.fireEvent('changecomplete', this, this.value);\r
+        }\r
+    },\r
 \r
-   return {\r
-   \r
-   createStyleSheet : function(cssText, id){\r
-       var ss;\r
-       var head = doc.getElementsByTagName("head")[0];\r
-       var rules = doc.createElement("style");\r
-       rules.setAttribute("type", "text/css");\r
-       if(id){\r
-           rules.setAttribute("id", id);\r
-       }\r
-       if(Ext.isIE){\r
-           head.appendChild(rules);\r
-           ss = rules.styleSheet;\r
-           ss.cssText = cssText;\r
-       }else{\r
-           try{\r
-                rules.appendChild(doc.createTextNode(cssText));\r
-           }catch(e){\r
-               rules.cssText = cssText;\r
-           }\r
-           head.appendChild(rules);\r
-           ss = rules.styleSheet ? rules.styleSheet : (rules.sheet || doc.styleSheets[doc.styleSheets.length-1]);\r
-       }\r
-       this.cacheStyleSheet(ss);\r
-       return ss;\r
-   },\r
-\r
-   \r
-   removeStyleSheet : function(id){\r
-       var existing = doc.getElementById(id);\r
-       if(existing){\r
-           existing.parentNode.removeChild(existing);\r
-       }\r
-   },\r
-\r
-   \r
-   swapStyleSheet : function(id, url){\r
-       this.removeStyleSheet(id);\r
-       var ss = doc.createElement("link");\r
-       ss.setAttribute("rel", "stylesheet");\r
-       ss.setAttribute("type", "text/css");\r
-       ss.setAttribute("id", id);\r
-       ss.setAttribute("href", url);\r
-       doc.getElementsByTagName("head")[0].appendChild(ss);\r
-   },\r
-   \r
-   \r
-   refreshCache : function(){\r
-       return this.getRules(true);\r
-   },\r
-\r
-   // private\r
-   cacheStyleSheet : function(ss){\r
-       if(!rules){\r
-           rules = {};\r
-       }\r
-       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
-           }\r
-       }catch(e){}\r
-   },\r
-   \r
-   \r
-   getRules : function(refreshCache){\r
-               if(rules == null || refreshCache){\r
-                       rules = {};\r
-                       var ds = doc.styleSheets;\r
-                       for(var i =0, len = ds.length; i < len; i++){\r
-                           try{\r
-                       this.cacheStyleSheet(ds[i]);\r
-                   }catch(e){} \r
-               }\r
-               }\r
-               return rules;\r
-       },\r
-       \r
-       \r
-   getRule : function(selector, refreshCache){\r
-               var rs = this.getRules(refreshCache);\r
-               if(!Ext.isArray(selector)){\r
-                   return rs[selector];\r
-               }\r
-               for(var i = 0; i < selector.length; i++){\r
-                       if(rs[selector[i]]){\r
-                               return rs[selector[i]];\r
-                       }\r
-               }\r
-               return null;\r
-       },\r
-       \r
-       \r
-       \r
-   updateRule : function(selector, property, value){\r
-               if(!Ext.isArray(selector)){\r
-                       var rule = this.getRule(selector);\r
-                       if(rule){\r
-                               rule.style[property.replace(camelRe, camelFn)] = value;\r
-                               return true;\r
-                       }\r
-               }else{\r
-                       for(var i = 0; i < selector.length; i++){\r
-                               if(this.updateRule(selector[i], property, value)){\r
-                                       return true;\r
-                               }\r
-                       }\r
-               }\r
-               return false;\r
-       }\r
-   };  \r
-}();\r
-\r
-Ext.util.ClickRepeater = function(el, config)\r
-{\r
-    this.el = Ext.get(el);\r
-    this.el.unselectable();\r
-\r
-    Ext.apply(this, config);\r
-\r
-    this.addEvents(\r
-    \r
-        "mousedown",\r
-    \r
-        "click",\r
+       // private\r
+    onResize : function(w, h){\r
+        this.innerEl.setWidth(w - (this.el.getPadding('l') + this.endEl.getPadding('r')));\r
+        this.syncThumb();\r
+    },\r
     \r
-        "mouseup"\r
-    );\r
-\r
-    this.el.on("mousedown", this.handleMouseDown, this);\r
-    if(this.preventDefault || this.stopDefault){\r
-        this.el.on("click", function(e){\r
-            if(this.preventDefault){\r
-                e.preventDefault();\r
+    //private\r
+    onDisable: function(){\r
+        Ext.Slider.superclass.onDisable.call(this);\r
+        this.thumb.addClass(this.disabledClass);\r
+        if(Ext.isIE){\r
+            //IE breaks when using overflow visible and opacity other than 1.\r
+            //Create a place holder for the thumb and display it.\r
+            var xy = this.thumb.getXY();\r
+            this.thumb.hide();\r
+            this.innerEl.addClass(this.disabledClass).dom.disabled = true;\r
+            if (!this.thumbHolder){\r
+                this.thumbHolder = this.endEl.createChild({cls: 'x-slider-thumb ' + this.disabledClass});    \r
             }\r
-            if(this.stopDefault){\r
-                e.stopEvent();\r
+            this.thumbHolder.show().setXY(xy);\r
+        }\r
+    },\r
+    \r
+    //private\r
+    onEnable: function(){\r
+        Ext.Slider.superclass.onEnable.call(this);\r
+        this.thumb.removeClass(this.disabledClass);\r
+        if(Ext.isIE){\r
+            this.innerEl.removeClass(this.disabledClass).dom.disabled = false;\r
+            if (this.thumbHolder){\r
+                this.thumbHolder.hide();\r
             }\r
-        }, this);\r
-    }\r
-\r
-    // allow inline handler\r
-    if(this.handler){\r
-        this.on("click", this.handler,  this.scope || this);\r
-    }\r
-\r
-    Ext.util.ClickRepeater.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.util.ClickRepeater, Ext.util.Observable, {\r
-    interval : 20,\r
-    delay: 250,\r
-    preventDefault : true,\r
-    stopDefault : false,\r
-    timer : 0,\r
-\r
-    // private\r
-    destroy : function() {\r
-        Ext.destroy(this.el);\r
-        this.purgeListeners();\r
+            this.thumb.show();\r
+            this.syncThumb();\r
+        }\r
     },\r
     \r
-    // private\r
-    handleMouseDown : function(){\r
-        clearTimeout(this.timer);\r
-        this.el.blur();\r
-        if(this.pressClass){\r
-            this.el.addClass(this.pressClass);\r
+    /**\r
+     * Synchronizes the thumb position to the proper proportion of the total component width based\r
+     * on the current slider {@link #value}.  This will be called automatically when the Slider\r
+     * is resized by a layout, but if it is rendered auto width, this method can be called from\r
+     * another resize handler to sync the Slider if necessary.\r
+     */\r
+    syncThumb : function(){\r
+        if(this.rendered){\r
+            this.moveThumb(this.translateValue(this.value));\r
         }\r
-        this.mousedownTime = new Date();\r
-\r
-        Ext.getDoc().on("mouseup", this.handleMouseUp, this);\r
-        this.el.on("mouseout", this.handleMouseOut, this);\r
-\r
-        this.fireEvent("mousedown", this);\r
-        this.fireEvent("click", this);\r
-\r
-//      Do not honor delay or interval if acceleration wanted.\r
-        if (this.accelerate) {\r
-            this.delay = 400;\r
-           }\r
-        this.timer = this.click.defer(this.delay || this.interval, this);\r
     },\r
 \r
-    // private\r
-    click : function(){\r
-        this.fireEvent("click", this);\r
-        this.timer = this.click.defer(this.accelerate ?\r
-            this.easeOutExpo(this.mousedownTime.getElapsed(),\r
-                400,\r
-                -390,\r
-                12000) :\r
-            this.interval, this);\r
-    },\r
+       /**\r
+        * Returns the current value of the slider\r
+        * @return {Number} The current value of the slider\r
+        */\r
+    getValue : function(){\r
+        return this.value;\r
+    }\r
+});\r
+Ext.reg('slider', Ext.Slider);\r
 \r
-    easeOutExpo : function (t, b, c, d) {\r
-        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;\r
+// private class to support vertical sliders\r
+Ext.Slider.Vertical = {\r
+    onResize : function(w, h){\r
+        this.innerEl.setHeight(h - (this.el.getPadding('t') + this.endEl.getPadding('b')));\r
+        this.syncThumb();\r
     },\r
 \r
-    // private\r
-    handleMouseOut : function(){\r
-        clearTimeout(this.timer);\r
-        if(this.pressClass){\r
-            this.el.removeClass(this.pressClass);\r
-        }\r
-        this.el.on("mouseover", this.handleMouseReturn, this);\r
+    getRatio : function(){\r
+        var h = this.innerEl.getHeight();\r
+        var v = this.maxValue - this.minValue;\r
+        return h/v;\r
     },\r
 \r
-    // private\r
-    handleMouseReturn : function(){\r
-        this.el.un("mouseover", this.handleMouseReturn, this);\r
-        if(this.pressClass){\r
-            this.el.addClass(this.pressClass);\r
+    moveThumb: function(v, animate){\r
+        if(!animate || this.animate === false){\r
+            this.thumb.setBottom(v);\r
+        }else{\r
+            this.thumb.shift({bottom: v, stopFx: true, duration:.35});\r
         }\r
-        this.click();\r
     },\r
 \r
-    // private\r
-    handleMouseUp : function(){\r
-        clearTimeout(this.timer);\r
-        this.el.un("mouseover", this.handleMouseReturn, this);\r
-        this.el.un("mouseout", this.handleMouseOut, this);\r
-        Ext.getDoc().un("mouseup", this.handleMouseUp, this);\r
-        this.el.removeClass(this.pressClass);\r
-        this.fireEvent("mouseup", this);\r
-    }\r
-});\r
+    onDrag: function(e){\r
+        var pos = this.innerEl.translatePoints(this.tracker.getXY());\r
+        var bottom = this.innerEl.getHeight()-pos.top;\r
+        this.setValue(this.minValue + Ext.util.Format.round(bottom/this.getRatio(), this.decimalPrecision), false);\r
+        this.fireEvent('drag', this, e);\r
+    },\r
 \r
-Ext.KeyNav = function(el, config){\r
-    this.el = Ext.get(el);\r
-    Ext.apply(this, config);\r
-    if(!this.disabled){\r
-        this.disabled = true;\r
-        this.enable();\r
+    onClickChange : function(local){\r
+        if(local.left > this.clickRange[0] && local.left < this.clickRange[1]){\r
+            var bottom = this.innerEl.getHeight()-local.top;\r
+            this.setValue(this.minValue + Ext.util.Format.round(bottom/this.getRatio(), this.decimalPrecision), undefined, true);\r
+        }\r
     }\r
-};\r
-\r
-Ext.KeyNav.prototype = {\r
-    \r
-    disabled : false,\r
-    \r
-    defaultEventAction: "stopEvent",\r
+};/**\r
+ * @class Ext.ProgressBar\r
+ * @extends Ext.BoxComponent\r
+ * <p>An updateable progress bar component.  The progress bar supports two different modes: manual and automatic.</p>\r
+ * <p>In manual mode, you are responsible for showing, updating (via {@link #updateProgress}) and clearing the\r
+ * progress bar as needed from your own code.  This method is most appropriate when you want to show progress\r
+ * throughout an operation that has predictable points of interest at which you can update the control.</p>\r
+ * <p>In automatic mode, you simply call {@link #wait} and let the progress bar run indefinitely, only clearing it\r
+ * once the operation is complete.  You can optionally have the progress bar wait for a specific amount of time\r
+ * and then clear itself.  Automatic mode is most appropriate for timed operations or asynchronous operations in\r
+ * which you have no need for indicating intermediate progress.</p>\r
+ * @cfg {Float} value A floating point value between 0 and 1 (e.g., .5, defaults to 0)\r
+ * @cfg {String} text The progress bar text (defaults to '')\r
+ * @cfg {Mixed} textEl The element to render the progress text to (defaults to the progress\r
+ * bar's internal text element)\r
+ * @cfg {String} id The progress bar element's id (defaults to an auto-generated id)\r
+ * @xtype progress\r
+ */\r
+Ext.ProgressBar = Ext.extend(Ext.BoxComponent, {\r
+   /**\r
+    * @cfg {String} baseCls\r
+    * The base CSS class to apply to the progress bar's wrapper element (defaults to 'x-progress')\r
+    */\r
+    baseCls : 'x-progress',\r
     \r
-    forceKeyDown : false,\r
+    /**\r
+    * @cfg {Boolean} animate\r
+    * True to animate the progress bar during transitions (defaults to false)\r
+    */\r
+    animate : false,\r
 \r
     // private\r
-    prepareEvent : function(e){\r
-        var k = e.getKey();\r
-        var h = this.keyToHandler[k];\r
-        //if(h && this[h]){\r
-        //    e.stopPropagation();\r
-        //}\r
-        if(Ext.isSafari2 && h && k >= 37 && k <= 40){\r
-            e.stopEvent();\r
-        }\r
-    },\r
+    waitTimer : null,\r
 \r
     // private\r
-    relay : function(e){\r
-        var k = e.getKey();\r
-        var h = this.keyToHandler[k];\r
-        if(h && this[h]){\r
-            if(this.doRelay(e, this[h], h) !== true){\r
-                e[this.defaultEventAction]();\r
-            }\r
-        }\r
+    initComponent : function(){\r
+        Ext.ProgressBar.superclass.initComponent.call(this);\r
+        this.addEvents(\r
+            /**\r
+             * @event update\r
+             * Fires after each update interval\r
+             * @param {Ext.ProgressBar} this\r
+             * @param {Number} The current progress value\r
+             * @param {String} The current progress text\r
+             */\r
+            "update"\r
+        );\r
     },\r
 \r
     // private\r
-    doRelay : function(e, h, hname){\r
-        return h.call(this.scope || this, e);\r
-    },\r
-\r
-    // possible handlers\r
-    enter : false,\r
-    left : false,\r
-    right : false,\r
-    up : false,\r
-    down : false,\r
-    tab : false,\r
-    esc : false,\r
-    pageUp : false,\r
-    pageDown : false,\r
-    del : false,\r
-    home : false,\r
-    end : false,\r
-\r
-    // quick lookup hash\r
-    keyToHandler : {\r
-        37 : "left",\r
-        39 : "right",\r
-        38 : "up",\r
-        40 : "down",\r
-        33 : "pageUp",\r
-        34 : "pageDown",\r
-        46 : "del",\r
-        36 : "home",\r
-        35 : "end",\r
-        13 : "enter",\r
-        27 : "esc",\r
-        9  : "tab"\r
-    },\r
+    onRender : function(ct, position){\r
+        var tpl = new Ext.Template(\r
+            '<div class="{cls}-wrap">',\r
+                '<div class="{cls}-inner">',\r
+                    '<div class="{cls}-bar">',\r
+                        '<div class="{cls}-text">',\r
+                            '<div>&#160;</div>',\r
+                        '</div>',\r
+                    '</div>',\r
+                    '<div class="{cls}-text {cls}-text-back">',\r
+                        '<div>&#160;</div>',\r
+                    '</div>',\r
+                '</div>',\r
+            '</div>'\r
+        );\r
 \r
-       \r
-       enable: function(){\r
-               if(this.disabled){\r
-            if(this.forceKeyDown || Ext.isIE || Ext.isSafari3 || Ext.isAir){\r
-                this.el.on("keydown", this.relay,  this);\r
-            }else{\r
-                this.el.on("keydown", this.prepareEvent,  this);\r
-                this.el.on("keypress", this.relay,  this);\r
-            }\r
-                   this.disabled = false;\r
-               }\r
-       },\r
-\r
-       \r
-       disable: function(){\r
-               if(!this.disabled){\r
-                   if(this.forceKeyDown || Ext.isIE || Ext.isSafari3 || Ext.isAir){\r
-                this.el.un("keydown", this.relay, this);\r
-            }else{\r
-                this.el.un("keydown", this.prepareEvent, this);\r
-                this.el.un("keypress", this.relay, this);\r
-            }\r
-                   this.disabled = true;\r
-               }\r
-       }\r
-};\r
-\r
-Ext.KeyMap = function(el, config, eventName){\r
-    this.el  = Ext.get(el);\r
-    this.eventName = eventName || "keydown";\r
-    this.bindings = [];\r
-    if(config){\r
-        this.addBinding(config);\r
-    }\r
-    this.enable();\r
-};\r
-\r
-Ext.KeyMap.prototype = {\r
-    \r
-    stopEvent : false,\r
-\r
-    \r
-       addBinding : function(config){\r
-        if(Ext.isArray(config)){\r
-            for(var i = 0, len = config.length; i < len; i++){\r
-                this.addBinding(config[i]);\r
-            }\r
-            return;\r
+        this.el = position ? tpl.insertBefore(position, {cls: this.baseCls}, true)\r
+               : tpl.append(ct, {cls: this.baseCls}, true);\r
+                       \r
+        if(this.id){\r
+            this.el.dom.id = this.id;\r
         }\r
-        var keyCode = config.key,\r
-            shift = config.shift,\r
-            ctrl = config.ctrl,\r
-            alt = config.alt,\r
-            fn = config.fn || config.handler,\r
-            scope = config.scope;\r
-       \r
-       if (config.stopEvent) {\r
-           this.stopEvent = config.stopEvent;    \r
-       }       \r
+        var inner = this.el.dom.firstChild;\r
+        this.progressBar = Ext.get(inner.firstChild);\r
 \r
-        if(typeof keyCode == "string"){\r
-            var ks = [];\r
-            var keyString = keyCode.toUpperCase();\r
-            for(var j = 0, len = keyString.length; j < len; j++){\r
-                ks.push(keyString.charCodeAt(j));\r
-            }\r
-            keyCode = ks;\r
+        if(this.textEl){\r
+            //use an external text el\r
+            this.textEl = Ext.get(this.textEl);\r
+            delete this.textTopEl;\r
+        }else{\r
+            //setup our internal layered text els\r
+            this.textTopEl = Ext.get(this.progressBar.dom.firstChild);\r
+            var textBackEl = Ext.get(inner.childNodes[1]);\r
+            this.textTopEl.setStyle("z-index", 99).addClass('x-hidden');\r
+            this.textEl = new Ext.CompositeElement([this.textTopEl.dom.firstChild, textBackEl.dom.firstChild]);\r
+            this.textEl.setWidth(inner.offsetWidth);\r
         }\r
-        var keyArray = Ext.isArray(keyCode);\r
-        \r
-        var handler = function(e){\r
-            if((!shift || e.shiftKey) && (!ctrl || e.ctrlKey) &&  (!alt || e.altKey)){\r
-                var k = e.getKey();\r
-                if(keyArray){\r
-                    for(var i = 0, len = keyCode.length; i < len; i++){\r
-                        if(keyCode[i] == k){\r
-                          if(this.stopEvent){\r
-                              e.stopEvent();\r
-                          }\r
-                          fn.call(scope || window, k, e);\r
-                          return;\r
-                        }\r
-                    }\r
-                }else{\r
-                    if(k == keyCode){\r
-                        if(this.stopEvent){\r
-                           e.stopEvent();\r
-                        }\r
-                        fn.call(scope || window, k, e);\r
-                    }\r
-                }\r
-            }\r
-        };\r
-        this.bindings.push(handler);\r
-       },\r
-\r
+        this.progressBar.setHeight(inner.offsetHeight);\r
+    },\r
     \r
-    on : function(key, fn, scope){\r
-        var keyCode, shift, ctrl, alt;\r
-        if(typeof key == "object" && !Ext.isArray(key)){\r
-            keyCode = key.key;\r
-            shift = key.shift;\r
-            ctrl = key.ctrl;\r
-            alt = key.alt;\r
+    // private\r
+    afterRender : function(){\r
+        Ext.ProgressBar.superclass.afterRender.call(this);\r
+        if(this.value){\r
+            this.updateProgress(this.value, this.text);\r
         }else{\r
-            keyCode = key;\r
+            this.updateText(this.text);\r
         }\r
-        this.addBinding({\r
-            key: keyCode,\r
-            shift: shift,\r
-            ctrl: ctrl,\r
-            alt: alt,\r
-            fn: fn,\r
-            scope: scope\r
-        })\r
     },\r
 \r
-    // private\r
-    handleKeyDown : function(e){\r
-           if(this.enabled){ //just in case\r
-           var b = this.bindings;\r
-           for(var i = 0, len = b.length; i < len; i++){\r
-               b[i].call(this, e);\r
-           }\r
-           }\r
-       },\r
+    /**\r
+     * Updates the progress bar value, and optionally its text.  If the text argument is not specified,\r
+     * any existing text value will be unchanged.  To blank out existing text, pass ''.  Note that even\r
+     * if the progress bar value exceeds 1, it will never automatically reset -- you are responsible for\r
+     * determining when the progress is complete and calling {@link #reset} to clear and/or hide the control.\r
+     * @param {Float} value (optional) A floating point value between 0 and 1 (e.g., .5, defaults to 0)\r
+     * @param {String} text (optional) The string to display in the progress text element (defaults to '')\r
+     * @param {Boolean} animate (optional) Whether to animate the transition of the progress bar. If this value is\r
+     * not specified, the default for the class is used (default to false)\r
+     * @return {Ext.ProgressBar} this\r
+     */\r
+    updateProgress : function(value, text, animate){\r
+        this.value = value || 0;\r
+        if(text){\r
+            this.updateText(text);\r
+        }\r
+        if(this.rendered){\r
+            var w = Math.floor(value*this.el.dom.firstChild.offsetWidth);\r
+            this.progressBar.setWidth(w, animate === true || (animate !== false && this.animate));\r
+            if(this.textTopEl){\r
+                //textTopEl should be the same width as the bar so overflow will clip as the bar moves\r
+                this.textTopEl.removeClass('x-hidden').setWidth(w);\r
+            }\r
+        }\r
+        this.fireEvent('update', this, value, text);\r
+        return this;\r
+    },\r
 \r
-       \r
-       isEnabled : function(){\r
-           return this.enabled;\r
-       },\r
+    /**\r
+     * Initiates an auto-updating progress bar.  A duration can be specified, in which case the progress\r
+     * bar will automatically reset after a fixed amount of time and optionally call a callback function\r
+     * if specified.  If no duration is passed in, then the progress bar will run indefinitely and must\r
+     * be manually cleared by calling {@link #reset}.  The wait method accepts a config object with\r
+     * the following properties:\r
+     * <pre>\r
+Property   Type          Description\r
+---------- ------------  ----------------------------------------------------------------------\r
+duration   Number        The length of time in milliseconds that the progress bar should\r
+                         run before resetting itself (defaults to undefined, in which case it\r
+                         will run indefinitely until reset is called)\r
+interval   Number        The length of time in milliseconds between each progress update\r
+                         (defaults to 1000 ms)\r
+animate    Boolean       Whether to animate the transition of the progress bar. If this value is\r
+                         not specified, the default for the class is used.                                                   \r
+increment  Number        The number of progress update segments to display within the progress\r
+                         bar (defaults to 10).  If the bar reaches the end and is still\r
+                         updating, it will automatically wrap back to the beginning.\r
+text       String        Optional text to display in the progress bar element (defaults to '').\r
+fn         Function      A callback function to execute after the progress bar finishes auto-\r
+                         updating.  The function will be called with no arguments.  This function\r
+                         will be ignored if duration is not specified since in that case the\r
+                         progress bar can only be stopped programmatically, so any required function\r
+                         should be called by the same code after it resets the progress bar.\r
+scope      Object        The scope that is passed to the callback function (only applies when\r
+                         duration and fn are both passed).\r
+</pre>\r
+         *\r
+         * Example usage:\r
+         * <pre><code>\r
+var p = new Ext.ProgressBar({\r
+   renderTo: 'my-el'\r
+});\r
 \r
-       \r
-       enable: function(){\r
-               if(!this.enabled){\r
-                   this.el.on(this.eventName, this.handleKeyDown, this);\r
-                   this.enabled = true;\r
-               }\r
-       },\r
+//Wait for 5 seconds, then update the status el (progress bar will auto-reset)\r
+p.wait({\r
+   interval: 100, //bar will move fast!\r
+   duration: 5000,\r
+   increment: 15,\r
+   text: 'Updating...',\r
+   scope: this,\r
+   fn: function(){\r
+      Ext.fly('status').update('Done!');\r
+   }\r
+});\r
 \r
-       \r
-       disable: function(){\r
-               if(this.enabled){\r
-                   this.el.removeListener(this.eventName, this.handleKeyDown, this);\r
-                   this.enabled = false;\r
-               }\r
-       }\r
-};\r
+//Or update indefinitely until some async action completes, then reset manually\r
+p.wait();\r
+myAction.on('complete', function(){\r
+    p.reset();\r
+    Ext.fly('status').update('Done!');\r
+});\r
+</code></pre>\r
+     * @param {Object} config (optional) Configuration options\r
+     * @return {Ext.ProgressBar} this\r
+     */\r
+    wait : function(o){\r
+        if(!this.waitTimer){\r
+            var scope = this;\r
+            o = o || {};\r
+            this.updateText(o.text);\r
+            this.waitTimer = Ext.TaskMgr.start({\r
+                run: function(i){\r
+                    var inc = o.increment || 10;\r
+                    this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*0.01, null, o.animate);\r
+                },\r
+                interval: o.interval || 1000,\r
+                duration: o.duration,\r
+                onStop: function(){\r
+                    if(o.fn){\r
+                        o.fn.apply(o.scope || this);\r
+                    }\r
+                    this.reset();\r
+                },\r
+                scope: scope\r
+            });\r
+        }\r
+        return this;\r
+    },\r
 \r
-Ext.util.TextMetrics = function(){\r
-    var shared;\r
-    return {\r
-        \r
-        measure : function(el, text, fixedWidth){\r
-            if(!shared){\r
-                shared = Ext.util.TextMetrics.Instance(el, fixedWidth);\r
-            }\r
-            shared.bind(el);\r
-            shared.setFixedWidth(fixedWidth || 'auto');\r
-            return shared.getSize(text);\r
-        },\r
+    /**\r
+     * Returns true if the progress bar is currently in a {@link #wait} operation\r
+     * @return {Boolean} True if waiting, else false\r
+     */\r
+    isWaiting : function(){\r
+        return this.waitTimer !== null;\r
+    },\r
 \r
-        \r
-        createInstance : function(el, fixedWidth){\r
-            return Ext.util.TextMetrics.Instance(el, fixedWidth);\r
+    /**\r
+     * Updates the progress bar text.  If specified, textEl will be updated, otherwise the progress\r
+     * bar itself will display the updated text.\r
+     * @param {String} text (optional) The string to display in the progress text element (defaults to '')\r
+     * @return {Ext.ProgressBar} this\r
+     */\r
+    updateText : function(text){\r
+        this.text = text || '&#160;';\r
+        if(this.rendered){\r
+            this.textEl.update(this.text);\r
         }\r
-    };\r
-}();\r
+        return this;\r
+    },\r
+    \r
+    /**\r
+     * Synchronizes the inner bar width to the proper proportion of the total componet width based\r
+     * on the current progress {@link #value}.  This will be called automatically when the ProgressBar\r
+     * is resized by a layout, but if it is rendered auto width, this method can be called from\r
+     * another resize handler to sync the ProgressBar if necessary.\r
+     */\r
+    syncProgressBar : function(){\r
+        if(this.value){\r
+            this.updateProgress(this.value, this.text);\r
+        }\r
+        return this;\r
+    },\r
 \r
-Ext.util.TextMetrics.Instance = function(bindTo, fixedWidth){\r
-    var ml = new Ext.Element(document.createElement('div'));\r
-    document.body.appendChild(ml.dom);\r
-    ml.position('absolute');\r
-    ml.setLeftTop(-1000, -1000);\r
-    ml.hide();\r
+    /**\r
+     * Sets the size of the progress bar.\r
+     * @param {Number} width The new width in pixels\r
+     * @param {Number} height The new height in pixels\r
+     * @return {Ext.ProgressBar} this\r
+     */\r
+    setSize : function(w, h){\r
+        Ext.ProgressBar.superclass.setSize.call(this, w, h);\r
+        if(this.textTopEl){\r
+            var inner = this.el.dom.firstChild;\r
+            this.textEl.setSize(inner.offsetWidth, inner.offsetHeight);\r
+        }\r
+        this.syncProgressBar();\r
+        return this;\r
+    },\r
 \r
-    if(fixedWidth){\r
-        ml.setWidth(fixedWidth);\r
+    /**\r
+     * Resets the progress bar value to 0 and text to empty string.  If hide = true, the progress\r
+     * bar will also be hidden (using the {@link #hideMode} property internally).\r
+     * @param {Boolean} hide (optional) True to hide the progress bar (defaults to false)\r
+     * @return {Ext.ProgressBar} this\r
+     */\r
+    reset : function(hide){\r
+        this.updateProgress(0);\r
+        if(this.textTopEl){\r
+            this.textTopEl.addClass('x-hidden');\r
+        }\r
+        if(this.waitTimer){\r
+            this.waitTimer.onStop = null; //prevent recursion\r
+            Ext.TaskMgr.stop(this.waitTimer);\r
+            this.waitTimer = null;\r
+        }\r
+        if(hide === true){\r
+            this.hide();\r
+        }\r
+        return this;\r
     }\r
+});\r
+Ext.reg('progress', Ext.ProgressBar);/*
+ * These classes are derivatives of the similarly named classes in the YUI Library.
+ * The original license:
+ * Copyright (c) 2006, Yahoo! Inc. All rights reserved.
+ * Code licensed under the BSD License:
+ * http://developer.yahoo.net/yui/license.txt
+ */
+
+(function() {
+
+var Event=Ext.EventManager;
+var Dom=Ext.lib.Dom;
+
+/**
+ * @class Ext.dd.DragDrop
+ * Defines the interface and base operation of items that that can be
+ * dragged or can be drop targets.  It was designed to be extended, overriding
+ * the event handlers for startDrag, onDrag, onDragOver and onDragOut.
+ * Up to three html elements can be associated with a DragDrop instance:
+ * <ul>
+ * <li>linked element: the element that is passed into the constructor.
+ * This is the element which defines the boundaries for interaction with
+ * other DragDrop objects.</li>
+ * <li>handle element(s): The drag operation only occurs if the element that
+ * was clicked matches a handle element.  By default this is the linked
+ * element, but there are times that you will want only a portion of the
+ * linked element to initiate the drag operation, and the setHandleElId()
+ * method provides a way to define this.</li>
+ * <li>drag element: this represents the element that would be moved along
+ * with the cursor during a drag operation.  By default, this is the linked
+ * element itself as in {@link Ext.dd.DD}.  setDragElId() lets you define
+ * a separate element that would be moved, as in {@link Ext.dd.DDProxy}.
+ * </li>
+ * </ul>
+ * This class should not be instantiated until the onload event to ensure that
+ * the associated elements are available.
+ * The following would define a DragDrop obj that would interact with any
+ * other DragDrop obj in the "group1" group:
+ * <pre>
+ *  dd = new Ext.dd.DragDrop("div1", "group1");
+ * </pre>
+ * Since none of the event handlers have been implemented, nothing would
+ * actually happen if you were to run the code above.  Normally you would
+ * override this class or one of the default implementations, but you can
+ * also override the methods you want on an instance of the class...
+ * <pre>
+ *  dd.onDragDrop = function(e, id) {
+ *  &nbsp;&nbsp;alert("dd was dropped on " + id);
+ *  }
+ * </pre>
+ * @constructor
+ * @param {String} id of the element that is linked to this instance
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ *                Valid properties for DragDrop:
+ *                    padding, isTarget, maintainOffset, primaryButtonOnly
+ */
+Ext.dd.DragDrop = function(id, sGroup, config) {
+    if(id) {
+        this.init(id, sGroup, config);
+    }
+};
+
+Ext.dd.DragDrop.prototype = {
+
+    /**
+     * Set to false to enable a DragDrop object to fire drag events while dragging
+     * over its own Element. Defaults to true - DragDrop objects do not by default
+     * fire drag events to themselves.
+     * @property ignoreSelf
+     * @type Boolean
+     */
+
+    /**
+     * The id of the element associated with this object.  This is what we
+     * refer to as the "linked element" because the size and position of
+     * this element is used to determine when the drag and drop objects have
+     * interacted.
+     * @property id
+     * @type String
+     */
+    id: null,
+
+    /**
+     * Configuration attributes passed into the constructor
+     * @property config
+     * @type object
+     */
+    config: null,
+
+    /**
+     * The id of the element that will be dragged.  By default this is same
+     * as the linked element , but could be changed to another element. Ex:
+     * Ext.dd.DDProxy
+     * @property dragElId
+     * @type String
+     * @private
+     */
+    dragElId: null,
+
+    /**
+     * The ID of the element that initiates the drag operation.  By default
+     * this is the linked element, but could be changed to be a child of this
+     * element.  This lets us do things like only starting the drag when the
+     * header element within the linked html element is clicked.
+     * @property handleElId
+     * @type String
+     * @private
+     */
+    handleElId: null,
+
+    /**
+     * An object who's property names identify HTML tags to be considered invalid as drag handles.
+     * A non-null property value identifies the tag as invalid. Defaults to the 
+     * following value which prevents drag operations from being initiated by &lt;a> elements:<pre><code>
+{
+    A: "A"
+}</code></pre>
+     * @property invalidHandleTypes
+     * @type Object
+     */
+    invalidHandleTypes: null,
+
+    /**
+     * An object who's property names identify the IDs of elements to be considered invalid as drag handles.
+     * A non-null property value identifies the ID as invalid. For example, to prevent
+     * dragging from being initiated on element ID "foo", use:<pre><code>
+{
+    foo: true
+}</code></pre>
+     * @property invalidHandleIds
+     * @type Object
+     */
+    invalidHandleIds: null,
+
+    /**
+     * An Array of CSS class names for elements to be considered in valid as drag handles.
+     * @property invalidHandleClasses
+     * @type Array
+     */
+    invalidHandleClasses: null,
+
+    /**
+     * The linked element's absolute X position at the time the drag was
+     * started
+     * @property startPageX
+     * @type int
+     * @private
+     */
+    startPageX: 0,
+
+    /**
+     * The linked element's absolute X position at the time the drag was
+     * started
+     * @property startPageY
+     * @type int
+     * @private
+     */
+    startPageY: 0,
+
+    /**
+     * The group defines a logical collection of DragDrop objects that are
+     * related.  Instances only get events when interacting with other
+     * DragDrop object in the same group.  This lets us define multiple
+     * groups using a single DragDrop subclass if we want.
+     * @property groups
+     * @type object An object in the format {'group1':true, 'group2':true}
+     */
+    groups: null,
+
+    /**
+     * Individual drag/drop instances can be locked.  This will prevent
+     * onmousedown start drag.
+     * @property locked
+     * @type boolean
+     * @private
+     */
+    locked: false,
+
+    /**
+     * Lock this instance
+     * @method lock
+     */
+    lock: function() { this.locked = true; },
+
+    /**
+     * When set to true, other DD objects in cooperating DDGroups do not receive
+     * notification events when this DD object is dragged over them. Defaults to false.
+     * @property moveOnly
+     * @type boolean
+     */
+    moveOnly: false,
+
+    /**
+     * Unlock this instace
+     * @method unlock
+     */
+    unlock: function() { this.locked = false; },
+
+    /**
+     * By default, all instances can be a drop target.  This can be disabled by
+     * setting isTarget to false.
+     * @property isTarget
+     * @type boolean
+     */
+    isTarget: true,
+
+    /**
+     * The padding configured for this drag and drop object for calculating
+     * the drop zone intersection with this object.
+     * @property padding
+     * @type int[] An array containing the 4 padding values: [top, right, bottom, left]
+     */
+    padding: null,
+
+    /**
+     * Cached reference to the linked element
+     * @property _domRef
+     * @private
+     */
+    _domRef: null,
+
+    /**
+     * Internal typeof flag
+     * @property __ygDragDrop
+     * @private
+     */
+    __ygDragDrop: true,
+
+    /**
+     * Set to true when horizontal contraints are applied
+     * @property constrainX
+     * @type boolean
+     * @private
+     */
+    constrainX: false,
+
+    /**
+     * Set to true when vertical contraints are applied
+     * @property constrainY
+     * @type boolean
+     * @private
+     */
+    constrainY: false,
+
+    /**
+     * The left constraint
+     * @property minX
+     * @type int
+     * @private
+     */
+    minX: 0,
+
+    /**
+     * The right constraint
+     * @property maxX
+     * @type int
+     * @private
+     */
+    maxX: 0,
+
+    /**
+     * The up constraint
+     * @property minY
+     * @type int
+     * @type int
+     * @private
+     */
+    minY: 0,
+
+    /**
+     * The down constraint
+     * @property maxY
+     * @type int
+     * @private
+     */
+    maxY: 0,
+
+    /**
+     * Maintain offsets when we resetconstraints.  Set to true when you want
+     * the position of the element relative to its parent to stay the same
+     * when the page changes
+     *
+     * @property maintainOffset
+     * @type boolean
+     */
+    maintainOffset: false,
+
+    /**
+     * Array of pixel locations the element will snap to if we specified a
+     * horizontal graduation/interval.  This array is generated automatically
+     * when you define a tick interval.
+     * @property xTicks
+     * @type int[]
+     */
+    xTicks: null,
+
+    /**
+     * Array of pixel locations the element will snap to if we specified a
+     * vertical graduation/interval.  This array is generated automatically
+     * when you define a tick interval.
+     * @property yTicks
+     * @type int[]
+     */
+    yTicks: null,
+
+    /**
+     * By default the drag and drop instance will only respond to the primary
+     * button click (left button for a right-handed mouse).  Set to true to
+     * allow drag and drop to start with any mouse click that is propogated
+     * by the browser
+     * @property primaryButtonOnly
+     * @type boolean
+     */
+    primaryButtonOnly: true,
+
+    /**
+     * The availabe property is false until the linked dom element is accessible.
+     * @property available
+     * @type boolean
+     */
+    available: false,
+
+    /**
+     * By default, drags can only be initiated if the mousedown occurs in the
+     * region the linked element is.  This is done in part to work around a
+     * bug in some browsers that mis-report the mousedown if the previous
+     * mouseup happened outside of the window.  This property is set to true
+     * if outer handles are defined.
+     *
+     * @property hasOuterHandles
+     * @type boolean
+     * @default false
+     */
+    hasOuterHandles: false,
+
+    /**
+     * Code that executes immediately before the startDrag event
+     * @method b4StartDrag
+     * @private
+     */
+    b4StartDrag: function(x, y) { },
+
+    /**
+     * Abstract method called after a drag/drop object is clicked
+     * and the drag or mousedown time thresholds have beeen met.
+     * @method startDrag
+     * @param {int} X click location
+     * @param {int} Y click location
+     */
+    startDrag: function(x, y) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDrag event
+     * @method b4Drag
+     * @private
+     */
+    b4Drag: function(e) { },
+
+    /**
+     * Abstract method called during the onMouseMove event while dragging an
+     * object.
+     * @method onDrag
+     * @param {Event} e the mousemove event
+     */
+    onDrag: function(e) { /* override this */ },
+
+    /**
+     * Abstract method called when this element fist begins hovering over
+     * another DragDrop obj
+     * @method onDragEnter
+     * @param {Event} e the mousemove event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this is hovering over.  In INTERSECT mode, an array of one or more
+     * dragdrop items being hovered over.
+     */
+    onDragEnter: function(e, id) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDragOver event
+     * @method b4DragOver
+     * @private
+     */
+    b4DragOver: function(e) { },
+
+    /**
+     * Abstract method called when this element is hovering over another
+     * DragDrop obj
+     * @method onDragOver
+     * @param {Event} e the mousemove event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this is hovering over.  In INTERSECT mode, an array of dd items
+     * being hovered over.
+     */
+    onDragOver: function(e, id) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDragOut event
+     * @method b4DragOut
+     * @private
+     */
+    b4DragOut: function(e) { },
+
+    /**
+     * Abstract method called when we are no longer hovering over an element
+     * @method onDragOut
+     * @param {Event} e the mousemove event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this was hovering over.  In INTERSECT mode, an array of dd items
+     * that the mouse is no longer over.
+     */
+    onDragOut: function(e, id) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the onDragDrop event
+     * @method b4DragDrop
+     * @private
+     */
+    b4DragDrop: function(e) { },
+
+    /**
+     * Abstract method called when this item is dropped on another DragDrop
+     * obj
+     * @method onDragDrop
+     * @param {Event} e the mouseup event
+     * @param {String|DragDrop[]} id In POINT mode, the element
+     * id this was dropped on.  In INTERSECT mode, an array of dd items this
+     * was dropped on.
+     */
+    onDragDrop: function(e, id) { /* override this */ },
+
+    /**
+     * Abstract method called when this item is dropped on an area with no
+     * drop target
+     * @method onInvalidDrop
+     * @param {Event} e the mouseup event
+     */
+    onInvalidDrop: function(e) { /* override this */ },
+
+    /**
+     * Code that executes immediately before the endDrag event
+     * @method b4EndDrag
+     * @private
+     */
+    b4EndDrag: function(e) { },
+
+    /**
+     * Fired when we are done dragging the object
+     * @method endDrag
+     * @param {Event} e the mouseup event
+     */
+    endDrag: function(e) { /* override this */ },
+
+    /**
+     * Code executed immediately before the onMouseDown event
+     * @method b4MouseDown
+     * @param {Event} e the mousedown event
+     * @private
+     */
+    b4MouseDown: function(e) {  },
+
+    /**
+     * Event handler that fires when a drag/drop obj gets a mousedown
+     * @method onMouseDown
+     * @param {Event} e the mousedown event
+     */
+    onMouseDown: function(e) { /* override this */ },
+
+    /**
+     * Event handler that fires when a drag/drop obj gets a mouseup
+     * @method onMouseUp
+     * @param {Event} e the mouseup event
+     */
+    onMouseUp: function(e) { /* override this */ },
+
+    /**
+     * Override the onAvailable method to do what is needed after the initial
+     * position was determined.
+     * @method onAvailable
+     */
+    onAvailable: function () {
+    },
+
+    /**
+     * Provides default constraint padding to "constrainTo" elements (defaults to {left: 0, right:0, top:0, bottom:0}).
+     * @type Object
+     */
+    defaultPadding : {left:0, right:0, top:0, bottom:0},
+
+    /**
+     * Initializes the drag drop object's constraints to restrict movement to a certain element.
+ *
+ * Usage:
+ <pre><code>
+ var dd = new Ext.dd.DDProxy("dragDiv1", "proxytest",
+                { dragElId: "existingProxyDiv" });
+ dd.startDrag = function(){
+     this.constrainTo("parent-id");
+ };
+ </code></pre>
+ * Or you can initalize it using the {@link Ext.Element} object:
+ <pre><code>
+ Ext.get("dragDiv1").initDDProxy("proxytest", {dragElId: "existingProxyDiv"}, {
+     startDrag : function(){
+         this.constrainTo("parent-id");
+     }
+ });
+ </code></pre>
+     * @param {Mixed} constrainTo The element to constrain to.
+     * @param {Object/Number} pad (optional) Pad provides a way to specify "padding" of the constraints,
+     * and can be either a number for symmetrical padding (4 would be equal to {left:4, right:4, top:4, bottom:4}) or
+     * an object containing the sides to pad. For example: {right:10, bottom:10}
+     * @param {Boolean} inContent (optional) Constrain the draggable in the content box of the element (inside padding and borders)
+     */
+    constrainTo : function(constrainTo, pad, inContent){
+        if(typeof pad == "number"){
+            pad = {left: pad, right:pad, top:pad, bottom:pad};
+        }
+        pad = pad || this.defaultPadding;
+        var b = Ext.get(this.getEl()).getBox();
+        var ce = Ext.get(constrainTo);
+        var s = ce.getScroll();
+        var c, cd = ce.dom;
+        if(cd == document.body){
+            c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
+        }else{
+            var xy = ce.getXY();
+            c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
+        }
+
+
+        var topSpace = b.y - c.y;
+        var leftSpace = b.x - c.x;
+
+        this.resetConstraints();
+        this.setXConstraint(leftSpace - (pad.left||0), // left
+                c.width - leftSpace - b.width - (pad.right||0), //right
+                               this.xTickSize
+        );
+        this.setYConstraint(topSpace - (pad.top||0), //top
+                c.height - topSpace - b.height - (pad.bottom||0), //bottom
+                               this.yTickSize
+        );
+    },
+
+    /**
+     * Returns a reference to the linked element
+     * @method getEl
+     * @return {HTMLElement} the html element
+     */
+    getEl: function() {
+        if (!this._domRef) {
+            this._domRef = Ext.getDom(this.id);
+        }
+
+        return this._domRef;
+    },
+
+    /**
+     * Returns a reference to the actual element to drag.  By default this is
+     * the same as the html element, but it can be assigned to another
+     * element. An example of this can be found in Ext.dd.DDProxy
+     * @method getDragEl
+     * @return {HTMLElement} the html element
+     */
+    getDragEl: function() {
+        return Ext.getDom(this.dragElId);
+    },
+
+    /**
+     * Sets up the DragDrop object.  Must be called in the constructor of any
+     * Ext.dd.DragDrop subclass
+     * @method init
+     * @param id the id of the linked element
+     * @param {String} sGroup the group of related items
+     * @param {object} config configuration attributes
+     */
+    init: function(id, sGroup, config) {
+        this.initTarget(id, sGroup, config);
+        Event.on(this.id, "mousedown", this.handleMouseDown, this);
+        // Event.on(this.id, "selectstart", Event.preventDefault);
+    },
+
+    /**
+     * Initializes Targeting functionality only... the object does not
+     * get a mousedown handler.
+     * @method initTarget
+     * @param id the id of the linked element
+     * @param {String} sGroup the group of related items
+     * @param {object} config configuration attributes
+     */
+    initTarget: function(id, sGroup, config) {
+
+        // configuration attributes
+        this.config = config || {};
+
+        // create a local reference to the drag and drop manager
+        this.DDM = Ext.dd.DDM;
+        // initialize the groups array
+        this.groups = {};
+
+        // assume that we have an element reference instead of an id if the
+        // parameter is not a string
+        if (typeof id !== "string") {
+            id = Ext.id(id);
+        }
+
+        // set the id
+        this.id = id;
+
+        // add to an interaction group
+        this.addToGroup((sGroup) ? sGroup : "default");
+
+        // We don't want to register this as the handle with the manager
+        // so we just set the id rather than calling the setter.
+        this.handleElId = id;
+
+        // the linked element is the element that gets dragged by default
+        this.setDragElId(id);
+
+        // by default, clicked anchors will not start drag operations.
+        this.invalidHandleTypes = { A: "A" };
+        this.invalidHandleIds = {};
+        this.invalidHandleClasses = [];
+
+        this.applyConfig();
+
+        this.handleOnAvailable();
+    },
+
+    /**
+     * Applies the configuration parameters that were passed into the constructor.
+     * This is supposed to happen at each level through the inheritance chain.  So
+     * a DDProxy implentation will execute apply config on DDProxy, DD, and
+     * DragDrop in order to get all of the parameters that are available in
+     * each object.
+     * @method applyConfig
+     */
+    applyConfig: function() {
+
+        // configurable properties:
+        //    padding, isTarget, maintainOffset, primaryButtonOnly
+        this.padding           = this.config.padding || [0, 0, 0, 0];
+        this.isTarget          = (this.config.isTarget !== false);
+        this.maintainOffset    = (this.config.maintainOffset);
+        this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);
+
+    },
+
+    /**
+     * Executed when the linked element is available
+     * @method handleOnAvailable
+     * @private
+     */
+    handleOnAvailable: function() {
+        this.available = true;
+        this.resetConstraints();
+        this.onAvailable();
+    },
+
+     /**
+     * Configures the padding for the target zone in px.  Effectively expands
+     * (or reduces) the virtual object size for targeting calculations.
+     * Supports css-style shorthand; if only one parameter is passed, all sides
+     * will have that padding, and if only two are passed, the top and bottom
+     * will have the first param, the left and right the second.
+     * @method setPadding
+     * @param {int} iTop    Top pad
+     * @param {int} iRight  Right pad
+     * @param {int} iBot    Bot pad
+     * @param {int} iLeft   Left pad
+     */
+    setPadding: function(iTop, iRight, iBot, iLeft) {
+        // this.padding = [iLeft, iRight, iTop, iBot];
+        if (!iRight && 0 !== iRight) {
+            this.padding = [iTop, iTop, iTop, iTop];
+        } else if (!iBot && 0 !== iBot) {
+            this.padding = [iTop, iRight, iTop, iRight];
+        } else {
+            this.padding = [iTop, iRight, iBot, iLeft];
+        }
+    },
+
+    /**
+     * Stores the initial placement of the linked element.
+     * @method setInitPosition
+     * @param {int} diffX   the X offset, default 0
+     * @param {int} diffY   the Y offset, default 0
+     */
+    setInitPosition: function(diffX, diffY) {
+        var el = this.getEl();
+
+        if (!this.DDM.verifyEl(el)) {
+            return;
+        }
+
+        var dx = diffX || 0;
+        var dy = diffY || 0;
+
+        var p = Dom.getXY( el );
+
+        this.initPageX = p[0] - dx;
+        this.initPageY = p[1] - dy;
+
+        this.lastPageX = p[0];
+        this.lastPageY = p[1];
+
+
+        this.setStartPosition(p);
+    },
+
+    /**
+     * Sets the start position of the element.  This is set when the obj
+     * is initialized, the reset when a drag is started.
+     * @method setStartPosition
+     * @param pos current position (from previous lookup)
+     * @private
+     */
+    setStartPosition: function(pos) {
+        var p = pos || Dom.getXY( this.getEl() );
+        this.deltaSetXY = null;
+
+        this.startPageX = p[0];
+        this.startPageY = p[1];
+    },
+
+    /**
+     * Add this instance to a group of related drag/drop objects.  All
+     * instances belong to at least one group, and can belong to as many
+     * groups as needed.
+     * @method addToGroup
+     * @param sGroup {string} the name of the group
+     */
+    addToGroup: function(sGroup) {
+        this.groups[sGroup] = true;
+        this.DDM.regDragDrop(this, sGroup);
+    },
+
+    /**
+     * Remove's this instance from the supplied interaction group
+     * @method removeFromGroup
+     * @param {string}  sGroup  The group to drop
+     */
+    removeFromGroup: function(sGroup) {
+        if (this.groups[sGroup]) {
+            delete this.groups[sGroup];
+        }
+
+        this.DDM.removeDDFromGroup(this, sGroup);
+    },
+
+    /**
+     * Allows you to specify that an element other than the linked element
+     * will be moved with the cursor during a drag
+     * @method setDragElId
+     * @param id {string} the id of the element that will be used to initiate the drag
+     */
+    setDragElId: function(id) {
+        this.dragElId = id;
+    },
+
+    /**
+     * Allows you to specify a child of the linked element that should be
+     * used to initiate the drag operation.  An example of this would be if
+     * you have a content div with text and links.  Clicking anywhere in the
+     * content area would normally start the drag operation.  Use this method
+     * to specify that an element inside of the content div is the element
+     * that starts the drag operation.
+     * @method setHandleElId
+     * @param id {string} the id of the element that will be used to
+     * initiate the drag.
+     */
+    setHandleElId: function(id) {
+        if (typeof id !== "string") {
+            id = Ext.id(id);
+        }
+        this.handleElId = id;
+        this.DDM.regHandle(this.id, id);
+    },
+
+    /**
+     * Allows you to set an element outside of the linked element as a drag
+     * handle
+     * @method setOuterHandleElId
+     * @param id the id of the element that will be used to initiate the drag
+     */
+    setOuterHandleElId: function(id) {
+        if (typeof id !== "string") {
+            id = Ext.id(id);
+        }
+        Event.on(id, "mousedown",
+                this.handleMouseDown, this);
+        this.setHandleElId(id);
+
+        this.hasOuterHandles = true;
+    },
+
+    /**
+     * Remove all drag and drop hooks for this element
+     * @method unreg
+     */
+    unreg: function() {
+        Event.un(this.id, "mousedown",
+                this.handleMouseDown);
+        this._domRef = null;
+        this.DDM._remove(this);
+    },
+
+    destroy : function(){
+        this.unreg();
+    },
+
+    /**
+     * Returns true if this instance is locked, or the drag drop mgr is locked
+     * (meaning that all drag/drop is disabled on the page.)
+     * @method isLocked
+     * @return {boolean} true if this obj or all drag/drop is locked, else
+     * false
+     */
+    isLocked: function() {
+        return (this.DDM.isLocked() || this.locked);
+    },
+
+    /**
+     * Fired when this object is clicked
+     * @method handleMouseDown
+     * @param {Event} e
+     * @param {Ext.dd.DragDrop} oDD the clicked dd object (this dd obj)
+     * @private
+     */
+    handleMouseDown: function(e, oDD){
+        if (this.primaryButtonOnly && e.button != 0) {
+            return;
+        }
+
+        if (this.isLocked()) {
+            return;
+        }
+
+        this.DDM.refreshCache(this.groups);
+
+        var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));
+        if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {
+        } else {
+            if (this.clickValidator(e)) {
+
+                // set the initial element position
+                this.setStartPosition();
+
+
+                this.b4MouseDown(e);
+                this.onMouseDown(e);
+
+                this.DDM.handleMouseDown(e, this);
+
+                this.DDM.stopEvent(e);
+            } else {
+
+
+            }
+        }
+    },
+
+    clickValidator: function(e) {
+        var target = e.getTarget();
+        return ( this.isValidHandleChild(target) &&
+                    (this.id == this.handleElId ||
+                        this.DDM.handleWasClicked(target, this.id)) );
+    },
+
+    /**
+     * Allows you to specify a tag name that should not start a drag operation
+     * when clicked.  This is designed to facilitate embedding links within a
+     * drag handle that do something other than start the drag.
+     * @method addInvalidHandleType
+     * @param {string} tagName the type of element to exclude
+     */
+    addInvalidHandleType: function(tagName) {
+        var type = tagName.toUpperCase();
+        this.invalidHandleTypes[type] = type;
+    },
+
+    /**
+     * Lets you to specify an element id for a child of a drag handle
+     * that should not initiate a drag
+     * @method addInvalidHandleId
+     * @param {string} id the element id of the element you wish to ignore
+     */
+    addInvalidHandleId: function(id) {
+        if (typeof id !== "string") {
+            id = Ext.id(id);
+        }
+        this.invalidHandleIds[id] = id;
+    },
+
+    /**
+     * Lets you specify a css class of elements that will not initiate a drag
+     * @method addInvalidHandleClass
+     * @param {string} cssClass the class of the elements you wish to ignore
+     */
+    addInvalidHandleClass: function(cssClass) {
+        this.invalidHandleClasses.push(cssClass);
+    },
+
+    /**
+     * Unsets an excluded tag name set by addInvalidHandleType
+     * @method removeInvalidHandleType
+     * @param {string} tagName the type of element to unexclude
+     */
+    removeInvalidHandleType: function(tagName) {
+        var type = tagName.toUpperCase();
+        // this.invalidHandleTypes[type] = null;
+        delete this.invalidHandleTypes[type];
+    },
+
+    /**
+     * Unsets an invalid handle id
+     * @method removeInvalidHandleId
+     * @param {string} id the id of the element to re-enable
+     */
+    removeInvalidHandleId: function(id) {
+        if (typeof id !== "string") {
+            id = Ext.id(id);
+        }
+        delete this.invalidHandleIds[id];
+    },
+
+    /**
+     * Unsets an invalid css class
+     * @method removeInvalidHandleClass
+     * @param {string} cssClass the class of the element(s) you wish to
+     * re-enable
+     */
+    removeInvalidHandleClass: function(cssClass) {
+        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {
+            if (this.invalidHandleClasses[i] == cssClass) {
+                delete this.invalidHandleClasses[i];
+            }
+        }
+    },
+
+    /**
+     * Checks the tag exclusion list to see if this click should be ignored
+     * @method isValidHandleChild
+     * @param {HTMLElement} node the HTMLElement to evaluate
+     * @return {boolean} true if this is a valid tag type, false if not
+     */
+    isValidHandleChild: function(node) {
+
+        var valid = true;
+        // var n = (node.nodeName == "#text") ? node.parentNode : node;
+        var nodeName;
+        try {
+            nodeName = node.nodeName.toUpperCase();
+        } catch(e) {
+            nodeName = node.nodeName;
+        }
+        valid = valid && !this.invalidHandleTypes[nodeName];
+        valid = valid && !this.invalidHandleIds[node.id];
+
+        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {
+            valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);
+        }
+
+
+        return valid;
+
+    },
+
+    /**
+     * Create the array of horizontal tick marks if an interval was specified
+     * in setXConstraint().
+     * @method setXTicks
+     * @private
+     */
+    setXTicks: function(iStartX, iTickSize) {
+        this.xTicks = [];
+        this.xTickSize = iTickSize;
+
+        var tickMap = {};
+
+        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {
+            if (!tickMap[i]) {
+                this.xTicks[this.xTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {
+            if (!tickMap[i]) {
+                this.xTicks[this.xTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        this.xTicks.sort(this.DDM.numericSort) ;
+    },
+
+    /**
+     * Create the array of vertical tick marks if an interval was specified in
+     * setYConstraint().
+     * @method setYTicks
+     * @private
+     */
+    setYTicks: function(iStartY, iTickSize) {
+        this.yTicks = [];
+        this.yTickSize = iTickSize;
+
+        var tickMap = {};
+
+        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {
+            if (!tickMap[i]) {
+                this.yTicks[this.yTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {
+            if (!tickMap[i]) {
+                this.yTicks[this.yTicks.length] = i;
+                tickMap[i] = true;
+            }
+        }
+
+        this.yTicks.sort(this.DDM.numericSort) ;
+    },
+
+    /**
+     * By default, the element can be dragged any place on the screen.  Use
+     * this method to limit the horizontal travel of the element.  Pass in
+     * 0,0 for the parameters if you want to lock the drag to the y axis.
+     * @method setXConstraint
+     * @param {int} iLeft the number of pixels the element can move to the left
+     * @param {int} iRight the number of pixels the element can move to the
+     * right
+     * @param {int} iTickSize optional parameter for specifying that the
+     * element
+     * should move iTickSize pixels at a time.
+     */
+    setXConstraint: function(iLeft, iRight, iTickSize) {
+        this.leftConstraint = iLeft;
+        this.rightConstraint = iRight;
+
+        this.minX = this.initPageX - iLeft;
+        this.maxX = this.initPageX + iRight;
+        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }
+
+        this.constrainX = true;
+    },
+
+    /**
+     * Clears any constraints applied to this instance.  Also clears ticks
+     * since they can't exist independent of a constraint at this time.
+     * @method clearConstraints
+     */
+    clearConstraints: function() {
+        this.constrainX = false;
+        this.constrainY = false;
+        this.clearTicks();
+    },
+
+    /**
+     * Clears any tick interval defined for this instance
+     * @method clearTicks
+     */
+    clearTicks: function() {
+        this.xTicks = null;
+        this.yTicks = null;
+        this.xTickSize = 0;
+        this.yTickSize = 0;
+    },
+
+    /**
+     * By default, the element can be dragged any place on the screen.  Set
+     * this to limit the vertical travel of the element.  Pass in 0,0 for the
+     * parameters if you want to lock the drag to the x axis.
+     * @method setYConstraint
+     * @param {int} iUp the number of pixels the element can move up
+     * @param {int} iDown the number of pixels the element can move down
+     * @param {int} iTickSize optional parameter for specifying that the
+     * element should move iTickSize pixels at a time.
+     */
+    setYConstraint: function(iUp, iDown, iTickSize) {
+        this.topConstraint = iUp;
+        this.bottomConstraint = iDown;
+
+        this.minY = this.initPageY - iUp;
+        this.maxY = this.initPageY + iDown;
+        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }
+
+        this.constrainY = true;
+
+    },
+
+    /**
+     * resetConstraints must be called if you manually reposition a dd element.
+     * @method resetConstraints
+     * @param {boolean} maintainOffset
+     */
+    resetConstraints: function() {
+
+
+        // Maintain offsets if necessary
+        if (this.initPageX || this.initPageX === 0) {
+            // figure out how much this thing has moved
+            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;
+            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;
+
+            this.setInitPosition(dx, dy);
+
+        // This is the first time we have detected the element's position
+        } else {
+            this.setInitPosition();
+        }
+
+        if (this.constrainX) {
+            this.setXConstraint( this.leftConstraint,
+                                 this.rightConstraint,
+                                 this.xTickSize        );
+        }
+
+        if (this.constrainY) {
+            this.setYConstraint( this.topConstraint,
+                                 this.bottomConstraint,
+                                 this.yTickSize         );
+        }
+    },
+
+    /**
+     * Normally the drag element is moved pixel by pixel, but we can specify
+     * that it move a number of pixels at a time.  This method resolves the
+     * location when we have it set up like this.
+     * @method getTick
+     * @param {int} val where we want to place the object
+     * @param {int[]} tickArray sorted array of valid points
+     * @return {int} the closest tick
+     * @private
+     */
+    getTick: function(val, tickArray) {
+
+        if (!tickArray) {
+            // If tick interval is not defined, it is effectively 1 pixel,
+            // so we return the value passed to us.
+            return val;
+        } else if (tickArray[0] >= val) {
+            // The value is lower than the first tick, so we return the first
+            // tick.
+            return tickArray[0];
+        } else {
+            for (var i=0, len=tickArray.length; i<len; ++i) {
+                var next = i + 1;
+                if (tickArray[next] && tickArray[next] >= val) {
+                    var diff1 = val - tickArray[i];
+                    var diff2 = tickArray[next] - val;
+                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];
+                }
+            }
+
+            // The value is larger than the last tick, so we return the last
+            // tick.
+            return tickArray[tickArray.length - 1];
+        }
+    },
+
+    /**
+     * toString method
+     * @method toString
+     * @return {string} string representation of the dd obj
+     */
+    toString: function() {
+        return ("DragDrop " + this.id);
+    }
+
+};
+
+})();
+/**
+ * The drag and drop utility provides a framework for building drag and drop
+ * applications.  In addition to enabling drag and drop for specific elements,
+ * the drag and drop elements are tracked by the manager class, and the
+ * interactions between the various elements are tracked during the drag and
+ * the implementing code is notified about these important moments.
+ */
+
+// Only load the library once.  Rewriting the manager class would orphan
+// existing drag and drop instances.
+if (!Ext.dd.DragDropMgr) {
+
+/**
+ * @class Ext.dd.DragDropMgr
+ * DragDropMgr is a singleton that tracks the element interaction for
+ * all DragDrop items in the window.  Generally, you will not call
+ * this class directly, but it does have helper methods that could
+ * be useful in your DragDrop implementations.
+ * @singleton
+ */
+Ext.dd.DragDropMgr = function() {
+
+    var Event = Ext.EventManager;
+
+    return {
+
+        /**
+         * Two dimensional Array of registered DragDrop objects.  The first
+         * dimension is the DragDrop item group, the second the DragDrop
+         * object.
+         * @property ids
+         * @type {string: string}
+         * @private
+         * @static
+         */
+        ids: {},
+
+        /**
+         * Array of element ids defined as drag handles.  Used to determine
+         * if the element that generated the mousedown event is actually the
+         * handle and not the html element itself.
+         * @property handleIds
+         * @type {string: string}
+         * @private
+         * @static
+         */
+        handleIds: {},
+
+        /**
+         * the DragDrop object that is currently being dragged
+         * @property dragCurrent
+         * @type DragDrop
+         * @private
+         * @static
+         **/
+        dragCurrent: null,
+
+        /**
+         * the DragDrop object(s) that are being hovered over
+         * @property dragOvers
+         * @type Array
+         * @private
+         * @static
+         */
+        dragOvers: {},
+
+        /**
+         * the X distance between the cursor and the object being dragged
+         * @property deltaX
+         * @type int
+         * @private
+         * @static
+         */
+        deltaX: 0,
+
+        /**
+         * the Y distance between the cursor and the object being dragged
+         * @property deltaY
+         * @type int
+         * @private
+         * @static
+         */
+        deltaY: 0,
+
+        /**
+         * Flag to determine if we should prevent the default behavior of the
+         * events we define. By default this is true, but this can be set to
+         * false if you need the default behavior (not recommended)
+         * @property preventDefault
+         * @type boolean
+         * @static
+         */
+        preventDefault: true,
+
+        /**
+         * Flag to determine if we should stop the propagation of the events
+         * we generate. This is true by default but you may want to set it to
+         * false if the html element contains other features that require the
+         * mouse click.
+         * @property stopPropagation
+         * @type boolean
+         * @static
+         */
+        stopPropagation: true,
+
+        /**
+         * Internal flag that is set to true when drag and drop has been
+         * intialized
+         * @property initialized
+         * @private
+         * @static
+         */
+        initialized: false,
+
+        /**
+         * All drag and drop can be disabled.
+         * @property locked
+         * @private
+         * @static
+         */
+        locked: false,
+
+        /**
+         * Called the first time an element is registered.
+         * @method init
+         * @private
+         * @static
+         */
+        init: function() {
+            this.initialized = true;
+        },
+
+        /**
+         * In point mode, drag and drop interaction is defined by the
+         * location of the cursor during the drag/drop
+         * @property POINT
+         * @type int
+         * @static
+         */
+        POINT: 0,
+
+        /**
+         * In intersect mode, drag and drop interaction is defined by the
+         * overlap of two or more drag and drop objects.
+         * @property INTERSECT
+         * @type int
+         * @static
+         */
+        INTERSECT: 1,
+
+        /**
+         * The current drag and drop mode.  Default: POINT
+         * @property mode
+         * @type int
+         * @static
+         */
+        mode: 0,
+
+        /**
+         * Runs method on all drag and drop objects
+         * @method _execOnAll
+         * @private
+         * @static
+         */
+        _execOnAll: function(sMethod, args) {
+            for (var i in this.ids) {
+                for (var j in this.ids[i]) {
+                    var oDD = this.ids[i][j];
+                    if (! this.isTypeOfDD(oDD)) {
+                        continue;
+                    }
+                    oDD[sMethod].apply(oDD, args);
+                }
+            }
+        },
+
+        /**
+         * Drag and drop initialization.  Sets up the global event handlers
+         * @method _onLoad
+         * @private
+         * @static
+         */
+        _onLoad: function() {
+
+            this.init();
+
+
+            Event.on(document, "mouseup",   this.handleMouseUp, this, true);
+            Event.on(document, "mousemove", this.handleMouseMove, this, true);
+            Event.on(window,   "unload",    this._onUnload, this, true);
+            Event.on(window,   "resize",    this._onResize, this, true);
+            // Event.on(window,   "mouseout",    this._test);
+
+        },
+
+        /**
+         * Reset constraints on all drag and drop objs
+         * @method _onResize
+         * @private
+         * @static
+         */
+        _onResize: function(e) {
+            this._execOnAll("resetConstraints", []);
+        },
+
+        /**
+         * Lock all drag and drop functionality
+         * @method lock
+         * @static
+         */
+        lock: function() { this.locked = true; },
+
+        /**
+         * Unlock all drag and drop functionality
+         * @method unlock
+         * @static
+         */
+        unlock: function() { this.locked = false; },
+
+        /**
+         * Is drag and drop locked?
+         * @method isLocked
+         * @return {boolean} True if drag and drop is locked, false otherwise.
+         * @static
+         */
+        isLocked: function() { return this.locked; },
+
+        /**
+         * Location cache that is set for all drag drop objects when a drag is
+         * initiated, cleared when the drag is finished.
+         * @property locationCache
+         * @private
+         * @static
+         */
+        locationCache: {},
+
+        /**
+         * Set useCache to false if you want to force object the lookup of each
+         * drag and drop linked element constantly during a drag.
+         * @property useCache
+         * @type boolean
+         * @static
+         */
+        useCache: true,
+
+        /**
+         * The number of pixels that the mouse needs to move after the
+         * mousedown before the drag is initiated.  Default=3;
+         * @property clickPixelThresh
+         * @type int
+         * @static
+         */
+        clickPixelThresh: 3,
+
+        /**
+         * The number of milliseconds after the mousedown event to initiate the
+         * drag if we don't get a mouseup event. Default=1000
+         * @property clickTimeThresh
+         * @type int
+         * @static
+         */
+        clickTimeThresh: 350,
+
+        /**
+         * Flag that indicates that either the drag pixel threshold or the
+         * mousdown time threshold has been met
+         * @property dragThreshMet
+         * @type boolean
+         * @private
+         * @static
+         */
+        dragThreshMet: false,
+
+        /**
+         * Timeout used for the click time threshold
+         * @property clickTimeout
+         * @type Object
+         * @private
+         * @static
+         */
+        clickTimeout: null,
+
+        /**
+         * The X position of the mousedown event stored for later use when a
+         * drag threshold is met.
+         * @property startX
+         * @type int
+         * @private
+         * @static
+         */
+        startX: 0,
+
+        /**
+         * The Y position of the mousedown event stored for later use when a
+         * drag threshold is met.
+         * @property startY
+         * @type int
+         * @private
+         * @static
+         */
+        startY: 0,
+
+        /**
+         * Each DragDrop instance must be registered with the DragDropMgr.
+         * This is executed in DragDrop.init()
+         * @method regDragDrop
+         * @param {DragDrop} oDD the DragDrop object to register
+         * @param {String} sGroup the name of the group this element belongs to
+         * @static
+         */
+        regDragDrop: function(oDD, sGroup) {
+            if (!this.initialized) { this.init(); }
+
+            if (!this.ids[sGroup]) {
+                this.ids[sGroup] = {};
+            }
+            this.ids[sGroup][oDD.id] = oDD;
+        },
+
+        /**
+         * Removes the supplied dd instance from the supplied group. Executed
+         * by DragDrop.removeFromGroup, so don't call this function directly.
+         * @method removeDDFromGroup
+         * @private
+         * @static
+         */
+        removeDDFromGroup: function(oDD, sGroup) {
+            if (!this.ids[sGroup]) {
+                this.ids[sGroup] = {};
+            }
+
+            var obj = this.ids[sGroup];
+            if (obj && obj[oDD.id]) {
+                delete obj[oDD.id];
+            }
+        },
+
+        /**
+         * Unregisters a drag and drop item.  This is executed in
+         * DragDrop.unreg, use that method instead of calling this directly.
+         * @method _remove
+         * @private
+         * @static
+         */
+        _remove: function(oDD) {
+            for (var g in oDD.groups) {
+                if (g && this.ids[g] && this.ids[g][oDD.id]) {
+                    delete this.ids[g][oDD.id];
+                }
+            }
+            delete this.handleIds[oDD.id];
+        },
+
+        /**
+         * Each DragDrop handle element must be registered.  This is done
+         * automatically when executing DragDrop.setHandleElId()
+         * @method regHandle
+         * @param {String} sDDId the DragDrop id this element is a handle for
+         * @param {String} sHandleId the id of the element that is the drag
+         * handle
+         * @static
+         */
+        regHandle: function(sDDId, sHandleId) {
+            if (!this.handleIds[sDDId]) {
+                this.handleIds[sDDId] = {};
+            }
+            this.handleIds[sDDId][sHandleId] = sHandleId;
+        },
+
+        /**
+         * Utility function to determine if a given element has been
+         * registered as a drag drop item.
+         * @method isDragDrop
+         * @param {String} id the element id to check
+         * @return {boolean} true if this element is a DragDrop item,
+         * false otherwise
+         * @static
+         */
+        isDragDrop: function(id) {
+            return ( this.getDDById(id) ) ? true : false;
+        },
+
+        /**
+         * Returns the drag and drop instances that are in all groups the
+         * passed in instance belongs to.
+         * @method getRelated
+         * @param {DragDrop} p_oDD the obj to get related data for
+         * @param {boolean} bTargetsOnly if true, only return targetable objs
+         * @return {DragDrop[]} the related instances
+         * @static
+         */
+        getRelated: function(p_oDD, bTargetsOnly) {
+            var oDDs = [];
+            for (var i in p_oDD.groups) {
+                for (var j in this.ids[i]) {
+                    var dd = this.ids[i][j];
+                    if (! this.isTypeOfDD(dd)) {
+                        continue;
+                    }
+                    if (!bTargetsOnly || dd.isTarget) {
+                        oDDs[oDDs.length] = dd;
+                    }
+                }
+            }
+
+            return oDDs;
+        },
+
+        /**
+         * Returns true if the specified dd target is a legal target for
+         * the specifice drag obj
+         * @method isLegalTarget
+         * @param {DragDrop} the drag obj
+         * @param {DragDrop} the target
+         * @return {boolean} true if the target is a legal target for the
+         * dd obj
+         * @static
+         */
+        isLegalTarget: function (oDD, oTargetDD) {
+            var targets = this.getRelated(oDD, true);
+            for (var i=0, len=targets.length;i<len;++i) {
+                if (targets[i].id == oTargetDD.id) {
+                    return true;
+                }
+            }
+
+            return false;
+        },
+
+        /**
+         * My goal is to be able to transparently determine if an object is
+         * typeof DragDrop, and the exact subclass of DragDrop.  typeof
+         * returns "object", oDD.constructor.toString() always returns
+         * "DragDrop" and not the name of the subclass.  So for now it just
+         * evaluates a well-known variable in DragDrop.
+         * @method isTypeOfDD
+         * @param {Object} the object to evaluate
+         * @return {boolean} true if typeof oDD = DragDrop
+         * @static
+         */
+        isTypeOfDD: function (oDD) {
+            return (oDD && oDD.__ygDragDrop);
+        },
+
+        /**
+         * Utility function to determine if a given element has been
+         * registered as a drag drop handle for the given Drag Drop object.
+         * @method isHandle
+         * @param {String} id the element id to check
+         * @return {boolean} true if this element is a DragDrop handle, false
+         * otherwise
+         * @static
+         */
+        isHandle: function(sDDId, sHandleId) {
+            return ( this.handleIds[sDDId] &&
+                            this.handleIds[sDDId][sHandleId] );
+        },
+
+        /**
+         * Returns the DragDrop instance for a given id
+         * @method getDDById
+         * @param {String} id the id of the DragDrop object
+         * @return {DragDrop} the drag drop object, null if it is not found
+         * @static
+         */
+        getDDById: function(id) {
+            for (var i in this.ids) {
+                if (this.ids[i][id]) {
+                    return this.ids[i][id];
+                }
+            }
+            return null;
+        },
+
+        /**
+         * Fired after a registered DragDrop object gets the mousedown event.
+         * Sets up the events required to track the object being dragged
+         * @method handleMouseDown
+         * @param {Event} e the event
+         * @param oDD the DragDrop object being dragged
+         * @private
+         * @static
+         */
+        handleMouseDown: function(e, oDD) {
+            if(Ext.QuickTips){
+                Ext.QuickTips.disable();
+            }
+            if(this.dragCurrent){
+                // the original browser mouseup wasn't handled (e.g. outside FF browser window)
+                // so clean up first to avoid breaking the next drag
+                this.handleMouseUp(e);
+            }
+            
+            this.currentTarget = e.getTarget();
+            this.dragCurrent = oDD;
+
+            var el = oDD.getEl();
+
+            // track start position
+            this.startX = e.getPageX();
+            this.startY = e.getPageY();
+
+            this.deltaX = this.startX - el.offsetLeft;
+            this.deltaY = this.startY - el.offsetTop;
+
+            this.dragThreshMet = false;
+
+            this.clickTimeout = setTimeout(
+                    function() {
+                        var DDM = Ext.dd.DDM;
+                        DDM.startDrag(DDM.startX, DDM.startY);
+                    },
+                    this.clickTimeThresh );
+        },
+
+        /**
+         * Fired when either the drag pixel threshol or the mousedown hold
+         * time threshold has been met.
+         * @method startDrag
+         * @param x {int} the X position of the original mousedown
+         * @param y {int} the Y position of the original mousedown
+         * @static
+         */
+        startDrag: function(x, y) {
+            clearTimeout(this.clickTimeout);
+            if (this.dragCurrent) {
+                this.dragCurrent.b4StartDrag(x, y);
+                this.dragCurrent.startDrag(x, y);
+            }
+            this.dragThreshMet = true;
+        },
+
+        /**
+         * Internal function to handle the mouseup event.  Will be invoked
+         * from the context of the document.
+         * @method handleMouseUp
+         * @param {Event} e the event
+         * @private
+         * @static
+         */
+        handleMouseUp: function(e) {
+
+            if(Ext.QuickTips){
+                Ext.QuickTips.enable();
+            }
+            if (! this.dragCurrent) {
+                return;
+            }
+
+            clearTimeout(this.clickTimeout);
+
+            if (this.dragThreshMet) {
+                this.fireEvents(e, true);
+            } else {
+            }
+
+            this.stopDrag(e);
+
+            this.stopEvent(e);
+        },
+
+        /**
+         * Utility to stop event propagation and event default, if these
+         * features are turned on.
+         * @method stopEvent
+         * @param {Event} e the event as returned by this.getEvent()
+         * @static
+         */
+        stopEvent: function(e){
+            if(this.stopPropagation) {
+                e.stopPropagation();
+            }
+
+            if (this.preventDefault) {
+                e.preventDefault();
+            }
+        },
+
+        /**
+         * Internal function to clean up event handlers after the drag
+         * operation is complete
+         * @method stopDrag
+         * @param {Event} e the event
+         * @private
+         * @static
+         */
+        stopDrag: function(e) {
+            // Fire the drag end event for the item that was dragged
+            if (this.dragCurrent) {
+                if (this.dragThreshMet) {
+                    this.dragCurrent.b4EndDrag(e);
+                    this.dragCurrent.endDrag(e);
+                }
+
+                this.dragCurrent.onMouseUp(e);
+            }
+
+            this.dragCurrent = null;
+            this.dragOvers = {};
+        },
+
+        /**
+         * Internal function to handle the mousemove event.  Will be invoked
+         * from the context of the html element.
+         *
+         * @TODO figure out what we can do about mouse events lost when the
+         * user drags objects beyond the window boundary.  Currently we can
+         * detect this in internet explorer by verifying that the mouse is
+         * down during the mousemove event.  Firefox doesn't give us the
+         * button state on the mousemove event.
+         * @method handleMouseMove
+         * @param {Event} e the event
+         * @private
+         * @static
+         */
+        handleMouseMove: function(e) {
+            if (! this.dragCurrent) {
+                return true;
+            }
+            // var button = e.which || e.button;
+
+            // check for IE mouseup outside of page boundary
+            if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {
+                this.stopEvent(e);
+                return this.handleMouseUp(e);
+            }
+
+            if (!this.dragThreshMet) {
+                var diffX = Math.abs(this.startX - e.getPageX());
+                var diffY = Math.abs(this.startY - e.getPageY());
+                if (diffX > this.clickPixelThresh ||
+                            diffY > this.clickPixelThresh) {
+                    this.startDrag(this.startX, this.startY);
+                }
+            }
+
+            if (this.dragThreshMet) {
+                this.dragCurrent.b4Drag(e);
+                this.dragCurrent.onDrag(e);
+                if(!this.dragCurrent.moveOnly){
+                    this.fireEvents(e, false);
+                }
+            }
+
+            this.stopEvent(e);
+
+            return true;
+        },
+
+        /**
+         * Iterates over all of the DragDrop elements to find ones we are
+         * hovering over or dropping on
+         * @method fireEvents
+         * @param {Event} e the event
+         * @param {boolean} isDrop is this a drop op or a mouseover op?
+         * @private
+         * @static
+         */
+        fireEvents: function(e, isDrop) {
+            var dc = this.dragCurrent;
+
+            // If the user did the mouse up outside of the window, we could
+            // get here even though we have ended the drag.
+            if (!dc || dc.isLocked()) {
+                return;
+            }
+
+            var pt = e.getPoint();
+
+            // cache the previous dragOver array
+            var oldOvers = [];
+
+            var outEvts   = [];
+            var overEvts  = [];
+            var dropEvts  = [];
+            var enterEvts = [];
+
+            // Check to see if the object(s) we were hovering over is no longer
+            // being hovered over so we can fire the onDragOut event
+            for (var i in this.dragOvers) {
+
+                var ddo = this.dragOvers[i];
+
+                if (! this.isTypeOfDD(ddo)) {
+                    continue;
+                }
+
+                if (! this.isOverTarget(pt, ddo, this.mode)) {
+                    outEvts.push( ddo );
+                }
+
+                oldOvers[i] = true;
+                delete this.dragOvers[i];
+            }
+
+            for (var sGroup in dc.groups) {
+
+                if ("string" != typeof sGroup) {
+                    continue;
+                }
+
+                for (i in this.ids[sGroup]) {
+                    var oDD = this.ids[sGroup][i];
+                    if (! this.isTypeOfDD(oDD)) {
+                        continue;
+                    }
+
+                    if (oDD.isTarget && !oDD.isLocked() && ((oDD != dc) || (dc.ignoreSelf === false))) {
+                        if (this.isOverTarget(pt, oDD, this.mode)) {
+                            // look for drop interactions
+                            if (isDrop) {
+                                dropEvts.push( oDD );
+                            // look for drag enter and drag over interactions
+                            } else {
+
+                                // initial drag over: dragEnter fires
+                                if (!oldOvers[oDD.id]) {
+                                    enterEvts.push( oDD );
+                                // subsequent drag overs: dragOver fires
+                                } else {
+                                    overEvts.push( oDD );
+                                }
+
+                                this.dragOvers[oDD.id] = oDD;
+                            }
+                        }
+                    }
+                }
+            }
+
+            if (this.mode) {
+                if (outEvts.length) {
+                    dc.b4DragOut(e, outEvts);
+                    dc.onDragOut(e, outEvts);
+                }
+
+                if (enterEvts.length) {
+                    dc.onDragEnter(e, enterEvts);
+                }
+
+                if (overEvts.length) {
+                    dc.b4DragOver(e, overEvts);
+                    dc.onDragOver(e, overEvts);
+                }
+
+                if (dropEvts.length) {
+                    dc.b4DragDrop(e, dropEvts);
+                    dc.onDragDrop(e, dropEvts);
+                }
+
+            } else {
+                // fire dragout events
+                var len = 0;
+                for (i=0, len=outEvts.length; i<len; ++i) {
+                    dc.b4DragOut(e, outEvts[i].id);
+                    dc.onDragOut(e, outEvts[i].id);
+                }
+
+                // fire enter events
+                for (i=0,len=enterEvts.length; i<len; ++i) {
+                    // dc.b4DragEnter(e, oDD.id);
+                    dc.onDragEnter(e, enterEvts[i].id);
+                }
+
+                // fire over events
+                for (i=0,len=overEvts.length; i<len; ++i) {
+                    dc.b4DragOver(e, overEvts[i].id);
+                    dc.onDragOver(e, overEvts[i].id);
+                }
+
+                // fire drop events
+                for (i=0, len=dropEvts.length; i<len; ++i) {
+                    dc.b4DragDrop(e, dropEvts[i].id);
+                    dc.onDragDrop(e, dropEvts[i].id);
+                }
+
+            }
+
+            // notify about a drop that did not find a target
+            if (isDrop && !dropEvts.length) {
+                dc.onInvalidDrop(e);
+            }
+
+        },
+
+        /**
+         * Helper function for getting the best match from the list of drag
+         * and drop objects returned by the drag and drop events when we are
+         * in INTERSECT mode.  It returns either the first object that the
+         * cursor is over, or the object that has the greatest overlap with
+         * the dragged element.
+         * @method getBestMatch
+         * @param  {DragDrop[]} dds The array of drag and drop objects
+         * targeted
+         * @return {DragDrop}       The best single match
+         * @static
+         */
+        getBestMatch: function(dds) {
+            var winner = null;
+            // Return null if the input is not what we expect
+            //if (!dds || !dds.length || dds.length == 0) {
+               // winner = null;
+            // If there is only one item, it wins
+            //} else if (dds.length == 1) {
+
+            var len = dds.length;
+
+            if (len == 1) {
+                winner = dds[0];
+            } else {
+                // Loop through the targeted items
+                for (var i=0; i<len; ++i) {
+                    var dd = dds[i];
+                    // If the cursor is over the object, it wins.  If the
+                    // cursor is over multiple matches, the first one we come
+                    // to wins.
+                    if (dd.cursorIsOver) {
+                        winner = dd;
+                        break;
+                    // Otherwise the object with the most overlap wins
+                    } else {
+                        if (!winner ||
+                            winner.overlap.getArea() < dd.overlap.getArea()) {
+                            winner = dd;
+                        }
+                    }
+                }
+            }
+
+            return winner;
+        },
+
+        /**
+         * Refreshes the cache of the top-left and bottom-right points of the
+         * drag and drop objects in the specified group(s).  This is in the
+         * format that is stored in the drag and drop instance, so typical
+         * usage is:
+         * <code>
+         * Ext.dd.DragDropMgr.refreshCache(ddinstance.groups);
+         * </code>
+         * Alternatively:
+         * <code>
+         * Ext.dd.DragDropMgr.refreshCache({group1:true, group2:true});
+         * </code>
+         * @TODO this really should be an indexed array.  Alternatively this
+         * method could accept both.
+         * @method refreshCache
+         * @param {Object} groups an associative array of groups to refresh
+         * @static
+         */
+        refreshCache: function(groups) {
+            for (var sGroup in groups) {
+                if ("string" != typeof sGroup) {
+                    continue;
+                }
+                for (var i in this.ids[sGroup]) {
+                    var oDD = this.ids[sGroup][i];
+
+                    if (this.isTypeOfDD(oDD)) {
+                    // if (this.isTypeOfDD(oDD) && oDD.isTarget) {
+                        var loc = this.getLocation(oDD);
+                        if (loc) {
+                            this.locationCache[oDD.id] = loc;
+                        } else {
+                            delete this.locationCache[oDD.id];
+                            // this will unregister the drag and drop object if
+                            // the element is not in a usable state
+                            // oDD.unreg();
+                        }
+                    }
+                }
+            }
+        },
+
+        /**
+         * This checks to make sure an element exists and is in the DOM.  The
+         * main purpose is to handle cases where innerHTML is used to remove
+         * drag and drop objects from the DOM.  IE provides an 'unspecified
+         * error' when trying to access the offsetParent of such an element
+         * @method verifyEl
+         * @param {HTMLElement} el the element to check
+         * @return {boolean} true if the element looks usable
+         * @static
+         */
+        verifyEl: function(el) {
+            if (el) {
+                var parent;
+                if(Ext.isIE){
+                    try{
+                        parent = el.offsetParent;
+                    }catch(e){}
+                }else{
+                    parent = el.offsetParent;
+                }
+                if (parent) {
+                    return true;
+                }
+            }
+
+            return false;
+        },
+
+        /**
+         * Returns a Region object containing the drag and drop element's position
+         * and size, including the padding configured for it
+         * @method getLocation
+         * @param {DragDrop} oDD the drag and drop object to get the
+         *                       location for
+         * @return {Ext.lib.Region} a Region object representing the total area
+         *                             the element occupies, including any padding
+         *                             the instance is configured for.
+         * @static
+         */
+        getLocation: function(oDD) {
+            if (! this.isTypeOfDD(oDD)) {
+                return null;
+            }
+
+            var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;
+
+            try {
+                pos= Ext.lib.Dom.getXY(el);
+            } catch (e) { }
+
+            if (!pos) {
+                return null;
+            }
+
+            x1 = pos[0];
+            x2 = x1 + el.offsetWidth;
+            y1 = pos[1];
+            y2 = y1 + el.offsetHeight;
+
+            t = y1 - oDD.padding[0];
+            r = x2 + oDD.padding[1];
+            b = y2 + oDD.padding[2];
+            l = x1 - oDD.padding[3];
+
+            return new Ext.lib.Region( t, r, b, l );
+        },
+
+        /**
+         * Checks the cursor location to see if it over the target
+         * @method isOverTarget
+         * @param {Ext.lib.Point} pt The point to evaluate
+         * @param {DragDrop} oTarget the DragDrop object we are inspecting
+         * @return {boolean} true if the mouse is over the target
+         * @private
+         * @static
+         */
+        isOverTarget: function(pt, oTarget, intersect) {
+            // use cache if available
+            var loc = this.locationCache[oTarget.id];
+            if (!loc || !this.useCache) {
+                loc = this.getLocation(oTarget);
+                this.locationCache[oTarget.id] = loc;
+
+            }
+
+            if (!loc) {
+                return false;
+            }
+
+            oTarget.cursorIsOver = loc.contains( pt );
+
+            // DragDrop is using this as a sanity check for the initial mousedown
+            // in this case we are done.  In POINT mode, if the drag obj has no
+            // contraints, we are also done. Otherwise we need to evaluate the
+            // location of the target as related to the actual location of the
+            // dragged element.
+            var dc = this.dragCurrent;
+            if (!dc || !dc.getTargetCoord ||
+                    (!intersect && !dc.constrainX && !dc.constrainY)) {
+                return oTarget.cursorIsOver;
+            }
+
+            oTarget.overlap = null;
+
+            // Get the current location of the drag element, this is the
+            // location of the mouse event less the delta that represents
+            // where the original mousedown happened on the element.  We
+            // need to consider constraints and ticks as well.
+            var pos = dc.getTargetCoord(pt.x, pt.y);
+
+            var el = dc.getDragEl();
+            var curRegion = new Ext.lib.Region( pos.y,
+                                                   pos.x + el.offsetWidth,
+                                                   pos.y + el.offsetHeight,
+                                                   pos.x );
+
+            var overlap = curRegion.intersect(loc);
+
+            if (overlap) {
+                oTarget.overlap = overlap;
+                return (intersect) ? true : oTarget.cursorIsOver;
+            } else {
+                return false;
+            }
+        },
+
+        /**
+         * unload event handler
+         * @method _onUnload
+         * @private
+         * @static
+         */
+        _onUnload: function(e, me) {
+            Ext.dd.DragDropMgr.unregAll();
+        },
+
+        /**
+         * Cleans up the drag and drop events and objects.
+         * @method unregAll
+         * @private
+         * @static
+         */
+        unregAll: function() {
+
+            if (this.dragCurrent) {
+                this.stopDrag();
+                this.dragCurrent = null;
+            }
+
+            this._execOnAll("unreg", []);
+
+            for (var i in this.elementCache) {
+                delete this.elementCache[i];
+            }
+
+            this.elementCache = {};
+            this.ids = {};
+        },
+
+        /**
+         * A cache of DOM elements
+         * @property elementCache
+         * @private
+         * @static
+         */
+        elementCache: {},
+
+        /**
+         * Get the wrapper for the DOM element specified
+         * @method getElWrapper
+         * @param {String} id the id of the element to get
+         * @return {Ext.dd.DDM.ElementWrapper} the wrapped element
+         * @private
+         * @deprecated This wrapper isn't that useful
+         * @static
+         */
+        getElWrapper: function(id) {
+            var oWrapper = this.elementCache[id];
+            if (!oWrapper || !oWrapper.el) {
+                oWrapper = this.elementCache[id] =
+                    new this.ElementWrapper(Ext.getDom(id));
+            }
+            return oWrapper;
+        },
+
+        /**
+         * Returns the actual DOM element
+         * @method getElement
+         * @param {String} id the id of the elment to get
+         * @return {Object} The element
+         * @deprecated use Ext.lib.Ext.getDom instead
+         * @static
+         */
+        getElement: function(id) {
+            return Ext.getDom(id);
+        },
+
+        /**
+         * Returns the style property for the DOM element (i.e.,
+         * document.getElById(id).style)
+         * @method getCss
+         * @param {String} id the id of the elment to get
+         * @return {Object} The style property of the element
+         * @deprecated use Ext.lib.Dom instead
+         * @static
+         */
+        getCss: function(id) {
+            var el = Ext.getDom(id);
+            return (el) ? el.style : null;
+        },
+
+        /**
+         * Inner class for cached elements
+         * @class DragDropMgr.ElementWrapper
+         * @for DragDropMgr
+         * @private
+         * @deprecated
+         */
+        ElementWrapper: function(el) {
+                /**
+                 * The element
+                 * @property el
+                 */
+                this.el = el || null;
+                /**
+                 * The element id
+                 * @property id
+                 */
+                this.id = this.el && el.id;
+                /**
+                 * A reference to the style property
+                 * @property css
+                 */
+                this.css = this.el && el.style;
+            },
+
+        /**
+         * Returns the X position of an html element
+         * @method getPosX
+         * @param el the element for which to get the position
+         * @return {int} the X coordinate
+         * @for DragDropMgr
+         * @deprecated use Ext.lib.Dom.getX instead
+         * @static
+         */
+        getPosX: function(el) {
+            return Ext.lib.Dom.getX(el);
+        },
+
+        /**
+         * Returns the Y position of an html element
+         * @method getPosY
+         * @param el the element for which to get the position
+         * @return {int} the Y coordinate
+         * @deprecated use Ext.lib.Dom.getY instead
+         * @static
+         */
+        getPosY: function(el) {
+            return Ext.lib.Dom.getY(el);
+        },
+
+        /**
+         * Swap two nodes.  In IE, we use the native method, for others we
+         * emulate the IE behavior
+         * @method swapNode
+         * @param n1 the first node to swap
+         * @param n2 the other node to swap
+         * @static
+         */
+        swapNode: function(n1, n2) {
+            if (n1.swapNode) {
+                n1.swapNode(n2);
+            } else {
+                var p = n2.parentNode;
+                var s = n2.nextSibling;
+
+                if (s == n1) {
+                    p.insertBefore(n1, n2);
+                } else if (n2 == n1.nextSibling) {
+                    p.insertBefore(n2, n1);
+                } else {
+                    n1.parentNode.replaceChild(n2, n1);
+                    p.insertBefore(n1, s);
+                }
+            }
+        },
+
+        /**
+         * Returns the current scroll position
+         * @method getScroll
+         * @private
+         * @static
+         */
+        getScroll: function () {
+            var t, l, dde=document.documentElement, db=document.body;
+            if (dde && (dde.scrollTop || dde.scrollLeft)) {
+                t = dde.scrollTop;
+                l = dde.scrollLeft;
+            } else if (db) {
+                t = db.scrollTop;
+                l = db.scrollLeft;
+            } else {
+
+            }
+            return { top: t, left: l };
+        },
+
+        /**
+         * Returns the specified element style property
+         * @method getStyle
+         * @param {HTMLElement} el          the element
+         * @param {string}      styleProp   the style property
+         * @return {string} The value of the style property
+         * @deprecated use Ext.lib.Dom.getStyle
+         * @static
+         */
+        getStyle: function(el, styleProp) {
+            return Ext.fly(el).getStyle(styleProp);
+        },
+
+        /**
+         * Gets the scrollTop
+         * @method getScrollTop
+         * @return {int} the document's scrollTop
+         * @static
+         */
+        getScrollTop: function () { return this.getScroll().top; },
+
+        /**
+         * Gets the scrollLeft
+         * @method getScrollLeft
+         * @return {int} the document's scrollTop
+         * @static
+         */
+        getScrollLeft: function () { return this.getScroll().left; },
+
+        /**
+         * Sets the x/y position of an element to the location of the
+         * target element.
+         * @method moveToEl
+         * @param {HTMLElement} moveEl      The element to move
+         * @param {HTMLElement} targetEl    The position reference element
+         * @static
+         */
+        moveToEl: function (moveEl, targetEl) {
+            var aCoord = Ext.lib.Dom.getXY(targetEl);
+            Ext.lib.Dom.setXY(moveEl, aCoord);
+        },
+
+        /**
+         * Numeric array sort function
+         * @method numericSort
+         * @static
+         */
+        numericSort: function(a, b) { return (a - b); },
+
+        /**
+         * Internal counter
+         * @property _timeoutCount
+         * @private
+         * @static
+         */
+        _timeoutCount: 0,
+
+        /**
+         * Trying to make the load order less important.  Without this we get
+         * an error if this file is loaded before the Event Utility.
+         * @method _addListeners
+         * @private
+         * @static
+         */
+        _addListeners: function() {
+            var DDM = Ext.dd.DDM;
+            if ( Ext.lib.Event && document ) {
+                DDM._onLoad();
+            } else {
+                if (DDM._timeoutCount > 2000) {
+                } else {
+                    setTimeout(DDM._addListeners, 10);
+                    if (document && document.body) {
+                        DDM._timeoutCount += 1;
+                    }
+                }
+            }
+        },
+
+        /**
+         * Recursively searches the immediate parent and all child nodes for
+         * the handle element in order to determine wheter or not it was
+         * clicked.
+         * @method handleWasClicked
+         * @param node the html element to inspect
+         * @static
+         */
+        handleWasClicked: function(node, id) {
+            if (this.isHandle(id, node.id)) {
+                return true;
+            } else {
+                // check to see if this is a text node child of the one we want
+                var p = node.parentNode;
+
+                while (p) {
+                    if (this.isHandle(id, p.id)) {
+                        return true;
+                    } else {
+                        p = p.parentNode;
+                    }
+                }
+            }
+
+            return false;
+        }
+
+    };
+
+}();
+
+// shorter alias, save a few bytes
+Ext.dd.DDM = Ext.dd.DragDropMgr;
+Ext.dd.DDM._addListeners();
+
+}
+
+/**
+ * @class Ext.dd.DD
+ * A DragDrop implementation where the linked element follows the
+ * mouse cursor during a drag.
+ * @extends Ext.dd.DragDrop
+ * @constructor
+ * @param {String} id the id of the linked element
+ * @param {String} sGroup the group of related DragDrop items
+ * @param {object} config an object containing configurable attributes
+ *                Valid properties for DD:
+ *                    scroll
+ */
+Ext.dd.DD = function(id, sGroup, config) {
+    if (id) {
+        this.init(id, sGroup, config);
+    }
+};
+
+Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {
+
+    /**
+     * When set to true, the utility automatically tries to scroll the browser
+     * window when a drag and drop element is dragged near the viewport boundary.
+     * Defaults to true.
+     * @property scroll
+     * @type boolean
+     */
+    scroll: true,
+
+    /**
+     * Sets the pointer offset to the distance between the linked element's top
+     * left corner and the location the element was clicked
+     * @method autoOffset
+     * @param {int} iPageX the X coordinate of the click
+     * @param {int} iPageY the Y coordinate of the click
+     */
+    autoOffset: function(iPageX, iPageY) {
+        var x = iPageX - this.startPageX;
+        var y = iPageY - this.startPageY;
+        this.setDelta(x, y);
+    },
+
+    /**
+     * Sets the pointer offset.  You can call this directly to force the
+     * offset to be in a particular location (e.g., pass in 0,0 to set it
+     * to the center of the object)
+     * @method setDelta
+     * @param {int} iDeltaX the distance from the left
+     * @param {int} iDeltaY the distance from the top
+     */
+    setDelta: function(iDeltaX, iDeltaY) {
+        this.deltaX = iDeltaX;
+        this.deltaY = iDeltaY;
+    },
+
+    /**
+     * Sets the drag element to the location of the mousedown or click event,
+     * maintaining the cursor location relative to the location on the element
+     * that was clicked.  Override this if you want to place the element in a
+     * location other than where the cursor is.
+     * @method setDragElPos
+     * @param {int} iPageX the X coordinate of the mousedown or drag event
+     * @param {int} iPageY the Y coordinate of the mousedown or drag event
+     */
+    setDragElPos: function(iPageX, iPageY) {
+        // the first time we do this, we are going to check to make sure
+        // the element has css positioning
+
+        var el = this.getDragEl();
+        this.alignElWithMouse(el, iPageX, iPageY);
+    },
+
+    /**
+     * Sets the element to the location of the mousedown or click event,
+     * maintaining the cursor location relative to the location on the element
+     * that was clicked.  Override this if you want to place the element in a
+     * location other than where the cursor is.
+     * @method alignElWithMouse
+     * @param {HTMLElement} el the element to move
+     * @param {int} iPageX the X coordinate of the mousedown or drag event
+     * @param {int} iPageY the Y coordinate of the mousedown or drag event
+     */
+    alignElWithMouse: function(el, iPageX, iPageY) {
+        var oCoord = this.getTargetCoord(iPageX, iPageY);
+        var fly = el.dom ? el : Ext.fly(el, '_dd');
+        if (!this.deltaSetXY) {
+            var aCoord = [oCoord.x, oCoord.y];
+            fly.setXY(aCoord);
+            var newLeft = fly.getLeft(true);
+            var newTop  = fly.getTop(true);
+            this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];
+        } else {
+            fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);
+        }
+
+        this.cachePosition(oCoord.x, oCoord.y);
+        this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);
+        return oCoord;
+    },
+
+    /**
+     * Saves the most recent position so that we can reset the constraints and
+     * tick marks on-demand.  We need to know this so that we can calculate the
+     * number of pixels the element is offset from its original position.
+     * @method cachePosition
+     * @param iPageX the current x position (optional, this just makes it so we
+     * don't have to look it up again)
+     * @param iPageY the current y position (optional, this just makes it so we
+     * don't have to look it up again)
+     */
+    cachePosition: function(iPageX, iPageY) {
+        if (iPageX) {
+            this.lastPageX = iPageX;
+            this.lastPageY = iPageY;
+        } else {
+            var aCoord = Ext.lib.Dom.getXY(this.getEl());
+            this.lastPageX = aCoord[0];
+            this.lastPageY = aCoord[1];
+        }
+    },
+
+    /**
+     * Auto-scroll the window if the dragged object has been moved beyond the
+     * visible window boundary.
+     * @method autoScroll
+     * @param {int} x the drag element's x position
+     * @param {int} y the drag element's y position
+     * @param {int} h the height of the drag element
+     * @param {int} w the width of the drag element
+     * @private
+     */
+    autoScroll: function(x, y, h, w) {
+
+        if (this.scroll) {
+            // The client height
+            var clientH = Ext.lib.Dom.getViewHeight();
+
+            // The client width
+            var clientW = Ext.lib.Dom.getViewWidth();
+
+            // The amt scrolled down
+            var st = this.DDM.getScrollTop();
+
+            // The amt scrolled right
+            var sl = this.DDM.getScrollLeft();
+
+            // Location of the bottom of the element
+            var bot = h + y;
+
+            // Location of the right of the element
+            var right = w + x;
+
+            // The distance from the cursor to the bottom of the visible area,
+            // adjusted so that we don't scroll if the cursor is beyond the
+            // element drag constraints
+            var toBot = (clientH + st - y - this.deltaY);
+
+            // The distance from the cursor to the right of the visible area
+            var toRight = (clientW + sl - x - this.deltaX);
+
+
+            // How close to the edge the cursor must be before we scroll
+            // var thresh = (document.all) ? 100 : 40;
+            var thresh = 40;
+
+            // How many pixels to scroll per autoscroll op.  This helps to reduce
+            // clunky scrolling. IE is more sensitive about this ... it needs this
+            // value to be higher.
+            var scrAmt = (document.all) ? 80 : 30;
+
+            // Scroll down if we are near the bottom of the visible page and the
+            // obj extends below the crease
+            if ( bot > clientH && toBot < thresh ) {
+                window.scrollTo(sl, st + scrAmt);
+            }
+
+            // Scroll up if the window is scrolled down and the top of the object
+            // goes above the top border
+            if ( y < st && st > 0 && y - st < thresh ) {
+                window.scrollTo(sl, st - scrAmt);
+            }
+
+            // Scroll right if the obj is beyond the right border and the cursor is
+            // near the border.
+            if ( right > clientW && toRight < thresh ) {
+                window.scrollTo(sl + scrAmt, st);
+            }
+
+            // Scroll left if the window has been scrolled to the right and the obj
+            // extends past the left border
+            if ( x < sl && sl > 0 && x - sl < thresh ) {
+                window.scrollTo(sl - scrAmt, st);
+            }
+        }
+    },
+
+    /**
+     * Finds the location the element should be placed if we want to move
+     * it to where the mouse location less the click offset would place us.
+     * @method getTargetCoord
+     * @param {int} iPageX the X coordinate of the click
+     * @param {int} iPageY the Y coordinate of the click
+     * @return an object that contains the coordinates (Object.x and Object.y)
+     * @private
+     */
+    getTargetCoord: function(iPageX, iPageY) {
+
+
+        var x = iPageX - this.deltaX;
+        var y = iPageY - this.deltaY;
+
+        if (this.constrainX) {
+            if (x < this.minX) { x = this.minX; }
+            if (x > this.maxX) { x = this.maxX; }
+        }
+
+        if (this.constrainY) {
+            if (y < this.minY) { y = this.minY; }
+            if (y > this.maxY) { y = this.maxY; }
+        }
+
+        x = this.getTick(x, this.xTicks);
+        y = this.getTick(y, this.yTicks);
+
+
+        return {x:x, y:y};
+    },
+
+    /**
+     * Sets up config options specific to this class. Overrides
+     * Ext.dd.DragDrop, but all versions of this method through the
+     * inheritance chain are called
+     */
+    applyConfig: function() {
+        Ext.dd.DD.superclass.applyConfig.call(this);
+        this.scroll = (this.config.scroll !== false);
+    },
+
+    /**
+     * Event that fires prior to the onMouseDown event.  Overrides
+     * Ext.dd.DragDrop.
+     */
+    b4MouseDown: function(e) {
+        // this.resetConstraints();
+        this.autoOffset(e.getPageX(),
+                            e.getPageY());
+    },
+
+    /**
+     * Event that fires prior to the onDrag event.  Overrides
+     * Ext.dd.DragDrop.
+     */
+    b4Drag: function(e) {
+        this.setDragElPos(e.getPageX(),
+                            e.getPageY());
+    },
+
+    toString: function() {
+        return ("DD " + this.id);
+    }
+
+    //////////////////////////////////////////////////////////////////////////
+    // Debugging ygDragDrop events that can be overridden
+    //////////////////////////////////////////////////////////////////////////
+    /*
+    startDrag: function(x, y) {
+    },
+
+    onDrag: function(e) {
+    },
+
+    onDragEnter: function(e, id) {
+    },
+
+    onDragOver: function(e, id) {
+    },
+
+    onDragOut: function(e, id) {
+    },
+
+    onDragDrop: function(e, id) {
+    },
+
+    endDrag: function(e) {
+    }
+
+    */
+
+});
+/**
+ * @class Ext.dd.DDProxy
+ * A DragDrop implementation that inserts an empty, bordered div into
+ * the document that follows the cursor during drag operations.  At the time of
+ * the click, the frame div is resized to the dimensions of the linked html
+ * element, and moved to the exact location of the linked element.
+ *
+ * References to the "frame" element refer to the single proxy element that
+ * was created to be dragged in place of all DDProxy elements on the
+ * page.
+ *
+ * @extends Ext.dd.DD
+ * @constructor
+ * @param {String} id the id of the linked html element
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ *                Valid properties for DDProxy in addition to those in DragDrop:
+ *                   resizeFrame, centerFrame, dragElId
+ */
+Ext.dd.DDProxy = function(id, sGroup, config) {
+    if (id) {
+        this.init(id, sGroup, config);
+        this.initFrame();
+    }
+};
+
+/**
+ * The default drag frame div id
+ * @property Ext.dd.DDProxy.dragElId
+ * @type String
+ * @static
+ */
+Ext.dd.DDProxy.dragElId = "ygddfdiv";
+
+Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {
+
+    /**
+     * By default we resize the drag frame to be the same size as the element
+     * we want to drag (this is to get the frame effect).  We can turn it off
+     * if we want a different behavior.
+     * @property resizeFrame
+     * @type boolean
+     */
+    resizeFrame: true,
+
+    /**
+     * By default the frame is positioned exactly where the drag element is, so
+     * we use the cursor offset provided by Ext.dd.DD.  Another option that works only if
+     * you do not have constraints on the obj is to have the drag frame centered
+     * around the cursor.  Set centerFrame to true for this effect.
+     * @property centerFrame
+     * @type boolean
+     */
+    centerFrame: false,
+
+    /**
+     * Creates the proxy element if it does not yet exist
+     * @method createFrame
+     */
+    createFrame: function() {
+        var self = this;
+        var body = document.body;
+
+        if (!body || !body.firstChild) {
+            setTimeout( function() { self.createFrame(); }, 50 );
+            return;
+        }
+
+        var div = this.getDragEl();
+
+        if (!div) {
+            div    = document.createElement("div");
+            div.id = this.dragElId;
+            var s  = div.style;
+
+            s.position   = "absolute";
+            s.visibility = "hidden";
+            s.cursor     = "move";
+            s.border     = "2px solid #aaa";
+            s.zIndex     = 999;
+
+            // appendChild can blow up IE if invoked prior to the window load event
+            // while rendering a table.  It is possible there are other scenarios
+            // that would cause this to happen as well.
+            body.insertBefore(div, body.firstChild);
+        }
+    },
+
+    /**
+     * Initialization for the drag frame element.  Must be called in the
+     * constructor of all subclasses
+     * @method initFrame
+     */
+    initFrame: function() {
+        this.createFrame();
+    },
+
+    applyConfig: function() {
+        Ext.dd.DDProxy.superclass.applyConfig.call(this);
+
+        this.resizeFrame = (this.config.resizeFrame !== false);
+        this.centerFrame = (this.config.centerFrame);
+        this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);
+    },
+
+    /**
+     * Resizes the drag frame to the dimensions of the clicked object, positions
+     * it over the object, and finally displays it
+     * @method showFrame
+     * @param {int} iPageX X click position
+     * @param {int} iPageY Y click position
+     * @private
+     */
+    showFrame: function(iPageX, iPageY) {
+        var el = this.getEl();
+        var dragEl = this.getDragEl();
+        var s = dragEl.style;
+
+        this._resizeProxy();
+
+        if (this.centerFrame) {
+            this.setDelta( Math.round(parseInt(s.width,  10)/2),
+                           Math.round(parseInt(s.height, 10)/2) );
+        }
+
+        this.setDragElPos(iPageX, iPageY);
+
+        Ext.fly(dragEl).show();
+    },
+
+    /**
+     * The proxy is automatically resized to the dimensions of the linked
+     * element when a drag is initiated, unless resizeFrame is set to false
+     * @method _resizeProxy
+     * @private
+     */
+    _resizeProxy: function() {
+        if (this.resizeFrame) {
+            var el = this.getEl();
+            Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);
+        }
+    },
+
+    // overrides Ext.dd.DragDrop
+    b4MouseDown: function(e) {
+        var x = e.getPageX();
+        var y = e.getPageY();
+        this.autoOffset(x, y);
+        this.setDragElPos(x, y);
+    },
+
+    // overrides Ext.dd.DragDrop
+    b4StartDrag: function(x, y) {
+        // show the drag frame
+        this.showFrame(x, y);
+    },
+
+    // overrides Ext.dd.DragDrop
+    b4EndDrag: function(e) {
+        Ext.fly(this.getDragEl()).hide();
+    },
+
+    // overrides Ext.dd.DragDrop
+    // By default we try to move the element to the last location of the frame.
+    // This is so that the default behavior mirrors that of Ext.dd.DD.
+    endDrag: function(e) {
+
+        var lel = this.getEl();
+        var del = this.getDragEl();
+
+        // Show the drag frame briefly so we can get its position
+        del.style.visibility = "";
+
+        this.beforeMove();
+        // Hide the linked element before the move to get around a Safari
+        // rendering bug.
+        lel.style.visibility = "hidden";
+        Ext.dd.DDM.moveToEl(lel, del);
+        del.style.visibility = "hidden";
+        lel.style.visibility = "";
+
+        this.afterDrag();
+    },
+
+    beforeMove : function(){
+
+    },
+
+    afterDrag : function(){
+
+    },
+
+    toString: function() {
+        return ("DDProxy " + this.id);
+    }
+
+});
+/**
+ * @class Ext.dd.DDTarget
+ * A DragDrop implementation that does not move, but can be a drop
+ * target.  You would get the same result by simply omitting implementation
+ * for the event callbacks, but this way we reduce the processing cost of the
+ * event listener and the callbacks.
+ * @extends Ext.dd.DragDrop
+ * @constructor
+ * @param {String} id the id of the element that is a drop target
+ * @param {String} sGroup the group of related DragDrop objects
+ * @param {object} config an object containing configurable attributes
+ *                 Valid properties for DDTarget in addition to those in
+ *                 DragDrop:
+ *                    none
+ */
+Ext.dd.DDTarget = function(id, sGroup, config) {
+    if (id) {
+        this.initTarget(id, sGroup, config);
+    }
+};
+
+// Ext.dd.DDTarget.prototype = new Ext.dd.DragDrop();
+Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {
+    toString: function() {
+        return ("DDTarget " + this.id);
+    }
+});
+/**\r
+ * @class Ext.dd.DragTracker\r
+ * @extends Ext.util.Observable\r
+ */\r
+Ext.dd.DragTracker = function(config){\r
+    Ext.apply(this, config);\r
+    this.addEvents(\r
+        /**\r
+         * @event mousedown\r
+         * @param {Object} this\r
+         * @param {Object} e event object\r
+         */\r
+        'mousedown',\r
+        /**\r
+         * @event mouseup\r
+         * @param {Object} this\r
+         * @param {Object} e event object\r
+         */\r
+        'mouseup',\r
+        /**\r
+         * @event mousemove\r
+         * @param {Object} this\r
+         * @param {Object} e event object\r
+         */\r
+        'mousemove',\r
+        /**\r
+         * @event dragstart\r
+         * @param {Object} this\r
+         * @param {Object} startXY the page coordinates of the event\r
+         */\r
+        'dragstart',\r
+        /**\r
+         * @event dragend\r
+         * @param {Object} this\r
+         * @param {Object} e event object\r
+         */\r
+        'dragend',\r
+        /**\r
+         * @event drag\r
+         * @param {Object} this\r
+         * @param {Object} e event object\r
+         */\r
+        'drag'\r
+    );\r
 \r
-    var instance = {\r
-        \r
-        getSize : function(text){\r
-            ml.update(text);\r
-            var s = ml.getSize();\r
-            ml.update('');\r
-            return s;\r
-        },\r
+    this.dragRegion = new Ext.lib.Region(0,0,0,0);\r
 \r
-        \r
-        bind : function(el){\r
-            ml.setStyle(\r
-                Ext.fly(el).getStyles('font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing')\r
-            );\r
-        },\r
+    if(this.el){\r
+        this.initEl(this.el);\r
+    }\r
+}\r
 \r
-        \r
-        setFixedWidth : function(width){\r
-            ml.setWidth(width);\r
-        },\r
+Ext.extend(Ext.dd.DragTracker, Ext.util.Observable,  {\r
+    /**\r
+     * @cfg {Boolean} active\r
+        * Defaults to <tt>false</tt>.\r
+        */     \r
+    active: false,\r
+    /**\r
+     * @cfg {Number} tolerance\r
+        * Defaults to <tt>5</tt>.\r
+        */     \r
+    tolerance: 5,\r
+    /**\r
+     * @cfg {Boolean/Number} autoStart\r
+        * Defaults to <tt>false</tt>. Specify <tt>true</tt> to defer trigger start by 1000 ms.\r
+        * Specify a Number for the number of milliseconds to defer trigger start.\r
+        */     \r
+    autoStart: false,\r
 \r
-        \r
-        getWidth : function(text){\r
-            ml.dom.style.width = 'auto';\r
-            return this.getSize(text).width;\r
-        },\r
+    initEl: function(el){\r
+        this.el = Ext.get(el);\r
+        el.on('mousedown', this.onMouseDown, this,\r
+                this.delegate ? {delegate: this.delegate} : undefined);\r
+    },\r
 \r
-        \r
-        getHeight : function(text){\r
-            return this.getSize(text).height;\r
-        }\r
-    };\r
-\r
-    instance.bind(bindTo);\r
-\r
-    return instance;\r
-};\r
-\r
-// backwards compat\r
-Ext.Element.measureText = Ext.util.TextMetrics.measure;\r
-\r
-\r
-(function() {\r
-\r
-var Event=Ext.EventManager;\r
-var Dom=Ext.lib.Dom;\r
-\r
-\r
-Ext.dd.DragDrop = function(id, sGroup, config) {\r
-    if(id) {\r
-        this.init(id, sGroup, config);\r
-    }\r
-};\r
-\r
-Ext.dd.DragDrop.prototype = {\r
-\r
-    \r
-    id: null,\r
-\r
-    \r
-    config: null,\r
-\r
-    \r
-    dragElId: null,\r
-\r
-    \r
-    handleElId: null,\r
-\r
-    \r
-    invalidHandleTypes: null,\r
-\r
-    \r
-    invalidHandleIds: null,\r
-\r
-    \r
-    invalidHandleClasses: null,\r
-\r
-    \r
-    startPageX: 0,\r
-\r
-    \r
-    startPageY: 0,\r
-\r
-    \r
-    groups: null,\r
-\r
-    \r
-    locked: false,\r
-\r
-    \r
-    lock: function() { this.locked = true; },\r
-\r
-    \r
-    moveOnly: false,\r
-\r
-    \r
-    unlock: function() { this.locked = false; },\r
-\r
-    \r
-    isTarget: true,\r
-\r
-    \r
-    padding: null,\r
-\r
-    \r
-    _domRef: null,\r
-\r
-    \r
-    __ygDragDrop: true,\r
-\r
-    \r
-    constrainX: false,\r
-\r
-    \r
-    constrainY: false,\r
-\r
-    \r
-    minX: 0,\r
-\r
-    \r
-    maxX: 0,\r
-\r
-    \r
-    minY: 0,\r
-\r
-    \r
-    maxY: 0,\r
-\r
-    \r
-    maintainOffset: false,\r
-\r
-    \r
-    xTicks: null,\r
-\r
-    \r
-    yTicks: null,\r
-\r
-    \r
-    primaryButtonOnly: true,\r
-\r
-    \r
-    available: false,\r
-\r
-    \r
-    hasOuterHandles: false,\r
-\r
-    \r
-    b4StartDrag: function(x, y) { },\r
-\r
-    \r
-    startDrag: function(x, y) {  },\r
-\r
-    \r
-    b4Drag: function(e) { },\r
-\r
-    \r
-    onDrag: function(e) {  },\r
-\r
-    \r
-    onDragEnter: function(e, id) {  },\r
-\r
-    \r
-    b4DragOver: function(e) { },\r
-\r
-    \r
-    onDragOver: function(e, id) {  },\r
-\r
-    \r
-    b4DragOut: function(e) { },\r
-\r
-    \r
-    onDragOut: function(e, id) {  },\r
-\r
-    \r
-    b4DragDrop: function(e) { },\r
-\r
-    \r
-    onDragDrop: function(e, id) {  },\r
-\r
-    \r
-    onInvalidDrop: function(e) {  },\r
-\r
-    \r
-    b4EndDrag: function(e) { },\r
-\r
-    \r
-    endDrag: function(e) {  },\r
-\r
-    \r
-    b4MouseDown: function(e) {  },\r
-\r
-    \r
-    onMouseDown: function(e) {  },\r
-\r
-    \r
-    onMouseUp: function(e) {  },\r
-\r
-    \r
-    onAvailable: function () {\r
+    destroy : function(){\r
+        this.el.un('mousedown', this.onMouseDown, this);\r
     },\r
 \r
-    \r
-    defaultPadding : {left:0, right:0, top:0, bottom:0},\r
-\r
-    \r
-    constrainTo : function(constrainTo, pad, inContent){\r
-        if(typeof pad == "number"){\r
-            pad = {left: pad, right:pad, top:pad, bottom:pad};\r
-        }\r
-        pad = pad || this.defaultPadding;\r
-        var b = Ext.get(this.getEl()).getBox();\r
-        var ce = Ext.get(constrainTo);\r
-        var s = ce.getScroll();\r
-        var c, cd = ce.dom;\r
-        if(cd == document.body){\r
-            c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};\r
-        }else{\r
-            var xy = ce.getXY();\r
-            c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};\r
+    onMouseDown: function(e, target){\r
+        if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){\r
+            this.startXY = this.lastXY = e.getXY();\r
+            this.dragTarget = this.delegate ? target : this.el.dom;\r
+            if(this.preventDefault !== false){\r
+                e.preventDefault();\r
+            }\r
+            var doc = Ext.getDoc();\r
+            doc.on('mouseup', this.onMouseUp, this);\r
+            doc.on('mousemove', this.onMouseMove, this);\r
+            doc.on('selectstart', this.stopSelect, this);\r
+            if(this.autoStart){\r
+                this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this);\r
+            }\r
         }\r
-\r
-\r
-        var topSpace = b.y - c.y;\r
-        var leftSpace = b.x - c.x;\r
-\r
-        this.resetConstraints();\r
-        this.setXConstraint(leftSpace - (pad.left||0), // left\r
-                c.width - leftSpace - b.width - (pad.right||0), //right\r
-                               this.xTickSize\r
-        );\r
-        this.setYConstraint(topSpace - (pad.top||0), //top\r
-                c.height - topSpace - b.height - (pad.bottom||0), //bottom\r
-                               this.yTickSize\r
-        );\r
     },\r
 \r
-    \r
-    getEl: function() {\r
-        if (!this._domRef) {\r
-            this._domRef = Ext.getDom(this.id);\r
+    onMouseMove: function(e, target){\r
+        // HACK: IE hack to see if button was released outside of window. */\r
+        if(this.active && Ext.isIE && !e.browserEvent.button){\r
+            e.preventDefault();\r
+            this.onMouseUp(e);\r
+            return;\r
         }\r
 \r
-        return this._domRef;\r
+        e.preventDefault();\r
+        var xy = e.getXY(), s = this.startXY;\r
+        this.lastXY = xy;\r
+        if(!this.active){\r
+            if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){\r
+                this.triggerStart();\r
+            }else{\r
+                return;\r
+            }\r
+        }\r
+        this.fireEvent('mousemove', this, e);\r
+        this.onDrag(e);\r
+        this.fireEvent('drag', this, e);\r
     },\r
 \r
-    \r
-    getDragEl: function() {\r
-        return Ext.getDom(this.dragElId);\r
+    onMouseUp: function(e){\r
+        var doc = Ext.getDoc();\r
+        doc.un('mousemove', this.onMouseMove, this);\r
+        doc.un('mouseup', this.onMouseUp, this);\r
+        doc.un('selectstart', this.stopSelect, this);\r
+        e.preventDefault();\r
+        this.clearStart();\r
+        var wasActive = this.active;\r
+        this.active = false;\r
+        delete this.elRegion;\r
+        this.fireEvent('mouseup', this, e);\r
+        if(wasActive){\r
+            this.onEnd(e);\r
+            this.fireEvent('dragend', this, e);\r
+        }\r
     },\r
 \r
-    \r
-    init: function(id, sGroup, config) {\r
-        this.initTarget(id, sGroup, config);\r
-        Event.on(this.id, "mousedown", this.handleMouseDown, this);\r
-        // Event.on(this.id, "selectstart", Event.preventDefault);\r
+    triggerStart: function(isTimer){\r
+        this.clearStart();\r
+        this.active = true;\r
+        this.onStart(this.startXY);\r
+        this.fireEvent('dragstart', this, this.startXY);\r
     },\r
 \r
-    \r
-    initTarget: function(id, sGroup, config) {\r
-\r
-        // configuration attributes\r
-        this.config = config || {};\r
-\r
-        // create a local reference to the drag and drop manager\r
-        this.DDM = Ext.dd.DDM;\r
-        // initialize the groups array\r
-        this.groups = {};\r
-\r
-        // assume that we have an element reference instead of an id if the\r
-        // parameter is not a string\r
-        if (typeof id !== "string") {\r
-            id = Ext.id(id);\r
+    clearStart : function(){\r
+        if(this.timer){\r
+            clearTimeout(this.timer);\r
+            delete this.timer;\r
         }\r
-\r
-        // set the id\r
-        this.id = id;\r
-\r
-        // add to an interaction group\r
-        this.addToGroup((sGroup) ? sGroup : "default");\r
-\r
-        // We don't want to register this as the handle with the manager\r
-        // so we just set the id rather than calling the setter.\r
-        this.handleElId = id;\r
-\r
-        // the linked element is the element that gets dragged by default\r
-        this.setDragElId(id);\r
-\r
-        // by default, clicked anchors will not start drag operations.\r
-        this.invalidHandleTypes = { A: "A" };\r
-        this.invalidHandleIds = {};\r
-        this.invalidHandleClasses = [];\r
-\r
-        this.applyConfig();\r
-\r
-        this.handleOnAvailable();\r
     },\r
 \r
-    \r
-    applyConfig: function() {\r
-\r
-        // configurable properties:\r
-        //    padding, isTarget, maintainOffset, primaryButtonOnly\r
-        this.padding           = this.config.padding || [0, 0, 0, 0];\r
-        this.isTarget          = (this.config.isTarget !== false);\r
-        this.maintainOffset    = (this.config.maintainOffset);\r
-        this.primaryButtonOnly = (this.config.primaryButtonOnly !== false);\r
-\r
+    stopSelect : function(e){\r
+        e.stopEvent();\r
+        return false;\r
     },\r
 \r
-    \r
-    handleOnAvailable: function() {\r
-        this.available = true;\r
-        this.resetConstraints();\r
-        this.onAvailable();\r
-    },\r
+    onBeforeStart : function(e){\r
 \r
-     \r
-    setPadding: function(iTop, iRight, iBot, iLeft) {\r
-        // this.padding = [iLeft, iRight, iTop, iBot];\r
-        if (!iRight && 0 !== iRight) {\r
-            this.padding = [iTop, iTop, iTop, iTop];\r
-        } else if (!iBot && 0 !== iBot) {\r
-            this.padding = [iTop, iRight, iTop, iRight];\r
-        } else {\r
-            this.padding = [iTop, iRight, iBot, iLeft];\r
-        }\r
     },\r
 \r
-    \r
-    setInitPosition: function(diffX, diffY) {\r
-        var el = this.getEl();\r
-\r
-        if (!this.DDM.verifyEl(el)) {\r
-            return;\r
-        }\r
-\r
-        var dx = diffX || 0;\r
-        var dy = diffY || 0;\r
-\r
-        var p = Dom.getXY( el );\r
-\r
-        this.initPageX = p[0] - dx;\r
-        this.initPageY = p[1] - dy;\r
-\r
-        this.lastPageX = p[0];\r
-        this.lastPageY = p[1];\r
-\r
+    onStart : function(xy){\r
 \r
-        this.setStartPosition(p);\r
     },\r
 \r
-    \r
-    setStartPosition: function(pos) {\r
-        var p = pos || Dom.getXY( this.getEl() );\r
-        this.deltaSetXY = null;\r
-\r
-        this.startPageX = p[0];\r
-        this.startPageY = p[1];\r
-    },\r
+    onDrag : function(e){\r
 \r
-    \r
-    addToGroup: function(sGroup) {\r
-        this.groups[sGroup] = true;\r
-        this.DDM.regDragDrop(this, sGroup);\r
     },\r
 \r
-    \r
-    removeFromGroup: function(sGroup) {\r
-        if (this.groups[sGroup]) {\r
-            delete this.groups[sGroup];\r
-        }\r
+    onEnd : function(e){\r
 \r
-        this.DDM.removeDDFromGroup(this, sGroup);\r
     },\r
 \r
-    \r
-    setDragElId: function(id) {\r
-        this.dragElId = id;\r
+    getDragTarget : function(){\r
+        return this.dragTarget;\r
     },\r
 \r
-    \r
-    setHandleElId: function(id) {\r
-        if (typeof id !== "string") {\r
-            id = Ext.id(id);\r
-        }\r
-        this.handleElId = id;\r
-        this.DDM.regHandle(this.id, id);\r
+    getDragCt : function(){\r
+        return this.el;\r
     },\r
 \r
-    \r
-    setOuterHandleElId: function(id) {\r
-        if (typeof id !== "string") {\r
-            id = Ext.id(id);\r
-        }\r
-        Event.on(id, "mousedown",\r
-                this.handleMouseDown, this);\r
-        this.setHandleElId(id);\r
-\r
-        this.hasOuterHandles = true;\r
+    getXY : function(constrain){\r
+        return constrain ?\r
+               this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;\r
     },\r
 \r
-    \r
-    unreg: function() {\r
-        Event.un(this.id, "mousedown",\r
-                this.handleMouseDown);\r
-        this._domRef = null;\r
-        this.DDM._remove(this);\r
+    getOffset : function(constrain){\r
+        var xy = this.getXY(constrain);\r
+        var s = this.startXY;\r
+        return [s[0]-xy[0], s[1]-xy[1]];\r
     },\r
 \r
-    destroy : function(){\r
-        this.unreg();\r
-    },\r
+    constrainModes: {\r
+        'point' : function(xy){\r
 \r
-    \r
-    isLocked: function() {\r
-        return (this.DDM.isLocked() || this.locked);\r
-    },\r
+            if(!this.elRegion){\r
+                this.elRegion = this.getDragCt().getRegion();\r
+            }\r
 \r
-    \r
-    handleMouseDown: function(e, oDD){\r
-        if (this.primaryButtonOnly && e.button != 0) {\r
-            return;\r
-        }\r
+            var dr = this.dragRegion;\r
 \r
-        if (this.isLocked()) {\r
-            return;\r
-        }\r
+            dr.left = xy[0];\r
+            dr.top = xy[1];\r
+            dr.right = xy[0];\r
+            dr.bottom = xy[1];\r
 \r
-        this.DDM.refreshCache(this.groups);\r
+            dr.constrainTo(this.elRegion);\r
 \r
-        var pt = new Ext.lib.Point(Ext.lib.Event.getPageX(e), Ext.lib.Event.getPageY(e));\r
-        if (!this.hasOuterHandles && !this.DDM.isOverTarget(pt, this) )  {\r
-        } else {\r
-            if (this.clickValidator(e)) {\r
-\r
-                // set the initial element position\r
-                this.setStartPosition();\r
-\r
-\r
-                this.b4MouseDown(e);\r
-                this.onMouseDown(e);\r
-\r
-                this.DDM.handleMouseDown(e, this);\r
-\r
-                this.DDM.stopEvent(e);\r
-            } else {\r
-\r
-\r
-            }\r
-        }\r
-    },\r
-\r
-    clickValidator: function(e) {\r
-        var target = e.getTarget();\r
-        return ( this.isValidHandleChild(target) &&\r
-                    (this.id == this.handleElId ||\r
-                        this.DDM.handleWasClicked(target, this.id)) );\r
-    },\r
-\r
-    \r
-    addInvalidHandleType: function(tagName) {\r
-        var type = tagName.toUpperCase();\r
-        this.invalidHandleTypes[type] = type;\r
-    },\r
-\r
-    \r
-    addInvalidHandleId: function(id) {\r
-        if (typeof id !== "string") {\r
-            id = Ext.id(id);\r
+            return [dr.left, dr.top];\r
         }\r
-        this.invalidHandleIds[id] = id;\r
-    },\r
-\r
-    \r
-    addInvalidHandleClass: function(cssClass) {\r
-        this.invalidHandleClasses.push(cssClass);\r
-    },\r
-\r
+    }\r
+});/**\r
+ * @class Ext.dd.ScrollManager\r
+ * <p>Provides automatic scrolling of overflow regions in the page during drag operations.</p>\r
+ * <p>The ScrollManager configs will be used as the defaults for any scroll container registered with it,\r
+ * but you can also override most of the configs per scroll container by adding a \r
+ * <tt>ddScrollConfig</tt> object to the target element that contains these properties: {@link #hthresh},\r
+ * {@link #vthresh}, {@link #increment} and {@link #frequency}.  Example usage:\r
+ * <pre><code>\r
+var el = Ext.get('scroll-ct');\r
+el.ddScrollConfig = {\r
+    vthresh: 50,\r
+    hthresh: -1,\r
+    frequency: 100,\r
+    increment: 200\r
+};\r
+Ext.dd.ScrollManager.register(el);\r
+</code></pre>\r
+ * <b>Note: This class uses "Point Mode" and is untested in "Intersect Mode".</b>\r
+ * @singleton\r
+ */\r
+Ext.dd.ScrollManager = function(){\r
+    var ddm = Ext.dd.DragDropMgr;\r
+    var els = {};\r
+    var dragEl = null;\r
+    var proc = {};\r
     \r
-    removeInvalidHandleType: function(tagName) {\r
-        var type = tagName.toUpperCase();\r
-        // this.invalidHandleTypes[type] = null;\r
-        delete this.invalidHandleTypes[type];\r
-    },\r
-\r
+    var onStop = function(e){\r
+        dragEl = null;\r
+        clearProc();\r
+    };\r
     \r
-    removeInvalidHandleId: function(id) {\r
-        if (typeof id !== "string") {\r
-            id = Ext.id(id);\r
+    var triggerRefresh = function(){\r
+        if(ddm.dragCurrent){\r
+             ddm.refreshCache(ddm.dragCurrent.groups);\r
         }\r
-        delete this.invalidHandleIds[id];\r
-    },\r
-\r
+    };\r
     \r
-    removeInvalidHandleClass: function(cssClass) {\r
-        for (var i=0, len=this.invalidHandleClasses.length; i<len; ++i) {\r
-            if (this.invalidHandleClasses[i] == cssClass) {\r
-                delete this.invalidHandleClasses[i];\r
+    var doScroll = function(){\r
+        if(ddm.dragCurrent){\r
+            var dds = Ext.dd.ScrollManager;\r
+            var inc = proc.el.ddScrollConfig ?\r
+                      proc.el.ddScrollConfig.increment : dds.increment;\r
+            if(!dds.animate){\r
+                if(proc.el.scroll(proc.dir, inc)){\r
+                    triggerRefresh();\r
+                }\r
+            }else{\r
+                proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh);\r
             }\r
         }\r
-    },\r
-\r
+    };\r
     \r
-    isValidHandleChild: function(node) {\r
-\r
-        var valid = true;\r
-        // var n = (node.nodeName == "#text") ? node.parentNode : node;\r
-        var nodeName;\r
-        try {\r
-            nodeName = node.nodeName.toUpperCase();\r
-        } catch(e) {\r
-            nodeName = node.nodeName;\r
-        }\r
-        valid = valid && !this.invalidHandleTypes[nodeName];\r
-        valid = valid && !this.invalidHandleIds[node.id];\r
-\r
-        for (var i=0, len=this.invalidHandleClasses.length; valid && i<len; ++i) {\r
-            valid = !Ext.fly(node).hasClass(this.invalidHandleClasses[i]);\r
+    var clearProc = function(){\r
+        if(proc.id){\r
+            clearInterval(proc.id);\r
         }\r
-\r
-\r
-        return valid;\r
-\r
-    },\r
-\r
+        proc.id = 0;\r
+        proc.el = null;\r
+        proc.dir = "";\r
+    };\r
     \r
-    setXTicks: function(iStartX, iTickSize) {\r
-        this.xTicks = [];\r
-        this.xTickSize = iTickSize;\r
-\r
-        var tickMap = {};\r
-\r
-        for (var i = this.initPageX; i >= this.minX; i = i - iTickSize) {\r
-            if (!tickMap[i]) {\r
-                this.xTicks[this.xTicks.length] = i;\r
-                tickMap[i] = true;\r
-            }\r
-        }\r
-\r
-        for (i = this.initPageX; i <= this.maxX; i = i + iTickSize) {\r
-            if (!tickMap[i]) {\r
-                this.xTicks[this.xTicks.length] = i;\r
-                tickMap[i] = true;\r
-            }\r
-        }\r
-\r
-        this.xTicks.sort(this.DDM.numericSort) ;\r
-    },\r
-\r
+    var startProc = function(el, dir){\r
+        clearProc();\r
+        proc.el = el;\r
+        proc.dir = dir;\r
+        var freq = (el.ddScrollConfig && el.ddScrollConfig.frequency) ? \r
+                el.ddScrollConfig.frequency : Ext.dd.ScrollManager.frequency;\r
+        proc.id = setInterval(doScroll, freq);\r
+    };\r
     \r
-    setYTicks: function(iStartY, iTickSize) {\r
-        this.yTicks = [];\r
-        this.yTickSize = iTickSize;\r
-\r
-        var tickMap = {};\r
-\r
-        for (var i = this.initPageY; i >= this.minY; i = i - iTickSize) {\r
-            if (!tickMap[i]) {\r
-                this.yTicks[this.yTicks.length] = i;\r
-                tickMap[i] = true;\r
-            }\r
+    var onFire = function(e, isDrop){\r
+        if(isDrop || !ddm.dragCurrent){ return; }\r
+        var dds = Ext.dd.ScrollManager;\r
+        if(!dragEl || dragEl != ddm.dragCurrent){\r
+            dragEl = ddm.dragCurrent;\r
+            // refresh regions on drag start\r
+            dds.refreshCache();\r
         }\r
-\r
-        for (i = this.initPageY; i <= this.maxY; i = i + iTickSize) {\r
-            if (!tickMap[i]) {\r
-                this.yTicks[this.yTicks.length] = i;\r
-                tickMap[i] = true;\r
+        \r
+        var xy = Ext.lib.Event.getXY(e);\r
+        var pt = new Ext.lib.Point(xy[0], xy[1]);\r
+        for(var id in els){\r
+            var el = els[id], r = el._region;\r
+            var c = el.ddScrollConfig ? el.ddScrollConfig : dds;\r
+            if(r && r.contains(pt) && el.isScrollable()){\r
+                if(r.bottom - pt.y <= c.vthresh){\r
+                    if(proc.el != el){\r
+                        startProc(el, "down");\r
+                    }\r
+                    return;\r
+                }else if(r.right - pt.x <= c.hthresh){\r
+                    if(proc.el != el){\r
+                        startProc(el, "left");\r
+                    }\r
+                    return;\r
+                }else if(pt.y - r.top <= c.vthresh){\r
+                    if(proc.el != el){\r
+                        startProc(el, "up");\r
+                    }\r
+                    return;\r
+                }else if(pt.x - r.left <= c.hthresh){\r
+                    if(proc.el != el){\r
+                        startProc(el, "right");\r
+                    }\r
+                    return;\r
+                }\r
             }\r
         }\r
-\r
-        this.yTicks.sort(this.DDM.numericSort) ;\r
-    },\r
-\r
-    \r
-    setXConstraint: function(iLeft, iRight, iTickSize) {\r
-        this.leftConstraint = iLeft;\r
-        this.rightConstraint = iRight;\r
-\r
-        this.minX = this.initPageX - iLeft;\r
-        this.maxX = this.initPageX + iRight;\r
-        if (iTickSize) { this.setXTicks(this.initPageX, iTickSize); }\r
-\r
-        this.constrainX = true;\r
-    },\r
-\r
-    \r
-    clearConstraints: function() {\r
-        this.constrainX = false;\r
-        this.constrainY = false;\r
-        this.clearTicks();\r
-    },\r
-\r
-    \r
-    clearTicks: function() {\r
-        this.xTicks = null;\r
-        this.yTicks = null;\r
-        this.xTickSize = 0;\r
-        this.yTickSize = 0;\r
-    },\r
-\r
-    \r
-    setYConstraint: function(iUp, iDown, iTickSize) {\r
-        this.topConstraint = iUp;\r
-        this.bottomConstraint = iDown;\r
-\r
-        this.minY = this.initPageY - iUp;\r
-        this.maxY = this.initPageY + iDown;\r
-        if (iTickSize) { this.setYTicks(this.initPageY, iTickSize); }\r
-\r
-        this.constrainY = true;\r
-\r
-    },\r
-\r
+        clearProc();\r
+    };\r
     \r
-    resetConstraints: function() {\r
-\r
-\r
-        // Maintain offsets if necessary\r
-        if (this.initPageX || this.initPageX === 0) {\r
-            // figure out how much this thing has moved\r
-            var dx = (this.maintainOffset) ? this.lastPageX - this.initPageX : 0;\r
-            var dy = (this.maintainOffset) ? this.lastPageY - this.initPageY : 0;\r
-\r
-            this.setInitPosition(dx, dy);\r
-\r
-        // This is the first time we have detected the element's position\r
-        } else {\r
-            this.setInitPosition();\r
-        }\r
-\r
-        if (this.constrainX) {\r
-            this.setXConstraint( this.leftConstraint,\r
-                                 this.rightConstraint,\r
-                                 this.xTickSize        );\r
-        }\r
-\r
-        if (this.constrainY) {\r
-            this.setYConstraint( this.topConstraint,\r
-                                 this.bottomConstraint,\r
-                                 this.yTickSize         );\r
-        }\r
-    },\r
-\r
+    ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm);\r
+    ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm);\r
     \r
-    getTick: function(val, tickArray) {\r
-\r
-        if (!tickArray) {\r
-            // If tick interval is not defined, it is effectively 1 pixel,\r
-            // so we return the value passed to us.\r
-            return val;\r
-        } else if (tickArray[0] >= val) {\r
-            // The value is lower than the first tick, so we return the first\r
-            // tick.\r
-            return tickArray[0];\r
-        } else {\r
-            for (var i=0, len=tickArray.length; i<len; ++i) {\r
-                var next = i + 1;\r
-                if (tickArray[next] && tickArray[next] >= val) {\r
-                    var diff1 = val - tickArray[i];\r
-                    var diff2 = tickArray[next] - val;\r
-                    return (diff2 > diff1) ? tickArray[i] : tickArray[next];\r
+    return {\r
+        /**\r
+         * Registers new overflow element(s) to auto scroll\r
+         * @param {Mixed/Array} el The id of or the element to be scrolled or an array of either\r
+         */\r
+        register : function(el){\r
+            if(Ext.isArray(el)){\r
+                for(var i = 0, len = el.length; i < len; i++) {\r
+                       this.register(el[i]);\r
                 }\r
+            }else{\r
+                el = Ext.get(el);\r
+                els[el.id] = el;\r
             }\r
-\r
-            // The value is larger than the last tick, so we return the last\r
-            // tick.\r
-            return tickArray[tickArray.length - 1];\r
-        }\r
-    },\r
-\r
-    \r
-    toString: function() {\r
-        return ("DragDrop " + this.id);\r
-    }\r
-\r
-};\r
-\r
-})();\r
-\r
-\r
-// Only load the library once.  Rewriting the manager class would orphan\r
-// existing drag and drop instances.\r
-if (!Ext.dd.DragDropMgr) {\r
-\r
-\r
-Ext.dd.DragDropMgr = function() {\r
-\r
-    var Event = Ext.EventManager;\r
-\r
-    return {\r
-\r
-        \r
-        ids: {},\r
-\r
-        \r
-        handleIds: {},\r
-\r
-        \r
-        dragCurrent: null,\r
-\r
-        \r
-        dragOvers: {},\r
-\r
-        \r
-        deltaX: 0,\r
-\r
-        \r
-        deltaY: 0,\r
-\r
-        \r
-        preventDefault: true,\r
-\r
-        \r
-        stopPropagation: true,\r
-\r
-        \r
-        initialized: false,\r
-\r
-        \r
-        locked: false,\r
-\r
-        \r
-        init: function() {\r
-            this.initialized = true;\r
         },\r
-\r
-        \r
-        POINT: 0,\r
-\r
-        \r
-        INTERSECT: 1,\r
-\r
-        \r
-        mode: 0,\r
-\r
         \r
-        _execOnAll: function(sMethod, args) {\r
-            for (var i in this.ids) {\r
-                for (var j in this.ids[i]) {\r
-                    var oDD = this.ids[i][j];\r
-                    if (! this.isTypeOfDD(oDD)) {\r
-                        continue;\r
-                    }\r
-                    oDD[sMethod].apply(oDD, args);\r
+        /**\r
+         * Unregisters overflow element(s) so they are no longer scrolled\r
+         * @param {Mixed/Array} el The id of or the element to be removed or an array of either\r
+         */\r
+        unregister : function(el){\r
+            if(Ext.isArray(el)){\r
+                for(var i = 0, len = el.length; i < len; i++) {\r
+                       this.unregister(el[i]);\r
                 }\r
+            }else{\r
+                el = Ext.get(el);\r
+                delete els[el.id];\r
             }\r
         },\r
-\r
-        \r
-        _onLoad: function() {\r
-\r
-            this.init();\r
-\r
-\r
-            Event.on(document, "mouseup",   this.handleMouseUp, this, true);\r
-            Event.on(document, "mousemove", this.handleMouseMove, this, true);\r
-            Event.on(window,   "unload",    this._onUnload, this, true);\r
-            Event.on(window,   "resize",    this._onResize, this, true);\r
-            // Event.on(window,   "mouseout",    this._test);\r
-\r
-        },\r
-\r
-        \r
-        _onResize: function(e) {\r
-            this._execOnAll("resetConstraints", []);\r
-        },\r
-\r
-        \r
-        lock: function() { this.locked = true; },\r
-\r
-        \r
-        unlock: function() { this.locked = false; },\r
-\r
         \r
-        isLocked: function() { return this.locked; },\r
+        /**\r
+         * The number of pixels from the top or bottom edge of a container the pointer needs to be to\r
+         * trigger scrolling (defaults to 25)\r
+         * @type Number\r
+         */\r
+        vthresh : 25,\r
+        /**\r
+         * The number of pixels from the right or left edge of a container the pointer needs to be to\r
+         * trigger scrolling (defaults to 25)\r
+         * @type Number\r
+         */\r
+        hthresh : 25,\r
 \r
+        /**\r
+         * The number of pixels to scroll in each scroll increment (defaults to 50)\r
+         * @type Number\r
+         */\r
+        increment : 100,\r
         \r
-        locationCache: {},\r
-\r
+        /**\r
+         * The frequency of scrolls in milliseconds (defaults to 500)\r
+         * @type Number\r
+         */\r
+        frequency : 500,\r
         \r
-        useCache: true,\r
-\r
+        /**\r
+         * True to animate the scroll (defaults to true)\r
+         * @type Boolean\r
+         */\r
+        animate: true,\r
         \r
-        clickPixelThresh: 3,\r
-\r
+        /**\r
+         * The animation duration in seconds - \r
+         * MUST BE less than Ext.dd.ScrollManager.frequency! (defaults to .4)\r
+         * @type Number\r
+         */\r
+        animDuration: .4,\r
         \r
-        clickTimeThresh: 350,\r
-\r
-        \r
-        dragThreshMet: false,\r
-\r
-        \r
-        clickTimeout: null,\r
-\r
-        \r
-        startX: 0,\r
-\r
-        \r
-        startY: 0,\r
-\r
-        \r
-        regDragDrop: function(oDD, sGroup) {\r
-            if (!this.initialized) { this.init(); }\r
-\r
-            if (!this.ids[sGroup]) {\r
-                this.ids[sGroup] = {};\r
+        /**\r
+         * Manually trigger a cache refresh.\r
+         */\r
+        refreshCache : function(){\r
+            for(var id in els){\r
+                if(typeof els[id] == 'object'){ // for people extending the object prototype\r
+                    els[id]._region = els[id].getRegion();\r
+                }\r
             }\r
-            this.ids[sGroup][oDD.id] = oDD;\r
-        },\r
+        }\r
+    };\r
+}();/**\r
+ * @class Ext.dd.Registry\r
+ * Provides easy access to all drag drop components that are registered on a page.  Items can be retrieved either\r
+ * directly by DOM node id, or by passing in the drag drop event that occurred and looking up the event target.\r
+ * @singleton\r
+ */\r
+Ext.dd.Registry = function(){\r
+    var elements = {}; \r
+    var handles = {}; \r
+    var autoIdSeed = 0;\r
 \r
-        \r
-        removeDDFromGroup: function(oDD, sGroup) {\r
-            if (!this.ids[sGroup]) {\r
-                this.ids[sGroup] = {};\r
+    var getId = function(el, autogen){\r
+        if(typeof el == "string"){\r
+            return el;\r
+        }\r
+        var id = el.id;\r
+        if(!id && autogen !== false){\r
+            id = "extdd-" + (++autoIdSeed);\r
+            el.id = id;\r
+        }\r
+        return id;\r
+    };\r
+    \r
+    return {\r
+    /**\r
+     * Resgister a drag drop element\r
+     * @param {String/HTMLElement) element The id or DOM node to register\r
+     * @param {Object} data (optional) An custom data object that will be passed between the elements that are involved\r
+     * in drag drop operations.  You can populate this object with any arbitrary properties that your own code\r
+     * knows how to interpret, plus there are some specific properties known to the Registry that should be\r
+     * populated in the data object (if applicable):\r
+     * <pre>\r
+Value      Description<br />\r
+---------  ------------------------------------------<br />\r
+handles    Array of DOM nodes that trigger dragging<br />\r
+           for the element being registered<br />\r
+isHandle   True if the element passed in triggers<br />\r
+           dragging itself, else false\r
+</pre>\r
+     */\r
+        register : function(el, data){\r
+            data = data || {};\r
+            if(typeof el == "string"){\r
+                el = document.getElementById(el);\r
             }\r
-\r
-            var obj = this.ids[sGroup];\r
-            if (obj && obj[oDD.id]) {\r
-                delete obj[oDD.id];\r
+            data.ddel = el;\r
+            elements[getId(el)] = data;\r
+            if(data.isHandle !== false){\r
+                handles[data.ddel.id] = data;\r
             }\r
-        },\r
-\r
-        \r
-        _remove: function(oDD) {\r
-            for (var g in oDD.groups) {\r
-                if (g && this.ids[g] && this.ids[g][oDD.id]) {\r
-                    delete this.ids[g][oDD.id];\r
+            if(data.handles){\r
+                var hs = data.handles;\r
+                for(var i = 0, len = hs.length; i < len; i++){\r
+                       handles[getId(hs[i])] = data;\r
                 }\r
             }\r
-            delete this.handleIds[oDD.id];\r
-        },\r
-\r
-        \r
-        regHandle: function(sDDId, sHandleId) {\r
-            if (!this.handleIds[sDDId]) {\r
-                this.handleIds[sDDId] = {};\r
-            }\r
-            this.handleIds[sDDId][sHandleId] = sHandleId;\r
-        },\r
-\r
-        \r
-        isDragDrop: function(id) {\r
-            return ( this.getDDById(id) ) ? true : false;\r
         },\r
 \r
-        \r
-        getRelated: function(p_oDD, bTargetsOnly) {\r
-            var oDDs = [];\r
-            for (var i in p_oDD.groups) {\r
-                for (j in this.ids[i]) {\r
-                    var dd = this.ids[i][j];\r
-                    if (! this.isTypeOfDD(dd)) {\r
-                        continue;\r
-                    }\r
-                    if (!bTargetsOnly || dd.isTarget) {\r
-                        oDDs[oDDs.length] = dd;\r
+    /**\r
+     * Unregister a drag drop element\r
+     * @param {String/HTMLElement) element The id or DOM node to unregister\r
+     */\r
+        unregister : function(el){\r
+            var id = getId(el, false);\r
+            var data = elements[id];\r
+            if(data){\r
+                delete elements[id];\r
+                if(data.handles){\r
+                    var hs = data.handles;\r
+                    for(var i = 0, len = hs.length; i < len; i++){\r
+                       delete handles[getId(hs[i], false)];\r
                     }\r
                 }\r
             }\r
-\r
-            return oDDs;\r
         },\r
 \r
-        \r
-        isLegalTarget: function (oDD, oTargetDD) {\r
-            var targets = this.getRelated(oDD, true);\r
-            for (var i=0, len=targets.length;i<len;++i) {\r
-                if (targets[i].id == oTargetDD.id) {\r
-                    return true;\r
-                }\r
+    /**\r
+     * Returns the handle registered for a DOM Node by id\r
+     * @param {String/HTMLElement} id The DOM node or id to look up\r
+     * @return {Object} handle The custom handle data\r
+     */\r
+        getHandle : function(id){\r
+            if(typeof id != "string"){ // must be element?\r
+                id = id.id;\r
             }\r
-\r
-            return false;\r
-        },\r
-\r
-        \r
-        isTypeOfDD: function (oDD) {\r
-            return (oDD && oDD.__ygDragDrop);\r
+            return handles[id];\r
         },\r
 \r
-        \r
-        isHandle: function(sDDId, sHandleId) {\r
-            return ( this.handleIds[sDDId] &&\r
-                            this.handleIds[sDDId][sHandleId] );\r
+    /**\r
+     * Returns the handle that is registered for the DOM node that is the target of the event\r
+     * @param {Event} e The event\r
+     * @return {Object} handle The custom handle data\r
+     */\r
+        getHandleFromEvent : function(e){\r
+            var t = Ext.lib.Event.getTarget(e);\r
+            return t ? handles[t.id] : null;\r
         },\r
 \r
-        \r
-        getDDById: function(id) {\r
-            for (var i in this.ids) {\r
-                if (this.ids[i][id]) {\r
-                    return this.ids[i][id];\r
-                }\r
+    /**\r
+     * Returns a custom data object that is registered for a DOM node by id\r
+     * @param {String/HTMLElement} id The DOM node or id to look up\r
+     * @return {Object} data The custom data\r
+     */\r
+        getTarget : function(id){\r
+            if(typeof id != "string"){ // must be element?\r
+                id = id.id;\r
             }\r
-            return null;\r
+            return elements[id];\r
         },\r
 \r
-        \r
-        handleMouseDown: function(e, oDD) {\r
-            if(Ext.QuickTips){\r
-                Ext.QuickTips.disable();\r
-            }\r
-            if(this.dragCurrent){\r
-                // the original browser mouseup wasn't handled (e.g. outside FF browser window)\r
-                // so clean up first to avoid breaking the next drag\r
-                this.handleMouseUp(e);\r
-            }\r
-            \r
-            this.currentTarget = e.getTarget();\r
-            this.dragCurrent = oDD;\r
-\r
-            var el = oDD.getEl();\r
+    /**\r
+     * Returns a custom data object that is registered for the DOM node that is the target of the event\r
+     * @param {Event} e The event\r
+     * @return {Object} data The custom data\r
+     */\r
+        getTargetFromEvent : function(e){\r
+            var t = Ext.lib.Event.getTarget(e);\r
+            return t ? elements[t.id] || handles[t.id] : null;\r
+        }\r
+    };\r
+}();/**\r
+ * @class Ext.dd.StatusProxy\r
+ * A specialized drag proxy that supports a drop status icon, {@link Ext.Layer} styles and auto-repair.  This is the\r
+ * default drag proxy used by all Ext.dd components.\r
+ * @constructor\r
+ * @param {Object} config\r
+ */\r
+Ext.dd.StatusProxy = function(config){\r
+    Ext.apply(this, config);\r
+    this.id = this.id || Ext.id();\r
+    this.el = new Ext.Layer({\r
+        dh: {\r
+            id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [\r
+                {tag: "div", cls: "x-dd-drop-icon"},\r
+                {tag: "div", cls: "x-dd-drag-ghost"}\r
+            ]\r
+        }, \r
+        shadow: !config || config.shadow !== false\r
+    });\r
+    this.ghost = Ext.get(this.el.dom.childNodes[1]);\r
+    this.dropStatus = this.dropNotAllowed;\r
+};\r
 \r
-            // track start position\r
-            this.startX = e.getPageX();\r
-            this.startY = e.getPageY();\r
+Ext.dd.StatusProxy.prototype = {\r
+    /**\r
+     * @cfg {String} dropAllowed\r
+     * The CSS class to apply to the status element when drop is allowed (defaults to "x-dd-drop-ok").\r
+     */\r
+    dropAllowed : "x-dd-drop-ok",\r
+    /**\r
+     * @cfg {String} dropNotAllowed\r
+     * The CSS class to apply to the status element when drop is not allowed (defaults to "x-dd-drop-nodrop").\r
+     */\r
+    dropNotAllowed : "x-dd-drop-nodrop",\r
 \r
-            this.deltaX = this.startX - el.offsetLeft;\r
-            this.deltaY = this.startY - el.offsetTop;\r
+    /**\r
+     * Updates the proxy's visual element to indicate the status of whether or not drop is allowed\r
+     * over the current target element.\r
+     * @param {String} cssClass The css class for the new drop status indicator image\r
+     */\r
+    setStatus : function(cssClass){\r
+        cssClass = cssClass || this.dropNotAllowed;\r
+        if(this.dropStatus != cssClass){\r
+            this.el.replaceClass(this.dropStatus, cssClass);\r
+            this.dropStatus = cssClass;\r
+        }\r
+    },\r
 \r
-            this.dragThreshMet = false;\r
+    /**\r
+     * Resets the status indicator to the default dropNotAllowed value\r
+     * @param {Boolean} clearGhost True to also remove all content from the ghost, false to preserve it\r
+     */\r
+    reset : function(clearGhost){\r
+        this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;\r
+        this.dropStatus = this.dropNotAllowed;\r
+        if(clearGhost){\r
+            this.ghost.update("");\r
+        }\r
+    },\r
 \r
-            this.clickTimeout = setTimeout(\r
-                    function() {\r
-                        var DDM = Ext.dd.DDM;\r
-                        DDM.startDrag(DDM.startX, DDM.startY);\r
-                    },\r
-                    this.clickTimeThresh );\r
-        },\r
+    /**\r
+     * Updates the contents of the ghost element\r
+     * @param {String/HTMLElement} html The html that will replace the current innerHTML of the ghost element, or a\r
+     * DOM node to append as the child of the ghost element (in which case the innerHTML will be cleared first).\r
+     */\r
+    update : function(html){\r
+        if(typeof html == "string"){\r
+            this.ghost.update(html);\r
+        }else{\r
+            this.ghost.update("");\r
+            html.style.margin = "0";\r
+            this.ghost.dom.appendChild(html);\r
+        }\r
+        var el = this.ghost.dom.firstChild; \r
+        if(el){\r
+            Ext.fly(el).setStyle('float', 'none');\r
+        }\r
+    },\r
 \r
-        \r
-        startDrag: function(x, y) {\r
-            clearTimeout(this.clickTimeout);\r
-            if (this.dragCurrent) {\r
-                this.dragCurrent.b4StartDrag(x, y);\r
-                this.dragCurrent.startDrag(x, y);\r
-            }\r
-            this.dragThreshMet = true;\r
-        },\r
+    /**\r
+     * Returns the underlying proxy {@link Ext.Layer}\r
+     * @return {Ext.Layer} el\r
+    */\r
+    getEl : function(){\r
+        return this.el;\r
+    },\r
 \r
-        \r
-        handleMouseUp: function(e) {\r
+    /**\r
+     * Returns the ghost element\r
+     * @return {Ext.Element} el\r
+     */\r
+    getGhost : function(){\r
+        return this.ghost;\r
+    },\r
 \r
-            if(Ext.QuickTips){\r
-                Ext.QuickTips.enable();\r
-            }\r
-            if (! this.dragCurrent) {\r
-                return;\r
-            }\r
+    /**\r
+     * Hides the proxy\r
+     * @param {Boolean} clear True to reset the status and clear the ghost contents, false to preserve them\r
+     */\r
+    hide : function(clear){\r
+        this.el.hide();\r
+        if(clear){\r
+            this.reset(true);\r
+        }\r
+    },\r
 \r
-            clearTimeout(this.clickTimeout);\r
+    /**\r
+     * Stops the repair animation if it's currently running\r
+     */\r
+    stop : function(){\r
+        if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){\r
+            this.anim.stop();\r
+        }\r
+    },\r
 \r
-            if (this.dragThreshMet) {\r
-                this.fireEvents(e, true);\r
-            } else {\r
-            }\r
+    /**\r
+     * Displays this proxy\r
+     */\r
+    show : function(){\r
+        this.el.show();\r
+    },\r
 \r
-            this.stopDrag(e);\r
+    /**\r
+     * Force the Layer to sync its shadow and shim positions to the element\r
+     */\r
+    sync : function(){\r
+        this.el.sync();\r
+    },\r
 \r
-            this.stopEvent(e);\r
-        },\r
+    /**\r
+     * Causes the proxy to return to its position of origin via an animation.  Should be called after an\r
+     * invalid drop operation by the item being dragged.\r
+     * @param {Array} xy The XY position of the element ([x, y])\r
+     * @param {Function} callback The function to call after the repair is complete\r
+     * @param {Object} scope The scope in which to execute the callback\r
+     */\r
+    repair : function(xy, callback, scope){\r
+        this.callback = callback;\r
+        this.scope = scope;\r
+        if(xy && this.animRepair !== false){\r
+            this.el.addClass("x-dd-drag-repair");\r
+            this.el.hideUnders(true);\r
+            this.anim = this.el.shift({\r
+                duration: this.repairDuration || .5,\r
+                easing: 'easeOut',\r
+                xy: xy,\r
+                stopFx: true,\r
+                callback: this.afterRepair,\r
+                scope: this\r
+            });\r
+        }else{\r
+            this.afterRepair();\r
+        }\r
+    },\r
 \r
-        \r
-        stopEvent: function(e){\r
-            if(this.stopPropagation) {\r
-                e.stopPropagation();\r
-            }\r
+    // private\r
+    afterRepair : function(){\r
+        this.hide(true);\r
+        if(typeof this.callback == "function"){\r
+            this.callback.call(this.scope || this);\r
+        }\r
+        this.callback = null;\r
+        this.scope = null;\r
+    }\r
+};/**\r
+ * @class Ext.dd.DragSource\r
+ * @extends Ext.dd.DDProxy\r
+ * A simple class that provides the basic implementation needed to make any element draggable.\r
+ * @constructor\r
+ * @param {Mixed} el The container element\r
+ * @param {Object} config\r
+ */\r
+Ext.dd.DragSource = function(el, config){\r
+    this.el = Ext.get(el);\r
+    if(!this.dragData){\r
+        this.dragData = {};\r
+    }\r
+    \r
+    Ext.apply(this, config);\r
+    \r
+    if(!this.proxy){\r
+        this.proxy = new Ext.dd.StatusProxy();\r
+    }\r
+    Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group, \r
+          {dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true});\r
+    \r
+    this.dragging = false;\r
+};\r
 \r
-            if (this.preventDefault) {\r
-                e.preventDefault();\r
-            }\r
-        },\r
+Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, {\r
+    /**\r
+     * @cfg {String} ddGroup\r
+     * A named drag drop group to which this object belongs.  If a group is specified, then this object will only\r
+     * interact with other drag drop objects in the same group (defaults to undefined).\r
+     */\r
+    /**\r
+     * @cfg {String} dropAllowed\r
+     * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").\r
+     */\r
+    dropAllowed : "x-dd-drop-ok",\r
+    /**\r
+     * @cfg {String} dropNotAllowed\r
+     * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").\r
+     */\r
+    dropNotAllowed : "x-dd-drop-nodrop",\r
 \r
-        \r
-        stopDrag: function(e) {\r
-            // Fire the drag end event for the item that was dragged\r
-            if (this.dragCurrent) {\r
-                if (this.dragThreshMet) {\r
-                    this.dragCurrent.b4EndDrag(e);\r
-                    this.dragCurrent.endDrag(e);\r
-                }\r
+    /**\r
+     * Returns the data object associated with this drag source\r
+     * @return {Object} data An object containing arbitrary data\r
+     */\r
+    getDragData : function(e){\r
+        return this.dragData;\r
+    },\r
 \r
-                this.dragCurrent.onMouseUp(e);\r
+    // private\r
+    onDragEnter : function(e, id){\r
+        var target = Ext.dd.DragDropMgr.getDDById(id);\r
+        this.cachedTarget = target;\r
+        if(this.beforeDragEnter(target, e, id) !== false){\r
+            if(target.isNotifyTarget){\r
+                var status = target.notifyEnter(this, e, this.dragData);\r
+                this.proxy.setStatus(status);\r
+            }else{\r
+                this.proxy.setStatus(this.dropAllowed);\r
             }\r
-\r
-            this.dragCurrent = null;\r
-            this.dragOvers = {};\r
-        },\r
-\r
-        \r
-        handleMouseMove: function(e) {\r
-            if (! this.dragCurrent) {\r
-                return true;\r
+            \r
+            if(this.afterDragEnter){\r
+                /**\r
+                 * An empty function by default, but provided so that you can perform a custom action\r
+                 * when the dragged item enters the drop target by providing an implementation.\r
+                 * @param {Ext.dd.DragDrop} target The drop target\r
+                 * @param {Event} e The event object\r
+                 * @param {String} id The id of the dragged element\r
+                 * @method afterDragEnter\r
+                 */\r
+                this.afterDragEnter(target, e, id);\r
             }\r
+        }\r
+    },\r
 \r
-            // var button = e.which || e.button;\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action\r
+     * before the dragged item enters the drop target and optionally cancel the onDragEnter.\r
+     * @param {Ext.dd.DragDrop} target The drop target\r
+     * @param {Event} e The event object\r
+     * @param {String} id The id of the dragged element\r
+     * @return {Boolean} isValid True if the drag event is valid, else false to cancel\r
+     */\r
+    beforeDragEnter : function(target, e, id){\r
+        return true;\r
+    },\r
 \r
-            // check for IE mouseup outside of page boundary\r
-            if (Ext.isIE && (e.button !== 0 && e.button !== 1 && e.button !== 2)) {\r
-                this.stopEvent(e);\r
-                return this.handleMouseUp(e);\r
-            }\r
+    // private\r
+    alignElWithMouse: function() {\r
+        Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);\r
+        this.proxy.sync();\r
+    },\r
 \r
-            if (!this.dragThreshMet) {\r
-                var diffX = Math.abs(this.startX - e.getPageX());\r
-                var diffY = Math.abs(this.startY - e.getPageY());\r
-                if (diffX > this.clickPixelThresh ||\r
-                            diffY > this.clickPixelThresh) {\r
-                    this.startDrag(this.startX, this.startY);\r
-                }\r
+    // private\r
+    onDragOver : function(e, id){\r
+        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);\r
+        if(this.beforeDragOver(target, e, id) !== false){\r
+            if(target.isNotifyTarget){\r
+                var status = target.notifyOver(this, e, this.dragData);\r
+                this.proxy.setStatus(status);\r
             }\r
 \r
-            if (this.dragThreshMet) {\r
-                this.dragCurrent.b4Drag(e);\r
-                this.dragCurrent.onDrag(e);\r
-                if(!this.dragCurrent.moveOnly){\r
-                    this.fireEvents(e, false);\r
-                }\r
+            if(this.afterDragOver){\r
+                /**\r
+                 * An empty function by default, but provided so that you can perform a custom action\r
+                 * while the dragged item is over the drop target by providing an implementation.\r
+                 * @param {Ext.dd.DragDrop} target The drop target\r
+                 * @param {Event} e The event object\r
+                 * @param {String} id The id of the dragged element\r
+                 * @method afterDragOver\r
+                 */\r
+                this.afterDragOver(target, e, id);\r
             }\r
+        }\r
+    },\r
 \r
-            this.stopEvent(e);\r
-\r
-            return true;\r
-        },\r
-\r
-        \r
-        fireEvents: function(e, isDrop) {\r
-            var dc = this.dragCurrent;\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action\r
+     * while the dragged item is over the drop target and optionally cancel the onDragOver.\r
+     * @param {Ext.dd.DragDrop} target The drop target\r
+     * @param {Event} e The event object\r
+     * @param {String} id The id of the dragged element\r
+     * @return {Boolean} isValid True if the drag event is valid, else false to cancel\r
+     */\r
+    beforeDragOver : function(target, e, id){\r
+        return true;\r
+    },\r
 \r
-            // If the user did the mouse up outside of the window, we could\r
-            // get here even though we have ended the drag.\r
-            if (!dc || dc.isLocked()) {\r
-                return;\r
+    // private\r
+    onDragOut : function(e, id){\r
+        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);\r
+        if(this.beforeDragOut(target, e, id) !== false){\r
+            if(target.isNotifyTarget){\r
+                target.notifyOut(this, e, this.dragData);\r
+            }\r
+            this.proxy.reset();\r
+            if(this.afterDragOut){\r
+                /**\r
+                 * An empty function by default, but provided so that you can perform a custom action\r
+                 * after the dragged item is dragged out of the target without dropping.\r
+                 * @param {Ext.dd.DragDrop} target The drop target\r
+                 * @param {Event} e The event object\r
+                 * @param {String} id The id of the dragged element\r
+                 * @method afterDragOut\r
+                 */\r
+                this.afterDragOut(target, e, id);\r
             }\r
+        }\r
+        this.cachedTarget = null;\r
+    },\r
 \r
-            var pt = e.getPoint();\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action before the dragged\r
+     * item is dragged out of the target without dropping, and optionally cancel the onDragOut.\r
+     * @param {Ext.dd.DragDrop} target The drop target\r
+     * @param {Event} e The event object\r
+     * @param {String} id The id of the dragged element\r
+     * @return {Boolean} isValid True if the drag event is valid, else false to cancel\r
+     */\r
+    beforeDragOut : function(target, e, id){\r
+        return true;\r
+    },\r
+    \r
+    // private\r
+    onDragDrop : function(e, id){\r
+        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);\r
+        if(this.beforeDragDrop(target, e, id) !== false){\r
+            if(target.isNotifyTarget){\r
+                if(target.notifyDrop(this, e, this.dragData)){ // valid drop?\r
+                    this.onValidDrop(target, e, id);\r
+                }else{\r
+                    this.onInvalidDrop(target, e, id);\r
+                }\r
+            }else{\r
+                this.onValidDrop(target, e, id);\r
+            }\r
+            \r
+            if(this.afterDragDrop){\r
+                /**\r
+                 * An empty function by default, but provided so that you can perform a custom action\r
+                 * after a valid drag drop has occurred by providing an implementation.\r
+                 * @param {Ext.dd.DragDrop} target The drop target\r
+                 * @param {Event} e The event object\r
+                 * @param {String} id The id of the dropped element\r
+                 * @method afterDragDrop\r
+                 */\r
+                this.afterDragDrop(target, e, id);\r
+            }\r
+        }\r
+        delete this.cachedTarget;\r
+    },\r
 \r
-            // cache the previous dragOver array\r
-            var oldOvers = [];\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action before the dragged\r
+     * item is dropped onto the target and optionally cancel the onDragDrop.\r
+     * @param {Ext.dd.DragDrop} target The drop target\r
+     * @param {Event} e The event object\r
+     * @param {String} id The id of the dragged element\r
+     * @return {Boolean} isValid True if the drag drop event is valid, else false to cancel\r
+     */\r
+    beforeDragDrop : function(target, e, id){\r
+        return true;\r
+    },\r
 \r
-            var outEvts   = [];\r
-            var overEvts  = [];\r
-            var dropEvts  = [];\r
-            var enterEvts = [];\r
+    // private\r
+    onValidDrop : function(target, e, id){\r
+        this.hideProxy();\r
+        if(this.afterValidDrop){\r
+            /**\r
+             * An empty function by default, but provided so that you can perform a custom action\r
+             * after a valid drop has occurred by providing an implementation.\r
+             * @param {Object} target The target DD \r
+             * @param {Event} e The event object\r
+             * @param {String} id The id of the dropped element\r
+             * @method afterInvalidDrop\r
+             */\r
+            this.afterValidDrop(target, e, id);\r
+        }\r
+    },\r
 \r
-            // Check to see if the object(s) we were hovering over is no longer\r
-            // being hovered over so we can fire the onDragOut event\r
-            for (var i in this.dragOvers) {\r
+    // private\r
+    getRepairXY : function(e, data){\r
+        return this.el.getXY();  \r
+    },\r
 \r
-                var ddo = this.dragOvers[i];\r
+    // private\r
+    onInvalidDrop : function(target, e, id){\r
+        this.beforeInvalidDrop(target, e, id);\r
+        if(this.cachedTarget){\r
+            if(this.cachedTarget.isNotifyTarget){\r
+                this.cachedTarget.notifyOut(this, e, this.dragData);\r
+            }\r
+            this.cacheTarget = null;\r
+        }\r
+        this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this);\r
 \r
-                if (! this.isTypeOfDD(ddo)) {\r
-                    continue;\r
-                }\r
+        if(this.afterInvalidDrop){\r
+            /**\r
+             * An empty function by default, but provided so that you can perform a custom action\r
+             * after an invalid drop has occurred by providing an implementation.\r
+             * @param {Event} e The event object\r
+             * @param {String} id The id of the dropped element\r
+             * @method afterInvalidDrop\r
+             */\r
+            this.afterInvalidDrop(e, id);\r
+        }\r
+    },\r
 \r
-                if (! this.isOverTarget(pt, ddo, this.mode)) {\r
-                    outEvts.push( ddo );\r
-                }\r
+    // private\r
+    afterRepair : function(){\r
+        if(Ext.enableFx){\r
+            this.el.highlight(this.hlColor || "c3daf9");\r
+        }\r
+        this.dragging = false;\r
+    },\r
 \r
-                oldOvers[i] = true;\r
-                delete this.dragOvers[i];\r
-            }\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action after an invalid\r
+     * drop has occurred.\r
+     * @param {Ext.dd.DragDrop} target The drop target\r
+     * @param {Event} e The event object\r
+     * @param {String} id The id of the dragged element\r
+     * @return {Boolean} isValid True if the invalid drop should proceed, else false to cancel\r
+     */\r
+    beforeInvalidDrop : function(target, e, id){\r
+        return true;\r
+    },\r
 \r
-            for (var sGroup in dc.groups) {\r
+    // private\r
+    handleMouseDown : function(e){\r
+        if(this.dragging) {\r
+            return;\r
+        }\r
+        var data = this.getDragData(e);\r
+        if(data && this.onBeforeDrag(data, e) !== false){\r
+            this.dragData = data;\r
+            this.proxy.stop();\r
+            Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments);\r
+        } \r
+    },\r
 \r
-                if ("string" != typeof sGroup) {\r
-                    continue;\r
-                }\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action before the initial\r
+     * drag event begins and optionally cancel it.\r
+     * @param {Object} data An object containing arbitrary data to be shared with drop targets\r
+     * @param {Event} e The event object\r
+     * @return {Boolean} isValid True if the drag event is valid, else false to cancel\r
+     */\r
+    onBeforeDrag : function(data, e){\r
+        return true;\r
+    },\r
 \r
-                for (i in this.ids[sGroup]) {\r
-                    var oDD = this.ids[sGroup][i];\r
-                    if (! this.isTypeOfDD(oDD)) {\r
-                        continue;\r
-                    }\r
+    /**\r
+     * An empty function by default, but provided so that you can perform a custom action once the initial\r
+     * drag event has begun.  The drag cannot be canceled from this function.\r
+     * @param {Number} x The x position of the click on the dragged object\r
+     * @param {Number} y The y position of the click on the dragged object\r
+     */\r
+    onStartDrag : Ext.emptyFn,\r
 \r
-                    if (oDD.isTarget && !oDD.isLocked() && oDD != dc) {\r
-                        if (this.isOverTarget(pt, oDD, this.mode)) {\r
-                            // look for drop interactions\r
-                            if (isDrop) {\r
-                                dropEvts.push( oDD );\r
-                            // look for drag enter and drag over interactions\r
-                            } else {\r
-\r
-                                // initial drag over: dragEnter fires\r
-                                if (!oldOvers[oDD.id]) {\r
-                                    enterEvts.push( oDD );\r
-                                // subsequent drag overs: dragOver fires\r
-                                } else {\r
-                                    overEvts.push( oDD );\r
-                                }\r
+    // private override\r
+    startDrag : function(x, y){\r
+        this.proxy.reset();\r
+        this.dragging = true;\r
+        this.proxy.update("");\r
+        this.onInitDrag(x, y);\r
+        this.proxy.show();\r
+    },\r
 \r
-                                this.dragOvers[oDD.id] = oDD;\r
-                            }\r
-                        }\r
-                    }\r
-                }\r
-            }\r
+    // private\r
+    onInitDrag : function(x, y){\r
+        var clone = this.el.dom.cloneNode(true);\r
+        clone.id = Ext.id(); // prevent duplicate ids\r
+        this.proxy.update(clone);\r
+        this.onStartDrag(x, y);\r
+        return true;\r
+    },\r
 \r
-            if (this.mode) {\r
-                if (outEvts.length) {\r
-                    dc.b4DragOut(e, outEvts);\r
-                    dc.onDragOut(e, outEvts);\r
-                }\r
+    /**\r
+     * Returns the drag source's underlying {@link Ext.dd.StatusProxy}\r
+     * @return {Ext.dd.StatusProxy} proxy The StatusProxy\r
+     */\r
+    getProxy : function(){\r
+        return this.proxy;  \r
+    },\r
 \r
-                if (enterEvts.length) {\r
-                    dc.onDragEnter(e, enterEvts);\r
-                }\r
+    /**\r
+     * Hides the drag source's {@link Ext.dd.StatusProxy}\r
+     */\r
+    hideProxy : function(){\r
+        this.proxy.hide();  \r
+        this.proxy.reset(true);\r
+        this.dragging = false;\r
+    },\r
 \r
-                if (overEvts.length) {\r
-                    dc.b4DragOver(e, overEvts);\r
-                    dc.onDragOver(e, overEvts);\r
-                }\r
+    // private\r
+    triggerCacheRefresh : function(){\r
+        Ext.dd.DDM.refreshCache(this.groups);\r
+    },\r
 \r
-                if (dropEvts.length) {\r
-                    dc.b4DragDrop(e, dropEvts);\r
-                    dc.onDragDrop(e, dropEvts);\r
-                }\r
+    // private - override to prevent hiding\r
+    b4EndDrag: function(e) {\r
+    },\r
 \r
-            } else {\r
-                // fire dragout events\r
-                var len = 0;\r
-                for (i=0, len=outEvts.length; i<len; ++i) {\r
-                    dc.b4DragOut(e, outEvts[i].id);\r
-                    dc.onDragOut(e, outEvts[i].id);\r
-                }\r
+    // private - override to prevent moving\r
+    endDrag : function(e){\r
+        this.onEndDrag(this.dragData, e);\r
+    },\r
 \r
-                // fire enter events\r
-                for (i=0,len=enterEvts.length; i<len; ++i) {\r
-                    // dc.b4DragEnter(e, oDD.id);\r
-                    dc.onDragEnter(e, enterEvts[i].id);\r
-                }\r
+    // private\r
+    onEndDrag : function(data, e){\r
+    },\r
+    \r
+    // private - pin to cursor\r
+    autoOffset : function(x, y) {\r
+        this.setDelta(-12, -20);\r
+    }    \r
+});/**\r
+ * @class Ext.dd.DropTarget\r
+ * @extends Ext.dd.DDTarget\r
+ * A simple class that provides the basic implementation needed to make any element a drop target that can have\r
+ * draggable items dropped onto it.  The drop has no effect until an implementation of notifyDrop is provided.\r
+ * @constructor\r
+ * @param {Mixed} el The container element\r
+ * @param {Object} config\r
+ */\r
+Ext.dd.DropTarget = function(el, config){\r
+    this.el = Ext.get(el);\r
+    \r
+    Ext.apply(this, config);\r
+    \r
+    if(this.containerScroll){\r
+        Ext.dd.ScrollManager.register(this.el);\r
+    }\r
+    \r
+    Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group, \r
+          {isTarget: true});\r
 \r
-                // fire over events\r
-                for (i=0,len=overEvts.length; i<len; ++i) {\r
-                    dc.b4DragOver(e, overEvts[i].id);\r
-                    dc.onDragOver(e, overEvts[i].id);\r
-                }\r
+};\r
 \r
-                // fire drop events\r
-                for (i=0, len=dropEvts.length; i<len; ++i) {\r
-                    dc.b4DragDrop(e, dropEvts[i].id);\r
-                    dc.onDragDrop(e, dropEvts[i].id);\r
-                }\r
+Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {\r
+    /**\r
+     * @cfg {String} ddGroup\r
+     * A named drag drop group to which this object belongs.  If a group is specified, then this object will only\r
+     * interact with other drag drop objects in the same group (defaults to undefined).\r
+     */\r
+    /**\r
+     * @cfg {String} overClass\r
+     * The CSS class applied to the drop target element while the drag source is over it (defaults to "").\r
+     */\r
+    /**\r
+     * @cfg {String} dropAllowed\r
+     * The CSS class returned to the drag source when drop is allowed (defaults to "x-dd-drop-ok").\r
+     */\r
+    dropAllowed : "x-dd-drop-ok",\r
+    /**\r
+     * @cfg {String} dropNotAllowed\r
+     * The CSS class returned to the drag source when drop is not allowed (defaults to "x-dd-drop-nodrop").\r
+     */\r
+    dropNotAllowed : "x-dd-drop-nodrop",\r
 \r
-            }\r
+    // private\r
+    isTarget : true,\r
 \r
-            // notify about a drop that did not find a target\r
-            if (isDrop && !dropEvts.length) {\r
-                dc.onInvalidDrop(e);\r
-            }\r
+    // private\r
+    isNotifyTarget : true,\r
 \r
-        },\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source is now over the\r
+     * target.  This default implementation adds the CSS class specified by overClass (if any) to the drop element\r
+     * and returns the dropAllowed config value.  This method should be overridden if drop validation is required.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {String} status The CSS class that communicates the drop status back to the source so that the\r
+     * underlying {@link Ext.dd.StatusProxy} can be updated\r
+     */\r
+    notifyEnter : function(dd, e, data){\r
+        if(this.overClass){\r
+            this.el.addClass(this.overClass);\r
+        }\r
+        return this.dropAllowed;\r
+    },\r
 \r
-        \r
-        getBestMatch: function(dds) {\r
-            var winner = null;\r
-            // Return null if the input is not what we expect\r
-            //if (!dds || !dds.length || dds.length == 0) {\r
-               // winner = null;\r
-            // If there is only one item, it wins\r
-            //} else if (dds.length == 1) {\r
-\r
-            var len = dds.length;\r
-\r
-            if (len == 1) {\r
-                winner = dds[0];\r
-            } else {\r
-                // Loop through the targeted items\r
-                for (var i=0; i<len; ++i) {\r
-                    var dd = dds[i];\r
-                    // If the cursor is over the object, it wins.  If the\r
-                    // cursor is over multiple matches, the first one we come\r
-                    // to wins.\r
-                    if (dd.cursorIsOver) {\r
-                        winner = dd;\r
-                        break;\r
-                    // Otherwise the object with the most overlap wins\r
-                    } else {\r
-                        if (!winner ||\r
-                            winner.overlap.getArea() < dd.overlap.getArea()) {\r
-                            winner = dd;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the target.\r
+     * This method will be called on every mouse movement while the drag source is over the drop target.\r
+     * This default implementation simply returns the dropAllowed config value.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {String} status The CSS class that communicates the drop status back to the source so that the\r
+     * underlying {@link Ext.dd.StatusProxy} can be updated\r
+     */\r
+    notifyOver : function(dd, e, data){\r
+        return this.dropAllowed;\r
+    },\r
 \r
-            return winner;\r
-        },\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the source has been dragged\r
+     * out of the target without dropping.  This default implementation simply removes the CSS class specified by\r
+     * overClass (if any) from the drop element.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     */\r
+    notifyOut : function(dd, e, data){\r
+        if(this.overClass){\r
+            this.el.removeClass(this.overClass);\r
+        }\r
+    },\r
 \r
-        \r
-        refreshCache: function(groups) {\r
-            for (var sGroup in groups) {\r
-                if ("string" != typeof sGroup) {\r
-                    continue;\r
-                }\r
-                for (var i in this.ids[sGroup]) {\r
-                    var oDD = this.ids[sGroup][i];\r
-\r
-                    if (this.isTypeOfDD(oDD)) {\r
-                    // if (this.isTypeOfDD(oDD) && oDD.isTarget) {\r
-                        var loc = this.getLocation(oDD);\r
-                        if (loc) {\r
-                            this.locationCache[oDD.id] = loc;\r
-                        } else {\r
-                            delete this.locationCache[oDD.id];\r
-                            // this will unregister the drag and drop object if\r
-                            // the element is not in a usable state\r
-                            // oDD.unreg();\r
-                        }\r
-                    }\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls once to notify this drop target that the dragged item has\r
+     * been dropped on it.  This method has no default implementation and returns false, so you must provide an\r
+     * implementation that does something to process the drop event and returns true so that the drag source's\r
+     * repair action does not run.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {Boolean} True if the drop was valid, else false\r
+     */\r
+    notifyDrop : function(dd, e, data){\r
+        return false;\r
+    }\r
+});/**\r
+ * @class Ext.dd.DragZone\r
+ * @extends Ext.dd.DragSource\r
+ * <p>This class provides a container DD instance that allows dragging of multiple child source nodes.</p>\r
+ * <p>This class does not move the drag target nodes, but a proxy element which may contain\r
+ * any DOM structure you wish. The DOM element to show in the proxy is provided by either a\r
+ * provided implementation of {@link #getDragData}, or by registered draggables registered with {@link Ext.dd.Registry}</p>\r
+ * <p>If you wish to provide draggability for an arbitrary number of DOM nodes, each of which represent some\r
+ * application object (For example nodes in a {@link Ext.DataView DataView}) then use of this class\r
+ * is the most efficient way to "activate" those nodes.</p>\r
+ * <p>By default, this class requires that draggable child nodes are registered with {@link Ext.dd.Registry}.\r
+ * However a simpler way to allow a DragZone to manage any number of draggable elements is to configure\r
+ * the DragZone with  an implementation of the {@link #getDragData} method which interrogates the passed\r
+ * mouse event to see if it has taken place within an element, or class of elements. This is easily done\r
+ * by using the event's {@link Ext.EventObject#getTarget getTarget} method to identify a node based on a\r
+ * {@link Ext.DomQuery} selector. For example, to make the nodes of a DataView draggable, use the following\r
+ * technique. Knowledge of the use of the DataView is required:</p><pre><code>\r
+myDataView.on('render', function() {\r
+    myDataView.dragZone = new Ext.dd.DragZone(myDataView.getEl(), {\r
+\r
+//      On receipt of a mousedown event, see if it is within a DataView node.\r
+//      Return a drag data object if so.\r
+        getDragData: function(e) {\r
+\r
+//          Use the DataView's own itemSelector (a mandatory property) to\r
+//          test if the mousedown is within one of the DataView's nodes.\r
+            var sourceEl = e.getTarget(myDataView.itemSelector, 10);\r
+\r
+//          If the mousedown is within a DataView node, clone the node to produce\r
+//          a ddel element for use by the drag proxy. Also add application data\r
+//          to the returned data object.\r
+            if (sourceEl) {\r
+                d = sourceEl.cloneNode(true);\r
+                d.id = Ext.id();\r
+                return {\r
+                    ddel: d,\r
+                    sourceEl: sourceEl,\r
+                    repairXY: Ext.fly(sourceEl).getXY(),\r
+                    sourceStore: myDataView.store,\r
+                    draggedRecord: v.getRecord(sourceEl)\r
                 }\r
             }\r
         },\r
 \r
-        \r
-        verifyEl: function(el) {\r
-            if (el) {\r
-                var parent;\r
-                if(Ext.isIE){\r
-                    try{\r
-                        parent = el.offsetParent;\r
-                    }catch(e){}\r
-                }else{\r
-                    parent = el.offsetParent;\r
-                }\r
-                if (parent) {\r
-                    return true;\r
-                }\r
-            }\r
-\r
-            return false;\r
-        },\r
-\r
-        \r
-        getLocation: function(oDD) {\r
-            if (! this.isTypeOfDD(oDD)) {\r
-                return null;\r
-            }\r
-\r
-            var el = oDD.getEl(), pos, x1, x2, y1, y2, t, r, b, l;\r
-\r
-            try {\r
-                pos= Ext.lib.Dom.getXY(el);\r
-            } catch (e) { }\r
-\r
-            if (!pos) {\r
-                return null;\r
-            }\r
-\r
-            x1 = pos[0];\r
-            x2 = x1 + el.offsetWidth;\r
-            y1 = pos[1];\r
-            y2 = y1 + el.offsetHeight;\r
-\r
-            t = y1 - oDD.padding[0];\r
-            r = x2 + oDD.padding[1];\r
-            b = y2 + oDD.padding[2];\r
-            l = x1 - oDD.padding[3];\r
-\r
-            return new Ext.lib.Region( t, r, b, l );\r
-        },\r
-\r
-        \r
-        isOverTarget: function(pt, oTarget, intersect) {\r
-            // use cache if available\r
-            var loc = this.locationCache[oTarget.id];\r
-            if (!loc || !this.useCache) {\r
-                loc = this.getLocation(oTarget);\r
-                this.locationCache[oTarget.id] = loc;\r
-\r
-            }\r
-\r
-            if (!loc) {\r
-                return false;\r
-            }\r
-\r
-            oTarget.cursorIsOver = loc.contains( pt );\r
-\r
-            // DragDrop is using this as a sanity check for the initial mousedown\r
-            // in this case we are done.  In POINT mode, if the drag obj has no\r
-            // contraints, we are also done. Otherwise we need to evaluate the\r
-            // location of the target as related to the actual location of the\r
-            // dragged element.\r
-            var dc = this.dragCurrent;\r
-            if (!dc || !dc.getTargetCoord ||\r
-                    (!intersect && !dc.constrainX && !dc.constrainY)) {\r
-                return oTarget.cursorIsOver;\r
-            }\r
-\r
-            oTarget.overlap = null;\r
-\r
-            // Get the current location of the drag element, this is the\r
-            // location of the mouse event less the delta that represents\r
-            // where the original mousedown happened on the element.  We\r
-            // need to consider constraints and ticks as well.\r
-            var pos = dc.getTargetCoord(pt.x, pt.y);\r
-\r
-            var el = dc.getDragEl();\r
-            var curRegion = new Ext.lib.Region( pos.y,\r
-                                                   pos.x + el.offsetWidth,\r
-                                                   pos.y + el.offsetHeight,\r
-                                                   pos.x );\r
-\r
-            var overlap = curRegion.intersect(loc);\r
-\r
-            if (overlap) {\r
-                oTarget.overlap = overlap;\r
-                return (intersect) ? true : oTarget.cursorIsOver;\r
-            } else {\r
-                return false;\r
-            }\r
-        },\r
-\r
-        \r
-        _onUnload: function(e, me) {\r
-            Ext.dd.DragDropMgr.unregAll();\r
-        },\r
-\r
-        \r
-        unregAll: function() {\r
-\r
-            if (this.dragCurrent) {\r
-                this.stopDrag();\r
-                this.dragCurrent = null;\r
-            }\r
-\r
-            this._execOnAll("unreg", []);\r
-\r
-            for (var i in this.elementCache) {\r
-                delete this.elementCache[i];\r
-            }\r
-\r
-            this.elementCache = {};\r
-            this.ids = {};\r
-        },\r
-\r
-        \r
-        elementCache: {},\r
+//      Provide coordinates for the proxy to slide back to on failed drag.\r
+//      This is the original XY coordinates of the draggable element captured\r
+//      in the getDragData method.\r
+        getRepairXY: function() {\r
+            return this.dragData.repairXY;\r
+        }\r
+    });\r
+});</code></pre>\r
+ * See the {@link Ext.dd.DropZone DropZone} documentation for details about building a DropZone which\r
+ * cooperates with this DragZone.\r
+ * @constructor\r
+ * @param {Mixed} el The container element\r
+ * @param {Object} config\r
+ */\r
+Ext.dd.DragZone = function(el, config){\r
+    Ext.dd.DragZone.superclass.constructor.call(this, el, config);\r
+    if(this.containerScroll){\r
+        Ext.dd.ScrollManager.register(this.el);\r
+    }\r
+};\r
 \r
-        \r
-        getElWrapper: function(id) {\r
-            var oWrapper = this.elementCache[id];\r
-            if (!oWrapper || !oWrapper.el) {\r
-                oWrapper = this.elementCache[id] =\r
-                    new this.ElementWrapper(Ext.getDom(id));\r
-            }\r
-            return oWrapper;\r
-        },\r
+Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, {\r
+    /**\r
+     * This property contains the data representing the dragged object. This data is set up by the implementation\r
+     * of the {@link #getDragData} method. It must contain a <tt>ddel</tt> property, but can contain\r
+     * any other data according to the application's needs.\r
+     * @type Object\r
+     * @property dragData\r
+     */\r
+    /**\r
+     * @cfg {Boolean} containerScroll True to register this container with the Scrollmanager\r
+     * for auto scrolling during drag operations.\r
+     */\r
+    /**\r
+     * @cfg {String} hlColor The color to use when visually highlighting the drag source in the afterRepair\r
+     * method after a failed drop (defaults to "c3daf9" - light blue)\r
+     */\r
+\r
+    /**\r
+     * Called when a mousedown occurs in this container. Looks in {@link Ext.dd.Registry}\r
+     * for a valid target to drag based on the mouse down. Override this method\r
+     * to provide your own lookup logic (e.g. finding a child by class name). Make sure your returned\r
+     * object has a "ddel" attribute (with an HTML Element) for other functions to work.\r
+     * @param {EventObject} e The mouse down event\r
+     * @return {Object} The dragData\r
+     */\r
+    getDragData : function(e){\r
+        return Ext.dd.Registry.getHandleFromEvent(e);\r
+    },\r
+    \r
+    /**\r
+     * Called once drag threshold has been reached to initialize the proxy element. By default, it clones the\r
+     * this.dragData.ddel\r
+     * @param {Number} x The x position of the click on the dragged object\r
+     * @param {Number} y The y position of the click on the dragged object\r
+     * @return {Boolean} true to continue the drag, false to cancel\r
+     */\r
+    onInitDrag : function(x, y){\r
+        this.proxy.update(this.dragData.ddel.cloneNode(true));\r
+        this.onStartDrag(x, y);\r
+        return true;\r
+    },\r
+    \r
+    /**\r
+     * Called after a repair of an invalid drop. By default, highlights this.dragData.ddel \r
+     */\r
+    afterRepair : function(){\r
+        if(Ext.enableFx){\r
+            Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");\r
+        }\r
+        this.dragging = false;\r
+    },\r
 \r
-        \r
-        getElement: function(id) {\r
-            return Ext.getDom(id);\r
+    /**\r
+     * Called before a repair of an invalid drop to get the XY to animate to. By default returns\r
+     * the XY of this.dragData.ddel\r
+     * @param {EventObject} e The mouse up event\r
+     * @return {Array} The xy location (e.g. [100, 200])\r
+     */\r
+    getRepairXY : function(e){\r
+        return Ext.Element.fly(this.dragData.ddel).getXY();  \r
+    }\r
+});/**\r
+ * @class Ext.dd.DropZone\r
+ * @extends Ext.dd.DropTarget\r
+ * <p>This class provides a container DD instance that allows dropping on multiple child target nodes.</p>\r
+ * <p>By default, this class requires that child nodes accepting drop are registered with {@link Ext.dd.Registry}.\r
+ * However a simpler way to allow a DropZone to manage any number of target elements is to configure the\r
+ * DropZone with an implementation of {@link #getTargetFromEvent} which interrogates the passed\r
+ * mouse event to see if it has taken place within an element, or class of elements. This is easily done\r
+ * by using the event's {@link Ext.EventObject#getTarget getTarget} method to identify a node based on a\r
+ * {@link Ext.DomQuery} selector.</p>\r
+ * <p>Once the DropZone has detected through calling getTargetFromEvent, that the mouse is over\r
+ * a drop target, that target is passed as the first parameter to {@link #onNodeEnter}, {@link #onNodeOver},\r
+ * {@link #onNodeOut}, {@link #onNodeDrop}. You may configure the instance of DropZone with implementations\r
+ * of these methods to provide application-specific behaviour for these events to update both\r
+ * application state, and UI state.</p>\r
+ * <p>For example to make a GridPanel a cooperating target with the example illustrated in\r
+ * {@link Ext.dd.DragZone DragZone}, the following technique might be used:</p><pre><code>\r
+myGridPanel.on('render', function() {\r
+    myGridPanel.dropZone = new Ext.dd.DropZone(myGridPanel.getView().scroller, {\r
+\r
+//      If the mouse is over a grid row, return that node. This is\r
+//      provided as the "target" parameter in all "onNodeXXXX" node event handling functions\r
+        getTargetFromEvent: function(e) {\r
+            return e.getTarget(myGridPanel.getView().rowSelector);\r
         },\r
 \r
-        \r
-        getCss: function(id) {\r
-            var el = Ext.getDom(id);\r
-            return (el) ? el.style : null;\r
+//      On entry into a target node, highlight that node.\r
+        onNodeEnter : function(target, dd, e, data){ \r
+            Ext.fly(target).addClass('my-row-highlight-class');\r
         },\r
 \r
-        \r
-        ElementWrapper: function(el) {\r
-                \r
-                this.el = el || null;\r
-                \r
-                this.id = this.el && el.id;\r
-                \r
-                this.css = this.el && el.style;\r
-            },\r
-\r
-        \r
-        getPosX: function(el) {\r
-            return Ext.lib.Dom.getX(el);\r
+//      On exit from a target node, unhighlight that node.\r
+        onNodeOut : function(target, dd, e, data){ \r
+            Ext.fly(target).removeClass('my-row-highlight-class');\r
         },\r
 \r
-        \r
-        getPosY: function(el) {\r
-            return Ext.lib.Dom.getY(el);\r
+//      While over a target node, return the default drop allowed class which\r
+//      places a "tick" icon into the drag proxy.\r
+        onNodeOver : function(target, dd, e, data){ \r
+            return Ext.dd.DropZone.prototype.dropAllowed;\r
         },\r
 \r
-        \r
-        swapNode: function(n1, n2) {\r
-            if (n1.swapNode) {\r
-                n1.swapNode(n2);\r
-            } else {\r
-                var p = n2.parentNode;\r
-                var s = n2.nextSibling;\r
+//      On node drop we can interrogate the target to find the underlying\r
+//      application object that is the real target of the dragged data.\r
+//      In this case, it is a Record in the GridPanel's Store.\r
+//      We can use the data set up by the DragZone's getDragData method to read\r
+//      any data we decided to attach in the DragZone's getDragData method.\r
+        onNodeDrop : function(target, dd, e, data){\r
+            var rowIndex = myGridPanel.getView().findRowIndex(target);\r
+            var r = myGridPanel.getStore().getAt(rowIndex);\r
+            Ext.Msg.alert('Drop gesture', 'Dropped Record id ' + data.draggedRecord.id +\r
+                ' on Record id ' + r.id);\r
+            return true;\r
+        }\r
+    });\r
+}\r
+</code></pre>\r
+ * See the {@link Ext.dd.DragZone DragZone} documentation for details about building a DragZone which\r
+ * cooperates with this DropZone.\r
+ * @constructor\r
+ * @param {Mixed} el The container element\r
+ * @param {Object} config\r
+ */\r
+Ext.dd.DropZone = function(el, config){\r
+    Ext.dd.DropZone.superclass.constructor.call(this, el, config);\r
+};\r
 \r
-                if (s == n1) {\r
-                    p.insertBefore(n1, n2);\r
-                } else if (n2 == n1.nextSibling) {\r
-                    p.insertBefore(n2, n1);\r
-                } else {\r
-                    n1.parentNode.replaceChild(n2, n1);\r
-                    p.insertBefore(n1, s);\r
-                }\r
-            }\r
-        },\r
+Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {\r
+    /**\r
+     * Returns a custom data object associated with the DOM node that is the target of the event.  By default\r
+     * this looks up the event target in the {@link Ext.dd.Registry}, although you can override this method to\r
+     * provide your own custom lookup.\r
+     * @param {Event} e The event\r
+     * @return {Object} data The custom data\r
+     */\r
+    getTargetFromEvent : function(e){\r
+        return Ext.dd.Registry.getTargetFromEvent(e);\r
+    },\r
 \r
+    /**\r
+     * Called when the DropZone determines that a {@link Ext.dd.DragSource} has entered a drop node\r
+     * that has either been registered or detected by a configured implementation of {@link #getTargetFromEvent}.\r
+     * This method has no default implementation and should be overridden to provide\r
+     * node-specific processing if necessary.\r
+     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from \r
+     * {@link #getTargetFromEvent} for this node)\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     */\r
+    onNodeEnter : function(n, dd, e, data){\r
         \r
-        getScroll: function () {\r
-            var t, l, dde=document.documentElement, db=document.body;\r
-            if (dde && (dde.scrollTop || dde.scrollLeft)) {\r
-                t = dde.scrollTop;\r
-                l = dde.scrollLeft;\r
-            } else if (db) {\r
-                t = db.scrollTop;\r
-                l = db.scrollLeft;\r
-            } else {\r
-\r
-            }\r
-            return { top: t, left: l };\r
-        },\r
+    },\r
 \r
-        \r
-        getStyle: function(el, styleProp) {\r
-            return Ext.fly(el).getStyle(styleProp);\r
-        },\r
+    /**\r
+     * Called while the DropZone determines that a {@link Ext.dd.DragSource} is over a drop node\r
+     * that has either been registered or detected by a configured implementation of {@link #getTargetFromEvent}.\r
+     * The default implementation returns this.dropNotAllowed, so it should be\r
+     * overridden to provide the proper feedback.\r
+     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from\r
+     * {@link #getTargetFromEvent} for this node)\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {String} status The CSS class that communicates the drop status back to the source so that the\r
+     * underlying {@link Ext.dd.StatusProxy} can be updated\r
+     */\r
+    onNodeOver : function(n, dd, e, data){\r
+        return this.dropAllowed;\r
+    },\r
 \r
+    /**\r
+     * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dragged out of\r
+     * the drop node without dropping.  This method has no default implementation and should be overridden to provide\r
+     * node-specific processing if necessary.\r
+     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from\r
+     * {@link #getTargetFromEvent} for this node)\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     */\r
+    onNodeOut : function(n, dd, e, data){\r
         \r
-        getScrollTop: function () { return this.getScroll().top; },\r
+    },\r
 \r
-        \r
-        getScrollLeft: function () { return this.getScroll().left; },\r
+    /**\r
+     * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped onto\r
+     * the drop node.  The default implementation returns false, so it should be overridden to provide the\r
+     * appropriate processing of the drop event and return true so that the drag source's repair action does not run.\r
+     * @param {Object} nodeData The custom data associated with the drop node (this is the same value returned from\r
+     * {@link #getTargetFromEvent} for this node)\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {Boolean} True if the drop was valid, else false\r
+     */\r
+    onNodeDrop : function(n, dd, e, data){\r
+        return false;\r
+    },\r
 \r
-        \r
-        moveToEl: function (moveEl, targetEl) {\r
-            var aCoord = Ext.lib.Dom.getXY(targetEl);\r
-            Ext.lib.Dom.setXY(moveEl, aCoord);\r
-        },\r
+    /**\r
+     * Called while the DropZone determines that a {@link Ext.dd.DragSource} is being dragged over it,\r
+     * but not over any of its registered drop nodes.  The default implementation returns this.dropNotAllowed, so\r
+     * it should be overridden to provide the proper feedback if necessary.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {String} status The CSS class that communicates the drop status back to the source so that the\r
+     * underlying {@link Ext.dd.StatusProxy} can be updated\r
+     */\r
+    onContainerOver : function(dd, e, data){\r
+        return this.dropNotAllowed;\r
+    },\r
 \r
-        \r
-        numericSort: function(a, b) { return (a - b); },\r
+    /**\r
+     * Called when the DropZone determines that a {@link Ext.dd.DragSource} has been dropped on it,\r
+     * but not on any of its registered drop nodes.  The default implementation returns false, so it should be\r
+     * overridden to provide the appropriate processing of the drop event if you need the drop zone itself to\r
+     * be able to accept drops.  It should return true when valid so that the drag source's repair action does not run.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {Boolean} True if the drop was valid, else false\r
+     */\r
+    onContainerDrop : function(dd, e, data){\r
+        return false;\r
+    },\r
 \r
-        \r
-        _timeoutCount: 0,\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source is now over\r
+     * the zone.  The default implementation returns this.dropNotAllowed and expects that only registered drop\r
+     * nodes can process drag drop operations, so if you need the drop zone itself to be able to process drops\r
+     * you should override this method and provide a custom implementation.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {String} status The CSS class that communicates the drop status back to the source so that the\r
+     * underlying {@link Ext.dd.StatusProxy} can be updated\r
+     */\r
+    notifyEnter : function(dd, e, data){\r
+        return this.dropNotAllowed;\r
+    },\r
 \r
-        \r
-        _addListeners: function() {\r
-            var DDM = Ext.dd.DDM;\r
-            if ( Ext.lib.Event && document ) {\r
-                DDM._onLoad();\r
-            } else {\r
-                if (DDM._timeoutCount > 2000) {\r
-                } else {\r
-                    setTimeout(DDM._addListeners, 10);\r
-                    if (document && document.body) {\r
-                        DDM._timeoutCount += 1;\r
-                    }\r
-                }\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls continuously while it is being dragged over the drop zone.\r
+     * This method will be called on every mouse movement while the drag source is over the drop zone.\r
+     * It will call {@link #onNodeOver} while the drag source is over a registered node, and will also automatically\r
+     * delegate to the appropriate node-specific methods as necessary when the drag source enters and exits\r
+     * registered nodes ({@link #onNodeEnter}, {@link #onNodeOut}). If the drag source is not currently over a\r
+     * registered node, it will call {@link #onContainerOver}.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {String} status The CSS class that communicates the drop status back to the source so that the\r
+     * underlying {@link Ext.dd.StatusProxy} can be updated\r
+     */\r
+    notifyOver : function(dd, e, data){\r
+        var n = this.getTargetFromEvent(e);\r
+        if(!n){ // not over valid drop target\r
+            if(this.lastOverNode){\r
+                this.onNodeOut(this.lastOverNode, dd, e, data);\r
+                this.lastOverNode = null;\r
             }\r
-        },\r
-\r
-        \r
-        handleWasClicked: function(node, id) {\r
-            if (this.isHandle(id, node.id)) {\r
-                return true;\r
-            } else {\r
-                // check to see if this is a text node child of the one we want\r
-                var p = node.parentNode;\r
-\r
-                while (p) {\r
-                    if (this.isHandle(id, p.id)) {\r
-                        return true;\r
-                    } else {\r
-                        p = p.parentNode;\r
-                    }\r
-                }\r
+            return this.onContainerOver(dd, e, data);\r
+        }\r
+        if(this.lastOverNode != n){\r
+            if(this.lastOverNode){\r
+                this.onNodeOut(this.lastOverNode, dd, e, data);\r
             }\r
-\r
-            return false;\r
+            this.onNodeEnter(n, dd, e, data);\r
+            this.lastOverNode = n;\r
         }\r
+        return this.onNodeOver(n, dd, e, data);\r
+    },\r
 \r
-    };\r
-\r
-}();\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the source has been dragged\r
+     * out of the zone without dropping.  If the drag source is currently over a registered node, the notification\r
+     * will be delegated to {@link #onNodeOut} for node-specific handling, otherwise it will be ignored.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop target\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag zone\r
+     */\r
+    notifyOut : function(dd, e, data){\r
+        if(this.lastOverNode){\r
+            this.onNodeOut(this.lastOverNode, dd, e, data);\r
+            this.lastOverNode = null;\r
+        }\r
+    },\r
 \r
-// shorter alias, save a few bytes\r
-Ext.dd.DDM = Ext.dd.DragDropMgr;\r
-Ext.dd.DDM._addListeners();\r
+    /**\r
+     * The function a {@link Ext.dd.DragSource} calls once to notify this drop zone that the dragged item has\r
+     * been dropped on it.  The drag zone will look up the target node based on the event passed in, and if there\r
+     * is a node registered for that event, it will delegate to {@link #onNodeDrop} for node-specific handling,\r
+     * otherwise it will call {@link #onContainerDrop}.\r
+     * @param {Ext.dd.DragSource} source The drag source that was dragged over this drop zone\r
+     * @param {Event} e The event\r
+     * @param {Object} data An object containing arbitrary data supplied by the drag source\r
+     * @return {Boolean} True if the drop was valid, else false\r
+     */\r
+    notifyDrop : function(dd, e, data){\r
+        if(this.lastOverNode){\r
+            this.onNodeOut(this.lastOverNode, dd, e, data);\r
+            this.lastOverNode = null;\r
+        }\r
+        var n = this.getTargetFromEvent(e);\r
+        return n ?\r
+            this.onNodeDrop(n, dd, e, data) :\r
+            this.onContainerDrop(dd, e, data);\r
+    },\r
 \r
-}\r
+    // private\r
+    triggerCacheRefresh : function(){\r
+        Ext.dd.DDM.refreshCache(this.groups);\r
+    }  \r
+});/**\r
+ * @class Ext.Element\r
+ */\r
+Ext.Element.addMethods({\r
+    /**\r
+     * Initializes a {@link Ext.dd.DD} drag drop object for this element.\r
+     * @param {String} group The group the DD object is member of\r
+     * @param {Object} config The DD config object\r
+     * @param {Object} overrides An object containing methods to override/implement on the DD object\r
+     * @return {Ext.dd.DD} The DD object\r
+     */\r
+    initDD : function(group, config, overrides){\r
+        var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);\r
+        return Ext.apply(dd, overrides);\r
+    },\r
 \r
+    /**\r
+     * Initializes a {@link Ext.dd.DDProxy} object for this element.\r
+     * @param {String} group The group the DDProxy object is member of\r
+     * @param {Object} config The DDProxy config object\r
+     * @param {Object} overrides An object containing methods to override/implement on the DDProxy object\r
+     * @return {Ext.dd.DDProxy} The DDProxy object\r
+     */\r
+    initDDProxy : function(group, config, overrides){\r
+        var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);\r
+        return Ext.apply(dd, overrides);\r
+    },\r
 \r
-Ext.dd.DD = function(id, sGroup, config) {\r
-    if (id) {\r
-        this.init(id, sGroup, config);\r
+    /**\r
+     * Initializes a {@link Ext.dd.DDTarget} object for this element.\r
+     * @param {String} group The group the DDTarget object is member of\r
+     * @param {Object} config The DDTarget config object\r
+     * @param {Object} overrides An object containing methods to override/implement on the DDTarget object\r
+     * @return {Ext.dd.DDTarget} The DDTarget object\r
+     */\r
+    initDDTarget : function(group, config, overrides){\r
+        var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);\r
+        return Ext.apply(dd, overrides);\r
     }\r
-};\r
-\r
-Ext.extend(Ext.dd.DD, Ext.dd.DragDrop, {\r
-\r
+});/**
+ * @class Ext.data.Api
+ * @extends Object
+ * Ext.data.Api is a singleton designed to manage the data API including methods
+ * for validating a developer's DataProxy API.  Defines variables for CRUD actions
+ * create, read, update and destroy in addition to a mapping of RESTful HTTP methods
+ * GET, POST, PUT and DELETE to CRUD actions.
+ * @singleton
+ */
+Ext.data.Api = (function() {
+
+    // private validActions.  validActions is essentially an inverted hash of Ext.data.Api.actions, where value becomes the key.
+    // Some methods in this singleton (e.g.: getActions, getVerb) will loop through actions with the code <code>for (var verb in this.actions)</code>
+    // For efficiency, some methods will first check this hash for a match.  Those methods which do acces validActions will cache their result here.
+    // We cannot pre-define this hash since the developer may over-ride the actions at runtime.
+    var validActions = {};
+
+    return {
+        /**
+         * Defined actions corresponding to remote actions:
+         * <pre><code>
+actions: {
+    create  : 'create',  // Text representing the remote-action to create records on server.
+    read    : 'read',    // Text representing the remote-action to read/load data from server.
+    update  : 'update',  // Text representing the remote-action to update records on server.
+    destroy : 'destroy'  // Text representing the remote-action to destroy records on server.
+}
+         * </code></pre>
+         * @property actions
+         * @type Object
+         */
+        actions : {
+            create  : 'create',
+            read    : 'read',
+            update  : 'update',
+            destroy : 'destroy'
+        },
+
+        /**
+         * Defined {CRUD action}:{HTTP method} pairs to associate HTTP methods with the
+         * corresponding actions for {@link Ext.data.DataProxy#restful RESTful proxies}.
+         * Defaults to:
+         * <pre><code>
+restActions : {
+    create  : 'POST',
+    read    : 'GET',
+    update  : 'PUT',
+    destroy : 'DELETE'
+},
+         * </code></pre>
+         */
+        restActions : {
+            create  : 'POST',
+            read    : 'GET',
+            update  : 'PUT',
+            destroy : 'DELETE'
+        },
+
+        /**
+         * Returns true if supplied action-name is a valid API action defined in <code>{@link #actions}</code> constants
+         * @param {String} action
+         * @param {String[]}(Optional) List of available CRUD actions.  Pass in list when executing multiple times for efficiency.
+         * @return {Boolean}
+         */
+        isAction : function(action) {
+            return (Ext.data.Api.actions[action]) ? true : false;
+        },
+
+        /**
+         * Returns the actual CRUD action KEY "create", "read", "update" or "destroy" from the supplied action-name.  This method is used internally and shouldn't generally
+         * need to be used directly.  The key/value pair of Ext.data.Api.actions will often be identical but this is not necessarily true.  A developer can override this naming
+         * convention if desired.  However, the framework internally calls methods based upon the KEY so a way of retreiving the the words "create", "read", "update" and "destroy" is
+         * required.  This method will cache discovered KEYS into the private validActions hash.
+         * @param {String} name The runtime name of the action.
+         * @return {String||null} returns the action-key, or verb of the user-action or null if invalid.
+         * @nodoc
+         */
+        getVerb : function(name) {
+            if (validActions[name]) {
+                return validActions[name];  // <-- found in cache.  return immediately.
+            }
+            for (var verb in this.actions) {
+                if (this.actions[verb] === name) {
+                    validActions[name] = verb;
+                    break;
+                }
+            }
+            return (validActions[name] !== undefined) ? validActions[name] : null;
+        },
+
+        /**
+         * Returns true if the supplied API is valid; that is, check that all keys match defined actions
+         * otherwise returns an array of mistakes.
+         * @return {String[]||true}
+         */
+        isValid : function(api){
+            var invalid = [];
+            var crud = this.actions; // <-- cache a copy of the actions.
+            for (var action in api) {
+                if (!(action in crud)) {
+                    invalid.push(action);
+                }
+            }
+            return (!invalid.length) ? true : invalid;
+        },
+
+        /**
+         * Returns true if the supplied verb upon the supplied proxy points to a unique url in that none of the other api-actions
+         * point to the same url.  The question is important for deciding whether to insert the "xaction" HTTP parameter within an
+         * Ajax request.  This method is used internally and shouldn't generally need to be called directly.
+         * @param {Ext.data.DataProxy} proxy
+         * @param {String} verb
+         * @return {Boolean}
+         */
+        hasUniqueUrl : function(proxy, verb) {
+            var url = (proxy.api[verb]) ? proxy.api[verb].url : null;
+            var unique = true;
+            for (var action in proxy.api) {
+                if ((unique = (action === verb) ? true : (proxy.api[action].url != url) ? true : false) === false) {
+                    break;
+                }
+            }
+            return unique;
+        },
+
+        /**
+         * This method is used internally by <tt>{@link Ext.data.DataProxy DataProxy}</tt> and should not generally need to be used directly.
+         * Each action of a DataProxy api can be initially defined as either a String or an Object.  When specified as an object,
+         * one can explicitly define the HTTP method (GET|POST) to use for each CRUD action.  This method will prepare the supplied API, setting
+         * each action to the Object form.  If your API-actions do not explicitly define the HTTP method, the "method" configuration-parameter will
+         * be used.  If the method configuration parameter is not specified, POST will be used.
+         <pre><code>
+new Ext.data.HttpProxy({
+    method: "POST",     // <-- default HTTP method when not specified.
+    api: {
+        create: 'create.php',
+        load: 'read.php',
+        save: 'save.php',
+        destroy: 'destroy.php'
+    }
+});
+
+// Alternatively, one can use the object-form to specify the API
+new Ext.data.HttpProxy({
+    api: {
+        load: {url: 'read.php', method: 'GET'},
+        create: 'create.php',
+        destroy: 'destroy.php',
+        save: 'update.php'
+    }
+});
+        </code></pre>
+         *
+         * @param {Ext.data.DataProxy} proxy
+         */
+        prepare : function(proxy) {
+            if (!proxy.api) {
+                proxy.api = {}; // <-- No api?  create a blank one.
+            }
+            for (var verb in this.actions) {
+                var action = this.actions[verb];
+                proxy.api[action] = proxy.api[action] || proxy.url || proxy.directFn;
+                if (typeof(proxy.api[action]) == 'string') {
+                    proxy.api[action] = {
+                        url: proxy.api[action]
+                    };
+                }
+            }
+        },
+
+        /**
+         * Prepares a supplied Proxy to be RESTful.  Sets the HTTP method for each api-action to be one of
+         * GET, POST, PUT, DELETE according to the defined {@link #restActions}.
+         * @param {Ext.data.DataProxy} proxy
+         */
+        restify : function(proxy) {
+            proxy.restful = true;
+            for (var verb in this.restActions) {
+                proxy.api[this.actions[verb]].method = this.restActions[verb];
+            }
+        }
+    };
+})();
+
+/**
+ * @class Ext.data.Api.Error
+ * @extends Ext.Error
+ * Error class for Ext.data.Api errors
+ */
+Ext.data.Api.Error = Ext.extend(Ext.Error, {
+    constructor : function(message, arg) {
+        this.arg = arg;
+        Ext.Error.call(this, message);
+    },
+    name: 'Ext.data.Api'
+});
+Ext.apply(Ext.data.Api.Error.prototype, {
+    lang: {
+        'action-url-undefined': 'No fallback url defined for this action.  When defining a DataProxy api, please be sure to define an url for each CRUD action in Ext.data.Api.actions or define a default url in addition to your api-configuration.',
+        'invalid': 'received an invalid API-configuration.  Please ensure your proxy API-configuration contains only the actions defined in Ext.data.Api.actions',
+        'invalid-url': 'Invalid url.  Please review your proxy configuration.',
+        'execute': 'Attempted to execute an unknown action.  Valid API actions are defined in Ext.data.Api.actions"'
+    }
+});
+\r
+/**\r
+ * @class Ext.data.SortTypes\r
+ * @singleton\r
+ * Defines the default sorting (casting?) comparison functions used when sorting data.\r
+ */\r
+Ext.data.SortTypes = {\r
+    /**\r
+     * Default sort that does nothing\r
+     * @param {Mixed} s The value being converted\r
+     * @return {Mixed} The comparison value\r
+     */\r
+    none : function(s){\r
+        return s;\r
+    },\r
     \r
-    scroll: true,\r
-\r
+    /**\r
+     * The regular expression used to strip tags\r
+     * @type {RegExp}\r
+     * @property\r
+     */\r
+    stripTagsRE : /<\/?[^>]+>/gi,\r
     \r
-    autoOffset: function(iPageX, iPageY) {\r
-        var x = iPageX - this.startPageX;\r
-        var y = iPageY - this.startPageY;\r
-        this.setDelta(x, y);\r
+    /**\r
+     * Strips all HTML tags to sort on text only\r
+     * @param {Mixed} s The value being converted\r
+     * @return {String} The comparison value\r
+     */\r
+    asText : function(s){\r
+        return String(s).replace(this.stripTagsRE, "");\r
     },\r
-\r
     \r
-    setDelta: function(iDeltaX, iDeltaY) {\r
-        this.deltaX = iDeltaX;\r
-        this.deltaY = iDeltaY;\r
+    /**\r
+     * Strips all HTML tags to sort on text only - Case insensitive\r
+     * @param {Mixed} s The value being converted\r
+     * @return {String} The comparison value\r
+     */\r
+    asUCText : function(s){\r
+        return String(s).toUpperCase().replace(this.stripTagsRE, "");\r
     },\r
-\r
     \r
-    setDragElPos: function(iPageX, iPageY) {\r
-        // the first time we do this, we are going to check to make sure\r
-        // the element has css positioning\r
-\r
-        var el = this.getDragEl();\r
-        this.alignElWithMouse(el, iPageX, iPageY);\r
+    /**\r
+     * Case insensitive string\r
+     * @param {Mixed} s The value being converted\r
+     * @return {String} The comparison value\r
+     */\r
+    asUCString : function(s) {\r
+       return String(s).toUpperCase();\r
     },\r
-\r
     \r
-    alignElWithMouse: function(el, iPageX, iPageY) {\r
-        var oCoord = this.getTargetCoord(iPageX, iPageY);\r
-        var fly = el.dom ? el : Ext.fly(el, '_dd');\r
-        if (!this.deltaSetXY) {\r
-            var aCoord = [oCoord.x, oCoord.y];\r
-            fly.setXY(aCoord);\r
-            var newLeft = fly.getLeft(true);\r
-            var newTop  = fly.getTop(true);\r
-            this.deltaSetXY = [ newLeft - oCoord.x, newTop - oCoord.y ];\r
-        } else {\r
-            fly.setLeftTop(oCoord.x + this.deltaSetXY[0], oCoord.y + this.deltaSetXY[1]);\r
+    /**\r
+     * Date sorting\r
+     * @param {Mixed} s The value being converted\r
+     * @return {Number} The comparison value\r
+     */\r
+    asDate : function(s) {\r
+        if(!s){\r
+            return 0;\r
         }\r
-\r
-        this.cachePosition(oCoord.x, oCoord.y);\r
-        this.autoScroll(oCoord.x, oCoord.y, el.offsetHeight, el.offsetWidth);\r
-        return oCoord;\r
+        if(Ext.isDate(s)){\r
+            return s.getTime();\r
+        }\r
+       return Date.parse(String(s));\r
     },\r
-\r
     \r
-    cachePosition: function(iPageX, iPageY) {\r
-        if (iPageX) {\r
-            this.lastPageX = iPageX;\r
-            this.lastPageY = iPageY;\r
-        } else {\r
-            var aCoord = Ext.lib.Dom.getXY(this.getEl());\r
-            this.lastPageX = aCoord[0];\r
-            this.lastPageY = aCoord[1];\r
-        }\r
+    /**\r
+     * Float sorting\r
+     * @param {Mixed} s The value being converted\r
+     * @return {Float} The comparison value\r
+     */\r
+    asFloat : function(s) {\r
+       var val = parseFloat(String(s).replace(/,/g, ""));\r
+       return isNaN(val) ? 0 : val;\r
     },\r
-\r
     \r
-    autoScroll: function(x, y, h, w) {\r
-\r
-        if (this.scroll) {\r
-            // The client height\r
-            var clientH = Ext.lib.Dom.getViewHeight();\r
-\r
-            // The client width\r
-            var clientW = Ext.lib.Dom.getViewWidth();\r
-\r
-            // The amt scrolled down\r
-            var st = this.DDM.getScrollTop();\r
-\r
-            // The amt scrolled right\r
-            var sl = this.DDM.getScrollLeft();\r
-\r
-            // Location of the bottom of the element\r
-            var bot = h + y;\r
-\r
-            // Location of the right of the element\r
-            var right = w + x;\r
-\r
-            // The distance from the cursor to the bottom of the visible area,\r
-            // adjusted so that we don't scroll if the cursor is beyond the\r
-            // element drag constraints\r
-            var toBot = (clientH + st - y - this.deltaY);\r
+    /**\r
+     * Integer sorting\r
+     * @param {Mixed} s The value being converted\r
+     * @return {Number} The comparison value\r
+     */\r
+    asInt : function(s) {\r
+        var val = parseInt(String(s).replace(/,/g, ""), 10);\r
+        return isNaN(val) ? 0 : val;\r
+    }\r
+};/**
+ * @class Ext.data.Record
+ * <p>Instances of this class encapsulate both Record <em>definition</em> information, and Record
+ * <em>value</em> information for use in {@link Ext.data.Store} objects, or any code which needs
+ * to access Records cached in an {@link Ext.data.Store} object.</p>
+ * <p>Constructors for this class are generated by passing an Array of field definition objects to {@link #create}.
+ * Instances are usually only created by {@link Ext.data.Reader} implementations when processing unformatted data
+ * objects.</p>
+ * <p>Note that an instance of a Record class may only belong to one {@link Ext.data.Store Store} at a time.
+ * In order to copy data from one Store to another, use the {@link #copy} method to create an exact
+ * copy of the Record, and insert the new instance into the other Store.</p>
+ * <p>When serializing a Record for submission to the server, be aware that it contains many private
+ * properties, and also a reference to its owning Store which in turn holds references to its Records.
+ * This means that a whole Record may not be encoded using {@link Ext.util.JSON.encode}. Instead, use the
+ * <code>{@link #data}</code> and <code>{@link #id}</code> properties.</p>
+ * <p>Record objects generated by this constructor inherit all the methods of Ext.data.Record listed below.</p>
+ * @constructor
+ * This constructor should not be used to create Record objects. Instead, use {@link #create} to
+ * generate a subclass of Ext.data.Record configured with information about its constituent fields.
+ * @param {Object} data (Optional) An object, the properties of which provide values for the new Record's
+ * fields. If not specified the <code>{@link Ext.data.Field#defaultValue defaultValue}</code>
+ * for each field will be assigned.
+ * @param {Object} id (Optional) The id of the Record. This id should be unique, and is used by the
+ * {@link Ext.data.Store} object which owns the Record to index its collection of Records. If
+ * an <code>id</code> is not specified a <b><code>{@link #phantom}</code></b> Record will be created
+ * with an {@link #Record.id automatically generated id}.
+ */
+Ext.data.Record = function(data, id){
+    // if no id, call the auto id method
+    this.id = (id || id === 0) ? id : Ext.data.Record.id(this);
+    this.data = data || {};
+};
+
+/**
+ * Generate a constructor for a specific Record layout.
+ * @param {Array} o An Array of <b>{@link Ext.data.Field Field}</b> definition objects.
+ * The constructor generated by this method may be used to create new Record instances. The data
+ * object must contain properties named after the {@link Ext.data.Field field}
+ * <b><tt>{@link Ext.data.Field#name}s</tt></b>.  Example usage:<pre><code>
+// create a Record constructor from a description of the fields
+var TopicRecord = Ext.data.Record.create([ // creates a subclass of Ext.data.Record
+    {{@link Ext.data.Field#name name}: 'title', {@link Ext.data.Field#mapping mapping}: 'topic_title'},
+    {name: 'author', mapping: 'username', allowBlank: false},
+    {name: 'totalPosts', mapping: 'topic_replies', type: 'int'},
+    {name: 'lastPost', mapping: 'post_time', type: 'date'},
+    {name: 'lastPoster', mapping: 'user2'},
+    {name: 'excerpt', mapping: 'post_text', allowBlank: false},
+    // In the simplest case, if no properties other than <tt>name</tt> are required,
+    // a field definition may consist of just a String for the field name.
+    'signature'
+]);
+
+// create Record instance
+var myNewRecord = new TopicRecord(
+    {
+        title: 'Do my job please',
+        author: 'noobie',
+        totalPosts: 1,
+        lastPost: new Date(),
+        lastPoster: 'Animal',
+        excerpt: 'No way dude!',
+        signature: ''
+    },
+    id // optionally specify the id of the record otherwise {@link #Record.id one is auto-assigned}
+);
+myStore.{@link Ext.data.Store#add add}(myNewRecord);
+</code></pre>
+ * @method create
+ * @return {function} A constructor which is used to create new Records according
+ * to the definition. The constructor has the same signature as {@link #Ext.data.Record}.
+ * @static
+ */
+Ext.data.Record.create = function(o){
+    var f = Ext.extend(Ext.data.Record, {});
+    var p = f.prototype;
+    p.fields = new Ext.util.MixedCollection(false, function(field){
+        return field.name;
+    });
+    for(var i = 0, len = o.length; i < len; i++){
+        p.fields.add(new Ext.data.Field(o[i]));
+    }
+    f.getField = function(name){
+        return p.fields.get(name);
+    };
+    return f;
+};
+
+Ext.data.Record.PREFIX = 'ext-record';
+Ext.data.Record.AUTO_ID = 1;
+Ext.data.Record.EDIT = 'edit';
+Ext.data.Record.REJECT = 'reject';
+Ext.data.Record.COMMIT = 'commit';
+
+
+/**
+ * Generates a sequential id. This method is typically called when a record is {@link #create}d
+ * and {@link #Record no id has been specified}. The returned id takes the form:
+ * <tt>&#123;PREFIX}-&#123;AUTO_ID}</tt>.<div class="mdetail-params"><ul>
+ * <li><b><tt>PREFIX</tt></b> : String<p class="sub-desc"><tt>Ext.data.Record.PREFIX</tt>
+ * (defaults to <tt>'ext-record'</tt>)</p></li>
+ * <li><b><tt>AUTO_ID</tt></b> : String<p class="sub-desc"><tt>Ext.data.Record.AUTO_ID</tt>
+ * (defaults to <tt>1</tt> initially)</p></li>
+ * </ul></div>
+ * @param {Record} rec The record being created.  The record does not exist, it's a {@link #phantom}.
+ * @return {String} auto-generated string id, <tt>"ext-record-i++'</tt>;
+ */
+Ext.data.Record.id = function(rec) {
+    rec.phantom = true;
+    return [Ext.data.Record.PREFIX, '-', Ext.data.Record.AUTO_ID++].join('');
+};
+
+Ext.data.Record.prototype = {
+    /**
+     * <p><b>This property is stored in the Record definition's <u>prototype</u></b></p>
+     * A MixedCollection containing the defined {@link Ext.data.Field Field}s for this Record.  Read-only.
+     * @property fields
+     * @type Ext.util.MixedCollection
+     */
+    /**
+     * An object hash representing the data for this Record. Every field name in the Record definition
+     * is represented by a property of that name in this object. Note that unless you specified a field
+     * with {@link Ext.data.Field#name name} "id" in the Record definition, this will <b>not</b> contain
+     * an <tt>id</tt> property.
+     * @property data
+     * @type {Object}
+     */
+    /**
+     * The unique ID of the Record {@link #Record as specified at construction time}.
+     * @property id
+     * @type {Object}
+     */
+    /**
+     * Readonly flag - true if this Record has been modified.
+     * @type Boolean
+     */
+    dirty : false,
+    editing : false,
+    error: null,
+    /**
+     * This object contains a key and value storing the original values of all modified
+     * fields or is null if no fields have been modified.
+     * @property modified
+     * @type {Object}
+     */
+    modified: null,
+    /**
+     * <tt>false</tt> when the record does not yet exist in a server-side database (see
+     * {@link #markDirty}).  Any record which has a real database pk set as its id property
+     * is NOT a phantom -- it's real.
+     * @property phantom
+     * @type {Boolean}
+     */
+    phantom : false,
+
+    // private
+    join : function(store){
+        /**
+         * The {@link Ext.data.Store} to which this Record belongs.
+         * @property store
+         * @type {Ext.data.Store}
+         */
+        this.store = store;
+    },
+
+    /**
+     * Set the {@link Ext.data.Field#name named field} to the specified value.  For example:
+     * <pre><code>
+// record has a field named 'firstname'
+var Employee = Ext.data.Record.{@link #create}([
+    {name: 'firstname'},
+    ...
+]);
+
+// update the 2nd record in the store:
+var rec = myStore.{@link Ext.data.Store#getAt getAt}(1);
+
+// set the value (shows dirty flag):
+rec.set('firstname', 'Betty');
+
+// commit the change (removes dirty flag):
+rec.{@link #commit}();
+
+// update the record in the store, bypass setting dirty flag,
+// and do not store the change in the {@link Ext.data.Store#getModifiedRecords modified records}
+rec.{@link #data}['firstname'] = 'Wilma'); // updates record, but not the view
+rec.{@link #commit}(); // updates the view
+     * </code></pre>
+     * <b>Notes</b>:<div class="mdetail-params"><ul>
+     * <li>If the store has a writer and <code>autoSave=true</code>, each set()
+     * will execute an XHR to the server.</li>
+     * <li>Use <code>{@link #beginEdit}</code> to prevent the store's <code>update</code>
+     * event firing while using set().</li>
+     * <li>Use <code>{@link #endEdit}</code> to have the store's <code>update</code>
+     * event fire.</li>
+     * </ul></div>
+     * @param {String} name The {@link Ext.data.Field#name name of the field} to set.
+     * @param {Object} value The value to set the field to.
+     */
+    set : function(name, value){
+        var isObj = (typeof value === 'object');
+        if(!isObj && String(this.data[name]) === String(value)){
+            return;
+        } else if (isObj && Ext.encode(this.data[name]) === Ext.encode(value)) {
+            return;
+        }
+        this.dirty = true;
+        if(!this.modified){
+            this.modified = {};
+        }
+        if(typeof this.modified[name] == 'undefined'){
+            this.modified[name] = this.data[name];
+        }
+        this.data[name] = value;
+        if(!this.editing){
+            this.afterEdit();
+        }
+    },
+
+    // private
+    afterEdit: function(){
+        if(this.store){
+            this.store.afterEdit(this);
+        }
+    },
+
+    // private
+    afterReject: function(){
+        if(this.store){
+            this.store.afterReject(this);
+        }
+    },
+
+    // private
+    afterCommit: function(){
+        if(this.store){
+            this.store.afterCommit(this);
+        }
+    },
+
+    /**
+     * Get the value of the {@link Ext.data.Field#name named field}.
+     * @param {String} name The {@link Ext.data.Field#name name of the field} to get the value of.
+     * @return {Object} The value of the field.
+     */
+    get : function(name){
+        return this.data[name];
+    },
+
+    /**
+     * Begin an edit. While in edit mode, no events (e.g.. the <code>update</code> event)
+     * are relayed to the containing store.
+     * See also: <code>{@link #endEdit}</code> and <code>{@link #cancelEdit}</code>.
+     */
+    beginEdit : function(){
+        this.editing = true;
+        this.modified = this.modified || {};
+    },
+
+    /**
+     * Cancels all changes made in the current edit operation.
+     */
+    cancelEdit : function(){
+        this.editing = false;
+        delete this.modified;
+    },
+
+    /**
+     * End an edit. If any data was modified, the containing store is notified
+     * (ie, the store's <code>update</code> event will fire).
+     */
+    endEdit : function(){
+        this.editing = false;
+        if(this.dirty){
+            this.afterEdit();
+        }
+    },
+
+    /**
+     * Usually called by the {@link Ext.data.Store} which owns the Record.
+     * Rejects all changes made to the Record since either creation, or the last commit operation.
+     * Modified fields are reverted to their original values.
+     * <p>Developers should subscribe to the {@link Ext.data.Store#update} event
+     * to have their code notified of reject operations.</p>
+     * @param {Boolean} silent (optional) True to skip notification of the owning
+     * store of the change (defaults to false)
+     */
+    reject : function(silent){
+        var m = this.modified;
+        for(var n in m){
+            if(typeof m[n] != "function"){
+                this.data[n] = m[n];
+            }
+        }
+        this.dirty = false;
+        delete this.modified;
+        this.editing = false;
+        if(silent !== true){
+            this.afterReject();
+        }
+    },
+
+    /**
+     * Usually called by the {@link Ext.data.Store} which owns the Record.
+     * Commits all changes made to the Record since either creation, or the last commit operation.
+     * <p>Developers should subscribe to the {@link Ext.data.Store#update} event
+     * to have their code notified of commit operations.</p>
+     * @param {Boolean} silent (optional) True to skip notification of the owning
+     * store of the change (defaults to false)
+     */
+    commit : function(silent){
+        this.dirty = false;
+        delete this.modified;
+        this.editing = false;
+        if(silent !== true){
+            this.afterCommit();
+        }
+    },
+
+    /**
+     * Gets a hash of only the fields that have been modified since this Record was created or commited.
+     * @return Object
+     */
+    getChanges : function(){
+        var m = this.modified, cs = {};
+        for(var n in m){
+            if(m.hasOwnProperty(n)){
+                cs[n] = this.data[n];
+            }
+        }
+        return cs;
+    },
+
+    // private
+    hasError : function(){
+        return this.error !== null;
+    },
+
+    // private
+    clearError : function(){
+        this.error = null;
+    },
+
+    /**
+     * Creates a copy of this Record.
+     * @param {String} id (optional) A new Record id, defaults to {@link #Record.id autogenerating an id}.
+     * Note: if an <code>id</code> is not specified the copy created will be a
+     * <code>{@link #phantom}</code> Record.
+     * @return {Record}
+     */
+    copy : function(newId) {
+        return new this.constructor(Ext.apply({}, this.data), newId || this.id);
+    },
+
+    /**
+     * Returns <tt>true</tt> if the passed field name has been <code>{@link #modified}</code>
+     * since the load or last commit.
+     * @param {String} fieldName {@link Ext.data.Field.{@link Ext.data.Field#name}
+     * @return {Boolean}
+     */
+    isModified : function(fieldName){
+        return !!(this.modified && this.modified.hasOwnProperty(fieldName));
+    },
+
+    /**
+     * By default returns <tt>false</tt> if any {@link Ext.data.Field field} within the
+     * record configured with <tt>{@link Ext.data.Field#allowBlank} = false</tt> returns
+     * <tt>true</tt> from an {@link Ext}.{@link Ext#isEmpty isempty} test.
+     * @return {Boolean}
+     */
+    isValid : function() {
+        return this.fields.find(function(f) {
+            return (f.allowBlank === false && Ext.isEmpty(this.data[f.name])) ? true : false;
+        },this) ? false : true;
+    },
+
+    /**
+     * <p>Marks this <b>Record</b> as <code>{@link #dirty}</code>.  This method
+     * is used interally when adding <code>{@link #phantom}</code> records to a
+     * {@link Ext.data.Store#writer writer enabled store}.</p>
+     * <br><p>Marking a record <code>{@link #dirty}</code> causes the phantom to
+     * be returned by {@link Ext.data.Store#getModifiedRecords} where it will
+     * have a create action composed for it during {@link Ext.data.Store#save store save}
+     * operations.</p>
+     */
+    markDirty : function(){
+        this.dirty = true;
+        if(!this.modified){
+            this.modified = {};
+        }
+        this.fields.each(function(f) {
+            this.modified[f.name] = this.data[f.name];
+        },this);
+    }
+};/**
+ * @class Ext.StoreMgr
+ * @extends Ext.util.MixedCollection
+ * The default global group of stores.
+ * @singleton
+ */
+Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {
+    /**
+     * @cfg {Object} listeners @hide
+     */
+
+    /**
+     * Registers one or more Stores with the StoreMgr. You do not normally need to register stores
+     * manually.  Any store initialized with a {@link Ext.data.Store#storeId} will be auto-registered. 
+     * @param {Ext.data.Store} store1 A Store instance
+     * @param {Ext.data.Store} store2 (optional)
+     * @param {Ext.data.Store} etc... (optional)
+     */
+    register : function(){
+        for(var i = 0, s; (s = arguments[i]); i++){
+            this.add(s);
+        }
+    },
+
+    /**
+     * Unregisters one or more Stores with the StoreMgr
+     * @param {String/Object} id1 The id of the Store, or a Store instance
+     * @param {String/Object} id2 (optional)
+     * @param {String/Object} etc... (optional)
+     */
+    unregister : function(){
+        for(var i = 0, s; (s = arguments[i]); i++){
+            this.remove(this.lookup(s));
+        }
+    },
+
+    /**
+     * Gets a registered Store by id
+     * @param {String/Object} id The id of the Store, or a Store instance
+     * @return {Ext.data.Store}
+     */
+    lookup : function(id){
+        if(Ext.isArray(id)){
+            var fields = ['field1'], expand = !Ext.isArray(id[0]);
+            if(!expand){
+                for(var i = 2, len = id[0].length; i <= len; ++i){
+                    fields.push('field' + i);
+                }
+            }
+            return new Ext.data.ArrayStore({
+                fields: fields,
+                data: id,
+                expandData: expand,
+                autoDestroy: true,
+                autoCreated: true
+
+            });
+        }
+        return Ext.isObject(id) ? (id.events ? id : Ext.create(id, 'store')) : this.get(id);
+    },
+
+    // getKey implementation for MixedCollection
+    getKey : function(o){
+         return o.storeId;
+    }
+});/**
+ * @class Ext.data.Store
+ * @extends Ext.util.Observable
+ * <p>The Store class encapsulates a client side cache of {@link Ext.data.Record Record}
+ * objects which provide input data for Components such as the {@link Ext.grid.GridPanel GridPanel},
+ * the {@link Ext.form.ComboBox ComboBox}, or the {@link Ext.DataView DataView}.</p>
+ * <p><u>Retrieving Data</u></p>
+ * <p>A Store object may access a data object using:<div class="mdetail-params"><ul>
+ * <li>{@link #proxy configured implementation} of {@link Ext.data.DataProxy DataProxy}</li>
+ * <li>{@link #data} to automatically pass in data</li>
+ * <li>{@link #loadData} to manually pass in data</li>
+ * </ul></div></p>
+ * <p><u>Reading Data</u></p>
+ * <p>A Store object has no inherent knowledge of the format of the data object (it could be
+ * an Array, XML, or JSON). A Store object uses an appropriate {@link #reader configured implementation}
+ * of a {@link Ext.data.DataReader DataReader} to create {@link Ext.data.Record Record} instances from the data
+ * object.</p>
+ * <p><u>Store Types</u></p>
+ * <p>There are several implementations of Store available which are customized for use with
+ * a specific DataReader implementation.  Here is an example using an ArrayStore which implicitly
+ * creates a reader commensurate to an Array data object.</p>
+ * <pre><code>
+var myStore = new Ext.data.ArrayStore({
+    fields: ['fullname', 'first'],
+    idIndex: 0 // id for each record will be the first element
+});
+ * </code></pre>
+ * <p>For custom implementations create a basic {@link Ext.data.Store} configured as needed:</p>
+ * <pre><code>
+// create a {@link Ext.data.Record Record} constructor:
+var rt = Ext.data.Record.create([
+    {name: 'fullname'},
+    {name: 'first'}
+]);
+var myStore = new Ext.data.Store({
+    // explicitly create reader
+    reader: new Ext.data.ArrayReader(
+        {
+            idIndex: 0  // id for each record will be the first element
+        },
+        rt // recordType
+    )
+});
+ * </code></pre>
+ * <p>Load some data into store (note the data object is an array which corresponds to the reader):</p>
+ * <pre><code>
+var myData = [
+    [1, 'Fred Flintstone', 'Fred'],  // note that id for the record is the first element
+    [2, 'Barney Rubble', 'Barney']
+];
+myStore.loadData(myData);
+ * </code></pre>
+ * <p>Records are cached and made available through accessor functions.  An example of adding
+ * a record to the store:</p>
+ * <pre><code>
+var defaultData = {
+    fullname: 'Full Name',
+    first: 'First Name'
+};
+var recId = 100; // provide unique id for the record
+var r = new myStore.recordType(defaultData, ++recId); // create new record
+myStore.{@link #insert}(0, r); // insert a new record into the store (also see {@link #add})
+ * </code></pre>
+ * @constructor
+ * Creates a new Store.
+ * @param {Object} config A config object containing the objects needed for the Store to access data,
+ * and read the data into Records.
+ * @xtype store
+ */
+Ext.data.Store = function(config){
+    this.data = new Ext.util.MixedCollection(false);
+    this.data.getKey = function(o){
+        return o.id;
+    };
+    /**
+     * See the <code>{@link #baseParams corresponding configuration option}</code>
+     * for a description of this property.
+     * To modify this property see <code>{@link #setBaseParam}</code>.
+     * @property
+     */
+    this.baseParams = {};
+
+    // temporary removed-records cache
+    this.removed = [];
+
+    if(config && config.data){
+        this.inlineData = config.data;
+        delete config.data;
+    }
+
+    Ext.apply(this, config);
+    
+    this.paramNames = Ext.applyIf(this.paramNames || {}, this.defaultParamNames);
+
+    if(this.url && !this.proxy){
+        this.proxy = new Ext.data.HttpProxy({url: this.url});
+    }
+    // If Store is RESTful, so too is the DataProxy
+    if (this.restful === true && this.proxy) {
+        // When operating RESTfully, a unique transaction is generated for each record.
+        this.batch = false;
+        Ext.data.Api.restify(this.proxy);
+    }
+
+    if(this.reader){ // reader passed
+        if(!this.recordType){
+            this.recordType = this.reader.recordType;
+        }
+        if(this.reader.onMetaChange){
+            this.reader.onMetaChange = this.onMetaChange.createDelegate(this);
+        }
+        if (this.writer) { // writer passed
+            this.writer.meta = this.reader.meta;
+            this.pruneModifiedRecords = true;
+        }
+    }
+
+    /**
+     * The {@link Ext.data.Record Record} constructor as supplied to (or created by) the
+     * {@link Ext.data.DataReader Reader}. Read-only.
+     * <p>If the Reader was constructed by passing in an Array of {@link Ext.data.Field} definition objects,
+     * instead of a Record constructor, it will implicitly create a Record constructor from that Array (see
+     * {@link Ext.data.Record}.{@link Ext.data.Record#create create} for additional details).</p>
+     * <p>This property may be used to create new Records of the type held in this Store, for example:</p><pre><code>
+// create the data store
+var store = new Ext.data.ArrayStore({
+    autoDestroy: true,
+    fields: [
+       {name: 'company'},
+       {name: 'price', type: 'float'},
+       {name: 'change', type: 'float'},
+       {name: 'pctChange', type: 'float'},
+       {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
+    ]
+});
+store.loadData(myData);
+
+// create the Grid
+var grid = new Ext.grid.EditorGridPanel({
+    store: store,
+    colModel: new Ext.grid.ColumnModel({
+        columns: [
+            {id:'company', header: 'Company', width: 160, dataIndex: 'company'},
+            {header: 'Price', renderer: 'usMoney', dataIndex: 'price'},
+            {header: 'Change', renderer: change, dataIndex: 'change'},
+            {header: '% Change', renderer: pctChange, dataIndex: 'pctChange'},
+            {header: 'Last Updated', width: 85,
+                renderer: Ext.util.Format.dateRenderer('m/d/Y'),
+                dataIndex: 'lastChange'}
+        ],
+        defaults: {
+            sortable: true,
+            width: 75
+        }
+    }),
+    autoExpandColumn: 'company', // match the id specified in the column model
+    height:350,
+    width:600,
+    title:'Array Grid',
+    tbar: [{
+        text: 'Add Record',
+        handler : function(){
+            var defaultData = {
+                change: 0,
+                company: 'New Company',
+                lastChange: (new Date()).clearTime(),
+                pctChange: 0,
+                price: 10
+            };
+            var recId = 3; // provide unique id
+            var p = new store.recordType(defaultData, recId); // create new record
+            grid.stopEditing();
+            store.{@link #insert}(0, p); // insert a new record into the store (also see {@link #add})
+            grid.startEditing(0, 0);
+        }
+    }]
+});
+     * </code></pre>
+     * @property recordType
+     * @type Function
+     */
+
+    if(this.recordType){
+        /**
+         * A {@link Ext.util.MixedCollection MixedCollection} containing the defined {@link Ext.data.Field Field}s
+         * for the {@link Ext.data.Record Records} stored in this Store. Read-only.
+         * @property fields
+         * @type Ext.util.MixedCollection
+         */
+        this.fields = this.recordType.prototype.fields;
+    }
+    this.modified = [];
+
+    this.addEvents(
+        /**
+         * @event datachanged
+         * Fires when the data cache has changed in a bulk manner (e.g., it has been sorted, filtered, etc.) and a
+         * widget that is using this Store as a Record cache should refresh its view.
+         * @param {Store} this
+         */
+        'datachanged',
+        /**
+         * @event metachange
+         * Fires when this store's reader provides new metadata (fields). This is currently only supported for JsonReaders.
+         * @param {Store} this
+         * @param {Object} meta The JSON metadata
+         */
+        'metachange',
+        /**
+         * @event add
+         * Fires when Records have been {@link #add}ed to the Store
+         * @param {Store} this
+         * @param {Ext.data.Record[]} records The array of Records added
+         * @param {Number} index The index at which the record(s) were added
+         */
+        'add',
+        /**
+         * @event remove
+         * Fires when a Record has been {@link #remove}d from the Store
+         * @param {Store} this
+         * @param {Ext.data.Record} record The Record that was removed
+         * @param {Number} index The index at which the record was removed
+         */
+        'remove',
+        /**
+         * @event update
+         * Fires when a Record has been updated
+         * @param {Store} this
+         * @param {Ext.data.Record} record The Record that was updated
+         * @param {String} operation The update operation being performed.  Value may be one of:
+         * <pre><code>
+ Ext.data.Record.EDIT
+ Ext.data.Record.REJECT
+ Ext.data.Record.COMMIT
+         * </code></pre>
+         */
+        'update',
+        /**
+         * @event clear
+         * Fires when the data cache has been cleared.
+         * @param {Store} this
+         */
+        'clear',
+        /**
+         * @event exception
+         * <p>Fires if an exception occurs in the Proxy during a remote request.
+         * This event is relayed through the corresponding {@link Ext.data.DataProxy}.
+         * See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
+         * for additional details.
+         * @param {misc} misc See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
+         * for description.
+         */
+        'exception',
+        /**
+         * @event beforeload
+         * Fires before a request is made for a new data object.  If the beforeload handler returns
+         * <tt>false</tt> the {@link #load} action will be canceled.
+         * @param {Store} this
+         * @param {Object} options The loading options that were specified (see {@link #load} for details)
+         */
+        'beforeload',
+        /**
+         * @event load
+         * Fires after a new set of Records has been loaded.
+         * @param {Store} this
+         * @param {Ext.data.Record[]} records The Records that were loaded
+         * @param {Object} options The loading options that were specified (see {@link #load} for details)
+         */
+        'load',
+        /**
+         * @event loadexception
+         * <p>This event is <b>deprecated</b> in favor of the catch-all <b><code>{@link #exception}</code></b>
+         * event instead.</p>
+         * <p>This event is relayed through the corresponding {@link Ext.data.DataProxy}.
+         * See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#loadexception loadexception}
+         * for additional details.
+         * @param {misc} misc See {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#loadexception loadexception}
+         * for description.
+         */
+        'loadexception',
+        /**
+         * @event beforewrite
+         * @param {DataProxy} this
+         * @param {String} action [Ext.data.Api.actions.create|update|destroy]
+         * @param {Record/Array[Record]} rs
+         * @param {Object} options The loading options that were specified. Edit <code>options.params</code> to add Http parameters to the request.  (see {@link #save} for details)
+         * @param {Object} arg The callback's arg object passed to the {@link #request} function
+         */
+        'beforewrite',
+        /**
+         * @event write
+         * Fires if the server returns 200 after an Ext.data.Api.actions CRUD action.
+         * Success or failure of the action is available in the <code>result['successProperty']</code> property.
+         * The server-code might set the <code>successProperty</code> to <tt>false</tt> if a database validation
+         * failed, for example.
+         * @param {Ext.data.Store} store
+         * @param {String} action [Ext.data.Api.actions.create|update|destroy]
+         * @param {Object} result The 'data' picked-out out of the response for convenience.
+         * @param {Ext.Direct.Transaction} res
+         * @param {Record/Record[]} rs Store's records, the subject(s) of the write-action
+         */
+        'write'
+    );
+
+    if(this.proxy){
+        this.relayEvents(this.proxy,  ['loadexception', 'exception']);
+    }
+    // With a writer set for the Store, we want to listen to add/remove events to remotely create/destroy records.
+    if (this.writer) {
+        this.on({
+            scope: this,
+            add: this.createRecords,
+            remove: this.destroyRecord,
+            update: this.updateRecord
+        });
+    }
+
+    this.sortToggle = {};
+    if(this.sortField){
+        this.setDefaultSort(this.sortField, this.sortDir);
+    }else if(this.sortInfo){
+        this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction);
+    }
+
+    Ext.data.Store.superclass.constructor.call(this);
+
+    if(this.id){
+        this.storeId = this.id;
+        delete this.id;
+    }
+    if(this.storeId){
+        Ext.StoreMgr.register(this);
+    }
+    if(this.inlineData){
+        this.loadData(this.inlineData);
+        delete this.inlineData;
+    }else if(this.autoLoad){
+        this.load.defer(10, this, [
+            typeof this.autoLoad == 'object' ?
+                this.autoLoad : undefined]);
+    }
+};
+Ext.extend(Ext.data.Store, Ext.util.Observable, {
+    /**
+     * @cfg {String} storeId If passed, the id to use to register with the <b>{@link Ext.StoreMgr StoreMgr}</b>.
+     * <p><b>Note</b>: if a (deprecated) <tt>{@link #id}</tt> is specified it will supersede the <tt>storeId</tt>
+     * assignment.</p>
+     */
+    /**
+     * @cfg {String} url If a <tt>{@link #proxy}</tt> is not specified the <tt>url</tt> will be used to
+     * implicitly configure a {@link Ext.data.HttpProxy HttpProxy} if an <tt>url</tt> is specified.
+     * Typically this option, or the <code>{@link #data}</code> option will be specified.
+     */
+    /**
+     * @cfg {Boolean/Object} autoLoad If <tt>{@link #data}</tt> is not specified, and if <tt>autoLoad</tt>
+     * is <tt>true</tt> or an <tt>Object</tt>, this store's {@link #load} method is automatically called
+     * after creation. If the value of <tt>autoLoad</tt> is an <tt>Object</tt>, this <tt>Object</tt> will
+     * be passed to the store's {@link #load} method.
+     */
+    /**
+     * @cfg {Ext.data.DataProxy} proxy The {@link Ext.data.DataProxy DataProxy} object which provides
+     * access to a data object.  See <code>{@link #url}</code>.
+     */
+    /**
+     * @cfg {Array} data An inline data object readable by the <code>{@link #reader}</code>.
+     * Typically this option, or the <code>{@link #url}</code> option will be specified.
+     */
+    /**
+     * @cfg {Ext.data.DataReader} reader The {@link Ext.data.DataReader Reader} object which processes the
+     * data object and returns an Array of {@link Ext.data.Record} objects which are cached keyed by their
+     * <b><tt>{@link Ext.data.Record#id id}</tt></b> property.
+     */
+    /**
+     * @cfg {Ext.data.DataWriter} writer
+     * <p>The {@link Ext.data.DataWriter Writer} object which processes a record object for being written
+     * to the server-side database.</p>
+     * <br><p>When a writer is installed into a Store the {@link #add}, {@link #remove}, and {@link #update}
+     * events on the store are monitored in order to remotely {@link #createRecords create records},
+     * {@link #destroyRecord destroy records}, or {@link #updateRecord update records}.</p>
+     * <br><p>The proxy for this store will relay any {@link #writexception} events to this store.</p>
+     * <br><p>Sample implementation:
+     * <pre><code>
+var writer = new {@link Ext.data.JsonWriter}({
+    encode: true,
+    writeAllFields: true // write all fields, not just those that changed
+});
+
+// Typical Store collecting the Proxy, Reader and Writer together.
+var store = new Ext.data.Store({
+    storeId: 'user',
+    root: 'records',
+    proxy: proxy,
+    reader: reader,
+    writer: writer,     // <-- plug a DataWriter into the store just as you would a Reader
+    paramsAsHash: true,
+    autoSave: false    // <-- false to delay executing create, update, destroy requests
+                        //     until specifically told to do so.
+});
+     * </code></pre></p>
+     */
+    writer : undefined,
+    /**
+     * @cfg {Object} baseParams
+     * <p>An object containing properties which are to be sent as parameters
+     * for <i>every</i> HTTP request.</p>
+     * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p>
+     * <p><b>Note</b>: <code>baseParams</code> may be superseded by any <code>params</code>
+     * specified in a <code>{@link #load}</code> request, see <code>{@link #load}</code>
+     * for more details.</p>
+     * This property may be modified after creation using the <code>{@link #setBaseParam}</code>
+     * method.
+     * @property
+     */
+    /**
+     * @cfg {Object} sortInfo A config object to specify the sort order in the request of a Store's
+     * {@link #load} operation.  Note that for local sorting, the <tt>direction</tt> property is
+     * case-sensitive. See also {@link #remoteSort} and {@link #paramNames}.
+     * For example:<pre><code>
+sortInfo: {
+    field: 'fieldName',
+    direction: 'ASC' // or 'DESC' (case sensitive for local sorting)
+}
+</code></pre>
+     */
+    /**
+     * @cfg {boolean} remoteSort <tt>true</tt> if sorting is to be handled by requesting the <tt>{@link #proxy Proxy}</tt>
+     * to provide a refreshed version of the data object in sorted order, as opposed to sorting the Record cache
+     * in place (defaults to <tt>false</tt>).
+     * <p>If <tt>remoteSort</tt> is <tt>true</tt>, then clicking on a {@link Ext.grid.Column Grid Column}'s
+     * {@link Ext.grid.Column#header header} causes the current page to be requested from the server appending
+     * the following two parameters to the <b><tt>{@link #load params}</tt></b>:<div class="mdetail-params"><ul>
+     * <li><b><tt>sort</tt></b> : String<p class="sub-desc">The <tt>name</tt> (as specified in the Record's
+     * {@link Ext.data.Field Field definition}) of the field to sort on.</p></li>
+     * <li><b><tt>dir</tt></b> : String<p class="sub-desc">The direction of the sort, 'ASC' or 'DESC' (case-sensitive).</p></li>
+     * </ul></div></p>
+     */
+    remoteSort : false,
+
+    /**
+     * @cfg {Boolean} autoDestroy <tt>true</tt> to destroy the store when the component the store is bound
+     * to is destroyed (defaults to <tt>false</tt>).
+     * <p><b>Note</b>: this should be set to true when using stores that are bound to only 1 component.</p>
+     */
+    autoDestroy : false,
+
+    /**
+     * @cfg {Boolean} pruneModifiedRecords <tt>true</tt> to clear all modified record information each time
+     * the store is loaded or when a record is removed (defaults to <tt>false</tt>). See {@link #getModifiedRecords}
+     * for the accessor method to retrieve the modified records.
+     */
+    pruneModifiedRecords : false,
+
+    /**
+     * Contains the last options object used as the parameter to the {@link #load} method. See {@link #load}
+     * for the details of what this may contain. This may be useful for accessing any params which were used
+     * to load the current Record cache.
+     * @property
+     */
+    lastOptions : null,
+
+    /**
+     * @cfg {Boolean} autoSave
+     * <p>Defaults to <tt>true</tt> causing the store to automatically {@link #save} records to
+     * the server when a record is modified (ie: becomes 'dirty'). Specify <tt>false</tt> to manually call {@link #save}
+     * to send all modifiedRecords to the server.</p>
+     * <br><p><b>Note</b>: each CRUD action will be sent as a separate request.</p>
+     */
+    autoSave : true,
+
+    /**
+     * @cfg {Boolean} batch
+     * <p>Defaults to <tt>true</tt> (unless <code>{@link #restful}:true</code>). Multiple
+     * requests for each CRUD action (CREATE, READ, UPDATE and DESTROY) will be combined
+     * and sent as one transaction. Only applies when <code>{@link #autoSave}</code> is set
+     * to <tt>false</tt>.</p>
+     * <br><p>If Store is RESTful, the DataProxy is also RESTful, and a unique transaction is
+     * generated for each record.</p>
+     */
+    batch : true,
+
+    /**
+     * @cfg {Boolean} restful
+     * Defaults to <tt>false</tt>.  Set to <tt>true</tt> to have the Store and the set
+     * Proxy operate in a RESTful manner. The store will automatically generate GET, POST,
+     * PUT and DELETE requests to the server. The HTTP method used for any given CRUD
+     * action is described in {@link Ext.data.Api#restActions}.  For additional information
+     * see {@link Ext.data.DataProxy#restful}.
+     * <p><b>Note</b>: if <code>{@link #restful}:true</code> <code>batch</code> will
+     * internally be set to <tt>false</tt>.</p>
+     */
+    restful: false,
+    
+    /**
+     * @cfg {Object} paramNames
+     * <p>An object containing properties which specify the names of the paging and
+     * sorting parameters passed to remote servers when loading blocks of data. By default, this
+     * object takes the following form:</p><pre><code>
+{
+    start : 'start',  // The parameter name which specifies the start row
+    limit : 'limit',  // The parameter name which specifies number of rows to return
+    sort : 'sort',    // The parameter name which specifies the column to sort on
+    dir : 'dir'       // The parameter name which specifies the sort direction
+}
+</code></pre>
+     * <p>The server must produce the requested data block upon receipt of these parameter names.
+     * If different parameter names are required, this property can be overriden using a configuration
+     * property.</p>
+     * <p>A {@link Ext.PagingToolbar PagingToolbar} bound to this Store uses this property to determine
+     * the parameter names to use in its {@link #load requests}.
+     */
+    paramNames : undefined,
+    
+    /**
+     * @cfg {Object} defaultParamNames
+     * Provides the default values for the {@link #paramNames} property. To globally modify the parameters
+     * for all stores, this object should be changed on the store prototype.
+     */
+    defaultParamNames : {
+        start : 'start',
+        limit : 'limit',
+        sort : 'sort',
+        dir : 'dir'
+    },
+
+    /**
+     * Destroys the store.
+     */
+    destroy : function(){
+        if(this.storeId){
+            Ext.StoreMgr.unregister(this);
+        }
+        this.data = null;
+        Ext.destroy(this.proxy);
+        this.reader = this.writer = null;
+        this.purgeListeners();
+    },
+
+    /**
+     * Add Records to the Store and fires the {@link #add} event.  To add Records
+     * to the store from a remote source use <code>{@link #load}({add:true})</code>.
+     * See also <code>{@link #recordType}</code> and <code>{@link #insert}</code>.
+     * @param {Ext.data.Record[]} records An Array of Ext.data.Record objects
+     * to add to the cache. See {@link #recordType}.
+     */
+    add : function(records){
+        records = [].concat(records);
+        if(records.length < 1){
+            return;
+        }
+        for(var i = 0, len = records.length; i < len; i++){
+            records[i].join(this);
+        }
+        var index = this.data.length;
+        this.data.addAll(records);
+        if(this.snapshot){
+            this.snapshot.addAll(records);
+        }
+        this.fireEvent('add', this, records, index);
+    },
+
+    /**
+     * (Local sort only) Inserts the passed Record into the Store at the index where it
+     * should go based on the current sort information.
+     * @param {Ext.data.Record} record
+     */
+    addSorted : function(record){
+        var index = this.findInsertIndex(record);
+        this.insert(index, record);
+    },
+
+    /**
+     * Remove a Record from the Store and fires the {@link #remove} event.
+     * @param {Ext.data.Record} record The Ext.data.Record object to remove from the cache.
+     */
+    remove : function(record){
+        var index = this.data.indexOf(record);
+        if(index > -1){
+            this.data.removeAt(index);
+            if(this.pruneModifiedRecords){
+                this.modified.remove(record);
+            }
+            if(this.snapshot){
+                this.snapshot.remove(record);
+            }
+            this.fireEvent('remove', this, record, index);
+        }
+    },
+
+    /**
+     * Remove a Record from the Store at the specified index. Fires the {@link #remove} event.
+     * @param {Number} index The index of the record to remove.
+     */
+    removeAt : function(index){
+        this.remove(this.getAt(index));
+    },
+
+    /**
+     * Remove all Records from the Store and fires the {@link #clear} event.
+     */
+    removeAll : function(){
+        this.data.clear();
+        if(this.snapshot){
+            this.snapshot.clear();
+        }
+        if(this.pruneModifiedRecords){
+            this.modified = [];
+        }
+        this.fireEvent('clear', this);
+    },
+
+    /**
+     * Inserts Records into the Store at the given index and fires the {@link #add} event.
+     * See also <code>{@link #add}</code> and <code>{@link #addSorted}</code>.
+     * @param {Number} index The start index at which to insert the passed Records.
+     * @param {Ext.data.Record[]} records An Array of Ext.data.Record objects to add to the cache.
+     */
+    insert : function(index, records){
+        records = [].concat(records);
+        for(var i = 0, len = records.length; i < len; i++){
+            this.data.insert(index, records[i]);
+            records[i].join(this);
+        }
+        this.fireEvent('add', this, records, index);
+    },
+
+    /**
+     * Get the index within the cache of the passed Record.
+     * @param {Ext.data.Record} record The Ext.data.Record object to find.
+     * @return {Number} The index of the passed Record. Returns -1 if not found.
+     */
+    indexOf : function(record){
+        return this.data.indexOf(record);
+    },
+
+    /**
+     * Get the index within the cache of the Record with the passed id.
+     * @param {String} id The id of the Record to find.
+     * @return {Number} The index of the Record. Returns -1 if not found.
+     */
+    indexOfId : function(id){
+        return this.data.indexOfKey(id);
+    },
+
+    /**
+     * Get the Record with the specified id.
+     * @param {String} id The id of the Record to find.
+     * @return {Ext.data.Record} The Record with the passed id. Returns undefined if not found.
+     */
+    getById : function(id){
+        return this.data.key(id);
+    },
+
+    /**
+     * Get the Record at the specified index.
+     * @param {Number} index The index of the Record to find.
+     * @return {Ext.data.Record} The Record at the passed index. Returns undefined if not found.
+     */
+    getAt : function(index){
+        return this.data.itemAt(index);
+    },
+
+    /**
+     * Returns a range of Records between specified indices.
+     * @param {Number} startIndex (optional) The starting index (defaults to 0)
+     * @param {Number} endIndex (optional) The ending index (defaults to the last Record in the Store)
+     * @return {Ext.data.Record[]} An array of Records
+     */
+    getRange : function(start, end){
+        return this.data.getRange(start, end);
+    },
+
+    // private
+    storeOptions : function(o){
+        o = Ext.apply({}, o);
+        delete o.callback;
+        delete o.scope;
+        this.lastOptions = o;
+    },
+
+    /**
+     * <p>Loads the Record cache from the configured <tt>{@link #proxy}</tt> using the configured <tt>{@link #reader}</tt>.</p>
+     * <br><p>Notes:</p><div class="mdetail-params"><ul>
+     * <li><b><u>Important</u></b>: loading is asynchronous! This call will return before the new data has been
+     * loaded. To perform any post-processing where information from the load call is required, specify
+     * the <tt>callback</tt> function to be called, or use a {@link Ext.util.Observable#listeners a 'load' event handler}.</li>
+     * <li>If using {@link Ext.PagingToolbar remote paging}, the first load call must specify the <tt>start</tt> and <tt>limit</tt>
+     * properties in the <code>options.params</code> property to establish the initial position within the
+     * dataset, and the number of Records to cache on each read from the Proxy.</li>
+     * <li>If using {@link #remoteSort remote sorting}, the configured <code>{@link #sortInfo}</code>
+     * will be automatically included with the posted parameters according to the specified
+     * <code>{@link #paramNames}</code>.</li>
+     * </ul></div>
+     * @param {Object} options An object containing properties which control loading options:<ul>
+     * <li><b><tt>params</tt></b> :Object<div class="sub-desc"><p>An object containing properties to pass as HTTP
+     * parameters to a remote data source. <b>Note</b>: <code>params</code> will override any
+     * <code>{@link #baseParams}</code> of the same name.</p>
+     * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p></div></li>
+     * <li><b><tt>callback</tt></b> : Function<div class="sub-desc"><p>A function to be called after the Records
+     * have been loaded. The <tt>callback</tt> is called after the load event and is passed the following arguments:<ul>
+     * <li><tt>r</tt> : Ext.data.Record[]</li>
+     * <li><tt>options</tt>: Options object from the load call</li>
+     * <li><tt>success</tt>: Boolean success indicator</li></ul></p></div></li>
+     * <li><b><tt>scope</tt></b> : Object<div class="sub-desc"><p>Scope with which to call the callback (defaults
+     * to the Store object)</p></div></li>
+     * <li><b><tt>add</tt></b> : Boolean<div class="sub-desc"><p>Indicator to append loaded records rather than
+     * replace the current cache.  <b>Note</b>: see note for <tt>{@link #loadData}</tt></p></div></li>
+     * </ul>
+     * @return {Boolean} If the <i>developer</i> provided <tt>{@link #beforeload}</tt> event handler returns
+     * <tt>false</tt>, the load call will abort and will return <tt>false</tt>; otherwise will return <tt>true</tt>.
+     */
+    load : function(options) {
+        options = options || {};
+        this.storeOptions(options);
+        if(this.sortInfo && this.remoteSort){
+            var pn = this.paramNames;
+            options.params = options.params || {};
+            options.params[pn.sort] = this.sortInfo.field;
+            options.params[pn.dir] = this.sortInfo.direction;
+        }
+        try {
+            return this.execute('read', null, options); // <-- null represents rs.  No rs for load actions.
+        } catch(e) {
+            this.handleException(e);
+            return false;
+        }
+    },
+
+    /**
+     * updateRecord  Should not be used directly.  This method will be called automatically if a Writer is set.
+     * Listens to 'update' event.
+     * @param {Object} store
+     * @param {Object} record
+     * @param {Object} action
+     * @private
+     */
+    updateRecord : function(store, record, action) {
+        if (action == Ext.data.Record.EDIT && this.autoSave === true && (!record.phantom || (record.phantom && record.isValid))) {
+            this.save();
+        }
+    },
+
+    /**
+     * Should not be used directly.  Store#add will call this automatically if a Writer is set
+     * @param {Object} store
+     * @param {Object} rs
+     * @param {Object} index
+     * @private
+     */
+    createRecords : function(store, rs, index) {
+        for (var i = 0, len = rs.length; i < len; i++) {
+            if (rs[i].phantom && rs[i].isValid()) {
+                rs[i].markDirty();  // <-- Mark new records dirty
+                this.modified.push(rs[i]);  // <-- add to modified
+            }
+        }
+        if (this.autoSave === true) {
+            this.save();
+        }
+    },
+
+    /**
+     * Destroys a record or records.  Should not be used directly.  It's called by Store#remove if a Writer is set.
+     * @param {Store} this
+     * @param {Ext.data.Record/Ext.data.Record[]}
+     * @param {Number} index
+     * @private
+     */
+    destroyRecord : function(store, record, index) {
+        if (this.modified.indexOf(record) != -1) {  // <-- handled already if @cfg pruneModifiedRecords == true
+            this.modified.remove(record);
+        }
+        if (!record.phantom) {
+            this.removed.push(record);
+
+            // since the record has already been removed from the store but the server request has not yet been executed,
+            // must keep track of the last known index this record existed.  If a server error occurs, the record can be
+            // put back into the store.  @see Store#createCallback where the record is returned when response status === false
+            record.lastIndex = index;
+
+            if (this.autoSave === true) {
+                this.save();
+            }
+        }
+    },
+
+    /**
+     * This method should generally not be used directly.  This method is called internally
+     * by {@link #load}, or if a Writer is set will be called automatically when {@link #add},
+     * {@link #remove}, or {@link #update} events fire.
+     * @param {String} action Action name ('read', 'create', 'update', or 'destroy')
+     * @param {Record/Record[]} rs
+     * @param {Object} options
+     * @throws Error
+     * @private
+     */
+    execute : function(action, rs, options) {
+        // blow up if action not Ext.data.CREATE, READ, UPDATE, DESTROY
+        if (!Ext.data.Api.isAction(action)) {
+            throw new Ext.data.Api.Error('execute', action);
+        }
+        // make sure options has a params key
+        options = Ext.applyIf(options||{}, {
+            params: {}
+        });
+
+        // have to separate before-events since load has a different signature than create,destroy and save events since load does not
+        // include the rs (record resultset) parameter.  Capture return values from the beforeaction into doRequest flag.
+        var doRequest = true;
+
+        if (action === 'read') {
+            doRequest = this.fireEvent('beforeload', this, options);
+        }
+        else {
+            // if Writer is configured as listful, force single-recoord rs to be [{}} instead of {}
+            if (this.writer.listful === true && this.restful !== true) {
+                rs = (Ext.isArray(rs)) ? rs : [rs];
+            }
+            // if rs has just a single record, shift it off so that Writer writes data as '{}' rather than '[{}]'
+            else if (Ext.isArray(rs) && rs.length == 1) {
+                rs = rs.shift();
+            }
+            // Write the action to options.params
+            if ((doRequest = this.fireEvent('beforewrite', this, action, rs, options)) !== false) {
+                this.writer.write(action, options.params, rs);
+            }
+        }
+        if (doRequest !== false) {
+            // Send request to proxy.
+            var params = Ext.apply({}, options.params, this.baseParams);
+            if (this.writer && this.proxy.url && !this.proxy.restful && !Ext.data.Api.hasUniqueUrl(this.proxy, action)) {
+                params.xaction = action;
+            }
+            // Note:  Up until this point we've been dealing with 'action' as a key from Ext.data.Api.actions.  We'll flip it now
+            // and send the value into DataProxy#request, since it's the value which maps to the DataProxy#api
+            this.proxy.request(Ext.data.Api.actions[action], rs, params, this.reader, this.createCallback(action, rs), this, options);
+        }
+        return doRequest;
+    },
+
+    /**
+     * Saves all pending changes to the store.  If the commensurate Ext.data.Api.actions action is not configured, then
+     * the configured <code>{@link #url}</code> will be used.
+     * <pre>
+     * change            url
+     * ---------------   --------------------
+     * removed records   Ext.data.Api.actions.destroy
+     * phantom records   Ext.data.Api.actions.create
+     * {@link #getModifiedRecords modified records}  Ext.data.Api.actions.update
+     * </pre>
+     * @TODO:  Create extensions of Error class and send associated Record with thrown exceptions.
+     * e.g.:  Ext.data.DataReader.Error or Ext.data.Error or Ext.data.DataProxy.Error, etc.
+     */
+    save : function() {
+        if (!this.writer) {
+            throw new Ext.data.Store.Error('writer-undefined');
+        }
+
+        // DESTROY:  First check for removed records.  Records in this.removed are guaranteed non-phantoms.  @see Store#remove
+        if (this.removed.length) {
+            this.doTransaction('destroy', this.removed);
+        }
+
+        // Check for modified records. Use a copy so Store#rejectChanges will work if server returns error.
+        var rs = [].concat(this.getModifiedRecords());
+        if (!rs.length) { // Bail-out if empty...
+            return true;
+        }
+
+        // CREATE:  Next check for phantoms within rs.  splice-off and execute create.
+        var phantoms = [];
+        for (var i = rs.length-1; i >= 0; i--) {
+            if (rs[i].phantom === true) {
+                var rec = rs.splice(i, 1).shift();
+                if (rec.isValid()) {
+                    phantoms.push(rec);
+                }
+            } else if (!rs[i].isValid()) { // <-- while we're here, splice-off any !isValid real records
+                rs.splice(i,1);
+            }
+        }
+        // If we have valid phantoms, create them...
+        if (phantoms.length) {
+            this.doTransaction('create', phantoms);
+        }
+
+        // UPDATE:  And finally, if we're still here after splicing-off phantoms and !isValid real records, update the rest...
+        if (rs.length) {
+            this.doTransaction('update', rs);
+        }
+        return true;
+    },
+
+    // private.  Simply wraps call to Store#execute in try/catch.  Defers to Store#handleException on error.  Loops if batch: false
+    doTransaction : function(action, rs) {
+        function transaction(records) {
+            try {
+                this.execute(action, records);
+            } catch (e) {
+                this.handleException(e);
+            }
+        }
+        if (this.batch === false) {
+            for (var i = 0, len = rs.length; i < len; i++) {
+                transaction.call(this, rs[i]);
+            }
+        } else {
+            transaction.call(this, rs);
+        }
+    },
+
+    // @private callback-handler for remote CRUD actions
+    // Do not override -- override loadRecords, onCreateRecords, onDestroyRecords and onUpdateRecords instead.
+    createCallback : function(action, rs) {
+        var actions = Ext.data.Api.actions;
+        return (action == 'read') ? this.loadRecords : function(data, response, success) {
+            // calls: onCreateRecords | onUpdateRecords | onDestroyRecords
+            this['on' + Ext.util.Format.capitalize(action) + 'Records'](success, rs, data);
+            // If success === false here, exception will have been called in DataProxy
+            if (success === true) {
+                this.fireEvent('write', this, action, data, response, rs);
+            }
+        };
+    },
+
+    // Clears records from modified array after an exception event.
+    // NOTE:  records are left marked dirty.  Do we want to commit them even though they were not updated/realized?
+    clearModified : function(rs) {
+        if (Ext.isArray(rs)) {
+            for (var n=rs.length-1;n>=0;n--) {
+                this.modified.splice(this.modified.indexOf(rs[n]), 1);
+            }
+        } else {
+            this.modified.splice(this.modified.indexOf(rs), 1);
+        }
+    },
+
+    // remap record ids in MixedCollection after records have been realized.  @see Store#onCreateRecords, @see DataReader#realize
+    reMap : function(record) {
+        if (Ext.isArray(record)) {
+            for (var i = 0, len = record.length; i < len; i++) {
+                this.reMap(record[i]);
+            }
+        } else {
+            delete this.data.map[record._phid];
+            this.data.map[record.id] = record;
+            var index = this.data.keys.indexOf(record._phid);
+            this.data.keys.splice(index, 1, record.id);
+            delete record._phid;
+        }
+    },
+
+    // @protected onCreateRecord proxy callback for create action
+    onCreateRecords : function(success, rs, data) {
+        if (success === true) {
+            try {
+                this.reader.realize(rs, data);
+                this.reMap(rs);
+            }
+            catch (e) {
+                this.handleException(e);
+                if (Ext.isArray(rs)) {
+                    // Recurse to run back into the try {}.  DataReader#realize splices-off the rs until empty.
+                    this.onCreateRecords(success, rs, data);
+                }
+            }
+        }
+    },
+
+    // @protected, onUpdateRecords proxy callback for update action
+    onUpdateRecords : function(success, rs, data) {
+        if (success === true) {
+            try {
+                this.reader.update(rs, data);
+            } catch (e) {
+                this.handleException(e);
+                if (Ext.isArray(rs)) {
+                    // Recurse to run back into the try {}.  DataReader#update splices-off the rs until empty.
+                    this.onUpdateRecords(success, rs, data);
+                }
+            }
+        }
+    },
+
+    // @protected onDestroyRecords proxy callback for destroy action
+    onDestroyRecords : function(success, rs, data) {
+        // splice each rec out of this.removed
+        rs = (rs instanceof Ext.data.Record) ? [rs] : rs;
+        for (var i=0,len=rs.length;i<len;i++) {
+            this.removed.splice(this.removed.indexOf(rs[i]), 1);
+        }
+        if (success === false) {
+            // put records back into store if remote destroy fails.
+            // @TODO: Might want to let developer decide.
+            for (i=rs.length-1;i>=0;i--) {
+                this.insert(rs[i].lastIndex, rs[i]);    // <-- lastIndex set in Store#destroyRecord
+            }
+        }
+    },
+
+    // protected handleException.  Possibly temporary until Ext framework has an exception-handler.
+    handleException : function(e) {
+        // @see core/Error.js
+        Ext.handleError(e);
+    },
+
+    /**
+     * <p>Reloads the Record cache from the configured Proxy using the configured {@link Ext.data.Reader Reader} and
+     * the options from the last load operation performed.</p>
+     * <p><b>Note</b>: see the Important note in {@link #load}.</p>
+     * @param {Object} options (optional) An <tt>Object</tt> containing {@link #load loading options} which may
+     * override the options used in the last {@link #load} operation. See {@link #load} for details (defaults to
+     * <tt>null</tt>, in which case the {@link #lastOptions} are used).
+     */
+    reload : function(options){
+        this.load(Ext.applyIf(options||{}, this.lastOptions));
+    },
+
+    // private
+    // Called as a callback by the Reader during a load operation.
+    loadRecords : function(o, options, success){
+        if(!o || success === false){
+            if(success !== false){
+                this.fireEvent('load', this, [], options);
+            }
+            if(options.callback){
+                options.callback.call(options.scope || this, [], options, false, o);
+            }
+            return;
+        }
+        var r = o.records, t = o.totalRecords || r.length;
+        if(!options || options.add !== true){
+            if(this.pruneModifiedRecords){
+                this.modified = [];
+            }
+            for(var i = 0, len = r.length; i < len; i++){
+                r[i].join(this);
+            }
+            if(this.snapshot){
+                this.data = this.snapshot;
+                delete this.snapshot;
+            }
+            this.data.clear();
+            this.data.addAll(r);
+            this.totalLength = t;
+            this.applySort();
+            this.fireEvent('datachanged', this);
+        }else{
+            this.totalLength = Math.max(t, this.data.length+r.length);
+            this.add(r);
+        }
+        this.fireEvent('load', this, r, options);
+        if(options.callback){
+            options.callback.call(options.scope || this, r, options, true);
+        }
+    },
+
+    /**
+     * Loads data from a passed data block and fires the {@link #load} event. A {@link Ext.data.Reader Reader}
+     * which understands the format of the data must have been configured in the constructor.
+     * @param {Object} data The data block from which to read the Records.  The format of the data expected
+     * is dependent on the type of {@link Ext.data.Reader Reader} that is configured and should correspond to
+     * that {@link Ext.data.Reader Reader}'s <tt>{@link Ext.data.Reader#readRecords}</tt> parameter.
+     * @param {Boolean} append (Optional) <tt>true</tt> to append the new Records rather the default to replace
+     * the existing cache.
+     * <b>Note</b>: that Records in a Store are keyed by their {@link Ext.data.Record#id id}, so added Records
+     * with ids which are already present in the Store will <i>replace</i> existing Records. Only Records with
+     * new, unique ids will be added.
+     */
+    loadData : function(o, append){
+        var r = this.reader.readRecords(o);
+        this.loadRecords(r, {add: append}, true);
+    },
+
+    /**
+     * Gets the number of cached records.
+     * <p>If using paging, this may not be the total size of the dataset. If the data object
+     * used by the Reader contains the dataset size, then the {@link #getTotalCount} function returns
+     * the dataset size.  <b>Note</b>: see the Important note in {@link #load}.</p>
+     * @return {Number} The number of Records in the Store's cache.
+     */
+    getCount : function(){
+        return this.data.length || 0;
+    },
+
+    /**
+     * Gets the total number of records in the dataset as returned by the server.
+     * <p>If using paging, for this to be accurate, the data object used by the {@link #reader Reader}
+     * must contain the dataset size. For remote data sources, the value for this property
+     * (<tt>totalProperty</tt> for {@link Ext.data.JsonReader JsonReader},
+     * <tt>totalRecords</tt> for {@link Ext.data.XmlReader XmlReader}) shall be returned by a query on the server.
+     * <b>Note</b>: see the Important note in {@link #load}.</p>
+     * @return {Number} The number of Records as specified in the data object passed to the Reader
+     * by the Proxy.
+     * <p><b>Note</b>: this value is not updated when changing the contents of the Store locally.</p>
+     */
+    getTotalCount : function(){
+        return this.totalLength || 0;
+    },
+
+    /**
+     * Returns an object describing the current sort state of this Store.
+     * @return {Object} The sort state of the Store. An object with two properties:<ul>
+     * <li><b>field : String<p class="sub-desc">The name of the field by which the Records are sorted.</p></li>
+     * <li><b>direction : String<p class="sub-desc">The sort order, 'ASC' or 'DESC' (case-sensitive).</p></li>
+     * </ul>
+     * See <tt>{@link #sortInfo}</tt> for additional details.
+     */
+    getSortState : function(){
+        return this.sortInfo;
+    },
+
+    // private
+    applySort : function(){
+        if(this.sortInfo && !this.remoteSort){
+            var s = this.sortInfo, f = s.field;
+            this.sortData(f, s.direction);
+        }
+    },
+
+    // private
+    sortData : function(f, direction){
+        direction = direction || 'ASC';
+        var st = this.fields.get(f).sortType;
+        var fn = function(r1, r2){
+            var v1 = st(r1.data[f]), v2 = st(r2.data[f]);
+            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);
+        };
+        this.data.sort(direction, fn);
+        if(this.snapshot && this.snapshot != this.data){
+            this.snapshot.sort(direction, fn);
+        }
+    },
+
+    /**
+     * Sets the default sort column and order to be used by the next {@link #load} operation.
+     * @param {String} fieldName The name of the field to sort by.
+     * @param {String} dir (optional) The sort order, 'ASC' or 'DESC' (case-sensitive, defaults to <tt>'ASC'</tt>)
+     */
+    setDefaultSort : function(field, dir){
+        dir = dir ? dir.toUpperCase() : 'ASC';
+        this.sortInfo = {field: field, direction: dir};
+        this.sortToggle[field] = dir;
+    },
+
+    /**
+     * Sort the Records.
+     * If remote sorting is used, the sort is performed on the server, and the cache is reloaded. If local
+     * sorting is used, the cache is sorted internally. See also {@link #remoteSort} and {@link #paramNames}.
+     * @param {String} fieldName The name of the field to sort by.
+     * @param {String} dir (optional) The sort order, 'ASC' or 'DESC' (case-sensitive, defaults to <tt>'ASC'</tt>)
+     */
+    sort : function(fieldName, dir){
+        var f = this.fields.get(fieldName);
+        if(!f){
+            return false;
+        }
+        if(!dir){
+            if(this.sortInfo && this.sortInfo.field == f.name){ // toggle sort dir
+                dir = (this.sortToggle[f.name] || 'ASC').toggle('ASC', 'DESC');
+            }else{
+                dir = f.sortDir;
+            }
+        }
+        var st = (this.sortToggle) ? this.sortToggle[f.name] : null;
+        var si = (this.sortInfo) ? this.sortInfo : null;
+
+        this.sortToggle[f.name] = dir;
+        this.sortInfo = {field: f.name, direction: dir};
+        if(!this.remoteSort){
+            this.applySort();
+            this.fireEvent('datachanged', this);
+        }else{
+            if (!this.load(this.lastOptions)) {
+                if (st) {
+                    this.sortToggle[f.name] = st;
+                }
+                if (si) {
+                    this.sortInfo = si;
+                }
+            }
+        }
+    },
+
+    /**
+     * Calls the specified function for each of the {@link Ext.data.Record Records} in the cache.
+     * @param {Function} fn The function to call. The {@link Ext.data.Record Record} is passed as the first parameter.
+     * Returning <tt>false</tt> aborts and exits the iteration.
+     * @param {Object} scope (optional) The scope in which to call the function (defaults to the {@link Ext.data.Record Record}).
+     */
+    each : function(fn, scope){
+        this.data.each(fn, scope);
+    },
+
+    /**
+     * Gets all {@link Ext.data.Record records} modified since the last commit.  Modified records are
+     * persisted across load operations (e.g., during paging). <b>Note</b>: deleted records are not
+     * included.  See also <tt>{@link #pruneModifiedRecords}</tt> and
+     * {@link Ext.data.Record}<tt>{@link Ext.data.Record#markDirty markDirty}.</tt>.
+     * @return {Ext.data.Record[]} An array of {@link Ext.data.Record Records} containing outstanding
+     * modifications.  To obtain modified fields within a modified record see
+     *{@link Ext.data.Record}<tt>{@link Ext.data.Record#modified modified}.</tt>.
+     */
+    getModifiedRecords : function(){
+        return this.modified;
+    },
+
+    // private
+    createFilterFn : function(property, value, anyMatch, caseSensitive){
+        if(Ext.isEmpty(value, false)){
+            return false;
+        }
+        value = this.data.createValueMatcher(value, anyMatch, caseSensitive);
+        return function(r){
+            return value.test(r.data[property]);
+        };
+    },
+
+    /**
+     * Sums the value of <tt>property</tt> for each {@link Ext.data.Record record} between <tt>start</tt>
+     * and <tt>end</tt> and returns the result.
+     * @param {String} property A field in each record
+     * @param {Number} start (optional) The record index to start at (defaults to <tt>0</tt>)
+     * @param {Number} end (optional) The last record index to include (defaults to length - 1)
+     * @return {Number} The sum
+     */
+    sum : function(property, start, end){
+        var rs = this.data.items, v = 0;
+        start = start || 0;
+        end = (end || end === 0) ? end : rs.length-1;
+
+        for(var i = start; i <= end; i++){
+            v += (rs[i].data[property] || 0);
+        }
+        return v;
+    },
+
+    /**
+     * Filter the {@link Ext.data.Record records} by a specified property.
+     * @param {String} field A field on your records
+     * @param {String/RegExp} value Either a string that the field should begin with, or a RegExp to test
+     * against the field.
+     * @param {Boolean} anyMatch (optional) <tt>true</tt> to match any part not just the beginning
+     * @param {Boolean} caseSensitive (optional) <tt>true</tt> for case sensitive comparison
+     */
+    filter : function(property, value, anyMatch, caseSensitive){
+        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
+        return fn ? this.filterBy(fn) : this.clearFilter();
+    },
+
+    /**
+     * Filter by a function. The specified function will be called for each
+     * Record in this Store. If the function returns <tt>true</tt> the Record is included,
+     * otherwise it is filtered out.
+     * @param {Function} fn The function to be called. It will be passed the following parameters:<ul>
+     * <li><b>record</b> : Ext.data.Record<p class="sub-desc">The {@link Ext.data.Record record}
+     * to test for filtering. Access field values using {@link Ext.data.Record#get}.</p></li>
+     * <li><b>id</b> : Object<p class="sub-desc">The ID of the Record passed.</p></li>
+     * </ul>
+     * @param {Object} scope (optional) The scope of the function (defaults to this)
+     */
+    filterBy : function(fn, scope){
+        this.snapshot = this.snapshot || this.data;
+        this.data = this.queryBy(fn, scope||this);
+        this.fireEvent('datachanged', this);
+    },
+
+    /**
+     * Query the records by a specified property.
+     * @param {String} field A field on your records
+     * @param {String/RegExp} value Either a string that the field
+     * should begin with, or a RegExp to test against the field.
+     * @param {Boolean} anyMatch (optional) True to match any part not just the beginning
+     * @param {Boolean} caseSensitive (optional) True for case sensitive comparison
+     * @return {MixedCollection} Returns an Ext.util.MixedCollection of the matched records
+     */
+    query : function(property, value, anyMatch, caseSensitive){
+        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
+        return fn ? this.queryBy(fn) : this.data.clone();
+    },
+
+    /**
+     * Query the cached records in this Store using a filtering function. The specified function
+     * will be called with each record in this Store. If the function returns <tt>true</tt> the record is
+     * included in the results.
+     * @param {Function} fn The function to be called. It will be passed the following parameters:<ul>
+     * <li><b>record</b> : Ext.data.Record<p class="sub-desc">The {@link Ext.data.Record record}
+     * to test for filtering. Access field values using {@link Ext.data.Record#get}.</p></li>
+     * <li><b>id</b> : Object<p class="sub-desc">The ID of the Record passed.</p></li>
+     * </ul>
+     * @param {Object} scope (optional) The scope of the function (defaults to this)
+     * @return {MixedCollection} Returns an Ext.util.MixedCollection of the matched records
+     **/
+    queryBy : function(fn, scope){
+        var data = this.snapshot || this.data;
+        return data.filterBy(fn, scope||this);
+    },
+
+    /**
+     * Finds the index of the first matching record in this store by a specific property/value.
+     * @param {String} property A property on your objects
+     * @param {String/RegExp} value Either a string that the property value
+     * should begin with, or a RegExp to test against the property.
+     * @param {Number} startIndex (optional) The index to start searching at
+     * @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
+     */
+    find : function(property, value, start, anyMatch, caseSensitive){
+        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);
+        return fn ? this.data.findIndexBy(fn, null, start) : -1;
+    },
+
+    /**
+     * Finds the index of the first matching record in this store by a specific property/value.
+     * @param {String} property A property on your objects
+     * @param {String/RegExp} value The value to match against
+     * @param {Number} startIndex (optional) The index to start searching at
+     * @return {Number} The matched index or -1
+     */
+    findExact: function(property, value, start){
+        return this.data.findIndexBy(function(rec){
+            return rec.get(property) === value;
+        }, this, start);
+    },
+
+    /**
+     * Find the index of the first matching Record in this Store by a function.
+     * If the function returns <tt>true</tt> it is considered a match.
+     * @param {Function} fn The function to be called. It will be passed the following parameters:<ul>
+     * <li><b>record</b> : Ext.data.Record<p class="sub-desc">The {@link Ext.data.Record record}
+     * to test for filtering. Access field values using {@link Ext.data.Record#get}.</p></li>
+     * <li><b>id</b> : Object<p class="sub-desc">The ID of the Record passed.</p></li>
+     * </ul>
+     * @param {Object} scope (optional) The scope of the function (defaults to this)
+     * @param {Number} startIndex (optional) The index to start searching at
+     * @return {Number} The matched index or -1
+     */
+    findBy : function(fn, scope, start){
+        return this.data.findIndexBy(fn, scope, start);
+    },
+
+    /**
+     * Collects unique values for a particular dataIndex from this store.
+     * @param {String} dataIndex The property to collect
+     * @param {Boolean} allowNull (optional) Pass true to allow null, undefined or empty string values
+     * @param {Boolean} bypassFilter (optional) Pass true to collect from all records, even ones which are filtered
+     * @return {Array} An array of the unique values
+     **/
+    collect : function(dataIndex, allowNull, bypassFilter){
+        var d = (bypassFilter === true && this.snapshot) ?
+                this.snapshot.items : this.data.items;
+        var v, sv, r = [], l = {};
+        for(var i = 0, len = d.length; i < len; i++){
+            v = d[i].data[dataIndex];
+            sv = String(v);
+            if((allowNull || !Ext.isEmpty(v)) && !l[sv]){
+                l[sv] = true;
+                r[r.length] = v;
+            }
+        }
+        return r;
+    },
+
+    /**
+     * Revert to a view of the Record cache with no filtering applied.
+     * @param {Boolean} suppressEvent If <tt>true</tt> the filter is cleared silently without firing the
+     * {@link #datachanged} event.
+     */
+    clearFilter : function(suppressEvent){
+        if(this.isFiltered()){
+            this.data = this.snapshot;
+            delete this.snapshot;
+            if(suppressEvent !== true){
+                this.fireEvent('datachanged', this);
+            }
+        }
+    },
+
+    /**
+     * Returns true if this store is currently filtered
+     * @return {Boolean}
+     */
+    isFiltered : function(){
+        return this.snapshot && this.snapshot != this.data;
+    },
+
+    // private
+    afterEdit : function(record){
+        if(this.modified.indexOf(record) == -1){
+            this.modified.push(record);
+        }
+        this.fireEvent('update', this, record, Ext.data.Record.EDIT);
+    },
+
+    // private
+    afterReject : function(record){
+        this.modified.remove(record);
+        this.fireEvent('update', this, record, Ext.data.Record.REJECT);
+    },
+
+    // private
+    afterCommit : function(record){
+        this.modified.remove(record);
+        this.fireEvent('update', this, record, Ext.data.Record.COMMIT);
+    },
+
+    /**
+     * Commit all Records with {@link #getModifiedRecords outstanding changes}. To handle updates for changes,
+     * subscribe to the Store's {@link #update update event}, and perform updating when the third parameter is
+     * Ext.data.Record.COMMIT.
+     */
+    commitChanges : function(){
+        var m = this.modified.slice(0);
+        this.modified = [];
+        for(var i = 0, len = m.length; i < len; i++){
+            m[i].commit();
+        }
+    },
+
+    /**
+     * {@link Ext.data.Record#reject Reject} outstanding changes on all {@link #getModifiedRecords modified records}.
+     */
+    rejectChanges : function(){
+        var m = this.modified.slice(0);
+        this.modified = [];
+        for(var i = 0, len = m.length; i < len; i++){
+            m[i].reject();
+        }
+    },
+
+    // private
+    onMetaChange : function(meta, rtype, o){
+        this.recordType = rtype;
+        this.fields = rtype.prototype.fields;
+        delete this.snapshot;
+        if(meta.sortInfo){
+            this.sortInfo = meta.sortInfo;
+        }else if(this.sortInfo  && !this.fields.get(this.sortInfo.field)){
+            delete this.sortInfo;
+        }
+        this.modified = [];
+        this.fireEvent('metachange', this, this.reader.meta);
+    },
+
+    // private
+    findInsertIndex : function(record){
+        this.suspendEvents();
+        var data = this.data.clone();
+        this.data.add(record);
+        this.applySort();
+        var index = this.data.indexOf(record);
+        this.data = data;
+        this.resumeEvents();
+        return index;
+    },
+
+    /**
+     * Set the value for a property name in this store's {@link #baseParams}.  Usage:</p><pre><code>
+myStore.setBaseParam('foo', {bar:3});
+</code></pre>
+     * @param {String} name Name of the property to assign
+     * @param {Mixed} value Value to assign the <tt>name</tt>d property
+     **/
+    setBaseParam : function (name, value){
+        this.baseParams = this.baseParams || {};
+        this.baseParams[name] = value;
+    }
+});
+
+Ext.reg('store', Ext.data.Store);
+
+/**
+ * @class Ext.data.Store.Error
+ * @extends Ext.Error
+ * Store Error extension.
+ * @param {String} name
+ */
+Ext.data.Store.Error = Ext.extend(Ext.Error, {
+    name: 'Ext.data.Store'
+});
+Ext.apply(Ext.data.Store.Error.prototype, {
+    lang: {
+        'writer-undefined' : 'Attempted to execute a write-action without a DataWriter installed.'
+    }
+});
+
+/**
+ * @class Ext.data.Field
+ * <p>This class encapsulates the field definition information specified in the field definition objects
+ * passed to {@link Ext.data.Record#create}.</p>
+ * <p>Developers do not need to instantiate this class. Instances are created by {@link Ext.data.Record.create}
+ * and cached in the {@link Ext.data.Record#fields fields} property of the created Record constructor's <b>prototype.</b></p>
+ */
+Ext.data.Field = function(config){
+    if(typeof config == "string"){
+        config = {name: config};
+    }
+    Ext.apply(this, config);
+
+    if(!this.type){
+        this.type = "auto";
+    }
+
+    var st = Ext.data.SortTypes;
+    // named sortTypes are supported, here we look them up
+    if(typeof this.sortType == "string"){
+        this.sortType = st[this.sortType];
+    }
+
+    // set default sortType for strings and dates
+    if(!this.sortType){
+        switch(this.type){
+            case "string":
+                this.sortType = st.asUCString;
+                break;
+            case "date":
+                this.sortType = st.asDate;
+                break;
+            default:
+                this.sortType = st.none;
+        }
+    }
+
+    // define once
+    var stripRe = /[\$,%]/g;
+
+    // prebuilt conversion function for this field, instead of
+    // switching every time we're reading a value
+    if(!this.convert){
+        var cv, dateFormat = this.dateFormat;
+        switch(this.type){
+            case "":
+            case "auto":
+            case undefined:
+                cv = function(v){ return v; };
+                break;
+            case "string":
+                cv = function(v){ return (v === undefined || v === null) ? '' : String(v); };
+                break;
+            case "int":
+                cv = function(v){
+                    return v !== undefined && v !== null && v !== '' ?
+                           parseInt(String(v).replace(stripRe, ""), 10) : '';
+                    };
+                break;
+            case "float":
+                cv = function(v){
+                    return v !== undefined && v !== null && v !== '' ?
+                           parseFloat(String(v).replace(stripRe, ""), 10) : '';
+                    };
+                break;
+            case "bool":
+            case "boolean":
+                cv = function(v){ return v === true || v === "true" || v == 1; };
+                break;
+            case "date":
+                cv = function(v){
+                    if(!v){
+                        return '';
+                    }
+                    if(Ext.isDate(v)){
+                        return v;
+                    }
+                    if(dateFormat){
+                        if(dateFormat == "timestamp"){
+                            return new Date(v*1000);
+                        }
+                        if(dateFormat == "time"){
+                            return new Date(parseInt(v, 10));
+                        }
+                        return Date.parseDate(v, dateFormat);
+                    }
+                    var parsed = Date.parse(v);
+                    return parsed ? new Date(parsed) : null;
+                };
+             break;
+
+        }
+        this.convert = cv;
+    }
+};
+
+Ext.data.Field.prototype = {
+    /**
+     * @cfg {String} name
+     * The name by which the field is referenced within the Record. This is referenced by, for example,
+     * the <tt>dataIndex</tt> property in column definition objects passed to {@link Ext.grid.ColumnModel}.
+     * <p>Note: In the simplest case, if no properties other than <tt>name</tt> are required, a field
+     * definition may consist of just a String for the field name.</p>
+     */
+    /**
+     * @cfg {String} type
+     * (Optional) The data type for conversion to displayable value if <tt>{@link Ext.data.Field#convert convert}</tt>
+     * has not been specified. Possible values are
+     * <div class="mdetail-params"><ul>
+     * <li>auto (Default, implies no conversion)</li>
+     * <li>string</li>
+     * <li>int</li>
+     * <li>float</li>
+     * <li>boolean</li>
+     * <li>date</li></ul></div>
+     */
+    /**
+     * @cfg {Function} convert
+     * (Optional) A function which converts the value provided by the Reader into an object that will be stored
+     * in the Record. It is passed the following parameters:<div class="mdetail-params"><ul>
+     * <li><b>v</b> : Mixed<div class="sub-desc">The data value as read by the Reader, if undefined will use
+     * the configured <tt>{@link Ext.data.Field#defaultValue defaultValue}</tt>.</div></li>
+     * <li><b>rec</b> : Mixed<div class="sub-desc">The data object containing the row as read by the Reader.
+     * Depending on the Reader type, this could be an Array ({@link Ext.data.ArrayReader ArrayReader}), an object
+     *  ({@link Ext.data.JsonReader JsonReader}), or an XML element ({@link Ext.data.XMLReader XMLReader}).</div></li>
+     * </ul></div>
+     * <pre><code>
+// example of convert function
+function fullName(v, record){
+    return record.name.last + ', ' + record.name.first;
+}
+
+function location(v, record){
+    return !record.city ? '' : (record.city + ', ' + record.state);
+}
+
+var Dude = Ext.data.Record.create([
+    {name: 'fullname',  convert: fullName},
+    {name: 'firstname', mapping: 'name.first'},
+    {name: 'lastname',  mapping: 'name.last'},
+    {name: 'city', defaultValue: 'homeless'},
+    'state',
+    {name: 'location',  convert: location}
+]);
+
+// create the data store
+var store = new Ext.data.Store({
+    reader: new Ext.data.JsonReader(
+        {
+            idProperty: 'key',
+            root: 'daRoot',  
+            totalProperty: 'total'
+        },
+        Dude  // recordType
+    )
+});
+
+var myData = [
+    { key: 1,
+      name: { first: 'Fat',    last:  'Albert' }
+      // notice no city, state provided in data object
+    },
+    { key: 2,
+      name: { first: 'Barney', last:  'Rubble' },
+      city: 'Bedrock', state: 'Stoneridge'
+    },
+    { key: 3,
+      name: { first: 'Cliff',  last:  'Claven' },
+      city: 'Boston',  state: 'MA'
+    }
+];
+     * </code></pre>
+     */
+    /**
+     * @cfg {String} dateFormat
+     * (Optional) A format string for the {@link Date#parseDate Date.parseDate} function, or "timestamp" if the
+     * value provided by the Reader is a UNIX timestamp, or "time" if the value provided by the Reader is a
+     * javascript millisecond timestamp.
+     */
+    dateFormat: null,
+    /**
+     * @cfg {Mixed} defaultValue
+     * (Optional) The default value used <b>when a Record is being created by a {@link Ext.data.Reader Reader}</b>
+     * when the item referenced by the <tt>{@link Ext.data.Field#mapping mapping}</tt> does not exist in the data
+     * object (i.e. undefined). (defaults to "")
+     */
+    defaultValue: "",
+    /**
+     * @cfg {String/Number} mapping
+     * <p>(Optional) A path expression for use by the {@link Ext.data.DataReader} implementation
+     * that is creating the {@link Ext.data.Record Record} to extract the Field value from the data object.
+     * If the path expression is the same as the field name, the mapping may be omitted.</p>
+     * <p>The form of the mapping expression depends on the Reader being used.</p>
+     * <div class="mdetail-params"><ul>
+     * <li>{@link Ext.data.JsonReader}<div class="sub-desc">The mapping is a string containing the javascript
+     * expression to reference the data from an element of the data item's {@link Ext.data.JsonReader#root root} Array. Defaults to the field name.</div></li>
+     * <li>{@link Ext.data.XmlReader}<div class="sub-desc">The mapping is an {@link Ext.DomQuery} path to the data
+     * item relative to the DOM element that represents the {@link Ext.data.XmlReader#record record}. Defaults to the field name.</div></li>
+     * <li>{@link Ext.data.ArrayReader}<div class="sub-desc">The mapping is a number indicating the Array index
+     * of the field's value. Defaults to the field specification's Array position.</div></li>
+     * </ul></div>
+     * <p>If a more complex value extraction strategy is required, then configure the Field with a {@link #convert}
+     * function. This is passed the whole row object, and may interrogate it in whatever way is necessary in order to
+     * return the desired data.</p>
+     */
+    mapping: null,
+    /**
+     * @cfg {Function} sortType
+     * (Optional) A function which converts a Field's value to a comparable value in order to ensure
+     * correct sort ordering. Predefined functions are provided in {@link Ext.data.SortTypes}. A custom
+     * sort example:<pre><code>
+// current sort     after sort we want
+// +-+------+          +-+------+
+// |1|First |          |1|First |
+// |2|Last  |          |3|Second|
+// |3|Second|          |2|Last  |
+// +-+------+          +-+------+
+
+sortType: function(value) {
+   switch (value.toLowerCase()) // native toLowerCase():
+   {
+      case 'first': return 1;
+      case 'second': return 2;
+      default: return 3;
+   }
+}
+     * </code></pre>
+     */
+    sortType : null,
+    /**
+     * @cfg {String} sortDir
+     * (Optional) Initial direction to sort (<tt>"ASC"</tt> or  <tt>"DESC"</tt>).  Defaults to
+     * <tt>"ASC"</tt>.
+     */
+    sortDir : "ASC",
+       /**
+        * @cfg {Boolean} allowBlank 
+        * (Optional) Used for validating a {@link Ext.data.Record record}, defaults to <tt>true</tt>.
+        * An empty value here will cause {@link Ext.data.Record}.{@link Ext.data.Record#isValid isValid}
+        * to evaluate to <tt>false</tt>.
+        */
+       allowBlank : true
+};/**\r
+ * @class Ext.data.DataReader\r
+ * Abstract base class for reading structured data from a data source and converting\r
+ * it into an object containing {@link Ext.data.Record} objects and metadata for use\r
+ * by an {@link Ext.data.Store}.  This class is intended to be extended and should not\r
+ * be created directly. For existing implementations, see {@link Ext.data.ArrayReader},\r
+ * {@link Ext.data.JsonReader} and {@link Ext.data.XmlReader}.\r
+ * @constructor Create a new DataReader\r
+ * @param {Object} meta Metadata configuration options (implementation-specific).\r
+ * @param {Array/Object} recordType\r
+ * <p>Either an Array of {@link Ext.data.Field Field} definition objects (which\r
+ * will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}\r
+ * constructor created using {@link Ext.data.Record#create}.</p>\r
+ */\r
+Ext.data.DataReader = function(meta, recordType){\r
+    /**\r
+     * This DataReader's configured metadata as passed to the constructor.\r
+     * @type Mixed\r
+     * @property meta\r
+     */\r
+    this.meta = meta;\r
+    /**\r
+     * @cfg {Array/Object} fields\r
+     * <p>Either an Array of {@link Ext.data.Field Field} definition objects (which\r
+     * will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}\r
+     * constructor created from {@link Ext.data.Record#create}.</p>\r
+     */\r
+    this.recordType = Ext.isArray(recordType) ?\r
+        Ext.data.Record.create(recordType) : recordType;\r
+};\r
 \r
-            // The distance from the cursor to the right of the visible area\r
-            var toRight = (clientW + sl - x - this.deltaX);\r
+Ext.data.DataReader.prototype = {\r
 \r
-\r
-            // How close to the edge the cursor must be before we scroll\r
-            // var thresh = (document.all) ? 100 : 40;\r
-            var thresh = 40;\r
-\r
-            // How many pixels to scroll per autoscroll op.  This helps to reduce\r
-            // clunky scrolling. IE is more sensitive about this ... it needs this\r
-            // value to be higher.\r
-            var scrAmt = (document.all) ? 80 : 30;\r
-\r
-            // Scroll down if we are near the bottom of the visible page and the\r
-            // obj extends below the crease\r
-            if ( bot > clientH && toBot < thresh ) {\r
-                window.scrollTo(sl, st + scrAmt);\r
+    /**\r
+     * Abstract method, overridden in {@link Ext.data.JsonReader}\r
+     */\r
+    buildExtractors : Ext.emptyFn,\r
+\r
+    /**\r
+     * Used for un-phantoming a record after a successful database insert.  Sets the records pk along with new data from server.\r
+     * You <b>must</b> return at least the database pk using the idProperty defined in your DataReader configuration.  The incoming\r
+     * data from server will be merged with the data in the local record.\r
+     * In addition, you <b>must</b> return record-data from the server in the same order received.\r
+     * Will perform a commit as well, un-marking dirty-fields.  Store's "update" event will be suppressed.\r
+     * @param {Record/Record[]} record The phantom record to be realized.\r
+     * @param {Object/Object[]} data The new record data to apply.  Must include the primary-key from database defined in idProperty field.\r
+     */\r
+    realize: function(rs, data){\r
+        if (Ext.isArray(rs)) {\r
+            for (var i = rs.length - 1; i >= 0; i--) {\r
+                // recurse\r
+                if (Ext.isArray(data)) {\r
+                    this.realize(rs.splice(i,1).shift(), data.splice(i,1).shift());\r
+                }\r
+                else {\r
+                    // weird...rs is an array but data isn't??  recurse but just send in the whole invalid data object.\r
+                    // the else clause below will detect !this.isData and throw exception.\r
+                    this.realize(rs.splice(i,1).shift(), data);\r
+                }\r
             }\r
-\r
-            // Scroll up if the window is scrolled down and the top of the object\r
-            // goes above the top border\r
-            if ( y < st && st > 0 && y - st < thresh ) {\r
-                window.scrollTo(sl, st - scrAmt);\r
+        }\r
+        else {\r
+            // If rs is NOT an array but data IS, see if data contains just 1 record.  If so extract it and carry on.\r
+            if (Ext.isArray(data) && data.length == 1) {\r
+                data = data.shift();\r
+            }\r
+            if (!this.isData(data)) {\r
+                // TODO: Let exception-handler choose to commit or not rather than blindly rs.commit() here.\r
+                //rs.commit();\r
+                throw new Ext.data.DataReader.Error('realize', rs);\r
+            }\r
+            this.buildExtractors();\r
+            var values = this.extractValues(data, rs.fields.items, rs.fields.items.length);\r
+            rs.phantom = false; // <-- That's what it's all about\r
+            rs._phid = rs.id;  // <-- copy phantom-id -> _phid, so we can remap in Store#onCreateRecords\r
+            rs.id = data[this.meta.idProperty];\r
+            rs.data = values;\r
+            rs.commit();\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Used for updating a non-phantom or "real" record's data with fresh data from server after remote-save.\r
+     * You <b>must</b> return a complete new record from the server.  If you don't, your local record's missing fields\r
+     * will be populated with the default values specified in your Ext.data.Record.create specification.  Without a defaultValue,\r
+     * local fields will be populated with empty string "".  So return your entire record's data after both remote create and update.\r
+     * In addition, you <b>must</b> return record-data from the server in the same order received.\r
+     * Will perform a commit as well, un-marking dirty-fields.  Store's "update" event will be suppressed as the record receives\r
+     * a fresh new data-hash.\r
+     * @param {Record/Record[]} rs\r
+     * @param {Object/Object[]} data\r
+     */\r
+    update : function(rs, data) {\r
+        if (Ext.isArray(rs)) {\r
+            for (var i=rs.length-1; i >= 0; i--) {\r
+                if (Ext.isArray(data)) {\r
+                    this.update(rs.splice(i,1).shift(), data.splice(i,1).shift());\r
+                }\r
+                else {\r
+                    // weird...rs is an array but data isn't??  recurse but just send in the whole data object.\r
+                    // the else clause below will detect !this.isData and throw exception.\r
+                    this.update(rs.splice(i,1).shift(), data);\r
+                }\r
             }\r
-\r
-            // Scroll right if the obj is beyond the right border and the cursor is\r
-            // near the border.\r
-            if ( right > clientW && toRight < thresh ) {\r
-                window.scrollTo(sl + scrAmt, st);\r
+        }\r
+        else {\r
+                     // If rs is NOT an array but data IS, see if data contains just 1 record.  If so extract it and carry on.\r
+            if (Ext.isArray(data) && data.length == 1) {\r
+                data = data.shift();\r
             }\r
-\r
-            // Scroll left if the window has been scrolled to the right and the obj\r
-            // extends past the left border\r
-            if ( x < sl && sl > 0 && x - sl < thresh ) {\r
-                window.scrollTo(sl - scrAmt, st);\r
+            if (!this.isData(data)) {\r
+                // TODO: create custom Exception class to return record in thrown exception.  Allow exception-handler the choice\r
+                // to commit or not rather than blindly rs.commit() here.\r
+                rs.commit();\r
+                throw new Ext.data.DataReader.Error('update', rs);\r
             }\r
+            this.buildExtractors();\r
+            rs.data = this.extractValues(Ext.apply(rs.data, data), rs.fields.items, rs.fields.items.length);\r
+            rs.commit();\r
         }\r
     },\r
 \r
-    \r
-    getTargetCoord: function(iPageX, iPageY) {\r
+    /**\r
+     * Returns true if the supplied data-hash <b>looks</b> and quacks like data.  Checks to see if it has a key\r
+     * corresponding to idProperty defined in your DataReader config containing non-empty pk.\r
+     * @param {Object} data\r
+     * @return {Boolean}\r
+     */\r
+    isData : function(data) {\r
+        return (data && Ext.isObject(data) && !Ext.isEmpty(data[this.meta.idProperty])) ? true : false;\r
+    }\r
+};\r
 \r
+/**\r
+ * @class Ext.data.DataReader.Error\r
+ * @extends Ext.Error\r
+ * General error class for Ext.data.DataReader\r
+ */\r
+Ext.data.DataReader.Error = Ext.extend(Ext.Error, {\r
+    constructor : function(message, arg) {\r
+        this.arg = arg;\r
+        Ext.Error.call(this, message);\r
+    },\r
+    name: 'Ext.data.DataReader'\r
+});\r
+Ext.apply(Ext.data.DataReader.Error.prototype, {\r
+    lang : {\r
+        'update': "#update received invalid data from server.  Please see docs for DataReader#update and review your DataReader configuration.",\r
+        'realize': "#realize was called with invalid remote-data.  Please see the docs for DataReader#realize and review your DataReader configuration.",\r
+        'invalid-response': "#readResponse received an invalid response from the server."\r
+    }\r
+});\r
 \r
-        var x = iPageX - this.deltaX;\r
-        var y = iPageY - this.deltaY;\r
 \r
-        if (this.constrainX) {\r
-            if (x < this.minX) { x = this.minX; }\r
-            if (x > this.maxX) { x = this.maxX; }\r
+/**
+ * @class Ext.data.DataWriter
+ * <p>Ext.data.DataWriter facilitates create, update, and destroy actions between
+ * an Ext.data.Store and a server-side framework. A Writer enabled Store will
+ * automatically manage the Ajax requests to perform CRUD actions on a Store.</p>
+ * <p>Ext.data.DataWriter is an abstract base class which is intended to be extended
+ * and should not be created directly. For existing implementations, see
+ * {@link Ext.data.JsonWriter}.</p>
+ * <p>Creating a writer is simple:</p>
+ * <pre><code>
+var writer = new Ext.data.JsonWriter();
+ * </code></pre>
+ * <p>The proxy for a writer enabled store can be configured with a simple <code>url</code>:</p>
+ * <pre><code>
+// Create a standard HttpProxy instance.
+var proxy = new Ext.data.HttpProxy({
+    url: 'app.php/users'
+});
+ * </code></pre>
+ * <p>For finer grained control, the proxy may also be configured with an <code>api</code>:</p>
+ * <pre><code>
+// Use the api specification
+var proxy = new Ext.data.HttpProxy({
+    api: {
+        read    : 'app.php/users/read',
+        create  : 'app.php/users/create',
+        update  : 'app.php/users/update',
+        destroy : 'app.php/users/destroy'
+    }
+});
+ * </code></pre>
+ * <p>Creating a Writer enabled store:</p>
+ * <pre><code>
+var store = new Ext.data.Store({
+    proxy: proxy,
+    reader: reader,
+    writer: writer
+});
+ * </code></pre>
+ * @constructor Create a new DataWriter
+ * @param {Object} meta Metadata configuration options (implementation-specific)
+ * @param {Object} recordType Either an Array of field definition objects as specified
+ * in {@link Ext.data.Record#create}, or an {@link Ext.data.Record} object created
+ * using {@link Ext.data.Record#create}.
+ */
+Ext.data.DataWriter = function(config){
+    /**
+     * This DataWriter's configured metadata as passed to the constructor.
+     * @type Mixed
+     * @property meta
+     */
+    Ext.apply(this, config);
+};
+
+Ext.data.DataWriter.prototype = {
+
+    /**
+     * @cfg {Boolean} writeAllFields
+     * <tt>false</tt> by default.  Set <tt>true</tt> to have DataWriter return ALL fields of a modified
+     * record -- not just those that changed.
+     * <tt>false</tt> to have DataWriter only request modified fields from a record.
+     */
+    writeAllFields : false,
+    /**
+     * @cfg {Boolean} listful
+     * <tt>false</tt> by default.  Set <tt>true</tt> to have the DataWriter <b>always</b> write HTTP params as a list,
+     * even when acting upon a single record.
+     */
+    listful : false,    // <-- listful is actually not used internally here in DataWriter.  @see Ext.data.Store#execute.
+
+    /**
+     * Writes data in preparation for server-write action.  Simply proxies to DataWriter#update, DataWriter#create
+     * DataWriter#destroy.
+     * @param {String} action [CREATE|UPDATE|DESTROY]
+     * @param {Object} params The params-hash to write-to
+     * @param {Record/Record[]} rs The recordset write.
+     */
+    write : function(action, params, rs) {
+        this.render(action, rs, params, this[action](rs));
+    },
+
+    /**
+     * abstract method meant to be overridden by all DataWriter extensions.  It's the extension's job to apply the "data" to the "params".
+     * The data-object provided to render is populated with data according to the meta-info defined in the user's DataReader config,
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
+     * @param {Record[]} rs Store recordset
+     * @param {Object} params Http params to be sent to server.
+     * @param {Object} data object populated according to DataReader meta-data.
+     */
+    render : Ext.emptyFn,
+
+    /**
+     * update
+     * @param {Object} p Params-hash to apply result to.
+     * @param {Record/Record[]} rs Record(s) to write
+     * @private
+     */
+    update : function(rs) {
+        var params = {};
+        if (Ext.isArray(rs)) {
+            var data = [],
+                ids = [];
+            Ext.each(rs, function(val){
+                ids.push(val.id);
+                data.push(this.updateRecord(val));
+            }, this);
+            params[this.meta.idProperty] = ids;
+            params[this.meta.root] = data;
+        }
+        else if (rs instanceof Ext.data.Record) {
+            params[this.meta.idProperty] = rs.id;
+            params[this.meta.root] = this.updateRecord(rs);
+        }
+        return params;
+    },
+
+    /**
+     * @cfg {Function} saveRecord Abstract method that should be implemented in all subclasses
+     * (e.g.: {@link Ext.data.JsonWriter#saveRecord JsonWriter.saveRecord}
+     */
+    updateRecord : Ext.emptyFn,
+
+    /**
+     * create
+     * @param {Object} p Params-hash to apply result to.
+     * @param {Record/Record[]} rs Record(s) to write
+     * @private
+     */
+    create : function(rs) {
+        var params = {};
+        if (Ext.isArray(rs)) {
+            var data = [];
+            Ext.each(rs, function(val){
+                data.push(this.createRecord(val));
+            }, this);
+            params[this.meta.root] = data;
+        }
+        else if (rs instanceof Ext.data.Record) {
+            params[this.meta.root] = this.createRecord(rs);
+        }
+        return params;
+    },
+
+    /**
+     * @cfg {Function} createRecord Abstract method that should be implemented in all subclasses
+     * (e.g.: {@link Ext.data.JsonWriter#createRecord JsonWriter.createRecord})
+     */
+    createRecord : Ext.emptyFn,
+
+    /**
+     * destroy
+     * @param {Object} p Params-hash to apply result to.
+     * @param {Record/Record[]} rs Record(s) to write
+     * @private
+     */
+    destroy : function(rs) {
+        var params = {};
+        if (Ext.isArray(rs)) {
+            var data = [],
+                ids = [];
+            Ext.each(rs, function(val){
+                data.push(this.destroyRecord(val));
+            }, this);
+            params[this.meta.root] = data;
+        } else if (rs instanceof Ext.data.Record) {
+            params[this.meta.root] = this.destroyRecord(rs);
+        }
+        return params;
+    },
+
+    /**
+     * @cfg {Function} destroyRecord Abstract method that should be implemented in all subclasses
+     * (e.g.: {@link Ext.data.JsonWriter#destroyRecord JsonWriter.destroyRecord})
+     */
+    destroyRecord : Ext.emptyFn,
+
+    /**
+     * Converts a Record to a hash
+     * @param {Record}
+     * @private
+     */
+    toHash : function(rec) {
+        var map = rec.fields.map,
+            data = {},
+            raw = (this.writeAllFields === false && rec.phantom === false) ? rec.getChanges() : rec.data,
+            m;
+        Ext.iterate(raw, function(prop, value){
+            if((m = map[prop])){
+                data[m.mapping ? m.mapping : m.name] = value;
+            }
+        });
+        data[this.meta.idProperty] = rec.id;
+        return data;
+    }
+};/**\r
+ * @class Ext.data.DataProxy\r
+ * @extends Ext.util.Observable\r
+ * <p>Abstract base class for implementations which provide retrieval of unformatted data objects.\r
+ * This class is intended to be extended and should not be created directly. For existing implementations,\r
+ * see {@link Ext.data.DirectProxy}, {@link Ext.data.HttpProxy}, {@link Ext.data.ScriptTagProxy} and\r
+ * {@link Ext.data.MemoryProxy}.</p>\r
+ * <p>DataProxy implementations are usually used in conjunction with an implementation of {@link Ext.data.DataReader}\r
+ * (of the appropriate type which knows how to parse the data object) to provide a block of\r
+ * {@link Ext.data.Records} to an {@link Ext.data.Store}.</p>\r
+ * <p>The parameter to a DataProxy constructor may be an {@link Ext.data.Connection} or can also be the\r
+ * config object to an {@link Ext.data.Connection}.</p>\r
+ * <p>Custom implementations must implement either the <code><b>doRequest</b></code> method (preferred) or the\r
+ * <code>load</code> method (deprecated). See\r
+ * {@link Ext.data.HttpProxy}.{@link Ext.data.HttpProxy#doRequest doRequest} or\r
+ * {@link Ext.data.HttpProxy}.{@link Ext.data.HttpProxy#load load} for additional details.</p>\r
+ * <p><b><u>Example 1</u></b></p>\r
+ * <pre><code>\r
+proxy: new Ext.data.ScriptTagProxy({\r
+    {@link Ext.data.Connection#url url}: 'http://extjs.com/forum/topics-remote.php'\r
+}),\r
+ * </code></pre>\r
+ * <p><b><u>Example 2</u></b></p>\r
+ * <pre><code>\r
+proxy : new Ext.data.HttpProxy({\r
+    {@link Ext.data.Connection#method method}: 'GET',\r
+    {@link Ext.data.HttpProxy#prettyUrls prettyUrls}: false,\r
+    {@link Ext.data.Connection#url url}: 'local/default.php', // see options parameter for {@link Ext.Ajax#request}\r
+    {@link #api}: {\r
+        // all actions except the following will use above url\r
+        create  : 'local/new.php',\r
+        update  : 'local/update.php'\r
+    }\r
+}),\r
+ * </code></pre>\r
+ */\r
+Ext.data.DataProxy = function(conn){\r
+    // make sure we have a config object here to support ux proxies.\r
+    // All proxies should now send config into superclass constructor.\r
+    conn = conn || {};\r
+\r
+    // This line caused a bug when people use custom Connection object having its own request method.\r
+    // http://extjs.com/forum/showthread.php?t=67194.  Have to set DataProxy config\r
+    //Ext.applyIf(this, conn);\r
+\r
+    this.api     = conn.api;\r
+    this.url     = conn.url;\r
+    this.restful = conn.restful;\r
+    this.listeners = conn.listeners;\r
+\r
+    // deprecated\r
+    this.prettyUrls = conn.prettyUrls;\r
+\r
+    /**\r
+     * @cfg {Object} api\r
+     * Specific urls to call on CRUD action methods "read", "create", "update" and "destroy".\r
+     * Defaults to:<pre><code>\r
+api: {\r
+    read    : undefined,\r
+    create  : undefined,\r
+    update  : undefined,\r
+    destroy : undefined\r
+}\r
+</code></pre>\r
+     * <p>If the specific URL for a given CRUD action is undefined, the CRUD action request\r
+     * will be directed to the configured <tt>{@link Ext.data.Connection#url url}</tt>.</p>\r
+     * <br><p><b>Note</b>: To modify the URL for an action dynamically the appropriate API\r
+     * property should be modified before the action is requested using the corresponding before\r
+     * action event.  For example to modify the URL associated with the load action:\r
+     * <pre><code>\r
+// modify the url for the action\r
+myStore.on({\r
+    beforeload: {\r
+        fn: function (store, options) {\r
+            // use <tt>{@link Ext.data.HttpProxy#setUrl setUrl}</tt> to change the URL for *just* this request.\r
+            store.proxy.setUrl('changed1.php');\r
+\r
+            // set optional second parameter to true to make this URL change\r
+            // permanent, applying this URL for all subsequent requests.\r
+            store.proxy.setUrl('changed1.php', true);\r
+\r
+            // manually set the <b>private</b> connection URL.\r
+            // <b>Warning:</b>  Accessing the private URL property should be avoided.\r
+            // Use the public method <tt>{@link Ext.data.HttpProxy#setUrl setUrl}</tt> instead, shown above.\r
+            // It should be noted that changing the URL like this will affect\r
+            // the URL for just this request.  Subsequent requests will use the\r
+            // API or URL defined in your initial proxy configuration.\r
+            store.proxy.conn.url = 'changed1.php';\r
+\r
+            // proxy URL will be superseded by API (only if proxy created to use ajax):\r
+            // It should be noted that proxy API changes are permanent and will\r
+            // be used for all subsequent requests.\r
+            store.proxy.api.load = 'changed2.php';\r
+\r
+            // However, altering the proxy API should be done using the public\r
+            // method <tt>{@link Ext.data.DataProxy#setApi setApi}</tt> instead.\r
+            store.proxy.setApi('load', 'changed2.php');\r
+\r
+            // Or set the entire API with a config-object.\r
+            // When using the config-object option, you must redefine the <b>entire</b>\r
+            // API -- not just a specific action of it.\r
+            store.proxy.setApi({\r
+                read    : 'changed_read.php',\r
+                create  : 'changed_create.php',\r
+                update  : 'changed_update.php',\r
+                destroy : 'changed_destroy.php'\r
+            });\r
         }\r
-\r
-        if (this.constrainY) {\r
-            if (y < this.minY) { y = this.minY; }\r
-            if (y > this.maxY) { y = this.maxY; }\r
+    }\r
+});\r
+     * </code></pre>\r
+     * </p>\r
+     */\r
+    // Prepare the proxy api.  Ensures all API-actions are defined with the Object-form.\r
+    try {\r
+        Ext.data.Api.prepare(this);\r
+    } catch (e) {\r
+        if (e instanceof Ext.data.Api.Error) {\r
+            e.toConsole();\r
         }\r
+    }\r
 \r
-        x = this.getTick(x, this.xTicks);\r
-        y = this.getTick(y, this.yTicks);\r
-\r
-\r
-        return {x:x, y:y};\r
-    },\r
+    this.addEvents(\r
+        /**\r
+         * @event exception\r
+         * <p>Fires if an exception occurs in the Proxy during a remote request.\r
+         * This event is relayed through a corresponding\r
+         * {@link Ext.data.Store}.{@link Ext.data.Store#exception exception},\r
+         * so any Store instance may observe this event.\r
+         * This event can be fired for one of two reasons:</p>\r
+         * <div class="mdetail-params"><ul>\r
+         * <li>remote-request <b>failed</b> : <div class="sub-desc">\r
+         * The server did not return status === 200.\r
+         * </div></li>\r
+         * <li>remote-request <b>succeeded</b> : <div class="sub-desc">\r
+         * The remote-request succeeded but the reader could not read the response.\r
+         * This means the server returned data, but the configured Reader threw an\r
+         * error while reading the response.  In this case, this event will be\r
+         * raised and the caught error will be passed along into this event.\r
+         * </div></li>\r
+         * </ul></div>\r
+         * <br><p>This event fires with two different contexts based upon the 2nd\r
+         * parameter <tt>type [remote|response]</tt>.  The first four parameters\r
+         * are identical between the two contexts -- only the final two parameters\r
+         * differ.</p>\r
+         * @param {DataProxy} this The proxy that sent the request\r
+         * @param {String} type\r
+         * <p>The value of this parameter will be either <tt>'response'</tt> or <tt>'remote'</tt>.</p>\r
+         * <div class="mdetail-params"><ul>\r
+         * <li><b><tt>'response'</tt></b> : <div class="sub-desc">\r
+         * <p>An <b>invalid</b> response from the server was returned: either 404,\r
+         * 500 or the response meta-data does not match that defined in the DataReader\r
+         * (e.g.: root, idProperty, successProperty).</p>\r
+         * </div></li>\r
+         * <li><b><tt>'remote'</tt></b> : <div class="sub-desc">\r
+         * <p>A <b>valid</b> response was returned from the server having\r
+         * successProperty === false.  This response might contain an error-message\r
+         * sent from the server.  For example, the user may have failed\r
+         * authentication/authorization or a database validation error occurred.</p>\r
+         * </div></li>\r
+         * </ul></div>\r
+         * @param {String} action Name of the action (see {@link Ext.data.Api#actions}.\r
+         * @param {Object} options The options for the action that were specified in the {@link #request}.\r
+         * @param {Object} response\r
+         * <p>The value of this parameter depends on the value of the <code>type</code> parameter:</p>\r
+         * <div class="mdetail-params"><ul>\r
+         * <li><b><tt>'response'</tt></b> : <div class="sub-desc">\r
+         * <p>The raw browser response object (e.g.: XMLHttpRequest)</p>\r
+         * </div></li>\r
+         * <li><b><tt>'remote'</tt></b> : <div class="sub-desc">\r
+         * <p>The decoded response object sent from the server.</p>\r
+         * </div></li>\r
+         * </ul></div>\r
+         * @param {Mixed} arg\r
+         * <p>The type and value of this parameter depends on the value of the <code>type</code> parameter:</p>\r
+         * <div class="mdetail-params"><ul>\r
+         * <li><b><tt>'response'</tt></b> : Error<div class="sub-desc">\r
+         * <p>The JavaScript Error object caught if the configured Reader could not read the data.\r
+         * If the remote request returns success===false, this parameter will be null.</p>\r
+         * </div></li>\r
+         * <li><b><tt>'remote'</tt></b> : Record/Record[]<div class="sub-desc">\r
+         * <p>This parameter will only exist if the <tt>action</tt> was a <b>write</b> action\r
+         * (Ext.data.Api.actions.create|update|destroy).</p>\r
+         * </div></li>\r
+         * </ul></div>\r
+         */\r
+        'exception',\r
+        /**\r
+         * @event beforeload\r
+         * Fires before a request to retrieve a data object.\r
+         * @param {DataProxy} this The proxy for the request\r
+         * @param {Object} params The params object passed to the {@link #request} function\r
+         */\r
+        'beforeload',\r
+        /**\r
+         * @event load\r
+         * Fires before the load method's callback is called.\r
+         * @param {DataProxy} this The proxy for the request\r
+         * @param {Object} o The request transaction object\r
+         * @param {Object} options The callback's <tt>options</tt> property as passed to the {@link #request} function\r
+         */\r
+        'load',\r
+        /**\r
+         * @event loadexception\r
+         * <p>This event is <b>deprecated</b>.  The signature of the loadexception event\r
+         * varies depending on the proxy, use the catch-all {@link #exception} event instead.\r
+         * This event will fire in addition to the {@link #exception} event.</p>\r
+         * @param {misc} misc See {@link #exception}.\r
+         * @deprecated\r
+         */\r
+        'loadexception',\r
+        /**\r
+         * @event beforewrite\r
+         * Fires before a request is generated for one of the actions Ext.data.Api.actions.create|update|destroy\r
+         * @param {DataProxy} this The proxy for the request\r
+         * @param {String} action [Ext.data.Api.actions.create|update|destroy]\r
+         * @param {Record/Array[Record]} rs The Record(s) to create|update|destroy.\r
+         * @param {Object} params The request <code>params</code> object.  Edit <code>params</code> to add parameters to the request.\r
+         */\r
+        'beforewrite',\r
+        /**\r
+         * @event write\r
+         * Fires before the request-callback is called\r
+         * @param {DataProxy} this The proxy that sent the request\r
+         * @param {String} action [Ext.data.Api.actions.create|upate|destroy]\r
+         * @param {Object} data The data object extracted from the server-response\r
+         * @param {Object} response The decoded response from server\r
+         * @param {Record/Record{}} rs The records from Store\r
+         * @param {Object} options The callback's <tt>options</tt> property as passed to the {@link #request} function\r
+         */\r
+        'write'\r
+    );\r
+    Ext.data.DataProxy.superclass.constructor.call(this);\r
+};\r
 \r
-    \r
-    applyConfig: function() {\r
-        Ext.dd.DD.superclass.applyConfig.call(this);\r
-        this.scroll = (this.config.scroll !== false);\r
+Ext.extend(Ext.data.DataProxy, Ext.util.Observable, {\r
+    /**\r
+     * @cfg {Boolean} restful\r
+     * <p>Defaults to <tt>false</tt>.  Set to <tt>true</tt> to operate in a RESTful manner.</p>\r
+     * <br><p> Note: this parameter will automatically be set to <tt>true</tt> if the\r
+     * {@link Ext.data.Store} it is plugged into is set to <code>restful: true</code>. If the\r
+     * Store is RESTful, there is no need to set this option on the proxy.</p>\r
+     * <br><p>RESTful implementations enable the serverside framework to automatically route\r
+     * actions sent to one url based upon the HTTP method, for example:\r
+     * <pre><code>\r
+store: new Ext.data.Store({\r
+    restful: true,\r
+    proxy: new Ext.data.HttpProxy({url:'/users'}); // all requests sent to /users\r
+    ...\r
+)}\r
+     * </code></pre>\r
+     * There is no <code>{@link #api}</code> specified in the configuration of the proxy,\r
+     * all requests will be marshalled to a single RESTful url (/users) so the serverside\r
+     * framework can inspect the HTTP Method and act accordingly:\r
+     * <pre>\r
+<u>Method</u>   <u>url</u>        <u>action</u>\r
+POST     /users     create\r
+GET      /users     read\r
+PUT      /users/23  update\r
+DESTROY  /users/23  delete\r
+     * </pre></p>\r
+     */\r
+    restful: false,\r
+\r
+    /**\r
+     * <p>Redefines the Proxy's API or a single action of an API. Can be called with two method signatures.</p>\r
+     * <p>If called with an object as the only parameter, the object should redefine the <b>entire</b> API, e.g.:</p><pre><code>\r
+proxy.setApi({\r
+    read    : '/users/read',\r
+    create  : '/users/create',\r
+    update  : '/users/update',\r
+    destroy : '/users/destroy'\r
+});\r
+</code></pre>\r
+     * <p>If called with two parameters, the first parameter should be a string specifying the API action to\r
+     * redefine and the second parameter should be the URL (or function if using DirectProxy) to call for that action, e.g.:</p><pre><code>\r
+proxy.setApi(Ext.data.Api.actions.read, '/users/new_load_url');\r
+</code></pre>\r
+     * @param {String/Object} api An API specification object, or the name of an action.\r
+     * @param {String/Function} url The URL (or function if using DirectProxy) to call for the action.\r
+     */\r
+    setApi : function() {\r
+        if (arguments.length == 1) {\r
+            var valid = Ext.data.Api.isValid(arguments[0]);\r
+            if (valid === true) {\r
+                this.api = arguments[0];\r
+            }\r
+            else {\r
+                throw new Ext.data.Api.Error('invalid', valid);\r
+            }\r
+        }\r
+        else if (arguments.length == 2) {\r
+            if (!Ext.data.Api.isAction(arguments[0])) {\r
+                throw new Ext.data.Api.Error('invalid', arguments[0]);\r
+            }\r
+            this.api[arguments[0]] = arguments[1];\r
+        }\r
+        Ext.data.Api.prepare(this);\r
     },\r
 \r
-    \r
-    b4MouseDown: function(e) {\r
-        // this.resetConstraints();\r
-        this.autoOffset(e.getPageX(),\r
-                            e.getPageY());\r
+    /**\r
+     * Returns true if the specified action is defined as a unique action in the api-config.\r
+     * request.  If all API-actions are routed to unique urls, the xaction parameter is unecessary.  However, if no api is defined\r
+     * and all Proxy actions are routed to DataProxy#url, the server-side will require the xaction parameter to perform a switch to\r
+     * the corresponding code for CRUD action.\r
+     * @param {String [Ext.data.Api.CREATE|READ|UPDATE|DESTROY]} action\r
+     * @return {Boolean}\r
+     */\r
+    isApiAction : function(action) {\r
+        return (this.api[action]) ? true : false;\r
     },\r
 \r
-    \r
-    b4Drag: function(e) {\r
-        this.setDragElPos(e.getPageX(),\r
-                            e.getPageY());\r
+    /**\r
+     * All proxy actions are executed through this method.  Automatically fires the "before" + action event\r
+     * @param {String} action Name of the action\r
+     * @param {Ext.data.Record/Ext.data.Record[]/null} rs Will be null when action is 'load'\r
+     * @param {Object} params\r
+     * @param {Ext.data.DataReader} reader\r
+     * @param {Function} callback\r
+     * @param {Object} scope Scope with which to call the callback (defaults to the Proxy object)\r
+     * @param {Object} options Any options specified for the action (e.g. see {@link Ext.data.Store#load}.\r
+     */\r
+    request : function(action, rs, params, reader, callback, scope, options) {\r
+        if (!this.api[action] && !this.load) {\r
+            throw new Ext.data.DataProxy.Error('action-undefined', action);\r
+        }\r
+        params = params || {};\r
+        if ((action === Ext.data.Api.actions.read) ? this.fireEvent("beforeload", this, params) : this.fireEvent("beforewrite", this, action, rs, params) !== false) {\r
+            this.doRequest.apply(this, arguments);\r
+        }\r
+        else {\r
+            callback.call(scope || this, null, options, false);\r
+        }\r
+    },\r
+\r
+\r
+    /**\r
+     * <b>Deprecated</b> load method using old method signature. See {@doRequest} for preferred method.\r
+     * @deprecated\r
+     * @param {Object} params\r
+     * @param {Object} reader\r
+     * @param {Object} callback\r
+     * @param {Object} scope\r
+     * @param {Object} arg\r
+     */\r
+    load : null,\r
+\r
+    /**\r
+     * @cfg {Function} doRequest Abstract method that should be implemented in all subclasses\r
+     * (e.g.: {@link Ext.data.HttpProxy#doRequest HttpProxy.doRequest},\r
+     * {@link Ext.data.DirectProxy#doRequest DirectProxy.doRequest}).\r
+     */\r
+    doRequest : function(action, rs, params, reader, callback, scope, options) {\r
+        // default implementation of doRequest for backwards compatibility with 2.0 proxies.\r
+        // If we're executing here, the action is probably "load".\r
+        // Call with the pre-3.0 method signature.\r
+        this.load(params, reader, callback, scope, options);\r
+    },\r
+\r
+    /**\r
+     * buildUrl\r
+     * Sets the appropriate url based upon the action being executed.  If restful is true, and only a single record is being acted upon,\r
+     * url will be built Rails-style, as in "/controller/action/32".  restful will aply iff the supplied record is an\r
+     * instance of Ext.data.Record rather than an Array of them.\r
+     * @param {String} action The api action being executed [read|create|update|destroy]\r
+     * @param {Ext.data.Record/Array[Ext.data.Record]} The record or Array of Records being acted upon.\r
+     * @return {String} url\r
+     * @private\r
+     */\r
+    buildUrl : function(action, record) {\r
+        record = record || null;\r
+        var url = (this.api[action]) ? this.api[action].url : this.url;\r
+        if (!url) {\r
+            throw new Ext.data.Api.Error('invalid-url', action);\r
+        }\r
+\r
+        var format = null;\r
+        var m = url.match(/(.*)(\.\w+)$/);  // <-- look for urls with "provides" suffix, e.g.: /users.json, /users.xml, etc\r
+        if (m) {\r
+            format = m[2];\r
+            url = m[1];\r
+        }\r
+        // prettyUrls is deprectated in favor of restful-config\r
+        if ((this.prettyUrls === true || this.restful === true) && record instanceof Ext.data.Record && !record.phantom) {\r
+            url += '/' + record.id;\r
+        }\r
+        if (format) {   // <-- append the request format if exists (ie: /users/update/69[.json])\r
+            url += format;\r
+        }\r
+        return url;\r
     },\r
 \r
-    toString: function() {\r
-        return ("DD " + this.id);\r
+    /**\r
+     * Destroys the proxy by purging any event listeners and cancelling any active requests.\r
+     */\r
+    destroy: function(){\r
+        this.purgeListeners();\r
     }\r
-\r
-    //////////////////////////////////////////////////////////////////////////\r
-    // Debugging ygDragDrop events that can be overridden\r
-    //////////////////////////////////////////////////////////////////////////\r
-    \r
-\r
 });\r
 \r
-Ext.dd.DDProxy = function(id, sGroup, config) {\r
-    if (id) {\r
-        this.init(id, sGroup, config);\r
-        this.initFrame();\r
+/**\r
+ * @class Ext.data.DataProxy.Error\r
+ * @extends Ext.Error\r
+ * DataProxy Error extension.\r
+ * constructor\r
+ * @param {String} name\r
+ * @param {Record/Array[Record]/Array}\r
+ */\r
+Ext.data.DataProxy.Error = Ext.extend(Ext.Error, {\r
+    constructor : function(message, arg) {\r
+        this.arg = arg;\r
+        Ext.Error.call(this, message);\r
+    },\r
+    name: 'Ext.data.DataProxy'\r
+});\r
+Ext.apply(Ext.data.DataProxy.Error.prototype, {\r
+    lang: {\r
+        'action-undefined': "DataProxy attempted to execute an API-action but found an undefined url / function.  Please review your Proxy url/api-configuration.",\r
+        'api-invalid': 'Recieved an invalid API-configuration.  Please ensure your proxy API-configuration contains only the actions from Ext.data.Api.actions.'\r
     }\r
-};\r
-\r
+});\r
+/**\r
+ * @class Ext.data.ScriptTagProxy\r
+ * @extends Ext.data.DataProxy\r
+ * An implementation of Ext.data.DataProxy that reads a data object from a URL which may be in a domain\r
+ * other than the originating domain of the running page.<br>\r
+ * <p>\r
+ * <b>Note that if you are retrieving data from a page that is in a domain that is NOT the same as the originating domain\r
+ * of the running page, you must use this class, rather than HttpProxy.</b><br>\r
+ * <p>\r
+ * The content passed back from a server resource requested by a ScriptTagProxy <b>must</b> be executable JavaScript\r
+ * source code because it is used as the source inside a &lt;script> tag.<br>\r
+ * <p>\r
+ * In order for the browser to process the returned data, the server must wrap the data object\r
+ * with a call to a callback function, the name of which is passed as a parameter by the ScriptTagProxy.\r
+ * Below is a Java example for a servlet which returns data for either a ScriptTagProxy, or an HttpProxy\r
+ * depending on whether the callback name was passed:\r
+ * <p>\r
+ * <pre><code>\r
+boolean scriptTag = false;\r
+String cb = request.getParameter("callback");\r
+if (cb != null) {\r
+    scriptTag = true;\r
+    response.setContentType("text/javascript");\r
+} else {\r
+    response.setContentType("application/x-json");\r
+}\r
+Writer out = response.getWriter();\r
+if (scriptTag) {\r
+    out.write(cb + "(");\r
+}\r
+out.print(dataBlock.toJsonString());\r
+if (scriptTag) {\r
+    out.write(");");\r
+}\r
+</code></pre>\r
+ *\r
+ * @constructor\r
+ * @param {Object} config A configuration object.\r
+ */\r
+Ext.data.ScriptTagProxy = function(config){\r
+    Ext.apply(this, config);\r
 \r
-Ext.dd.DDProxy.dragElId = "ygddfdiv";\r
+    Ext.data.ScriptTagProxy.superclass.constructor.call(this, config);\r
 \r
-Ext.extend(Ext.dd.DDProxy, Ext.dd.DD, {\r
+    this.head = document.getElementsByTagName("head")[0];\r
 \r
-    \r
-    resizeFrame: true,\r
+    /**\r
+     * @event loadexception\r
+     * <b>Deprecated</b> in favor of 'exception' event.\r
+     * Fires if an exception occurs in the Proxy during data loading.  This event can be fired for one of two reasons:\r
+     * <ul><li><b>The load call timed out.</b>  This means the load callback did not execute within the time limit\r
+     * specified by {@link #timeout}.  In this case, this event will be raised and the\r
+     * fourth parameter (read error) will be null.</li>\r
+     * <li><b>The load succeeded but the reader could not read the response.</b>  This means the server returned\r
+     * data, but the configured Reader threw an error while reading the data.  In this case, this event will be\r
+     * raised and the caught error will be passed along as the fourth parameter of this event.</li></ul>\r
+     * Note that this event is also relayed through {@link Ext.data.Store}, so you can listen for it directly\r
+     * on any Store instance.\r
+     * @param {Object} this\r
+     * @param {Object} options The loading options that were specified (see {@link #load} for details).  If the load\r
+     * call timed out, this parameter will be null.\r
+     * @param {Object} arg The callback's arg object passed to the {@link #load} function\r
+     * @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data.\r
+     * If the remote request returns success: false, this parameter will be null.\r
+     */\r
+};\r
 \r
-    \r
-    centerFrame: false,\r
+Ext.data.ScriptTagProxy.TRANS_ID = 1000;\r
 \r
-    \r
-    createFrame: function() {\r
-        var self = this;\r
-        var body = document.body;\r
+Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {\r
+    /**\r
+     * @cfg {String} url The URL from which to request the data object.\r
+     */\r
+    /**\r
+     * @cfg {Number} timeout (optional) The number of milliseconds to wait for a response. Defaults to 30 seconds.\r
+     */\r
+    timeout : 30000,\r
+    /**\r
+     * @cfg {String} callbackParam (Optional) The name of the parameter to pass to the server which tells\r
+     * the server the name of the callback function set up by the load call to process the returned data object.\r
+     * Defaults to "callback".<p>The server-side processing must read this parameter value, and generate\r
+     * javascript output which calls this named function passing the data object as its only parameter.\r
+     */\r
+    callbackParam : "callback",\r
+    /**\r
+     *  @cfg {Boolean} nocache (optional) Defaults to true. Disable caching by adding a unique parameter\r
+     * name to the request.\r
+     */\r
+    nocache : true,\r
 \r
-        if (!body || !body.firstChild) {\r
-            setTimeout( function() { self.createFrame(); }, 50 );\r
-            return;\r
+    /**\r
+     * HttpProxy implementation of DataProxy#doRequest\r
+     * @param {String} action\r
+     * @param {Ext.data.Record/Ext.data.Record[]} rs If action is <tt>read</tt>, rs will be null\r
+     * @param {Object} params An object containing properties which are to be used as HTTP parameters\r
+     * for the request to the remote server.\r
+     * @param {Ext.data.DataReader} reader The Reader object which converts the data\r
+     * object into a block of Ext.data.Records.\r
+     * @param {Function} callback The function into which to pass the block of Ext.data.Records.\r
+     * The function must be passed <ul>\r
+     * <li>The Record block object</li>\r
+     * <li>The "arg" argument from the load function</li>\r
+     * <li>A boolean success indicator</li>\r
+     * </ul>\r
+     * @param {Object} scope The scope in which to call the callback\r
+     * @param {Object} arg An optional argument which is passed to the callback as its second parameter.\r
+     */\r
+    doRequest : function(action, rs, params, reader, callback, scope, arg) {\r
+        var p = Ext.urlEncode(Ext.apply(params, this.extraParams));\r
+\r
+        var url = this.buildUrl(action, rs);\r
+        if (!url) {\r
+            throw new Ext.data.Api.Error('invalid-url', url);\r
+        }\r
+        url = Ext.urlAppend(url, p);\r
+\r
+        if(this.nocache){\r
+            url = Ext.urlAppend(url, '_dc=' + (new Date().getTime()));\r
+        }\r
+        var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;\r
+        var trans = {\r
+            id : transId,\r
+            action: action,\r
+            cb : "stcCallback"+transId,\r
+            scriptId : "stcScript"+transId,\r
+            params : params,\r
+            arg : arg,\r
+            url : url,\r
+            callback : callback,\r
+            scope : scope,\r
+            reader : reader\r
+        };\r
+        window[trans.cb] = this.createCallback(action, rs, trans);\r
+        url += String.format("&{0}={1}", this.callbackParam, trans.cb);\r
+        if(this.autoAbort !== false){\r
+            this.abort();\r
         }\r
 \r
-        var div = this.getDragEl();\r
-\r
-        if (!div) {\r
-            div    = document.createElement("div");\r
-            div.id = this.dragElId;\r
-            var s  = div.style;\r
+        trans.timeoutId = this.handleFailure.defer(this.timeout, this, [trans]);\r
 \r
-            s.position   = "absolute";\r
-            s.visibility = "hidden";\r
-            s.cursor     = "move";\r
-            s.border     = "2px solid #aaa";\r
-            s.zIndex     = 999;\r
+        var script = document.createElement("script");\r
+        script.setAttribute("src", url);\r
+        script.setAttribute("type", "text/javascript");\r
+        script.setAttribute("id", trans.scriptId);\r
+        this.head.appendChild(script);\r
 \r
-            // appendChild can blow up IE if invoked prior to the window load event\r
-            // while rendering a table.  It is possible there are other scenarios\r
-            // that would cause this to happen as well.\r
-            body.insertBefore(div, body.firstChild);\r
-        }\r
+        this.trans = trans;\r
     },\r
 \r
-    \r
-    initFrame: function() {\r
-        this.createFrame();\r
+    // @private createCallback\r
+    createCallback : function(action, rs, trans) {\r
+        var self = this;\r
+        return function(res) {\r
+            self.trans = false;\r
+            self.destroyTrans(trans, true);\r
+            if (action === Ext.data.Api.actions.read) {\r
+                self.onRead.call(self, action, trans, res);\r
+            } else {\r
+                self.onWrite.call(self, action, trans, res, rs);\r
+            }\r
+        };\r
     },\r
+    /**\r
+     * Callback for read actions\r
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]\r
+     * @param {Object} trans The request transaction object\r
+     * @param {Object} res The server response\r
+     * @private\r
+     */\r
+    onRead : function(action, trans, res) {\r
+        var result;\r
+        try {\r
+            result = trans.reader.readRecords(res);\r
+        }catch(e){\r
+            // @deprecated: fire loadexception\r
+            this.fireEvent("loadexception", this, trans, res, e);\r
 \r
-    applyConfig: function() {\r
-        Ext.dd.DDProxy.superclass.applyConfig.call(this);\r
+            this.fireEvent('exception', this, 'response', action, trans, res, e);\r
+            trans.callback.call(trans.scope||window, null, trans.arg, false);\r
+            return;\r
+        }\r
+        if (result.success === false) {\r
+            // @deprecated: fire old loadexception for backwards-compat.\r
+            this.fireEvent('loadexception', this, trans, res);\r
 \r
-        this.resizeFrame = (this.config.resizeFrame !== false);\r
-        this.centerFrame = (this.config.centerFrame);\r
-        this.setDragElId(this.config.dragElId || Ext.dd.DDProxy.dragElId);\r
+            this.fireEvent('exception', this, 'remote', action, trans, res, null);\r
+        } else {\r
+            this.fireEvent("load", this, res, trans.arg);\r
+        }\r
+        trans.callback.call(trans.scope||window, result, trans.arg, result.success);\r
+    },\r
+    /**\r
+     * Callback for write actions\r
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]\r
+     * @param {Object} trans The request transaction object\r
+     * @param {Object} res The server response\r
+     * @private\r
+     */\r
+    onWrite : function(action, trans, res, rs) {\r
+        var reader = trans.reader;\r
+        try {\r
+            // though we already have a response object here in STP, run through readResponse to catch any meta-data exceptions.\r
+            reader.readResponse(action, res);\r
+        } catch (e) {\r
+            this.fireEvent('exception', this, 'response', action, trans, res, e);\r
+            trans.callback.call(trans.scope||window, null, res, false);\r
+            return;\r
+        }\r
+        if(!res[reader.meta.successProperty] === true){\r
+            this.fireEvent('exception', this, 'remote', action, trans, res, rs);\r
+            trans.callback.call(trans.scope||window, null, res, false);\r
+            return;\r
+        }\r
+        this.fireEvent("write", this, action, res[reader.meta.root], res, rs, trans.arg );\r
+        trans.callback.call(trans.scope||window, res[reader.meta.root], res, true);\r
     },\r
 \r
-    \r
-    showFrame: function(iPageX, iPageY) {\r
-        var el = this.getEl();\r
-        var dragEl = this.getDragEl();\r
-        var s = dragEl.style;\r
-\r
-        this._resizeProxy();\r
+    // private\r
+    isLoading : function(){\r
+        return this.trans ? true : false;\r
+    },\r
 \r
-        if (this.centerFrame) {\r
-            this.setDelta( Math.round(parseInt(s.width,  10)/2),\r
-                           Math.round(parseInt(s.height, 10)/2) );\r
+    /**\r
+     * Abort the current server request.\r
+     */\r
+    abort : function(){\r
+        if(this.isLoading()){\r
+            this.destroyTrans(this.trans);\r
         }\r
-\r
-        this.setDragElPos(iPageX, iPageY);\r
-\r
-        Ext.fly(dragEl).show();\r
     },\r
 \r
-    \r
-    _resizeProxy: function() {\r
-        if (this.resizeFrame) {\r
-            var el = this.getEl();\r
-            Ext.fly(this.getDragEl()).setSize(el.offsetWidth, el.offsetHeight);\r
+    // private\r
+    destroyTrans : function(trans, isLoaded){\r
+        this.head.removeChild(document.getElementById(trans.scriptId));\r
+        clearTimeout(trans.timeoutId);\r
+        if(isLoaded){\r
+            window[trans.cb] = undefined;\r
+            try{\r
+                delete window[trans.cb];\r
+            }catch(e){}\r
+        }else{\r
+            // if hasn't been loaded, wait for load to remove it to prevent script error\r
+            window[trans.cb] = function(){\r
+                window[trans.cb] = undefined;\r
+                try{\r
+                    delete window[trans.cb];\r
+                }catch(e){}\r
+            };\r
         }\r
     },\r
 \r
-    // overrides Ext.dd.DragDrop\r
-    b4MouseDown: function(e) {\r
-        var x = e.getPageX();\r
-        var y = e.getPageY();\r
-        this.autoOffset(x, y);\r
-        this.setDragElPos(x, y);\r
-    },\r
+    // private\r
+    handleFailure : function(trans){\r
+        this.trans = false;\r
+        this.destroyTrans(trans, false);\r
+        if (trans.action === Ext.data.Api.actions.read) {\r
+            // @deprecated firing loadexception\r
+            this.fireEvent("loadexception", this, null, trans.arg);\r
+        }\r
 \r
-    // overrides Ext.dd.DragDrop\r
-    b4StartDrag: function(x, y) {\r
-        // show the drag frame\r
-        this.showFrame(x, y);\r
+        this.fireEvent('exception', this, 'response', trans.action, {\r
+            response: null,\r
+            options: trans.arg\r
+        });\r
+        trans.callback.call(trans.scope||window, null, trans.arg, false);\r
     },\r
 \r
-    // overrides Ext.dd.DragDrop\r
-    b4EndDrag: function(e) {\r
-        Ext.fly(this.getDragEl()).hide();\r
-    },\r
+    // inherit docs\r
+    destroy: function(){\r
+        this.abort();\r
+        Ext.data.ScriptTagProxy.superclass.destroy.call(this);\r
+    }\r
+});/**\r
+ * @class Ext.data.HttpProxy\r
+ * @extends Ext.data.DataProxy\r
+ * <p>An implementation of {@link Ext.data.DataProxy} that processes data requests within the same\r
+ * domain of the originating page.</p>\r
+ * <p><b>Note</b>: this class cannot be used to retrieve data from a domain other\r
+ * than the domain from which the running page was served. For cross-domain requests, use a\r
+ * {@link Ext.data.ScriptTagProxy ScriptTagProxy}.</p>\r
+ * <p>Be aware that to enable the browser to parse an XML document, the server must set\r
+ * the Content-Type header in the HTTP response to "<tt>text/xml</tt>".</p>\r
+ * @constructor\r
+ * @param {Object} conn\r
+ * An {@link Ext.data.Connection} object, or options parameter to {@link Ext.Ajax#request}.\r
+ * <p>Note that if this HttpProxy is being used by a (@link Ext.data.Store Store}, then the\r
+ * Store's call to {@link #load} will override any specified <tt>callback</tt> and <tt>params</tt>\r
+ * options. In this case, use the Store's {@link Ext.data.Store#events events} to modify parameters,\r
+ * or react to loading events. The Store's {@link Ext.data.Store#baseParams baseParams} may also be\r
+ * used to pass parameters known at instantiation time.</p>\r
+ * <p>If an options parameter is passed, the singleton {@link Ext.Ajax} object will be used to make\r
+ * the request.</p>\r
+ */\r
+Ext.data.HttpProxy = function(conn){\r
+    Ext.data.HttpProxy.superclass.constructor.call(this, conn);\r
+\r
+    /**\r
+     * The Connection object (Or options parameter to {@link Ext.Ajax#request}) which this HttpProxy\r
+     * uses to make requests to the server. Properties of this object may be changed dynamically to\r
+     * change the way data is requested.\r
+     * @property\r
+     */\r
+    this.conn = conn;\r
 \r
-    // overrides Ext.dd.DragDrop\r
-    // By default we try to move the element to the last location of the frame.\r
-    // This is so that the default behavior mirrors that of Ext.dd.DD.\r
-    endDrag: function(e) {\r
+    // nullify the connection url.  The url param has been copied to 'this' above.  The connection\r
+    // url will be set during each execution of doRequest when buildUrl is called.  This makes it easier for users to override the\r
+    // connection url during beforeaction events (ie: beforeload, beforesave, etc).  The connection url will be nullified\r
+    // after each request as well.  Url is always re-defined during doRequest.\r
+    this.conn.url = null;\r
 \r
-        var lel = this.getEl();\r
-        var del = this.getDragEl();\r
+    this.useAjax = !conn || !conn.events;\r
 \r
-        // Show the drag frame briefly so we can get its position\r
-        del.style.visibility = "";\r
+    //private.  A hash containing active requests, keyed on action [Ext.data.Api.actions.create|read|update|destroy]\r
+    var actions = Ext.data.Api.actions;\r
+    this.activeRequest = {};\r
+    for (var verb in actions) {\r
+        this.activeRequest[actions[verb]] = undefined;\r
+    }\r
+};\r
 \r
-        this.beforeMove();\r
-        // Hide the linked element before the move to get around a Safari\r
-        // rendering bug.\r
-        lel.style.visibility = "hidden";\r
-        Ext.dd.DDM.moveToEl(lel, del);\r
-        del.style.visibility = "hidden";\r
-        lel.style.visibility = "";\r
+Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {\r
+    /**\r
+     * @cfg {Boolean} restful\r
+     * <p>If set to <tt>true</tt>, a {@link Ext.data.Record#phantom non-phantom} record's\r
+     * {@link Ext.data.Record#id id} will be appended to the url (defaults to <tt>false</tt>).</p><br>\r
+     * <p>The url is built based upon the action being executed <tt>[load|create|save|destroy]</tt>\r
+     * using the commensurate <tt>{@link #api}</tt> property, or if undefined default to the\r
+     * configured {@link Ext.data.Store}.{@link Ext.data.Store#url url}.</p><br>\r
+     * <p>Some MVC (e.g., Ruby on Rails, Merb and Django) support this style of segment based urls\r
+     * where the segments in the URL follow the Model-View-Controller approach.</p><pre><code>\r
+     * someSite.com/controller/action/id\r
+     * </code></pre>\r
+     * Where the segments in the url are typically:<div class="mdetail-params"><ul>\r
+     * <li>The first segment : represents the controller class that should be invoked.</li>\r
+     * <li>The second segment : represents the class function, or method, that should be called.</li>\r
+     * <li>The third segment : represents the ID (a variable typically passed to the method).</li>\r
+     * </ul></div></p>\r
+     * <p>For example:</p>\r
+     * <pre><code>\r
+api: {\r
+    load :    '/controller/load',\r
+    create :  '/controller/new',  // Server MUST return idProperty of new record\r
+    save :    '/controller/update',\r
+    destroy : '/controller/destroy_action'\r
+}\r
 \r
-        this.afterDrag();\r
+// Alternatively, one can use the object-form to specify each API-action\r
+api: {\r
+    load: {url: 'read.php', method: 'GET'},\r
+    create: 'create.php',\r
+    destroy: 'destroy.php',\r
+    save: 'update.php'\r
+}\r
+     */\r
+\r
+    /**\r
+     * Return the {@link Ext.data.Connection} object being used by this Proxy.\r
+     * @return {Connection} The Connection object. This object may be used to subscribe to events on\r
+     * a finer-grained basis than the DataProxy events.\r
+     */\r
+    getConnection : function() {\r
+        return this.useAjax ? Ext.Ajax : this.conn;\r
     },\r
 \r
-    beforeMove : function(){\r
+    /**\r
+     * Used for overriding the url used for a single request.  Designed to be called during a beforeaction event.  Calling setUrl\r
+     * will override any urls set via the api configuration parameter.  Set the optional parameter makePermanent to set the url for\r
+     * all subsequent requests.  If not set to makePermanent, the next request will use the same url or api configuration defined\r
+     * in the initial proxy configuration.\r
+     * @param {String} url\r
+     * @param {Boolean} makePermanent (Optional) [false]\r
+     *\r
+     * (e.g.: beforeload, beforesave, etc).\r
+     */\r
+    setUrl : function(url, makePermanent) {\r
+        this.conn.url = url;\r
+        if (makePermanent === true) {\r
+            this.url = url;\r
+            Ext.data.Api.prepare(this);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * HttpProxy implementation of DataProxy#doRequest\r
+     * @param {String} action The crud action type (create, read, update, destroy)\r
+     * @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null\r
+     * @param {Object} params An object containing properties which are to be used as HTTP parameters\r
+     * for the request to the remote server.\r
+     * @param {Ext.data.DataReader} reader The Reader object which converts the data\r
+     * object into a block of Ext.data.Records.\r
+     * @param {Function} callback\r
+     * <div class="sub-desc"><p>A function to be called after the request.\r
+     * The <tt>callback</tt> is passed the following arguments:<ul>\r
+     * <li><tt>r</tt> : Ext.data.Record[] The block of Ext.data.Records.</li>\r
+     * <li><tt>options</tt>: Options object from the action request</li>\r
+     * <li><tt>success</tt>: Boolean success indicator</li></ul></p></div>\r
+     * @param {Object} scope The scope in which to call the callback\r
+     * @param {Object} arg An optional argument which is passed to the callback as its second parameter.\r
+     */\r
+    doRequest : function(action, rs, params, reader, cb, scope, arg) {\r
+        var  o = {\r
+            method: (this.api[action]) ? this.api[action]['method'] : undefined,\r
+            request: {\r
+                callback : cb,\r
+                scope : scope,\r
+                arg : arg\r
+            },\r
+            reader: reader,\r
+            callback : this.createCallback(action, rs),\r
+            scope: this\r
+        };\r
+        // Sample the request data:  If it's an object, then it hasn't been json-encoded yet.\r
+        // Transmit data using jsonData config of Ext.Ajax.request\r
+        if (typeof(params[reader.meta.root]) === 'object') {\r
+            o.jsonData = params;\r
+        } else {\r
+            o.params = params || {};\r
+        }\r
+        // Set the connection url.  If this.conn.url is not null here,\r
+        // the user may have overridden the url during a beforeaction event-handler.\r
+        // this.conn.url is nullified after each request.\r
+        if (this.conn.url === null) {\r
+            this.conn.url = this.buildUrl(action, rs);\r
+        }\r
+        else if (this.restful === true && rs instanceof Ext.data.Record && !rs.phantom) {\r
+            this.conn.url += '/' + rs.id;\r
+        }\r
+        if(this.useAjax){\r
+\r
+            Ext.applyIf(o, this.conn);\r
 \r
+            // If a currently running request is found for this action, abort it.\r
+            if (this.activeRequest[action]) {\r
+                // Disabled aborting activeRequest while implementing REST.  activeRequest[action] will have to become an array\r
+                //Ext.Ajax.abort(this.activeRequest[action]);\r
+            }\r
+            this.activeRequest[action] = Ext.Ajax.request(o);\r
+        }else{\r
+            this.conn.request(o);\r
+        }\r
+        // request is sent, nullify the connection url in preparation for the next request\r
+        this.conn.url = null;\r
+    },\r
+\r
+    /**\r
+     * Returns a callback function for a request.  Note a special case is made for the\r
+     * read action vs all the others.\r
+     * @param {String} action [create|update|delete|load]\r
+     * @param {Ext.data.Record[]} rs The Store-recordset being acted upon\r
+     * @private\r
+     */\r
+    createCallback : function(action, rs) {\r
+        return function(o, success, response) {\r
+            this.activeRequest[action] = undefined;\r
+            if (!success) {\r
+                if (action === Ext.data.Api.actions.read) {\r
+                    // @deprecated: fire loadexception for backwards compat.\r
+                    this.fireEvent('loadexception', this, o, response);\r
+                }\r
+                this.fireEvent('exception', this, 'response', action, o, response);\r
+                o.request.callback.call(o.request.scope, null, o.request.arg, false);\r
+                return;\r
+            }\r
+            if (action === Ext.data.Api.actions.read) {\r
+                this.onRead(action, o, response);\r
+            } else {\r
+                this.onWrite(action, o, response, rs);\r
+            }\r
+        }\r
     },\r
 \r
-    afterDrag : function(){\r
-\r
+    /**\r
+     * Callback for read action\r
+     * @param {String} action Action name as per {@link Ext.data.Api.actions#read}.\r
+     * @param {Object} o The request transaction object\r
+     * @param {Object} res The server response\r
+     * @private\r
+     */\r
+    onRead : function(action, o, response) {\r
+        var result;\r
+        try {\r
+            result = o.reader.read(response);\r
+        }catch(e){\r
+            // @deprecated: fire old loadexception for backwards-compat.\r
+            this.fireEvent('loadexception', this, o, response, e);\r
+            this.fireEvent('exception', this, 'response', action, o, response, e);\r
+            o.request.callback.call(o.request.scope, null, o.request.arg, false);\r
+            return;\r
+        }\r
+        if (result.success === false) {\r
+            // @deprecated: fire old loadexception for backwards-compat.\r
+            this.fireEvent('loadexception', this, o, response);\r
+\r
+            // Get DataReader read-back a response-object to pass along to exception event\r
+            var res = o.reader.readResponse(action, response);\r
+            this.fireEvent('exception', this, 'remote', action, o, res, null);\r
+        }\r
+        else {\r
+            this.fireEvent('load', this, o, o.request.arg);\r
+        }\r
+        o.request.callback.call(o.request.scope, result, o.request.arg, result.success);\r
+    },\r
+    /**\r
+     * Callback for write actions\r
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]\r
+     * @param {Object} trans The request transaction object\r
+     * @param {Object} res The server response\r
+     * @private\r
+     */\r
+    onWrite : function(action, o, response, rs) {\r
+        var reader = o.reader;\r
+        var res;\r
+        try {\r
+            res = reader.readResponse(action, response);\r
+        } catch (e) {\r
+            this.fireEvent('exception', this, 'response', action, o, response, e);\r
+            o.request.callback.call(o.request.scope, null, o.request.arg, false);\r
+            return;\r
+        }\r
+        if (res[reader.meta.successProperty] === false) {\r
+            this.fireEvent('exception', this, 'remote', action, o, res, rs);\r
+        } else {\r
+            this.fireEvent('write', this, action, res[reader.meta.root], res, rs, o.request.arg);\r
+        }\r
+        o.request.callback.call(o.request.scope, res[reader.meta.root], res, res[reader.meta.successProperty]);\r
     },\r
 \r
-    toString: function() {\r
-        return ("DDProxy " + this.id);\r
+    // inherit docs\r
+    destroy: function(){\r
+        if(!this.useAjax){\r
+            this.conn.abort();\r
+        }else if(this.activeRequest){\r
+            var actions = Ext.data.Api.actions;\r
+            for (var verb in actions) {\r
+                if(this.activeRequest[actions[verb]]){\r
+                    Ext.Ajax.abort(this.activeRequest[actions[verb]]);\r
+                }\r
+            }\r
+        }\r
+        Ext.data.HttpProxy.superclass.destroy.call(this);\r
     }\r
+});/**\r
+ * @class Ext.data.MemoryProxy\r
+ * @extends Ext.data.DataProxy\r
+ * An implementation of Ext.data.DataProxy that simply passes the data specified in its constructor\r
+ * to the Reader when its load method is called.\r
+ * @constructor\r
+ * @param {Object} data The data object which the Reader uses to construct a block of Ext.data.Records.\r
+ */\r
+Ext.data.MemoryProxy = function(data){\r
+    // Must define a dummy api with "read" action to satisfy DataProxy#doRequest and Ext.data.Api#prepare *before* calling super\r
+    var api = {};\r
+    api[Ext.data.Api.actions.read] = true;\r
+    Ext.data.MemoryProxy.superclass.constructor.call(this, {\r
+        api: api\r
+    });\r
+    this.data = data;\r
+};\r
 \r
-});\r
+Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {\r
+    /**\r
+     * @event loadexception\r
+     * Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed\r
+     * through {@link Ext.data.Store}, so you can listen for it directly on any Store instance.\r
+     * @param {Object} this\r
+     * @param {Object} arg The callback's arg object passed to the {@link #load} function\r
+     * @param {Object} null This parameter does not apply and will always be null for MemoryProxy\r
+     * @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data\r
+     */\r
+\r
+       /**\r
+     * MemoryProxy implementation of DataProxy#doRequest\r
+     * @param {String} action\r
+     * @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null\r
+     * @param {Object} params An object containing properties which are to be used as HTTP parameters\r
+     * for the request to the remote server.\r
+     * @param {Ext.data.DataReader} reader The Reader object which converts the data\r
+     * object into a block of Ext.data.Records.\r
+     * @param {Function} callback The function into which to pass the block of Ext.data.Records.\r
+     * The function must be passed <ul>\r
+     * <li>The Record block object</li>\r
+     * <li>The "arg" argument from the load function</li>\r
+     * <li>A boolean success indicator</li>\r
+     * </ul>\r
+     * @param {Object} scope The scope in which to call the callback\r
+     * @param {Object} arg An optional argument which is passed to the callback as its second parameter.\r
+     */\r
+    doRequest : function(action, rs, params, reader, callback, scope, arg) {\r
+        // No implementation for CRUD in MemoryProxy.  Assumes all actions are 'load'\r
+        params = params || {};\r
+        var result;\r
+        try {\r
+            result = reader.readRecords(this.data);\r
+        }catch(e){\r
+            // @deprecated loadexception\r
+            this.fireEvent("loadexception", this, null, arg, e);\r
 \r
-Ext.dd.DDTarget = function(id, sGroup, config) {\r
-    if (id) {\r
-        this.initTarget(id, sGroup, config);\r
+            this.fireEvent('exception', this, 'response', action, arg, null, e);\r
+            callback.call(scope, null, arg, false);\r
+            return;\r
+        }\r
+        callback.call(scope, result, arg, true);\r
     }\r
-};\r
-\r
-// Ext.dd.DDTarget.prototype = new Ext.dd.DragDrop();\r
-Ext.extend(Ext.dd.DDTarget, Ext.dd.DragDrop, {\r
-    toString: function() {\r
-        return ("DDTarget " + this.id);\r
+});/**
+ * @class Ext.data.JsonWriter
+ * @extends Ext.data.DataWriter
+ * DataWriter extension for writing an array or single {@link Ext.data.Record} object(s) in preparation for executing a remote CRUD action.
+ */
+Ext.data.JsonWriter = function(config) {
+    Ext.data.JsonWriter.superclass.constructor.call(this, config);
+    // careful to respect "returnJson", renamed to "encode"
+    if (this.returnJson != undefined) {
+        this.encode = this.returnJson;
+    }
+}
+Ext.extend(Ext.data.JsonWriter, Ext.data.DataWriter, {
+    /**
+     * @cfg {Boolean} returnJson <b>Deprecated.  Use {@link Ext.data.JsonWriter#encode} instead.
+     */
+    returnJson : undefined,
+    /**
+     * @cfg {Boolean} encode <tt>true</tt> to {@link Ext.util.JSON#encode encode} the
+     * {@link Ext.data.DataWriter#toHash hashed data}. Defaults to <tt>true</tt>.  When using
+     * {@link Ext.data.DirectProxy}, set this to <tt>false</tt> since Ext.Direct.JsonProvider will perform
+     * its own json-encoding.  In addition, if you're using {@link Ext.data.HttpProxy}, setting to <tt>false</tt>
+     * will cause HttpProxy to transmit data using the <b>jsonData</b> configuration-params of {@link Ext.Ajax#request}
+     * instead of <b>params</b>.  When using a {@link Ext.data.Store#restful} Store, some serverside frameworks are
+     * tuned to expect data through the jsonData mechanism.  In those cases, one will want to set <b>encode: <tt>false</tt></b>
+     */
+    encode : true,
+
+    /**
+     * Final action of a write event.  Apply the written data-object to params.
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
+     * @param {Record[]} rs
+     * @param {Object} http params
+     * @param {Object} data object populated according to DataReader meta-data "root" and "idProperty"
+     */
+    render : function(action, rs, params, data) {
+        Ext.apply(params, data);
+
+        if (this.encode === true) { // <-- @deprecated returnJson
+            if (Ext.isArray(rs) && data[this.meta.idProperty]) {
+                params[this.meta.idProperty] = Ext.encode(params[this.meta.idProperty]);
+            }
+            params[this.meta.root] = Ext.encode(params[this.meta.root]);
+        }
+    },
+    /**
+     * createRecord
+     * @protected
+     * @param {Ext.data.Record} rec
+     */
+    createRecord : function(rec) {
+        return this.toHash(rec);
+    },
+    /**
+     * updateRecord
+     * @protected
+     * @param {Ext.data.Record} rec
+     */
+    updateRecord : function(rec) {
+        return this.toHash(rec);
+
+    },
+    /**
+     * destroyRecord
+     * @protected
+     * @param {Ext.data.Record} rec
+     */
+    destroyRecord : function(rec) {
+        return rec.id;
+    }
+});/**
+ * @class Ext.data.JsonReader
+ * @extends Ext.data.DataReader
+ * <p>Data reader class to create an Array of {@link Ext.data.Record} objects from a JSON response
+ * based on mappings in a provided {@link Ext.data.Record} constructor.</p>
+ * <p>Example code:</p>
+ * <pre><code>
+var Employee = Ext.data.Record.create([
+    {name: 'firstname'},                  // map the Record's "firstname" field to the row object's key of the same name
+    {name: 'job', mapping: 'occupation'}  // map the Record's "job" field to the row object's "occupation" key
+]);
+var myReader = new Ext.data.JsonReader(
+    {                             // The metadata property, with configuration options:
+        totalProperty: "results", //   the property which contains the total dataset size (optional)
+        root: "rows",             //   the property which contains an Array of record data objects
+        idProperty: "id"          //   the property within each row object that provides an ID for the record (optional)
+    },
+    Employee  // {@link Ext.data.Record} constructor that provides mapping for JSON object
+);
+</code></pre>
+ * <p>This would consume a JSON data object of the form:</p><pre><code>
+{
+    results: 2,  // Reader's configured totalProperty
+    rows: [      // Reader's configured root
+        { id: 1, firstname: 'Bill', occupation: 'Gardener' },         // a row object
+        { id: 2, firstname: 'Ben' , occupation: 'Horticulturalist' }  // another row object
+    ]
+}
+</code></pre>
+ * <p><b><u>Automatic configuration using metaData</u></b></p>
+ * <p>It is possible to change a JsonReader's metadata at any time by including a <b><tt>metaData</tt></b>
+ * property in the JSON data object. If the JSON data object has a <b><tt>metaData</tt></b> property, a
+ * {@link Ext.data.Store Store} object using this Reader will reconfigure itself to use the newly provided
+ * field definition and fire its {@link Ext.data.Store#metachange metachange} event. The metachange event
+ * handler may interrogate the <b><tt>metaData</tt></b> property to perform any configuration required.
+ * Note that reconfiguring a Store potentially invalidates objects which may refer to Fields or Records
+ * which no longer exist.</p>
+ * <p>The <b><tt>metaData</tt></b> property in the JSON data object may contain:</p>
+ * <div class="mdetail-params"><ul>
+ * <li>any of the configuration options for this class</li>
+ * <li>a <b><tt>{@link Ext.data.Record#fields fields}</tt></b> property which the JsonReader will
+ * use as an argument to the {@link Ext.data.Record#create data Record create method} in order to
+ * configure the layout of the Records it will produce.</li>
+ * <li>a <b><tt>{@link Ext.data.Store#sortInfo sortInfo}</tt></b> property which the JsonReader will
+ * use to set the {@link Ext.data.Store}'s {@link Ext.data.Store#sortInfo sortInfo} property</li>
+ * <li>any user-defined properties needed</li>
+ * </ul></div>
+ * <p>To use this facility to send the same data as the example above (without having to code the creation
+ * of the Record constructor), you would create the JsonReader like this:</p><pre><code>
+var myReader = new Ext.data.JsonReader();
+</code></pre>
+ * <p>The first data packet from the server would configure the reader by containing a
+ * <b><tt>metaData</tt></b> property <b>and</b> the data. For example, the JSON data object might take
+ * the form:</p>
+<pre><code>
+{
+    metaData: {
+        idProperty: 'id',
+        root: 'rows',
+        totalProperty: 'results',
+        fields: [
+            {name: 'name'},
+            {name: 'job', mapping: 'occupation'}
+        ],
+        sortInfo: {field: 'name', direction:'ASC'}, // used by store to set its sortInfo
+        foo: 'bar' // custom property
+    },
+    results: 2,
+    rows: [ // an Array
+        { 'id': 1, 'name': 'Bill', occupation: 'Gardener' },
+        { 'id': 2, 'name': 'Ben', occupation: 'Horticulturalist' }
+    ]
+}
+</code></pre>
+ * @cfg {String} totalProperty [total] Name of the property from which to retrieve the total number of records
+ * in the dataset. This is only needed if the whole dataset is not passed in one go, but is being
+ * paged from the remote server.  Defaults to <tt>total</tt>.
+ * @cfg {String} successProperty [success] Name of the property from which to
+ * retrieve the success attribute. Defaults to <tt>success</tt>.  See
+ * {@link Ext.data.DataProxy}.{@link Ext.data.DataProxy#exception exception}
+ * for additional information.
+ * @cfg {String} root [undefined] <b>Required</b>.  The name of the property
+ * which contains the Array of row objects.  Defaults to <tt>undefined</tt>.
+ * An exception will be thrown if the root property is undefined. The data packet
+ * value for this property should be an empty array to clear the data or show
+ * no data.
+ * @cfg {String} idProperty [id] Name of the property within a row object that contains a record identifier value.  Defaults to <tt>id</tt>
+ * @constructor
+ * Create a new JsonReader
+ * @param {Object} meta Metadata configuration options.
+ * @param {Array/Object} recordType
+ * <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
+ * will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
+ * constructor created from {@link Ext.data.Record#create}.</p>
+ */
+Ext.data.JsonReader = function(meta, recordType){
+    meta = meta || {};
+
+    // default idProperty, successProperty & totalProperty -> "id", "success", "total"
+    Ext.applyIf(meta, {
+        idProperty: 'id',
+        successProperty: 'success',
+        totalProperty: 'total'
+    });
+
+    Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);
+};
+Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, {
+    /**
+     * This JsonReader's metadata as passed to the constructor, or as passed in
+     * the last data packet's <b><tt>metaData</tt></b> property.
+     * @type Mixed
+     * @property meta
+     */
+    /**
+     * This method is only used by a DataProxy which has retrieved data from a remote server.
+     * @param {Object} response The XHR object which contains the JSON data in its responseText.
+     * @return {Object} data A data block which is used by an Ext.data.Store object as
+     * a cache of Ext.data.Records.
+     */
+    read : function(response){
+        var json = response.responseText;
+        var o = Ext.decode(json);
+        if(!o) {
+            throw {message: "JsonReader.read: Json object not found"};
+        }
+        return this.readRecords(o);
+    },
+
+    // private function a store will implement
+    onMetaChange : function(meta, recordType, o){
+
+    },
+
+    /**
+     * @ignore
+     */
+    simpleAccess: function(obj, subsc) {
+        return obj[subsc];
+    },
+
+    /**
+     * @ignore
+     */
+    getJsonAccessor: function(){
+        var re = /[\[\.]/;
+        return function(expr) {
+            try {
+                return(re.test(expr)) ?
+                new Function("obj", "return obj." + expr) :
+                function(obj){
+                    return obj[expr];
+                };
+            } catch(e){}
+            return Ext.emptyFn;
+        };
+    }(),
+
+    /**
+     * Create a data block containing Ext.data.Records from a JSON object.
+     * @param {Object} o An object which contains an Array of row objects in the property specified
+     * in the config as 'root, and optionally a property, specified in the config as 'totalProperty'
+     * which contains the total size of the dataset.
+     * @return {Object} data A data block which is used by an Ext.data.Store object as
+     * a cache of Ext.data.Records.
+     */
+    readRecords : function(o){
+        /**
+         * After any data loads, the raw JSON data is available for further custom processing.  If no data is
+         * loaded or there is a load exception this property will be undefined.
+         * @type Object
+         */
+        this.jsonData = o;
+        if(o.metaData){
+            delete this.ef;
+            this.meta = o.metaData;
+            this.recordType = Ext.data.Record.create(o.metaData.fields);
+            this.onMetaChange(this.meta, this.recordType, o);
+        }
+        var s = this.meta, Record = this.recordType,
+            f = Record.prototype.fields, fi = f.items, fl = f.length, v;
+
+        // Generate extraction functions for the totalProperty, the root, the id, and for each field
+        this.buildExtractors();
+        var root = this.getRoot(o), c = root.length, totalRecords = c, success = true;
+        if(s.totalProperty){
+            v = parseInt(this.getTotal(o), 10);
+            if(!isNaN(v)){
+                totalRecords = v;
+            }
+        }
+        if(s.successProperty){
+            v = this.getSuccess(o);
+            if(v === false || v === 'false'){
+                success = false;
+            }
+        }
+
+        var records = [];
+        for(var i = 0; i < c; i++){
+            var n = root[i];
+            var record = new Record(this.extractValues(n, fi, fl), this.getId(n));
+            record.json = n;
+            records[i] = record;
+        }
+        return {
+            success : success,
+            records : records,
+            totalRecords : totalRecords
+        };
+    },
+
+    // private
+    buildExtractors : function() {
+        if(this.ef){
+            return;
+        }
+        var s = this.meta, Record = this.recordType,
+            f = Record.prototype.fields, fi = f.items, fl = f.length;
+
+        if(s.totalProperty) {
+            this.getTotal = this.getJsonAccessor(s.totalProperty);
+        }
+        if(s.successProperty) {
+            this.getSuccess = this.getJsonAccessor(s.successProperty);
+        }
+        this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;};
+        if (s.id || s.idProperty) {
+            var g = this.getJsonAccessor(s.id || s.idProperty);
+            this.getId = function(rec) {
+                var r = g(rec);
+                return (r === undefined || r === "") ? null : r;
+            };
+        } else {
+            this.getId = function(){return null;};
+        }
+        var ef = [];
+        for(var i = 0; i < fl; i++){
+            f = fi[i];
+            var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;
+            ef.push(this.getJsonAccessor(map));
+        }
+        this.ef = ef;
+    },
+
+    // private extractValues
+    extractValues: function(data, items, len) {
+        var f, values = {};
+        for(var j = 0; j < len; j++){
+            f = items[j];
+            var v = this.ef[j](data);
+            values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, data);
+        }
+        return values;
+    },
+
+    /**
+     * Decode a json response from server.
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]
+     * @param {Object} response
+     */
+    readResponse : function(action, response) {
+        var o = (response.responseText !== undefined) ? Ext.decode(response.responseText) : response;
+        if(!o) {
+            throw new Ext.data.JsonReader.Error('response');
+        }
+        if (Ext.isEmpty(o[this.meta.successProperty])) {
+            throw new Ext.data.JsonReader.Error('successProperty-response', this.meta.successProperty);
+        }
+        // TODO, separate empty and undefined exceptions.
+        if ((action === Ext.data.Api.actions.create || action === Ext.data.Api.actions.update)) {
+            if (Ext.isEmpty(o[this.meta.root])) {
+                throw new Ext.data.JsonReader.Error('root-emtpy', this.meta.root);
+            }
+            else if (o[this.meta.root] === undefined) {
+                throw new Ext.data.JsonReader.Error('root-undefined-response', this.meta.root);
+            }
+        }
+        // make sure extraction functions are defined.
+        this.ef = this.buildExtractors();
+        return o;
+    }
+});
+
+/**
+ * @class Ext.data.JsonReader.Error
+ * Error class for JsonReader
+ */
+Ext.data.JsonReader.Error = Ext.extend(Ext.Error, {
+    constructor : function(message, arg) {
+        this.arg = arg;
+        Ext.Error.call(this, message);
+    },
+    name : 'Ext.data.JsonReader'
+});
+Ext.apply(Ext.data.JsonReader.Error.prototype, {
+    lang: {
+        'response': "An error occurred while json-decoding your server response",
+        'successProperty-response': 'Could not locate your "successProperty" in your server response.  Please review your JsonReader config to ensure the config-property "successProperty" matches the property in your server-response.  See the JsonReader docs.',
+        'root-undefined-response': 'Could not locate your "root" property in your server response.  Please review your JsonReader config to ensure the config-property "root" matches the property your server-response.  See the JsonReader docs.',
+        'root-undefined-config': 'Your JsonReader was configured without a "root" property.  Please review your JsonReader config and make sure to define the root property.  See the JsonReader docs.',
+        'idProperty-undefined' : 'Your JsonReader was configured without an "idProperty"  Please review your JsonReader configuration and ensure the "idProperty" is set (e.g.: "id").  See the JsonReader docs.',
+        'root-emtpy': 'Data was expected to be returned by the server in the "root" property of the response.  Please review your JsonReader configuration to ensure the "root" property matches that returned in the server-response.  See JsonReader docs.'
+    }
+});
+/**
+ * @class Ext.data.ArrayReader
+ * @extends Ext.data.JsonReader
+ * <p>Data reader class to create an Array of {@link Ext.data.Record} objects from an Array.
+ * Each element of that Array represents a row of data fields. The
+ * fields are pulled into a Record object using as a subscript, the <code>mapping</code> property
+ * of the field definition if it exists, or the field's ordinal position in the definition.</p>
+ * <p>Example code:</p>
+ * <pre><code>
+var Employee = Ext.data.Record.create([
+    {name: 'name', mapping: 1},         // "mapping" only needed if an "id" field is present which
+    {name: 'occupation', mapping: 2}    // precludes using the ordinal position as the index.
+]);
+var myReader = new Ext.data.ArrayReader({
+    {@link #idIndex}: 0
+}, Employee);
+</code></pre>
+ * <p>This would consume an Array like this:</p>
+ * <pre><code>
+[ [1, 'Bill', 'Gardener'], [2, 'Ben', 'Horticulturalist'] ]
+ * </code></pre>
+ * @constructor
+ * Create a new ArrayReader
+ * @param {Object} meta Metadata configuration options.
+ * @param {Array/Object} recordType
+ * <p>Either an Array of {@link Ext.data.Field Field} definition objects (which
+ * will be passed to {@link Ext.data.Record#create}, or a {@link Ext.data.Record Record}
+ * constructor created from {@link Ext.data.Record#create}.</p>
+ */
+Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {
+    /**
+     * @cfg {String} successProperty
+     * @hide
+     */
+    /**
+     * @cfg {Number} id (optional) The subscript within row Array that provides an ID for the Record.
+     * Deprecated. Use {@link #idIndex} instead.
+     */
+    /**
+     * @cfg {Number} idIndex (optional) The subscript within row Array that provides an ID for the Record.
+     */
+    /**
+     * Create a data block containing Ext.data.Records from an Array.
+     * @param {Object} o An Array of row objects which represents the dataset.
+     * @return {Object} data A data block which is used by an Ext.data.Store object as
+     * a cache of Ext.data.Records.
+     */
+    readRecords : function(o){
+        this.arrayData = o;
+        var s = this.meta,
+            sid = s ? Ext.num(s.idIndex, s.id) : null,
+            recordType = this.recordType, 
+            fields = recordType.prototype.fields,
+            records = [],
+            v;
+
+        if(!this.getRoot) {
+            this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p) {return p;};
+            if(s.totalProperty) {
+                this.getTotal = this.getJsonAccessor(s.totalProperty);
+            }
+        }
+
+        var root = this.getRoot(o);
+
+        for(var i = 0; i < root.length; i++) {
+            var n = root[i];
+            var values = {};
+            var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);
+            for(var j = 0, jlen = fields.length; j < jlen; j++) {
+                var f = fields.items[j];
+                var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;
+                v = n[k] !== undefined ? n[k] : f.defaultValue;
+                v = f.convert(v, n);
+                values[f.name] = v;
+            }
+            var record = new recordType(values, id);
+            record.json = n;
+            records[records.length] = record;
+        }
+
+        var totalRecords = records.length;
+
+        if(s.totalProperty) {
+            v = parseInt(this.getTotal(o), 10);
+            if(!isNaN(v)) {
+                totalRecords = v;
+            }
+        }
+
+        return {
+            records : records,
+            totalRecords : totalRecords
+        };
+    }
+});/**
+ * @class Ext.data.ArrayStore
+ * @extends Ext.data.Store
+ * <p>Formerly known as "SimpleStore".</p>
+ * <p>Small helper class to make creating {@link Ext.data.Store}s from Array data easier.
+ * An ArrayStore will be automatically configured with a {@link Ext.data.ArrayReader}.</p>
+ * <p>A store configuration would be something like:<pre><code>
+var store = new Ext.data.ArrayStore({
+    // store configs
+    autoDestroy: true,
+    storeId: 'myStore',
+    // reader configs
+    idIndex: 0,  
+    fields: [
+       'company',
+       {name: 'price', type: 'float'},
+       {name: 'change', type: 'float'},
+       {name: 'pctChange', type: 'float'},
+       {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
+    ]
+});
+ * </code></pre></p>
+ * <p>This store is configured to consume a returned object of the form:<pre><code>
+var myData = [
+    ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
+    ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
+    ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
+    ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
+    ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
+];
+ * </code></pre>
+ * An object literal of this form could also be used as the {@link #data} config option.</p>
+ * <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of 
+ * <b>{@link Ext.data.ArrayReader ArrayReader}</b>.</p>
+ * @constructor
+ * @param {Object} config
+ * @xtype arraystore
+ */
+Ext.data.ArrayStore = Ext.extend(Ext.data.Store, {
+    /**
+     * @cfg {Ext.data.DataReader} reader @hide
+     */
+    constructor: function(config){
+        Ext.data.ArrayStore.superclass.constructor.call(this, Ext.apply(config, {
+            reader: new Ext.data.ArrayReader(config)
+        }));
+    },
+
+    loadData : function(data, append){
+        if(this.expandData === true){
+            var r = [];
+            for(var i = 0, len = data.length; i < len; i++){
+                r[r.length] = [data[i]];
+            }
+            data = r;
+        }
+        Ext.data.ArrayStore.superclass.loadData.call(this, data, append);
+    }
+});
+Ext.reg('arraystore', Ext.data.ArrayStore);
+
+// backwards compat
+Ext.data.SimpleStore = Ext.data.ArrayStore;
+Ext.reg('simplestore', Ext.data.SimpleStore);/**
+ * @class Ext.data.JsonStore
+ * @extends Ext.data.Store
+ * <p>Small helper class to make creating {@link Ext.data.Store}s from JSON data easier.
+ * A JsonStore will be automatically configured with a {@link Ext.data.JsonReader}.</p>
+ * <p>A store configuration would be something like:<pre><code>
+var store = new Ext.data.JsonStore({
+    // store configs
+    autoDestroy: true,
+    url: 'get-images.php',
+    storeId: 'myStore',
+    // reader configs
+    root: 'images',
+    idProperty: 'name',  
+    fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date'}]
+});
+ * </code></pre></p>
+ * <p>This store is configured to consume a returned object of the form:<pre><code>
+{
+    images: [
+        {name: 'Image one', url:'/GetImage.php?id=1', size:46.5, lastmod: new Date(2007, 10, 29)},
+        {name: 'Image Two', url:'/GetImage.php?id=2', size:43.2, lastmod: new Date(2007, 10, 30)}
+    ]
+}
+ * </code></pre>
+ * An object literal of this form could also be used as the {@link #data} config option.</p>
+ * <p><b>*Note:</b> Although not listed here, this class accepts all of the configuration options of 
+ * <b>{@link Ext.data.JsonReader JsonReader}</b>.</p>
+ * @constructor
+ * @param {Object} config
+ * @xtype jsonstore
+ */
+Ext.data.JsonStore = Ext.extend(Ext.data.Store, {
+    /**
+     * @cfg {Ext.data.DataReader} reader @hide
+     */
+    constructor: function(config){
+        Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(config, {
+            reader: new Ext.data.JsonReader(config)
+        }));
+    }
+});
+Ext.reg('jsonstore', Ext.data.JsonStore);/**
+ * @class Ext.data.XmlWriter
+ * @extends Ext.data.DataWriter
+ * DataWriter extension for writing an array or single {@link Ext.data.Record} object(s) in preparation for executing a remote CRUD action via XML.
+ */
+Ext.data.XmlWriter = Ext.extend(Ext.data.DataWriter, {
+    /**
+     * Final action of a write event.  Apply the written data-object to params.
+     * @param {String} action [Ext.data.Api.create|read|update|destroy]
+     * @param {Record[]} rs
+     * @param {Object} http params
+     * @param {Object} data object populated according to DataReader meta-data "root" and "idProperty"
+     */
+    render : function(action, rs, params, data) {
+        // no impl.
+    },
+    /**
+     * createRecord
+     * @param {Ext.data.Record} rec
+     */
+    createRecord : function(rec) {
+        // no impl
+    },
+    /**
+     * updateRecord
+     * @param {Ext.data.Record} rec
+     */
+    updateRecord : function(rec) {
+        // no impl.
+
+    },
+    /**
+     * destroyRecord
+     * @param {Ext.data.Record} rec
+     */
+    destroyRecord : function(rec) {
+        // no impl
+    }
+});/**
+ * @class Ext.data.XmlReader
+ * @extends Ext.data.DataReader
+ * <p>Data reader class to create an Array of {@link Ext.data.Record} objects from an XML document
+ * based on mappings in a provided {@link Ext.data.Record} constructor.</p>
+ * <p><b>Note</b>: that in order for the browser to parse a returned XML document, the Content-Type
+ * header in the HTTP response must be set to "text/xml" or "application/xml".</p>
+ * <p>Example code:</p>
+ * <pre><code>
+var Employee = Ext.data.Record.create([
+   {name: 'name', mapping: 'name'},     // "mapping" property not needed if it is the same as "name"
+   {name: 'occupation'}                 // This field will use "occupation" as the mapping.
+]);
+var myReader = new Ext.data.XmlReader({
+   totalRecords: "results", // The element which contains the total dataset size (optional)
+   record: "row",           // The repeated element which contains row information
+   id: "id"                 // The element within the row that provides an ID for the record (optional)
+}, Employee);
+</code></pre>
+ * <p>
+ * This would consume an XML file like this:
+ * <pre><code>
+&lt;?xml version="1.0" encoding="UTF-8"?>
+&lt;dataset>
+ &lt;results>2&lt;/results>
+ &lt;row>
+   &lt;id>1&lt;/id>
+   &lt;name>Bill&lt;/name>
+   &lt;occupation>Gardener&lt;/occupation>
+ &lt;/row>
+ &lt;row>
+   &lt;id>2&lt;/id>
+   &lt;name>Ben&lt;/name>
+   &lt;occupation>Horticulturalist&lt;/occupation>
+ &lt;/row>
+&lt;/dataset>
+</code></pre>
+ * @cfg {String} totalRecords The DomQuery path from which to retrieve the total number of records
+ * in the dataset. This is only needed if the whole dataset is not passed in one go, but is being
+ * paged from the remote server.
+ * @cfg {String} record The DomQuery path to the repeated element which contains record information.
+ * @cfg {String} success The DomQuery path to the success attribute used by forms.
+ * @cfg {String} idPath The DomQuery path relative from the record element to the element that contains
+ * a record identifier value.
+ * @constructor
+ * Create a new XmlReader.
+ * @param {Object} meta Metadata configuration options
+ * @param {Object} recordType Either an Array of field definition objects as passed to
+ * {@link Ext.data.Record#create}, or a Record constructor object created using {@link Ext.data.Record#create}.
+ */
+Ext.data.XmlReader = function(meta, recordType){
+    meta = meta || {};
+    Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields);
+};
+Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, {
+    /**
+     * This method is only used by a DataProxy which has retrieved data from a remote server.
+     * @param {Object} response The XHR object which contains the parsed XML document.  The response is expected
+     * to contain a property called <tt>responseXML</tt> which refers to an XML document object.
+     * @return {Object} records A data block which is used by an {@link Ext.data.Store} as
+     * a cache of Ext.data.Records.
+     */
+    read : function(response){
+        var doc = response.responseXML;
+        if(!doc) {
+            throw {message: "XmlReader.read: XML Document not available"};
+        }
+        return this.readRecords(doc);
+    },
+
+    /**
+     * Create a data block containing Ext.data.Records from an XML document.
+     * @param {Object} doc A parsed XML document.
+     * @return {Object} records A data block which is used by an {@link Ext.data.Store} as
+     * a cache of Ext.data.Records.
+     */
+    readRecords : function(doc){
+        /**
+         * After any data loads/reads, the raw XML Document is available for further custom processing.
+         * @type XMLDocument
+         */
+        this.xmlData = doc;
+        var root = doc.documentElement || doc;
+        var q = Ext.DomQuery;
+        var recordType = this.recordType, fields = recordType.prototype.fields;
+        var sid = this.meta.idPath || this.meta.id;
+        var totalRecords = 0, success = true;
+        if(this.meta.totalRecords){
+            totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);
+        }
+
+        if(this.meta.success){
+            var sv = q.selectValue(this.meta.success, root, true);
+            success = sv !== false && sv !== 'false';
+        }
+        var records = [];
+        var ns = q.select(this.meta.record, root);
+        for(var i = 0, len = ns.length; i < len; i++) {
+            var n = ns[i];
+            var values = {};
+            var id = sid ? q.selectValue(sid, n) : undefined;
+            for(var j = 0, jlen = fields.length; j < jlen; j++){
+                var f = fields.items[j];
+                var v = q.selectValue(Ext.value(f.mapping, f.name, true), n, f.defaultValue);
+                v = f.convert(v, n);
+                values[f.name] = v;
+            }
+            var record = new recordType(values, id);
+            record.node = n;
+            records[records.length] = record;
+        }
+
+        return {
+            success : success,
+            records : records,
+            totalRecords : totalRecords || records.length
+        };
+    },
+
+    // TODO: implement readResponse for XmlReader
+    readResponse : Ext.emptyFn
+});/**\r
+ * @class Ext.data.XmlStore\r
+ * @extends Ext.data.Store\r
+ * <p>Small helper class to make creating {@link Ext.data.Store}s from XML data easier.\r
+ * A XmlStore will be automatically configured with a {@link Ext.data.XmlReader}.</p>\r
+ * <p>A store configuration would be something like:<pre><code>\r
+var store = new Ext.data.XmlStore({\r
+    // store configs\r
+    autoDestroy: true,\r
+    storeId: 'myStore',\r
+    url: 'sheldon.xml', // automatically configures a HttpProxy\r
+    // reader configs\r
+    record: 'Item', // records will have an "Item" tag\r
+    idPath: 'ASIN',\r
+    totalRecords: '@TotalResults'\r
+    fields: [\r
+        // set up the fields mapping into the xml doc\r
+        // The first needs mapping, the others are very basic\r
+        {name: 'Author', mapping: 'ItemAttributes > Author'},\r
+        'Title', 'Manufacturer', 'ProductGroup'\r
+    ]\r
+});\r
+ * </code></pre></p>\r
+ * <p>This store is configured to consume a returned object of the form:<pre><code>\r
+&#60?xml version="1.0" encoding="UTF-8"?>\r
+&#60ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-05-15">\r
+    &#60Items>\r
+        &#60Request>\r
+            &#60IsValid>True&#60/IsValid>\r
+            &#60ItemSearchRequest>\r
+                &#60Author>Sidney Sheldon&#60/Author>\r
+                &#60SearchIndex>Books&#60/SearchIndex>\r
+            &#60/ItemSearchRequest>\r
+        &#60/Request>\r
+        &#60TotalResults>203&#60/TotalResults>\r
+        &#60TotalPages>21&#60/TotalPages>\r
+        &#60Item>\r
+            &#60ASIN>0446355453&#60/ASIN>\r
+            &#60DetailPageURL>\r
+                http://www.amazon.com/\r
+            &#60/DetailPageURL>\r
+            &#60ItemAttributes>\r
+                &#60Author>Sidney Sheldon&#60/Author>\r
+                &#60Manufacturer>Warner Books&#60/Manufacturer>\r
+                &#60ProductGroup>Book&#60/ProductGroup>\r
+                &#60Title>Master of the Game&#60/Title>\r
+            &#60/ItemAttributes>\r
+        &#60/Item>\r
+    &#60/Items>\r
+&#60/ItemSearchResponse>\r
+ * </code></pre>\r
+ * An object literal of this form could also be used as the {@link #data} config option.</p>\r
+ * <p><b>Note:</b> Although not listed here, this class accepts all of the configuration options of \r
+ * <b>{@link Ext.data.XmlReader XmlReader}</b>.</p>\r
+ * @constructor\r
+ * @param {Object} config\r
+ * @xtype xmlstore\r
+ */\r
+Ext.data.XmlStore = Ext.extend(Ext.data.Store, {\r
+    /**\r
+     * @cfg {Ext.data.DataReader} reader @hide\r
+     */\r
+    constructor: function(config){\r
+        Ext.data.XmlStore.superclass.constructor.call(this, Ext.apply(config, {\r
+            reader: new Ext.data.XmlReader(config)\r
+        }));\r
     }\r
 });\r
+Ext.reg('xmlstore', Ext.data.XmlStore);/**\r
+ * @class Ext.data.GroupingStore\r
+ * @extends Ext.data.Store\r
+ * A specialized store implementation that provides for grouping records by one of the available fields. This\r
+ * is usually used in conjunction with an {@link Ext.grid.GroupingView} to proved the data model for\r
+ * a grouped GridPanel.\r
+ * @constructor\r
+ * Creates a new GroupingStore.\r
+ * @param {Object} config A config object containing the objects needed for the Store to access data,\r
+ * and read the data into Records.\r
+ * @xtype groupingstore\r
+ */\r
+Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {\r
+    \r
+    //inherit docs\r
+    constructor: function(config){\r
+        Ext.data.GroupingStore.superclass.constructor.call(this, config);\r
+        this.applyGroupField();\r
+    },\r
+    \r
+    /**\r
+     * @cfg {String} groupField\r
+     * The field name by which to sort the store's data (defaults to '').\r
+     */\r
+    /**\r
+     * @cfg {Boolean} remoteGroup\r
+     * True if the grouping should apply on the server side, false if it is local only (defaults to false).  If the\r
+     * grouping is local, it can be applied immediately to the data.  If it is remote, then it will simply act as a\r
+     * helper, automatically sending the grouping field name as the 'groupBy' param with each XHR call.\r
+     */\r
+    remoteGroup : false,\r
+    /**\r
+     * @cfg {Boolean} groupOnSort\r
+     * True to sort the data on the grouping field when a grouping operation occurs, false to sort based on the\r
+     * existing sort info (defaults to false).\r
+     */\r
+    groupOnSort:false,\r
 \r
-Ext.dd.DragTracker = function(config){\r
-    Ext.apply(this, config);\r
-    this.addEvents(\r
-        'mousedown',\r
-        'mouseup',\r
-        'mousemove',\r
-        'dragstart',\r
-        'dragend',\r
-        'drag'\r
-    );\r
-\r
-    this.dragRegion = new Ext.lib.Region(0,0,0,0);\r
-\r
-    if(this.el){\r
-        this.initEl(this.el);\r
-    }\r
-}\r
+       groupDir : 'ASC',\r
+       \r
+    /**\r
+     * Clears any existing grouping and refreshes the data using the default sort.\r
+     */\r
+    clearGrouping : function(){\r
+        this.groupField = false;\r
+        if(this.remoteGroup){\r
+            if(this.baseParams){\r
+                delete this.baseParams.groupBy;\r
+            }\r
+            var lo = this.lastOptions;\r
+            if(lo && lo.params){\r
+                delete lo.params.groupBy;\r
+            }\r
+            this.reload();\r
+        }else{\r
+            this.applySort();\r
+            this.fireEvent('datachanged', this);\r
+        }\r
+    },\r
 \r
-Ext.extend(Ext.dd.DragTracker, Ext.util.Observable,  {\r
-    active: false,\r
-    tolerance: 5,\r
-    autoStart: false,\r
-\r
-    initEl: function(el){\r
-        this.el = Ext.get(el);\r
-        el.on('mousedown', this.onMouseDown, this,\r
-                this.delegate ? {delegate: this.delegate} : undefined);\r
+    /**\r
+     * Groups the data by the specified field.\r
+     * @param {String} field The field name by which to sort the store's data\r
+     * @param {Boolean} forceRegroup (optional) True to force the group to be refreshed even if the field passed\r
+     * in is the same as the current grouping field, false to skip grouping on the same field (defaults to false)\r
+     */\r
+    groupBy : function(field, forceRegroup, direction){\r
+               direction = direction ? (String(direction).toUpperCase() == 'DESC' ? 'DESC' : 'ASC') : this.groupDir;\r
+        if(this.groupField == field && this.groupDir == direction && !forceRegroup){\r
+            return; // already grouped by this field\r
+        }\r
+        this.groupField = field;\r
+               this.groupDir = direction;\r
+        this.applyGroupField();\r
+        if(this.groupOnSort){\r
+            this.sort(field, direction);\r
+            return;\r
+        }\r
+        if(this.remoteGroup){\r
+            this.reload();\r
+        }else{\r
+            var si = this.sortInfo || {};\r
+            if(si.field != field || si.direction != direction){\r
+                this.applySort();\r
+            }else{\r
+                this.sortData(field, direction);\r
+            }\r
+            this.fireEvent('datachanged', this);\r
+        }\r
     },\r
-\r
-    destroy : function(){\r
-        this.el.un('mousedown', this.onMouseDown, this);\r
+    \r
+    // private\r
+    applyGroupField: function(){\r
+        if(this.remoteGroup){\r
+            if(!this.baseParams){\r
+                this.baseParams = {};\r
+            }\r
+            this.baseParams.groupBy = this.groupField;\r
+            this.baseParams.groupDir = this.groupDir;\r
+        }\r
     },\r
 \r
-    onMouseDown: function(e, target){\r
-        if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){\r
-            this.startXY = this.lastXY = e.getXY();\r
-            this.dragTarget = this.delegate ? target : this.el.dom;\r
-            e.preventDefault();\r
-            var doc = Ext.getDoc();\r
-            doc.on('mouseup', this.onMouseUp, this);\r
-            doc.on('mousemove', this.onMouseMove, this);\r
-            doc.on('selectstart', this.stopSelect, this);\r
-            if(this.autoStart){\r
-                this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this);\r
+    // private\r
+    applySort : function(){\r
+        Ext.data.GroupingStore.superclass.applySort.call(this);\r
+        if(!this.groupOnSort && !this.remoteGroup){\r
+            var gs = this.getGroupState();\r
+            if(gs && (gs != this.sortInfo.field || this.groupDir != this.sortInfo.direction)){\r
+                this.sortData(this.groupField, this.groupDir);\r
             }\r
         }\r
     },\r
 \r
-    onMouseMove: function(e, target){\r
-        e.preventDefault();\r
-        var xy = e.getXY(), s = this.startXY;\r
-        this.lastXY = xy;\r
-        if(!this.active){\r
-            if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){\r
-                this.triggerStart();\r
-            }else{\r
-                return;\r
+    // private\r
+    applyGrouping : function(alwaysFireChange){\r
+        if(this.groupField !== false){\r
+            this.groupBy(this.groupField, true, this.groupDir);\r
+            return true;\r
+        }else{\r
+            if(alwaysFireChange === true){\r
+                this.fireEvent('datachanged', this);\r
             }\r
+            return false;\r
         }\r
-        this.fireEvent('mousemove', this, e);\r
-        this.onDrag(e);\r
-        this.fireEvent('drag', this, e);\r
     },\r
 \r
-    onMouseUp: function(e){\r
-        var doc = Ext.getDoc();\r
-        doc.un('mousemove', this.onMouseMove, this);\r
-        doc.un('mouseup', this.onMouseUp, this);\r
-        doc.un('selectstart', this.stopSelect, this);\r
-        e.preventDefault();\r
-        this.clearStart();\r
-        this.active = false;\r
-        delete this.elRegion;\r
-        this.fireEvent('mouseup', this, e);\r
-        this.onEnd(e);\r
-        this.fireEvent('dragend', this, e);\r
-    },\r
+    // private\r
+    getGroupState : function(){\r
+        return this.groupOnSort && this.groupField !== false ?\r
+               (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;\r
+    }\r
+});\r
+Ext.reg('groupingstore', Ext.data.GroupingStore);/**\r
+ * @class Ext.data.DirectProxy\r
+ * @extends Ext.data.DataProxy\r
+ */\r
+Ext.data.DirectProxy = function(config){\r
+    Ext.apply(this, config);\r
+    if(typeof this.paramOrder == 'string'){\r
+        this.paramOrder = this.paramOrder.split(/[\s,|]/);\r
+    }\r
+    Ext.data.DirectProxy.superclass.constructor.call(this, config);\r
+};\r
 \r
-    triggerStart: function(isTimer){\r
-        this.clearStart();\r
-        this.active = true;\r
-        this.onStart(this.startXY);\r
-        this.fireEvent('dragstart', this, this.startXY);\r
-    },\r
+Ext.extend(Ext.data.DirectProxy, Ext.data.DataProxy, {\r
+    /**\r
+     * @cfg {Array/String} paramOrder Defaults to <tt>undefined</tt>. A list of params to be executed\r
+     * server side.  Specify the params in the order in which they must be executed on the server-side\r
+     * as either (1) an Array of String values, or (2) a String of params delimited by either whitespace,\r
+     * comma, or pipe. For example,\r
+     * any of the following would be acceptable:<pre><code>\r
+paramOrder: ['param1','param2','param3']\r
+paramOrder: 'param1 param2 param3'\r
+paramOrder: 'param1,param2,param3'\r
+paramOrder: 'param1|param2|param'\r
+     </code></pre>\r
+     */\r
+    paramOrder: undefined,\r
+\r
+    /**\r
+     * @cfg {Boolean} paramsAsHash\r
+     * Send parameters as a collection of named arguments (defaults to <tt>true</tt>). Providing a\r
+     * <tt>{@link #paramOrder}</tt> nullifies this configuration.\r
+     */\r
+    paramsAsHash: true,\r
+\r
+    /**\r
+     * @cfg {Function} directFn\r
+     * Function to call when executing a request.  directFn is a simple alternative to defining the api configuration-parameter\r
+     * for Store's which will not implement a full CRUD api.\r
+     */\r
+    directFn : undefined,\r
 \r
-    clearStart : function(){\r
-        if(this.timer){\r
-            clearTimeout(this.timer);\r
-            delete this.timer;\r
+    // protected\r
+    doRequest : function(action, rs, params, reader, callback, scope, options) {\r
+        var args = [];\r
+        var directFn = this.api[action] || this.directFn;\r
+\r
+        switch (action) {\r
+            case Ext.data.Api.actions.create:\r
+                args.push(params[reader.meta.root]);           // <-- create(Hash)\r
+                break;\r
+            case Ext.data.Api.actions.read:\r
+                if(this.paramOrder){\r
+                    for(var i = 0, len = this.paramOrder.length; i < len; i++){\r
+                        args.push(params[this.paramOrder[i]]);\r
+                    }\r
+                }else if(this.paramsAsHash){\r
+                    args.push(params);\r
+                }\r
+                break;\r
+            case Ext.data.Api.actions.update:\r
+                args.push(params[reader.meta.idProperty]);  // <-- save(Integer/Integer[], Hash/Hash[])\r
+                args.push(params[reader.meta.root]);\r
+                break;\r
+            case Ext.data.Api.actions.destroy:\r
+                args.push(params[reader.meta.root]);        // <-- destroy(Int/Int[])\r
+                break;\r
         }\r
-    },\r
 \r
-    stopSelect : function(e){\r
-        e.stopEvent();\r
-        return false;\r
-    },\r
+        var trans = {\r
+            params : params || {},\r
+            callback : callback,\r
+            scope : scope,\r
+            arg : options,\r
+            reader: reader\r
+        };\r
 \r
-    onBeforeStart : function(e){\r
+        args.push(this.createCallback(action, rs, trans), this);\r
+        directFn.apply(window, args);\r
+    },\r
 \r
+    // private\r
+    createCallback : function(action, rs, trans) {\r
+        return function(result, res) {\r
+            if (!res.status) {\r
+                // @deprecated fire loadexception\r
+                if (action === Ext.data.Api.actions.read) {\r
+                    this.fireEvent("loadexception", this, trans, res, null);\r
+                }\r
+                this.fireEvent('exception', this, 'remote', action, trans, res, null);\r
+                trans.callback.call(trans.scope, null, trans.arg, false);\r
+                return;\r
+            }\r
+            if (action === Ext.data.Api.actions.read) {\r
+                this.onRead(action, trans, result, res);\r
+            } else {\r
+                this.onWrite(action, trans, result, res, rs);\r
+            }\r
+        };\r
     },\r
+    /**\r
+     * Callback for read actions\r
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]\r
+     * @param {Object} trans The request transaction object\r
+     * @param {Object} res The server response\r
+     * @private\r
+     */\r
+    onRead : function(action, trans, result, res) {\r
+        var records;\r
+        try {\r
+            records = trans.reader.readRecords(result);\r
+        }\r
+        catch (ex) {\r
+            // @deprecated: Fire old loadexception for backwards-compat.\r
+            this.fireEvent("loadexception", this, trans, res, ex);\r
 \r
-    onStart : function(xy){\r
+            this.fireEvent('exception', this, 'response', action, trans, res, ex);\r
+            trans.callback.call(trans.scope, null, trans.arg, false);\r
+            return;\r
+        }\r
+        this.fireEvent("load", this, res, trans.arg);\r
+        trans.callback.call(trans.scope, records, trans.arg, true);\r
+    },\r
+    /**\r
+     * Callback for write actions\r
+     * @param {String} action [Ext.data.Api.actions.create|read|update|destroy]\r
+     * @param {Object} trans The request transaction object\r
+     * @param {Object} res The server response\r
+     * @private\r
+     */\r
+    onWrite : function(action, trans, result, res, rs) {\r
+        this.fireEvent("write", this, action, result, res, rs, trans.arg);\r
+        trans.callback.call(trans.scope, result, res, true);\r
+    }\r
+});\r
 \r
-    },\r
+/**\r
+ * @class Ext.data.DirectStore\r
+ * @extends Ext.data.Store\r
+ * <p>Small helper class to create an {@link Ext.data.Store} configured with an\r
+ * {@link Ext.data.DirectProxy} and {@link Ext.data.JsonReader} to make interacting\r
+ * with an {@link Ext.Direct} Server-side {@link Ext.direct.Provider Provider} easier.\r
+ * To create a different proxy/reader combination create a basic {@link Ext.data.Store}\r
+ * configured as needed.</p>\r
+ *\r
+ * <p><b>*Note:</b> Although they are not listed, this class inherits all of the config options of:</p>\r
+ * <div><ul class="mdetail-params">\r
+ * <li><b>{@link Ext.data.Store Store}</b></li>\r
+ * <div class="sub-desc"><ul class="mdetail-params">\r
+ *\r
+ * </ul></div>\r
+ * <li><b>{@link Ext.data.JsonReader JsonReader}</b></li>\r
+ * <div class="sub-desc"><ul class="mdetail-params">\r
+ * <li><tt><b>{@link Ext.data.JsonReader#root root}</b></tt></li>\r
+ * <li><tt><b>{@link Ext.data.JsonReader#idProperty idProperty}</b></tt></li>\r
+ * <li><tt><b>{@link Ext.data.JsonReader#totalProperty totalProperty}</b></tt></li>\r
+ * </ul></div>\r
+ *\r
+ * <li><b>{@link Ext.data.DirectProxy DirectProxy}</b></li>\r
+ * <div class="sub-desc"><ul class="mdetail-params">\r
+ * <li><tt><b>{@link Ext.data.DirectProxy#directFn directFn}</b></tt></li>\r
+ * <li><tt><b>{@link Ext.data.DirectProxy#paramOrder paramOrder}</b></tt></li>\r
+ * <li><tt><b>{@link Ext.data.DirectProxy#paramsAsHash paramsAsHash}</b></tt></li>\r
+ * </ul></div>\r
+ * </ul></div>\r
+ *\r
+ * @xtype directstore\r
+ *\r
+ * @constructor\r
+ * @param {Object} config\r
+ */\r
+Ext.data.DirectStore = function(c){\r
+    // each transaction upon a singe record will generatie a distinct Direct transaction since Direct queues them into one Ajax request.\r
+    c.batchTransactions = false;\r
 \r
-    onDrag : function(e){\r
+    Ext.data.DirectStore.superclass.constructor.call(this, Ext.apply(c, {\r
+        proxy: (typeof(c.proxy) == 'undefined') ? new Ext.data.DirectProxy(Ext.copyTo({}, c, 'paramOrder,paramsAsHash,directFn,api')) : c.proxy,\r
+        reader: (typeof(c.reader) == 'undefined' && typeof(c.fields) == 'object') ? new Ext.data.JsonReader(Ext.copyTo({}, c, 'totalProperty,root,idProperty'), c.fields) : c.reader\r
+    }));\r
+};\r
+Ext.extend(Ext.data.DirectStore, Ext.data.Store, {});\r
+Ext.reg('directstore', Ext.data.DirectStore);
+/**\r
+ * @class Ext.Direct\r
+ * @extends Ext.util.Observable\r
+ * <p><b><u>Overview</u></b></p>\r
+ * \r
+ * <p>Ext.Direct aims to streamline communication between the client and server\r
+ * by providing a single interface that reduces the amount of common code\r
+ * typically required to validate data and handle returned data packets\r
+ * (reading data, error conditions, etc).</p>\r
+ *  \r
+ * <p>The Ext.direct namespace includes several classes for a closer integration\r
+ * with the server-side. The Ext.data namespace also includes classes for working\r
+ * with Ext.data.Stores which are backed by data from an Ext.Direct method.</p>\r
+ * \r
+ * <p><b><u>Specification</u></b></p>\r
+ * \r
+ * <p>For additional information consult the \r
+ * <a href="http://extjs.com/products/extjs/direct.php">Ext.Direct Specification</a>.</p>\r
+ *   \r
+ * <p><b><u>Providers</u></b></p>\r
+ * \r
+ * <p>Ext.Direct uses a provider architecture, where one or more providers are\r
+ * used to transport data to and from the server. There are several providers\r
+ * that exist in the core at the moment:</p><div class="mdetail-params"><ul>\r
+ * \r
+ * <li>{@link Ext.direct.JsonProvider JsonProvider} for simple JSON operations</li>\r
+ * <li>{@link Ext.direct.PollingProvider PollingProvider} for repeated requests</li>\r
+ * <li>{@link Ext.direct.RemotingProvider RemotingProvider} exposes server side\r
+ * on the client.</li>\r
+ * </ul></div>\r
+ * \r
+ * <p>A provider does not need to be invoked directly, providers are added via\r
+ * {@link Ext.Direct}.{@link Ext.Direct#add add}.</p>\r
+ * \r
+ * <p><b><u>Router</u></b></p>\r
+ * \r
+ * <p>Ext.Direct utilizes a "router" on the server to direct requests from the client\r
+ * to the appropriate server-side method. Because the Ext.Direct API is completely\r
+ * platform-agnostic, you could completely swap out a Java based server solution\r
+ * and replace it with one that uses C# without changing the client side JavaScript\r
+ * at all.</p>\r
+ * \r
+ * <p><b><u>Server side events</u></b></p>\r
+ * \r
+ * <p>Custom events from the server may be handled by the client by adding\r
+ * listeners, for example:</p>\r
+ * <pre><code>\r
+{"type":"event","name":"message","data":"Successfully polled at: 11:19:30 am"}\r
+\r
+// add a handler for a 'message' event sent by the server \r
+Ext.Direct.on('message', function(e){\r
+    out.append(String.format('&lt;p>&lt;i>{0}&lt;/i>&lt;/p>', e.data));\r
+            out.el.scrollTo('t', 100000, true);\r
+});\r
+ * </code></pre>\r
+ * @singleton\r
+ */\r
+Ext.Direct = Ext.extend(Ext.util.Observable, {\r
+    /**\r
+     * Each event type implements a getData() method. The default event types are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>event</tt></b> : Ext.Direct.Event</li>\r
+     * <li><b><tt>exception</tt></b> : Ext.Direct.ExceptionEvent</li>\r
+     * <li><b><tt>rpc</tt></b> : Ext.Direct.RemotingEvent</li>\r
+     * </ul></div>\r
+     * @property eventTypes\r
+     * @type Object\r
+     */\r
+\r
+    /**\r
+     * Four types of possible exceptions which can occur:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>Ext.Direct.exceptions.TRANSPORT</tt></b> : 'xhr'</li>\r
+     * <li><b><tt>Ext.Direct.exceptions.PARSE</tt></b> : 'parse'</li>\r
+     * <li><b><tt>Ext.Direct.exceptions.LOGIN</tt></b> : 'login'</li>\r
+     * <li><b><tt>Ext.Direct.exceptions.SERVER</tt></b> : 'exception'</li>\r
+     * </ul></div>\r
+     * @property exceptions\r
+     * @type Object\r
+     */\r
+    exceptions: {\r
+        TRANSPORT: 'xhr',\r
+        PARSE: 'parse',\r
+        LOGIN: 'login',\r
+        SERVER: 'exception'\r
+    },\r
+    \r
+    // private\r
+    constructor: function(){\r
+        this.addEvents(\r
+            /**\r
+             * @event event\r
+             * Fires after an event.\r
+             * @param {event} e The {@link Ext.Direct#eventTypes Ext.Direct.Event type} that occurred.\r
+             * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.\r
+             */\r
+            'event',\r
+            /**\r
+             * @event exception\r
+             * Fires after an event exception.\r
+             * @param {event} e The {@link Ext.Direct#eventTypes Ext.Direct.Event type} that occurred.\r
+             */\r
+            'exception'\r
+        );\r
+        this.transactions = {};\r
+        this.providers = {};\r
+    },\r
+\r
+    /**\r
+     * Adds an Ext.Direct Provider and creates the proxy or stub methods to execute server-side methods.\r
+     * If the provider is not already connected, it will auto-connect.\r
+     * <pre><code>\r
+var pollProv = new Ext.direct.PollingProvider({\r
+    url: 'php/poll2.php'\r
+}); \r
+\r
+Ext.Direct.addProvider(\r
+    {\r
+        "type":"remoting",       // create a {@link Ext.direct.RemotingProvider} \r
+        "url":"php\/router.php", // url to connect to the Ext.Direct server-side router.\r
+        "actions":{              // each property within the actions object represents a Class \r
+            "TestAction":[       // array of methods within each server side Class   \r
+            {\r
+                "name":"doEcho", // name of method\r
+                "len":1\r
+            },{\r
+                "name":"multiply",\r
+                "len":1\r
+            },{\r
+                "name":"doForm",\r
+                "formHandler":true, // handle form on server with Ext.Direct.Transaction \r
+                "len":1\r
+            }]\r
+        },\r
+        "namespace":"myApplication",// namespace to create the Remoting Provider in\r
+    },{\r
+        type: 'polling', // create a {@link Ext.direct.PollingProvider} \r
+        url:  'php/poll.php'\r
+    },\r
+    pollProv // reference to previously created instance\r
+);\r
+     * </code></pre>\r
+     * @param {Object/Array} provider Accepts either an Array of Provider descriptions (an instance\r
+     * or config object for a Provider) or any number of Provider descriptions as arguments.  Each\r
+     * Provider description instructs Ext.Direct how to create client-side stub methods.\r
+     */\r
+    addProvider : function(provider){        \r
+        var a = arguments;\r
+        if(a.length > 1){\r
+            for(var i = 0, len = a.length; i < len; i++){\r
+                this.addProvider(a[i]);\r
+            }\r
+            return;\r
+        }\r
+        \r
+        // if provider has not already been instantiated\r
+        if(!provider.events){\r
+            provider = new Ext.Direct.PROVIDERS[provider.type](provider);\r
+        }\r
+        provider.id = provider.id || Ext.id();\r
+        this.providers[provider.id] = provider;\r
 \r
-    },\r
+        provider.on('data', this.onProviderData, this);\r
+        provider.on('exception', this.onProviderException, this);\r
 \r
-    onEnd : function(e){\r
 \r
+        if(!provider.isConnected()){\r
+            provider.connect();\r
+        }\r
+\r
+        return provider;\r
     },\r
 \r
-    getDragTarget : function(){\r
-        return this.dragTarget;\r
+    /**\r
+     * Retrieve a {@link Ext.direct.Provider provider} by the\r
+     * <b><tt>{@link Ext.direct.Provider#id id}</tt></b> specified when the provider is\r
+     * {@link #addProvider added}.\r
+     * @param {String} id Unique identifier assigned to the provider when calling {@link #addProvider} \r
+     */\r
+    getProvider : function(id){\r
+        return this.providers[id];\r
     },\r
 \r
-    getDragCt : function(){\r
-        return this.el;\r
+    removeProvider : function(id){\r
+        var provider = id.id ? id : this.providers[id.id];\r
+        provider.un('data', this.onProviderData, this);\r
+        provider.un('exception', this.onProviderException, this);\r
+        delete this.providers[provider.id];\r
+        return provider;\r
     },\r
 \r
-    getXY : function(constrain){\r
-        return constrain ?\r
-               this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;\r
+    addTransaction: function(t){\r
+        this.transactions[t.tid] = t;\r
+        return t;\r
     },\r
 \r
-    getOffset : function(constrain){\r
-        var xy = this.getXY(constrain);\r
-        var s = this.startXY;\r
-        return [s[0]-xy[0], s[1]-xy[1]];\r
+    removeTransaction: function(t){\r
+        delete this.transactions[t.tid || t];\r
+        return t;\r
     },\r
 \r
-    constrainModes: {\r
-        'point' : function(xy){\r
+    getTransaction: function(tid){\r
+        return this.transactions[tid.tid || tid];\r
+    },\r
 \r
-            if(!this.elRegion){\r
-                this.elRegion = this.getDragCt().getRegion();\r
+    onProviderData : function(provider, e){\r
+        if(Ext.isArray(e)){\r
+            for(var i = 0, len = e.length; i < len; i++){\r
+                this.onProviderData(provider, e[i]);\r
             }\r
+            return;\r
+        }\r
+        if(e.name && e.name != 'event' && e.name != 'exception'){\r
+            this.fireEvent(e.name, e);\r
+        }else if(e.type == 'exception'){\r
+            this.fireEvent('exception', e);\r
+        }\r
+        this.fireEvent('event', e, provider);\r
+    },\r
 \r
-            var dr = this.dragRegion;\r
+    createEvent : function(response, extraProps){\r
+        return new Ext.Direct.eventTypes[response.type](Ext.apply(response, extraProps));\r
+    }\r
+});\r
+// overwrite impl. with static instance\r
+Ext.Direct = new Ext.Direct();\r
+\r
+Ext.Direct.TID = 1;\r
+Ext.Direct.PROVIDERS = {};/**\r
+ * @class Ext.Direct.Transaction\r
+ * @extends Object\r
+ * <p>Supporting Class for Ext.Direct (not intended to be used directly).</p>\r
+ * @constructor\r
+ * @param {Object} config\r
+ */\r
+Ext.Direct.Transaction = function(config){\r
+    Ext.apply(this, config);\r
+    this.tid = ++Ext.Direct.TID;\r
+    this.retryCount = 0;\r
+};\r
+Ext.Direct.Transaction.prototype = {\r
+    send: function(){\r
+        this.provider.queueTransaction(this);\r
+    },\r
 \r
-            dr.left = xy[0];\r
-            dr.top = xy[1];\r
-            dr.right = xy[0];\r
-            dr.bottom = xy[1];\r
+    retry: function(){\r
+        this.retryCount++;\r
+        this.send();\r
+    },\r
 \r
-            dr.constrainTo(this.elRegion);\r
+    getProvider: function(){\r
+        return this.provider;\r
+    }\r
+};Ext.Direct.Event = function(config){\r
+    Ext.apply(this, config);\r
+}\r
+Ext.Direct.Event.prototype = {\r
+    status: true,\r
+    getData: function(){\r
+        return this.data;\r
+    }\r
+};\r
 \r
-            return [dr.left, dr.top];\r
-        }\r
+Ext.Direct.RemotingEvent = Ext.extend(Ext.Direct.Event, {\r
+    type: 'rpc',\r
+    getTransaction: function(){\r
+        return this.transaction || Ext.Direct.getTransaction(this.tid);\r
     }\r
 });\r
 \r
-Ext.dd.ScrollManager = function(){\r
-    var ddm = Ext.dd.DragDropMgr;\r
-    var els = {};\r
-    var dragEl = null;\r
-    var proc = {};\r
-    \r
-    var onStop = function(e){\r
-        dragEl = null;\r
-        clearProc();\r
-    };\r
-    \r
-    var triggerRefresh = function(){\r
-        if(ddm.dragCurrent){\r
-             ddm.refreshCache(ddm.dragCurrent.groups);\r
-        }\r
-    };\r
+Ext.Direct.ExceptionEvent = Ext.extend(Ext.Direct.RemotingEvent, {\r
+    status: false,\r
+    type: 'exception'\r
+});\r
+\r
+Ext.Direct.eventTypes = {\r
+    'rpc':  Ext.Direct.RemotingEvent,\r
+    'event':  Ext.Direct.Event,\r
+    'exception':  Ext.Direct.ExceptionEvent\r
+};\r
+\r
+/**\r
+ * @class Ext.direct.Provider\r
+ * @extends Ext.util.Observable\r
+ * <p>Ext.direct.Provider is an abstract class meant to be extended.</p>\r
+ * \r
+ * <p>For example ExtJs implements the following subclasses:</p>\r
+ * <pre><code>\r
+Provider\r
+|\r
++---{@link Ext.direct.JsonProvider JsonProvider} \r
+    |\r
+    +---{@link Ext.direct.PollingProvider PollingProvider}   \r
+    |\r
+    +---{@link Ext.direct.RemotingProvider RemotingProvider}   \r
+ * </code></pre>\r
+ * @abstract\r
+ */\r
+Ext.direct.Provider = Ext.extend(Ext.util.Observable, {    \r
+    /**\r
+     * @cfg {String} id\r
+     * The unique id of the provider (defaults to an {@link Ext#id auto-assigned id}).\r
+     * You should assign an id if you need to be able to access the provider later and you do\r
+     * not have an object reference available, for example:\r
+     * <pre><code>\r
+Ext.Direct.addProvider(\r
+    {\r
+        type: 'polling',\r
+        url:  'php/poll.php',\r
+        id:   'poll-provider'\r
+    }\r
+);\r
+     \r
+var p = {@link Ext.Direct Ext.Direct}.{@link Ext.Direct#getProvider getProvider}('poll-provider');\r
+p.disconnect();\r
+     * </code></pre>\r
+     */\r
+        \r
+    /**\r
+     * @cfg {Number} priority\r
+     * Priority of the request. Lower is higher priority, <tt>0</tt> means "duplex" (always on).\r
+     * All Providers default to <tt>1</tt> except for PollingProvider which defaults to <tt>3</tt>.\r
+     */    \r
+    priority: 1,\r
+\r
+    /**\r
+     * @cfg {String} type\r
+     * <b>Required</b>, <tt>undefined</tt> by default.  The <tt>type</tt> of provider specified\r
+     * to {@link Ext.Direct Ext.Direct}.{@link Ext.Direct#addProvider addProvider} to create a\r
+     * new Provider. Acceptable values by default are:<div class="mdetail-params"><ul>\r
+     * <li><b><tt>polling</tt></b> : {@link Ext.direct.PollingProvider PollingProvider}</li>\r
+     * <li><b><tt>remoting</tt></b> : {@link Ext.direct.RemotingProvider RemotingProvider}</li>\r
+     * </ul></div>\r
+     */    \r
\r
+    // private\r
+    constructor : function(config){\r
+        Ext.apply(this, config);\r
+        this.addEvents(\r
+            /**\r
+             * @event connect\r
+             * Fires when the Provider connects to the server-side\r
+             * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.\r
+             */            \r
+            'connect',\r
+            /**\r
+             * @event disconnect\r
+             * Fires when the Provider disconnects from the server-side\r
+             * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.\r
+             */            \r
+            'disconnect',\r
+            /**\r
+             * @event data\r
+             * Fires when the Provider receives data from the server-side\r
+             * @param {Ext.direct.Provider} provider The {@link Ext.direct.Provider Provider}.\r
+             * @param {event} e The {@link Ext.Direct#eventTypes Ext.Direct.Event type} that occurred.\r
+             */            \r
+            'data',\r
+            /**\r
+             * @event exception\r
+             * Fires when the Provider receives an exception from the server-side\r
+             */                        \r
+            'exception'\r
+        );\r
+        Ext.direct.Provider.superclass.constructor.call(this, config);\r
+    },\r
+\r
+    /**\r
+     * Returns whether or not the server-side is currently connected.\r
+     * Abstract method for subclasses to implement.\r
+     */\r
+    isConnected: function(){\r
+        return false;\r
+    },\r
+\r
+    /**\r
+     * Abstract methods for subclasses to implement.\r
+     */\r
+    connect: Ext.emptyFn,\r
     \r
-    var doScroll = function(){\r
-        if(ddm.dragCurrent){\r
-            var dds = Ext.dd.ScrollManager;\r
-            var inc = proc.el.ddScrollConfig ?\r
-                      proc.el.ddScrollConfig.increment : dds.increment;\r
-            if(!dds.animate){\r
-                if(proc.el.scroll(proc.dir, inc)){\r
-                    triggerRefresh();\r
-                }\r
-            }else{\r
-                proc.el.scroll(proc.dir, inc, true, dds.animDuration, triggerRefresh);\r
+    /**\r
+     * Abstract methods for subclasses to implement.\r
+     */\r
+    disconnect: Ext.emptyFn\r
+});\r
+/**\r
+ * @class Ext.direct.JsonProvider\r
+ * @extends Ext.direct.Provider\r
+ */\r
+Ext.direct.JsonProvider = Ext.extend(Ext.direct.Provider, {\r
+    parseResponse: function(xhr){\r
+        if(!Ext.isEmpty(xhr.responseText)){\r
+            if(typeof xhr.responseText == 'object'){\r
+                return xhr.responseText;\r
             }\r
+            return Ext.decode(xhr.responseText);\r
         }\r
-    };\r
-    \r
-    var clearProc = function(){\r
-        if(proc.id){\r
-            clearInterval(proc.id);\r
-        }\r
-        proc.id = 0;\r
-        proc.el = null;\r
-        proc.dir = "";\r
-    };\r
-    \r
-    var startProc = function(el, dir){\r
-        clearProc();\r
-        proc.el = el;\r
-        proc.dir = dir;\r
-        var freq = (el.ddScrollConfig && el.ddScrollConfig.frequency) ? \r
-                el.ddScrollConfig.frequency : Ext.dd.ScrollManager.frequency;\r
-        proc.id = setInterval(doScroll, freq);\r
-    };\r
-    \r
-    var onFire = function(e, isDrop){\r
-        if(isDrop || !ddm.dragCurrent){ return; }\r
-        var dds = Ext.dd.ScrollManager;\r
-        if(!dragEl || dragEl != ddm.dragCurrent){\r
-            dragEl = ddm.dragCurrent;\r
-            // refresh regions on drag start\r
-            dds.refreshCache();\r
+        return null;\r
+    },\r
+\r
+    getEvents: function(xhr){\r
+        var data = null;\r
+        try{\r
+            data = this.parseResponse(xhr);\r
+        }catch(e){\r
+            var event = new Ext.Direct.ExceptionEvent({\r
+                data: e,\r
+                xhr: xhr,\r
+                code: Ext.Direct.exceptions.PARSE,\r
+                message: 'Error parsing json response: \n\n ' + data\r
+            })\r
+            return [event];\r
         }\r
-        \r
-        var xy = Ext.lib.Event.getXY(e);\r
-        var pt = new Ext.lib.Point(xy[0], xy[1]);\r
-        for(var id in els){\r
-            var el = els[id], r = el._region;\r
-            var c = el.ddScrollConfig ? el.ddScrollConfig : dds;\r
-            if(r && r.contains(pt) && el.isScrollable()){\r
-                if(r.bottom - pt.y <= c.vthresh){\r
-                    if(proc.el != el){\r
-                        startProc(el, "down");\r
-                    }\r
-                    return;\r
-                }else if(r.right - pt.x <= c.hthresh){\r
-                    if(proc.el != el){\r
-                        startProc(el, "left");\r
-                    }\r
-                    return;\r
-                }else if(pt.y - r.top <= c.vthresh){\r
-                    if(proc.el != el){\r
-                        startProc(el, "up");\r
-                    }\r
-                    return;\r
-                }else if(pt.x - r.left <= c.hthresh){\r
-                    if(proc.el != el){\r
-                        startProc(el, "right");\r
+        var events = [];\r
+        if(Ext.isArray(data)){\r
+            for(var i = 0, len = data.length; i < len; i++){\r
+                events.push(Ext.Direct.createEvent(data[i]));\r
+            }\r
+        }else{\r
+            events.push(Ext.Direct.createEvent(data));\r
+        }\r
+        return events;\r
+    }\r
+});/**\r
+ * @class Ext.direct.PollingProvider\r
+ * @extends Ext.direct.JsonProvider\r
+ *\r
+ * <p>Provides for repetitive polling of the server at distinct {@link #interval intervals}.\r
+ * The initial request for data originates from the client, and then is responded to by the\r
+ * server.</p>\r
+ * \r
+ * <p>All configurations for the PollingProvider should be generated by the server-side\r
+ * API portion of the Ext.Direct stack.</p>\r
+ *\r
+ * <p>An instance of PollingProvider may be created directly via the new keyword or by simply\r
+ * specifying <tt>type = 'polling'</tt>.  For example:</p>\r
+ * <pre><code>\r
+var pollA = new Ext.direct.PollingProvider({\r
+    type:'polling',\r
+    url: 'php/pollA.php',\r
+});\r
+Ext.Direct.addProvider(pollA);\r
+pollA.disconnect();\r
+\r
+Ext.Direct.addProvider(\r
+    {\r
+        type:'polling',\r
+        url: 'php/pollB.php',\r
+        id: 'pollB-provider'\r
+    }\r
+);\r
+var pollB = Ext.Direct.getProvider('pollB-provider');\r
+ * </code></pre>\r
+ */\r
+Ext.direct.PollingProvider = Ext.extend(Ext.direct.JsonProvider, {\r
+    /**\r
+     * @cfg {Number} priority\r
+     * Priority of the request (defaults to <tt>3</tt>). See {@link Ext.direct.Provider#priority}.\r
+     */\r
+    // override default priority\r
+    priority: 3,\r
+    \r
+    /**\r
+     * @cfg {Number} interval\r
+     * How often to poll the server-side in milliseconds (defaults to <tt>3000</tt> - every\r
+     * 3 seconds).\r
+     */\r
+    interval: 3000,\r
+\r
+    /**\r
+     * @cfg {Object} baseParams An object containing properties which are to be sent as parameters\r
+     * on every polling request\r
+     */\r
+    \r
+    /**\r
+     * @cfg {String/Function} url\r
+     * The url which the PollingProvider should contact with each request. This can also be\r
+     * an imported Ext.Direct method which will accept the baseParams as its only argument.\r
+     */\r
+\r
+    // private\r
+    constructor : function(config){\r
+        Ext.direct.PollingProvider.superclass.constructor.call(this, config);\r
+        this.addEvents(\r
+            /**\r
+             * @event beforepoll\r
+             * Fired immediately before a poll takes place, an event handler can return false\r
+             * in order to cancel the poll.\r
+             * @param {Ext.direct.PollingProvider}\r
+             */\r
+            'beforepoll',            \r
+            /**\r
+             * @event poll\r
+             * This event has not yet been implemented.\r
+             * @param {Ext.direct.PollingProvider}\r
+             */\r
+            'poll'\r
+        );\r
+    },\r
+\r
+    // inherited\r
+    isConnected: function(){\r
+        return !!this.pollTask;\r
+    },\r
+\r
+    /**\r
+     * Connect to the server-side and begin the polling process. To handle each\r
+     * response subscribe to the data event.\r
+     */\r
+    connect: function(){\r
+        if(this.url && !this.pollTask){\r
+            this.pollTask = Ext.TaskMgr.start({\r
+                run: function(){\r
+                    if(this.fireEvent('beforepoll', this) !== false){\r
+                        if(typeof this.url == 'function'){\r
+                            this.url(this.baseParams);\r
+                        }else{\r
+                            Ext.Ajax.request({\r
+                                url: this.url,\r
+                                callback: this.onData,\r
+                                scope: this,\r
+                                params: this.baseParams\r
+                            });\r
+                        }\r
                     }\r
-                    return;\r
-                }\r
+                },\r
+                interval: this.interval,\r
+                scope: this\r
+            });\r
+            this.fireEvent('connect', this);\r
+        }else if(!this.url){\r
+            throw 'Error initializing PollingProvider, no url configured.';\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Disconnect from the server-side and stop the polling process. The disconnect\r
+     * event will be fired on a successful disconnect.\r
+     */\r
+    disconnect: function(){\r
+        if(this.pollTask){\r
+            Ext.TaskMgr.stop(this.pollTask);\r
+            delete this.pollTask;\r
+            this.fireEvent('disconnect', this);\r
+        }\r
+    },\r
+\r
+    // private\r
+    onData: function(opt, success, xhr){\r
+        if(success){\r
+            var events = this.getEvents(xhr);\r
+            for(var i = 0, len = events.length; i < len; i++){\r
+                var e = events[i];\r
+                this.fireEvent('data', this, e);\r
             }\r
+        }else{\r
+            var e = new Ext.Direct.ExceptionEvent({\r
+                data: e,\r
+                code: Ext.Direct.exceptions.TRANSPORT,\r
+                message: 'Unable to connect to the server.',\r
+                xhr: xhr\r
+            });\r
+            this.fireEvent('data', this, e);\r
         }\r
-        clearProc();\r
-    };\r
-    \r
-    ddm.fireEvents = ddm.fireEvents.createSequence(onFire, ddm);\r
-    ddm.stopDrag = ddm.stopDrag.createSequence(onStop, ddm);\r
+    }\r
+});\r
+\r
+Ext.Direct.PROVIDERS['polling'] = Ext.direct.PollingProvider;/**\r
+ * @class Ext.direct.RemotingProvider\r
+ * @extends Ext.direct.JsonProvider\r
+ * \r
+ * <p>The {@link Ext.direct.RemotingProvider RemotingProvider} exposes access to\r
+ * server side methods on the client (a remote procedure call (RPC) type of\r
+ * connection where the client can initiate a procedure on the server).</p>\r
+ * \r
+ * <p>This allows for code to be organized in a fashion that is maintainable,\r
+ * while providing a clear path between client and server, something that is\r
+ * not always apparent when using URLs.</p>\r
+ * \r
+ * <p>To accomplish this the server-side needs to describe what classes and methods\r
+ * are available on the client-side. This configuration will typically be\r
+ * outputted by the server-side Ext.Direct stack when the API description is built.</p>\r
+ */\r
+Ext.direct.RemotingProvider = Ext.extend(Ext.direct.JsonProvider, {       \r
+    /**\r
+     * @cfg {Object} actions\r
+     * Object literal defining the server side actions and methods. For example, if\r
+     * the Provider is configured with:\r
+     * <pre><code>\r
+"actions":{ // each property within the 'actions' object represents a server side Class \r
+    "TestAction":[ // array of methods within each server side Class to be   \r
+    {              // stubbed out on client\r
+        "name":"doEcho", \r
+        "len":1            \r
+    },{\r
+        "name":"multiply",// name of method\r
+        "len":2           // The number of parameters that will be used to create an\r
+                          // array of data to send to the server side function.\r
+                          // Ensure the server sends back a Number, not a String. \r
+    },{\r
+        "name":"doForm",\r
+        "formHandler":true, // direct the client to use specialized form handling method \r
+        "len":1\r
+    }]\r
+}\r
+     * </code></pre>\r
+     * <p>Note that a Store is not required, a server method can be called at any time.\r
+     * In the following example a <b>client side</b> handler is used to call the\r
+     * server side method "multiply" in the server-side "TestAction" Class:</p>\r
+     * <pre><code>\r
+TestAction.multiply(\r
+    2, 4, // pass two arguments to server, so specify len=2\r
+    // callback function after the server is called\r
+    // result: the result returned by the server\r
+    //      e: Ext.Direct.RemotingEvent object\r
+    function(result, e){\r
+        var t = e.getTransaction();\r
+        var action = t.action; // server side Class called\r
+        var method = t.method; // server side method called\r
+        if(e.status){\r
+            var answer = Ext.encode(result); // 8\r
     \r
-    return {\r
-        \r
-        register : function(el){\r
-            if(Ext.isArray(el)){\r
-                for(var i = 0, len = el.length; i < len; i++) {\r
-                       this.register(el[i]);\r
-                }\r
-            }else{\r
-                el = Ext.get(el);\r
-                els[el.id] = el;\r
-            }\r
-        },\r
-        \r
-        \r
-        unregister : function(el){\r
-            if(Ext.isArray(el)){\r
-                for(var i = 0, len = el.length; i < len; i++) {\r
-                       this.unregister(el[i]);\r
-                }\r
-            }else{\r
-                el = Ext.get(el);\r
-                delete els[el.id];\r
-            }\r
-        },\r
-        \r
-        \r
-        vthresh : 25,\r
-        \r
-        hthresh : 25,\r
+        }else{\r
+            var msg = e.message; // failure message\r
+        }\r
+    }\r
+);\r
+     * </code></pre>\r
+     * In the example above, the server side "multiply" function will be passed two\r
+     * arguments (2 and 4).  The "multiply" method should return the value 8 which will be\r
+     * available as the <tt>result</tt> in the example above. \r
+     */\r
+    \r
+    /**\r
+     * @cfg {String/Object} namespace\r
+     * Namespace for the Remoting Provider (defaults to the browser global scope of <i>window</i>).\r
+     * Explicitly specify the namespace Object, or specify a String to have a\r
+     * {@link Ext#namespace namespace created} implicitly.\r
+     */\r
+    \r
+    /**\r
+     * @cfg {String} url\r
+     * <b>Required<b>. The url to connect to the {@link Ext.Direct} server-side router. \r
+     */\r
+    \r
+    /**\r
+     * @cfg {String} enableUrlEncode\r
+     * Specify which param will hold the arguments for the method.\r
+     * Defaults to <tt>'data'</tt>.\r
+     */\r
+    \r
+    /**\r
+     * @cfg {Number/Boolean} enableBuffer\r
+     * <p><tt>true</tt> or <tt>false</tt> to enable or disable combining of method\r
+     * calls. If a number is specified this is the amount of time in milliseconds\r
+     * to wait before sending a batched request (defaults to <tt>10</tt>).</p>\r
+     * <br><p>Calls which are received within the specified timeframe will be\r
+     * concatenated together and sent in a single request, optimizing the\r
+     * application by reducing the amount of round trips that have to be made\r
+     * to the server.</p>\r
+     */\r
+    enableBuffer: 10,\r
+    \r
+    /**\r
+     * @cfg {Number} maxRetries\r
+     * Number of times to re-attempt delivery on failure of a call.\r
+     */\r
+    maxRetries: 1,\r
+\r
+    constructor : function(config){\r
+        Ext.direct.RemotingProvider.superclass.constructor.call(this, config);\r
+        this.addEvents(\r
+            /**\r
+             * @event beforecall\r
+             * Fires immediately before the client-side sends off the RPC call.\r
+             * By returning false from an event handler you can prevent the call from\r
+             * executing.\r
+             * @param {Ext.direct.RemotingProvider} provider\r
+             * @param {Ext.Direct.Transaction} transaction\r
+             */            \r
+            'beforecall',\r
+            /**\r
+             * @event call\r
+             * Fires immediately after the request to the server-side is sent. This does\r
+             * NOT fire after the response has come back from the call.\r
+             * @param {Ext.direct.RemotingProvider} provider\r
+             * @param {Ext.Direct.Transaction} transaction\r
+             */            \r
+            'call'\r
+        );\r
+        this.namespace = (typeof this.namespace === 'string') ? Ext.ns(this.namespace) : this.namespace || window;\r
+        this.transactions = {};\r
+        this.callBuffer = [];\r
+    },\r
 \r
-        \r
-        increment : 100,\r
-        \r
-        \r
-        frequency : 500,\r
-        \r
-        \r
-        animate: true,\r
-        \r
-        \r
-        animDuration: .4,\r
-        \r
-        \r
-        refreshCache : function(){\r
-            for(var id in els){\r
-                if(typeof els[id] == 'object'){ // for people extending the object prototype\r
-                    els[id]._region = els[id].getRegion();\r
-                }\r
+    // private\r
+    initAPI : function(){\r
+        var o = this.actions;\r
+        for(var c in o){\r
+            var cls = this.namespace[c] || (this.namespace[c] = {});\r
+            var ms = o[c];\r
+            for(var i = 0, len = ms.length; i < len; i++){\r
+                var m = ms[i];\r
+                cls[m.name] = this.createMethod(c, m);\r
             }\r
         }\r
-    };\r
-}();\r
+    },\r
 \r
-Ext.dd.Registry = function(){\r
-    var elements = {}; \r
-    var handles = {}; \r
-    var autoIdSeed = 0;\r
+    // inherited\r
+    isConnected: function(){\r
+        return !!this.connected;\r
+    },\r
 \r
-    var getId = function(el, autogen){\r
-        if(typeof el == "string"){\r
-            return el;\r
+    connect: function(){\r
+        if(this.url){\r
+            this.initAPI();\r
+            this.connected = true;\r
+            this.fireEvent('connect', this);\r
+        }else if(!this.url){\r
+            throw 'Error initializing RemotingProvider, no url configured.';\r
         }\r
-        var id = el.id;\r
-        if(!id && autogen !== false){\r
-            id = "extdd-" + (++autoIdSeed);\r
-            el.id = id;\r
+    },\r
+\r
+    disconnect: function(){\r
+        if(this.connected){\r
+            this.connected = false;\r
+            this.fireEvent('disconnect', this);\r
         }\r
-        return id;\r
-    };\r
-    \r
-    return {\r
-    \r
-        register : function(el, data){\r
-            data = data || {};\r
-            if(typeof el == "string"){\r
-                el = document.getElementById(el);\r
-            }\r
-            data.ddel = el;\r
-            elements[getId(el)] = data;\r
-            if(data.isHandle !== false){\r
-                handles[data.ddel.id] = data;\r
-            }\r
-            if(data.handles){\r
-                var hs = data.handles;\r
-                for(var i = 0, len = hs.length; i < len; i++){\r
-                       handles[getId(hs[i])] = data;\r
+    },\r
+\r
+    onData: function(opt, success, xhr){\r
+        if(success){\r
+            var events = this.getEvents(xhr);\r
+            for(var i = 0, len = events.length; i < len; i++){\r
+                var e = events[i];\r
+                var t = this.getTransaction(e);\r
+                this.fireEvent('data', this, e);\r
+                if(t){\r
+                    this.doCallback(t, e, true);\r
+                    Ext.Direct.removeTransaction(t);\r
                 }\r
             }\r
-        },\r
-\r
-    \r
-        unregister : function(el){\r
-            var id = getId(el, false);\r
-            var data = elements[id];\r
-            if(data){\r
-                delete elements[id];\r
-                if(data.handles){\r
-                    var hs = data.handles;\r
-                    for(var i = 0, len = hs.length; i < len; i++){\r
-                       delete handles[getId(hs[i], false)];\r
+        }else{\r
+            var ts = [].concat(opt.ts);\r
+            for(var i = 0, len = ts.length; i < len; i++){\r
+                var t = this.getTransaction(ts[i]);\r
+                if(t && t.retryCount < this.maxRetries){\r
+                    t.retry();\r
+                }else{\r
+                    var e = new Ext.Direct.ExceptionEvent({\r
+                        data: e,\r
+                        transaction: t,\r
+                        code: Ext.Direct.exceptions.TRANSPORT,\r
+                        message: 'Unable to connect to the server.',\r
+                        xhr: xhr\r
+                    });\r
+                    this.fireEvent('data', this, e);\r
+                    if(t){\r
+                        this.doCallback(t, e, false);\r
+                        Ext.Direct.removeTransaction(t);\r
                     }\r
                 }\r
             }\r
-        },\r
+        }\r
+    },\r
 \r
-    \r
-        getHandle : function(id){\r
-            if(typeof id != "string"){ // must be element?\r
-                id = id.id;\r
+    getCallData: function(t){\r
+        return {\r
+            action: t.action,\r
+            method: t.method,\r
+            data: t.data,\r
+            type: 'rpc',\r
+            tid: t.tid\r
+        };\r
+    },\r
+\r
+    doSend : function(data){\r
+        var o = {\r
+            url: this.url,\r
+            callback: this.onData,\r
+            scope: this,\r
+            ts: data\r
+        };\r
+\r
+        // send only needed data\r
+        var callData;\r
+        if(Ext.isArray(data)){\r
+            callData = [];\r
+            for(var i = 0, len = data.length; i < len; i++){\r
+                callData.push(this.getCallData(data[i]));\r
             }\r
-            return handles[id];\r
-        },\r
+        }else{\r
+            callData = this.getCallData(data);\r
+        }\r
 \r
-    \r
-        getHandleFromEvent : function(e){\r
-            var t = Ext.lib.Event.getTarget(e);\r
-            return t ? handles[t.id] : null;\r
-        },\r
+        if(this.enableUrlEncode){\r
+            var params = {};\r
+            params[typeof this.enableUrlEncode == 'string' ? this.enableUrlEncode : 'data'] = Ext.encode(callData);\r
+            o.params = params;\r
+        }else{\r
+            o.jsonData = callData;\r
+        }\r
+        Ext.Ajax.request(o);\r
+    },\r
 \r
-    \r
-        getTarget : function(id){\r
-            if(typeof id != "string"){ // must be element?\r
-                id = id.id;\r
+    combineAndSend : function(){\r
+        var len = this.callBuffer.length;\r
+        if(len > 0){\r
+            this.doSend(len == 1 ? this.callBuffer[0] : this.callBuffer);\r
+            this.callBuffer = [];\r
+        }\r
+    },\r
+\r
+    queueTransaction: function(t){\r
+        if(t.form){\r
+            this.processForm(t);\r
+            return;\r
+        }\r
+        this.callBuffer.push(t);\r
+        if(this.enableBuffer){\r
+            if(!this.callTask){\r
+                this.callTask = new Ext.util.DelayedTask(this.combineAndSend, this);\r
             }\r
-            return elements[id];\r
-        },\r
+            this.callTask.delay(typeof this.enableBuffer == 'number' ? this.enableBuffer : 10);\r
+        }else{\r
+            this.combineAndSend();\r
+        }\r
+    },\r
 \r
-    \r
-        getTargetFromEvent : function(e){\r
-            var t = Ext.lib.Event.getTarget(e);\r
-            return t ? elements[t.id] || handles[t.id] : null;\r
+    doCall : function(c, m, args){\r
+        var data = null, hs = args[m.len], scope = args[m.len+1];\r
+\r
+        if(m.len !== 0){\r
+            data = args.slice(0, m.len);\r
         }\r
-    };\r
-}();\r
 \r
-Ext.dd.StatusProxy = function(config){\r
-    Ext.apply(this, config);\r
-    this.id = this.id || Ext.id();\r
-    this.el = new Ext.Layer({\r
-        dh: {\r
-            id: this.id, tag: "div", cls: "x-dd-drag-proxy "+this.dropNotAllowed, children: [\r
-                {tag: "div", cls: "x-dd-drop-icon"},\r
-                {tag: "div", cls: "x-dd-drag-ghost"}\r
-            ]\r
-        }, \r
-        shadow: !config || config.shadow !== false\r
-    });\r
-    this.ghost = Ext.get(this.el.dom.childNodes[1]);\r
-    this.dropStatus = this.dropNotAllowed;\r
-};\r
-\r
-Ext.dd.StatusProxy.prototype = {\r
-    \r
-    dropAllowed : "x-dd-drop-ok",\r
-    \r
-    dropNotAllowed : "x-dd-drop-nodrop",\r
+        var t = new Ext.Direct.Transaction({\r
+            provider: this,\r
+            args: args,\r
+            action: c,\r
+            method: m.name,\r
+            data: data,\r
+            cb: scope && Ext.isFunction(hs) ? hs.createDelegate(scope) : hs\r
+        });\r
 \r
-    \r
-    setStatus : function(cssClass){\r
-        cssClass = cssClass || this.dropNotAllowed;\r
-        if(this.dropStatus != cssClass){\r
-            this.el.replaceClass(this.dropStatus, cssClass);\r
-            this.dropStatus = cssClass;\r
+        if(this.fireEvent('beforecall', this, t) !== false){\r
+            Ext.Direct.addTransaction(t);\r
+            this.queueTransaction(t);\r
+            this.fireEvent('call', this, t);\r
         }\r
     },\r
 \r
-    \r
-    reset : function(clearGhost){\r
-        this.el.dom.className = "x-dd-drag-proxy " + this.dropNotAllowed;\r
-        this.dropStatus = this.dropNotAllowed;\r
-        if(clearGhost){\r
-            this.ghost.update("");\r
-        }\r
-    },\r
+    doForm : function(c, m, form, callback, scope){\r
+        var t = new Ext.Direct.Transaction({\r
+            provider: this,\r
+            action: c,\r
+            method: m.name,\r
+            args:[form, callback, scope],\r
+            cb: scope && Ext.isFunction(callback) ? callback.createDelegate(scope) : callback,\r
+            isForm: true\r
+        });\r
 \r
-    \r
-    update : function(html){\r
-        if(typeof html == "string"){\r
-            this.ghost.update(html);\r
-        }else{\r
-            this.ghost.update("");\r
-            html.style.margin = "0";\r
-            this.ghost.dom.appendChild(html);\r
-        }\r
-        var el = this.ghost.dom.firstChild; \r
-        if(el){\r
-            Ext.fly(el).setStyle(Ext.isIE ? 'styleFloat' : 'cssFloat', 'none');\r
+        if(this.fireEvent('beforecall', this, t) !== false){\r
+            Ext.Direct.addTransaction(t);\r
+            var isUpload = String(form.getAttribute("enctype")).toLowerCase() == 'multipart/form-data',\r
+                params = {\r
+                    extTID: t.tid,\r
+                    extAction: c,\r
+                    extMethod: m.name,\r
+                    extType: 'rpc',\r
+                    extUpload: String(isUpload)\r
+                };\r
+            \r
+            // change made from typeof callback check to callback.params\r
+            // to support addl param passing in DirectSubmit EAC 6/2\r
+            Ext.apply(t, {\r
+                form: Ext.getDom(form),\r
+                isUpload: isUpload,\r
+                params: callback && Ext.isObject(callback.params) ? Ext.apply(params, callback.params) : params\r
+            });\r
+            this.fireEvent('call', this, t);\r
+            this.processForm(t);\r
         }\r
     },\r
-\r
     \r
-    getEl : function(){\r
-        return this.el;\r
+    processForm: function(t){\r
+        Ext.Ajax.request({\r
+            url: this.url,\r
+            params: t.params,\r
+            callback: this.onData,\r
+            scope: this,\r
+            form: t.form,\r
+            isUpload: t.isUpload,\r
+            ts: t\r
+        });\r
     },\r
 \r
-    \r
-    getGhost : function(){\r
-        return this.ghost;\r
+    createMethod : function(c, m){\r
+        var f;\r
+        if(!m.formHandler){\r
+            f = function(){\r
+                this.doCall(c, m, Array.prototype.slice.call(arguments, 0));\r
+            }.createDelegate(this);\r
+        }else{\r
+            f = function(form, callback, scope){\r
+                this.doForm(c, m, form, callback, scope);\r
+            }.createDelegate(this);\r
+        }\r
+        f.directCfg = {\r
+            action: c,\r
+            method: m\r
+        };\r
+        return f;\r
     },\r
 \r
-    \r
-    hide : function(clear){\r
-        this.el.hide();\r
-        if(clear){\r
-            this.reset(true);\r
-        }\r
+    getTransaction: function(opt){\r
+        return opt && opt.tid ? Ext.Direct.getTransaction(opt.tid) : null;\r
     },\r
 \r
+    doCallback: function(t, e){\r
+        var fn = e.status ? 'success' : 'failure';\r
+        if(t && t.cb){\r
+            var hs = t.cb;\r
+            var result = e.result || e.data;\r
+            if(Ext.isFunction(hs)){\r
+                hs(result, e);\r
+            } else{\r
+                Ext.callback(hs[fn], hs.scope, [result, e]);\r
+                Ext.callback(hs.callback, hs.scope, [result, e]);\r
+            }\r
+        }\r
+    }\r
+});\r
+Ext.Direct.PROVIDERS['remoting'] = Ext.direct.RemotingProvider;/**\r
+ * @class Ext.Resizable\r
+ * @extends Ext.util.Observable\r
+ * <p>Applies drag handles to an element to make it resizable. The drag handles are inserted into the element \r
+ * and positioned absolute. Some elements, such as a textarea or image, don't support this. To overcome that, you can wrap\r
+ * the textarea in a div and set 'resizeChild' to true (or to the id of the element), <b>or</b> set wrap:true in your config and\r
+ * the element will be wrapped for you automatically.</p>\r
+ * <p>Here is the list of valid resize handles:</p>\r
+ * <pre>\r
+Value   Description\r
+------  -------------------\r
+ 'n'     north\r
+ 's'     south\r
+ 'e'     east\r
+ 'w'     west\r
+ 'nw'    northwest\r
+ 'sw'    southwest\r
+ 'se'    southeast\r
+ 'ne'    northeast\r
+ 'all'   all\r
+</pre>\r
+ * <p>Here's an example showing the creation of a typical Resizable:</p>\r
+ * <pre><code>\r
+var resizer = new Ext.Resizable('element-id', {\r
+    handles: 'all',\r
+    minWidth: 200,\r
+    minHeight: 100,\r
+    maxWidth: 500,\r
+    maxHeight: 400,\r
+    pinned: true\r
+});\r
+resizer.on('resize', myHandler);\r
+</code></pre>\r
+ * <p>To hide a particular handle, set its display to none in CSS, or through script:<br>\r
+ * resizer.east.setDisplayed(false);</p>\r
+ * @constructor\r
+ * Create a new resizable component\r
+ * @param {Mixed} el The id or element to resize\r
+ * @param {Object} config configuration options\r
+  */\r
+Ext.Resizable = function(el, config){\r
+    this.el = Ext.get(el);\r
     \r
-    stop : function(){\r
-        if(this.anim && this.anim.isAnimated && this.anim.isAnimated()){\r
-            this.anim.stop();\r
+    if(config && config.wrap){\r
+        config.resizeChild = this.el;\r
+        this.el = this.el.wrap(typeof config.wrap == 'object' ? config.wrap : {cls:'xresizable-wrap'});\r
+        this.el.id = this.el.dom.id = config.resizeChild.id + '-rzwrap';\r
+        this.el.setStyle('overflow', 'hidden');\r
+        this.el.setPositioning(config.resizeChild.getPositioning());\r
+        config.resizeChild.clearPositioning();\r
+        if(!config.width || !config.height){\r
+            var csize = config.resizeChild.getSize();\r
+            this.el.setSize(csize.width, csize.height);\r
         }\r
-    },\r
+        if(config.pinned && !config.adjustments){\r
+            config.adjustments = 'auto';\r
+        }\r
+    }\r
 \r
-    \r
-    show : function(){\r
-        this.el.show();\r
-    },\r
+    /**\r
+     * The proxy Element that is resized in place of the real Element during the resize operation.\r
+     * This may be queried using {@link Ext.Element#getBox} to provide the new area to resize to.\r
+     * Read only.\r
+     * @type Ext.Element.\r
+     * @property proxy\r
+     */\r
+    this.proxy = this.el.createProxy({tag: 'div', cls: 'x-resizable-proxy', id: this.el.id + '-rzproxy'}, Ext.getBody());\r
+    this.proxy.unselectable();\r
+    this.proxy.enableDisplayMode('block');\r
 \r
+    Ext.apply(this, config);\r
     \r
-    sync : function(){\r
-        this.el.sync();\r
-    },\r
-\r
+    if(this.pinned){\r
+        this.disableTrackOver = true;\r
+        this.el.addClass('x-resizable-pinned');\r
+    }\r
+    // if the element isn't positioned, make it relative\r
+    var position = this.el.getStyle('position');\r
+    if(position != 'absolute' && position != 'fixed'){\r
+        this.el.setStyle('position', 'relative');\r
+    }\r
+    if(!this.handles){ // no handles passed, must be legacy style\r
+        this.handles = 's,e,se';\r
+        if(this.multiDirectional){\r
+            this.handles += ',n,w';\r
+        }\r
+    }\r
+    if(this.handles == 'all'){\r
+        this.handles = 'n s e w ne nw se sw';\r
+    }\r
+    var hs = this.handles.split(/\s*?[,;]\s*?| /);\r
+    var ps = Ext.Resizable.positions;\r
+    for(var i = 0, len = hs.length; i < len; i++){\r
+        if(hs[i] && ps[hs[i]]){\r
+            var pos = ps[hs[i]];\r
+            this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent);\r
+        }\r
+    }\r
+    // legacy\r
+    this.corner = this.southeast;\r
     \r
-    repair : function(xy, callback, scope){\r
-        this.callback = callback;\r
-        this.scope = scope;\r
-        if(xy && this.animRepair !== false){\r
-            this.el.addClass("x-dd-drag-repair");\r
-            this.el.hideUnders(true);\r
-            this.anim = this.el.shift({\r
-                duration: this.repairDuration || .5,\r
-                easing: 'easeOut',\r
-                xy: xy,\r
-                stopFx: true,\r
-                callback: this.afterRepair,\r
-                scope: this\r
-            });\r
+    if(this.handles.indexOf('n') != -1 || this.handles.indexOf('w') != -1){\r
+        this.updateBox = true;\r
+    }   \r
+   \r
+    this.activeHandle = null;\r
+    \r
+    if(this.resizeChild){\r
+        if(typeof this.resizeChild == 'boolean'){\r
+            this.resizeChild = Ext.get(this.el.dom.firstChild, true);\r
         }else{\r
-            this.afterRepair();\r
+            this.resizeChild = Ext.get(this.resizeChild, true);\r
         }\r
-    },\r
-\r
-    // private\r
-    afterRepair : function(){\r
-        this.hide(true);\r
-        if(typeof this.callback == "function"){\r
-            this.callback.call(this.scope || this);\r
+    }\r
+    \r
+    if(this.adjustments == 'auto'){\r
+        var rc = this.resizeChild;\r
+        var hw = this.west, he = this.east, hn = this.north, hs = this.south;\r
+        if(rc && (hw || hn)){\r
+            rc.position('relative');\r
+            rc.setLeft(hw ? hw.el.getWidth() : 0);\r
+            rc.setTop(hn ? hn.el.getHeight() : 0);\r
         }\r
-        this.callback = null;\r
-        this.scope = null;\r
+        this.adjustments = [\r
+            (he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0),\r
+            (hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1 \r
+        ];\r
     }\r
-};\r
-\r
-Ext.dd.DragSource = function(el, config){\r
-    this.el = Ext.get(el);\r
-    if(!this.dragData){\r
-        this.dragData = {};\r
+    \r
+    if(this.draggable){\r
+        this.dd = this.dynamic ? \r
+            this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});\r
+        this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);\r
     }\r
     \r
-    Ext.apply(this, config);\r
+    this.addEvents(\r
+        /**\r
+         * @event beforeresize\r
+         * Fired before resize is allowed. Set {@link #enabled} to false to cancel resize.\r
+         * @param {Ext.Resizable} this\r
+         * @param {Ext.EventObject} e The mousedown event\r
+         */\r
+        'beforeresize',\r
+        /**\r
+         * @event resize\r
+         * Fired after a resize.\r
+         * @param {Ext.Resizable} this\r
+         * @param {Number} width The new width\r
+         * @param {Number} height The new height\r
+         * @param {Ext.EventObject} e The mouseup event\r
+         */\r
+        'resize'\r
+    );\r
     \r
-    if(!this.proxy){\r
-        this.proxy = new Ext.dd.StatusProxy();\r
+    if(this.width !== null && this.height !== null){\r
+        this.resizeTo(this.width, this.height);\r
+    }else{\r
+        this.updateChildSize();\r
     }\r
-    Ext.dd.DragSource.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group, \r
-          {dragElId : this.proxy.id, resizeFrame: false, isTarget: false, scroll: this.scroll === true});\r
-    \r
-    this.dragging = false;\r
+    if(Ext.isIE){\r
+        this.el.dom.style.zoom = 1;\r
+    }\r
+    Ext.Resizable.superclass.constructor.call(this);\r
 };\r
 \r
-Ext.extend(Ext.dd.DragSource, Ext.dd.DDProxy, {\r
-    \r
-    \r
-    dropAllowed : "x-dd-drop-ok",\r
-    \r
-    dropNotAllowed : "x-dd-drop-nodrop",\r
+Ext.extend(Ext.Resizable, Ext.util.Observable, {\r
 \r
-    \r
-    getDragData : function(e){\r
-        return this.dragData;\r
+    /**\r
+     * @cfg {Array/String} adjustments String 'auto' or an array [width, height] with values to be <b>added</b> to the\r
+     * resize operation's new size (defaults to <tt>[0, 0]</tt>)\r
+     */\r
+    adjustments : [0, 0],\r
+    /**\r
+     * @cfg {Boolean} animate True to animate the resize (not compatible with dynamic sizing, defaults to false)\r
+     */\r
+    animate : false,\r
+    /**\r
+     * @cfg {Mixed} constrainTo Constrain the resize to a particular element\r
+     */\r
+    /**\r
+     * @cfg {Boolean} disableTrackOver True to disable mouse tracking. This is only applied at config time. (defaults to false)\r
+     */\r
+    disableTrackOver : false,\r
+    /**\r
+     * @cfg {Boolean} draggable Convenience to initialize drag drop (defaults to false)\r
+     */\r
+    draggable: false,\r
+    /**\r
+     * @cfg {Number} duration Animation duration if animate = true (defaults to 0.35)\r
+     */\r
+    duration : 0.35,\r
+    /**\r
+     * @cfg {Boolean} dynamic True to resize the element while dragging instead of using a proxy (defaults to false)\r
+     */\r
+    dynamic : false,\r
+    /**\r
+     * @cfg {String} easing Animation easing if animate = true (defaults to <tt>'easingOutStrong'</tt>)\r
+     */\r
+    easing : 'easeOutStrong',\r
+    /**\r
+     * @cfg {Boolean} enabled False to disable resizing (defaults to true)\r
+     */\r
+    enabled : true,\r
+    /**\r
+     * @property enabled Writable. False if resizing is disabled.\r
+     * @type Boolean \r
+     */\r
+    /**\r
+     * @cfg {String} handles String consisting of the resize handles to display (defaults to undefined).\r
+     * Specify either <tt>'all'</tt> or any of <tt>'n s e w ne nw se sw'</tt>.\r
+     */\r
+    handles : false,\r
+    /**\r
+     * @cfg {Boolean} multiDirectional <b>Deprecated</b>.  Deprecated style of adding multi-direction resize handles.\r
+     */\r
+    multiDirectional : false,\r
+    /**\r
+     * @cfg {Number} height The height of the element in pixels (defaults to null)\r
+     */\r
+    height : null,\r
+    /**\r
+     * @cfg {Number} width The width of the element in pixels (defaults to null)\r
+     */\r
+    width : null,\r
+    /**\r
+     * @cfg {Number} heightIncrement The increment to snap the height resize in pixels\r
+     * (only applies if <code>{@link #dynamic}==true</code>). Defaults to <tt>0</tt>.\r
+     */\r
+    heightIncrement : 0,\r
+    /**\r
+     * @cfg {Number} widthIncrement The increment to snap the width resize in pixels\r
+     * (only applies if <code>{@link #dynamic}==true</code>). Defaults to <tt>0</tt>.\r
+     */\r
+    widthIncrement : 0,\r
+    /**\r
+     * @cfg {Number} minHeight The minimum height for the element (defaults to 5)\r
+     */\r
+    minHeight : 5,\r
+    /**\r
+     * @cfg {Number} minWidth The minimum width for the element (defaults to 5)\r
+     */\r
+    minWidth : 5,\r
+    /**\r
+     * @cfg {Number} maxHeight The maximum height for the element (defaults to 10000)\r
+     */\r
+    maxHeight : 10000,\r
+    /**\r
+     * @cfg {Number} maxWidth The maximum width for the element (defaults to 10000)\r
+     */\r
+    maxWidth : 10000,\r
+    /**\r
+     * @cfg {Number} minX The minimum x for the element (defaults to 0)\r
+     */\r
+    minX: 0,\r
+    /**\r
+     * @cfg {Number} minY The minimum x for the element (defaults to 0)\r
+     */\r
+    minY: 0,\r
+    /**\r
+     * @cfg {Boolean} pinned True to ensure that the resize handles are always visible, false to display them only when the\r
+     * user mouses over the resizable borders. This is only applied at config time. (defaults to false)\r
+     */\r
+    pinned : false,\r
+    /**\r
+     * @cfg {Boolean} preserveRatio True to preserve the original ratio between height\r
+     * and width during resize (defaults to false)\r
+     */\r
+    preserveRatio : false,\r
+    /**\r
+     * @cfg {Boolean/String/Element} resizeChild True to resize the first child, or id/element to resize (defaults to false) \r
+     */ \r
+    resizeChild : false,\r
+    /**\r
+     * @cfg {Boolean} transparent True for transparent handles. This is only applied at config time. (defaults to false)\r
+     */\r
+    transparent: false,\r
+    /**\r
+     * @cfg {Ext.lib.Region} resizeRegion Constrain the resize to a particular region\r
+     */\r
+    /**\r
+     * @cfg {Boolean} wrap True to wrap an element with a div if needed (required for textareas and images, defaults to false)\r
+     * in favor of the handles config option (defaults to false)\r
+     */\r
+\r
+    \r
+    /**\r
+     * Perform a manual resize and fires the 'resize' event.\r
+     * @param {Number} width\r
+     * @param {Number} height\r
+     */\r
+    resizeTo : function(width, height){\r
+        this.el.setSize(width, height);\r
+        this.updateChildSize();\r
+        this.fireEvent('resize', this, width, height, null);\r
     },\r
 \r
     // private\r
-    onDragEnter : function(e, id){\r
-        var target = Ext.dd.DragDropMgr.getDDById(id);\r
-        this.cachedTarget = target;\r
-        if(this.beforeDragEnter(target, e, id) !== false){\r
-            if(target.isNotifyTarget){\r
-                var status = target.notifyEnter(this, e, this.dragData);\r
-                this.proxy.setStatus(status);\r
-            }else{\r
-                this.proxy.setStatus(this.dropAllowed);\r
-            }\r
-            \r
-            if(this.afterDragEnter){\r
-                \r
-                this.afterDragEnter(target, e, id);\r
+    startSizing : function(e, handle){\r
+        this.fireEvent('beforeresize', this, e);\r
+        if(this.enabled){ // 2nd enabled check in case disabled before beforeresize handler\r
+\r
+            if(!this.overlay){\r
+                this.overlay = this.el.createProxy({tag: 'div', cls: 'x-resizable-overlay', html: '&#160;'}, Ext.getBody());\r
+                this.overlay.unselectable();\r
+                this.overlay.enableDisplayMode('block');\r
+                this.overlay.on({\r
+                    scope: this,\r
+                    mousemove: this.onMouseMove,\r
+                    mouseup: this.onMouseUp\r
+                });\r
             }\r
-        }\r
-    },\r
+            this.overlay.setStyle('cursor', handle.el.getStyle('cursor'));\r
 \r
-    \r
-    beforeDragEnter : function(target, e, id){\r
-        return true;\r
-    },\r
+            this.resizing = true;\r
+            this.startBox = this.el.getBox();\r
+            this.startPoint = e.getXY();\r
+            this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0],\r
+                            (this.startBox.y + this.startBox.height) - this.startPoint[1]];\r
 \r
-    // private\r
-    alignElWithMouse: function() {\r
-        Ext.dd.DragSource.superclass.alignElWithMouse.apply(this, arguments);\r
-        this.proxy.sync();\r
-    },\r
+            this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));\r
+            this.overlay.show();\r
 \r
-    // private\r
-    onDragOver : function(e, id){\r
-        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);\r
-        if(this.beforeDragOver(target, e, id) !== false){\r
-            if(target.isNotifyTarget){\r
-                var status = target.notifyOver(this, e, this.dragData);\r
-                this.proxy.setStatus(status);\r
+            if(this.constrainTo) {\r
+                var ct = Ext.get(this.constrainTo);\r
+                this.resizeRegion = ct.getRegion().adjust(\r
+                    ct.getFrameWidth('t'),\r
+                    ct.getFrameWidth('l'),\r
+                    -ct.getFrameWidth('b'),\r
+                    -ct.getFrameWidth('r')\r
+                );\r
             }\r
 \r
-            if(this.afterDragOver){\r
-                \r
-                this.afterDragOver(target, e, id);\r
+            this.proxy.setStyle('visibility', 'hidden'); // workaround display none\r
+            this.proxy.show();\r
+            this.proxy.setBox(this.startBox);\r
+            if(!this.dynamic){\r
+                this.proxy.setStyle('visibility', 'visible');\r
             }\r
         }\r
     },\r
 \r
-    \r
-    beforeDragOver : function(target, e, id){\r
-        return true;\r
+    // private\r
+    onMouseDown : function(handle, e){\r
+        if(this.enabled){\r
+            e.stopEvent();\r
+            this.activeHandle = handle;\r
+            this.startSizing(e, handle);\r
+        }          \r
     },\r
 \r
     // private\r
-    onDragOut : function(e, id){\r
-        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);\r
-        if(this.beforeDragOut(target, e, id) !== false){\r
-            if(target.isNotifyTarget){\r
-                target.notifyOut(this, e, this.dragData);\r
+    onMouseUp : function(e){\r
+        this.activeHandle = null;\r
+        var size = this.resizeElement();\r
+        this.resizing = false;\r
+        this.handleOut();\r
+        this.overlay.hide();\r
+        this.proxy.hide();\r
+        this.fireEvent('resize', this, size.width, size.height, e);\r
+    },\r
+\r
+    // private\r
+    updateChildSize : function(){\r
+        if(this.resizeChild){\r
+            var el = this.el;\r
+            var child = this.resizeChild;\r
+            var adj = this.adjustments;\r
+            if(el.dom.offsetWidth){\r
+                var b = el.getSize(true);\r
+                child.setSize(b.width+adj[0], b.height+adj[1]);\r
             }\r
-            this.proxy.reset();\r
-            if(this.afterDragOut){\r
-                \r
-                this.afterDragOut(target, e, id);\r
+            // Second call here for IE\r
+            // The first call enables instant resizing and\r
+            // the second call corrects scroll bars if they\r
+            // exist\r
+            if(Ext.isIE){\r
+                setTimeout(function(){\r
+                    if(el.dom.offsetWidth){\r
+                        var b = el.getSize(true);\r
+                        child.setSize(b.width+adj[0], b.height+adj[1]);\r
+                    }\r
+                }, 10);\r
             }\r
         }\r
-        this.cachedTarget = null;\r
     },\r
 \r
-    \r
-    beforeDragOut : function(target, e, id){\r
-        return true;\r
-    },\r
-    \r
     // private\r
-    onDragDrop : function(e, id){\r
-        var target = this.cachedTarget || Ext.dd.DragDropMgr.getDDById(id);\r
-        if(this.beforeDragDrop(target, e, id) !== false){\r
-            if(target.isNotifyTarget){\r
-                if(target.notifyDrop(this, e, this.dragData)){ // valid drop?\r
-                    this.onValidDrop(target, e, id);\r
-                }else{\r
-                    this.onInvalidDrop(target, e, id);\r
-                }\r
+    snap : function(value, inc, min){\r
+        if(!inc || !value){\r
+            return value;\r
+        }\r
+        var newValue = value;\r
+        var m = value % inc;\r
+        if(m > 0){\r
+            if(m > (inc/2)){\r
+                newValue = value + (inc-m);\r
             }else{\r
-                this.onValidDrop(target, e, id);\r
-            }\r
-            \r
-            if(this.afterDragDrop){\r
-                \r
-                this.afterDragDrop(target, e, id);\r
+                newValue = value - m;\r
             }\r
         }\r
-        delete this.cachedTarget;\r
+        return Math.max(min, newValue);\r
     },\r
 \r
-    \r
-    beforeDragDrop : function(target, e, id){\r
-        return true;\r
+    /**\r
+     * <p>Performs resizing of the associated Element. This method is called internally by this\r
+     * class, and should not be called by user code.</p>\r
+     * <p>If a Resizable is being used to resize an Element which encapsulates a more complex UI\r
+     * component such as a Panel, this method may be overridden by specifying an implementation\r
+     * as a config option to provide appropriate behaviour at the end of the resize operation on\r
+     * mouseup, for example resizing the Panel, and relaying the Panel's content.</p>\r
+     * <p>The new area to be resized to is available by examining the state of the {@link #proxy}\r
+     * Element. Example:\r
+<pre><code>\r
+new Ext.Panel({\r
+    title: 'Resize me',\r
+    x: 100,\r
+    y: 100,\r
+    renderTo: Ext.getBody(),\r
+    floating: true,\r
+    frame: true,\r
+    width: 400,\r
+    height: 200,\r
+    listeners: {\r
+        render: function(p) {\r
+            new Ext.Resizable(p.getEl(), {\r
+                handles: 'all',\r
+                pinned: true,\r
+                transparent: true,\r
+                resizeElement: function() {\r
+                    var box = this.proxy.getBox();\r
+                    p.updateBox(box);\r
+                    if (p.layout) {\r
+                        p.doLayout();\r
+                    }\r
+                    return box;\r
+                }\r
+           });\r
+       }\r
+    }\r
+}).show();\r
+</code></pre>\r
+     */\r
+    resizeElement : function(){\r
+        var box = this.proxy.getBox();\r
+        if(this.updateBox){\r
+            this.el.setBox(box, false, this.animate, this.duration, null, this.easing);\r
+        }else{\r
+            this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);\r
+        }\r
+        this.updateChildSize();\r
+        if(!this.dynamic){\r
+            this.proxy.hide();\r
+        }\r
+        return box;\r
     },\r
 \r
     // private\r
-    onValidDrop : function(target, e, id){\r
-        this.hideProxy();\r
-        if(this.afterValidDrop){\r
-            \r
-            this.afterValidDrop(target, e, id);\r
+    constrain : function(v, diff, m, mx){\r
+        if(v - diff < m){\r
+            diff = v - m;    \r
+        }else if(v - diff > mx){\r
+            diff = v - mx; \r
         }\r
+        return diff;                \r
     },\r
 \r
     // private\r
-    getRepairXY : function(e, data){\r
-        return this.el.getXY();  \r
-    },\r
+    onMouseMove : function(e){\r
+        if(this.enabled && this.activeHandle){\r
+            try{// try catch so if something goes wrong the user doesn't get hung\r
 \r
-    // private\r
-    onInvalidDrop : function(target, e, id){\r
-        this.beforeInvalidDrop(target, e, id);\r
-        if(this.cachedTarget){\r
-            if(this.cachedTarget.isNotifyTarget){\r
-                this.cachedTarget.notifyOut(this, e, this.dragData);\r
+            if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {\r
+                return;\r
             }\r
-            this.cacheTarget = null;\r
-        }\r
-        this.proxy.repair(this.getRepairXY(e, this.dragData), this.afterRepair, this);\r
 \r
-        if(this.afterInvalidDrop){\r
+            //var curXY = this.startPoint;\r
+            var curSize = this.curSize || this.startBox,\r
+                x = this.startBox.x, y = this.startBox.y,\r
+                ox = x, \r
+                oy = y,\r
+                w = curSize.width, \r
+                h = curSize.height,\r
+                ow = w, \r
+                oh = h,\r
+                mw = this.minWidth, \r
+                mh = this.minHeight,\r
+                mxw = this.maxWidth, \r
+                mxh = this.maxHeight,\r
+                wi = this.widthIncrement,\r
+                hi = this.heightIncrement,\r
+                eventXY = e.getXY(),\r
+                diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0])),\r
+                diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1])),\r
+                pos = this.activeHandle.position,\r
+                tw,\r
+                th;\r
             \r
-            this.afterInvalidDrop(e, id);\r
+            switch(pos){\r
+                case 'east':\r
+                    w += diffX; \r
+                    w = Math.min(Math.max(mw, w), mxw);\r
+                    break;\r
+                case 'south':\r
+                    h += diffY;\r
+                    h = Math.min(Math.max(mh, h), mxh);\r
+                    break;\r
+                case 'southeast':\r
+                    w += diffX; \r
+                    h += diffY;\r
+                    w = Math.min(Math.max(mw, w), mxw);\r
+                    h = Math.min(Math.max(mh, h), mxh);\r
+                    break;\r
+                case 'north':\r
+                    diffY = this.constrain(h, diffY, mh, mxh);\r
+                    y += diffY;\r
+                    h -= diffY;\r
+                    break;\r
+                case 'west':\r
+                    diffX = this.constrain(w, diffX, mw, mxw);\r
+                    x += diffX;\r
+                    w -= diffX;\r
+                    break;\r
+                case 'northeast':\r
+                    w += diffX; \r
+                    w = Math.min(Math.max(mw, w), mxw);\r
+                    diffY = this.constrain(h, diffY, mh, mxh);\r
+                    y += diffY;\r
+                    h -= diffY;\r
+                    break;\r
+                case 'northwest':\r
+                    diffX = this.constrain(w, diffX, mw, mxw);\r
+                    diffY = this.constrain(h, diffY, mh, mxh);\r
+                    y += diffY;\r
+                    h -= diffY;\r
+                    x += diffX;\r
+                    w -= diffX;\r
+                    break;\r
+               case 'southwest':\r
+                    diffX = this.constrain(w, diffX, mw, mxw);\r
+                    h += diffY;\r
+                    h = Math.min(Math.max(mh, h), mxh);\r
+                    x += diffX;\r
+                    w -= diffX;\r
+                    break;\r
+            }\r
+            \r
+            var sw = this.snap(w, wi, mw);\r
+            var sh = this.snap(h, hi, mh);\r
+            if(sw != w || sh != h){\r
+                switch(pos){\r
+                    case 'northeast':\r
+                        y -= sh - h;\r
+                    break;\r
+                    case 'north':\r
+                        y -= sh - h;\r
+                        break;\r
+                    case 'southwest':\r
+                        x -= sw - w;\r
+                    break;\r
+                    case 'west':\r
+                        x -= sw - w;\r
+                        break;\r
+                    case 'northwest':\r
+                        x -= sw - w;\r
+                        y -= sh - h;\r
+                    break;\r
+                }\r
+                w = sw;\r
+                h = sh;\r
+            }\r
+            \r
+            if(this.preserveRatio){\r
+                switch(pos){\r
+                    case 'southeast':\r
+                    case 'east':\r
+                        h = oh * (w/ow);\r
+                        h = Math.min(Math.max(mh, h), mxh);\r
+                        w = ow * (h/oh);\r
+                       break;\r
+                    case 'south':\r
+                        w = ow * (h/oh);\r
+                        w = Math.min(Math.max(mw, w), mxw);\r
+                        h = oh * (w/ow);\r
+                        break;\r
+                    case 'northeast':\r
+                        w = ow * (h/oh);\r
+                        w = Math.min(Math.max(mw, w), mxw);\r
+                        h = oh * (w/ow);\r
+                    break;\r
+                    case 'north':\r
+                        tw = w;\r
+                        w = ow * (h/oh);\r
+                        w = Math.min(Math.max(mw, w), mxw);\r
+                        h = oh * (w/ow);\r
+                        x += (tw - w) / 2;\r
+                        break;\r
+                    case 'southwest':\r
+                        h = oh * (w/ow);\r
+                        h = Math.min(Math.max(mh, h), mxh);\r
+                        tw = w;\r
+                        w = ow * (h/oh);\r
+                        x += tw - w;\r
+                        break;\r
+                    case 'west':\r
+                        th = h;\r
+                        h = oh * (w/ow);\r
+                        h = Math.min(Math.max(mh, h), mxh);\r
+                        y += (th - h) / 2;\r
+                        tw = w;\r
+                        w = ow * (h/oh);\r
+                        x += tw - w;\r
+                       break;\r
+                    case 'northwest':\r
+                        tw = w;\r
+                        th = h;\r
+                        h = oh * (w/ow);\r
+                        h = Math.min(Math.max(mh, h), mxh);\r
+                        w = ow * (h/oh);\r
+                        y += th - h;\r
+                        x += tw - w;\r
+                        break;\r
+                        \r
+                }\r
+            }\r
+            this.proxy.setBounds(x, y, w, h);\r
+            if(this.dynamic){\r
+                this.resizeElement();\r
+            }\r
+            }catch(ex){}\r
         }\r
     },\r
 \r
     // private\r
-    afterRepair : function(){\r
-        if(Ext.enableFx){\r
-            this.el.highlight(this.hlColor || "c3daf9");\r
+    handleOver : function(){\r
+        if(this.enabled){\r
+            this.el.addClass('x-resizable-over');\r
         }\r
-        this.dragging = false;\r
-    },\r
-\r
-    \r
-    beforeInvalidDrop : function(target, e, id){\r
-        return true;\r
     },\r
 \r
     // private\r
-    handleMouseDown : function(e){\r
-        if(this.dragging) {\r
-            return;\r
+    handleOut : function(){\r
+        if(!this.resizing){\r
+            this.el.removeClass('x-resizable-over');\r
         }\r
-        var data = this.getDragData(e);\r
-        if(data && this.onBeforeDrag(data, e) !== false){\r
-            this.dragData = data;\r
-            this.proxy.stop();\r
-            Ext.dd.DragSource.superclass.handleMouseDown.apply(this, arguments);\r
-        } \r
     },\r
-\r
     \r
-    onBeforeDrag : function(data, e){\r
-        return true;\r
+    /**\r
+     * Returns the element this component is bound to.\r
+     * @return {Ext.Element}\r
+     */\r
+    getEl : function(){\r
+        return this.el;\r
     },\r
-\r
     \r
-    onStartDrag : Ext.emptyFn,\r
-\r
-    // private override\r
-    startDrag : function(x, y){\r
-        this.proxy.reset();\r
-        this.dragging = true;\r
-        this.proxy.update("");\r
-        this.onInitDrag(x, y);\r
-        this.proxy.show();\r
-    },\r
-\r
-    // private\r
-    onInitDrag : function(x, y){\r
-        var clone = this.el.dom.cloneNode(true);\r
-        clone.id = Ext.id(); // prevent duplicate ids\r
-        this.proxy.update(clone);\r
-        this.onStartDrag(x, y);\r
-        return true;\r
+    /**\r
+     * Returns the resizeChild element (or null).\r
+     * @return {Ext.Element}\r
+     */\r
+    getResizeChild : function(){\r
+        return this.resizeChild;\r
     },\r
-\r
     \r
-    getProxy : function(){\r
-        return this.proxy;  \r
+    /**\r
+     * Destroys this resizable. If the element was wrapped and \r
+     * removeEl is not true then the element remains.\r
+     * @param {Boolean} removeEl (optional) true to remove the element from the DOM\r
+     */\r
+    destroy : function(removeEl){\r
+        Ext.destroy(this.dd, this.overlay, this.proxy);\r
+        this.overlay = null;\r
+        this.proxy = null;\r
+        \r
+        var ps = Ext.Resizable.positions;\r
+        for(var k in ps){\r
+            if(typeof ps[k] != 'function' && this[ps[k]]){\r
+                this[ps[k]].destroy();\r
+            }\r
+        }\r
+        if(removeEl){\r
+            this.el.update('');\r
+            Ext.destroy(this.el);\r
+            this.el = null;\r
+        }\r
+        this.purgeListeners();\r
     },\r
 \r
-    \r
-    hideProxy : function(){\r
-        this.proxy.hide();  \r
-        this.proxy.reset(true);\r
-        this.dragging = false;\r
-    },\r
+    syncHandleHeight : function(){\r
+        var h = this.el.getHeight(true);\r
+        if(this.west){\r
+            this.west.el.setHeight(h);\r
+        }\r
+        if(this.east){\r
+            this.east.el.setHeight(h);\r
+        }\r
+    }\r
+});\r
+\r
+// private\r
+// hash to map config positions to true positions\r
+Ext.Resizable.positions = {\r
+    n: 'north', s: 'south', e: 'east', w: 'west', se: 'southeast', sw: 'southwest', nw: 'northwest', ne: 'northeast'\r
+};\r
+\r
+// private\r
+Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){\r
+    if(!this.tpl){\r
+        // only initialize the template if resizable is used\r
+        var tpl = Ext.DomHelper.createTemplate(\r
+            {tag: 'div', cls: 'x-resizable-handle x-resizable-handle-{0}'}\r
+        );\r
+        tpl.compile();\r
+        Ext.Resizable.Handle.prototype.tpl = tpl;\r
+    }\r
+    this.position = pos;\r
+    this.rz = rz;\r
+    this.el = this.tpl.append(rz.el.dom, [this.position], true);\r
+    this.el.unselectable();\r
+    if(transparent){\r
+        this.el.setOpacity(0);\r
+    }\r
+    this.el.on('mousedown', this.onMouseDown, this);\r
+    if(!disableTrackOver){\r
+        this.el.on({\r
+            scope: this,\r
+            mouseover: this.onMouseOver,\r
+            mouseout: this.onMouseOut\r
+        });\r
+    }\r
+};\r
 \r
+// private\r
+Ext.Resizable.Handle.prototype = {\r
     // private\r
-    triggerCacheRefresh : function(){\r
-        Ext.dd.DDM.refreshCache(this.groups);\r
+    afterResize : function(rz){\r
+        // do nothing    \r
     },\r
-\r
-    // private - override to prevent hiding\r
-    b4EndDrag: function(e) {\r
+    // private\r
+    onMouseDown : function(e){\r
+        this.rz.onMouseDown(this, e);\r
     },\r
-\r
-    // private - override to prevent moving\r
-    endDrag : function(e){\r
-        this.onEndDrag(this.dragData, e);\r
+    // private\r
+    onMouseOver : function(e){\r
+        this.rz.handleOver(this, e);\r
     },\r
-\r
     // private\r
-    onEndDrag : function(data, e){\r
+    onMouseOut : function(e){\r
+        this.rz.handleOut(this, e);\r
     },\r
-    \r
-    // private - pin to cursor\r
-    autoOffset : function(x, y) {\r
-        this.setDelta(-12, -20);\r
-    }    \r
-});\r
-\r
-Ext.dd.DropTarget = function(el, config){\r
-    this.el = Ext.get(el);\r
-    \r
-    Ext.apply(this, config);\r
-    \r
-    if(this.containerScroll){\r
-        Ext.dd.ScrollManager.register(this.el);\r
+    // private\r
+    destroy : function(){\r
+        Ext.destroy(this.el);\r
+        this.el = null;\r
     }\r
-    \r
-    Ext.dd.DropTarget.superclass.constructor.call(this, this.el.dom, this.ddGroup || this.group, \r
-          {isTarget: true});\r
-\r
+};\r
+/**
+ * @class Ext.Window
+ * @extends Ext.Panel
+ * <p>A specialized panel intended for use as an application window.  Windows are floated, {@link #resizable}, and
+ * {@link #draggable} by default.  Windows can be {@link #maximizable maximized} to fill the viewport,
+ * restored to their prior size, and can be {@link #minimize}d.</p>
+ * <p>Windows can also be linked to a {@link Ext.WindowGroup} or managed by the {@link Ext.WindowMgr} to provide 
+ * grouping, activation, to front, to back and other application-specific behavior.</p>
+ * <p>By default, Windows will be rendered to document.body. To {@link #constrain} a Window to another element
+ * specify {@link Ext.Component#renderTo renderTo}.</p>
+ * <p><b>Note:</b> By default, the <code>{@link #closable close}</code> header tool <i>destroys</i> the Window resulting in
+ * destruction of any child Components. This makes the Window object, and all its descendants <b>unusable</b>. To enable
+ * re-use of a Window, use <b><code>{@link #closeAction closeAction: 'hide'}</code></b>.</p>
+ * @constructor
+ * @param {Object} config The config object
+ * @xtype window
+ */
+Ext.Window = Ext.extend(Ext.Panel, {
+    /**
+     * @cfg {Number} x
+     * The X position of the left edge of the window on initial showing. Defaults to centering the Window within
+     * the width of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
+     */
+    /**
+     * @cfg {Number} y
+     * The Y position of the top edge of the window on initial showing. Defaults to centering the Window within
+     * the height of the Window's container {@link Ext.Element Element) (The Element that the Window is rendered to).
+     */
+    /**
+     * @cfg {Boolean} modal
+     * True to make the window modal and mask everything behind it when displayed, false to display it without
+     * restricting access to other UI elements (defaults to false).
+     */
+    /**
+     * @cfg {String/Element} animateTarget
+     * Id or element from which the window should animate while opening (defaults to null with no animation).
+     */
+    /**
+     * @cfg {String} resizeHandles
+     * A valid {@link Ext.Resizable} handles config string (defaults to 'all').  Only applies when resizable = true.
+     */
+    /**
+     * @cfg {Ext.WindowGroup} manager
+     * A reference to the WindowGroup that should manage this window (defaults to {@link Ext.WindowMgr}).
+     */
+    /**
+    * @cfg {String/Number/Button} defaultButton
+    * The id / index of a button or a button instance to focus when this window received the focus.
+    */
+    /**
+    * @cfg {Function} onEsc
+    * Allows override of the built-in processing for the escape key. Default action
+    * is to close the Window (performing whatever action is specified in {@link #closeAction}.
+    * To prevent the Window closing when the escape key is pressed, specify this as
+    * Ext.emptyFn (See {@link Ext#emptyFn}).
+    */
+    /**
+     * @cfg {Boolean} collapsed
+     * True to render the window collapsed, false to render it expanded (defaults to false). Note that if 
+     * {@link #expandOnShow} is true (the default) it will override the <tt>collapsed</tt> config and the window 
+     * will always be expanded when shown.
+     */
+    /**
+     * @cfg {Boolean} maximized
+     * True to initially display the window in a maximized state. (Defaults to false).
+     */
+    
+    /**
+    * @cfg {String} baseCls
+    * The base CSS class to apply to this panel's element (defaults to 'x-window').
+    */
+    baseCls : 'x-window',
+    /**
+     * @cfg {Boolean} resizable
+     * True to allow user resizing at each edge and corner of the window, false to disable resizing (defaults to true).
+     */
+    resizable : true,
+    /**
+     * @cfg {Boolean} draggable
+     * True to allow the window to be dragged by the header bar, false to disable dragging (defaults to true).  Note
+     * that by default the window will be centered in the viewport, so if dragging is disabled the window may need
+     * to be positioned programmatically after render (e.g., myWindow.setPosition(100, 100);).
+     */
+    draggable : true,
+    /**
+     * @cfg {Boolean} closable
+     * <p>True to display the 'close' tool button and allow the user to close the window, false to
+     * hide the button and disallow closing the window (defaults to true).</p>
+     * <p>By default, when close is requested by either clicking the close button in the header
+     * or pressing ESC when the Window has focus, the {@link #close} method will be called. This
+     * will <i>{@link Ext.Component#destroy destroy}</i> the Window and its content meaning that
+     * it may not be reused.</p>
+     * <p>To make closing a Window <i>hide</i> the Window so that it may be reused, set
+     * {@link #closeAction} to 'hide'.
+     */
+    closable : true,
+    /**
+     * @cfg {String} closeAction
+     * <p>The action to take when the close header tool is clicked:
+     * <div class="mdetail-params"><ul>
+     * <li><b><code>'{@link #close}'</code></b> : <b>Default</b><div class="sub-desc">
+     * {@link #close remove} the window from the DOM and {@link Ext.Component#destroy destroy}
+     * it and all descendant Components. The window will <b>not</b> be available to be
+     * redisplayed via the {@link #show} method.
+     * </div></li>
+     * <li><b><code>'{@link #hide}'</code></b> : <div class="sub-desc">
+     * {@link #hide} the window by setting visibility to hidden and applying negative offsets.
+     * The window will be available to be redisplayed via the {@link #show} method.
+     * </div></li>
+     * </ul></div>
+     * <p><b>Note:</b> This setting does not affect the {@link #close} method
+     * which will always {@link Ext.Component#destroy destroy} the window. To
+     * programatically <i>hide</i> a window, call {@link #hide}.</p>
+     */
+    closeAction : 'close',
+    /**
+     * @cfg {Boolean} constrain
+     * True to constrain the window within its containing element, false to allow it to fall outside of its
+     * containing element. By default the window will be rendered to document.body.  To render and constrain the 
+     * window within another element specify {@link #renderTo}.
+     * (defaults to false).  Optionally the header only can be constrained using {@link #constrainHeader}.
+     */
+    constrain : false,
+    /**
+     * @cfg {Boolean} constrainHeader
+     * True to constrain the window header within its containing element (allowing the window body to fall outside 
+     * of its containing element) or false to allow the header to fall outside its containing element (defaults to 
+     * false). Optionally the entire window can be constrained using {@link #constrain}.
+     */
+    constrainHeader : false,
+    /**
+     * @cfg {Boolean} plain
+     * True to render the window body with a transparent background so that it will blend into the framing
+     * elements, false to add a lighter background color to visually highlight the body element and separate it
+     * more distinctly from the surrounding frame (defaults to false).
+     */
+    plain : false,
+    /**
+     * @cfg {Boolean} minimizable
+     * True to display the 'minimize' tool button and allow the user to minimize the window, false to hide the button
+     * and disallow minimizing the window (defaults to false).  Note that this button provides no implementation --
+     * the behavior of minimizing a window is implementation-specific, so the minimize event must be handled and a
+     * custom minimize behavior implemented for this option to be useful.
+     */
+    minimizable : false,
+    /**
+     * @cfg {Boolean} maximizable
+     * True to display the 'maximize' tool button and allow the user to maximize the window, false to hide the button
+     * and disallow maximizing the window (defaults to false).  Note that when a window is maximized, the tool button
+     * will automatically change to a 'restore' button with the appropriate behavior already built-in that will
+     * restore the window to its previous size.
+     */
+    maximizable : false,
+    /**
+     * @cfg {Number} minHeight
+     * The minimum height in pixels allowed for this window (defaults to 100).  Only applies when resizable = true.
+     */
+    minHeight : 100,
+    /**
+     * @cfg {Number} minWidth
+     * The minimum width in pixels allowed for this window (defaults to 200).  Only applies when resizable = true.
+     */
+    minWidth : 200,
+    /**
+     * @cfg {Boolean} expandOnShow
+     * True to always expand the window when it is displayed, false to keep it in its current state (which may be
+     * {@link #collapsed}) when displayed (defaults to true).
+     */
+    expandOnShow : true,
+
+    // inherited docs, same default
+    collapsible : false,
+
+    /**
+     * @cfg {Boolean} initHidden
+     * True to hide the window until show() is explicitly called (defaults to true).
+     */
+    initHidden : true,
+    /**
+    * @cfg {Boolean} monitorResize @hide
+    * This is automatically managed based on the value of constrain and constrainToHeader
+    */
+    monitorResize : true,
+
+    // The following configs are set to provide the basic functionality of a window.
+    // Changing them would require additional code to handle correctly and should
+    // usually only be done in subclasses that can provide custom behavior.  Changing them
+    // may have unexpected or undesirable results.
+    /** @cfg {String} elements @hide */
+    elements : 'header,body',
+    /** @cfg {Boolean} frame @hide */
+    frame : true,
+    /** @cfg {Boolean} floating @hide */
+    floating : true,
+
+    // private
+    initComponent : function(){
+        Ext.Window.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event activate
+             * Fires after the window has been visually activated via {@link setActive}.
+             * @param {Ext.Window} this
+             */
+            /**
+             * @event deactivate
+             * Fires after the window has been visually deactivated via {@link setActive}.
+             * @param {Ext.Window} this
+             */
+            /**
+             * @event resize
+             * Fires after the window has been resized.
+             * @param {Ext.Window} this
+             * @param {Number} width The window's new width
+             * @param {Number} height The window's new height
+             */
+            'resize',
+            /**
+             * @event maximize
+             * Fires after the window has been maximized.
+             * @param {Ext.Window} this
+             */
+            'maximize',
+            /**
+             * @event minimize
+             * Fires after the window has been minimized.
+             * @param {Ext.Window} this
+             */
+            'minimize',
+            /**
+             * @event restore
+             * Fires after the window has been restored to its original size after being maximized.
+             * @param {Ext.Window} this
+             */
+            'restore'
+        );
+        if(this.initHidden === false){
+            this.show();
+        }else{
+            this.hidden = true;
+        }
+    },
+
+    // private
+    getState : function(){
+        return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox(true));
+    },
+
+    // private
+    onRender : function(ct, position){
+        Ext.Window.superclass.onRender.call(this, ct, position);
+
+        if(this.plain){
+            this.el.addClass('x-window-plain');
+        }
+
+        // this element allows the Window to be focused for keyboard events
+        this.focusEl = this.el.createChild({
+                    tag: 'a', href:'#', cls:'x-dlg-focus',
+                    tabIndex:'-1', html: '&#160;'});
+        this.focusEl.swallowEvent('click', true);
+
+        this.proxy = this.el.createProxy('x-window-proxy');
+        this.proxy.enableDisplayMode('block');
+
+        if(this.modal){
+            this.mask = this.container.createChild({cls:'ext-el-mask'}, this.el.dom);
+            this.mask.enableDisplayMode('block');
+            this.mask.hide();
+            this.mon(this.mask, 'click', this.focus, this);
+        }
+        this.initTools();
+    },
+
+    // private
+    initEvents : function(){
+        Ext.Window.superclass.initEvents.call(this);
+        if(this.animateTarget){
+            this.setAnimateTarget(this.animateTarget);
+        }
+
+        if(this.resizable){
+            this.resizer = new Ext.Resizable(this.el, {
+                minWidth: this.minWidth,
+                minHeight:this.minHeight,
+                handles: this.resizeHandles || 'all',
+                pinned: true,
+                resizeElement : this.resizerAction
+            });
+            this.resizer.window = this;
+            this.mon(this.resizer, 'beforeresize', this.beforeResize, this);
+        }
+
+        if(this.draggable){
+            this.header.addClass('x-window-draggable');
+        }
+        this.mon(this.el, 'mousedown', this.toFront, this);
+        this.manager = this.manager || Ext.WindowMgr;
+        this.manager.register(this);
+        if(this.maximized){
+            this.maximized = false;
+            this.maximize();
+        }
+        if(this.closable){
+            var km = this.getKeyMap();
+            km.on(27, this.onEsc, this);
+            km.disable();
+        }
+    },
+
+    initDraggable : function(){
+        /**
+         * If this Window is configured {@link #draggable}, this property will contain
+         * an instance of {@link Ext.dd.DD} which handles dragging the Window's DOM Element.
+         * @type Ext.dd.DD
+         * @property dd
+         */
+        this.dd = new Ext.Window.DD(this);
+    },
+
+   // private
+    onEsc : function(){
+        this[this.closeAction]();
+    },
+
+    // private
+    beforeDestroy : function(){
+        if (this.rendered){
+            this.hide();
+          if(this.doAnchor){
+                Ext.EventManager.removeResizeListener(this.doAnchor, this);
+              Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
+            }
+            Ext.destroy(
+                this.focusEl,
+                this.resizer,
+                this.dd,
+                this.proxy,
+                this.mask
+            );
+        }
+        Ext.Window.superclass.beforeDestroy.call(this);
+    },
+
+    // private
+    onDestroy : function(){
+        if(this.manager){
+            this.manager.unregister(this);
+        }
+        Ext.Window.superclass.onDestroy.call(this);
+    },
+
+    // private
+    initTools : function(){
+        if(this.minimizable){
+            this.addTool({
+                id: 'minimize',
+                handler: this.minimize.createDelegate(this, [])
+            });
+        }
+        if(this.maximizable){
+            this.addTool({
+                id: 'maximize',
+                handler: this.maximize.createDelegate(this, [])
+            });
+            this.addTool({
+                id: 'restore',
+                handler: this.restore.createDelegate(this, []),
+                hidden:true
+            });
+            this.mon(this.header, 'dblclick', this.toggleMaximize, this);
+        }
+        if(this.closable){
+            this.addTool({
+                id: 'close',
+                handler: this[this.closeAction].createDelegate(this, [])
+            });
+        }
+    },
+
+    // private
+    resizerAction : function(){
+        var box = this.proxy.getBox();
+        this.proxy.hide();
+        this.window.handleResize(box);
+        return box;
+    },
+
+    // private
+    beforeResize : function(){
+        this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); // 40 is a magic minimum content size?
+        this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);
+        this.resizeBox = this.el.getBox();
+    },
+
+    // private
+    updateHandles : function(){
+        if(Ext.isIE && this.resizer){
+            this.resizer.syncHandleHeight();
+            this.el.repaint();
+        }
+    },
+
+    // private
+    handleResize : function(box){
+        var rz = this.resizeBox;
+        if(rz.x != box.x || rz.y != box.y){
+            this.updateBox(box);
+        }else{
+            this.setSize(box);
+        }
+        this.focus();
+        this.updateHandles();
+        this.saveState();
+        this.doLayout();
+        this.fireEvent('resize', this, box.width, box.height);
+    },
+
+    /**
+     * Focuses the window.  If a defaultButton is set, it will receive focus, otherwise the
+     * window itself will receive focus.
+     */
+    focus : function(){
+        var f = this.focusEl, db = this.defaultButton, t = typeof db;
+        if(t != 'undefined'){
+            if(t == 'number' && this.fbar){
+                f = this.fbar.items.get(db);
+            }else if(t == 'string'){
+                f = Ext.getCmp(db);
+            }else{
+                f = db;
+            }
+        }
+        f = f || this.focusEl;
+        f.focus.defer(10, f);
+    },
+
+    /**
+     * Sets the target element from which the window should animate while opening.
+     * @param {String/Element} el The target element or id
+     */
+    setAnimateTarget : function(el){
+        el = Ext.get(el);
+        this.animateTarget = el;
+    },
+
+    // private
+    beforeShow : function(){
+        delete this.el.lastXY;
+        delete this.el.lastLT;
+        if(this.x === undefined || this.y === undefined){
+            var xy = this.el.getAlignToXY(this.container, 'c-c');
+            var pos = this.el.translatePoints(xy[0], xy[1]);
+            this.x = this.x === undefined? pos.left : this.x;
+            this.y = this.y === undefined? pos.top : this.y;
+        }
+        this.el.setLeftTop(this.x, this.y);
+
+        if(this.expandOnShow){
+            this.expand(false);
+        }
+
+        if(this.modal){
+            Ext.getBody().addClass('x-body-masked');
+            this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
+            this.mask.show();
+        }
+    },
+
+    /**
+     * Shows the window, rendering it first if necessary, or activates it and brings it to front if hidden.
+     * @param {String/Element} animateTarget (optional) The target element or id from which the window should
+     * animate while opening (defaults to null with no animation)
+     * @param {Function} callback (optional) A callback function to call after the window is displayed
+     * @param {Object} scope (optional) The scope in which to execute the callback
+     * @return {Ext.Window} this
+     */
+    show : function(animateTarget, cb, scope){
+        if(!this.rendered){
+            this.render(Ext.getBody());
+        }
+        if(this.hidden === false){
+            this.toFront();
+            return this;
+        }
+        if(this.fireEvent('beforeshow', this) === false){
+            return this;
+        }
+        if(cb){
+            this.on('show', cb, scope, {single:true});
+        }
+        this.hidden = false;
+        if(animateTarget !== undefined){
+            this.setAnimateTarget(animateTarget);
+        }
+        this.beforeShow();
+        if(this.animateTarget){
+            this.animShow();
+        }else{
+            this.afterShow();
+        }
+        return this;
+    },
+
+    // private
+    afterShow : function(isAnim){
+        this.proxy.hide();
+        this.el.setStyle('display', 'block');
+        this.el.show();
+        if(this.maximized){
+            this.fitContainer();
+        }
+        if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug
+            this.cascade(this.setAutoScroll);
+        }
+
+        if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
+            Ext.EventManager.onWindowResize(this.onWindowResize, this);
+        }
+        this.doConstrain();
+        this.doLayout();
+        if(this.keyMap){
+            this.keyMap.enable();
+        }
+        this.toFront();
+        this.updateHandles();
+        if(isAnim && (Ext.isIE || Ext.isWebKit)){
+            var sz = this.getSize();
+            this.onResize(sz.width, sz.height);
+        }
+        this.fireEvent('show', this);
+    },
+
+    // private
+    animShow : function(){
+        this.proxy.show();
+        this.proxy.setBox(this.animateTarget.getBox());
+        this.proxy.setOpacity(0);
+        var b = this.getBox(false);
+        b.callback = this.afterShow.createDelegate(this, [true], false);
+        b.scope = this;
+        b.duration = 0.25;
+        b.easing = 'easeNone';
+        b.opacity = 0.5;
+        b.block = true;
+        this.el.setStyle('display', 'none');
+        this.proxy.shift(b);
+    },
+
+    /**
+     * Hides the window, setting it to invisible and applying negative offsets.
+     * @param {String/Element} animateTarget (optional) The target element or id to which the window should
+     * animate while hiding (defaults to null with no animation)
+     * @param {Function} callback (optional) A callback function to call after the window is hidden
+     * @param {Object} scope (optional) The scope in which to execute the callback
+     * @return {Ext.Window} this
+     */
+    hide : function(animateTarget, cb, scope){
+        if(this.hidden || this.fireEvent('beforehide', this) === false){
+            return this;
+        }
+        if(cb){
+            this.on('hide', cb, scope, {single:true});
+        }
+        this.hidden = true;
+        if(animateTarget !== undefined){
+            this.setAnimateTarget(animateTarget);
+        }
+        if(this.modal){
+            this.mask.hide();
+            Ext.getBody().removeClass('x-body-masked');
+        }
+        if(this.animateTarget){
+            this.animHide();
+        }else{
+            this.el.hide();
+            this.afterHide();
+        }
+        return this;
+    },
+
+    // private
+    afterHide : function(){
+        this.proxy.hide();
+        if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){
+            Ext.EventManager.removeResizeListener(this.onWindowResize, this);
+        }
+        if(this.keyMap){
+            this.keyMap.disable();
+        }
+        this.fireEvent('hide', this);
+    },
+
+    // private
+    animHide : function(){
+        this.proxy.setOpacity(0.5);
+        this.proxy.show();
+        var tb = this.getBox(false);
+        this.proxy.setBox(tb);
+        this.el.hide();
+        var b = this.animateTarget.getBox();
+        b.callback = this.afterHide;
+        b.scope = this;
+        b.duration = 0.25;
+        b.easing = 'easeNone';
+        b.block = true;
+        b.opacity = 0;
+        this.proxy.shift(b);
+    },
+
+    // private
+    onWindowResize : function(){
+        if(this.maximized){
+            this.fitContainer();
+        }
+        if(this.modal){
+            this.mask.setSize('100%', '100%');
+            var force = this.mask.dom.offsetHeight;
+            this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));
+        }
+        this.doConstrain();
+    },
+
+    // private
+    doConstrain : function(){
+        if(this.constrain || this.constrainHeader){
+            var offsets;
+            if(this.constrain){
+                offsets = {
+                    right:this.el.shadowOffset,
+                    left:this.el.shadowOffset,
+                    bottom:this.el.shadowOffset
+                };
+            }else {
+                var s = this.getSize();
+                offsets = {
+                    right:-(s.width - 100),
+                    bottom:-(s.height - 25)
+                };
+            }
+
+            var xy = this.el.getConstrainToXY(this.container, true, offsets);
+            if(xy){
+                this.setPosition(xy[0], xy[1]);
+            }
+        }
+    },
+
+    // private - used for dragging
+    ghost : function(cls){
+        var ghost = this.createGhost(cls);
+        var box = this.getBox(true);
+        ghost.setLeftTop(box.x, box.y);
+        ghost.setWidth(box.width);
+        this.el.hide();
+        this.activeGhost = ghost;
+        return ghost;
+    },
+
+    // private
+    unghost : function(show, matchPosition){
+        if(!this.activeGhost) {
+            return;
+        }
+        if(show !== false){
+            this.el.show();
+            this.focus();
+            if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug
+                this.cascade(this.setAutoScroll);
+            }
+        }
+        if(matchPosition !== false){
+            this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));
+        }
+        this.activeGhost.hide();
+        this.activeGhost.remove();
+        delete this.activeGhost;
+    },
+
+    /**
+     * Placeholder method for minimizing the window.  By default, this method simply fires the {@link #minimize} event
+     * since the behavior of minimizing a window is application-specific.  To implement custom minimize behavior,
+     * either the minimize event can be handled or this method can be overridden.
+     * @return {Ext.Window} this
+     */
+    minimize : function(){
+        this.fireEvent('minimize', this);
+        return this;
+    },
+
+    /**
+     * <p>Closes the Window, removes it from the DOM, {@link Ext.Component#destroy destroy}s
+     * the Window object and all its descendant Components. The {@link Ext.Panel#beforeclose beforeclose}
+     * event is fired before the close happens and will cancel the close action if it returns false.<p>
+     * <p><b>Note:</b> This method is not affected by the {@link #closeAction} setting which
+     * only affects the action triggered when clicking the {@link #closable 'close' tool in the header}.
+     * To hide the Window without destroying it, call {@link #hide}.</p>
+     */
+    close : function(){
+        if(this.fireEvent('beforeclose', this) !== false){
+            this.hide(null, function(){
+                this.fireEvent('close', this);
+                this.destroy();
+            }, this);
+        }
+    },
+
+    /**
+     * Fits the window within its current container and automatically replaces
+     * the {@link #maximizable 'maximize' tool button} with the 'restore' tool button.
+     * Also see {@link #toggleMaximize}.
+     * @return {Ext.Window} this
+     */
+    maximize : function(){
+        if(!this.maximized){
+            this.expand(false);
+            this.restoreSize = this.getSize();
+            this.restorePos = this.getPosition(true);
+            if (this.maximizable){
+                this.tools.maximize.hide();
+                this.tools.restore.show();
+            }
+            this.maximized = true;
+            this.el.disableShadow();
+
+            if(this.dd){
+                this.dd.lock();
+            }
+            if(this.collapsible){
+                this.tools.toggle.hide();
+            }
+            this.el.addClass('x-window-maximized');
+            this.container.addClass('x-window-maximized-ct');
+
+            this.setPosition(0, 0);
+            this.fitContainer();
+            this.fireEvent('maximize', this);
+        }
+        return this;
+    },
+
+    /**
+     * Restores a {@link #maximizable maximized}  window back to its original
+     * size and position prior to being maximized and also replaces
+     * the 'restore' tool button with the 'maximize' tool button.
+     * Also see {@link #toggleMaximize}.
+     * @return {Ext.Window} this
+     */
+    restore : function(){
+        if(this.maximized){
+            this.el.removeClass('x-window-maximized');
+            this.tools.restore.hide();
+            this.tools.maximize.show();
+            this.setPosition(this.restorePos[0], this.restorePos[1]);
+            this.setSize(this.restoreSize.width, this.restoreSize.height);
+            delete this.restorePos;
+            delete this.restoreSize;
+            this.maximized = false;
+            this.el.enableShadow(true);
+
+            if(this.dd){
+                this.dd.unlock();
+            }
+            if(this.collapsible){
+                this.tools.toggle.show();
+            }
+            this.container.removeClass('x-window-maximized-ct');
+
+            this.doConstrain();
+            this.fireEvent('restore', this);
+        }
+        return this;
+    },
+
+    /**
+     * A shortcut method for toggling between {@link #maximize} and {@link #restore} based on the current maximized
+     * state of the window.
+     * @return {Ext.Window} this
+     */
+    toggleMaximize : function(){
+        return this[this.maximized ? 'restore' : 'maximize']();
+    },
+
+    // private
+    fitContainer : function(){
+        var vs = this.container.getViewSize();
+        this.setSize(vs.width, vs.height);
+    },
+
+    // private
+    // z-index is managed by the WindowManager and may be overwritten at any time
+    setZIndex : function(index){
+        if(this.modal){
+            this.mask.setStyle('z-index', index);
+        }
+        this.el.setZIndex(++index);
+        index += 5;
+
+        if(this.resizer){
+            this.resizer.proxy.setStyle('z-index', ++index);
+        }
+
+        this.lastZIndex = index;
+    },
+
+    /**
+     * Aligns the window to the specified element
+     * @param {Mixed} element The element to align to.
+     * @param {String} position The position to align to (see {@link Ext.Element#alignTo} for more details).
+     * @param {Array} offsets (optional) Offset the positioning by [x, y]
+     * @return {Ext.Window} this
+     */
+    alignTo : function(element, position, offsets){
+        var xy = this.el.getAlignToXY(element, position, offsets);
+        this.setPagePosition(xy[0], xy[1]);
+        return this;
+    },
+
+    /**
+     * Anchors this window to another element and realigns it when the window is resized or scrolled.
+     * @param {Mixed} element The element to align to.
+     * @param {String} position The position to align to (see {@link Ext.Element#alignTo} for more details)
+     * @param {Array} offsets (optional) Offset the positioning by [x, y]
+     * @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).
+     * @return {Ext.Window} this
+     */
+    anchorTo : function(el, alignment, offsets, monitorScroll){
+      if(this.doAnchor){
+          Ext.EventManager.removeResizeListener(this.doAnchor, this);
+          Ext.EventManager.un(window, 'scroll', this.doAnchor, this);
+      }
+      this.doAnchor = function(){
+          this.alignTo(el, alignment, offsets);
+      };
+      Ext.EventManager.onWindowResize(this.doAnchor, this);
+      
+      var tm = typeof monitorScroll;
+      if(tm != 'undefined'){
+          Ext.EventManager.on(window, 'scroll', this.doAnchor, this,
+              {buffer: tm == 'number' ? monitorScroll : 50});
+      }
+      this.doAnchor();
+      return this;
+    },
+
+    /**
+     * Brings this window to the front of any other visible windows
+     * @param {Boolean} e (optional) Specify <tt>false</tt> to prevent the window from being focused.
+     * @return {Ext.Window} this
+     */
+    toFront : function(e){
+        if(this.manager.bringToFront(this)){
+            if(!e || !e.getTarget().focus){
+                this.focus();
+            }
+        }
+        return this;
+    },
+
+    /**
+     * Makes this the active window by showing its shadow, or deactivates it by hiding its shadow.  This method also
+     * fires the {@link #activate} or {@link #deactivate} event depending on which action occurred.
+     * @param {Boolean} active True to activate the window, false to deactivate it (defaults to false)
+     */
+    setActive : function(active){
+        if(active){
+            if(!this.maximized){
+                this.el.enableShadow(true);
+            }
+            this.fireEvent('activate', this);
+        }else{
+            this.el.disableShadow();
+            this.fireEvent('deactivate', this);
+        }
+    },
+
+    /**
+     * Sends this window to the back of (lower z-index than) any other visible windows
+     * @return {Ext.Window} this
+     */
+    toBack : function(){
+        this.manager.sendToBack(this);
+        return this;
+    },
+
+    /**
+     * Centers this window in the viewport
+     * @return {Ext.Window} this
+     */
+    center : function(){
+        var xy = this.el.getAlignToXY(this.container, 'c-c');
+        this.setPagePosition(xy[0], xy[1]);
+        return this;
+    }
+
+    /**
+     * @cfg {Boolean} autoWidth @hide
+     **/
+});
+Ext.reg('window', Ext.Window);
+
+// private - custom Window DD implementation
+Ext.Window.DD = function(win){
+    this.win = win;
+    Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);
+    this.setHandleElId(win.header.id);
+    this.scroll = false;
+};
+
+Ext.extend(Ext.Window.DD, Ext.dd.DD, {
+    moveOnly:true,
+    headerOffsets:[100, 25],
+    startDrag : function(){
+        var w = this.win;
+        this.proxy = w.ghost();
+        if(w.constrain !== false){
+            var so = w.el.shadowOffset;
+            this.constrainTo(w.container, {right: so, left: so, bottom: so});
+        }else if(w.constrainHeader !== false){
+            var s = this.proxy.getSize();
+            this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});
+        }
+    },
+    b4Drag : Ext.emptyFn,
+
+    onDrag : function(e){
+        this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());
+    },
+
+    endDrag : function(e){
+        this.win.unghost();
+        this.win.saveState();
+    }
+});
+/**
+ * @class Ext.WindowGroup
+ * An object that represents a group of {@link Ext.Window} instances and provides z-order management
+ * and window activation behavior.
+ * @constructor
+ */
+Ext.WindowGroup = function(){
+    var list = {};
+    var accessList = [];
+    var front = null;
+
+    // private
+    var sortWindows = function(d1, d2){
+        return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
+    };
+
+    // private
+    var orderWindows = function(){
+        var a = accessList, len = a.length;
+        if(len > 0){
+            a.sort(sortWindows);
+            var seed = a[0].manager.zseed;
+            for(var i = 0; i < len; i++){
+                var win = a[i];
+                if(win && !win.hidden){
+                    win.setZIndex(seed + (i*10));
+                }
+            }
+        }
+        activateLast();
+    };
+
+    // private
+    var setActiveWin = function(win){
+        if(win != front){
+            if(front){
+                front.setActive(false);
+            }
+            front = win;
+            if(win){
+                win.setActive(true);
+            }
+        }
+    };
+
+    // private
+    var activateLast = function(){
+        for(var i = accessList.length-1; i >=0; --i) {
+            if(!accessList[i].hidden){
+                setActiveWin(accessList[i]);
+                return;
+            }
+        }
+        // none to activate
+        setActiveWin(null);
+    };
+
+    return {
+        /**
+         * The starting z-index for windows (defaults to 9000)
+         * @type Number The z-index value
+         */
+        zseed : 9000,
+
+        // private
+        register : function(win){
+            list[win.id] = win;
+            accessList.push(win);
+            win.on('hide', activateLast);
+        },
+
+        // private
+        unregister : function(win){
+            delete list[win.id];
+            win.un('hide', activateLast);
+            accessList.remove(win);
+        },
+
+        /**
+         * Gets a registered window by id.
+         * @param {String/Object} id The id of the window or a {@link Ext.Window} instance
+         * @return {Ext.Window}
+         */
+        get : function(id){
+            return typeof id == "object" ? id : list[id];
+        },
+
+        /**
+         * Brings the specified window to the front of any other active windows.
+         * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
+         * @return {Boolean} True if the dialog was brought to the front, else false
+         * if it was already in front
+         */
+        bringToFront : function(win){
+            win = this.get(win);
+            if(win != front){
+                win._lastAccess = new Date().getTime();
+                orderWindows();
+                return true;
+            }
+            return false;
+        },
+
+        /**
+         * Sends the specified window to the back of other active windows.
+         * @param {String/Object} win The id of the window or a {@link Ext.Window} instance
+         * @return {Ext.Window} The window
+         */
+        sendToBack : function(win){
+            win = this.get(win);
+            win._lastAccess = -(new Date().getTime());
+            orderWindows();
+            return win;
+        },
+
+        /**
+         * Hides all windows in the group.
+         */
+        hideAll : function(){
+            for(var id in list){
+                if(list[id] && typeof list[id] != "function" && list[id].isVisible()){
+                    list[id].hide();
+                }
+            }
+        },
+
+        /**
+         * Gets the currently-active window in the group.
+         * @return {Ext.Window} The active window
+         */
+        getActive : function(){
+            return front;
+        },
+
+        /**
+         * Returns zero or more windows in the group using the custom search function passed to this method.
+         * The function should accept a single {@link Ext.Window} reference as its only argument and should
+         * return true if the window matches the search criteria, otherwise it should return false.
+         * @param {Function} fn The search function
+         * @param {Object} scope (optional) The scope in which to execute the function (defaults to the window
+         * that gets passed to the function if not specified)
+         * @return {Array} An array of zero or more matching windows
+         */
+        getBy : function(fn, scope){
+            var r = [];
+            for(var i = accessList.length-1; i >=0; --i) {
+                var win = accessList[i];
+                if(fn.call(scope||win, win) !== false){
+                    r.push(win);
+                }
+            }
+            return r;
+        },
+
+        /**
+         * Executes the specified function once for every window in the group, passing each
+         * window as the only parameter. 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 in which to execute the function
+         */
+        each : function(fn, scope){
+            for(var id in list){
+                if(list[id] && typeof list[id] != "function"){
+                    if(fn.call(scope || list[id], list[id]) === false){
+                        return;
+                    }
+                }
+            }
+        }
+    };
+};
+
+
+/**
+ * @class Ext.WindowMgr
+ * @extends Ext.WindowGroup
+ * The default global window group that is available automatically.  To have more than one group of windows
+ * with separate z-order stacks, create additional instances of {@link Ext.WindowGroup} as needed.
+ * @singleton
+ */
+Ext.WindowMgr = new Ext.WindowGroup();/**
+ * @class Ext.MessageBox
+ * <p>Utility class for generating different styles of message boxes.  The alias Ext.Msg can also be used.<p/>
+ * <p>Note that the MessageBox is asynchronous.  Unlike a regular JavaScript <code>alert</code> (which will halt
+ * browser execution), showing a MessageBox will not cause the code to stop.  For this reason, if you have code
+ * that should only run <em>after</em> some user feedback from the MessageBox, you must use a callback function
+ * (see the <code>function</code> parameter for {@link #show} for more details).</p>
+ * <p>Example usage:</p>
+ *<pre><code>
+// Basic alert:
+Ext.Msg.alert('Status', 'Changes saved successfully.');
+
+// Prompt for user data and process the result using a callback:
+Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
+    if (btn == 'ok'){
+        // process text value and close...
+    }
+});
+
+// Show a dialog using config options:
+Ext.Msg.show({
+   title:'Save Changes?',
+   msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
+   buttons: Ext.Msg.YESNOCANCEL,
+   fn: processResult,
+   animEl: 'elId',
+   icon: Ext.MessageBox.QUESTION
+});
+</code></pre>
+ * @singleton
+ */
+Ext.MessageBox = function(){
+    var dlg, opt, mask, waitTimer;
+    var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;
+    var buttons, activeTextEl, bwidth, iconCls = '';
+
+    // private
+    var handleButton = function(button){
+        if(dlg.isVisible()){
+            dlg.hide();
+            handleHide();
+            Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1);
+        }
+    };
+
+    // private
+    var handleHide = function(){
+        if(opt && opt.cls){
+            dlg.el.removeClass(opt.cls);
+        }
+        progressBar.reset();
+    };
+
+    // private
+    var handleEsc = function(d, k, e){
+        if(opt && opt.closable !== false){
+            dlg.hide();
+            handleHide();
+        }
+        if(e){
+            e.stopEvent();
+        }
+    };
+
+    // private
+    var updateButtons = function(b){
+        var width = 0;
+        if(!b){
+            buttons["ok"].hide();
+            buttons["cancel"].hide();
+            buttons["yes"].hide();
+            buttons["no"].hide();
+            return width;
+        }
+        dlg.footer.dom.style.display = '';
+        for(var k in buttons){
+            if(typeof buttons[k] != "function"){
+                if(b[k]){
+                    buttons[k].show();
+                    buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);
+                    width += buttons[k].el.getWidth()+15;
+                }else{
+                    buttons[k].hide();
+                }
+            }
+        }
+        return width;
+    };
+
+    return {
+        /**
+         * Returns a reference to the underlying {@link Ext.Window} element
+         * @return {Ext.Window} The window
+         */
+        getDialog : function(titleText){
+           if(!dlg){
+                dlg = new Ext.Window({
+                    autoCreate : true,
+                    title:titleText,
+                    resizable:false,
+                    constrain:true,
+                    constrainHeader:true,
+                    minimizable : false,
+                    maximizable : false,
+                    stateful: false,
+                    modal: true,
+                    shim:true,
+                    buttonAlign:"center",
+                    width:400,
+                    height:100,
+                    minHeight: 80,
+                    plain:true,
+                    footer:true,
+                    closable:true,
+                    close : function(){
+                        if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){
+                            handleButton("no");
+                        }else{
+                            handleButton("cancel");
+                        }
+                    }
+                });
+                buttons = {};
+                var bt = this.buttonText;
+                //TODO: refactor this block into a buttons config to pass into the Window constructor
+                buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));
+                buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));
+                buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));
+                buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));
+                buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';
+                dlg.render(document.body);
+                dlg.getEl().addClass('x-window-dlg');
+                mask = dlg.mask;
+                bodyEl = dlg.body.createChild({
+                    html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'
+                });
+                iconEl = Ext.get(bodyEl.dom.firstChild);
+                var contentEl = bodyEl.dom.childNodes[1];
+                msgEl = Ext.get(contentEl.firstChild);
+                textboxEl = Ext.get(contentEl.childNodes[2].firstChild);
+                textboxEl.enableDisplayMode();
+                textboxEl.addKeyListener([10,13], function(){
+                    if(dlg.isVisible() && opt && opt.buttons){
+                        if(opt.buttons.ok){
+                            handleButton("ok");
+                        }else if(opt.buttons.yes){
+                            handleButton("yes");
+                        }
+                    }
+                });
+                textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);
+                textareaEl.enableDisplayMode();
+                progressBar = new Ext.ProgressBar({
+                    renderTo:bodyEl
+                });
+               bodyEl.createChild({cls:'x-clear'});
+            }
+            return dlg;
+        },
+
+        /**
+         * Updates the message box body text
+         * @param {String} text (optional) Replaces the message box element's innerHTML with the specified string (defaults to
+         * the XHTML-compliant non-breaking space character '&amp;#160;')
+         * @return {Ext.MessageBox} this
+         */
+        updateText : function(text){
+            if(!dlg.isVisible() && !opt.width){
+                dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows
+            }
+            msgEl.update(text || '&#160;');
+
+            var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;
+            var mw = msgEl.getWidth() + msgEl.getMargins('lr');
+            var fw = dlg.getFrameWidth('lr');
+            var bw = dlg.body.getFrameWidth('lr');
+            if (Ext.isIE && iw > 0){
+                //3 pixels get subtracted in the icon CSS for an IE margin issue,
+                //so we have to add it back here for the overall width to be consistent
+                iw += 3;
+            }
+            var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth),
+                        Math.max(opt.minWidth || this.minWidth, bwidth || 0));
+
+            if(opt.prompt === true){
+                activeTextEl.setWidth(w-iw-fw-bw);
+            }
+            if(opt.progress === true || opt.wait === true){
+                progressBar.setSize(w-iw-fw-bw);
+            }
+            if(Ext.isIE && w == bwidth){
+                w += 4; //Add offset when the content width is smaller than the buttons.    
+            }
+            dlg.setSize(w, 'auto').center();
+            return this;
+        },
+
+        /**
+         * Updates a progress-style message box's text and progress bar. Only relevant on message boxes
+         * initiated via {@link Ext.MessageBox#progress} or {@link Ext.MessageBox#wait},
+         * or by calling {@link Ext.MessageBox#show} with progress: true.
+         * @param {Number} value Any number between 0 and 1 (e.g., .5, defaults to 0)
+         * @param {String} progressText The progress text to display inside the progress bar (defaults to '')
+         * @param {String} msg The message box's body text is replaced with the specified string (defaults to undefined
+         * so that any existing body text will not get overwritten by default unless a new value is passed in)
+         * @return {Ext.MessageBox} this
+         */
+        updateProgress : function(value, progressText, msg){
+            progressBar.updateProgress(value, progressText);
+            if(msg){
+                this.updateText(msg);
+            }
+            return this;
+        },
+
+        /**
+         * Returns true if the message box is currently displayed
+         * @return {Boolean} True if the message box is visible, else false
+         */
+        isVisible : function(){
+            return dlg && dlg.isVisible();
+        },
+
+        /**
+         * Hides the message box if it is displayed
+         * @return {Ext.MessageBox} this
+         */
+        hide : function(){
+            var proxy = dlg ? dlg.activeGhost : null;
+            if(this.isVisible() || proxy){
+                dlg.hide();
+                handleHide();
+                if (proxy){
+                    // unghost is a private function, but i saw no better solution
+                    // to fix the locking problem when dragging while it closes
+                    dlg.unghost(false, false);
+                } 
+            }
+            return this;
+        },
+
+        /**
+         * Displays a new message box, or reinitializes an existing message box, based on the config options
+         * passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally,
+         * although those calls are basic shortcuts and do not support all of the config options allowed here.
+         * @param {Object} config The following config options are supported: <ul>
+         * <li><b>animEl</b> : String/Element<div class="sub-desc">An id or Element from which the message box should animate as it
+         * opens and closes (defaults to undefined)</div></li>
+         * <li><b>buttons</b> : Object/Boolean<div class="sub-desc">A button config object (e.g., Ext.MessageBox.OKCANCEL or {ok:'Foo',
+         * cancel:'Bar'}), or false to not show any buttons (defaults to false)</div></li>
+         * <li><b>closable</b> : Boolean<div class="sub-desc">False to hide the top-right close button (defaults to true). Note that
+         * progress and wait dialogs will ignore this property and always hide the close button as they can only
+         * be closed programmatically.</div></li>
+         * <li><b>cls</b> : String<div class="sub-desc">A custom CSS class to apply to the message box's container element</div></li>
+         * <li><b>defaultTextHeight</b> : Number<div class="sub-desc">The default height in pixels of the message box's multiline textarea
+         * if displayed (defaults to 75)</div></li>
+         * <li><b>fn</b> : Function<div class="sub-desc">A callback function which is called when the dialog is dismissed either
+         * by clicking on the configured buttons, or on the dialog close button, or by pressing
+         * the return button to enter input.
+         * <p>Progress and wait dialogs will ignore this option since they do not respond to user
+         * actions and can only be closed programmatically, so any required function should be called
+         * by the same code after it closes the dialog. Parameters passed:<ul>
+         * <li><b>buttonId</b> : String<div class="sub-desc">The ID of the button pressed, one of:<div class="sub-desc"><ul>
+         * <li><tt>ok</tt></li>
+         * <li><tt>yes</tt></li>
+         * <li><tt>no</tt></li>
+         * <li><tt>cancel</tt></li>
+         * </ul></div></div></li>
+         * <li><b>text</b> : String<div class="sub-desc">Value of the input field if either <tt><a href="#show-option-prompt" ext:member="show-option-prompt" ext:cls="Ext.MessageBox">prompt</a></tt>
+         * or <tt><a href="#show-option-multiline" ext:member="show-option-multiline" ext:cls="Ext.MessageBox">multiline</a></tt> is true</div></li>
+         * <li><b>opt</b> : Object<div class="sub-desc">The config object passed to show.</div></li>
+         * </ul></p></div></li>
+         * <li><b>scope</b> : Object<div class="sub-desc">The scope of the callback function</div></li>
+         * <li><b>icon</b> : String<div class="sub-desc">A CSS class that provides a background image to be used as the body icon for the
+         * dialog (e.g. Ext.MessageBox.WARNING or 'custom-class') (defaults to '')</div></li>
+         * <li><b>iconCls</b> : String<div class="sub-desc">The standard {@link Ext.Window#iconCls} to
+         * add an optional header icon (defaults to '')</div></li>
+         * <li><b>maxWidth</b> : Number<div class="sub-desc">The maximum width in pixels of the message box (defaults to 600)</div></li>
+         * <li><b>minWidth</b> : Number<div class="sub-desc">The minimum width in pixels of the message box (defaults to 100)</div></li>
+         * <li><b>modal</b> : Boolean<div class="sub-desc">False to allow user interaction with the page while the message box is
+         * displayed (defaults to true)</div></li>
+         * <li><b>msg</b> : String<div class="sub-desc">A string that will replace the existing message box body text (defaults to the
+         * XHTML-compliant non-breaking space character '&amp;#160;')</div></li>
+         * <li><a id="show-option-multiline"></a><b>multiline</b> : Boolean<div class="sub-desc">
+         * True to prompt the user to enter multi-line text (defaults to false)</div></li>
+         * <li><b>progress</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>
+         * <li><b>progressText</b> : String<div class="sub-desc">The text to display inside the progress bar if progress = true (defaults to '')</div></li>
+         * <li><a id="show-option-prompt"></a><b>prompt</b> : Boolean<div class="sub-desc">True to prompt the user to enter single-line text (defaults to false)</div></li>
+         * <li><b>proxyDrag</b> : Boolean<div class="sub-desc">True to display a lightweight proxy while dragging (defaults to false)</div></li>
+         * <li><b>title</b> : String<div class="sub-desc">The title text</div></li>
+         * <li><b>value</b> : String<div class="sub-desc">The string value to set into the active textbox element if displayed</div></li>
+         * <li><b>wait</b> : Boolean<div class="sub-desc">True to display a progress bar (defaults to false)</div></li>
+         * <li><b>waitConfig</b> : Object<div class="sub-desc">A {@link Ext.ProgressBar#waitConfig} object (applies only if wait = true)</div></li>
+         * <li><b>width</b> : Number<div class="sub-desc">The width of the dialog in pixels</div></li>
+         * </ul>
+         * Example usage:
+         * <pre><code>
+Ext.Msg.show({
+   title: 'Address',
+   msg: 'Please enter your address:',
+   width: 300,
+   buttons: Ext.MessageBox.OKCANCEL,
+   multiline: true,
+   fn: saveAddress,
+   animEl: 'addAddressBtn',
+   icon: Ext.MessageBox.INFO
+});
+</code></pre>
+         * @return {Ext.MessageBox} this
+         */
+        show : function(options){
+            if(this.isVisible()){
+                this.hide();
+            }
+            opt = options;
+            var d = this.getDialog(opt.title || "&#160;");
+
+            d.setTitle(opt.title || "&#160;");
+            var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);
+            d.tools.close.setDisplayed(allowClose);
+            activeTextEl = textboxEl;
+            opt.prompt = opt.prompt || (opt.multiline ? true : false);
+            if(opt.prompt){
+                if(opt.multiline){
+                    textboxEl.hide();
+                    textareaEl.show();
+                    textareaEl.setHeight(typeof opt.multiline == "number" ?
+                        opt.multiline : this.defaultTextHeight);
+                    activeTextEl = textareaEl;
+                }else{
+                    textboxEl.show();
+                    textareaEl.hide();
+                }
+            }else{
+                textboxEl.hide();
+                textareaEl.hide();
+            }
+            activeTextEl.dom.value = opt.value || "";
+            if(opt.prompt){
+                d.focusEl = activeTextEl;
+            }else{
+                var bs = opt.buttons;
+                var db = null;
+                if(bs && bs.ok){
+                    db = buttons["ok"];
+                }else if(bs && bs.yes){
+                    db = buttons["yes"];
+                }
+                if (db){
+                    d.focusEl = db;
+                }
+            }
+            if(opt.iconCls){
+              d.setIconClass(opt.iconCls);
+            }
+            this.setIcon(opt.icon);
+            if(opt.cls){
+                d.el.addClass(opt.cls);
+            }
+            d.proxyDrag = opt.proxyDrag === true;
+            d.modal = opt.modal !== false;
+            d.mask = opt.modal !== false ? mask : false;
+            
+            d.on('show', function(){
+                //workaround for window internally enabling keymap in afterShow
+                d.keyMap.setDisabled(allowClose !== true);
+                d.doLayout();
+                this.setIcon(opt.icon);
+                bwidth = updateButtons(opt.buttons);
+                progressBar.setVisible(opt.progress === true || opt.wait === true);
+                this.updateProgress(0, opt.progressText);
+                this.updateText(opt.msg);
+                if(opt.wait === true){
+                    progressBar.wait(opt.waitConfig);
+                }
+
+            }, this, {single:true});
+            if(!d.isVisible()){
+                // force it to the end of the z-index stack so it gets a cursor in FF
+                document.body.appendChild(dlg.el.dom);
+                d.setAnimateTarget(opt.animEl);
+                d.show(opt.animEl);
+            }
+            return this;
+        },
+
+        /**
+         * Adds the specified icon to the dialog.  By default, the class 'ext-mb-icon' is applied for default
+         * styling, and the class passed in is expected to supply the background image url. Pass in empty string ('')
+         * to clear any existing icon.  The following built-in icon classes are supported, but you can also pass
+         * in a custom class name:
+         * <pre>
+Ext.MessageBox.INFO
+Ext.MessageBox.WARNING
+Ext.MessageBox.QUESTION
+Ext.MessageBox.ERROR
+         *</pre>
+         * @param {String} icon A CSS classname specifying the icon's background image url, or empty string to clear the icon
+         * @return {Ext.MessageBox} this
+         */
+        setIcon : function(icon){
+            if(icon && icon != ''){
+                iconEl.removeClass('x-hidden');
+                iconEl.replaceClass(iconCls, icon);
+                bodyEl.addClass('x-dlg-icon');
+                iconCls = icon;
+            }else{
+                iconEl.replaceClass(iconCls, 'x-hidden');
+                bodyEl.removeClass('x-dlg-icon');
+                iconCls = '';
+            }
+            return this;
+        },
+
+        /**
+         * Displays a message box with a progress bar.  This message box has no buttons and is not closeable by
+         * the user.  You are responsible for updating the progress bar as needed via {@link Ext.MessageBox#updateProgress}
+         * and closing the message box when the process is complete.
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {String} progressText (optional) The text to display inside the progress bar (defaults to '')
+         * @return {Ext.MessageBox} this
+         */
+        progress : function(title, msg, progressText){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: false,
+                progress:true,
+                closable:false,
+                minWidth: this.minProgressWidth,
+                progressText: progressText
+            });
+            return this;
+        },
+
+        /**
+         * Displays a message box with an infinitely auto-updating progress bar.  This can be used to block user
+         * interaction while waiting for a long-running process to complete that does not have defined intervals.
+         * You are responsible for closing the message box when the process is complete.
+         * @param {String} msg The message box body text
+         * @param {String} title (optional) The title bar text
+         * @param {Object} config (optional) A {@link Ext.ProgressBar#waitConfig} object
+         * @return {Ext.MessageBox} this
+         */
+        wait : function(msg, title, config){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: false,
+                closable:false,
+                wait:true,
+                modal:true,
+                minWidth: this.minProgressWidth,
+                waitConfig: config
+            });
+            return this;
+        },
+
+        /**
+         * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt).
+         * If a callback function is passed it will be called after the user clicks the button, and the
+         * id of the button that was clicked will be passed as the only parameter to the callback
+         * (could also be the top-right close button).
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {Function} fn (optional) The callback function invoked after the message box is closed
+         * @param {Object} scope (optional) The scope of the callback function
+         * @return {Ext.MessageBox} this
+         */
+        alert : function(title, msg, fn, scope){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: this.OK,
+                fn: fn,
+                scope : scope
+            });
+            return this;
+        },
+
+        /**
+         * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm).
+         * If a callback function is passed it will be called after the user clicks either button,
+         * and the id of the button that was clicked will be passed as the only parameter to the callback
+         * (could also be the top-right close button).
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {Function} fn (optional) The callback function invoked after the message box is closed
+         * @param {Object} scope (optional) The scope of the callback function
+         * @return {Ext.MessageBox} this
+         */
+        confirm : function(title, msg, fn, scope){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: this.YESNO,
+                fn: fn,
+                scope : scope,
+                icon: this.QUESTION
+            });
+            return this;
+        },
+
+        /**
+         * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt).
+         * The prompt can be a single-line or multi-line textbox.  If a callback function is passed it will be called after the user
+         * clicks either button, and the id of the button that was clicked (could also be the top-right
+         * close button) and the text that was entered will be passed as the two parameters to the callback.
+         * @param {String} title The title bar text
+         * @param {String} msg The message box body text
+         * @param {Function} fn (optional) The callback function invoked after the message box is closed
+         * @param {Object} scope (optional) The scope of the callback function
+         * @param {Boolean/Number} multiline (optional) True to create a multiline textbox using the defaultTextHeight
+         * property, or the height in pixels to create the textbox (defaults to false / single-line)
+         * @param {String} value (optional) Default value of the text input element (defaults to '')
+         * @return {Ext.MessageBox} this
+         */
+        prompt : function(title, msg, fn, scope, multiline, value){
+            this.show({
+                title : title,
+                msg : msg,
+                buttons: this.OKCANCEL,
+                fn: fn,
+                minWidth:250,
+                scope : scope,
+                prompt:true,
+                multiline: multiline,
+                value: value
+            });
+            return this;
+        },
+
+        /**
+         * Button config that displays a single OK button
+         * @type Object
+         */
+        OK : {ok:true},
+        /**
+         * Button config that displays a single Cancel button
+         * @type Object
+         */
+        CANCEL : {cancel:true},
+        /**
+         * Button config that displays OK and Cancel buttons
+         * @type Object
+         */
+        OKCANCEL : {ok:true, cancel:true},
+        /**
+         * Button config that displays Yes and No buttons
+         * @type Object
+         */
+        YESNO : {yes:true, no:true},
+        /**
+         * Button config that displays Yes, No and Cancel buttons
+         * @type Object
+         */
+        YESNOCANCEL : {yes:true, no:true, cancel:true},
+        /**
+         * The CSS class that provides the INFO icon image
+         * @type String
+         */
+        INFO : 'ext-mb-info',
+        /**
+         * The CSS class that provides the WARNING icon image
+         * @type String
+         */
+        WARNING : 'ext-mb-warning',
+        /**
+         * The CSS class that provides the QUESTION icon image
+         * @type String
+         */
+        QUESTION : 'ext-mb-question',
+        /**
+         * The CSS class that provides the ERROR icon image
+         * @type String
+         */
+        ERROR : 'ext-mb-error',
+
+        /**
+         * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75)
+         * @type Number
+         */
+        defaultTextHeight : 75,
+        /**
+         * The maximum width in pixels of the message box (defaults to 600)
+         * @type Number
+         */
+        maxWidth : 600,
+        /**
+         * The minimum width in pixels of the message box (defaults to 110)
+         * @type Number
+         */
+        minWidth : 110,
+        /**
+         * The minimum width in pixels of the message box if it is a progress-style dialog.  This is useful
+         * for setting a different minimum width than text-only dialogs may need (defaults to 250)
+         * @type Number
+         */
+        minProgressWidth : 250,
+        /**
+         * An object containing the default button text strings that can be overriden for localized language support.
+         * Supported properties are: ok, cancel, yes and no.  Generally you should include a locale-specific
+         * resource file for handling language support across the framework.
+         * Customize the default text like so: Ext.MessageBox.buttonText.yes = "oui"; //french
+         * @type Object
+         */
+        buttonText : {
+            ok : "OK",
+            cancel : "Cancel",
+            yes : "Yes",
+            no : "No"
+        }
+    };
+}();
+
+/**
+ * Shorthand for {@link Ext.MessageBox}
+ */
+Ext.Msg = Ext.MessageBox;/**\r
+ * @class Ext.dd.PanelProxy\r
+ * A custom drag proxy implementation specific to {@link Ext.Panel}s. This class is primarily used internally\r
+ * for the Panel's drag drop implementation, and should never need to be created directly.\r
+ * @constructor\r
+ * @param panel The {@link Ext.Panel} to proxy for\r
+ * @param config Configuration options\r
+ */\r
+Ext.dd.PanelProxy = function(panel, config){\r
+    this.panel = panel;\r
+    this.id = this.panel.id +'-ddproxy';\r
+    Ext.apply(this, config);\r
 };\r
 \r
-Ext.extend(Ext.dd.DropTarget, Ext.dd.DDTarget, {\r
-    \r
-    \r
-    \r
-    dropAllowed : "x-dd-drop-ok",\r
-    \r
-    dropNotAllowed : "x-dd-drop-nodrop",\r
+Ext.dd.PanelProxy.prototype = {\r
+    /**\r
+     * @cfg {Boolean} insertProxy True to insert a placeholder proxy element while dragging the panel,\r
+     * false to drag with no proxy (defaults to true).\r
+     */\r
+    insertProxy : true,\r
 \r
-    // private\r
-    isTarget : true,\r
+    // private overrides\r
+    setStatus : Ext.emptyFn,\r
+    reset : Ext.emptyFn,\r
+    update : Ext.emptyFn,\r
+    stop : Ext.emptyFn,\r
+    sync: Ext.emptyFn,\r
 \r
-    // private\r
-    isNotifyTarget : true,\r
+    /**\r
+     * Gets the proxy's element\r
+     * @return {Element} The proxy's element\r
+     */\r
+    getEl : function(){\r
+        return this.ghost;\r
+    },\r
 \r
-    \r
-    notifyEnter : function(dd, e, data){\r
-        if(this.overClass){\r
-            this.el.addClass(this.overClass);\r
+    /**\r
+     * Gets the proxy's ghost element\r
+     * @return {Element} The proxy's ghost element\r
+     */\r
+    getGhost : function(){\r
+        return this.ghost;\r
+    },\r
+\r
+    /**\r
+     * Gets the proxy's element\r
+     * @return {Element} The proxy's element\r
+     */\r
+    getProxy : function(){\r
+        return this.proxy;\r
+    },\r
+\r
+    /**\r
+     * Hides the proxy\r
+     */\r
+    hide : function(){\r
+        if(this.ghost){\r
+            if(this.proxy){\r
+                this.proxy.remove();\r
+                delete this.proxy;\r
+            }\r
+            this.panel.el.dom.style.display = '';\r
+            this.ghost.remove();\r
+            delete this.ghost;\r
         }\r
-        return this.dropAllowed;\r
     },\r
 \r
-    \r
-    notifyOver : function(dd, e, data){\r
-        return this.dropAllowed;\r
+    /**\r
+     * Shows the proxy\r
+     */\r
+    show : function(){\r
+        if(!this.ghost){\r
+            this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());\r
+            this.ghost.setXY(this.panel.el.getXY())\r
+            if(this.insertProxy){\r
+                this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});\r
+                this.proxy.setSize(this.panel.getSize());\r
+            }\r
+            this.panel.el.dom.style.display = 'none';\r
+        }\r
     },\r
 \r
-    \r
-    notifyOut : function(dd, e, data){\r
-        if(this.overClass){\r
-            this.el.removeClass(this.overClass);\r
+    // private\r
+    repair : function(xy, callback, scope){\r
+        this.hide();\r
+        if(typeof callback == "function"){\r
+            callback.call(scope || this);\r
         }\r
     },\r
 \r
-    \r
-    notifyDrop : function(dd, e, data){\r
-        return false;\r
+    /**\r
+     * Moves the proxy to a different position in the DOM.  This is typically called while dragging the Panel\r
+     * to keep the proxy sync'd to the Panel's location.\r
+     * @param {HTMLElement} parentNode The proxy's parent DOM node\r
+     * @param {HTMLElement} before (optional) The sibling node before which the proxy should be inserted (defaults\r
+     * to the parent's last child if not specified)\r
+     */\r
+    moveProxy : function(parentNode, before){\r
+        if(this.proxy){\r
+            parentNode.insertBefore(this.proxy.dom, before);\r
+        }\r
     }\r
-});\r
+};\r
 \r
-Ext.dd.DragZone = function(el, config){\r
-    Ext.dd.DragZone.superclass.constructor.call(this, el, config);\r
-    if(this.containerScroll){\r
-        Ext.dd.ScrollManager.register(this.el);\r
+// private - DD implementation for Panels\r
+Ext.Panel.DD = function(panel, cfg){\r
+    this.panel = panel;\r
+    this.dragData = {panel: panel};\r
+    this.proxy = new Ext.dd.PanelProxy(panel, cfg);\r
+    Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);\r
+    var h = panel.header;\r
+    if(h){\r
+        this.setHandleElId(h.id);\r
     }\r
+    (h ? h : this.panel.body).setStyle('cursor', 'move');\r
+    this.scroll = false;\r
 };\r
 \r
-Ext.extend(Ext.dd.DragZone, Ext.dd.DragSource, {\r
-    \r
-    \r
-\r
-    \r
-    getDragData : function(e){\r
-        return Ext.dd.Registry.getHandleFromEvent(e);\r
-    },\r
-    \r
-    \r
+Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {\r
+    showFrame: Ext.emptyFn,\r
+    startDrag: Ext.emptyFn,\r
+    b4StartDrag: function(x, y) {\r
+        this.proxy.show();\r
+    },\r
+    b4MouseDown: function(e) {\r
+        var x = e.getPageX();\r
+        var y = e.getPageY();\r
+        this.autoOffset(x, y);\r
+    },\r
     onInitDrag : function(x, y){\r
-        this.proxy.update(this.dragData.ddel.cloneNode(true));\r
         this.onStartDrag(x, y);\r
         return true;\r
     },\r
-    \r
-    \r
-    afterRepair : function(){\r
-        if(Ext.enableFx){\r
-            Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");\r
-        }\r
-        this.dragging = false;\r
+    createFrame : Ext.emptyFn,\r
+    getDragEl : function(e){\r
+        return this.proxy.ghost.dom;\r
+    },\r
+    endDrag : function(e){\r
+        this.proxy.hide();\r
+        this.panel.saveState();\r
     },\r
 \r
-    \r
-    getRepairXY : function(e){\r
-        return Ext.Element.fly(this.dragData.ddel).getXY();  \r
+    autoOffset : function(x, y) {\r
+        x -= this.startPageX;\r
+        y -= this.startPageY;\r
+        this.setDelta(x, y);\r
     }\r
-});\r
+});/**
+ * @class Ext.state.Provider
+ * Abstract base class for state provider implementations. This class provides methods
+ * for encoding and decoding <b>typed</b> variables including dates and defines the
+ * Provider interface.
+ */
+Ext.state.Provider = function(){
+    /**
+     * @event statechange
+     * Fires when a state change occurs.
+     * @param {Provider} this This state provider
+     * @param {String} key The state key which was changed
+     * @param {String} value The encoded value for the state
+     */
+    this.addEvents("statechange");
+    this.state = {};
+    Ext.state.Provider.superclass.constructor.call(this);
+};
+Ext.extend(Ext.state.Provider, Ext.util.Observable, {
+    /**
+     * Returns the current value for a key
+     * @param {String} name The key name
+     * @param {Mixed} defaultValue A default value to return if the key's value is not found
+     * @return {Mixed} The state data
+     */
+    get : function(name, defaultValue){
+        return typeof this.state[name] == "undefined" ?
+            defaultValue : this.state[name];
+    },
+
+    /**
+     * Clears a value from the state
+     * @param {String} name The key name
+     */
+    clear : function(name){
+        delete this.state[name];
+        this.fireEvent("statechange", this, name, null);
+    },
+
+    /**
+     * Sets the value for a key
+     * @param {String} name The key name
+     * @param {Mixed} value The value to set
+     */
+    set : function(name, value){
+        this.state[name] = value;
+        this.fireEvent("statechange", this, name, value);
+    },
+
+    /**
+     * Decodes a string previously encoded with {@link #encodeValue}.
+     * @param {String} value The value to decode
+     * @return {Mixed} The decoded value
+     */
+    decodeValue : function(cookie){
+        var re = /^(a|n|d|b|s|o)\:(.*)$/;
+        var matches = re.exec(unescape(cookie));
+        if(!matches || !matches[1]) return; // non state cookie
+        var type = matches[1];
+        var v = matches[2];
+        switch(type){
+            case "n":
+                return parseFloat(v);
+            case "d":
+                return new Date(Date.parse(v));
+            case "b":
+                return (v == "1");
+            case "a":
+                var all = [];
+                var values = v.split("^");
+                for(var i = 0, len = values.length; i < len; i++){
+                    all.push(this.decodeValue(values[i]));
+                }
+                return all;
+           case "o":
+                var all = {};
+                var values = v.split("^");
+                for(var i = 0, len = values.length; i < len; i++){
+                    var kv = values[i].split("=");
+                    all[kv[0]] = this.decodeValue(kv[1]);
+                }
+                return all;
+           default:
+                return v;
+        }
+    },
+
+    /**
+     * Encodes a value including type information.  Decode with {@link #decodeValue}.
+     * @param {Mixed} value The value to encode
+     * @return {String} The encoded value
+     */
+    encodeValue : function(v){
+        var enc;
+        if(typeof v == "number"){
+            enc = "n:" + v;
+        }else if(typeof v == "boolean"){
+            enc = "b:" + (v ? "1" : "0");
+        }else if(Ext.isDate(v)){
+            enc = "d:" + v.toGMTString();
+        }else if(Ext.isArray(v)){
+            var flat = "";
+            for(var i = 0, len = v.length; i < len; i++){
+                flat += this.encodeValue(v[i]);
+                if(i != len-1) flat += "^";
+            }
+            enc = "a:" + flat;
+        }else if(typeof v == "object"){
+            var flat = "";
+            for(var key in v){
+                if(typeof v[key] != "function" && v[key] !== undefined){
+                    flat += key + "=" + this.encodeValue(v[key]) + "^";
+                }
+            }
+            enc = "o:" + flat.substring(0, flat.length-1);
+        }else{
+            enc = "s:" + v;
+        }
+        return escape(enc);
+    }
+});
+/**\r
+ * @class Ext.state.Manager\r
+ * This is the global state manager. By default all components that are "state aware" check this class\r
+ * for state information if you don't pass them a custom state provider. In order for this class\r
+ * to be useful, it must be initialized with a provider when your application initializes. Example usage:\r
+ <pre><code>\r
+// in your initialization function\r
+init : function(){\r
+   Ext.state.Manager.setProvider(new Ext.state.CookieProvider());\r
+   var win = new Window(...);\r
+   win.restoreState();\r
+}\r
+ </code></pre>\r
+ * @singleton\r
+ */\r
+Ext.state.Manager = function(){\r
+    var provider = new Ext.state.Provider();\r
 \r
-Ext.dd.DropZone = function(el, config){\r
-    Ext.dd.DropZone.superclass.constructor.call(this, el, config);\r
+    return {\r
+        /**\r
+         * Configures the default state provider for your application\r
+         * @param {Provider} stateProvider The state provider to set\r
+         */\r
+        setProvider : function(stateProvider){\r
+            provider = stateProvider;\r
+        },\r
+\r
+        /**\r
+         * Returns the current value for a key\r
+         * @param {String} name The key name\r
+         * @param {Mixed} defaultValue The default value to return if the key lookup does not match\r
+         * @return {Mixed} The state data\r
+         */\r
+        get : function(key, defaultValue){\r
+            return provider.get(key, defaultValue);\r
+        },\r
+\r
+        /**\r
+         * Sets the value for a key\r
+         * @param {String} name The key name\r
+         * @param {Mixed} value The state data\r
+         */\r
+         set : function(key, value){\r
+            provider.set(key, value);\r
+        },\r
+\r
+        /**\r
+         * Clears a value from the state\r
+         * @param {String} name The key name\r
+         */\r
+        clear : function(key){\r
+            provider.clear(key);\r
+        },\r
+\r
+        /**\r
+         * Gets the currently configured state provider\r
+         * @return {Provider} The state provider\r
+         */\r
+        getProvider : function(){\r
+            return provider;\r
+        }\r
+    };\r
+}();\r
+/**\r
+ * @class Ext.state.CookieProvider\r
+ * @extends Ext.state.Provider\r
+ * The default Provider implementation which saves state via cookies.\r
+ * <br />Usage:\r
+ <pre><code>\r
+   var cp = new Ext.state.CookieProvider({\r
+       path: "/cgi-bin/",\r
+       expires: new Date(new Date().getTime()+(1000*60*60*24*30)), //30 days\r
+       domain: "extjs.com"\r
+   });\r
+   Ext.state.Manager.setProvider(cp);\r
+ </code></pre>\r
+ * @cfg {String} path The path for which the cookie is active (defaults to root '/' which makes it active for all pages in the site)\r
+ * @cfg {Date} expires The cookie expiration date (defaults to 7 days from now)\r
+ * @cfg {String} domain The domain to save the cookie for.  Note that you cannot specify a different domain than\r
+ * your page is on, but you can specify a sub-domain, or simply the domain itself like 'extjs.com' to include\r
+ * all sub-domains if you need to access cookies across different sub-domains (defaults to null which uses the same\r
+ * domain the page is running on including the 'www' like 'www.extjs.com')\r
+ * @cfg {Boolean} secure True if the site is using SSL (defaults to false)\r
+ * @constructor\r
+ * Create a new CookieProvider\r
+ * @param {Object} config The configuration object\r
+ */\r
+Ext.state.CookieProvider = function(config){\r
+    Ext.state.CookieProvider.superclass.constructor.call(this);\r
+    this.path = "/";\r
+    this.expires = new Date(new Date().getTime()+(1000*60*60*24*7)); //7 days\r
+    this.domain = null;\r
+    this.secure = false;\r
+    Ext.apply(this, config);\r
+    this.state = this.readCookies();\r
 };\r
 \r
-Ext.extend(Ext.dd.DropZone, Ext.dd.DropTarget, {\r
-    \r
-    getTargetFromEvent : function(e){\r
-        return Ext.dd.Registry.getTargetFromEvent(e);\r
+Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, {\r
+    // private\r
+    set : function(name, value){\r
+        if(typeof value == "undefined" || value === null){\r
+            this.clear(name);\r
+            return;\r
+        }\r
+        this.setCookie(name, value);\r
+        Ext.state.CookieProvider.superclass.set.call(this, name, value);\r
     },\r
 \r
-    \r
-    onNodeEnter : function(n, dd, e, data){\r
-        \r
+    // private\r
+    clear : function(name){\r
+        this.clearCookie(name);\r
+        Ext.state.CookieProvider.superclass.clear.call(this, name);\r
     },\r
 \r
-    \r
-    onNodeOver : function(n, dd, e, data){\r
-        return this.dropAllowed;\r
+    // private\r
+    readCookies : function(){\r
+        var cookies = {};\r
+        var c = document.cookie + ";";\r
+        var re = /\s?(.*?)=(.*?);/g;\r
+       var matches;\r
+       while((matches = re.exec(c)) != null){\r
+            var name = matches[1];\r
+            var value = matches[2];\r
+            if(name && name.substring(0,3) == "ys-"){\r
+                cookies[name.substr(3)] = this.decodeValue(value);\r
+            }\r
+        }\r
+        return cookies;\r
     },\r
 \r
-    \r
-    onNodeOut : function(n, dd, e, data){\r
-        \r
+    // private\r
+    setCookie : function(name, value){\r
+        document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +\r
+           ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +\r
+           ((this.path == null) ? "" : ("; path=" + this.path)) +\r
+           ((this.domain == null) ? "" : ("; domain=" + this.domain)) +\r
+           ((this.secure == true) ? "; secure" : "");\r
     },\r
 \r
-    \r
-    onNodeDrop : function(n, dd, e, data){\r
-        return false;\r
-    },\r
+    // private\r
+    clearCookie : function(name){\r
+        document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +\r
+           ((this.path == null) ? "" : ("; path=" + this.path)) +\r
+           ((this.domain == null) ? "" : ("; domain=" + this.domain)) +\r
+           ((this.secure == true) ? "; secure" : "");\r
+    }\r
+});/**
+ * @class Ext.DataView
+ * @extends Ext.BoxComponent
+ * A mechanism for displaying data using custom layout templates and formatting. DataView uses an {@link Ext.XTemplate}
+ * as its internal templating mechanism, and is bound to an {@link Ext.data.Store}
+ * so that as the data in the store changes the view is automatically updated to reflect the changes.  The view also
+ * provides built-in behavior for many common events that can occur for its contained items including click, doubleclick,
+ * mouseover, mouseout, etc. as well as a built-in selection model. <b>In order to use these features, an {@link #itemSelector}
+ * config must be provided for the DataView to determine what nodes it will be working with.</b>
+ *
+ * <p>The example below binds a DataView to a {@link Ext.data.Store} and renders it into an {@link Ext.Panel}.</p>
+ * <pre><code>
+var store = new Ext.data.JsonStore({
+    url: 'get-images.php',
+    root: 'images',
+    fields: [
+        'name', 'url',
+        {name:'size', type: 'float'},
+        {name:'lastmod', type:'date', dateFormat:'timestamp'}
+    ]
+});
+store.load();
+
+var tpl = new Ext.XTemplate(
+    '&lt;tpl for="."&gt;',
+        '&lt;div class="thumb-wrap" id="{name}"&gt;',
+        '&lt;div class="thumb"&gt;&lt;img src="{url}" title="{name}"&gt;&lt;/div&gt;',
+        '&lt;span class="x-editable"&gt;{shortName}&lt;/span&gt;&lt;/div&gt;',
+    '&lt;/tpl&gt;',
+    '&lt;div class="x-clear"&gt;&lt;/div&gt;'
+);
+
+var panel = new Ext.Panel({
+    id:'images-view',
+    frame:true,
+    width:535,
+    autoHeight:true,
+    collapsible:true,
+    layout:'fit',
+    title:'Simple DataView',
+
+    items: new Ext.DataView({
+        store: store,
+        tpl: tpl,
+        autoHeight:true,
+        multiSelect: true,
+        overClass:'x-view-over',
+        itemSelector:'div.thumb-wrap',
+        emptyText: 'No images to display'
+    })
+});
+panel.render(document.body);
+</code></pre>
+ * @constructor
+ * Create a new DataView
+ * @param {Object} config The config object
+ * @xtype dataview
+ */
+Ext.DataView = Ext.extend(Ext.BoxComponent, {
+    /**
+     * @cfg {String/Array} tpl
+     * The HTML fragment or an array of fragments that will make up the template used by this DataView.  This should
+     * be specified in the same format expected by the constructor of {@link Ext.XTemplate}.
+     */
+    /**
+     * @cfg {Ext.data.Store} store
+     * The {@link Ext.data.Store} to bind this DataView to.
+     */
+    /**
+     * @cfg {String} itemSelector
+     * <b>This is a required setting</b>. A simple CSS selector (e.g. <tt>div.some-class</tt> or 
+     * <tt>span:first-child</tt>) that will be used to determine what nodes this DataView will be
+     * working with.
+     */
+    /**
+     * @cfg {Boolean} multiSelect
+     * True to allow selection of more than one item at a time, false to allow selection of only a single item
+     * at a time or no selection at all, depending on the value of {@link #singleSelect} (defaults to false).
+     */
+    /**
+     * @cfg {Boolean} singleSelect
+     * True to allow selection of exactly one item at a time, false to allow no selection at all (defaults to false).
+     * Note that if {@link #multiSelect} = true, this value will be ignored.
+     */
+    /**
+     * @cfg {Boolean} simpleSelect
+     * True to enable multiselection by clicking on multiple items without requiring the user to hold Shift or Ctrl,
+     * false to force the user to hold Ctrl or Shift to select more than on item (defaults to false).
+     */
+    /**
+     * @cfg {String} overClass
+     * A CSS class to apply to each item in the view on mouseover (defaults to undefined).
+     */
+    /**
+     * @cfg {String} loadingText
+     * A string to display during data load operations (defaults to undefined).  If specified, this text will be
+     * displayed in a loading div and the view's contents will be cleared while loading, otherwise the view's
+     * contents will continue to display normally until the new data is loaded and the contents are replaced.
+     */
+    /**
+     * @cfg {String} selectedClass
+     * A CSS class to apply to each selected item in the view (defaults to 'x-view-selected').
+     */
+    selectedClass : "x-view-selected",
+    /**
+     * @cfg {String} emptyText
+     * The text to display in the view when there is no data to display (defaults to '').
+     */
+    emptyText : "",
+
+    /**
+     * @cfg {Boolean} deferEmptyText True to defer emptyText being applied until the store's first load
+     */
+    deferEmptyText: true,
+    /**
+     * @cfg {Boolean} trackOver True to enable mouseenter and mouseleave events
+     */
+    trackOver: false,
+
+    //private
+    last: false,
+
+    // private
+    initComponent : function(){
+        Ext.DataView.superclass.initComponent.call(this);
+        if(Ext.isString(this.tpl) || Ext.isArray(this.tpl)){
+            this.tpl = new Ext.XTemplate(this.tpl);
+        }
+
+        this.addEvents(
+            /**
+             * @event beforeclick
+             * Fires before a click is processed. Returns false to cancel the default action.
+             * @param {Ext.DataView} this
+             * @param {Number} index The index of the target node
+             * @param {HTMLElement} node The target node
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "beforeclick",
+            /**
+             * @event click
+             * Fires when a template node is clicked.
+             * @param {Ext.DataView} this
+             * @param {Number} index The index of the target node
+             * @param {HTMLElement} node The target node
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "click",
+            /**
+             * @event mouseenter
+             * Fires when the mouse enters a template node. trackOver:true or an overCls must be set to enable this event.
+             * @param {Ext.DataView} this
+             * @param {Number} index The index of the target node
+             * @param {HTMLElement} node The target node
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "mouseenter",
+            /**
+             * @event mouseleave
+             * Fires when the mouse leaves a template node. trackOver:true or an overCls must be set to enable this event.
+             * @param {Ext.DataView} this
+             * @param {Number} index The index of the target node
+             * @param {HTMLElement} node The target node
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "mouseleave",
+            /**
+             * @event containerclick
+             * Fires when a click occurs and it is not on a template node.
+             * @param {Ext.DataView} this
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "containerclick",
+            /**
+             * @event dblclick
+             * Fires when a template node is double clicked.
+             * @param {Ext.DataView} this
+             * @param {Number} index The index of the target node
+             * @param {HTMLElement} node The target node
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "dblclick",
+            /**
+             * @event contextmenu
+             * Fires when a template node is right clicked.
+             * @param {Ext.DataView} this
+             * @param {Number} index The index of the target node
+             * @param {HTMLElement} node The target node
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "contextmenu",
+            /**
+             * @event containercontextmenu
+             * Fires when a right click occurs that is not on a template node.
+             * @param {Ext.DataView} this
+             * @param {Ext.EventObject} e The raw event object
+             */
+            "containercontextmenu",
+            /**
+             * @event selectionchange
+             * Fires when the selected nodes change.
+             * @param {Ext.DataView} this
+             * @param {Array} selections Array of the selected nodes
+             */
+            "selectionchange",
+
+            /**
+             * @event beforeselect
+             * Fires before a selection is made. If any handlers return false, the selection is cancelled.
+             * @param {Ext.DataView} this
+             * @param {HTMLElement} node The node to be selected
+             * @param {Array} selections Array of currently selected nodes
+             */
+            "beforeselect"
+        );
+
+        this.store = Ext.StoreMgr.lookup(this.store);
+        this.all = new Ext.CompositeElementLite();
+        this.selected = new Ext.CompositeElementLite();
+    },
+
+    // private
+    afterRender : function(){
+        Ext.DataView.superclass.afterRender.call(this);
+
+               this.mon(this.getTemplateTarget(), {
+            "click": this.onClick,
+            "dblclick": this.onDblClick,
+            "contextmenu": this.onContextMenu,
+            scope:this
+        });
+
+        if(this.overClass || this.trackOver){
+            this.mon(this.getTemplateTarget(), {
+                "mouseover": this.onMouseOver,
+                "mouseout": this.onMouseOut,
+                scope:this
+            });
+        }
+
+        if(this.store){
+            this.bindStore(this.store, true);
+        }
+    },
+
+    /**
+     * Refreshes the view by reloading the data from the store and re-rendering the template.
+     */
+    refresh : function(){
+        this.clearSelections(false, true);
+        var el = this.getTemplateTarget();
+        el.update("");
+        var records = this.store.getRange();
+        if(records.length < 1){
+            if(!this.deferEmptyText || this.hasSkippedEmptyText){
+                el.update(this.emptyText);
+            }
+            this.all.clear();
+        }else{
+            this.tpl.overwrite(el, this.collectData(records, 0));
+            this.all.fill(Ext.query(this.itemSelector, el.dom));
+            this.updateIndexes(0);
+        }
+        this.hasSkippedEmptyText = true;
+    },
+
+    getTemplateTarget: function(){
+        return this.el;
+    },
+
+    /**
+     * Function which can be overridden to provide custom formatting for each Record that is used by this
+     * DataView's {@link #tpl template} to render each node.
+     * @param {Array/Object} data The raw data object that was used to create the Record.
+     * @param {Number} recordIndex the index number of the Record being prepared for rendering.
+     * @param {Record} record The Record being prepared for rendering.
+     * @return {Array/Object} The formatted data in a format expected by the internal {@link #tpl template}'s overwrite() method.
+     * (either an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'}))
+     */
+    prepareData : function(data){
+        return data;
+    },
+
+    /**
+     * <p>Function which can be overridden which returns the data object passed to this
+     * DataView's {@link #tpl template} to render the whole DataView.</p>
+     * <p>This is usually an Array of data objects, each element of which is processed by an
+     * {@link Ext.XTemplate XTemplate} which uses <tt>'&lt;tpl for="."&gt;'</tt> to iterate over its supplied
+     * data object as an Array. However, <i>named</i> properties may be placed into the data object to
+     * provide non-repeating data such as headings, totals etc.</p>
+     * @param {Array} records An Array of {@link Ext.data.Record}s to be rendered into the DataView.
+     * @param {Number} startIndex the index number of the Record being prepared for rendering.
+     * @return {Array} An Array of data objects to be processed by a repeating XTemplate. May also
+     * contain <i>named</i> properties.
+     */
+    collectData : function(records, startIndex){
+        var r = [];
+        for(var i = 0, len = records.length; i < len; i++){
+            r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]);
+        }
+        return r;
+    },
+
+    // private
+    bufferRender : function(records){
+        var div = document.createElement('div');
+        this.tpl.overwrite(div, this.collectData(records));
+        return Ext.query(this.itemSelector, div);
+    },
+
+    // private
+    onUpdate : function(ds, record){
+        var index = this.store.indexOf(record);
+        var sel = this.isSelected(index);
+        var original = this.all.elements[index];
+        var node = this.bufferRender([record], index)[0];
+
+        this.all.replaceElement(index, node, true);
+        if(sel){
+            this.selected.replaceElement(original, node);
+            this.all.item(index).addClass(this.selectedClass);
+        }
+        this.updateIndexes(index, index);
+    },
+
+    // private
+    onAdd : function(ds, records, index){
+        if(this.all.getCount() === 0){
+            this.refresh();
+            return;
+        }
+        var nodes = this.bufferRender(records, index), n, a = this.all.elements;
+        if(index < this.all.getCount()){
+            n = this.all.item(index).insertSibling(nodes, 'before', true);
+            a.splice.apply(a, [index, 0].concat(nodes));
+        }else{
+            n = this.all.last().insertSibling(nodes, 'after', true);
+            a.push.apply(a, nodes);
+        }
+        this.updateIndexes(index);
+    },
+
+    // private
+    onRemove : function(ds, record, index){
+        this.deselect(index);
+        this.all.removeElement(index, true);
+        this.updateIndexes(index);
+        if (this.store.getCount() === 0){
+            this.refresh();
+        }
+    },
+
+    /**
+     * Refreshes an individual node's data from the store.
+     * @param {Number} index The item's data index in the store
+     */
+    refreshNode : function(index){
+        this.onUpdate(this.store, this.store.getAt(index));
+    },
+
+    // private
+    updateIndexes : function(startIndex, endIndex){
+        var ns = this.all.elements;
+        startIndex = startIndex || 0;
+        endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));
+        for(var i = startIndex; i <= endIndex; i++){
+            ns[i].viewIndex = i;
+        }
+    },
+    
+    /**
+     * Returns the store associated with this DataView.
+     * @return {Ext.data.Store} The store
+     */
+    getStore : function(){
+        return this.store;
+    },
+
+    /**
+     * Changes the data store bound to this view and refreshes it.
+     * @param {Store} store The store to bind to this view
+     */
+    bindStore : function(store, initial){
+        if(!initial && this.store){
+            this.store.un("beforeload", this.onBeforeLoad, this);
+            this.store.un("datachanged", this.refresh, this);
+            this.store.un("add", this.onAdd, this);
+            this.store.un("remove", this.onRemove, this);
+            this.store.un("update", this.onUpdate, this);
+            this.store.un("clear", this.refresh, this);
+            if(store !== this.store && this.store.autoDestroy){
+                this.store.destroy();
+            }
+        }
+        if(store){
+            store = Ext.StoreMgr.lookup(store);
+            store.on({
+                scope: this,
+                beforeload: this.onBeforeLoad,
+                datachanged: this.refresh,
+                add: this.onAdd,
+                remove: this.onRemove,
+                update: this.onUpdate,
+                clear: this.refresh
+            });
+        }
+        this.store = store;
+        if(store){
+            this.refresh();
+        }
+    },
+
+    /**
+     * Returns the template node the passed child belongs to, or null if it doesn't belong to one.
+     * @param {HTMLElement} node
+     * @return {HTMLElement} The template node
+     */
+    findItemFromChild : function(node){
+        return Ext.fly(node).findParent(this.itemSelector, this.getTemplateTarget());
+    },
+
+    // private
+    onClick : function(e){
+        var item = e.getTarget(this.itemSelector, this.getTemplateTarget());
+        if(item){
+            var index = this.indexOf(item);
+            if(this.onItemClick(item, index, e) !== false){
+                this.fireEvent("click", this, index, item, e);
+            }
+        }else{
+            if(this.fireEvent("containerclick", this, e) !== false){
+                this.onContainerClick(e);
+            }
+        }
+    },
+
+    onContainerClick : function(e){
+        this.clearSelections();
+    },
+
+    // private
+    onContextMenu : function(e){
+        var item = e.getTarget(this.itemSelector, this.getTemplateTarget());
+        if(item){
+            this.fireEvent("contextmenu", this, this.indexOf(item), item, e);
+        }else{
+            this.fireEvent("containercontextmenu", this, e);
+        }
+    },
+
+    // private
+    onDblClick : function(e){
+        var item = e.getTarget(this.itemSelector, this.getTemplateTarget());
+        if(item){
+            this.fireEvent("dblclick", this, this.indexOf(item), item, e);
+        }
+    },
+
+    // private
+    onMouseOver : function(e){
+        var item = e.getTarget(this.itemSelector, this.getTemplateTarget());
+        if(item && item !== this.lastItem){
+            this.lastItem = item;
+            Ext.fly(item).addClass(this.overClass);
+            this.fireEvent("mouseenter", this, this.indexOf(item), item, e);
+        }
+    },
+
+    // private
+    onMouseOut : function(e){
+        if(this.lastItem){
+            if(!e.within(this.lastItem, true, true)){
+                Ext.fly(this.lastItem).removeClass(this.overClass);
+                this.fireEvent("mouseleave", this, this.indexOf(this.lastItem), this.lastItem, e);
+                delete this.lastItem;
+            }
+        }
+    },
+
+    // private
+    onItemClick : function(item, index, e){
+        if(this.fireEvent("beforeclick", this, index, item, e) === false){
+            return false;
+        }
+        if(this.multiSelect){
+            this.doMultiSelection(item, index, e);
+            e.preventDefault();
+        }else if(this.singleSelect){
+            this.doSingleSelection(item, index, e);
+            e.preventDefault();
+        }
+        return true;
+    },
+
+    // private
+    doSingleSelection : function(item, index, e){
+        if(e.ctrlKey && this.isSelected(index)){
+            this.deselect(index);
+        }else{
+            this.select(index, false);
+        }
+    },
+
+    // private
+    doMultiSelection : function(item, index, e){
+        if(e.shiftKey && this.last !== false){
+            var last = this.last;
+            this.selectRange(last, index, e.ctrlKey);
+            this.last = last; // reset the last
+        }else{
+            if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){
+                this.deselect(index);
+            }else{
+                this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect);
+            }
+        }
+    },
+
+    /**
+     * Gets the number of selected nodes.
+     * @return {Number} The node count
+     */
+    getSelectionCount : function(){
+        return this.selected.getCount();
+    },
+
+    /**
+     * Gets the currently selected nodes.
+     * @return {Array} An array of HTMLElements
+     */
+    getSelectedNodes : function(){
+        return this.selected.elements;
+    },
+
+    /**
+     * Gets the indexes of the selected nodes.
+     * @return {Array} An array of numeric indexes
+     */
+    getSelectedIndexes : function(){
+        var indexes = [], s = this.selected.elements;
+        for(var i = 0, len = s.length; i < len; i++){
+            indexes.push(s[i].viewIndex);
+        }
+        return indexes;
+    },
+
+    /**
+     * Gets an array of the selected records
+     * @return {Array} An array of {@link Ext.data.Record} objects
+     */
+    getSelectedRecords : function(){
+        var r = [], s = this.selected.elements;
+        for(var i = 0, len = s.length; i < len; i++){
+            r[r.length] = this.store.getAt(s[i].viewIndex);
+        }
+        return r;
+    },
+
+    /**
+     * Gets an array of the records from an array of nodes
+     * @param {Array} nodes The nodes to evaluate
+     * @return {Array} records The {@link Ext.data.Record} objects
+     */
+    getRecords : function(nodes){
+        var r = [], s = nodes;
+        for(var i = 0, len = s.length; i < len; i++){
+            r[r.length] = this.store.getAt(s[i].viewIndex);
+        }
+        return r;
+    },
+
+    /**
+     * Gets a record from a node
+     * @param {HTMLElement} node The node to evaluate
+     * @return {Record} record The {@link Ext.data.Record} object
+     */
+    getRecord : function(node){
+        return this.store.getAt(node.viewIndex);
+    },
+
+    /**
+     * Clears all selections.
+     * @param {Boolean} suppressEvent (optional) True to skip firing of the selectionchange event
+     */
+    clearSelections : function(suppressEvent, skipUpdate){
+        if((this.multiSelect || this.singleSelect) && this.selected.getCount() > 0){
+            if(!skipUpdate){
+                this.selected.removeClass(this.selectedClass);
+            }
+            this.selected.clear();
+            this.last = false;
+            if(!suppressEvent){
+                this.fireEvent("selectionchange", this, this.selected.elements);
+            }
+        }
+    },
+
+    /**
+     * Returns true if the passed node is selected, else false.
+     * @param {HTMLElement/Number} node The node or node index to check
+     * @return {Boolean} True if selected, else false
+     */
+    isSelected : function(node){
+        return this.selected.contains(this.getNode(node));
+    },
+
+    /**
+     * Deselects a node.
+     * @param {HTMLElement/Number} node The node to deselect
+     */
+    deselect : function(node){
+        if(this.isSelected(node)){
+            node = this.getNode(node);
+            this.selected.removeElement(node);
+            if(this.last == node.viewIndex){
+                this.last = false;
+            }
+            Ext.fly(node).removeClass(this.selectedClass);
+            this.fireEvent("selectionchange", this, this.selected.elements);
+        }
+    },
+
+    /**
+     * Selects a set of nodes.
+     * @param {Array/HTMLElement/String/Number} nodeInfo An HTMLElement template node, index of a template node,
+     * id of a template node or an array of any of those to select
+     * @param {Boolean} keepExisting (optional) true to keep existing selections
+     * @param {Boolean} suppressEvent (optional) true to skip firing of the selectionchange vent
+     */
+    select : function(nodeInfo, keepExisting, suppressEvent){
+        if(Ext.isArray(nodeInfo)){
+            if(!keepExisting){
+                this.clearSelections(true);
+            }
+            for(var i = 0, len = nodeInfo.length; i < len; i++){
+                this.select(nodeInfo[i], true, true);
+            }
+            if(!suppressEvent){
+                this.fireEvent("selectionchange", this, this.selected.elements);
+            }
+        } else{
+            var node = this.getNode(nodeInfo);
+            if(!keepExisting){
+                this.clearSelections(true);
+            }
+            if(node && !this.isSelected(node)){
+                if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){
+                    Ext.fly(node).addClass(this.selectedClass);
+                    this.selected.add(node);
+                    this.last = node.viewIndex;
+                    if(!suppressEvent){
+                        this.fireEvent("selectionchange", this, this.selected.elements);
+                    }
+                }
+            }
+        }
+    },
+
+    /**
+     * Selects a range of nodes. All nodes between start and end are selected.
+     * @param {Number} start The index of the first node in the range
+     * @param {Number} end The index of the last node in the range
+     * @param {Boolean} keepExisting (optional) True to retain existing selections
+     */
+    selectRange : function(start, end, keepExisting){
+        if(!keepExisting){
+            this.clearSelections(true);
+        }
+        this.select(this.getNodes(start, end), true);
+    },
+
+    /**
+     * Gets a template node.
+     * @param {HTMLElement/String/Number} nodeInfo An HTMLElement template node, index of a template node or the id of a template node
+     * @return {HTMLElement} The node or null if it wasn't found
+     */
+    getNode : function(nodeInfo){
+        if(Ext.isString(nodeInfo)){
+            return document.getElementById(nodeInfo);
+        }else if(Ext.isNumber(nodeInfo)){
+            return this.all.elements[nodeInfo];
+        }
+        return nodeInfo;
+    },
+
+    /**
+     * Gets a range nodes.
+     * @param {Number} start (optional) The index of the first node in the range
+     * @param {Number} end (optional) The index of the last node in the range
+     * @return {Array} An array of nodes
+     */
+    getNodes : function(start, end){
+        var ns = this.all.elements;
+        start = start || 0;
+        end = !Ext.isDefined(end) ? Math.max(ns.length - 1, 0) : end;
+        var nodes = [], i;
+        if(start <= end){
+            for(i = start; i <= end && ns[i]; i++){
+                nodes.push(ns[i]);
+            }
+        } else{
+            for(i = start; i >= end && ns[i]; i--){
+                nodes.push(ns[i]);
+            }
+        }
+        return nodes;
+    },
+
+    /**
+     * Finds the index of the passed node.
+     * @param {HTMLElement/String/Number} nodeInfo An HTMLElement template node, index of a template node or the id of a template node
+     * @return {Number} The index of the node or -1
+     */
+    indexOf : function(node){
+        node = this.getNode(node);
+        if(Ext.isNumber(node.viewIndex)){
+            return node.viewIndex;
+        }
+        return this.all.indexOf(node);
+    },
+
+    // private
+    onBeforeLoad : function(){
+        if(this.loadingText){
+            this.clearSelections(false, true);
+            this.getTemplateTarget().update('<div class="loading-indicator">'+this.loadingText+'</div>');
+            this.all.clear();
+        }
+    },
+
+    onDestroy : function(){
+        Ext.DataView.superclass.onDestroy.call(this);
+        this.bindStore(null);
+    }
+});
+
+/**
+ * Changes the data store bound to this view and refreshes it. (deprecated in favor of bindStore)
+ * @param {Store} store The store to bind to this view
+ */
+Ext.DataView.prototype.setStore = Ext.DataView.prototype.bindStore;
+
+Ext.reg('dataview', Ext.DataView);/**\r
+ * @class Ext.ListView\r
+ * @extends Ext.DataView\r
+ * <p>Ext.ListView is a fast and light-weight implentation of a\r
+ * {@link Ext.grid.GridPanel Grid} like view with the following characteristics:</p>\r
+ * <div class="mdetail-params"><ul>\r
+ * <li>resizable columns</li>\r
+ * <li>selectable</li>\r
+ * <li>column widths are initially proportioned by percentage based on the container\r
+ * width and number of columns</li>\r
+ * <li>uses templates to render the data in any required format</li>\r
+ * <li>no horizontal scrolling</li>\r
+ * <li>no editing</li>\r
+ * </ul></div>\r
+ * <p>Example usage:</p>\r
+ * <pre><code>\r
+// consume JSON of this form:\r
+{\r
+   "images":[\r
+      {\r
+         "name":"dance_fever.jpg",\r
+         "size":2067,\r
+         "lastmod":1236974993000,\r
+         "url":"images\/thumbs\/dance_fever.jpg"\r
+      },\r
+      {\r
+         "name":"zack_sink.jpg",\r
+         "size":2303,\r
+         "lastmod":1236974993000,\r
+         "url":"images\/thumbs\/zack_sink.jpg"\r
+      }\r
+   ]\r
+} \r
+var store = new Ext.data.JsonStore({\r
+    url: 'get-images.php',\r
+    root: 'images',\r
+    fields: [\r
+        'name', 'url',\r
+        {name:'size', type: 'float'},\r
+        {name:'lastmod', type:'date', dateFormat:'timestamp'}\r
+    ]\r
+});\r
+store.load();\r
+\r
+var listView = new Ext.ListView({\r
+    store: store,\r
+    multiSelect: true,\r
+    emptyText: 'No images to display',\r
+    reserveScrollOffset: true,\r
+    columns: [{\r
+        header: 'File',\r
+        width: .5,\r
+        dataIndex: 'name'\r
+    },{\r
+        header: 'Last Modified',\r
+        width: .35, \r
+        dataIndex: 'lastmod',\r
+        tpl: '{lastmod:date("m-d h:i a")}'\r
+    },{\r
+        header: 'Size',\r
+        dataIndex: 'size',\r
+        tpl: '{size:fileSize}', // format using Ext.util.Format.fileSize()\r
+        align: 'right'\r
+    }]\r
+});\r
 \r
-    \r
-    onContainerOver : function(dd, e, data){\r
-        return this.dropNotAllowed;\r
+// put it in a Panel so it looks pretty\r
+var panel = new Ext.Panel({\r
+    id:'images-view',\r
+    width:425,\r
+    height:250,\r
+    collapsible:true,\r
+    layout:'fit',\r
+    title:'Simple ListView <i>(0 items selected)</i>',\r
+    items: listView\r
+});\r
+panel.render(document.body);\r
+\r
+// little bit of feedback\r
+listView.on('selectionchange', function(view, nodes){\r
+    var l = nodes.length;\r
+    var s = l != 1 ? 's' : '';\r
+    panel.setTitle('Simple ListView <i>('+l+' item'+s+' selected)</i>');\r
+});\r
+ * </code></pre>\r
+ * @constructor\r
+ * @param {Object} config\r
+ * @xtype listview\r
+ */\r
+Ext.ListView = Ext.extend(Ext.DataView, {\r
+    /**\r
+     * Set this property to <tt>true</tt> to disable the header click handler disabling sort\r
+     * (defaults to <tt>false</tt>).\r
+     * @type Boolean\r
+     * @property disableHeaders\r
+     */\r
+    /**\r
+     * @cfg {Boolean} hideHeaders\r
+     * <tt>true</tt> to hide the {@link #internalTpl header row} (defaults to <tt>false</tt> so\r
+     * the {@link #internalTpl header row} will be shown).\r
+     */\r
+    /**\r
+     * @cfg {String} itemSelector\r
+     * Defaults to <tt>'dl'</tt> to work with the preconfigured <b><tt>{@link Ext.DataView#tpl tpl}</tt></b>.\r
+     * This setting specifies the CSS selector (e.g. <tt>div.some-class</tt> or <tt>span:first-child</tt>)\r
+     * that will be used to determine what nodes the ListView will be working with.   \r
+     */\r
+    itemSelector: 'dl',\r
+    /**\r
+     * @cfg {String} selectedClass The CSS class applied to a selected row (defaults to\r
+     * <tt>'x-list-selected'</tt>). An example overriding the default styling:\r
+    <pre><code>\r
+    .x-list-selected {background-color: yellow;}\r
+    </code></pre>\r
+     * @type String\r
+     */\r
+    selectedClass:'x-list-selected',\r
+    /**\r
+     * @cfg {String} overClass The CSS class applied when over a row (defaults to\r
+     * <tt>'x-list-over'</tt>). An example overriding the default styling:\r
+    <pre><code>\r
+    .x-list-over {background-color: orange;}\r
+    </code></pre>\r
+     * @type String\r
+     */\r
+    overClass:'x-list-over',\r
+    /**\r
+     * @cfg {Boolean} reserveScrollOffset\r
+     * By default will defer accounting for the configured <b><tt>{@link #scrollOffset}</tt></b>\r
+     * for 10 milliseconds.  Specify <tt>true</tt> to account for the configured\r
+     * <b><tt>{@link #scrollOffset}</tt></b> immediately.\r
+     */\r
+    /**\r
+     * @cfg {Number} scrollOffset The amount of space to reserve for the scrollbar (defaults to\r
+     * <tt>19</tt> pixels)\r
+     */\r
+    scrollOffset : 19,\r
+    /**\r
+     * @cfg {Boolean/Object} columnResize\r
+     * Specify <tt>true</tt> or specify a configuration object for {@link Ext.ListView.ColumnResizer}\r
+     * to enable the columns to be resizable (defaults to <tt>true</tt>).\r
+     */\r
+    columnResize: true,\r
+    /**\r
+     * @cfg {Array} columns An array of column configuration objects, for example:\r
+     * <pre><code>\r
+{\r
+    align: 'right',\r
+    dataIndex: 'size',\r
+    header: 'Size',\r
+    tpl: '{size:fileSize}',\r
+    width: .35\r
+}\r
+     * </code></pre> \r
+     * Acceptable properties for each column configuration object are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>align</tt></b> : String<div class="sub-desc">Set the CSS text-align property\r
+     * of the column. Defaults to <tt>'left'</tt>.</div></li>\r
+     * <li><b><tt>dataIndex</tt></b> : String<div class="sub-desc">See {@link Ext.grid.Column}.\r
+     * {@link Ext.grid.Column#dataIndex dataIndex} for details.</div></li>\r
+     * <li><b><tt>header</tt></b> : String<div class="sub-desc">See {@link Ext.grid.Column}.\r
+     * {@link Ext.grid.Column#header header} for details.</div></li>\r
+     * <li><b><tt>tpl</tt></b> : String<div class="sub-desc">Specify a string to pass as the\r
+     * configuration string for {@link Ext.XTemplate}.  By default an {@link Ext.XTemplate}\r
+     * will be implicitly created using the <tt>dataIndex</tt>.</div></li>\r
+     * <li><b><tt>width</tt></b> : Number<div class="sub-desc">Percentage of the container width\r
+     * this column should be allocated.  Columns that have no width specified will be\r
+     * allocated with an equal percentage to fill 100% of the container width.  To easily take\r
+     * advantage of the full container width, leave the width of at least one column undefined.\r
+     * Note that if you do not want to take up the full width of the container, the width of\r
+     * every column needs to be explicitly defined.</div></li>\r
+     * </ul></div>\r
+     */\r
+    /**\r
+     * @cfg {Boolean/Object} columnSort\r
+     * Specify <tt>true</tt> or specify a configuration object for {@link Ext.ListView.Sorter}\r
+     * to enable the columns to be sortable (defaults to <tt>true</tt>).\r
+     */\r
+    columnSort: true,\r
+    /**\r
+     * @cfg {String/Array} internalTpl\r
+     * The template to be used for the header row.  See {@link #tpl} for more details.\r
+     */\r
+\r
+    initComponent : function(){\r
+        if(this.columnResize){\r
+            this.colResizer = new Ext.ListView.ColumnResizer(this.colResizer);\r
+            this.colResizer.init(this);\r
+        }\r
+        if(this.columnSort){\r
+            this.colSorter = new Ext.ListView.Sorter(this.columnSort);\r
+            this.colSorter.init(this);\r
+        }\r
+        if(!this.internalTpl){\r
+            this.internalTpl = new Ext.XTemplate(\r
+                '<div class="x-list-header"><div class="x-list-header-inner">',\r
+                    '<tpl for="columns">',\r
+                    '<div style="width:{width}%;text-align:{align};"><em unselectable="on" id="',this.id, '-xlhd-{#}">',\r
+                        '{header}',\r
+                    '</em></div>',\r
+                    '</tpl>',\r
+                    '<div class="x-clear"></div>',\r
+                '</div></div>',\r
+                '<div class="x-list-body"><div class="x-list-body-inner">',\r
+                '</div></div>'\r
+            );\r
+        }\r
+        if(!this.tpl){\r
+            this.tpl = new Ext.XTemplate(\r
+                '<tpl for="rows">',\r
+                    '<dl>',\r
+                        '<tpl for="parent.columns">',\r
+                        '<dt style="width:{width}%;text-align:{align};"><em unselectable="on">',\r
+                            '{[values.tpl.apply(parent)]}',\r
+                        '</em></dt>',\r
+                        '</tpl>',\r
+                        '<div class="x-clear"></div>',\r
+                    '</dl>',\r
+                '</tpl>'\r
+            );\r
+        };\r
+        var cs = this.columns, allocatedWidth = 0, colsWithWidth = 0, len = cs.length;\r
+        for(var i = 0; i < len; i++){\r
+            var c = cs[i];\r
+            if(!c.tpl){\r
+                c.tpl = new Ext.XTemplate('{' + c.dataIndex + '}');\r
+            }else if(Ext.isString(c.tpl)){\r
+                c.tpl = new Ext.XTemplate(c.tpl);\r
+            }\r
+            c.align = c.align || 'left';\r
+            if(Ext.isNumber(c.width)){\r
+                c.width *= 100;\r
+                allocatedWidth += c.width;\r
+                colsWithWidth++;\r
+            }\r
+        }\r
+        // auto calculate missing column widths\r
+        if(colsWithWidth < len){\r
+            var remaining = len - colsWithWidth;\r
+            if(allocatedWidth < 100){\r
+                var perCol = ((100-allocatedWidth) / remaining);\r
+                for(var j = 0; j < len; j++){\r
+                    var c = cs[j];\r
+                    if(!Ext.isNumber(c.width)){\r
+                        c.width = perCol;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        Ext.ListView.superclass.initComponent.call(this);\r
     },\r
 \r
-    \r
-    onContainerDrop : function(dd, e, data){\r
-        return false;\r
+    onRender : function(){\r
+        Ext.ListView.superclass.onRender.apply(this, arguments);\r
+\r
+        this.internalTpl.overwrite(this.el, {columns: this.columns});\r
+        \r
+        this.innerBody = Ext.get(this.el.dom.childNodes[1].firstChild);\r
+        this.innerHd = Ext.get(this.el.dom.firstChild.firstChild);\r
+\r
+        if(this.hideHeaders){\r
+            this.el.dom.firstChild.style.display = 'none';\r
+        }\r
+    },\r
+\r
+    getTemplateTarget : function(){\r
+        return this.innerBody;\r
+    },\r
+\r
+    /**\r
+     * <p>Function which can be overridden which returns the data object passed to this\r
+     * view's {@link #tpl template} to render the whole ListView. The returned object \r
+     * shall contain the following properties:</p>\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b>columns</b> : String<div class="sub-desc">See <tt>{@link #columns}</tt></div></li>\r
+     * <li><b>rows</b> : String<div class="sub-desc">See\r
+     * <tt>{@link Ext.DataView}.{@link Ext.DataView#collectData collectData}</div></li>\r
+     * </ul></div>\r
+     * @param {Array} records An Array of {@link Ext.data.Record}s to be rendered into the DataView.\r
+     * @param {Number} startIndex the index number of the Record being prepared for rendering.\r
+     * @return {Object} A data object containing properties to be processed by a repeating\r
+     * XTemplate as described above.\r
+     */\r
+    collectData : function(){\r
+        var rs = Ext.ListView.superclass.collectData.apply(this, arguments);\r
+        return {\r
+            columns: this.columns,\r
+            rows: rs\r
+        }\r
     },\r
 \r
-    \r
-    notifyEnter : function(dd, e, data){\r
-        return this.dropNotAllowed;\r
+    verifyInternalSize : function(){\r
+        if(this.lastSize){\r
+            this.onResize(this.lastSize.width, this.lastSize.height);\r
+        }\r
     },\r
 \r
-    \r
-    notifyOver : function(dd, e, data){\r
-        var n = this.getTargetFromEvent(e);\r
-        if(!n){ // not over valid drop target\r
-            if(this.lastOverNode){\r
-                this.onNodeOut(this.lastOverNode, dd, e, data);\r
-                this.lastOverNode = null;\r
-            }\r
-            return this.onContainerOver(dd, e, data);\r
+    // private\r
+    onResize : function(w, h){\r
+        var bd = this.innerBody.dom;\r
+        var hd = this.innerHd.dom\r
+        if(!bd){\r
+            return;\r
         }\r
-        if(this.lastOverNode != n){\r
-            if(this.lastOverNode){\r
-                this.onNodeOut(this.lastOverNode, dd, e, data);\r
+        var bdp = bd.parentNode;\r
+        if(Ext.isNumber(w)){\r
+            var sw = w - this.scrollOffset;\r
+            if(this.reserveScrollOffset || ((bdp.offsetWidth - bdp.clientWidth) > 10)){\r
+                bd.style.width = sw + 'px';\r
+                hd.style.width = sw + 'px';\r
+            }else{\r
+                bd.style.width = w + 'px';\r
+                hd.style.width = w + 'px';\r
+                setTimeout(function(){\r
+                    if((bdp.offsetWidth - bdp.clientWidth) > 10){\r
+                        bd.style.width = sw + 'px';\r
+                        hd.style.width = sw + 'px';\r
+                    }\r
+                }, 10);\r
             }\r
-            this.onNodeEnter(n, dd, e, data);\r
-            this.lastOverNode = n;\r
         }\r
-        return this.onNodeOver(n, dd, e, data);\r
+        if(Ext.isNumber(h == 'number')){\r
+            bdp.style.height = (h - hd.parentNode.offsetHeight) + 'px';\r
+        }\r
     },\r
 \r
-    \r
-    notifyOut : function(dd, e, data){\r
-        if(this.lastOverNode){\r
-            this.onNodeOut(this.lastOverNode, dd, e, data);\r
-            this.lastOverNode = null;\r
-        }\r
+    updateIndexes : function(){\r
+        Ext.ListView.superclass.updateIndexes.apply(this, arguments);\r
+        this.verifyInternalSize();\r
     },\r
 \r
-    \r
-    notifyDrop : function(dd, e, data){\r
-        if(this.lastOverNode){\r
-            this.onNodeOut(this.lastOverNode, dd, e, data);\r
-            this.lastOverNode = null;\r
+    findHeaderIndex : function(hd){\r
+        hd = hd.dom || hd;\r
+        var pn = hd.parentNode, cs = pn.parentNode.childNodes;\r
+        for(var i = 0, c; c = cs[i]; i++){\r
+            if(c == pn){\r
+                return i;\r
+            }\r
         }\r
-        var n = this.getTargetFromEvent(e);\r
-        return n ?\r
-            this.onNodeDrop(n, dd, e, data) :\r
-            this.onContainerDrop(dd, e, data);\r
+        return -1;\r
     },\r
 \r
-    // private\r
-    triggerCacheRefresh : function(){\r
-        Ext.dd.DDM.refreshCache(this.groups);\r
-    }  \r
+    setHdWidths : function(){\r
+        var els = this.innerHd.dom.getElementsByTagName('div');\r
+        for(var i = 0, cs = this.columns, len = cs.length; i < len; i++){\r
+            els[i].style.width = cs[i].width + '%';\r
+        }\r
+    }\r
 });\r
 \r
+Ext.reg('listview', Ext.ListView);/**\r
+ * @class Ext.ListView.ColumnResizer\r
+ * @extends Ext.util.Observable\r
+ * <p>Supporting Class for Ext.ListView.</p>\r
+ * @constructor\r
+ * @param {Object} config\r
+ */\r
+Ext.ListView.ColumnResizer = Ext.extend(Ext.util.Observable, {\r
+    /**\r
+     * @cfg {Number} minPct The minimum percentage to allot for any column (defaults to <tt>.05</tt>)\r
+     */\r
+    minPct: .05,\r
 \r
-Ext.data.SortTypes = {\r
-    \r
-    none : function(s){\r
-        return s;\r
-    },\r
-    \r
-    \r
-    stripTagsRE : /<\/?[^>]+>/gi,\r
-    \r
-    \r
-    asText : function(s){\r
-        return String(s).replace(this.stripTagsRE, "");\r
+    constructor: function(config){\r
+        Ext.apply(this, config);\r
+        Ext.ListView.ColumnResizer.superclass.constructor.call(this);\r
     },\r
-    \r
-    \r
-    asUCText : function(s){\r
-        return String(s).toUpperCase().replace(this.stripTagsRE, "");\r
+    init : function(listView){\r
+        this.view = listView;\r
+        listView.on('render', this.initEvents, this);\r
     },\r
-    \r
-    \r
-    asUCString : function(s) {\r
-       return String(s).toUpperCase();\r
+\r
+    initEvents : function(view){\r
+        view.mon(view.innerHd, 'mousemove', this.handleHdMove, this);\r
+        this.tracker = new Ext.dd.DragTracker({\r
+            onBeforeStart: this.onBeforeStart.createDelegate(this),\r
+            onStart: this.onStart.createDelegate(this),\r
+            onDrag: this.onDrag.createDelegate(this),\r
+            onEnd: this.onEnd.createDelegate(this),\r
+            tolerance: 3,\r
+            autoStart: 300\r
+        });\r
+        this.tracker.initEl(view.innerHd);\r
+        view.on('beforedestroy', this.tracker.destroy, this.tracker);\r
     },\r
-    \r
-    \r
-    asDate : function(s) {\r
-        if(!s){\r
-            return 0;\r
+\r
+    handleHdMove : function(e, t){\r
+        var hw = 5;\r
+        var x = e.getPageX();\r
+        var hd = e.getTarget('em', 3, true);\r
+        if(hd){\r
+            var r = hd.getRegion();\r
+            var ss = hd.dom.style;\r
+            var pn = hd.dom.parentNode;\r
+\r
+            if(x - r.left <= hw && pn != pn.parentNode.firstChild){\r
+                this.activeHd = Ext.get(pn.previousSibling.firstChild);\r
+                               ss.cursor = Ext.isWebKit ? 'e-resize' : 'col-resize';\r
+            } else if(r.right - x <= hw && pn != pn.parentNode.lastChild.previousSibling){\r
+                this.activeHd = hd;\r
+                               ss.cursor = Ext.isWebKit ? 'w-resize' : 'col-resize';\r
+            } else{\r
+                delete this.activeHd;\r
+                ss.cursor = '';\r
+            }\r
         }\r
-        if(Ext.isDate(s)){\r
-            return s.getTime();\r
-        }\r
-       return Date.parse(String(s));\r
     },\r
-    \r
-    \r
-    asFloat : function(s) {\r
-       var val = parseFloat(String(s).replace(/,/g, ""));\r
-        if(isNaN(val)) val = 0;\r
-       return val;\r
+\r
+    onBeforeStart : function(e){\r
+        this.dragHd = this.activeHd;\r
+        return !!this.dragHd;\r
     },\r
-    \r
-    \r
-    asInt : function(s) {\r
-        var val = parseInt(String(s).replace(/,/g, ""));\r
-        if(isNaN(val)) val = 0;\r
-       return val;\r
-    }\r
-};\r
 \r
-Ext.data.Record = function(data, id){\r
-    this.id = (id || id === 0) ? id : ++Ext.data.Record.AUTO_ID;\r
-    this.data = data;\r
-};\r
+    onStart: function(e){\r
+        this.view.disableHeaders = true;\r
+        this.proxy = this.view.el.createChild({cls:'x-list-resizer'});\r
+        this.proxy.setHeight(this.view.el.getHeight());\r
 \r
+        var x = this.tracker.getXY()[0];\r
+        var w = this.view.innerHd.getWidth();\r
 \r
-Ext.data.Record.create = function(o){\r
-    var f = Ext.extend(Ext.data.Record, {});\r
-    var p = f.prototype;\r
-    p.fields = new Ext.util.MixedCollection(false, function(field){\r
-        return field.name;\r
-    });\r
-    for(var i = 0, len = o.length; i < len; i++){\r
-        p.fields.add(new Ext.data.Field(o[i]));\r
-    }\r
-    f.getField = function(name){\r
-        return p.fields.get(name);\r
-    };\r
-    return f;\r
-};\r
+        this.hdX = this.dragHd.getX();\r
+        this.hdIndex = this.view.findHeaderIndex(this.dragHd);\r
 \r
-Ext.data.Record.AUTO_ID = 1000;\r
-Ext.data.Record.EDIT = 'edit';\r
-Ext.data.Record.REJECT = 'reject';\r
-Ext.data.Record.COMMIT = 'commit';\r
+        this.proxy.setX(this.hdX);\r
+        this.proxy.setWidth(x-this.hdX);\r
 \r
-Ext.data.Record.prototype = {\r
-    \r
-    \r
-    \r
-    \r
-    dirty : false,\r
-    editing : false,\r
-    error: null,\r
-    \r
-    modified: null,\r
+        this.minWidth = w*this.minPct;\r
+        this.maxWidth = w - (this.minWidth*(this.view.columns.length-1-this.hdIndex));\r
+    },\r
 \r
-    // private\r
-    join : function(store){\r
-        this.store = store;\r
+    onDrag: function(e){\r
+        var cursorX = this.tracker.getXY()[0];\r
+        this.proxy.setWidth((cursorX-this.hdX).constrain(this.minWidth, this.maxWidth));\r
     },\r
 \r
-    \r
-    set : function(name, value){\r
-        if(String(this.data[name]) == String(value)){\r
-            return;\r
-        }\r
-        this.dirty = true;\r
-        if(!this.modified){\r
-            this.modified = {};\r
-        }\r
-        if(typeof this.modified[name] == 'undefined'){\r
-            this.modified[name] = this.data[name];\r
-        }\r
-        this.data[name] = value;\r
-        if(!this.editing && this.store){\r
-            this.store.afterEdit(this);\r
+    onEnd: function(e){\r
+        var nw = this.proxy.getWidth();\r
+        this.proxy.remove();\r
+\r
+        var index = this.hdIndex;\r
+        var vw = this.view, cs = vw.columns, len = cs.length;\r
+        var w = this.view.innerHd.getWidth(), minPct = this.minPct * 100;\r
+\r
+        var pct = Math.ceil((nw*100) / w);\r
+        var diff = cs[index].width - pct;\r
+        var each = Math.floor(diff / (len-1-index));\r
+        var mod = diff - (each * (len-1-index));\r
+\r
+        for(var i = index+1; i < len; i++){\r
+            var cw = cs[i].width + each;\r
+            var ncw = Math.max(minPct, cw);\r
+            if(cw != ncw){\r
+                mod += cw - ncw;\r
+            }\r
+            cs[i].width = ncw;\r
         }\r
-    },\r
+        cs[index].width = pct;\r
+        cs[index+1].width += mod;\r
+        delete this.dragHd;\r
+        this.view.setHdWidths();\r
+        this.view.refresh();\r
+        setTimeout(function(){\r
+            vw.disableHeaders = false;\r
+        }, 100);\r
+    }\r
+});/**\r
+ * @class Ext.ListView.Sorter\r
+ * @extends Ext.util.Observable\r
+ * <p>Supporting Class for Ext.ListView.</p>\r
+ * @constructor\r
+ * @param {Object} config\r
+ */\r
+Ext.ListView.Sorter = Ext.extend(Ext.util.Observable, {\r
+    /**\r
+     * @cfg {Array} sortClasses\r
+     * The CSS classes applied to a header when it is sorted. (defaults to <tt>["sort-asc", "sort-desc"]</tt>)\r
+     */\r
+    sortClasses : ["sort-asc", "sort-desc"],\r
 \r
-    \r
-    get : function(name){\r
-        return this.data[name];\r
+    constructor: function(config){\r
+        Ext.apply(this, config);\r
+        Ext.ListView.Sorter.superclass.constructor.call(this);\r
     },\r
 \r
-    \r
-    beginEdit : function(){\r
-        this.editing = true;\r
-        this.modified = {};\r
+    init : function(listView){\r
+        this.view = listView;\r
+        listView.on('render', this.initEvents, this);\r
     },\r
 \r
-    \r
-    cancelEdit : function(){\r
-        this.editing = false;\r
-        delete this.modified;\r
+    initEvents : function(view){\r
+        view.mon(view.innerHd, 'click', this.onHdClick, this);\r
+        view.innerHd.setStyle('cursor', 'pointer');\r
+        view.mon(view.store, 'datachanged', this.updateSortState, this);\r
+        this.updateSortState.defer(10, this, [view.store]);\r
     },\r
 \r
-    \r
-    endEdit : function(){\r
-        this.editing = false;\r
-        if(this.dirty && this.store){\r
-            this.store.afterEdit(this);\r
+    updateSortState : function(store){\r
+        var state = store.getSortState();\r
+        if(!state){\r
+            return;\r
         }\r
-    },\r
-\r
-    \r
-    reject : function(silent){\r
-        var m = this.modified;\r
-        for(var n in m){\r
-            if(typeof m[n] != "function"){\r
-                this.data[n] = m[n];\r
+        this.sortState = state;\r
+        var cs = this.view.columns, sortColumn = -1;\r
+        for(var i = 0, len = cs.length; i < len; i++){\r
+            if(cs[i].dataIndex == state.field){\r
+                sortColumn = i;\r
+                break;\r
             }\r
         }\r
-        this.dirty = false;\r
-        delete this.modified;\r
-        this.editing = false;\r
-        if(this.store && silent !== true){\r
-            this.store.afterReject(this);\r
+        if(sortColumn != -1){\r
+            var sortDir = state.direction;\r
+            this.updateSortIcon(sortColumn, sortDir);\r
         }\r
     },\r
 \r
-    \r
-    commit : function(silent){\r
-        this.dirty = false;\r
-        delete this.modified;\r
-        this.editing = false;\r
-        if(this.store && silent !== true){\r
-            this.store.afterCommit(this);\r
-        }\r
+    updateSortIcon : function(col, dir){\r
+        var sc = this.sortClasses;\r
+        var hds = this.view.innerHd.select('em').removeClass(sc);\r
+        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);\r
     },\r
 \r
-    \r
-    getChanges : function(){\r
-        var m = this.modified, cs = {};\r
-        for(var n in m){\r
-            if(m.hasOwnProperty(n)){\r
-                cs[n] = this.data[n];\r
-            }\r
+    onHdClick : function(e){\r
+        var hd = e.getTarget('em', 3);\r
+        if(hd && !this.view.disableHeaders){\r
+            var index = this.view.findHeaderIndex(hd);\r
+            this.view.store.sort(this.view.columns[index].dataIndex);\r
         }\r
-        return cs;\r
-    },\r
+    }\r
+});/**
+ * @class Ext.TabPanel
+ * <p>A basic tab container. TabPanels can be used exactly like a standard {@link Ext.Panel}
+ * for layout purposes, but also have special support for containing child Components
+ * (<tt>{@link Ext.Container#items items}</tt>) that are managed using a
+ * {@link Ext.layout.CardLayout CardLayout layout manager}, and displayed as separate tabs.</p>
+ *
+ * <b>Note:</b> By default, a tab's close tool <i>destroys</i> the child tab Component
+ * and all its descendants. This makes the child tab Component, and all its descendants <b>unusable</b>. To enable
+ * re-use of a tab, configure the TabPanel with <b><code>{@link #autoDestroy autoDestroy: false}</code></b>.
+ *
+ * <p><b><u>TabPanel header/footer elements</u></b></p>
+ * <p>TabPanels use their {@link Ext.Panel#header header} or {@link Ext.Panel#footer footer} element
+ * (depending on the {@link #tabPosition} configuration) to accommodate the tab selector buttons.
+ * This means that a TabPanel will not display any configured title, and will not display any
+ * configured header {@link Ext.Panel#tools tools}.</p>
+ * <p>To display a header, embed the TabPanel in a {@link Ext.Panel Panel} which uses
+ * <b><tt>{@link Ext.Container#layout layout:'fit'}</tt></b>.</p>
+ *
+ * <p><b><u>Tab Events</u></b></p>
+ * <p>There is no actual tab class &mdash; each tab is simply a {@link Ext.BoxComponent Component}
+ * such as a {@link Ext.Panel Panel}. However, when rendered in a TabPanel, each child Component
+ * can fire additional events that only exist for tabs and are not available from other Components.
+ * These events are:</p>
+ * <div><ul class="mdetail-params">
+ * <li><tt><b>{@link Ext.Panel#activate activate}</b></tt> : Fires when this Component becomes
+ * the active tab.</li>
+ * <li><tt><b>{@link Ext.Panel#deactivate deactivate}</b></tt> : Fires when the Component that
+ * was the active tab becomes deactivated.</li>
+ * </ul></div>
+ * <p><b><u>Creating TabPanels from Code</u></b></p>
+ * <p>TabPanels can be created and rendered completely in code, as in this example:</p>
+ * <pre><code>
+var tabs = new Ext.TabPanel({
+    renderTo: Ext.getBody(),
+    activeTab: 0,
+    items: [{
+        title: 'Tab 1',
+        html: 'A simple tab'
+    },{
+        title: 'Tab 2',
+        html: 'Another one'
+    }]
+});
+</code></pre>
+ * <p><b><u>Creating TabPanels from Existing Markup</u></b></p>
+ * <p>TabPanels can also be rendered from pre-existing markup in a couple of ways.</p>
+ * <div><ul class="mdetail-params">
+ *
+ * <li>Pre-Structured Markup</li>
+ * <div class="sub-desc">
+ * <p>A container div with one or more nested tab divs with class <tt>'x-tab'</tt> can be rendered entirely
+ * from existing markup (See the {@link #autoTabs} example).</p>
+ * </div>
+ *
+ * <li>Un-Structured Markup</li>
+ * <div class="sub-desc">
+ * <p>A TabPanel can also be rendered from markup that is not strictly structured by simply specifying by id
+ * which elements should be the container and the tabs. Using this method tab content can be pulled from different
+ * elements within the page by id regardless of page structure. For example:</p>
+ * <pre><code>
+var tabs = new Ext.TabPanel({
+    renderTo: 'my-tabs',
+    activeTab: 0,
+    items:[
+        {contentEl:'tab1', title:'Tab 1'},
+        {contentEl:'tab2', title:'Tab 2'}
+    ]
+});
+
+// Note that the tabs do not have to be nested within the container (although they can be)
+&lt;div id="my-tabs">&lt;/div>
+&lt;div id="tab1" class="x-hide-display">A simple tab&lt;/div>
+&lt;div id="tab2" class="x-hide-display">Another one&lt;/div>
+</code></pre>
+ * Note that the tab divs in this example contain the class <tt>'x-hide-display'</tt> so that they can be rendered
+ * deferred without displaying outside the tabs. You could alternately set <tt>{@link #deferredRender} = false </tt>
+ * to render all content tabs on page load.
+ * </div>
+ *
+ * </ul></div>
+ *
+ * @extends Ext.Panel
+ * @constructor
+ * @param {Object} config The configuration options
+ * @xtype tabpanel
+ */
+Ext.TabPanel = Ext.extend(Ext.Panel,  {
+    /**
+     * @cfg {Boolean} layoutOnTabChange
+     * Set to true to force a layout of the active tab when the tab is changed. Defaults to false.
+     * See {@link Ext.layout.CardLayout}.<code>{@link Ext.layout.CardLayout#layoutOnCardChange layoutOnCardChange}</code>.
+     */
+    /**
+     * @cfg {String} tabCls <b>This config option is used on <u>child Components</u> of ths TabPanel.</b> A CSS
+     * class name applied to the tab strip item representing the child Component, allowing special
+     * styling to be applied.
+     */
+    /**
+     * @cfg {Boolean} monitorResize True to automatically monitor window resize events and rerender the layout on
+     * browser resize (defaults to true).
+     */
+    monitorResize : true,
+    /**
+     * @cfg {Boolean} deferredRender
+     * <p><tt>true</tt> by default to defer the rendering of child <tt>{@link Ext.Container#items items}</tt>
+     * to the browsers DOM until a tab is activated. <tt>false</tt> will render all contained
+     * <tt>{@link Ext.Container#items items}</tt> as soon as the {@link Ext.layout.CardLayout layout}
+     * is rendered. If there is a significant amount of content or a lot of heavy controls being
+     * rendered into panels that are not displayed by default, setting this to <tt>true</tt> might
+     * improve performance.</p>
+     * <br><p>The <tt>deferredRender</tt> property is internally passed to the layout manager for
+     * TabPanels ({@link Ext.layout.CardLayout}) as its {@link Ext.layout.CardLayout#deferredRender}
+     * configuration value.</p>
+     * <br><p><b>Note</b>: leaving <tt>deferredRender</tt> as <tt>true</tt> means that the content
+     * within an unactivated tab will not be available. For example, this means that if the TabPanel
+     * is within a {@link Ext.form.FormPanel form}, then until a tab is activated, any Fields within
+     * unactivated tabs will not be rendered, and will therefore not be submitted and will not be
+     * available to either {@link Ext.form.BasicForm#getValues getValues} or
+     * {@link Ext.form.BasicForm#setValues setValues}.</p>
+     */
+    deferredRender : true,
+    /**
+     * @cfg {Number} tabWidth The initial width in pixels of each new tab (defaults to 120).
+     */
+    tabWidth : 120,
+    /**
+     * @cfg {Number} minTabWidth The minimum width in pixels for each tab when {@link #resizeTabs} = true (defaults to 30).
+     */
+    minTabWidth : 30,
+    /**
+     * @cfg {Boolean} resizeTabs True to automatically resize each tab so that the tabs will completely fill the
+     * tab strip (defaults to false).  Setting this to true may cause specific widths that might be set per tab to
+     * be overridden in order to fit them all into view (although {@link #minTabWidth} will always be honored).
+     */
+    resizeTabs : false,
+    /**
+     * @cfg {Boolean} enableTabScroll True to enable scrolling to tabs that may be invisible due to overflowing the
+     * overall TabPanel width. Only available with tabPosition:'top' (defaults to false).
+     */
+    enableTabScroll : false,
+    /**
+     * @cfg {Number} scrollIncrement The number of pixels to scroll each time a tab scroll button is pressed
+     * (defaults to <tt>100</tt>, or if <tt>{@link #resizeTabs} = true</tt>, the calculated tab width).  Only
+     * applies when <tt>{@link #enableTabScroll} = true</tt>.
+     */
+    scrollIncrement : 0,
+    /**
+     * @cfg {Number} scrollRepeatInterval Number of milliseconds between each scroll while a tab scroll button is
+     * continuously pressed (defaults to <tt>400</tt>).
+     */
+    scrollRepeatInterval : 400,
+    /**
+     * @cfg {Float} scrollDuration The number of milliseconds that each scroll animation should last (defaults
+     * to <tt>.35</tt>). Only applies when <tt>{@link #animScroll} = true</tt>.
+     */
+    scrollDuration : 0.35,
+    /**
+     * @cfg {Boolean} animScroll True to animate tab scrolling so that hidden tabs slide smoothly into view (defaults
+     * to <tt>true</tt>).  Only applies when <tt>{@link #enableTabScroll} = true</tt>.
+     */
+    animScroll : true,
+    /**
+     * @cfg {String} tabPosition The position where the tab strip should be rendered (defaults to <tt>'top'</tt>).
+     * The only other supported value is <tt>'bottom'</tt>.  <b>Note</b>: tab scrolling is only supported for
+     * <tt>tabPosition: 'top'</tt>.
+     */
+    tabPosition : 'top',
+    /**
+     * @cfg {String} baseCls The base CSS class applied to the panel (defaults to <tt>'x-tab-panel'</tt>).
+     */
+    baseCls : 'x-tab-panel',
+    /**
+     * @cfg {Boolean} autoTabs
+     * <p><tt>true</tt> to query the DOM for any divs with a class of 'x-tab' to be automatically converted
+     * to tabs and added to this panel (defaults to <tt>false</tt>).  Note that the query will be executed within
+     * the scope of the container element only (so that multiple tab panels from markup can be supported via this
+     * method).</p>
+     * <p>This method is only possible when the markup is structured correctly as a container with nested divs
+     * containing the class <tt>'x-tab'</tt>. To create TabPanels without these limitations, or to pull tab content
+     * from other elements on the page, see the example at the top of the class for generating tabs from markup.</p>
+     * <p>There are a couple of things to note when using this method:<ul>
+     * <li>When using the <tt>autoTabs</tt> config (as opposed to passing individual tab configs in the TabPanel's
+     * {@link #items} collection), you must use <tt>{@link #applyTo}</tt> to correctly use the specified <tt>id</tt>
+     * as the tab container. The <tt>autoTabs</tt> method <em>replaces</em> existing content with the TabPanel
+     * components.</li>
+     * <li>Make sure that you set <tt>{@link #deferredRender}: false</tt> so that the content elements for each
+     * tab will be rendered into the TabPanel immediately upon page load, otherwise they will not be transformed
+     * until each tab is activated and will be visible outside the TabPanel.</li>
+     * </ul>Example usage:</p>
+     * <pre><code>
+var tabs = new Ext.TabPanel({
+    applyTo: 'my-tabs',
+    activeTab: 0,
+    deferredRender: false,
+    autoTabs: true
+});
+
+// This markup will be converted to a TabPanel from the code above
+&lt;div id="my-tabs">
+    &lt;div class="x-tab" title="Tab 1">A simple tab&lt;/div>
+    &lt;div class="x-tab" title="Tab 2">Another one&lt;/div>
+&lt;/div>
+</code></pre>
+     */
+    autoTabs : false,
+    /**
+     * @cfg {String} autoTabSelector The CSS selector used to search for tabs in existing markup when
+     * <tt>{@link #autoTabs} = true</tt> (defaults to <tt>'div.x-tab'</tt>).  This can be any valid selector
+     * supported by {@link Ext.DomQuery#select}. Note that the query will be executed within the scope of this
+     * tab panel only (so that multiple tab panels from markup can be supported on a page).
+     */
+    autoTabSelector : 'div.x-tab',
+    /**
+     * @cfg {String/Number} activeTab A string id or the numeric index of the tab that should be initially
+     * activated on render (defaults to none).
+     */
+    activeTab : null,
+    /**
+     * @cfg {Number} tabMargin The number of pixels of space to calculate into the sizing and scrolling of
+     * tabs. If you change the margin in CSS, you will need to update this value so calculations are correct
+     * with either <tt>{@link #resizeTabs}</tt> or scrolling tabs. (defaults to <tt>2</tt>)
+     */
+    tabMargin : 2,
+    /**
+     * @cfg {Boolean} plain </tt>true</tt> to render the tab strip without a background container image
+     * (defaults to <tt>false</tt>).
+     */
+    plain : false,
+    /**
+     * @cfg {Number} wheelIncrement For scrolling tabs, the number of pixels to increment on mouse wheel
+     * scrolling (defaults to <tt>20</tt>).
+     */
+    wheelIncrement : 20,
+
+    /*
+     * This is a protected property used when concatenating tab ids to the TabPanel id for internal uniqueness.
+     * It does not generally need to be changed, but can be if external code also uses an id scheme that can
+     * potentially clash with this one.
+     */
+    idDelimiter : '__',
+
+    // private
+    itemCls : 'x-tab-item',
+
+    // private config overrides
+    elements : 'body',
+    headerAsText : false,
+    frame : false,
+    hideBorders :true,
+
+    // private
+    initComponent : function(){
+        this.frame = false;
+        Ext.TabPanel.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event beforetabchange
+             * Fires before the active tab changes. Handlers can <tt>return false</tt> to cancel the tab change.
+             * @param {TabPanel} this
+             * @param {Panel} newTab The tab being activated
+             * @param {Panel} currentTab The current active tab
+             */
+            'beforetabchange',
+            /**
+             * @event tabchange
+             * Fires after the active tab has changed.
+             * @param {TabPanel} this
+             * @param {Panel} tab The new active tab
+             */
+            'tabchange',
+            /**
+             * @event contextmenu
+             * Relays the contextmenu event from a tab selector element in the tab strip.
+             * @param {TabPanel} this
+             * @param {Panel} tab The target tab
+             * @param {EventObject} e
+             */
+            'contextmenu'
+        );
+        /**
+         * @cfg {Object} layoutConfig
+         * TabPanel implicitly uses {@link Ext.layout.CardLayout} as its layout manager.
+         * <code>layoutConfig</code> may be used to configure this layout manager.
+         * <code>{@link #deferredRender}</code> and <code>{@link #layoutOnTabChange}</code>
+         * configured on the TabPanel will be applied as configs to the layout manager.
+         */
+        this.setLayout(new Ext.layout.CardLayout(Ext.apply({
+            layoutOnCardChange: this.layoutOnTabChange,
+            deferredRender: this.deferredRender
+        }, this.layoutConfig)));
+
+        if(this.tabPosition == 'top'){
+            this.elements += ',header';
+            this.stripTarget = 'header';
+        }else {
+            this.elements += ',footer';
+            this.stripTarget = 'footer';
+        }
+        if(!this.stack){
+            this.stack = Ext.TabPanel.AccessStack();
+        }
+        this.initItems();
+    },
+
+    // private
+    onRender : function(ct, position){
+        Ext.TabPanel.superclass.onRender.call(this, ct, position);
+
+        if(this.plain){
+            var pos = this.tabPosition == 'top' ? 'header' : 'footer';
+            this[pos].addClass('x-tab-panel-'+pos+'-plain');
+        }
+
+        var st = this[this.stripTarget];
+
+        this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{
+            tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});
+
+        var beforeEl = (this.tabPosition=='bottom' ? this.stripWrap : null);
+        this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'}, beforeEl);
+        this.strip = new Ext.Element(this.stripWrap.dom.firstChild);
+
+        this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'});
+        this.strip.createChild({cls:'x-clear'});
+
+        this.body.addClass('x-tab-panel-body-'+this.tabPosition);
+
+        /**
+         * @cfg {Template/XTemplate} itemTpl <p>(Optional) A {@link Ext.Template Template} or
+         * {@link Ext.XTemplate XTemplate} which may be provided to process the data object returned from
+         * <tt>{@link #getTemplateArgs}</tt> to produce a clickable selector element in the tab strip.</p>
+         * <p>The main element created should be a <tt>&lt;li></tt> element. In order for a click event on
+         * a selector element to be connected to its item, it must take its <i>id</i> from the TabPanel's
+         * native <tt>{@link #getTemplateArgs}</tt>.</p>
+         * <p>The child element which contains the title text must be marked by the CSS class
+         * <tt>x-tab-strip-inner</tt>.</p>
+         * <p>To enable closability, the created element should contain an element marked by the CSS class
+         * <tt>x-tab-strip-close</tt>.</p>
+         * <p>If a custom <tt>itemTpl</tt> is supplied, it is the developer's responsibility to create CSS
+         * style rules to create the desired appearance.</p>
+         * Below is an example of how to create customized tab selector items:<pre><code>
+new Ext.TabPanel({
+    renderTo: document.body,
+    minTabWidth: 115,
+    tabWidth: 135,
+    enableTabScroll: true,
+    width: 600,
+    height: 250,
+    defaults: {autoScroll:true},
+    itemTpl: new Ext.XTemplate(
+    '&lt;li class="{cls}" id="{id}" style="overflow:hidden">',
+         '&lt;tpl if="closable">',
+            '&lt;a class="x-tab-strip-close" onclick="return false;">&lt;/a>',
+         '&lt;/tpl>',
+         '&lt;a class="x-tab-right" href="#" onclick="return false;" style="padding-left:6px">',
+            '&lt;em class="x-tab-left">',
+                '&lt;span class="x-tab-strip-inner">',
+                    '&lt;img src="{src}" style="float:left;margin:3px 3px 0 0">',
+                    '&lt;span style="margin-left:20px" class="x-tab-strip-text {iconCls}">{text} {extra}&lt;/span>',
+                '&lt;/span>',
+            '&lt;/em>',
+        '&lt;/a>',
+    '&lt;/li>'
+    ),
+    getTemplateArgs: function(item) {
+//      Call the native method to collect the base data. Like the ID!
+        var result = Ext.TabPanel.prototype.getTemplateArgs.call(this, item);
+
+//      Add stuff used in our template
+        return Ext.apply(result, {
+            closable: item.closable,
+            src: item.iconSrc,
+            extra: item.extraText || ''
+        });
+    },
+    items: [{
+        title: 'New Tab 1',
+        iconSrc: '../shared/icons/fam/grid.png',
+        html: 'Tab Body 1',
+        closable: true
+    }, {
+        title: 'New Tab 2',
+        iconSrc: '../shared/icons/fam/grid.png',
+        html: 'Tab Body 2',
+        extraText: 'Extra stuff in the tab button'
+    }]
+});
+</code></pre>
+         */
+        if(!this.itemTpl){
+            var tt = new Ext.Template(
+                 '<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',
+                 '<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',
+                 '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',
+                 '</em></a></li>'
+            );
+            tt.disableFormats = true;
+            tt.compile();
+            Ext.TabPanel.prototype.itemTpl = tt;
+        }
+
+        this.items.each(this.initTab, this);
+    },
+
+    // private
+    afterRender : function(){
+        Ext.TabPanel.superclass.afterRender.call(this);
+        if(this.autoTabs){
+            this.readTabs(false);
+        }
+        if(this.activeTab !== undefined){
+            var item = Ext.isObject(this.activeTab) ? this.activeTab : this.items.get(this.activeTab);
+            delete this.activeTab;
+            this.setActiveTab(item);
+        }
+    },
+
+    // private
+    initEvents : function(){
+        Ext.TabPanel.superclass.initEvents.call(this);
+        this.on('add', this.onAdd, this, {target: this});
+        this.on('remove', this.onRemove, this, {target: this});
+
+        this.mon(this.strip, 'mousedown', this.onStripMouseDown, this);
+        this.mon(this.strip, 'contextmenu', this.onStripContextMenu, this);
+        if(this.enableTabScroll){
+            this.mon(this.strip, 'mousewheel', this.onWheel, this);
+        }
+    },
+
+    // private
+    findTargets : function(e){
+        var item = null;
+        var itemEl = e.getTarget('li', this.strip);
+        if(itemEl){
+            item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);
+            if(item.disabled){
+                return {
+                    close : null,
+                    item : null,
+                    el : null
+                };
+            }
+        }
+        return {
+            close : e.getTarget('.x-tab-strip-close', this.strip),
+            item : item,
+            el : itemEl
+        };
+    },
+
+    // private
+    onStripMouseDown : function(e){
+        if(e.button !== 0){
+            return;
+        }
+        e.preventDefault();
+        var t = this.findTargets(e);
+        if(t.close){
+            if (t.item.fireEvent('beforeclose', t.item) !== false) {
+                t.item.fireEvent('close', t.item);
+                this.remove(t.item);
+            }
+            return;
+        }
+        if(t.item && t.item != this.activeTab){
+            this.setActiveTab(t.item);
+        }
+    },
+
+    // private
+    onStripContextMenu : function(e){
+        e.preventDefault();
+        var t = this.findTargets(e);
+        if(t.item){
+            this.fireEvent('contextmenu', this, t.item, e);
+        }
+    },
+
+    /**
+     * True to scan the markup in this tab panel for <tt>{@link #autoTabs}</tt> using the
+     * <tt>{@link #autoTabSelector}</tt>
+     * @param {Boolean} removeExisting True to remove existing tabs
+     */
+    readTabs : function(removeExisting){
+        if(removeExisting === true){
+            this.items.each(function(item){
+                this.remove(item);
+            }, this);
+        }
+        var tabs = this.el.query(this.autoTabSelector);
+        for(var i = 0, len = tabs.length; i < len; i++){
+            var tab = tabs[i];
+            var title = tab.getAttribute('title');
+            tab.removeAttribute('title');
+            this.add({
+                title: title,
+                contentEl: tab
+            });
+        }
+    },
+
+    // private
+    initTab : function(item, index){
+        var before = this.strip.dom.childNodes[index];
+        var p = this.getTemplateArgs(item);
+        var el = before ?
+                 this.itemTpl.insertBefore(before, p) :
+                 this.itemTpl.append(this.strip, p);
+
+        Ext.fly(el).addClassOnOver('x-tab-strip-over');
+
+        if(item.tabTip){
+            Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip;
+        }
+        item.tabEl = el;
+
+        item.on('disable', this.onItemDisabled, this);
+        item.on('enable', this.onItemEnabled, this);
+        item.on('titlechange', this.onItemTitleChanged, this);
+        item.on('iconchange', this.onItemIconChanged, this);
+        item.on('beforeshow', this.onBeforeShowItem, this);
+    },
+
+    /**
+     * <p>Provides template arguments for rendering a tab selector item in the tab strip.</p>
+     * <p>This method returns an object hash containing properties used by the TabPanel's <tt>{@link #itemTpl}</tt>
+     * to create a formatted, clickable tab selector element. The properties which must be returned
+     * are:</p><div class="mdetail-params"><ul>
+     * <li><b>id</b> : String<div class="sub-desc">A unique identifier which links to the item</div></li>
+     * <li><b>text</b> : String<div class="sub-desc">The text to display</div></li>
+     * <li><b>cls</b> : String<div class="sub-desc">The CSS class name</div></li>
+     * <li><b>iconCls</b> : String<div class="sub-desc">A CSS class to provide appearance for an icon.</div></li>
+     * </ul></div>
+     * @param {BoxComponent} item The {@link Ext.BoxComponent BoxComponent} for which to create a selector element in the tab strip.
+     * @return {Object} An object hash containing the properties required to render the selector element.
+     */
+    getTemplateArgs : function(item) {
+        var cls = item.closable ? 'x-tab-strip-closable' : '';
+        if(item.disabled){
+            cls += ' x-item-disabled';
+        }
+        if(item.iconCls){
+            cls += ' x-tab-with-icon';
+        }
+        if(item.tabCls){
+            cls += ' ' + item.tabCls;
+        }
+
+        return {
+            id: this.id + this.idDelimiter + item.getItemId(),
+            text: item.title,
+            cls: cls,
+            iconCls: item.iconCls || ''
+        };
+    },
+
+    // private
+    onAdd : function(tp, item, index){
+        this.initTab(item, index);
+        if(this.items.getCount() == 1){
+            this.syncSize();
+        }
+        this.delegateUpdates();
+    },
+
+    // private
+    onBeforeAdd : function(item){
+        var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);
+        if(existing){
+            this.setActiveTab(item);
+            return false;
+        }
+        Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);
+        var es = item.elements;
+        item.elements = es ? es.replace(',header', '') : es;
+        item.border = (item.border === true);
+    },
+
+    // private
+    onRemove : function(tp, item){
+        Ext.destroy(Ext.get(this.getTabEl(item)));
+        this.stack.remove(item);
+        item.un('disable', this.onItemDisabled, this);
+        item.un('enable', this.onItemEnabled, this);
+        item.un('titlechange', this.onItemTitleChanged, this);
+        item.un('iconchange', this.onItemIconChanged, this);
+        item.un('beforeshow', this.onBeforeShowItem, this);
+        if(item == this.activeTab){
+            var next = this.stack.next();
+            if(next){
+                this.setActiveTab(next);
+            }else if(this.items.getCount() > 0){
+                this.setActiveTab(0);
+            }else{
+                this.activeTab = null;
+            }
+        }
+        this.delegateUpdates();
+    },
+
+    // private
+    onBeforeShowItem : function(item){
+        if(item != this.activeTab){
+            this.setActiveTab(item);
+            return false;
+        }
+    },
+
+    // private
+    onItemDisabled : function(item){
+        var el = this.getTabEl(item);
+        if(el){
+            Ext.fly(el).addClass('x-item-disabled');
+        }
+        this.stack.remove(item);
+    },
+
+    // private
+    onItemEnabled : function(item){
+        var el = this.getTabEl(item);
+        if(el){
+            Ext.fly(el).removeClass('x-item-disabled');
+        }
+    },
+
+    // private
+    onItemTitleChanged : function(item){
+        var el = this.getTabEl(item);
+        if(el){
+            Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;
+        }
+    },
+
+    //private
+    onItemIconChanged : function(item, iconCls, oldCls){
+        var el = this.getTabEl(item);
+        if(el){
+            Ext.fly(el).child('span.x-tab-strip-text').replaceClass(oldCls, iconCls);
+        }
+    },
+
+    /**
+     * Gets the DOM element for the tab strip item which activates the child panel with the specified
+     * ID. Access this to change the visual treatment of the item, for example by changing the CSS class name.
+     * @param {Panel/Number/String} tab The tab component, or the tab's index, or the tabs id or itemId.
+     * @return {HTMLElement} The DOM node
+     */
+    getTabEl : function(item){
+        return document.getElementById(this.id + this.idDelimiter + this.getComponent(item).getItemId());
+    },
+
+    // private
+    onResize : function(){
+        Ext.TabPanel.superclass.onResize.apply(this, arguments);
+        this.delegateUpdates();
+    },
+
+    /**
+     * Suspends any internal calculations or scrolling while doing a bulk operation. See {@link #endUpdate}
+     */
+    beginUpdate : function(){
+        this.suspendUpdates = true;
+    },
+
+    /**
+     * Resumes calculations and scrolling at the end of a bulk operation. See {@link #beginUpdate}
+     */
+    endUpdate : function(){
+        this.suspendUpdates = false;
+        this.delegateUpdates();
+    },
+
+    /**
+     * Hides the tab strip item for the passed tab
+     * @param {Number/String/Panel} item The tab index, id or item
+     */
+    hideTabStripItem : function(item){
+        item = this.getComponent(item);
+        var el = this.getTabEl(item);
+        if(el){
+            el.style.display = 'none';
+            this.delegateUpdates();
+        }
+        this.stack.remove(item);
+    },
+
+    /**
+     * Unhides the tab strip item for the passed tab
+     * @param {Number/String/Panel} item The tab index, id or item
+     */
+    unhideTabStripItem : function(item){
+        item = this.getComponent(item);
+        var el = this.getTabEl(item);
+        if(el){
+            el.style.display = '';
+            this.delegateUpdates();
+        }
+    },
+
+    // private
+    delegateUpdates : function(){
+        if(this.suspendUpdates){
+            return;
+        }
+        if(this.resizeTabs && this.rendered){
+            this.autoSizeTabs();
+        }
+        if(this.enableTabScroll && this.rendered){
+            this.autoScrollTabs();
+        }
+    },
+
+    // private
+    autoSizeTabs : function(){
+        var count = this.items.length;
+        var ce = this.tabPosition != 'bottom' ? 'header' : 'footer';
+        var ow = this[ce].dom.offsetWidth;
+        var aw = this[ce].dom.clientWidth;
+
+        if(!this.resizeTabs || count < 1 || !aw){ // !aw for display:none
+            return;
+        }
+
+        var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth); // -4 for float errors in IE
+        this.lastTabWidth = each;
+        var lis = this.strip.query("li:not([className^=x-tab-edge])");
+        for(var i = 0, len = lis.length; i < len; i++) {
+            var li = lis[i];
+            var inner = Ext.fly(li).child('.x-tab-strip-inner', true);
+            var tw = li.offsetWidth;
+            var iw = inner.offsetWidth;
+            inner.style.width = (each - (tw-iw)) + 'px';
+        }
+    },
+
+    // private
+    adjustBodyWidth : function(w){
+        if(this.header){
+            this.header.setWidth(w);
+        }
+        if(this.footer){
+            this.footer.setWidth(w);
+        }
+        return w;
+    },
+
+    /**
+     * Sets the specified tab as the active tab. This method fires the {@link #beforetabchange} event which
+     * can <tt>return false</tt> to cancel the tab change.
+     * @param {String/Number} item
+     * The id or tab Panel to activate. This parameter may be any of the following:
+     * <div><ul class="mdetail-params">
+     * <li>a <b><tt>String</tt></b> : representing the <code>{@link Ext.Component#itemId itemId}</code>
+     * or <code>{@link Ext.Component#id id}</code> of the child component </li>
+     * <li>a <b><tt>Number</tt></b> : representing the position of the child component
+     * within the <code>{@link Ext.Container#items items}</code> <b>property</b></li>
+     * </ul></div>
+     * <p>For additional information see {@link Ext.util.MixedCollection#get}.
+     */
+    setActiveTab : function(item){
+        item = this.getComponent(item);
+        if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){
+            return;
+        }
+        if(!this.rendered){
+            this.activeTab = item;
+            return;
+        }
+        if(this.activeTab != item){
+            if(this.activeTab){
+                var oldEl = this.getTabEl(this.activeTab);
+                if(oldEl){
+                    Ext.fly(oldEl).removeClass('x-tab-strip-active');
+                }
+                this.activeTab.fireEvent('deactivate', this.activeTab);
+            }
+            var el = this.getTabEl(item);
+            Ext.fly(el).addClass('x-tab-strip-active');
+            this.activeTab = item;
+            this.stack.add(item);
+
+            this.layout.setActiveItem(item);
+            if(this.scrolling){
+                this.scrollToTab(item, this.animScroll);
+            }
+
+            item.fireEvent('activate', item);
+            this.fireEvent('tabchange', this, item);
+        }
+    },
+
+    /**
+     * Gets the currently active tab.
+     * @return {Panel} The active tab
+     */
+    getActiveTab : function(){
+        return this.activeTab || null;
+    },
+
+    /**
+     * Gets the specified tab by id.
+     * @param {String} id The tab id
+     * @return {Panel} The tab
+     */
+    getItem : function(item){
+        return this.getComponent(item);
+    },
+
+    // private
+    autoScrollTabs : function(){
+        this.pos = this.tabPosition=='bottom' ? this.footer : this.header;
+        var count = this.items.length;
+        var ow = this.pos.dom.offsetWidth;
+        var tw = this.pos.dom.clientWidth;
+
+        var wrap = this.stripWrap;
+        var wd = wrap.dom;
+        var cw = wd.offsetWidth;
+        var pos = this.getScrollPos();
+        var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;
+
+        if(!this.enableTabScroll || count < 1 || cw < 20){ // 20 to prevent display:none issues
+            return;
+        }
+        if(l <= tw){
+            wd.scrollLeft = 0;
+            wrap.setWidth(tw);
+            if(this.scrolling){
+                this.scrolling = false;
+                this.pos.removeClass('x-tab-scrolling');
+                this.scrollLeft.hide();
+                this.scrollRight.hide();
+                // See here: http://extjs.com/forum/showthread.php?t=49308&highlight=isSafari
+                if(Ext.isAir || Ext.isWebKit){
+                    wd.style.marginLeft = '';
+                    wd.style.marginRight = '';
+                }
+            }
+        }else{
+            if(!this.scrolling){
+                this.pos.addClass('x-tab-scrolling');
+                // See here: http://extjs.com/forum/showthread.php?t=49308&highlight=isSafari
+                if(Ext.isAir || Ext.isWebKit){
+                    wd.style.marginLeft = '18px';
+                    wd.style.marginRight = '18px';
+                }
+            }
+            tw -= wrap.getMargins('lr');
+            wrap.setWidth(tw > 20 ? tw : 20);
+            if(!this.scrolling){
+                if(!this.scrollLeft){
+                    this.createScrollers();
+                }else{
+                    this.scrollLeft.show();
+                    this.scrollRight.show();
+                }
+            }
+            this.scrolling = true;
+            if(pos > (l-tw)){ // ensure it stays within bounds
+                wd.scrollLeft = l-tw;
+            }else{ // otherwise, make sure the active tab is still visible
+                this.scrollToTab(this.activeTab, false);
+            }
+            this.updateScrollButtons();
+        }
+    },
+
+    // private
+    createScrollers : function(){
+        this.pos.addClass('x-tab-scrolling-' + this.tabPosition);
+        var h = this.stripWrap.dom.offsetHeight;
+
+        // left
+        var sl = this.pos.insertFirst({
+            cls:'x-tab-scroller-left'
+        });
+        sl.setHeight(h);
+        sl.addClassOnOver('x-tab-scroller-left-over');
+        this.leftRepeater = new Ext.util.ClickRepeater(sl, {
+            interval : this.scrollRepeatInterval,
+            handler: this.onScrollLeft,
+            scope: this
+        });
+        this.scrollLeft = sl;
+
+        // right
+        var sr = this.pos.insertFirst({
+            cls:'x-tab-scroller-right'
+        });
+        sr.setHeight(h);
+        sr.addClassOnOver('x-tab-scroller-right-over');
+        this.rightRepeater = new Ext.util.ClickRepeater(sr, {
+            interval : this.scrollRepeatInterval,
+            handler: this.onScrollRight,
+            scope: this
+        });
+        this.scrollRight = sr;
+    },
+
+    // private
+    getScrollWidth : function(){
+        return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();
+    },
+
+    // private
+    getScrollPos : function(){
+        return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;
+    },
+
+    // private
+    getScrollArea : function(){
+        return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;
+    },
+
+    // private
+    getScrollAnim : function(){
+        return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};
+    },
+
+    // private
+    getScrollIncrement : function(){
+        return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);
+    },
+
+    /**
+     * Scrolls to a particular tab if tab scrolling is enabled
+     * @param {Panel} item The item to scroll to
+     * @param {Boolean} animate True to enable animations
+     */
+
+    scrollToTab : function(item, animate){
+        if(!item){ return; }
+        var el = this.getTabEl(item);
+        var pos = this.getScrollPos(), area = this.getScrollArea();
+        var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;
+        var right = left + el.offsetWidth;
+        if(left < pos){
+            this.scrollTo(left, animate);
+        }else if(right > (pos + area)){
+            this.scrollTo(right - area, animate);
+        }
+    },
+
+    // private
+    scrollTo : function(pos, animate){
+        this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);
+        if(!animate){
+            this.updateScrollButtons();
+        }
+    },
+
+    onWheel : function(e){
+        var d = e.getWheelDelta()*this.wheelIncrement*-1;
+        e.stopEvent();
+
+        var pos = this.getScrollPos();
+        var newpos = pos + d;
+        var sw = this.getScrollWidth()-this.getScrollArea();
+
+        var s = Math.max(0, Math.min(sw, newpos));
+        if(s != pos){
+            this.scrollTo(s, false);
+        }
+    },
+
+    // private
+    onScrollRight : function(){
+        var sw = this.getScrollWidth()-this.getScrollArea();
+        var pos = this.getScrollPos();
+        var s = Math.min(sw, pos + this.getScrollIncrement());
+        if(s != pos){
+            this.scrollTo(s, this.animScroll);
+        }
+    },
+
+    // private
+    onScrollLeft : function(){
+        var pos = this.getScrollPos();
+        var s = Math.max(0, pos - this.getScrollIncrement());
+        if(s != pos){
+            this.scrollTo(s, this.animScroll);
+        }
+    },
+
+    // private
+    updateScrollButtons : function(){
+        var pos = this.getScrollPos();
+        this.scrollLeft[pos === 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');
+        this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');
+    },
+
+    // private
+    beforeDestroy : function() {
+        if(this.items){
+            this.items.each(function(item){
+                if(item && item.tabEl){
+                    Ext.get(item.tabEl).removeAllListeners();
+                    item.tabEl = null;
+                }
+            }, this);
+        }
+        if(this.strip){
+            this.strip.removeAllListeners();
+        }
+        Ext.TabPanel.superclass.beforeDestroy.apply(this);
+    }
+
+    /**
+     * @cfg {Boolean} collapsible
+     * @hide
+     */
+    /**
+     * @cfg {String} header
+     * @hide
+     */
+    /**
+     * @cfg {Boolean} headerAsText
+     * @hide
+     */
+    /**
+     * @property header
+     * @hide
+     */
+    /**
+     * @property title
+     * @hide
+     */
+    /**
+     * @cfg {Array} tools
+     * @hide
+     */
+    /**
+     * @cfg {Array} toolTemplate
+     * @hide
+     */
+    /**
+     * @cfg {Boolean} hideCollapseTool
+     * @hide
+     */
+    /**
+     * @cfg {Boolean} titleCollapse
+     * @hide
+     */
+    /**
+     * @cfg {Boolean} collapsed
+     * @hide
+     */
+    /**
+     * @cfg {String} layout
+     * @hide
+     */
+    /**
+     * @cfg {Boolean} preventBodyReset
+     * @hide
+     */
+});
+Ext.reg('tabpanel', Ext.TabPanel);
+
+/**
+ * See {@link #setActiveTab}. Sets the specified tab as the active tab. This method fires
+ * the {@link #beforetabchange} event which can <tt>return false</tt> to cancel the tab change.
+ * @param {String/Panel} tab The id or tab Panel to activate
+ * @method activate
+ */
+Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab;
+
+// private utility class used by TabPanel
+Ext.TabPanel.AccessStack = function(){
+    var items = [];
+    return {
+        add : function(item){
+            items.push(item);
+            if(items.length > 10){
+                items.shift();
+            }
+        },
+
+        remove : function(item){
+            var s = [];
+            for(var i = 0, len = items.length; i < len; i++) {
+                if(items[i] != item){
+                    s.push(items[i]);
+                }
+            }
+            items = s;
+        },
+
+        next : function(){
+            return items.pop();
+        }
+    };
+};/**
+ * @class Ext.Button
+ * @extends Ext.BoxComponent
+ * Simple Button class
+ * @cfg {String} text The button text to be used as innerHTML (html tags are accepted)
+ * @cfg {String} icon The path to an image to display in the button (the image will be set as the background-image
+ * CSS property of the button by default, so if you want a mixed icon/text button, set cls:'x-btn-text-icon')
+ * @cfg {Function} handler A function called when the button is clicked (can be used instead of click event).
+ * The handler is passed the following parameters:<div class="mdetail-params"><ul>
+ * <li><code>b</code> : Button<div class="sub-desc">This Button.</div></li>
+ * <li><code>e</code> : EventObject<div class="sub-desc">The click event.</div></li>
+ * </ul></div>
+ * @cfg {Object} scope The scope (<tt><b>this</b></tt> reference) in which the handler is executed. Defaults to this Button.
+ * @cfg {Number} minWidth The minimum width for this button (used to give a set of buttons a common width).
+ * See also {@link Ext.Panel}.<tt>{@link Ext.Panel#minButtonWidth minButtonWidth}</tt>.
+ * @cfg {String/Object} tooltip The tooltip for the button - can be a string to be used as innerHTML (html tags are accepted) or QuickTips config object
+ * @cfg {Boolean} hidden True to start hidden (defaults to false)
+ * @cfg {Boolean} disabled True to start disabled (defaults to false)
+ * @cfg {Boolean} pressed True to start pressed (only if enableToggle = true)
+ * @cfg {String} toggleGroup The group this toggle button is a member of (only 1 per group can be pressed)
+ * @cfg {Boolean/Object} repeat True to repeat fire the click event while the mouse is down. This can also be
+ * a {@link Ext.util.ClickRepeater ClickRepeater} config object (defaults to false).
+ * @constructor
+ * Create a new button
+ * @param {Object} config The config object
+ * @xtype button
+ */
+Ext.Button = Ext.extend(Ext.BoxComponent, {
+    /**
+     * Read-only. True if this button is hidden
+     * @type Boolean
+     */
+    hidden : false,
+    /**
+     * Read-only. True if this button is disabled
+     * @type Boolean
+     */
+    disabled : false,
+    /**
+     * Read-only. True if this button is pressed (only if enableToggle = true)
+     * @type Boolean
+     */
+    pressed : false,
+    /**
+     * The Button's owner {@link Ext.Panel} (defaults to undefined, and is set automatically when
+     * the Button is added to a container).  Read-only.
+     * @type Ext.Panel
+     * @property ownerCt
+     */
+
+    /**
+     * @cfg {Number} tabIndex Set a DOM tabIndex for this button (defaults to undefined)
+     */
+
+    /**
+     * @cfg {Boolean} allowDepress
+     * False to not allow a pressed Button to be depressed (defaults to undefined). Only valid when {@link #enableToggle} is true.
+     */
+
+    /**
+     * @cfg {Boolean} enableToggle
+     * True to enable pressed/not pressed toggling (defaults to false)
+     */
+    enableToggle: false,
+    /**
+     * @cfg {Function} toggleHandler
+     * Function called when a Button with {@link #enableToggle} set to true is clicked. Two arguments are passed:<ul class="mdetail-params">
+     * <li><b>button</b> : Ext.Button<div class="sub-desc">this Button object</div></li>
+     * <li><b>state</b> : Boolean<div class="sub-desc">The next state if the Button, true means pressed.</div></li>
+     * </ul>
+     */
+    /**
+     * @cfg {Mixed} menu
+     * Standard menu attribute consisting of a reference to a menu object, a menu id or a menu config blob (defaults to undefined).
+     */
+    /**
+     * @cfg {String} menuAlign
+     * The position to align the menu to (see {@link Ext.Element#alignTo} for more details, defaults to 'tl-bl?').
+     */
+    menuAlign : 'tl-bl?',
+
+    /**
+     * @cfg {String} overflowText If used in a {@link Ext.Toolbar Toolbar}, the
+     * text to be used if this item is shown in the overflow menu. See also
+     * {@link Ext.Toolbar.Item}.<code>{@link Ext.Toolbar.Item#overflowText overflowText}</code>.
+     */
+    /**
+     * @cfg {String} iconCls
+     * A css class which sets a background image to be used as the icon for this button
+     */
+    /**
+     * @cfg {String} type
+     * submit, reset or button - defaults to 'button'
+     */
+    type : 'button',
+
+    // private
+    menuClassTarget: 'tr:nth(2)',
+
+    /**
+     * @cfg {String} clickEvent
+     * The type of event to map to the button's event handler (defaults to 'click')
+     */
+    clickEvent : 'click',
+
+    /**
+     * @cfg {Boolean} handleMouseEvents
+     * False to disable visual cues on mouseover, mouseout and mousedown (defaults to true)
+     */
+    handleMouseEvents : true,
+
+    /**
+     * @cfg {String} tooltipType
+     * The type of tooltip to use. Either 'qtip' (default) for QuickTips or 'title' for title attribute.
+     */
+    tooltipType : 'qtip',
+
+    /**
+     * @cfg {String} buttonSelector
+     * <p>(Optional) A {@link Ext.DomQuery DomQuery} selector which is used to extract the active, clickable element from the
+     * DOM structure created.</p>
+     * <p>When a custom {@link #template} is used, you  must ensure that this selector results in the selection of
+     * a focussable element.</p>
+     * <p>Defaults to <b><tt>"button:first-child"</tt></b>.</p>
+     */
+    buttonSelector : 'button:first-child',
+
+    /**
+     * @cfg {String} scale
+     * <p>(Optional) The size of the Button. Three values are allowed:</p>
+     * <ul class="mdetail-params">
+     * <li>'small'<div class="sub-desc">Results in the button element being 16px high.</div></li>
+     * <li>'medium'<div class="sub-desc">Results in the button element being 24px high.</div></li>
+     * <li>'large'<div class="sub-desc">Results in the button element being 32px high.</div></li>
+     * </ul>
+     * <p>Defaults to <b><tt>'small'</tt></b>.</p>
+     */
+    scale: 'small',
+
+    /**
+     * @cfg {String} iconAlign
+     * <p>(Optional) The side of the Button box to render the icon. Four values are allowed:</p>
+     * <ul class="mdetail-params">
+     * <li>'top'<div class="sub-desc"></div></li>
+     * <li>'right'<div class="sub-desc"></div></li>
+     * <li>'bottom'<div class="sub-desc"></div></li>
+     * <li>'left'<div class="sub-desc"></div></li>
+     * </ul>
+     * <p>Defaults to <b><tt>'left'</tt></b>.</p>
+     */
+    iconAlign : 'left',
+
+    /**
+     * @cfg {String} arrowAlign
+     * <p>(Optional) The side of the Button box to render the arrow if the button has an associated {@link #menu}.
+     * Two values are allowed:</p>
+     * <ul class="mdetail-params">
+     * <li>'right'<div class="sub-desc"></div></li>
+     * <li>'bottom'<div class="sub-desc"></div></li>
+     * </ul>
+     * <p>Defaults to <b><tt>'right'</tt></b>.</p>
+     */
+    arrowAlign : 'right',
+
+    /**
+     * @cfg {Ext.Template} template (Optional)
+     * <p>A {@link Ext.Template Template} used to create the Button's DOM structure.</p>
+     * Instances, or subclasses which need a different DOM structure may provide a different
+     * template layout in conjunction with an implementation of {@link #getTemplateArgs}.
+     * @type Ext.Template
+     * @property template
+     */
+    /**
+     * @cfg {String} cls
+     * A CSS class string to apply to the button's main element.
+     */
+    /**
+     * @property menu
+     * @type Menu
+     * The {@link Ext.menu.Menu Menu} object associated with this Button when configured with the {@link #menu} config option.
+     */
+
+    initComponent : function(){
+        Ext.Button.superclass.initComponent.call(this);
+
+        this.addEvents(
+            /**
+             * @event click
+             * Fires when this button is clicked
+             * @param {Button} this
+             * @param {EventObject} e The click event
+             */
+            'click',
+            /**
+             * @event toggle
+             * Fires when the 'pressed' state of this button changes (only if enableToggle = true)
+             * @param {Button} this
+             * @param {Boolean} pressed
+             */
+            'toggle',
+            /**
+             * @event mouseover
+             * Fires when the mouse hovers over the button
+             * @param {Button} this
+             * @param {Event} e The event object
+             */
+            'mouseover',
+            /**
+             * @event mouseout
+             * Fires when the mouse exits the button
+             * @param {Button} this
+             * @param {Event} e The event object
+             */
+            'mouseout',
+            /**
+             * @event menushow
+             * If this button has a menu, this event fires when it is shown
+             * @param {Button} this
+             * @param {Menu} menu
+             */
+            'menushow',
+            /**
+             * @event menuhide
+             * If this button has a menu, this event fires when it is hidden
+             * @param {Button} this
+             * @param {Menu} menu
+             */
+            'menuhide',
+            /**
+             * @event menutriggerover
+             * If this button has a menu, this event fires when the mouse enters the menu triggering element
+             * @param {Button} this
+             * @param {Menu} menu
+             * @param {EventObject} e
+             */
+            'menutriggerover',
+            /**
+             * @event menutriggerout
+             * If this button has a menu, this event fires when the mouse leaves the menu triggering element
+             * @param {Button} this
+             * @param {Menu} menu
+             * @param {EventObject} e
+             */
+            'menutriggerout'
+        );
+        if(this.menu){
+            this.menu = Ext.menu.MenuMgr.get(this.menu);
+        }
+        if(Ext.isString(this.toggleGroup)){
+            this.enableToggle = true;
+        }
+    },
+
+/**
+  * <p>This method returns an object which provides substitution parameters for the {@link #template Template} used
+  * to create this Button's DOM structure.</p>
+  * <p>Instances or subclasses which use a different Template to create a different DOM structure may need to provide their
+  * own implementation of this method.</p>
+  * <p>The default implementation which provides data for the default {@link #template} returns an Array containing the
+  * following items:</p><div class="mdetail-params"><ul>
+  * <li>The Button's {@link #text}</li>
+  * <li>The &lt;button&gt;'s {@link #type}</li>
+  * <li>The {@link iconCls} applied to the &lt;button&gt; {@link #btnEl element}</li>
+  * <li>The {@link #cls} applied to the Button's main {@link #getEl Element}</li>
+  * <li>A CSS class name controlling the Button's {@link #scale} and {@link #iconAlign icon alignment}</li>
+  * <li>A CSS class name which applies an arrow to the Button if configured with a {@link #menu}</li>
+  * </ul></div>
+  * @return {Object} Substitution data for a Template.
+ */
+    getTemplateArgs : function(){
+        var cls = (this.cls || '');
+        cls += (this.iconCls || this.icon) ? (this.text ? ' x-btn-text-icon' : ' x-btn-icon') : ' x-btn-noicon';
+        if(this.pressed){
+            cls += ' x-btn-pressed';
+        }
+        return [this.text || '&#160;', this.type, this.iconCls || '', cls, 'x-btn-' + this.scale + ' x-btn-icon-' + this.scale + '-' + this.iconAlign, this.getMenuClass()];
+    },
+
+    // protected
+    getMenuClass : function(){
+        return this.menu ? (this.arrowAlign != 'bottom' ? 'x-btn-arrow' : 'x-btn-arrow-bottom') : '';
+    },
+
+    // private
+    onRender : function(ct, position){
+        if(!this.template){
+            if(!Ext.Button.buttonTemplate){
+                // hideous table template
+                Ext.Button.buttonTemplate = new Ext.Template(
+                    '<table cellspacing="0" class="x-btn {3}"><tbody class="{4}">',
+                    '<tr><td class="x-btn-tl"><i>&#160;</i></td><td class="x-btn-tc"></td><td class="x-btn-tr"><i>&#160;</i></td></tr>',
+                    '<tr><td class="x-btn-ml"><i>&#160;</i></td><td class="x-btn-mc"><em class="{5}" unselectable="on"><button class="x-btn-text {2}" type="{1}">{0}</button></em></td><td class="x-btn-mr"><i>&#160;</i></td></tr>',
+                    '<tr><td class="x-btn-bl"><i>&#160;</i></td><td class="x-btn-bc"></td><td class="x-btn-br"><i>&#160;</i></td></tr>',
+                    "</tbody></table>");
+                Ext.Button.buttonTemplate.compile();
+            }
+            this.template = Ext.Button.buttonTemplate;
+        }
+
+        var btn, targs = this.getTemplateArgs();
+
+        if(position){
+            btn = this.template.insertBefore(position, targs, true);
+        }else{
+            btn = this.template.append(ct, targs, true);
+        }
+        /**
+         * An {@link Ext.Element Element} encapsulating the Button's clickable element. By default,
+         * this references a <tt>&lt;button&gt;</tt> element. Read only.
+         * @type Ext.Element
+         * @property btnEl
+         */
+        this.btnEl = btn.child(this.buttonSelector);
+        this.mon(this.btnEl, {
+            scope: this,
+            focus: this.onFocus,
+            blur: this.onBlur
+        });
+
+        this.initButtonEl(btn, this.btnEl);
+
+        Ext.ButtonToggleMgr.register(this);
+    },
+
+    // private
+    initButtonEl : function(btn, btnEl){
+        this.el = btn;
+
+        if(this.id){
+            this.el.dom.id = this.el.id = this.id;
+        }
+        if(this.icon){
+            btnEl.setStyle('background-image', 'url(' +this.icon +')');
+        }
+        if(this.tabIndex !== undefined){
+            btnEl.dom.tabIndex = this.tabIndex;
+        }
+        if(this.tooltip){
+            this.setTooltip(this.tooltip, true);
+        }
+
+        if(this.handleMouseEvents){
+            this.mon(btn, {
+                scope: this,
+                mouseover: this.onMouseOver,
+                mousedown: this.onMouseDown
+            });
+            
+            // new functionality for monitoring on the document level
+            //this.mon(btn, 'mouseout', this.onMouseOut, this);
+        }
+
+        if(this.menu){
+            this.mon(this.menu, {
+                scope: this,
+                show: this.onMenuShow,
+                hide: this.onMenuHide
+            });
+        }
+
+        if(this.repeat){
+            var repeater = new Ext.util.ClickRepeater(btn, Ext.isObject(this.repeat) ? this.repeat : {});
+            this.mon(repeater, 'click', this.onClick, this);
+        }
+        
+        this.mon(btn, this.clickEvent, this.onClick, this);
+    },
+
+    // private
+    afterRender : function(){
+        Ext.Button.superclass.afterRender.call(this);
+        this.doAutoWidth();
+    },
+
+    /**
+     * Sets the CSS class that provides a background image to use as the button's icon.  This method also changes
+     * the value of the {@link iconCls} config internally.
+     * @param {String} cls The CSS class providing the icon image
+     * @return {Ext.Button} this
+     */
+    setIconClass : function(cls){
+        if(this.el){
+            this.btnEl.replaceClass(this.iconCls, cls);
+        }
+        this.iconCls = cls;
+        return this;
+    },
+
+    /**
+     * Sets the tooltip for this Button.
+     * @param {String/Object} tooltip. This may be:<div class="mdesc-details"><ul>
+     * <li><b>String</b> : A string to be used as innerHTML (html tags are accepted) to show in a tooltip</li>
+     * <li><b>Object</b> : A configuration object for {@link Ext.QuickTips#register}.</li>
+     * </ul></div>
+     * @return {Ext.Button} this
+     */
+    setTooltip : function(tooltip, /* private */ initial){
+        if(this.rendered){
+            if(!initial){
+                this.clearTip();
+            }
+            if(Ext.isObject(tooltip)){
+                Ext.QuickTips.register(Ext.apply({
+                      target: this.btnEl.id
+                }, tooltip));
+                this.tooltip = tooltip;
+            }else{
+                this.btnEl.dom[this.tooltipType] = tooltip;
+            }
+        }else{
+            this.tooltip = tooltip;
+        }
+        return this;
+    },
+    
+    // private
+    clearTip: function(){
+        if(Ext.isObject(this.tooltip)){
+            Ext.QuickTips.unregister(this.btnEl);
+        }
+    },
+    
+    // private
+    beforeDestroy: function(){
+        if(this.rendered){
+            this.clearTip();
+        }
+        Ext.destroy(this.menu, this.repeater);
+    },
+
+    // private
+    onDestroy : function(){
+        var doc = Ext.getDoc();
+        doc.un('mouseover', this.monitorMouseOver, this);
+        doc.un('mouseup', this.onMouseUp, this);
+        if(this.rendered){
+            Ext.ButtonToggleMgr.unregister(this);
+        }
+    },
+
+    // private
+    doAutoWidth : function(){
+        if(this.el && this.text && this.width === undefined){
+            this.el.setWidth('auto');
+            if(Ext.isIE7 && Ext.isStrict){
+                var ib = this.btnEl;
+                if(ib && ib.getWidth() > 20){
+                    ib.clip();
+                    ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));
+                }
+            }
+            if(this.minWidth){
+                if(this.el.getWidth() < this.minWidth){
+                    this.el.setWidth(this.minWidth);
+                }
+            }
+        }
+    },
+
+    /**
+     * Assigns this Button's click handler
+     * @param {Function} handler The function to call when the button is clicked
+     * @param {Object} scope (optional) Scope for the function passed in
+     * @return {Ext.Button} this
+     */
+    setHandler : function(handler, scope){
+        this.handler = handler;
+        this.scope = scope;
+        return this;
+    },
+
+    /**
+     * Sets this Button's text
+     * @param {String} text The button text
+     * @return {Ext.Button} this
+     */
+    setText : function(text){
+        this.text = text;
+        if(this.el){
+            this.el.child('td.x-btn-mc ' + this.buttonSelector).update(text);
+        }
+        this.doAutoWidth();
+        return this;
+    },
+
+    /**
+     * Gets the text for this Button
+     * @return {String} The button text
+     */
+    getText : function(){
+        return this.text;
+    },
+
+    /**
+     * If a state it passed, it becomes the pressed state otherwise the current state is toggled.
+     * @param {Boolean} state (optional) Force a particular state
+     * @param {Boolean} supressEvent (optional) True to stop events being fired when calling this method.
+     * @return {Ext.Button} this
+     */
+    toggle : function(state, suppressEvent){
+        state = state === undefined ? !this.pressed : !!state;
+        if(state != this.pressed){
+            this.el[state ? 'addClass' : 'removeClass']('x-btn-pressed');
+            this.pressed = state;
+            if(!suppressEvent){
+                this.fireEvent('toggle', this, state);
+                if(this.toggleHandler){
+                    this.toggleHandler.call(this.scope || this, this, state);
+                }
+            }
+        }
+        return this;
+    },
+
+    /**
+     * Focus the button
+     */
+    focus : function(){
+        this.btnEl.focus();
+    },
+
+    // private
+    onDisable : function(){
+        this.onDisableChange(true);
+    },
+
+    // private
+    onEnable : function(){
+        this.onDisableChange(false);
+    },
+    
+    onDisableChange : function(disabled){
+        if(this.el){
+            if(!Ext.isIE6 || !this.text){
+                this.el[disabled ? 'addClass' : 'removeClass'](this.disabledClass);
+            }
+            this.el.dom.disabled = disabled;
+        }
+        this.disabled = disabled;
+    },
+
+    /**
+     * Show this button's menu (if it has one)
+     */
+    showMenu : function(){
+        if(this.rendered && this.menu){
+            if(this.tooltip){
+                Ext.QuickTips.getQuickTip().cancelShow(this.btnEl);
+            }
+            this.menu.show(this.el, this.menuAlign);
+        }
+        return this;
+    },
+
+    /**
+     * Hide this button's menu (if it has one)
+     */
+    hideMenu : function(){
+        if(this.menu){
+            this.menu.hide();
+        }
+        return this;
+    },
+
+    /**
+     * Returns true if the button has a menu and it is visible
+     * @return {Boolean}
+     */
+    hasVisibleMenu : function(){
+        return this.menu && this.menu.isVisible();
+    },
+
+    // private
+    onClick : function(e){
+        if(e){
+            e.preventDefault();
+        }
+        if(e.button !== 0){
+            return;
+        }
+        if(!this.disabled){
+            if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){
+                this.toggle();
+            }
+            if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
+                this.showMenu();
+            }
+            this.fireEvent('click', this, e);
+            if(this.handler){
+                //this.el.removeClass('x-btn-over');
+                this.handler.call(this.scope || this, this, e);
+            }
+        }
+    },
+
+    // private
+    isMenuTriggerOver : function(e, internal){
+        return this.menu && !internal;
+    },
+
+    // private
+    isMenuTriggerOut : function(e, internal){
+        return this.menu && !internal;
+    },
+
+    // private
+    onMouseOver : function(e){
+        if(!this.disabled){
+            var internal = e.within(this.el,  true);
+            if(!internal){
+                this.el.addClass('x-btn-over');
+                if(!this.monitoringMouseOver){
+                    Ext.getDoc().on('mouseover', this.monitorMouseOver, this);
+                    this.monitoringMouseOver = true;
+                }
+                this.fireEvent('mouseover', this, e);
+            }
+            if(this.isMenuTriggerOver(e, internal)){
+                this.fireEvent('menutriggerover', this, this.menu, e);
+            }
+        }
+    },
+
+    // private
+    monitorMouseOver : function(e){
+        if(e.target != this.el.dom && !e.within(this.el)){
+            if(this.monitoringMouseOver){
+                Ext.getDoc().un('mouseover', this.monitorMouseOver, this);
+                this.monitoringMouseOver = false;
+            }
+            this.onMouseOut(e);
+        }
+    },
+
+    // private
+    onMouseOut : function(e){
+        var internal = e.within(this.el) && e.target != this.el.dom;
+        this.el.removeClass('x-btn-over');
+        this.fireEvent('mouseout', this, e);
+        if(this.isMenuTriggerOut(e, internal)){
+            this.fireEvent('menutriggerout', this, this.menu, e);
+        }
+    },
+    // private
+    onFocus : function(e){
+        if(!this.disabled){
+            this.el.addClass('x-btn-focus');
+        }
+    },
+    // private
+    onBlur : function(e){
+        this.el.removeClass('x-btn-focus');
+    },
+
+    // private
+    getClickEl : function(e, isUp){
+       return this.el;
+    },
+
+    // private
+    onMouseDown : function(e){
+        if(!this.disabled && e.button === 0){
+            this.getClickEl(e).addClass('x-btn-click');
+            Ext.getDoc().on('mouseup', this.onMouseUp, this);
+        }
+    },
+    // private
+    onMouseUp : function(e){
+        if(e.button === 0){
+            this.getClickEl(e, true).removeClass('x-btn-click');
+            Ext.getDoc().un('mouseup', this.onMouseUp, this);
+        }
+    },
+    // private
+    onMenuShow : function(e){
+        this.ignoreNextClick = 0;
+        this.el.addClass('x-btn-menu-active');
+        this.fireEvent('menushow', this, this.menu);
+    },
+    // private
+    onMenuHide : function(e){
+        this.el.removeClass('x-btn-menu-active');
+        this.ignoreNextClick = this.restoreClick.defer(250, this);
+        this.fireEvent('menuhide', this, this.menu);
+    },
+
+    // private
+    restoreClick : function(){
+        this.ignoreNextClick = 0;
+    }
+
+
+
+    /**
+     * @cfg {String} autoEl @hide
+     */
+});
+Ext.reg('button', Ext.Button);
+
+// Private utility class used by Button
+Ext.ButtonToggleMgr = function(){
+   var groups = {};
+
+   function toggleGroup(btn, state){
+       if(state){
+           var g = groups[btn.toggleGroup];
+           for(var i = 0, l = g.length; i < l; i++){
+               if(g[i] != btn){
+                   g[i].toggle(false);
+               }
+           }
+       }
+   }
+
+   return {
+       register : function(btn){
+           if(!btn.toggleGroup){
+               return;
+           }
+           var g = groups[btn.toggleGroup];
+           if(!g){
+               g = groups[btn.toggleGroup] = [];
+           }
+           g.push(btn);
+           btn.on('toggle', toggleGroup);
+       },
+
+       unregister : function(btn){
+           if(!btn.toggleGroup){
+               return;
+           }
+           var g = groups[btn.toggleGroup];
+           if(g){
+               g.remove(btn);
+               btn.un('toggle', toggleGroup);
+           }
+       },
+
+       /**
+        * Gets the pressed button in the passed group or null
+        * @param {String} group
+        * @return Button
+        */
+       getPressed : function(group){
+           var g = groups[group];
+           if(g){
+               for(var i = 0, len = g.length; i < len; i++){
+                   if(g[i].pressed === true){
+                       return g[i];
+                   }
+               }
+           }
+           return null;
+       }
+   };
+}();/**\r
+ * @class Ext.SplitButton\r
+ * @extends Ext.Button\r
+ * A split button that provides a built-in dropdown arrow that can fire an event separately from the default\r
+ * click event of the button.  Typically this would be used to display a dropdown menu that provides additional\r
+ * options to the primary button action, but any custom handler can provide the arrowclick implementation.  Example usage:\r
+ * <pre><code>\r
+// display a dropdown menu:\r
+new Ext.SplitButton({\r
+       renderTo: 'button-ct', // the container id\r
+       text: 'Options',\r
+       handler: optionsHandler, // handle a click on the button itself\r
+       menu: new Ext.menu.Menu({\r
+        items: [\r
+               // these items will render as dropdown menu items when the arrow is clicked:\r
+               {text: 'Item 1', handler: item1Handler},\r
+               {text: 'Item 2', handler: item2Handler}\r
+        ]\r
+       })\r
+});\r
+\r
+// Instead of showing a menu, you provide any type of custom\r
+// functionality you want when the dropdown arrow is clicked:\r
+new Ext.SplitButton({\r
+       renderTo: 'button-ct',\r
+       text: 'Options',\r
+       handler: optionsHandler,\r
+       arrowHandler: myCustomHandler\r
+});\r
+</code></pre>\r
+ * @cfg {Function} arrowHandler A function called when the arrow button is clicked (can be used instead of click event)\r
+ * @cfg {String} arrowTooltip The title attribute of the arrow\r
+ * @constructor\r
+ * Create a new menu button\r
+ * @param {Object} config The config object\r
+ * @xtype splitbutton\r
+ */\r
+Ext.SplitButton = Ext.extend(Ext.Button, {\r
+       // private\r
+    arrowSelector : 'em',\r
+    split: true,\r
 \r
     // private\r
-    hasError : function(){\r
-        return this.error != null;\r
+    initComponent : function(){\r
+        Ext.SplitButton.superclass.initComponent.call(this);\r
+        /**\r
+         * @event arrowclick\r
+         * Fires when this button's arrow is clicked\r
+         * @param {MenuButton} this\r
+         * @param {EventObject} e The click event\r
+         */\r
+        this.addEvents("arrowclick");\r
     },\r
 \r
     // private\r
-    clearError : function(){\r
-        this.error = null;\r
+    onRender : function(){\r
+        Ext.SplitButton.superclass.onRender.apply(this, arguments);\r
+        if(this.arrowTooltip){\r
+            this.el.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;\r
+        }\r
     },\r
 \r
-    \r
-    copy : function(newId) {\r
-        return new this.constructor(Ext.apply({}, this.data), newId || this.id);\r
+    /**\r
+     * Sets this button's arrow click handler.\r
+     * @param {Function} handler The function to call when the arrow is clicked\r
+     * @param {Object} scope (optional) Scope for the function passed above\r
+     */\r
+    setArrowHandler : function(handler, scope){\r
+        this.arrowHandler = handler;\r
+        this.scope = scope;\r
     },\r
 \r
-    \r
-    isModified : function(fieldName){\r
-        return !!(this.modified && this.modified.hasOwnProperty(fieldName));\r
-    }\r
-};\r
-\r
-Ext.StoreMgr = Ext.apply(new Ext.util.MixedCollection(), {\r
-    \r
+    getMenuClass : function(){\r
+        return 'x-btn-split' + (this.arrowAlign == 'bottom' ? '-bottom' : '');\r
+    },\r
 \r
-    \r
-    register : function(){\r
-        for(var i = 0, s; s = arguments[i]; i++){\r
-            this.add(s);\r
-        }\r
+    isClickOnArrow : function(e){\r
+        return this.arrowAlign != 'bottom' ?\r
+               e.getPageX() > this.el.child(this.buttonSelector).getRegion().right :\r
+               e.getPageY() > this.el.child(this.buttonSelector).getRegion().bottom;\r
     },\r
 \r
-    \r
-    unregister : function(){\r
-        for(var i = 0, s; s = arguments[i]; i++){\r
-            this.remove(this.lookup(s));\r
+    // private\r
+    onClick : function(e, t){\r
+        e.preventDefault();\r
+        if(!this.disabled){\r
+            if(this.isClickOnArrow(e)){\r
+                if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
+                    this.showMenu();\r
+                }\r
+                this.fireEvent("arrowclick", this, e);\r
+                if(this.arrowHandler){\r
+                    this.arrowHandler.call(this.scope || this, this, e);\r
+                }\r
+            }else{\r
+                if(this.enableToggle){\r
+                    this.toggle();\r
+                }\r
+                this.fireEvent("click", this, e);\r
+                if(this.handler){\r
+                    this.handler.call(this.scope || this, this, e);\r
+                }\r
+            }\r
         }\r
     },\r
 \r
-    \r
-    lookup : function(id){\r
-        return typeof id == "object" ? id : this.get(id);\r
+    // private\r
+    isMenuTriggerOver : function(e){\r
+        return this.menu && e.target.tagName == 'em';\r
     },\r
 \r
-    // getKey implementation for MixedCollection\r
-    getKey : function(o){\r
-         return o.storeId || o.id;\r
+    // private\r
+    isMenuTriggerOut : function(e, internal){\r
+        return this.menu && e.target.tagName != 'em';\r
     }\r
 });\r
 \r
-Ext.data.Store = function(config){\r
-    this.data = new Ext.util.MixedCollection(false);\r
-    this.data.getKey = function(o){\r
-        return o.id;\r
-    };\r
-    \r
-    this.baseParams = {};\r
-    \r
-    this.paramNames = {\r
-        "start" : "start",\r
-        "limit" : "limit",\r
-        "sort" : "sort",\r
-        "dir" : "dir"\r
-    };\r
-\r
-    if(config && config.data){\r
-        this.inlineData = config.data;\r
-        delete config.data;\r
+Ext.reg('splitbutton', Ext.SplitButton);/**\r
+ * @class Ext.CycleButton\r
+ * @extends Ext.SplitButton\r
+ * A specialized SplitButton that contains a menu of {@link Ext.menu.CheckItem} elements.  The button automatically\r
+ * cycles through each menu item on click, raising the button's {@link #change} event (or calling the button's\r
+ * {@link #changeHandler} function, if supplied) for the active menu item. Clicking on the arrow section of the\r
+ * button displays the dropdown menu just like a normal SplitButton.  Example usage:\r
+ * <pre><code>\r
+var btn = new Ext.CycleButton({\r
+    showText: true,\r
+    prependText: 'View as ',\r
+    items: [{\r
+        text:'text only',\r
+        iconCls:'view-text',\r
+        checked:true\r
+    },{\r
+        text:'HTML',\r
+        iconCls:'view-html'\r
+    }],\r
+    changeHandler:function(btn, item){\r
+        Ext.Msg.alert('Change View', item.text);\r
     }\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Create a new split button\r
+ * @param {Object} config The config object\r
+ * @xtype cycle\r
+ */\r
+Ext.CycleButton = Ext.extend(Ext.SplitButton, {\r
+    /**\r
+     * @cfg {Array} items An array of {@link Ext.menu.CheckItem} <b>config</b> objects to be used when creating the\r
+     * button's menu items (e.g., {text:'Foo', iconCls:'foo-icon'})\r
+     */\r
+    /**\r
+     * @cfg {Boolean} showText True to display the active item's text as the button text (defaults to false)\r
+     */\r
+    /**\r
+     * @cfg {String} prependText A static string to prepend before the active item's text when displayed as the\r
+     * button's text (only applies when showText = true, defaults to '')\r
+     */\r
+    /**\r
+     * @cfg {Function} changeHandler A callback function that will be invoked each time the active menu\r
+     * item in the button's menu has changed.  If this callback is not supplied, the SplitButton will instead\r
+     * fire the {@link #change} event on active item change.  The changeHandler function will be called with the\r
+     * following argument list: (SplitButton this, Ext.menu.CheckItem item)\r
+     */\r
+    /**\r
+     * @cfg {String} forceIcon A css class which sets an image to be used as the static icon for this button.  This\r
+     * icon will always be displayed regardless of which item is selected in the dropdown list.  This overrides the \r
+     * default behavior of changing the button's icon to match the selected item's icon on change.\r
+     */\r
+    /**\r
+     * @property menu\r
+     * @type Menu\r
+     * The {@link Ext.menu.Menu Menu} object used to display the {@link Ext.menu.CheckItem CheckItems} representing the available choices.\r
+     */\r
 \r
-    Ext.apply(this, config);\r
-\r
-    if(this.url && !this.proxy){\r
-        this.proxy = new Ext.data.HttpProxy({url: this.url});\r
-    }\r
+    // private\r
+    getItemText : function(item){\r
+        if(item && this.showText === true){\r
+            var text = '';\r
+            if(this.prependText){\r
+                text += this.prependText;\r
+            }\r
+            text += item.text;\r
+            return text;\r
+        }\r
+        return undefined;\r
+    },\r
 \r
-    if(this.reader){ // reader passed\r
-        if(!this.recordType){\r
-            this.recordType = this.reader.recordType;\r
+    /**\r
+     * Sets the button's active menu item.\r
+     * @param {Ext.menu.CheckItem} item The item to activate\r
+     * @param {Boolean} suppressEvent True to prevent the button's change event from firing (defaults to false)\r
+     */\r
+    setActiveItem : function(item, suppressEvent){\r
+        if(typeof item != 'object'){\r
+            item = this.menu.items.get(item);\r
         }\r
-        if(this.reader.onMetaChange){\r
-            this.reader.onMetaChange = this.onMetaChange.createDelegate(this);\r
+        if(item){\r
+            if(!this.rendered){\r
+                this.text = this.getItemText(item);\r
+                this.iconCls = item.iconCls;\r
+            }else{\r
+                var t = this.getItemText(item);\r
+                if(t){\r
+                    this.setText(t);\r
+                }\r
+                this.setIconClass(item.iconCls);\r
+            }\r
+            this.activeItem = item;\r
+            if(!item.checked){\r
+                item.setChecked(true, true);\r
+            }\r
+            if(this.forceIcon){\r
+                this.setIconClass(this.forceIcon);\r
+            }\r
+            if(!suppressEvent){\r
+                this.fireEvent('change', this, item);\r
+            }\r
         }\r
-    }\r
-\r
-    \r
-    if(this.recordType){\r
-        \r
-        this.fields = this.recordType.prototype.fields;\r
-    }\r
-    this.modified = [];\r
-\r
-    this.addEvents(\r
-        \r
-        'datachanged',\r
-        \r
-        'metachange',\r
-        \r
-        'add',\r
-        \r
-        'remove',\r
-        \r
-        'update',\r
-        \r
-        'clear',\r
-        \r
-        'beforeload',\r
-        \r
-        'load',\r
-        \r
-        'loadexception'\r
-    );\r
-\r
-    if(this.proxy){\r
-        this.relayEvents(this.proxy,  ["loadexception"]);\r
-    }\r
-\r
-    this.sortToggle = {};\r
-    if(this.sortInfo){\r
-        this.setDefaultSort(this.sortInfo.field, this.sortInfo.direction);\r
-    }\r
-\r
-    Ext.data.Store.superclass.constructor.call(this);\r
-\r
-    if(this.storeId || this.id){\r
-        Ext.StoreMgr.register(this);\r
-    }\r
-    if(this.inlineData){\r
-        this.loadData(this.inlineData);\r
-        delete this.inlineData;\r
-    }else if(this.autoLoad){\r
-        this.load.defer(10, this, [\r
-            typeof this.autoLoad == 'object' ?\r
-                this.autoLoad : undefined]);\r
-    }\r
-};\r
-Ext.extend(Ext.data.Store, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    remoteSort : false,\r
+    },\r
 \r
-    \r
-    pruneModifiedRecords : false,\r
+    /**\r
+     * Gets the currently active menu item.\r
+     * @return {Ext.menu.CheckItem} The active item\r
+     */\r
+    getActiveItem : function(){\r
+        return this.activeItem;\r
+    },\r
 \r
-    \r
-   lastOptions : null,\r
+    // private\r
+    initComponent : function(){\r
+        this.addEvents(\r
+            /**\r
+             * @event change\r
+             * Fires after the button's active menu item has changed.  Note that if a {@link #changeHandler} function\r
+             * is set on this CycleButton, it will be called instead on active item change and this change event will\r
+             * not be fired.\r
+             * @param {Ext.CycleButton} this\r
+             * @param {Ext.menu.CheckItem} item The menu item that was selected\r
+             */\r
+            "change"\r
+        );\r
 \r
-    destroy : function(){\r
-        if(this.storeId || this.id){\r
-            Ext.StoreMgr.unregister(this);\r
+        if(this.changeHandler){\r
+            this.on('change', this.changeHandler, this.scope||this);\r
+            delete this.changeHandler;\r
         }\r
-        this.data = null;\r
-        this.purgeListeners();\r
-    },\r
 \r
-    \r
-    add : function(records){\r
-        records = [].concat(records);\r
-        if(records.length < 1){\r
-            return;\r
-        }\r
-        for(var i = 0, len = records.length; i < len; i++){\r
-            records[i].join(this);\r
-        }\r
-        var index = this.data.length;\r
-        this.data.addAll(records);\r
-        if(this.snapshot){\r
-            this.snapshot.addAll(records);\r
+        this.itemCount = this.items.length;\r
+\r
+        this.menu = {cls:'x-cycle-menu', items:[]};\r
+        var checked;\r
+        for(var i = 0, len = this.itemCount; i < len; i++){\r
+            var item = this.items[i];\r
+            item.group = item.group || this.id;\r
+            item.itemIndex = i;\r
+            item.checkHandler = this.checkHandler;\r
+            item.scope = this;\r
+            item.checked = item.checked || false;\r
+            this.menu.items.push(item);\r
+            if(item.checked){\r
+                checked = item;\r
+            }\r
         }\r
-        this.fireEvent("add", this, records, index);\r
-    },\r
+        this.setActiveItem(checked, true);\r
+        Ext.CycleButton.superclass.initComponent.call(this);\r
 \r
-    \r
-    addSorted : function(record){\r
-        var index = this.findInsertIndex(record);\r
-        this.insert(index, record);\r
+        this.on('click', this.toggleSelected, this);\r
     },\r
 \r
-    \r
-    remove : function(record){\r
-        var index = this.data.indexOf(record);\r
-        this.data.removeAt(index);\r
-        if(this.pruneModifiedRecords){\r
-            this.modified.remove(record);\r
-        }\r
-        if(this.snapshot){\r
-            this.snapshot.remove(record);\r
+    // private\r
+    checkHandler : function(item, pressed){\r
+        if(pressed){\r
+            this.setActiveItem(item);\r
         }\r
-        this.fireEvent("remove", this, record, index);\r
-    },\r
-    \r
-    \r
-    removeAt : function(index){\r
-        this.remove(this.getAt(index));    \r
     },\r
 \r
-    \r
-    removeAll : function(){\r
-        this.data.clear();\r
-        if(this.snapshot){\r
-            this.snapshot.clear();\r
-        }\r
-        if(this.pruneModifiedRecords){\r
-            this.modified = [];\r
+    /**\r
+     * This is normally called internally on button click, but can be called externally to advance the button's\r
+     * active item programmatically to the next one in the menu.  If the current item is the last one in the menu\r
+     * the active item will be set to the first item in the menu.\r
+     */\r
+    toggleSelected : function(){\r
+        this.menu.render();\r
+        \r
+        var nextIdx, checkItem;\r
+        for (var i = 1; i < this.itemCount; i++) {\r
+            nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;\r
+            // check the potential item\r
+            checkItem = this.menu.items.itemAt(nextIdx);\r
+            // if its not disabled then check it.\r
+            if (!checkItem.disabled) {\r
+                checkItem.setChecked(true);\r
+                break;\r
+            }\r
         }\r
-        this.fireEvent("clear", this);\r
-    },\r
+    }\r
+});\r
+Ext.reg('cycle', Ext.CycleButton);/**\r
+ * @class Ext.layout.ToolbarLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * Layout manager implicitly used by Ext.Toolbar.\r
+ */\r
+Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
+    monitorResize : true,\r
+    triggerWidth : 18,\r
+    lastOverflow : false,\r
 \r
-    \r
-    insert : function(index, records){\r
-        records = [].concat(records);\r
-        for(var i = 0, len = records.length; i < len; i++){\r
-            this.data.insert(index, records[i]);\r
-            records[i].join(this);\r
+    noItemsMenuText : '<div class="x-toolbar-no-items">(None)</div>',\r
+    // private\r
+    onLayout : function(ct, target){\r
+        if(!this.leftTr){\r
+            target.addClass('x-toolbar-layout-ct');\r
+            target.insertHtml('beforeEnd',\r
+                 '<table cellspacing="0" class="x-toolbar-ct"><tbody><tr><td class="x-toolbar-left" align="left"><table cellspacing="0"><tbody><tr class="x-toolbar-left-row"></tr></tbody></table></td><td class="x-toolbar-right" align="right"><table cellspacing="0" class="x-toolbar-right-ct"><tbody><tr><td><table cellspacing="0"><tbody><tr class="x-toolbar-right-row"></tr></tbody></table></td><td><table cellspacing="0"><tbody><tr class="x-toolbar-extras-row"></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table>');\r
+            this.leftTr = target.child('tr.x-toolbar-left-row', true);\r
+            this.rightTr = target.child('tr.x-toolbar-right-row', true);\r
+            this.extrasTr = target.child('tr.x-toolbar-extras-row', true);\r
         }\r
-        this.fireEvent("add", this, records, index);\r
-    },\r
-\r
-    \r
-    indexOf : function(record){\r
-        return this.data.indexOf(record);\r
-    },\r
-\r
-    \r
-    indexOfId : function(id){\r
-        return this.data.indexOfKey(id);\r
-    },\r
+        var side = this.leftTr;\r
+        var pos = 0;\r
 \r
-    \r
-    getById : function(id){\r
-        return this.data.key(id);\r
+        var items = ct.items.items;\r
+        for(var i = 0, len = items.length, c; i < len; i++, pos++) {\r
+            c = items[i];\r
+            if(c.isFill){\r
+                side = this.rightTr;\r
+                pos = -1;\r
+            }else if(!c.rendered){\r
+                c.render(this.insertCell(c, side, pos));\r
+            }else{\r
+                if(!c.xtbHidden && !this.isValidParent(c, side.childNodes[pos])){\r
+                    var td = this.insertCell(c, side, pos);\r
+                    td.appendChild(c.getDomPositionEl().dom);\r
+                    c.container = Ext.get(td);\r
+                }\r
+            }\r
+        }\r
+        //strip extra empty cells\r
+        this.cleanup(this.leftTr);\r
+        this.cleanup(this.rightTr);\r
+        this.cleanup(this.extrasTr);\r
+        this.fitToSize(target);\r
     },\r
 \r
-    \r
-    getAt : function(index){\r
-        return this.data.itemAt(index);\r
+    cleanup : function(row){\r
+        var cn = row.childNodes;\r
+        for(var i = cn.length-1, c; i >= 0 && (c = cn[i]); i--){\r
+            if(!c.firstChild){\r
+                row.removeChild(c);\r
+            }\r
+        }\r
     },\r
 \r
-    \r
-    getRange : function(start, end){\r
-        return this.data.getRange(start, end);\r
+    insertCell : function(c, side, pos){\r
+        var td = document.createElement('td');\r
+        td.className='x-toolbar-cell';\r
+        side.insertBefore(td, side.childNodes[pos]||null);\r
+        return td;\r
     },\r
 \r
-    // private\r
-    storeOptions : function(o){\r
-        o = Ext.apply({}, o);\r
-        delete o.callback;\r
-        delete o.scope;\r
-        this.lastOptions = o;\r
+    hideItem : function(item){\r
+        var h = (this.hiddens = this.hiddens || []);\r
+        h.push(item);\r
+        item.xtbHidden = true;\r
+        item.xtbWidth = item.getDomPositionEl().dom.parentNode.offsetWidth;\r
+        item.hide();\r
     },\r
 \r
-    \r
-    load : function(options){\r
-        options = options || {};\r
-        if(this.fireEvent("beforeload", this, options) !== false){\r
-            this.storeOptions(options);\r
-            var p = Ext.apply(options.params || {}, this.baseParams);\r
-            if(this.sortInfo && this.remoteSort){\r
-                var pn = this.paramNames;\r
-                p[pn["sort"]] = this.sortInfo.field;\r
-                p[pn["dir"]] = this.sortInfo.direction;\r
-            }\r
-            this.proxy.load(p, this.reader, this.loadRecords, this, options);\r
-            return true;\r
-        } else {\r
-          return false;\r
+    unhideItem : function(item){\r
+        item.show();\r
+        item.xtbHidden = false;\r
+        this.hiddens.remove(item);\r
+        if(this.hiddens.length < 1){\r
+            delete this.hiddens;\r
         }\r
     },\r
 \r
-    \r
-    reload : function(options){\r
-        this.load(Ext.applyIf(options||{}, this.lastOptions));\r
+    getItemWidth : function(c){\r
+        return c.hidden ? (c.xtbWidth || 0) : c.getDomPositionEl().dom.parentNode.offsetWidth;\r
     },\r
 \r
-    // private\r
-    // Called as a callback by the Reader during a load operation.\r
-    loadRecords : function(o, options, success){\r
-        if(!o || success === false){\r
-            if(success !== false){\r
-                this.fireEvent("load", this, [], options);\r
-            }\r
-            if(options.callback){\r
-                options.callback.call(options.scope || this, [], options, false);\r
-            }\r
+    fitToSize : function(t){\r
+        if(this.container.enableOverflow === false){\r
             return;\r
         }\r
-        var r = o.records, t = o.totalRecords || r.length;\r
-        if(!options || options.add !== true){\r
-            if(this.pruneModifiedRecords){\r
-                this.modified = [];\r
+        var w = t.dom.clientWidth;\r
+        var lw = this.lastWidth || 0;\r
+        this.lastWidth = w;\r
+        var iw = t.dom.firstChild.offsetWidth;\r
+\r
+        var clipWidth = w - this.triggerWidth;\r
+        var hideIndex = -1;\r
+\r
+        if(iw > w || (this.hiddens && w >= lw)){\r
+            var i, items = this.container.items.items, len = items.length, c;\r
+            var loopWidth = 0;\r
+            for(i = 0; i < len; i++) {\r
+                c = items[i];\r
+                if(!c.isFill){\r
+                    loopWidth += this.getItemWidth(c);\r
+                    if(loopWidth > clipWidth){\r
+                        if(!c.xtbHidden){\r
+                            this.hideItem(c);\r
+                        }\r
+                    }else{\r
+                        if(c.xtbHidden){\r
+                            this.unhideItem(c);\r
+                        }\r
+                    }\r
+                }\r
             }\r
-            for(var i = 0, len = r.length; i < len; i++){\r
-                r[i].join(this);\r
+        }\r
+        if(this.hiddens){\r
+            this.initMore();\r
+            if(!this.lastOverflow){\r
+                this.container.fireEvent('overflowchange', this.container, true);\r
+                this.lastOverflow = true;\r
             }\r
-            if(this.snapshot){\r
-                this.data = this.snapshot;\r
-                delete this.snapshot;\r
+        }else if(this.more){\r
+            this.clearMenu();\r
+            this.more.destroy();\r
+            delete this.more;\r
+            if(this.lastOverflow){\r
+                this.container.fireEvent('overflowchange', this.container, false);\r
+                this.lastOverflow = false;\r
             }\r
-            this.data.clear();\r
-            this.data.addAll(r);\r
-            this.totalLength = t;\r
-            this.applySort();\r
-            this.fireEvent("datachanged", this);\r
-        }else{\r
-            this.totalLength = Math.max(t, this.data.length+r.length);\r
-            this.add(r);\r
-        }\r
-        this.fireEvent("load", this, r, options);\r
-        if(options.callback){\r
-            options.callback.call(options.scope || this, r, options, true);\r
         }\r
     },\r
 \r
-    \r
-    loadData : function(o, append){\r
-        var r = this.reader.readRecords(o);\r
-        this.loadRecords(r, {add: append}, true);\r
-    },\r
+    createMenuConfig : function(c, hideOnClick){\r
+        var cfg = Ext.apply({}, c.initialConfig),\r
+            group = c.toggleGroup;\r
 \r
-    \r
-    getCount : function(){\r
-        return this.data.length || 0;\r
+        Ext.apply(cfg, {\r
+            text: c.overflowText || c.text,\r
+            iconCls: c.iconCls,\r
+            icon: c.icon,\r
+            itemId: c.itemId,\r
+            disabled: c.disabled,\r
+            handler: c.handler,\r
+            scope: c.scope,\r
+            menu: c.menu,\r
+            hideOnClick: hideOnClick\r
+        });\r
+        if(group || c.enableToggle){\r
+            Ext.apply(cfg, {\r
+                group: group,\r
+                checked: c.pressed,\r
+                listeners: {\r
+                    checkchange: function(item, checked){\r
+                        c.toggle(checked);\r
+                    }\r
+                }\r
+            });\r
+        }\r
+        delete cfg.xtype;\r
+        delete cfg.id;\r
+        return cfg;\r
     },\r
 \r
-    \r
-    getTotalCount : function(){\r
-        return this.totalLength || 0;\r
+    // private\r
+    addComponentToMenu : function(m, c){\r
+        if(c instanceof Ext.Toolbar.Separator){\r
+            m.add('-');\r
+        }else if(Ext.isFunction(c.isXType)){\r
+            if(c.isXType('splitbutton')){\r
+                m.add(this.createMenuConfig(c, true));\r
+            }else if(c.isXType('button')){\r
+                m.add(this.createMenuConfig(c, !c.menu));\r
+            }else if(c.isXType('buttongroup')){\r
+                c.items.each(function(item){\r
+                     this.addComponentToMenu(m, item);\r
+                }, this);\r
+            }\r
+        }\r
     },\r
 \r
-    \r
-    getSortState : function(){\r
-        return this.sortInfo;\r
+    clearMenu : function(){\r
+        var m = this.moreMenu;\r
+        if(m && m.items){\r
+            this.moreMenu.items.each(function(item){\r
+                delete item.menu;\r
+            });\r
+        }\r
     },\r
 \r
     // private\r
-    applySort : function(){\r
-        if(this.sortInfo && !this.remoteSort){\r
-            var s = this.sortInfo, f = s.field;\r
-            this.sortData(f, s.direction);\r
+    beforeMoreShow : function(m){\r
+        var h = this.container.items.items,\r
+            len = h.length,\r
+            c,\r
+            prev,\r
+            needsSep = function(group, item){\r
+                return group.isXType('buttongroup') && !(item instanceof Ext.Toolbar.Separator);\r
+            };\r
+\r
+        this.clearMenu();\r
+        m.removeAll();\r
+        for(var i = 0; i < len; i++){\r
+            c = h[i];\r
+            if(c.xtbHidden){\r
+                if(prev && (needsSep(c, prev) || needsSep(prev, c))){\r
+                    m.add('-');\r
+                }\r
+                this.addComponentToMenu(m, c);\r
+                prev = c;\r
+            }\r
+        }\r
+        // put something so the menu isn't empty\r
+        // if no compatible items found\r
+        if(m.items.length < 1){\r
+            m.add(this.noItemsMenuText);\r
         }\r
     },\r
 \r
-    // private\r
-    sortData : function(f, direction){\r
-        direction = direction || 'ASC';\r
-        var st = this.fields.get(f).sortType;\r
-        var fn = function(r1, r2){\r
-            var v1 = st(r1.data[f]), v2 = st(r2.data[f]);\r
-            return v1 > v2 ? 1 : (v1 < v2 ? -1 : 0);\r
-        };\r
-        this.data.sort(direction, fn);\r
-        if(this.snapshot && this.snapshot != this.data){\r
-            this.snapshot.sort(direction, fn);\r
+    initMore : function(){\r
+        if(!this.more){\r
+            this.moreMenu = new Ext.menu.Menu({\r
+                listeners: {\r
+                    beforeshow: this.beforeMoreShow,\r
+                    scope: this\r
+                }\r
+            });\r
+            this.more = new Ext.Button({\r
+                iconCls: 'x-toolbar-more-icon',\r
+                cls: 'x-toolbar-more',\r
+                menu: this.moreMenu\r
+            });\r
+            var td = this.insertCell(this.more, this.extrasTr, 100);\r
+            this.more.render(td);\r
         }\r
     },\r
 \r
-    \r
-    setDefaultSort : function(field, dir){\r
-        dir = dir ? dir.toUpperCase() : "ASC";\r
-        this.sortInfo = {field: field, direction: dir};\r
-        this.sortToggle[field] = dir;\r
+    destroy : function(){\r
+        Ext.destroy(this.more, this.moreMenu);\r
+        Ext.layout.ToolbarLayout.superclass.destroy.call(this);\r
+    }\r
+    /**\r
+     * @property activeItem\r
+     * @hide\r
+     */\r
+});\r
+\r
+Ext.Container.LAYOUTS.toolbar = Ext.layout.ToolbarLayout;\r
+\r
+/**\r
+ * @class Ext.Toolbar\r
+ * @extends Ext.Container\r
+ * <p>Basic Toolbar class. Although the <tt>{@link Ext.Container#defaultType defaultType}</tt> for Toolbar\r
+ * is <tt>{@link Ext.Button button}</tt>, Toolbar elements (child items for the Toolbar container) may\r
+ * be virtually any type of Component. Toolbar elements can be created explicitly via their constructors,\r
+ * or implicitly via their xtypes, and can be <tt>{@link #add}</tt>ed dynamically.</p>\r
+ * <p>Some items have shortcut strings for creation:</p>\r
+ * <pre>\r
+<u>Shortcut</u>  <u>xtype</u>          <u>Class</u>                  <u>Description</u>\r
+'->'      'tbfill'       {@link Ext.Toolbar.Fill}       begin using the right-justified button container\r
+'-'       'tbseparator'  {@link Ext.Toolbar.Separator}  add a vertical separator bar between toolbar items\r
+' '       'tbspacer'     {@link Ext.Toolbar.Spacer}     add horiztonal space between elements\r
+ * </pre>\r
+ *\r
+ * Example usage of various elements:\r
+ * <pre><code>\r
+var tb = new Ext.Toolbar({\r
+    renderTo: document.body,\r
+    width: 600,\r
+    height: 100,\r
+    items: [\r
+        {\r
+            // xtype: 'button', // default for Toolbars, same as 'tbbutton'\r
+            text: 'Button'\r
+        },\r
+        {\r
+            xtype: 'splitbutton', // same as 'tbsplitbutton'\r
+            text: 'Split Button'\r
+        },\r
+        // begin using the right-justified button container\r
+        '->', // same as {xtype: 'tbfill'}, // Ext.Toolbar.Fill\r
+        {\r
+            xtype: 'textfield',\r
+            name: 'field1',\r
+            emptyText: 'enter search term'\r
+        },\r
+        // add a vertical separator bar between toolbar items\r
+        '-', // same as {xtype: 'tbseparator'} to create Ext.Toolbar.Separator\r
+        'text 1', // same as {xtype: 'tbtext', text: 'text1'} to create Ext.Toolbar.TextItem\r
+        {xtype: 'tbspacer'},// same as ' ' to create Ext.Toolbar.Spacer\r
+        'text 2',\r
+        {xtype: 'tbspacer', width: 50}, // add a 50px space\r
+        'text 3'\r
+    ]\r
+});\r
+ * </code></pre>\r
+ * Example adding a ComboBox within a menu of a button:\r
+ * <pre><code>\r
+// ComboBox creation\r
+var combo = new Ext.form.ComboBox({\r
+    store: new Ext.data.ArrayStore({\r
+        autoDestroy: true,\r
+        fields: ['initials', 'fullname'],\r
+        data : [\r
+            ['FF', 'Fred Flintstone'],\r
+            ['BR', 'Barney Rubble']\r
+        ]\r
+    }),\r
+    displayField: 'fullname',\r
+    typeAhead: true,\r
+    mode: 'local',\r
+    forceSelection: true,\r
+    triggerAction: 'all',\r
+    emptyText: 'Select a name...',\r
+    selectOnFocus: true,\r
+    width: 135,\r
+    getListParent: function() {\r
+        return this.el.up('.x-menu');\r
     },\r
+    iconCls: 'no-icon' //use iconCls if placing within menu to shift to right side of menu\r
+});\r
 \r
-    \r
-    sort : function(fieldName, dir){\r
-        var f = this.fields.get(fieldName);\r
-        if(!f){\r
-            return false;\r
+// put ComboBox in a Menu\r
+var menu = new Ext.menu.Menu({\r
+    id: 'mainMenu',\r
+    items: [\r
+        combo // A Field in a Menu\r
+    ]\r
+});\r
+\r
+// add a Button with the menu\r
+tb.add({\r
+        text:'Button w/ Menu',\r
+        menu: menu  // assign menu by instance\r
+    });\r
+tb.doLayout();\r
+ * </code></pre>\r
+ * @constructor\r
+ * Creates a new Toolbar\r
+ * @param {Object/Array} config A config object or an array of buttons to <tt>{@link #add}</tt>\r
+ * @xtype toolbar\r
+ */\r
+Ext.Toolbar = function(config){\r
+    if(Ext.isArray(config)){\r
+        config = {items: config, layout: 'toolbar'};\r
+    } else {\r
+        config = Ext.apply({\r
+            layout: 'toolbar'\r
+        }, config);\r
+        if(config.buttons) {\r
+            config.items = config.buttons;\r
         }\r
-        if(!dir){\r
-            if(this.sortInfo && this.sortInfo.field == f.name){ // toggle sort dir\r
-                dir = (this.sortToggle[f.name] || "ASC").toggle("ASC", "DESC");\r
+    }\r
+    Ext.Toolbar.superclass.constructor.call(this, config);\r
+};\r
+\r
+(function(){\r
+\r
+var T = Ext.Toolbar;\r
+\r
+Ext.extend(T, Ext.Container, {\r
+\r
+    defaultType: 'button',\r
+\r
+    trackMenus : true,\r
+    internalDefaults: {removeMode: 'container', hideParent: true},\r
+    toolbarCls: 'x-toolbar',\r
+\r
+    initComponent : function(){\r
+        T.superclass.initComponent.call(this);\r
+\r
+        /**\r
+         * @event overflowchange\r
+         * Fires after the overflow state has changed.\r
+         * @param {Object} c The Container\r
+         * @param {Boolean} lastOverflow overflow state\r
+         */\r
+        this.addEvents('overflowchange');\r
+    },\r
+\r
+    // private\r
+    onRender : function(ct, position){\r
+        if(!this.el){\r
+            if(!this.autoCreate){\r
+                this.autoCreate = {\r
+                    cls: this.toolbarCls + ' x-small-editor'\r
+                };\r
+            }\r
+            this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Adds element(s) to the toolbar -- this function takes a variable number of\r
+     * arguments of mixed type and adds them to the toolbar.\r
+     * @param {Mixed} arg1 The following types of arguments are all valid:<br />\r
+     * <ul>\r
+     * <li>{@link Ext.Button} config: A valid button config object (equivalent to {@link #addButton})</li>\r
+     * <li>HtmlElement: Any standard HTML element (equivalent to {@link #addElement})</li>\r
+     * <li>Field: Any form field (equivalent to {@link #addField})</li>\r
+     * <li>Item: Any subclass of {@link Ext.Toolbar.Item} (equivalent to {@link #addItem})</li>\r
+     * <li>String: Any generic string (gets wrapped in a {@link Ext.Toolbar.TextItem}, equivalent to {@link #addText}).\r
+     * Note that there are a few special strings that are treated differently as explained next.</li>\r
+     * <li>'-': Creates a separator element (equivalent to {@link #addSeparator})</li>\r
+     * <li>' ': Creates a spacer element (equivalent to {@link #addSpacer})</li>\r
+     * <li>'->': Creates a fill element (equivalent to {@link #addFill})</li>\r
+     * </ul>\r
+     * @param {Mixed} arg2\r
+     * @param {Mixed} etc.\r
+     * @method add\r
+     */\r
+\r
+    // private\r
+    lookupComponent : function(c){\r
+        if(Ext.isString(c)){\r
+            if(c == '-'){\r
+                c = new T.Separator();\r
+            }else if(c == ' '){\r
+                c = new T.Spacer();\r
+            }else if(c == '->'){\r
+                c = new T.Fill();\r
             }else{\r
-                dir = f.sortDir;\r
+                c = new T.TextItem(c);\r
             }\r
-        }\r
-        var st = (this.sortToggle) ? this.sortToggle[f.name] : null;\r
-        var si = (this.sortInfo) ? this.sortInfo : null;\r
-\r
-        this.sortToggle[f.name] = dir;\r
-        this.sortInfo = {field: f.name, direction: dir};\r
-        if(!this.remoteSort){\r
-            this.applySort();\r
-            this.fireEvent("datachanged", this);\r
+            this.applyDefaults(c);\r
         }else{\r
-            if (!this.load(this.lastOptions)) {\r
-                if (st) {\r
-                    this.sortToggle[f.name] = st;\r
-                }\r
-                if (si) {\r
-                    this.sortInfo = si;\r
-                }\r
+            if(c.isFormField || c.render){ // some kind of form field, some kind of Toolbar.Item\r
+                c = this.constructItem(c);\r
+            }else if(c.tag){ // DomHelper spec\r
+                c = new T.Item({autoEl: c});\r
+            }else if(c.tagName){ // element\r
+                c = new T.Item({el:c});\r
+            }else if(Ext.isObject(c)){ // must be button config?\r
+                c = c.xtype ? this.constructItem(c) : this.constructButton(c);\r
             }\r
         }\r
+        return c;\r
     },\r
 \r
-    \r
-    each : function(fn, scope){\r
-        this.data.each(fn, scope);\r
-    },\r
-\r
-    \r
-    getModifiedRecords : function(){\r
-        return this.modified;\r
+    // private\r
+    applyDefaults : function(c){\r
+        if(!Ext.isString(c)){\r
+            c = Ext.Toolbar.superclass.applyDefaults.call(this, c);\r
+            var d = this.internalDefaults;\r
+            if(c.events){\r
+                Ext.applyIf(c.initialConfig, d);\r
+                Ext.apply(c, d);\r
+            }else{\r
+                Ext.applyIf(c, d);\r
+            }\r
+        }\r
+        return c;\r
     },\r
 \r
     // private\r
-    createFilterFn : function(property, value, anyMatch, caseSensitive){\r
-        if(Ext.isEmpty(value, false)){\r
-            return false;\r
-        }\r
-        value = this.data.createValueMatcher(value, anyMatch, caseSensitive);\r
-        return function(r){\r
-            return value.test(r.data[property]);\r
-        };\r
+    constructItem : function(item, type){\r
+        return Ext.create(item, type || this.defaultType);\r
     },\r
 \r
-    \r
-    sum : function(property, start, end){\r
-        var rs = this.data.items, v = 0;\r
-        start = start || 0;\r
-        end = (end || end === 0) ? end : rs.length-1;\r
+    /**\r
+     * Adds a separator\r
+     * @return {Ext.Toolbar.Item} The separator {@link Ext.Toolbar.Item item}\r
+     */\r
+    addSeparator : function(){\r
+        return this.add(new T.Separator());\r
+    },\r
 \r
-        for(var i = start; i <= end; i++){\r
-            v += (rs[i].data[property] || 0);\r
-        }\r
-        return v;\r
+    /**\r
+     * Adds a spacer element\r
+     * @return {Ext.Toolbar.Spacer} The spacer item\r
+     */\r
+    addSpacer : function(){\r
+        return this.add(new T.Spacer());\r
     },\r
 \r
-    \r
-    filter : function(property, value, anyMatch, caseSensitive){\r
-        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);\r
-        return fn ? this.filterBy(fn) : this.clearFilter();\r
+    /**\r
+     * Forces subsequent additions into the float:right toolbar\r
+     */\r
+    addFill : function(){\r
+        this.add(new T.Fill());\r
     },\r
 \r
-    \r
-    filterBy : function(fn, scope){\r
-        this.snapshot = this.snapshot || this.data;\r
-        this.data = this.queryBy(fn, scope||this);\r
-        this.fireEvent("datachanged", this);\r
+    /**\r
+     * Adds any standard HTML element to the toolbar\r
+     * @param {Mixed} el The element or id of the element to add\r
+     * @return {Ext.Toolbar.Item} The element's item\r
+     */\r
+    addElement : function(el){\r
+        return this.addItem(new T.Item({el:el}));\r
     },\r
 \r
-    \r
-    query : function(property, value, anyMatch, caseSensitive){\r
-        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);\r
-        return fn ? this.queryBy(fn) : this.data.clone();\r
+    /**\r
+     * Adds any Toolbar.Item or subclass\r
+     * @param {Ext.Toolbar.Item} item\r
+     * @return {Ext.Toolbar.Item} The item\r
+     */\r
+    addItem : function(item){\r
+        return Ext.Toolbar.superclass.add.apply(this, arguments);\r
     },\r
 \r
-    \r
-    queryBy : function(fn, scope){\r
-        var data = this.snapshot || this.data;\r
-        return data.filterBy(fn, scope||this);\r
+    /**\r
+     * Adds a button (or buttons). See {@link Ext.Button} for more info on the config.\r
+     * @param {Object/Array} config A button config or array of configs\r
+     * @return {Ext.Button/Array}\r
+     */\r
+    addButton : function(config){\r
+        if(Ext.isArray(config)){\r
+            var buttons = [];\r
+            for(var i = 0, len = config.length; i < len; i++) {\r
+                buttons.push(this.addButton(config[i]));\r
+            }\r
+            return buttons;\r
+        }\r
+        return this.add(this.constructButton(config));\r
     },\r
 \r
-    \r
-    find : function(property, value, start, anyMatch, caseSensitive){\r
-        var fn = this.createFilterFn(property, value, anyMatch, caseSensitive);\r
-        return fn ? this.data.findIndexBy(fn, null, start) : -1;\r
+    /**\r
+     * Adds text to the toolbar\r
+     * @param {String} text The text to add\r
+     * @return {Ext.Toolbar.Item} The element's item\r
+     */\r
+    addText : function(text){\r
+        return this.addItem(new T.TextItem(text));\r
     },\r
 \r
-    \r
-    findBy : function(fn, scope, start){\r
-        return this.data.findIndexBy(fn, scope, start);\r
+    /**\r
+     * Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config\r
+     * @param {Object} config\r
+     * @return {Ext.Toolbar.Item} The element's item\r
+     */\r
+    addDom : function(config){\r
+        return this.add(new T.Item({autoEl: config}));\r
     },\r
 \r
-    \r
-    collect : function(dataIndex, allowNull, bypassFilter){\r
-        var d = (bypassFilter === true && this.snapshot) ?\r
-                this.snapshot.items : this.data.items;\r
-        var v, sv, r = [], l = {};\r
-        for(var i = 0, len = d.length; i < len; i++){\r
-            v = d[i].data[dataIndex];\r
-            sv = String(v);\r
-            if((allowNull || !Ext.isEmpty(v)) && !l[sv]){\r
-                l[sv] = true;\r
-                r[r.length] = v;\r
-            }\r
-        }\r
-        return r;\r
+    /**\r
+     * Adds a dynamically rendered Ext.form field (TextField, ComboBox, etc). Note: the field should not have\r
+     * been rendered yet. For a field that has already been rendered, use {@link #addElement}.\r
+     * @param {Ext.form.Field} field\r
+     * @return {Ext.Toolbar.Item}\r
+     */\r
+    addField : function(field){\r
+        return this.add(field);\r
     },\r
 \r
-    \r
-    clearFilter : function(suppressEvent){\r
-        if(this.isFiltered()){\r
-            this.data = this.snapshot;\r
-            delete this.snapshot;\r
-            if(suppressEvent !== true){\r
-                this.fireEvent("datachanged", this);\r
+    /**\r
+     * Inserts any {@link Ext.Toolbar.Item}/{@link Ext.Button} at the specified index.\r
+     * @param {Number} index The index where the item is to be inserted\r
+     * @param {Object/Ext.Toolbar.Item/Ext.Button/Array} item The button, or button config object to be\r
+     * inserted, or an array of buttons/configs.\r
+     * @return {Ext.Button/Item}\r
+     */\r
+    insertButton : function(index, item){\r
+        if(Ext.isArray(item)){\r
+            var buttons = [];\r
+            for(var i = 0, len = item.length; i < len; i++) {\r
+               buttons.push(this.insertButton(index + i, item[i]));\r
             }\r
+            return buttons;\r
         }\r
-    },\r
-\r
-    \r
-    isFiltered : function(){\r
-        return this.snapshot && this.snapshot != this.data;\r
+        return Ext.Toolbar.superclass.insert.call(this, index, item);\r
     },\r
 \r
     // private\r
-    afterEdit : function(record){\r
-        if(this.modified.indexOf(record) == -1){\r
-            this.modified.push(record);\r
+    initMenuTracking : function(item){\r
+        if(this.trackMenus && item.menu){\r
+            this.mon(item, {\r
+                'menutriggerover' : this.onButtonTriggerOver,\r
+                'menushow' : this.onButtonMenuShow,\r
+                'menuhide' : this.onButtonMenuHide,\r
+                scope: this\r
+            });\r
         }\r
-        this.fireEvent("update", this, record, Ext.data.Record.EDIT);\r
     },\r
 \r
     // private\r
-    afterReject : function(record){\r
-        this.modified.remove(record);\r
-        this.fireEvent("update", this, record, Ext.data.Record.REJECT);\r
+    constructButton : function(item){\r
+        var b = item.events ? item : this.constructItem(item, item.split ? 'splitbutton' : this.defaultType);\r
+        this.initMenuTracking(b);\r
+        return b;\r
     },\r
 \r
     // private\r
-    afterCommit : function(record){\r
-        this.modified.remove(record);\r
-        this.fireEvent("update", this, record, Ext.data.Record.COMMIT);\r
+    onDisable : function(){\r
+        this.items.each(function(item){\r
+             if(item.disable){\r
+                 item.disable();\r
+             }\r
+        });\r
     },\r
 \r
-    \r
-    commitChanges : function(){\r
-        var m = this.modified.slice(0);\r
-        this.modified = [];\r
-        for(var i = 0, len = m.length; i < len; i++){\r
-            m[i].commit();\r
-        }\r
+    // private\r
+    onEnable : function(){\r
+        this.items.each(function(item){\r
+             if(item.enable){\r
+                 item.enable();\r
+             }\r
+        });\r
     },\r
 \r
-    \r
-    rejectChanges : function(){\r
-        var m = this.modified.slice(0);\r
-        this.modified = [];\r
-        for(var i = 0, len = m.length; i < len; i++){\r
-            m[i].reject();\r
+    // private\r
+    onButtonTriggerOver : function(btn){\r
+        if(this.activeMenuBtn && this.activeMenuBtn != btn){\r
+            this.activeMenuBtn.hideMenu();\r
+            btn.showMenu();\r
+            this.activeMenuBtn = btn;\r
         }\r
     },\r
 \r
     // private\r
-    onMetaChange : function(meta, rtype, o){\r
-        this.recordType = rtype;\r
-        this.fields = rtype.prototype.fields;\r
-        delete this.snapshot;\r
-        this.sortInfo = meta.sortInfo;\r
-        this.modified = [];\r
-        this.fireEvent('metachange', this, this.reader.meta);\r
+    onButtonMenuShow : function(btn){\r
+        this.activeMenuBtn = btn;\r
     },\r
 \r
     // private\r
-    findInsertIndex : function(record){\r
-        this.suspendEvents();\r
-        var data = this.data.clone();\r
-        this.data.add(record);\r
-        this.applySort();\r
-        var index = this.data.indexOf(record);\r
-        this.data = data;\r
-        this.resumeEvents();\r
-        return index;\r
+    onButtonMenuHide : function(btn){\r
+        delete this.activeMenuBtn;\r
     }\r
 });\r
+Ext.reg('toolbar', Ext.Toolbar);\r
 \r
-Ext.data.SimpleStore = function(config){\r
-    Ext.data.SimpleStore.superclass.constructor.call(this, Ext.apply(config, {\r
-        reader: new Ext.data.ArrayReader({\r
-                id: config.id\r
-            },\r
-            Ext.data.Record.create(config.fields)\r
-        )\r
-    }));\r
-};\r
-Ext.extend(Ext.data.SimpleStore, Ext.data.Store, {\r
-    loadData : function(data, append){\r
-        if(this.expandData === true){\r
-            var r = [];\r
-            for(var i = 0, len = data.length; i < len; i++){\r
-                r[r.length] = [data[i]];\r
-            }\r
-            data = r;\r
-        }\r
-        Ext.data.SimpleStore.superclass.loadData.call(this, data, append);\r
+/**\r
+ * @class Ext.Toolbar.Item\r
+ * @extends Ext.BoxComponent\r
+ * The base class that other non-interacting Toolbar Item classes should extend in order to\r
+ * get some basic common toolbar item functionality.\r
+ * @constructor\r
+ * Creates a new Item\r
+ * @param {HTMLElement} el\r
+ * @xtype tbitem\r
+ */\r
+T.Item = Ext.extend(Ext.BoxComponent, {\r
+    hideParent: true, //  Hiding a Toolbar.Item hides its containing TD\r
+    enable:Ext.emptyFn,\r
+    disable:Ext.emptyFn,\r
+    focus:Ext.emptyFn\r
+    /**\r
+     * @cfg {String} overflowText Text to be used for the menu if the item is overflowed.\r
+     */\r
+});\r
+Ext.reg('tbitem', T.Item);\r
+\r
+/**\r
+ * @class Ext.Toolbar.Separator\r
+ * @extends Ext.Toolbar.Item\r
+ * A simple class that adds a vertical separator bar between toolbar items\r
+ * (css class:<tt>'xtb-sep'</tt>). Example usage:\r
+ * <pre><code>\r
+new Ext.Panel({\r
+    tbar : [\r
+        'Item 1',\r
+        {xtype: 'tbseparator'}, // or '-'\r
+        'Item 2'\r
+    ]\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Creates a new Separator\r
+ * @xtype tbseparator\r
+ */\r
+T.Separator = Ext.extend(T.Item, {\r
+    onRender : function(ct, position){\r
+        this.el = ct.createChild({tag:'span', cls:'xtb-sep'}, position);\r
     }\r
 });\r
+Ext.reg('tbseparator', T.Separator);\r
 \r
-Ext.data.JsonStore = function(c){\r
-    \r
-    \r
-    Ext.data.JsonStore.superclass.constructor.call(this, Ext.apply(c, {\r
-        proxy: c.proxy || (!c.data ? new Ext.data.HttpProxy({url: c.url}) : undefined),\r
-        reader: new Ext.data.JsonReader(c, c.fields)\r
-    }));\r
-};\r
-Ext.extend(Ext.data.JsonStore, Ext.data.Store);\r
+/**\r
+ * @class Ext.Toolbar.Spacer\r
+ * @extends Ext.Toolbar.Item\r
+ * A simple element that adds extra horizontal space between items in a toolbar.\r
+ * By default a 2px wide space is added via css specification:<pre><code>\r
+.x-toolbar .xtb-spacer {\r
+    width:2px;\r
+}\r
+ * </code></pre>\r
+ * <p>Example usage:</p>\r
+ * <pre><code>\r
+new Ext.Panel({\r
+    tbar : [\r
+        'Item 1',\r
+        {xtype: 'tbspacer'}, // or ' '\r
+        'Item 2',\r
+        // space width is also configurable via javascript\r
+        {xtype: 'tbspacer', width: 50}, // add a 50px space\r
+        'Item 3'\r
+    ]\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Creates a new Spacer\r
+ * @xtype tbspacer\r
+ */\r
+T.Spacer = Ext.extend(T.Item, {\r
+    /**\r
+     * @cfg {Number} width\r
+     * The width of the spacer in pixels (defaults to 2px via css style <tt>.x-toolbar .xtb-spacer</tt>).\r
+     */\r
 \r
-Ext.data.Field = function(config){\r
-    if(typeof config == "string"){\r
-        config = {name: config};\r
-    }\r
-    Ext.apply(this, config);\r
-    \r
-    if(!this.type){\r
-        this.type = "auto";\r
-    }\r
-    \r
-    var st = Ext.data.SortTypes;\r
-    // named sortTypes are supported, here we look them up\r
-    if(typeof this.sortType == "string"){\r
-        this.sortType = st[this.sortType];\r
-    }\r
-    \r
-    // set default sortType for strings and dates\r
-    if(!this.sortType){\r
-        switch(this.type){\r
-            case "string":\r
-                this.sortType = st.asUCString;\r
-                break;\r
-            case "date":\r
-                this.sortType = st.asDate;\r
-                break;\r
-            default:\r
-                this.sortType = st.none;\r
-        }\r
+    onRender : function(ct, position){\r
+        this.el = ct.createChild({tag:'div', cls:'xtb-spacer', style: this.width?'width:'+this.width+'px':''}, position);\r
     }\r
+});\r
+Ext.reg('tbspacer', T.Spacer);\r
 \r
-    // define once\r
-    var stripRe = /[\$,%]/g;\r
-\r
-    // prebuilt conversion function for this field, instead of\r
-    // switching every time we're reading a value\r
-    if(!this.convert){\r
-        var cv, dateFormat = this.dateFormat;\r
-        switch(this.type){\r
-            case "":\r
-            case "auto":\r
-            case undefined:\r
-                cv = function(v){ return v; };\r
-                break;\r
-            case "string":\r
-                cv = function(v){ return (v === undefined || v === null) ? '' : String(v); };\r
-                break;\r
-            case "int":\r
-                cv = function(v){\r
-                    return v !== undefined && v !== null && v !== '' ?\r
-                           parseInt(String(v).replace(stripRe, ""), 10) : '';\r
-                    };\r
-                break;\r
-            case "float":\r
-                cv = function(v){\r
-                    return v !== undefined && v !== null && v !== '' ?\r
-                           parseFloat(String(v).replace(stripRe, ""), 10) : ''; \r
-                    };\r
-                break;\r
-            case "bool":\r
-            case "boolean":\r
-                cv = function(v){ return v === true || v === "true" || v == 1; };\r
-                break;\r
-            case "date":\r
-                cv = function(v){\r
-                    if(!v){\r
-                        return '';\r
-                    }\r
-                    if(Ext.isDate(v)){\r
-                        return v;\r
-                    }\r
-                    if(dateFormat){\r
-                        if(dateFormat == "timestamp"){\r
-                            return new Date(v*1000);\r
-                        }\r
-                        if(dateFormat == "time"){\r
-                            return new Date(parseInt(v, 10));\r
-                        }\r
-                        return Date.parseDate(v, dateFormat);\r
-                    }\r
-                    var parsed = Date.parse(v);\r
-                    return parsed ? new Date(parsed) : null;\r
-                };\r
-             break;\r
-            \r
+/**\r
+ * @class Ext.Toolbar.Fill\r
+ * @extends Ext.Toolbar.Spacer\r
+ * A non-rendering placeholder item which instructs the Toolbar's Layout to begin using\r
+ * the right-justified button container.\r
+ * <pre><code>\r
+new Ext.Panel({\r
+    tbar : [\r
+        'Item 1',\r
+        {xtype: 'tbfill'}, // or '->'\r
+        'Item 2'\r
+    ]\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Creates a new Fill\r
+ * @xtype tbfill\r
+ */\r
+T.Fill = Ext.extend(T.Item, {\r
+    // private\r
+    render : Ext.emptyFn,\r
+    isFill : true\r
+});\r
+Ext.reg('tbfill', T.Fill);\r
+\r
+/**\r
+ * @class Ext.Toolbar.TextItem\r
+ * @extends Ext.Toolbar.Item\r
+ * A simple class that renders text directly into a toolbar\r
+ * (with css class:<tt>'xtb-text'</tt>). Example usage:\r
+ * <pre><code>\r
+new Ext.Panel({\r
+    tbar : [\r
+        {xtype: 'tbtext', text: 'Item 1'} // or simply 'Item 1'\r
+    ]\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Creates a new TextItem\r
+ * @param {String/Object} text A text string, or a config object containing a <tt>text</tt> property\r
+ * @xtype tbtext\r
+ */\r
+T.TextItem = Ext.extend(T.Item, {\r
+    constructor: function(config){\r
+        if (Ext.isString(config)) {\r
+            config = { autoEl: {cls: 'xtb-text', html: config }};\r
+        } else {\r
+            config.autoEl = {cls: 'xtb-text', html: config.text || ''};\r
+        }\r
+        T.TextItem.superclass.constructor.call(this, config);\r
+    },\r
+    /**\r
+     * Updates this item's text, setting the text to be used as innerHTML.\r
+     * @param {String} t The text to display (html accepted).\r
+     */\r
+    setText : function(t) {\r
+        if (this.rendered) {\r
+            this.el.dom.innerHTML = t;\r
+        } else {\r
+            this.autoEl.html = t;\r
         }\r
-        this.convert = cv;\r
     }\r
-};\r
-\r
-Ext.data.Field.prototype = {\r
-    \r
-    \r
-    \r
-    \r
-    dateFormat: null,\r
-    \r
-    defaultValue: "",\r
-    \r
-    mapping: null,\r
-    \r
-    sortType : null,\r
-    \r
-    sortDir : "ASC"\r
-};\r
-\r
-Ext.data.DataReader = function(meta, recordType){\r
-    \r
-    this.meta = meta;\r
-    this.recordType = Ext.isArray(recordType) ? \r
-        Ext.data.Record.create(recordType) : recordType;\r
-};\r
-\r
-Ext.data.DataReader.prototype = {\r
-    \r
-};\r
+});\r
+Ext.reg('tbtext', T.TextItem);\r
 \r
-Ext.data.DataProxy = function(){\r
-    this.addEvents(\r
-        \r
-        'beforeload',\r
-        \r
-        'load'\r
-    );\r
-    Ext.data.DataProxy.superclass.constructor.call(this);\r
-};\r
+// backwards compat\r
+T.Button = Ext.extend(Ext.Button, {});\r
+T.SplitButton = Ext.extend(Ext.SplitButton, {});\r
+Ext.reg('tbbutton', T.Button);\r
+Ext.reg('tbsplit', T.SplitButton);\r
 \r
-Ext.extend(Ext.data.DataProxy, Ext.util.Observable);\r
+})();\r
+/**\r
+ * @class Ext.ButtonGroup\r
+ * @extends Ext.Panel\r
+ * Container for a group of buttons. Example usage:\r
+ * <pre><code>\r
+var p = new Ext.Panel({\r
+    title: 'Panel with Button Group',\r
+    width: 300,\r
+    height:200,\r
+    renderTo: document.body,\r
+    html: 'whatever',\r
+    tbar: [{\r
+        xtype: 'buttongroup',\r
+        {@link #columns}: 3,\r
+        title: 'Clipboard',\r
+        items: [{\r
+            text: 'Paste',\r
+            scale: 'large',\r
+            rowspan: 3, iconCls: 'add',\r
+            iconAlign: 'top',\r
+            cls: 'x-btn-as-arrow'\r
+        },{\r
+            xtype:'splitbutton',\r
+            text: 'Menu Button',\r
+            scale: 'large',\r
+            rowspan: 3,\r
+            iconCls: 'add',\r
+            iconAlign: 'top',\r
+            arrowAlign:'bottom',\r
+            menu: [{text: 'Menu Item 1'}]\r
+        },{\r
+            xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]\r
+        },{\r
+            text: 'Copy', iconCls: 'add16'\r
+        },{\r
+            text: 'Format', iconCls: 'add16'\r
+        }]\r
+    }]\r
+});\r
+ * </code></pre>\r
+ * @xtype buttongroup\r
+ */\r
+Ext.ButtonGroup = Ext.extend(Ext.Panel, {\r
+    /**\r
+     * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the\r
+     * {@link #layout configured layout manager}. See {@link Ext.layout.TableLayout#columns}.\r
+     */\r
+    /**\r
+     * @cfg {String} baseCls  Defaults to <tt>'x-btn-group'</tt>.  See {@link Ext.Panel#baseCls}.\r
+     */\r
+    baseCls: 'x-btn-group',\r
+    /**\r
+     * @cfg {String} layout  Defaults to <tt>'table'</tt>.  See {@link Ext.Container#layout}.\r
+     */\r
+    layout:'table',\r
+    defaultType: 'button',\r
+    /**\r
+     * @cfg {Boolean} frame  Defaults to <tt>true</tt>.  See {@link Ext.Panel#frame}.\r
+     */\r
+    frame: true,\r
+    internalDefaults: {removeMode: 'container', hideParent: true},\r
 \r
-Ext.data.MemoryProxy = function(data){\r
-    Ext.data.MemoryProxy.superclass.constructor.call(this);\r
-    this.data = data;\r
-};\r
+    initComponent : function(){\r
+        this.layoutConfig = this.layoutConfig || {};\r
+        Ext.applyIf(this.layoutConfig, {\r
+            columns : this.columns\r
+        });\r
+        if(!this.title){\r
+            this.addClass('x-btn-group-notitle');\r
+        }\r
+        this.on('afterlayout', this.onAfterLayout, this);\r
+        Ext.ButtonGroup.superclass.initComponent.call(this);\r
+    },\r
 \r
-Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {\r
-    \r
-    \r
-    \r
-    load : function(params, reader, callback, scope, arg){\r
-        params = params || {};\r
-        var result;\r
-        try {\r
-            result = reader.readRecords(this.data);\r
-        }catch(e){\r
-            this.fireEvent("loadexception", this, arg, null, e);\r
-            callback.call(scope, null, arg, false);\r
-            return;\r
+    applyDefaults : function(c){\r
+        c = Ext.ButtonGroup.superclass.applyDefaults.call(this, c);\r
+        var d = this.internalDefaults;\r
+        if(c.events){\r
+            Ext.applyIf(c.initialConfig, d);\r
+            Ext.apply(c, d);\r
+        }else{\r
+            Ext.applyIf(c, d);\r
         }\r
-        callback.call(scope, result, arg, true);\r
+        return c;\r
     },\r
-    \r
-    // private\r
-    update : function(params, records){\r
-        \r
+\r
+    onAfterLayout : function(){\r
+        var bodyWidth = this.body.getFrameWidth('lr') + this.body.dom.firstChild.offsetWidth;\r
+        this.body.setWidth(bodyWidth);\r
+        this.el.setWidth(bodyWidth + this.getFrameWidth());\r
     }\r
+    /**\r
+     * @cfg {Array} tools  @hide\r
+     */\r
 });\r
 \r
-Ext.data.HttpProxy = function(conn){\r
-    Ext.data.HttpProxy.superclass.constructor.call(this);\r
-    \r
-    this.conn = conn;\r
-    this.useAjax = !conn || !conn.events;\r
+Ext.reg('buttongroup', Ext.ButtonGroup);\r
+/**
+ * @class Ext.PagingToolbar
+ * @extends Ext.Toolbar
+ * <p>As the amount of records increases, the time required for the browser to render
+ * them increases. Paging is used to reduce the amount of data exchanged with the client.
+ * Note: if there are more records/rows than can be viewed in the available screen area, vertical
+ * scrollbars will be added.</p>
+ * <p>Paging is typically handled on the server side (see exception below). The client sends
+ * parameters to the server side, which the server needs to interpret and then respond with the
+ * approprate data.</p>
+ * <p><b>Ext.PagingToolbar</b> is a specialized toolbar that is bound to a {@link Ext.data.Store}
+ * and provides automatic paging control. This Component {@link Ext.data.Store#load load}s blocks
+ * of data into the <tt>{@link #store}</tt> by passing {@link Ext.data.Store#paramNames paramNames} used for
+ * paging criteria.</p>
+ * <p>PagingToolbar is typically used as one of the Grid's toolbars:</p>
+ * <pre><code>
+Ext.QuickTips.init(); // to display button quicktips
+
+var myStore = new Ext.data.Store({
+    ...
+});
+
+var myPageSize = 25;  // server script should only send back 25 items
+
+var grid = new Ext.grid.GridPanel({
+    ...
+    store: myStore,
+    bbar: new Ext.PagingToolbar({
+        {@link #store}: myStore,       // grid and PagingToolbar using same store
+        {@link #displayInfo}: true,
+        {@link #pageSize}: myPageSize,
+        {@link #prependButtons}: true,
+        items: [
+            'text 1'
+        ]
+    })
+});
+ * </code></pre>
+ *
+ * <p>To use paging, pass the paging requirements to the server when the store is first loaded.</p>
+ * <pre><code>
+store.load({
+    params: {
+        start: 0,          // specify params for the first page load if using paging
+        limit: myPageSize,
+        foo:   'bar'
+    }
+});
+ * </code></pre>
+ * <p><u>Paging with Local Data</u></p>
+ * <p>Paging can also be accomplished with local data using extensions:</p>
+ * <div class="mdetail-params"><ul>
+ * <li><a href="http://extjs.com/forum/showthread.php?t=57386">Ext.ux.data.PagingStore</a></li>
+ * <li>Paging Memory Proxy (examples/ux/PagingMemoryProxy.js)</li>
+ * </ul></div>
+ * @constructor
+ * Create a new PagingToolbar
+ * @param {Object} config The config object
+ * @xtype paging
+ */
+(function() {
+
+var T = Ext.Toolbar;
+
+Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {
+    /**
+     * @cfg {Ext.data.Store} store
+     * The {@link Ext.data.Store} the paging toolbar should use as its data source (required).
+     */
+    /**
+     * @cfg {Boolean} displayInfo
+     * <tt>true</tt> to display the displayMsg (defaults to <tt>false</tt>)
+     */
+    /**
+     * @cfg {Number} pageSize
+     * The number of records to display per page (defaults to <tt>20</tt>)
+     */
+    pageSize : 20,
+    /**
+     * @cfg {Boolean} prependButtons
+     * <tt>true</tt> to insert any configured <tt>items</tt> <i>before</i> the paging buttons.
+     * Defaults to <tt>false</tt>.
+     */
+    /**
+     * @cfg {String} displayMsg
+     * The paging status message to display (defaults to <tt>'Displaying {0} - {1} of {2}'</tt>).
+     * Note that this string is formatted using the braced numbers <tt>{0}-{2}</tt> as tokens
+     * that are replaced by the values for start, end and total respectively. These tokens should
+     * be preserved when overriding this string if showing those values is desired.
+     */
+    displayMsg : 'Displaying {0} - {1} of {2}',
+    /**
+     * @cfg {String} emptyMsg
+     * The message to display when no records are found (defaults to 'No data to display')
+     */
+    emptyMsg : 'No data to display',
+    /**
+     * @cfg {String} beforePageText
+     * The text displayed before the input item (defaults to <tt>'Page'</tt>).
+     */
+    beforePageText : 'Page',
+    /**
+     * @cfg {String} afterPageText
+     * Customizable piece of the default paging text (defaults to <tt>'of {0}'</tt>). Note that
+     * this string is formatted using <tt>{0}</tt> as a token that is replaced by the number of
+     * total pages. This token should be preserved when overriding this string if showing the
+     * total page count is desired.
+     */
+    afterPageText : 'of {0}',
+    /**
+     * @cfg {String} firstText
+     * The quicktip text displayed for the first page button (defaults to <tt>'First Page'</tt>).
+     * <b>Note</b>: quick tips must be initialized for the quicktip to show.
+     */
+    firstText : 'First Page',
+    /**
+     * @cfg {String} prevText
+     * The quicktip text displayed for the previous page button (defaults to <tt>'Previous Page'</tt>).
+     * <b>Note</b>: quick tips must be initialized for the quicktip to show.
+     */
+    prevText : 'Previous Page',
+    /**
+     * @cfg {String} nextText
+     * The quicktip text displayed for the next page button (defaults to <tt>'Next Page'</tt>).
+     * <b>Note</b>: quick tips must be initialized for the quicktip to show.
+     */
+    nextText : 'Next Page',
+    /**
+     * @cfg {String} lastText
+     * The quicktip text displayed for the last page button (defaults to <tt>'Last Page'</tt>).
+     * <b>Note</b>: quick tips must be initialized for the quicktip to show.
+     */
+    lastText : 'Last Page',
+    /**
+     * @cfg {String} refreshText
+     * The quicktip text displayed for the Refresh button (defaults to <tt>'Refresh'</tt>).
+     * <b>Note</b>: quick tips must be initialized for the quicktip to show.
+     */
+    refreshText : 'Refresh',
+
+    /**
+     * @deprecated
+     * <b>The defaults for these should be set in the data store.</b>
+     * Object mapping of parameter names used for load calls, initially set to:
+     * <pre>{start: 'start', limit: 'limit'}</pre>
+     */
+
+    /**
+     * The number of records to display per page.  See also <tt>{@link #cursor}</tt>.
+     * @type Number
+     * @property pageSize
+     */
+
+    /**
+     * Indicator for the record position.  This property might be used to get the active page
+     * number for example:<pre><code>
+     * // t is reference to the paging toolbar instance
+     * var activePage = Math.ceil((t.cursor + t.pageSize) / t.pageSize);
+     * </code></pre>
+     * @type Number
+     * @property cursor
+     */
+
+    initComponent : function(){
+        var pagingItems = [this.first = new T.Button({
+            tooltip: this.firstText,
+            overflowText: this.firstText,
+            iconCls: 'x-tbar-page-first',
+            disabled: true,
+            handler: this.moveFirst,
+            scope: this
+        }), this.prev = new T.Button({
+            tooltip: this.prevText,
+            overflowText: this.prevText,
+            iconCls: 'x-tbar-page-prev',
+            disabled: true,
+            handler: this.movePrevious,
+            scope: this
+        }), '-', this.beforePageText,
+        this.inputItem = new Ext.form.NumberField({
+            cls: 'x-tbar-page-number',
+            allowDecimals: false,
+            allowNegative: false,
+            enableKeyEvents: true,
+            selectOnFocus: true,
+            listeners: {
+                scope: this,
+                keydown: this.onPagingKeyDown,
+                blur: this.onPagingBlur
+            }
+        }), this.afterTextItem = new T.TextItem({
+            text: String.format(this.afterPageText, 1)
+        }), '-', this.next = new T.Button({
+            tooltip: this.nextText,
+            overflowText: this.nextText,
+            iconCls: 'x-tbar-page-next',
+            disabled: true,
+            handler: this.moveNext,
+            scope: this
+        }), this.last = new T.Button({
+            tooltip: this.lastText,
+            overflowText: this.lastText,
+            iconCls: 'x-tbar-page-last',
+            disabled: true,
+            handler: this.moveLast,
+            scope: this
+        }), '-', this.refresh = new T.Button({
+            tooltip: this.refreshText,
+            overflowText: this.refreshText,
+            iconCls: 'x-tbar-loading',
+            handler: this.refresh,
+            scope: this
+        })];
+
+
+        var userItems = this.items || this.buttons || [];
+        if (this.prependButtons) {
+            this.items = userItems.concat(pagingItems);
+        }else{
+            this.items = pagingItems.concat(userItems);
+        }
+        delete this.buttons;
+        if(this.displayInfo){
+            this.items.push('->');
+            this.items.push(this.displayItem = new T.TextItem({}));
+        }
+        Ext.PagingToolbar.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event change
+             * Fires after the active page has been changed.
+             * @param {Ext.PagingToolbar} this
+             * @param {Object} pageData An object that has these properties:<ul>
+             * <li><code>total</code> : Number <div class="sub-desc">The total number of records in the dataset as
+             * returned by the server</div></li>
+             * <li><code>activePage</code> : Number <div class="sub-desc">The current page number</div></li>
+             * <li><code>pages</code> : Number <div class="sub-desc">The total number of pages (calculated from
+             * the total number of records in the dataset as returned by the server and the current {@link #pageSize})</div></li>
+             * </ul>
+             */
+            'change',
+            /**
+             * @event beforechange
+             * Fires just before the active page is changed.
+             * Return false to prevent the active page from being changed.
+             * @param {Ext.PagingToolbar} this
+             * @param {Object} params An object hash of the parameters which the PagingToolbar will send when
+             * loading the required page. This will contain:<ul>
+             * <li><code>start</code> : Number <div class="sub-desc">The starting row number for the next page of records to
+             * be retrieved from the server</div></li>
+             * <li><code>limit</code> : Number <div class="sub-desc">The number of records to be retrieved from the server</div></li>
+             * </ul>
+             * <p>(note: the names of the <b>start</b> and <b>limit</b> properties are determined
+             * by the store's {@link Ext.data.Store#paramNames paramNames} property.)</p>
+             * <p>Parameters may be added as required in the event handler.</p>
+             */
+            'beforechange'
+        );
+        this.on('afterlayout', this.onFirstLayout, this, {single: true});
+        this.cursor = 0;
+        this.bindStore(this.store);
+    },
+
+    // private
+    onFirstLayout : function(){
+        if(this.dsLoaded){
+            this.onLoad.apply(this, this.dsLoaded);
+        }
+    },
+
+    // private
+    updateInfo : function(){
+        if(this.displayItem){
+            var count = this.store.getCount();
+            var msg = count == 0 ?
+                this.emptyMsg :
+                String.format(
+                    this.displayMsg,
+                    this.cursor+1, this.cursor+count, this.store.getTotalCount()
+                );
+            this.displayItem.setText(msg);
+        }
+    },
+
+    // private
+    onLoad : function(store, r, o){
+        if(!this.rendered){
+            this.dsLoaded = [store, r, o];
+            return;
+        }
+        var p = this.getParams();
+        this.cursor = (o.params && o.params[p.start]) ? o.params[p.start] : 0;
+        var d = this.getPageData(), ap = d.activePage, ps = d.pages;
+
+        this.afterTextItem.setText(String.format(this.afterPageText, d.pages));
+        this.inputItem.setValue(ap);
+        this.first.setDisabled(ap == 1);
+        this.prev.setDisabled(ap == 1);
+        this.next.setDisabled(ap == ps);
+        this.last.setDisabled(ap == ps);
+        this.refresh.enable();
+        this.updateInfo();
+        this.fireEvent('change', this, d);
+    },
+
+    // private
+    getPageData : function(){
+        var total = this.store.getTotalCount();
+        return {
+            total : total,
+            activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),
+            pages :  total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)
+        };
+    },
+
+    /**
+     * Change the active page
+     * @param {Integer} page The page to display
+     */
+    changePage : function(page){
+        this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount()));
+    },
+
+    // private
+    onLoadError : function(){
+        if(!this.rendered){
+            return;
+        }
+        this.refresh.enable();
+    },
+
+    // private
+    readPage : function(d){
+        var v = this.inputItem.getValue(), pageNum;
+        if (!v || isNaN(pageNum = parseInt(v, 10))) {
+            this.inputItem.setValue(d.activePage);
+            return false;
+        }
+        return pageNum;
+    },
+
+    onPagingFocus : function(){
+        this.inputItem.select();
+    },
+
+    //private
+    onPagingBlur : function(e){
+        this.inputItem.setValue(this.getPageData().activePage);
+    },
+
+    // private
+    onPagingKeyDown : function(field, e){
+        var k = e.getKey(), d = this.getPageData(), pageNum;
+        if (k == e.RETURN) {
+            e.stopEvent();
+            pageNum = this.readPage(d);
+            if(pageNum !== false){
+                pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;
+                this.doLoad(pageNum * this.pageSize);
+            }
+        }else if (k == e.HOME || k == e.END){
+            e.stopEvent();
+            pageNum = k == e.HOME ? 1 : d.pages;
+            field.setValue(pageNum);
+        }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){
+            e.stopEvent();
+            if((pageNum = this.readPage(d))){
+                var increment = e.shiftKey ? 10 : 1;
+                if(k == e.DOWN || k == e.PAGEDOWN){
+                    increment *= -1;
+                }
+                pageNum += increment;
+                if(pageNum >= 1 & pageNum <= d.pages){
+                    field.setValue(pageNum);
+                }
+            }
+        }
+    },
+
+    // private
+    getParams : function(){
+        //retain backwards compat, allow params on the toolbar itself, if they exist.
+        return this.paramNames || this.store.paramNames;
+    },
+
+    // private
+    beforeLoad : function(){
+        if(this.rendered && this.refresh){
+            this.refresh.disable();
+        }
+    },
+
+    // private
+    doLoad : function(start){
+        var o = {}, pn = this.getParams();
+        o[pn.start] = start;
+        o[pn.limit] = this.pageSize;
+        if(this.fireEvent('beforechange', this, o) !== false){
+            this.store.load({params:o});
+        }
+    },
+
+    /**
+     * Move to the first page, has the same effect as clicking the 'first' button.
+     */
+    moveFirst : function(){
+        this.doLoad(0);
+    },
+
+    /**
+     * Move to the previous page, has the same effect as clicking the 'previous' button.
+     */
+    movePrevious : function(){
+        this.doLoad(Math.max(0, this.cursor-this.pageSize));
+    },
+
+    /**
+     * Move to the next page, has the same effect as clicking the 'next' button.
+     */
+    moveNext : function(){
+        this.doLoad(this.cursor+this.pageSize);
+    },
+
+    /**
+     * Move to the last page, has the same effect as clicking the 'last' button.
+     */
+    moveLast : function(){
+        var total = this.store.getTotalCount(),
+            extra = total % this.pageSize;
+
+        this.doLoad(extra ? (total - extra) : total - this.pageSize);
+    },
+
+    /**
+     * Refresh the current page, has the same effect as clicking the 'refresh' button.
+     */
+    refresh : function(){
+        this.doLoad(this.cursor);
+    },
+
+    /**
+     * Binds the paging toolbar to the specified {@link Ext.data.Store}
+     * @param {Store} store The store to bind to this toolbar
+     * @param {Boolean} initial (Optional) true to not remove listeners
+     */
+    bindStore : function(store, initial){
+        var doLoad;
+        if(!initial && this.store){
+            this.store.un('beforeload', this.beforeLoad, this);
+            this.store.un('load', this.onLoad, this);
+            this.store.un('exception', this.onLoadError, this);
+            if(store !== this.store && this.store.autoDestroy){
+                this.store.destroy();
+            }
+        }
+        if(store){
+            store = Ext.StoreMgr.lookup(store);
+            store.on({
+                scope: this,
+                beforeload: this.beforeLoad,
+                load: this.onLoad,
+                exception: this.onLoadError
+            });
+            doLoad = store.getCount() > 0;
+        }
+        this.store = store;
+        if(doLoad){
+            this.onLoad(store, null, {});
+        }
+    },
+
+    /**
+     * Unbinds the paging toolbar from the specified {@link Ext.data.Store} <b>(deprecated)</b>
+     * @param {Ext.data.Store} store The data store to unbind
+     */
+    unbind : function(store){
+        this.bindStore(null);
+    },
+
+    /**
+     * Binds the paging toolbar to the specified {@link Ext.data.Store} <b>(deprecated)</b>
+     * @param {Ext.data.Store} store The data store to bind
+     */
+    bind : function(store){
+        this.bindStore(store);
+    },
+
+    // private
+    onDestroy : function(){
+        this.bindStore(null);
+        Ext.PagingToolbar.superclass.onDestroy.call(this);
+    }
+});
+
+})();
+Ext.reg('paging', Ext.PagingToolbar);/**\r
+ * @class Ext.History\r
+ * @extends Ext.util.Observable\r
+ * History management component that allows you to register arbitrary tokens that signify application\r
+ * history state on navigation actions.  You can then handle the history {@link #change} event in order\r
+ * to reset your application UI to the appropriate state when the user navigates forward or backward through\r
+ * the browser history stack.\r
+ * @singleton\r
+ */\r
+Ext.History = (function () {\r
+    var iframe, hiddenField;\r
+    var ready = false;\r
+    var currentToken;\r
 \r
-    \r
-};\r
+    function getHash() {\r
+        var href = top.location.href, i = href.indexOf("#");\r
+        return i >= 0 ? href.substr(i + 1) : null;\r
+    }\r
 \r
-Ext.extend(Ext.data.HttpProxy, Ext.data.DataProxy, {\r
-    \r
-    getConnection : function(){\r
-        return this.useAjax ? Ext.Ajax : this.conn;\r
-    },\r
+    function doSave() {\r
+        hiddenField.value = currentToken;\r
+    }\r
 \r
-    \r
-    load : function(params, reader, callback, scope, arg){\r
-        if(this.fireEvent("beforeload", this, params) !== false){\r
-            var  o = {\r
-                params : params || {},\r
-                request: {\r
-                    callback : callback,\r
-                    scope : scope,\r
-                    arg : arg\r
-                },\r
-                reader: reader,\r
-                callback : this.loadResponse,\r
-                scope: this\r
-            };\r
-            if(this.useAjax){\r
-                Ext.applyIf(o, this.conn);\r
-                if(this.activeRequest){\r
-                    Ext.Ajax.abort(this.activeRequest);\r
-                }\r
-                this.activeRequest = Ext.Ajax.request(o);\r
-            }else{\r
-                this.conn.request(o);\r
-            }\r
-        }else{\r
-            callback.call(scope||this, null, arg, false);\r
-        }\r
-    },\r
+    function handleStateChange(token) {\r
+        currentToken = token;\r
+        Ext.History.fireEvent('change', token);\r
+    }\r
 \r
-    // private\r
-    loadResponse : function(o, success, response){\r
-        delete this.activeRequest;\r
-        if(!success){\r
-            this.fireEvent("loadexception", this, o, response);\r
-            o.request.callback.call(o.request.scope, null, o.request.arg, false);\r
-            return;\r
-        }\r
-        var result;\r
+    function updateIFrame (token) {\r
+        var html = ['<html><body><div id="state">',token,'</div></body></html>'].join('');\r
         try {\r
-            result = o.reader.read(response);\r
-        }catch(e){\r
-            this.fireEvent("loadexception", this, o, response, e);\r
-            o.request.callback.call(o.request.scope, null, o.request.arg, false);\r
-            return;\r
+            var doc = iframe.contentWindow.document;\r
+            doc.open();\r
+            doc.write(html);\r
+            doc.close();\r
+            return true;\r
+        } catch (e) {\r
+            return false;\r
         }\r
-        this.fireEvent("load", this, o, o.request.arg);\r
-        o.request.callback.call(o.request.scope, result, o.request.arg, true);\r
-    },\r
-    \r
-    // private\r
-    update : function(dataSet){\r
-        \r
-    },\r
-    \r
-    // private\r
-    updateResponse : function(dataSet){\r
-        \r
     }\r
-});\r
 \r
-Ext.data.ScriptTagProxy = function(config){\r
-    Ext.data.ScriptTagProxy.superclass.constructor.call(this);\r
-    Ext.apply(this, config);\r
-    this.head = document.getElementsByTagName("head")[0];\r
-    \r
-    \r
-};\r
+    function checkIFrame() {\r
+        if (!iframe.contentWindow || !iframe.contentWindow.document) {\r
+            setTimeout(checkIFrame, 10);\r
+            return;\r
+        }\r
 \r
-Ext.data.ScriptTagProxy.TRANS_ID = 1000;\r
+        var doc = iframe.contentWindow.document;\r
+        var elem = doc.getElementById("state");\r
+        var token = elem ? elem.innerText : null;\r
 \r
-Ext.extend(Ext.data.ScriptTagProxy, Ext.data.DataProxy, {\r
-    \r
-    \r
-    timeout : 30000,\r
-    \r
-    callbackParam : "callback",\r
-    \r
-    nocache : true,\r
+        var hash = getHash();\r
 \r
-    \r
-    load : function(params, reader, callback, scope, arg){\r
-        if(this.fireEvent("beforeload", this, params) !== false){\r
-\r
-            var p = Ext.urlEncode(Ext.apply(params, this.extraParams));\r
-\r
-            var url = this.url;\r
-            url += (url.indexOf("?") != -1 ? "&" : "?") + p;\r
-            if(this.nocache){\r
-                url += "&_dc=" + (new Date().getTime());\r
-            }\r
-            var transId = ++Ext.data.ScriptTagProxy.TRANS_ID;\r
-            var trans = {\r
-                id : transId,\r
-                cb : "stcCallback"+transId,\r
-                scriptId : "stcScript"+transId,\r
-                params : params,\r
-                arg : arg,\r
-                url : url,\r
-                callback : callback,\r
-                scope : scope,\r
-                reader : reader\r
-            };\r
-            var conn = this;\r
+        setInterval(function () {\r
 \r
-            window[trans.cb] = function(o){\r
-                conn.handleResponse(o, trans);\r
-            };\r
+            doc = iframe.contentWindow.document;\r
+            elem = doc.getElementById("state");\r
+\r
+            var newtoken = elem ? elem.innerText : null;\r
 \r
-            url += String.format("&{0}={1}", this.callbackParam, trans.cb);\r
+            var newHash = getHash();\r
 \r
-            if(this.autoAbort !== false){\r
-                this.abort();\r
+            if (newtoken !== token) {\r
+                token = newtoken;\r
+                handleStateChange(token);\r
+                top.location.hash = token;\r
+                hash = token;\r
+                doSave();\r
+            } else if (newHash !== hash) {\r
+                hash = newHash;\r
+                updateIFrame(newHash);\r
             }\r
 \r
-            trans.timeoutId = this.handleFailure.defer(this.timeout, this, [trans]);\r
+        }, 50);\r
 \r
-            var script = document.createElement("script");\r
-            script.setAttribute("src", url);\r
-            script.setAttribute("type", "text/javascript");\r
-            script.setAttribute("id", trans.scriptId);\r
-            this.head.appendChild(script);\r
+        ready = true;\r
 \r
-            this.trans = trans;\r
-        }else{\r
-            callback.call(scope||this, null, arg, false);\r
-        }\r
-    },\r
+        Ext.History.fireEvent('ready', Ext.History);\r
+    }\r
 \r
-    // private\r
-    isLoading : function(){\r
-        return this.trans ? true : false;\r
-    },\r
+    function startUp() {\r
+        currentToken = hiddenField.value ? hiddenField.value : getHash();\r
 \r
-    \r
-    abort : function(){\r
-        if(this.isLoading()){\r
-            this.destroyTrans(this.trans);\r
+        if (Ext.isIE) {\r
+            checkIFrame();\r
+        } else {\r
+            var hash = getHash();\r
+            setInterval(function () {\r
+                var newHash = getHash();\r
+                if (newHash !== hash) {\r
+                    hash = newHash;\r
+                    handleStateChange(hash);\r
+                    doSave();\r
+                }\r
+            }, 50);\r
+            ready = true;\r
+            Ext.History.fireEvent('ready', Ext.History);\r
         }\r
-    },\r
+    }\r
 \r
-    // private\r
-    destroyTrans : function(trans, isLoaded){\r
-        this.head.removeChild(document.getElementById(trans.scriptId));\r
-        clearTimeout(trans.timeoutId);\r
-        if(isLoaded){\r
-            window[trans.cb] = undefined;\r
-            try{\r
-                delete window[trans.cb];\r
-            }catch(e){}\r
-        }else{\r
-            // if hasn't been loaded, wait for load to remove it to prevent script error\r
-            window[trans.cb] = function(){\r
-                window[trans.cb] = undefined;\r
-                try{\r
-                    delete window[trans.cb];\r
-                }catch(e){}\r
-            };\r
-        }\r
-    },\r
+    return {\r
+        /**\r
+         * The id of the hidden field required for storing the current history token.\r
+         * @type String\r
+         * @property\r
+         */\r
+        fieldId: 'x-history-field',\r
+        /**\r
+         * The id of the iframe required by IE to manage the history stack.\r
+         * @type String\r
+         * @property\r
+         */\r
+        iframeId: 'x-history-frame',\r
+        \r
+        events:{},\r
 \r
-    // private\r
-    handleResponse : function(o, trans){\r
-        this.trans = false;\r
-        this.destroyTrans(trans, true);\r
-        var result;\r
-        try {\r
-            result = trans.reader.readRecords(o);\r
-        }catch(e){\r
-            this.fireEvent("loadexception", this, o, trans.arg, e);\r
-            trans.callback.call(trans.scope||window, null, trans.arg, false);\r
-            return;\r
-        }\r
-        this.fireEvent("load", this, o, trans.arg);\r
-        trans.callback.call(trans.scope||window, result, trans.arg, true);\r
-    },\r
+        /**\r
+         * Initialize the global History instance.\r
+         * @param {Boolean} onReady (optional) A callback function that will be called once the history\r
+         * component is fully initialized.\r
+         * @param {Object} scope (optional) The callback scope\r
+         */\r
+        init: function (onReady, scope) {\r
+            if(ready) {\r
+                Ext.callback(onReady, scope, [this]);\r
+                return;\r
+            }\r
+            if(!Ext.isReady){\r
+                Ext.onReady(function(){\r
+                    Ext.History.init(onReady, scope);\r
+                });\r
+                return;\r
+            }\r
+            hiddenField = Ext.getDom(Ext.History.fieldId);\r
+            if (Ext.isIE) {\r
+                iframe = Ext.getDom(Ext.History.iframeId);\r
+            }\r
+            this.addEvents('ready', 'change');\r
+            if(onReady){\r
+                this.on('ready', onReady, scope, {single:true});\r
+            }\r
+            startUp();\r
+        },\r
 \r
-    // private\r
-    handleFailure : function(trans){\r
-        this.trans = false;\r
-        this.destroyTrans(trans, false);\r
-        this.fireEvent("loadexception", this, null, trans.arg);\r
-        trans.callback.call(trans.scope||window, null, trans.arg, false);\r
-    }\r
+        /**\r
+         * Add a new token to the history stack. This can be any arbitrary value, although it would\r
+         * commonly be the concatenation of a component id and another id marking the specifc history\r
+         * state of that component.  Example usage:\r
+         * <pre><code>\r
+// Handle tab changes on a TabPanel\r
+tabPanel.on('tabchange', function(tabPanel, tab){\r
+    Ext.History.add(tabPanel.id + ':' + tab.id);\r
 });\r
+</code></pre>\r
+         * @param {String} token The value that defines a particular application-specific history state\r
+         * @param {Boolean} preventDuplicates When true, if the passed token matches the current token\r
+         * it will not save a new history step. Set to false if the same state can be saved more than once\r
+         * at the same history stack location (defaults to true).\r
+         */\r
+        add: function (token, preventDup) {\r
+            if(preventDup !== false){\r
+                if(this.getToken() == token){\r
+                    return true;\r
+                }\r
+            }\r
+            if (Ext.isIE) {\r
+                return updateIFrame(token);\r
+            } else {\r
+                top.location.hash = token;\r
+                return true;\r
+            }\r
+        },\r
 \r
-Ext.data.JsonReader = function(meta, recordType){\r
-    meta = meta || {};\r
-    Ext.data.JsonReader.superclass.constructor.call(this, meta, recordType || meta.fields);\r
-};\r
-Ext.extend(Ext.data.JsonReader, Ext.data.DataReader, {\r
-    \r
-    \r
-    read : function(response){\r
-        var json = response.responseText;\r
-        var o = eval("("+json+")");\r
-        if(!o) {\r
-            throw {message: "JsonReader.read: Json object not found"};\r
+        /**\r
+         * Programmatically steps back one step in browser history (equivalent to the user pressing the Back button).\r
+         */\r
+        back: function(){\r
+            history.go(-1);\r
+        },\r
+\r
+        /**\r
+         * Programmatically steps forward one step in browser history (equivalent to the user pressing the Forward button).\r
+         */\r
+        forward: function(){\r
+            history.go(1);\r
+        },\r
+\r
+        /**\r
+         * Retrieves the currently-active history token.\r
+         * @return {String} The token\r
+         */\r
+        getToken: function() {\r
+            return ready ? currentToken : getHash();\r
         }\r
-        return this.readRecords(o);\r
-    },\r
+    };\r
+})();\r
+Ext.apply(Ext.History, new Ext.util.Observable());/**\r
+ * @class Ext.Tip\r
+ * @extends Ext.Panel\r
+ * This is the base class for {@link Ext.QuickTip} and {@link Ext.Tooltip} that provides the basic layout and\r
+ * positioning that all tip-based classes require. This class can be used directly for simple, statically-positioned\r
+ * tips that are displayed programmatically, or it can be extended to provide custom tip implementations.\r
+ * @constructor\r
+ * Create a new Tip\r
+ * @param {Object} config The configuration options\r
+ */\r
+Ext.Tip = Ext.extend(Ext.Panel, {\r
+    /**\r
+     * @cfg {Boolean} closable True to render a close tool button into the tooltip header (defaults to false).\r
+     */\r
+    /**\r
+     * @cfg {Number} width\r
+     * Width in pixels of the tip (defaults to auto).  Width will be ignored if it exceeds the bounds of\r
+     * {@link #minWidth} or {@link #maxWidth}.  The maximum supported value is 500.\r
+     */\r
+    /**\r
+     * @cfg {Number} minWidth The minimum width of the tip in pixels (defaults to 40).\r
+     */\r
+    minWidth : 40,\r
+    /**\r
+     * @cfg {Number} maxWidth The maximum width of the tip in pixels (defaults to 300).  The maximum supported value is 500.\r
+     */\r
+    maxWidth : 300,\r
+    /**\r
+     * @cfg {Boolean/String} shadow True or "sides" for the default effect, "frame" for 4-way shadow, and "drop"\r
+     * for bottom-right shadow (defaults to "sides").\r
+     */\r
+    shadow : "sides",\r
+    /**\r
+     * @cfg {String} defaultAlign <b>Experimental</b>. The default {@link Ext.Element#alignTo} anchor position value\r
+     * for this tip relative to its element of origin (defaults to "tl-bl?").\r
+     */\r
+    defaultAlign : "tl-bl?",\r
+    autoRender: true,\r
+    quickShowInterval : 250,\r
 \r
-    // private function a store will implement\r
-    onMetaChange : function(meta, recordType, o){\r
+    // private panel overrides\r
+    frame:true,\r
+    hidden:true,\r
+    baseCls: 'x-tip',\r
+    floating:{shadow:true,shim:true,useDisplay:true,constrain:false},\r
+    autoHeight:true,\r
 \r
-    },\r
+    closeAction: 'hide',\r
 \r
-    \r
-    simpleAccess: function(obj, subsc) {\r
-       return obj[subsc];\r
+    // private\r
+    initComponent : function(){\r
+        Ext.Tip.superclass.initComponent.call(this);\r
+        if(this.closable && !this.title){\r
+            this.elements += ',header';\r
+        }\r
     },\r
 \r
-       \r
-    getJsonAccessor: function(){\r
-        var re = /[\[\.]/;\r
-        return function(expr) {\r
-            try {\r
-                return(re.test(expr))\r
-                    ? new Function("obj", "return obj." + expr)\r
-                    : function(obj){\r
-                        return obj[expr];\r
-                    };\r
-            } catch(e){}\r
-            return Ext.emptyFn;\r
-        };\r
-    }(),\r
-\r
-    \r
-    readRecords : function(o){\r
-        \r
-        this.jsonData = o;\r
-        if(o.metaData){\r
-            delete this.ef;\r
-            this.meta = o.metaData;\r
-            this.recordType = Ext.data.Record.create(o.metaData.fields);\r
-            this.onMetaChange(this.meta, this.recordType, o);\r
-        }\r
-        var s = this.meta, Record = this.recordType,\r
-            f = Record.prototype.fields, fi = f.items, fl = f.length;\r
-\r
-//      Generate extraction functions for the totalProperty, the root, the id, and for each field\r
-        if (!this.ef) {\r
-            if(s.totalProperty) {\r
-                   this.getTotal = this.getJsonAccessor(s.totalProperty);\r
-               }\r
-               if(s.successProperty) {\r
-                   this.getSuccess = this.getJsonAccessor(s.successProperty);\r
-               }\r
-               this.getRoot = s.root ? this.getJsonAccessor(s.root) : function(p){return p;};\r
-               if (s.id) {\r
-                       var g = this.getJsonAccessor(s.id);\r
-                       this.getId = function(rec) {\r
-                               var r = g(rec);\r
-                               return (r === undefined || r === "") ? null : r;\r
-                       };\r
-               } else {\r
-                       this.getId = function(){return null;};\r
-               }\r
-            this.ef = [];\r
-            for(var i = 0; i < fl; i++){\r
-                f = fi[i];\r
-                var map = (f.mapping !== undefined && f.mapping !== null) ? f.mapping : f.name;\r
-                this.ef[i] = this.getJsonAccessor(map);\r
-            }\r
+    // private\r
+    afterRender : function(){\r
+        Ext.Tip.superclass.afterRender.call(this);\r
+        if(this.closable){\r
+            this.addTool({\r
+                id: 'close',\r
+                handler: this[this.closeAction],\r
+                scope: this\r
+            });\r
         }\r
+    },\r
 \r
-       var root = this.getRoot(o), c = root.length, totalRecords = c, success = true;\r
-       if(s.totalProperty){\r
-            var v = parseInt(this.getTotal(o), 10);\r
-            if(!isNaN(v)){\r
-                totalRecords = v;\r
-            }\r
+    /**\r
+     * Shows this tip at the specified XY position.  Example usage:\r
+     * <pre><code>\r
+// Show the tip at x:50 and y:100\r
+tip.showAt([50,100]);\r
+</code></pre>\r
+     * @param {Array} xy An array containing the x and y coordinates\r
+     */\r
+    showAt : function(xy){\r
+        Ext.Tip.superclass.show.call(this);\r
+        if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){\r
+            this.doAutoWidth();\r
         }\r
-        if(s.successProperty){\r
-            var v = this.getSuccess(o);\r
-            if(v === false || v === 'false'){\r
-                success = false;\r
-            }\r
+        if(this.constrainPosition){\r
+            xy = this.el.adjustForConstraints(xy);\r
         }\r
-        var records = [];\r
-           for(var i = 0; i < c; i++){\r
-                   var n = root[i];\r
-               var values = {};\r
-               var id = this.getId(n);\r
-               for(var j = 0; j < fl; j++){\r
-                   f = fi[j];\r
-                var v = this.ef[j](n);\r
-                values[f.name] = f.convert((v !== undefined) ? v : f.defaultValue, n);\r
-               }\r
-               var record = new Record(values, id);\r
-               record.json = n;\r
-               records[i] = record;\r
-           }\r
-           return {\r
-               success : success,\r
-               records : records,\r
-               totalRecords : totalRecords\r
-           };\r
-    }\r
-});\r
+        this.setPagePosition(xy[0], xy[1]);\r
+    },\r
 \r
-Ext.data.XmlReader = function(meta, recordType){\r
-    meta = meta || {};\r
-    Ext.data.XmlReader.superclass.constructor.call(this, meta, recordType || meta.fields);\r
-};\r
-Ext.extend(Ext.data.XmlReader, Ext.data.DataReader, {\r
-    \r
-    read : function(response){\r
-        var doc = response.responseXML;\r
-        if(!doc) {\r
-            throw {message: "XmlReader.read: XML Document not available"};\r
+    // protected\r
+    doAutoWidth : function(){\r
+        var bw = this.body.getTextWidth();\r
+        if(this.title){\r
+            bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));\r
+        }\r
+        bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");\r
+        this.setWidth(bw.constrain(this.minWidth, this.maxWidth));\r
+        \r
+        // IE7 repaint bug on initial show\r
+        if(Ext.isIE7 && !this.repainted){\r
+            this.el.repaint();\r
+            this.repainted = true;\r
         }\r
-        return this.readRecords(doc);\r
     },\r
 \r
-    \r
-    readRecords : function(doc){\r
-        \r
-        this.xmlData = doc;\r
-        var root = doc.documentElement || doc;\r
-       var q = Ext.DomQuery;\r
-       var recordType = this.recordType, fields = recordType.prototype.fields;\r
-       var sid = this.meta.id;\r
-       var totalRecords = 0, success = true;\r
-       if(this.meta.totalRecords){\r
-           totalRecords = q.selectNumber(this.meta.totalRecords, root, 0);\r
-       }\r
-\r
-        if(this.meta.success){\r
-            var sv = q.selectValue(this.meta.success, root, true);\r
-            success = sv !== false && sv !== 'false';\r
-       }\r
-       var records = [];\r
-       var ns = q.select(this.meta.record, root);\r
-        for(var i = 0, len = ns.length; i < len; i++) {\r
-               var n = ns[i];\r
-               var values = {};\r
-               var id = sid ? q.selectValue(sid, n) : undefined;\r
-               for(var j = 0, jlen = fields.length; j < jlen; j++){\r
-                   var f = fields.items[j];\r
-                var v = q.selectValue(f.mapping || f.name, n, f.defaultValue);\r
-                   v = f.convert(v, n);\r
-                   values[f.name] = v;\r
-               }\r
-               var record = new recordType(values, id);\r
-               record.node = n;\r
-               records[records.length] = record;\r
-           }\r
+    /**\r
+     * <b>Experimental</b>. Shows this tip at a position relative to another element using a standard {@link Ext.Element#alignTo}\r
+     * anchor position value.  Example usage:\r
+     * <pre><code>\r
+// Show the tip at the default position ('tl-br?')\r
+tip.showBy('my-el');\r
 \r
-           return {\r
-               success : success,\r
-               records : records,\r
-               totalRecords : totalRecords || records.length\r
-           };\r
-    }\r
-});\r
+// Show the tip's top-left corner anchored to the element's top-right corner\r
+tip.showBy('my-el', 'tl-tr');\r
+</code></pre>\r
+     * @param {Mixed} el An HTMLElement, Ext.Element or string id of the target element to align to\r
+     * @param {String} position (optional) A valid {@link Ext.Element#alignTo} anchor position (defaults to 'tl-br?' or\r
+     * {@link #defaultAlign} if specified).\r
+     */\r
+    showBy : function(el, pos){\r
+        if(!this.rendered){\r
+            this.render(Ext.getBody());\r
+        }\r
+        this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));\r
+    },\r
 \r
-Ext.data.ArrayReader = Ext.extend(Ext.data.JsonReader, {\r
-    \r
-    readRecords : function(o){\r
-        var sid = this.meta ? this.meta.id : null;\r
-       var recordType = this.recordType, fields = recordType.prototype.fields;\r
-       var records = [];\r
-       var root = o;\r
-           for(var i = 0; i < root.length; i++){\r
-                   var n = root[i];\r
-               var values = {};\r
-               var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null);\r
-               for(var j = 0, jlen = fields.length; j < jlen; j++){\r
-                var f = fields.items[j];\r
-                var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j;\r
-                var v = n[k] !== undefined ? n[k] : f.defaultValue;\r
-                v = f.convert(v, n);\r
-                values[f.name] = v;\r
-            }\r
-               var record = new recordType(values, id);\r
-               record.json = n;\r
-               records[records.length] = record;\r
-           }\r
-           return {\r
-               records : records,\r
-               totalRecords : records.length\r
-           };\r
+    initDraggable : function(){\r
+        this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);\r
+        this.header.addClass('x-tip-draggable');\r
     }\r
 });\r
 \r
-Ext.data.Tree = function(root){\r
-   this.nodeHash = {};\r
-   \r
-   this.root = null;\r
-   if(root){\r
-       this.setRootNode(root);\r
-   }\r
-   this.addEvents(\r
-       \r
-       "append",\r
-       \r
-       "remove",\r
-       \r
-       "move",\r
-       \r
-       "insert",\r
-       \r
-       "beforeappend",\r
-       \r
-       "beforeremove",\r
-       \r
-       "beforemove",\r
-       \r
-       "beforeinsert"\r
-   );\r
-\r
-    Ext.data.Tree.superclass.constructor.call(this);\r
+// private - custom Tip DD implementation\r
+Ext.Tip.DD = function(tip, config){\r
+    Ext.apply(this, config);\r
+    this.tip = tip;\r
+    Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);\r
+    this.setHandleElId(tip.header.id);\r
+    this.scroll = false;\r
 };\r
 \r
-Ext.extend(Ext.data.Tree, Ext.util.Observable, {\r
-    \r
-    pathSeparator: "/",\r
-\r
-    // private\r
-    proxyNodeEvent : function(){\r
-        return this.fireEvent.apply(this, arguments);\r
+Ext.extend(Ext.Tip.DD, Ext.dd.DD, {\r
+    moveOnly:true,\r
+    scroll:false,\r
+    headerOffsets:[100, 25],\r
+    startDrag : function(){\r
+        this.tip.el.disableShadow();\r
     },\r
+    endDrag : function(e){\r
+        this.tip.el.enableShadow(true);\r
+    }\r
+});/**\r
+ * @class Ext.ToolTip\r
+ * @extends Ext.Tip\r
+ * A standard tooltip implementation for providing additional information when hovering over a target element.\r
+ * @constructor\r
+ * Create a new Tooltip\r
+ * @param {Object} config The configuration options\r
+ */\r
+Ext.ToolTip = Ext.extend(Ext.Tip, {\r
+    /**\r
+     * When a Tooltip is configured with the {@link #delegate} option to cause selected child elements of the {@link #target}\r
+     * Element to each trigger a seperate show event, this property is set to the DOM element which triggered the show.\r
+     * @type DOMElement\r
+     * @property triggerElement\r
+     */\r
+    /**\r
+     * @cfg {Mixed} target The target HTMLElement, Ext.Element or id to monitor for mouseover events to trigger\r
+     * showing this ToolTip.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} autoHide True to automatically hide the tooltip after the mouse exits the target element\r
+     * or after the {@link #dismissDelay} has expired if set (defaults to true).  If {@link closable} = true a close\r
+     * tool button will be rendered into the tooltip header.\r
+     */\r
+    /**\r
+     * @cfg {Number} showDelay Delay in milliseconds before the tooltip displays after the mouse enters the\r
+     * target element (defaults to 500)\r
+     */\r
+    showDelay: 500,\r
+    /**\r
+     * @cfg {Number} hideDelay Delay in milliseconds after the mouse exits the target element but before the\r
+     * tooltip actually hides (defaults to 200).  Set to 0 for the tooltip to hide immediately.\r
+     */\r
+    hideDelay: 200,\r
+    /**\r
+     * @cfg {Number} dismissDelay Delay in milliseconds before the tooltip automatically hides (defaults to 5000).\r
+     * To disable automatic hiding, set dismissDelay = 0.\r
+     */\r
+    dismissDelay: 5000,\r
+    /**\r
+     * @cfg {Array} mouseOffset An XY offset from the mouse position where the tooltip should be shown (defaults to [15,18]).\r
+     */\r
+    /**\r
+     * @cfg {Boolean} trackMouse True to have the tooltip follow the mouse as it moves over the target element (defaults to false).\r
+     */\r
+    trackMouse : false,\r
+    /**\r
+     * @cfg {Boolean} anchorToTarget True to anchor the tooltip to the target element, false to\r
+     * anchor it relative to the mouse coordinates (defaults to true).  When anchorToTarget is\r
+     * true, use {@link #defaultAlign} to control tooltip alignment to the target element.  When\r
+     * anchorToTarget is false, use {@link #anchorPosition} instead to control alignment.\r
+     */\r
+    anchorToTarget: true,\r
+    /**\r
+     * @cfg {Number} anchorOffset A numeric pixel value used to offset the default position of the\r
+     * anchor arrow (defaults to 0).  When the anchor position is on the top or bottom of the tooltip,\r
+     * anchorOffset will be used as a horizontal offset.  Likewise, when the anchor position is on the\r
+     * left or right side, anchorOffset will be used as a vertical offset.\r
+     */\r
+    anchorOffset: 0,\r
+    /**\r
+     * @cfg {String} delegate <p>Optional. A {@link Ext.DomQuery DomQuery} selector which allows selection of individual elements\r
+     * within the {@link #target} element to trigger showing and hiding the ToolTip as the mouse moves within the target.</p>\r
+     * <p>When specified, the child element of the target which caused a show event is placed into the {@link #triggerElement} property\r
+     * before the ToolTip is shown.</p>\r
+     * <p>This may be useful when a Component has regular, repeating elements in it, each of which need a Tooltip which contains\r
+     * information specific to that element. For example:</p><pre><code>\r
+var myGrid = new Ext.grid.gridPanel(gridConfig);\r
+myGrid.on('render', function(grid) {\r
+    var store = grid.getStore();  // Capture the Store.\r
+    var view = grid.getView();    // Capture the GridView.\r
+    myGrid.tip = new Ext.ToolTip({\r
+        target: view.mainBody,    // The overall target element.\r
+        delegate: '.x-grid3-row', // Each grid row causes its own seperate show and hide.\r
+        trackMouse: true,         // Moving within the row should not hide the tip.\r
+        renderTo: document.body,  // Render immediately so that tip.body can be referenced prior to the first show.\r
+        listeners: {              // Change content dynamically depending on which element triggered the show.\r
+            beforeshow: function updateTipBody(tip) {\r
+                var rowIndex = view.findRowIndex(tip.triggerElement);\r
+                tip.body.dom.innerHTML = "Over Record ID " + store.getAt(rowIndex).id;\r
+            }\r
+        }\r
+    });\r
+});</code></pre>\r
+     */\r
 \r
-    \r
-    getRootNode : function(){\r
-        return this.root;\r
-    },\r
+    // private\r
+    targetCounter: 0,\r
 \r
-    \r
-    setRootNode : function(node){\r
-        this.root = node;\r
-        node.ownerTree = this;\r
-        node.isRoot = true;\r
-        this.registerNode(node);\r
-        return node;\r
-    },\r
+    constrainPosition: false,\r
 \r
-    \r
-    getNodeById : function(id){\r
-        return this.nodeHash[id];\r
+    // private\r
+    initComponent: function(){\r
+        Ext.ToolTip.superclass.initComponent.call(this);\r
+        this.lastActive = new Date();\r
+        this.initTarget(this.target);\r
+        this.origAnchor = this.anchor;\r
     },\r
 \r
     // private\r
-    registerNode : function(node){\r
-        this.nodeHash[node.id] = node;\r
+    onRender : function(ct, position){\r
+        Ext.ToolTip.superclass.onRender.call(this, ct, position);\r
+        this.anchorCls = 'x-tip-anchor-' + this.getAnchorPosition();\r
+        this.anchorEl = this.el.createChild({\r
+            cls: 'x-tip-anchor ' + this.anchorCls\r
+        });\r
     },\r
 \r
     // private\r
-    unregisterNode : function(node){\r
-        delete this.nodeHash[node.id];\r
+    afterRender : function(){\r
+        Ext.ToolTip.superclass.afterRender.call(this);\r
+        this.anchorEl.setStyle('z-index', this.el.getZIndex() + 1);\r
     },\r
 \r
-    toString : function(){\r
-        return "[Tree"+(this.id?" "+this.id:"")+"]";\r
-    }\r
-});\r
-\r
-\r
-Ext.data.Node = function(attributes){\r
-    \r
-    this.attributes = attributes || {};\r
-    this.leaf = this.attributes.leaf;\r
-    \r
-    this.id = this.attributes.id;\r
-    if(!this.id){\r
-        this.id = Ext.id(null, "ynode-");\r
-        this.attributes.id = this.id;\r
-    }\r
-    \r
-    this.childNodes = [];\r
-    if(!this.childNodes.indexOf){ // indexOf is a must\r
-        this.childNodes.indexOf = function(o){\r
-            for(var i = 0, len = this.length; i < len; i++){\r
-                if(this[i] == o) return i;\r
-            }\r
-            return -1;\r
-        };\r
-    }\r
-    \r
-    this.parentNode = null;\r
-    \r
-    this.firstChild = null;\r
-    \r
-    this.lastChild = null;\r
-    \r
-    this.previousSibling = null;\r
-    \r
-    this.nextSibling = null;\r
-\r
-    this.addEvents({\r
-       \r
-       "append" : true,\r
-       \r
-       "remove" : true,\r
-       \r
-       "move" : true,\r
-       \r
-       "insert" : true,\r
-       \r
-       "beforeappend" : true,\r
-       \r
-       "beforeremove" : true,\r
-       \r
-       "beforemove" : true,\r
-       \r
-       "beforeinsert" : true\r
-   });\r
-    this.listeners = this.attributes.listeners;\r
-    Ext.data.Node.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.data.Node, Ext.util.Observable, {\r
-    // private\r
-    fireEvent : function(evtName){\r
-        // first do standard event for this node\r
-        if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){\r
-            return false;\r
+    /**\r
+     * Binds this ToolTip to the specified element. The tooltip will be displayed when the mouse moves over the element.\r
+     * @param {Mixed} t The Element, HtmlElement, or ID of an element to bind to\r
+     */\r
+    initTarget : function(target){\r
+        var t;\r
+        if((t = Ext.get(target))){\r
+            if(this.target){\r
+                this.target = Ext.get(this.target);\r
+                this.target.un('mouseover', this.onTargetOver, this);\r
+                this.target.un('mouseout', this.onTargetOut, this);\r
+                this.target.un('mousemove', this.onMouseMove, this);\r
+            }\r
+            this.mon(t, {\r
+                mouseover: this.onTargetOver,\r
+                mouseout: this.onTargetOut,\r
+                mousemove: this.onMouseMove,\r
+                scope: this\r
+            });\r
+            this.target = t;\r
         }\r
-        // then bubble it up to the tree if the event wasn't cancelled\r
-        var ot = this.getOwnerTree();\r
-        if(ot){\r
-            if(ot.proxyNodeEvent.apply(ot, arguments) === false){\r
-                return false;\r
-            }\r
+        if(this.anchor){\r
+            this.anchorTarget = this.target;\r
         }\r
-        return true;\r
     },\r
 \r
-    \r
-    isLeaf : function(){\r
-        return this.leaf === true;\r
+    // private\r
+    onMouseMove : function(e){\r
+        var t = this.delegate ? e.getTarget(this.delegate) : this.triggerElement = true;\r
+        if (t) {\r
+            this.targetXY = e.getXY();\r
+            if (t === this.triggerElement) {\r
+                if(!this.hidden && this.trackMouse){\r
+                    this.setPagePosition(this.getTargetXY());\r
+                }\r
+            } else {\r
+                this.hide();\r
+                this.lastActive = new Date(0);\r
+                this.onTargetOver(e);\r
+            }\r
+        } else if (!this.closable && this.isVisible()) {\r
+            this.hide();\r
+        }\r
     },\r
 \r
     // private\r
-    setFirstChild : function(node){\r
-        this.firstChild = node;\r
-    },\r
+    getTargetXY : function(){\r
+        if(this.anchor){\r
+            this.targetCounter++;\r
+            var offsets = this.getOffsets();\r
+            var xy = (this.anchorToTarget && !this.trackMouse) ?\r
+                this.el.getAlignToXY(this.anchorTarget, this.getAnchorAlign()) :\r
+                this.targetXY;\r
+\r
+            var dw = Ext.lib.Dom.getViewWidth()-5;\r
+            var dh = Ext.lib.Dom.getViewHeight()-5;\r
+            var scrollX = (document.documentElement.scrollLeft || document.body.scrollLeft || 0)+5;\r
+            var scrollY = (document.documentElement.scrollTop || document.body.scrollTop || 0)+5;\r
+\r
+            var axy = [xy[0] + offsets[0], xy[1] + offsets[1]];\r
+            var sz = this.getSize();\r
+            this.anchorEl.removeClass(this.anchorCls);\r
+\r
+            if(this.targetCounter < 2){\r
+                if(axy[0] < scrollX){\r
+                    if(this.anchorToTarget){\r
+                        this.defaultAlign = 'l-r';\r
+                        if(this.mouseOffset){this.mouseOffset[0] *= -1;}\r
+                    }\r
+                    this.anchor = 'left';\r
+                    return this.getTargetXY();\r
+                }\r
+                if(axy[0]+sz.width > dw){\r
+                    if(this.anchorToTarget){\r
+                        this.defaultAlign = 'r-l';\r
+                        if(this.mouseOffset){this.mouseOffset[0] *= -1;}\r
+                    }\r
+                    this.anchor = 'right';\r
+                    return this.getTargetXY();\r
+                }\r
+                if(axy[1] < scrollY){\r
+                    if(this.anchorToTarget){\r
+                        this.defaultAlign = 't-b';\r
+                        if(this.mouseOffset){this.mouseOffset[1] *= -1;}\r
+                    }\r
+                    this.anchor = 'top';\r
+                    return this.getTargetXY();\r
+                }\r
+                if(axy[1]+sz.height > dh){\r
+                    if(this.anchorToTarget){\r
+                        this.defaultAlign = 'b-t';\r
+                        if(this.mouseOffset){this.mouseOffset[1] *= -1;}\r
+                    }\r
+                    this.anchor = 'bottom';\r
+                    return this.getTargetXY();\r
+                }\r
+            }\r
 \r
-    //private\r
-    setLastChild : function(node){\r
-        this.lastChild = node;\r
+            this.anchorCls = 'x-tip-anchor-'+this.getAnchorPosition();\r
+            this.anchorEl.addClass(this.anchorCls);\r
+            this.targetCounter = 0;\r
+            return axy;\r
+        }else{\r
+            var mouseOffset = this.getMouseOffset();\r
+            return [this.targetXY[0]+mouseOffset[0], this.targetXY[1]+mouseOffset[1]];\r
+        }\r
     },\r
 \r
-\r
-    \r
-    isLast : function(){\r
-       return (!this.parentNode ? true : this.parentNode.lastChild == this);\r
+    getMouseOffset : function(){\r
+        var offset = this.anchor ? [0,0] : [15,18];\r
+        if(this.mouseOffset){\r
+            offset[0] += this.mouseOffset[0];\r
+            offset[1] += this.mouseOffset[1];\r
+        }\r
+        return offset;\r
     },\r
 \r
-    \r
-    isFirst : function(){\r
-       return (!this.parentNode ? true : this.parentNode.firstChild == this);\r
-    },\r
+    // private\r
+    getAnchorPosition : function(){\r
+        if(this.anchor){\r
+            this.tipAnchor = this.anchor.charAt(0);\r
+        }else{\r
+            var m = this.defaultAlign.match(/^([a-z]+)-([a-z]+)(\?)?$/);\r
+            if(!m){\r
+               throw "AnchorTip.defaultAlign is invalid";\r
+            }\r
+            this.tipAnchor = m[1].charAt(0);\r
+        }\r
 \r
-    \r
-    hasChildNodes : function(){\r
-        return !this.isLeaf() && this.childNodes.length > 0;\r
-    },\r
-    \r
-    \r
-    isExpandable : function(){\r
-        return this.attributes.expandable || this.hasChildNodes();\r
+        switch(this.tipAnchor){\r
+            case 't': return 'top';\r
+            case 'b': return 'bottom';\r
+            case 'r': return 'right';\r
+        }\r
+        return 'left';\r
     },\r
 \r
-    \r
-    appendChild : function(node){\r
-        var multi = false;\r
-        if(Ext.isArray(node)){\r
-            multi = node;\r
-        }else if(arguments.length > 1){\r
-            multi = arguments;\r
+    // private\r
+    getAnchorAlign : function(){\r
+        switch(this.anchor){\r
+            case 'top'  : return 'tl-bl';\r
+            case 'left' : return 'tl-tr';\r
+            case 'right': return 'tr-tl';\r
+            default     : return 'bl-tl';\r
         }\r
-        // if passed an array or multiple args do them one by one\r
-        if(multi){\r
-            for(var i = 0, len = multi.length; i < len; i++) {\r
-               this.appendChild(multi[i]);\r
+    },\r
+\r
+    // private\r
+    getOffsets: function(){\r
+        var offsets, ap = this.getAnchorPosition().charAt(0);\r
+        if(this.anchorToTarget && !this.trackMouse){\r
+            switch(ap){\r
+                case 't':\r
+                    offsets = [0, 9];\r
+                    break;\r
+                case 'b':\r
+                    offsets = [0, -13];\r
+                    break;\r
+                case 'r':\r
+                    offsets = [-13, 0];\r
+                    break;\r
+                default:\r
+                    offsets = [9, 0];\r
+                    break;\r
             }\r
         }else{\r
-            if(this.fireEvent("beforeappend", this.ownerTree, this, node) === false){\r
-                return false;\r
-            }\r
-            var index = this.childNodes.length;\r
-            var oldParent = node.parentNode;\r
-            // it's a move, make sure we move it cleanly\r
-            if(oldParent){\r
-                if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index) === false){\r
-                    return false;\r
-                }\r
-                oldParent.removeChild(node);\r
-            }\r
-            index = this.childNodes.length;\r
-            if(index == 0){\r
-                this.setFirstChild(node);\r
-            }\r
-            this.childNodes.push(node);\r
-            node.parentNode = this;\r
-            var ps = this.childNodes[index-1];\r
-            if(ps){\r
-                node.previousSibling = ps;\r
-                ps.nextSibling = node;\r
-            }else{\r
-                node.previousSibling = null;\r
-            }\r
-            node.nextSibling = null;\r
-            this.setLastChild(node);\r
-            node.setOwnerTree(this.getOwnerTree());\r
-            this.fireEvent("append", this.ownerTree, this, node, index);\r
-            if(oldParent){\r
-                node.fireEvent("move", this.ownerTree, node, oldParent, this, index);\r
+            switch(ap){\r
+                case 't':\r
+                    offsets = [-15-this.anchorOffset, 30];\r
+                    break;\r
+                case 'b':\r
+                    offsets = [-19-this.anchorOffset, -13-this.el.dom.offsetHeight];\r
+                    break;\r
+                case 'r':\r
+                    offsets = [-15-this.el.dom.offsetWidth, -13-this.anchorOffset];\r
+                    break;\r
+                default:\r
+                    offsets = [25, -13-this.anchorOffset];\r
+                    break;\r
             }\r
-            return node;\r
         }\r
+        var mouseOffset = this.getMouseOffset();\r
+        offsets[0] += mouseOffset[0];\r
+        offsets[1] += mouseOffset[1];\r
+\r
+        return offsets;\r
     },\r
 \r
-    \r
-    removeChild : function(node){\r
-        var index = this.childNodes.indexOf(node);\r
-        if(index == -1){\r
-            return false;\r
+    // private\r
+    onTargetOver : function(e){\r
+        if(this.disabled || e.within(this.target.dom, true)){\r
+            return;\r
         }\r
-        if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){\r
-            return false;\r
+        var t = e.getTarget(this.delegate);\r
+        if (t) {\r
+            this.triggerElement = t;\r
+            this.clearTimer('hide');\r
+            this.targetXY = e.getXY();\r
+            this.delayShow();\r
         }\r
+    },\r
 \r
-        // remove it from childNodes collection\r
-        this.childNodes.splice(index, 1);\r
-\r
-        // update siblings\r
-        if(node.previousSibling){\r
-            node.previousSibling.nextSibling = node.nextSibling;\r
-        }\r
-        if(node.nextSibling){\r
-            node.nextSibling.previousSibling = node.previousSibling;\r
+    // private\r
+    delayShow : function(){\r
+        if(this.hidden && !this.showTimer){\r
+            if(this.lastActive.getElapsed() < this.quickShowInterval){\r
+                this.show();\r
+            }else{\r
+                this.showTimer = this.show.defer(this.showDelay, this);\r
+            }\r
+        }else if(!this.hidden && this.autoHide !== false){\r
+            this.show();\r
         }\r
+    },\r
 \r
-        // update child refs\r
-        if(this.firstChild == node){\r
-            this.setFirstChild(node.nextSibling);\r
+    // private\r
+    onTargetOut : function(e){\r
+        if(this.disabled || e.within(this.target.dom, true)){\r
+            return;\r
         }\r
-        if(this.lastChild == node){\r
-            this.setLastChild(node.previousSibling);\r
+        this.clearTimer('show');\r
+        if(this.autoHide !== false){\r
+            this.delayHide();\r
         }\r
-\r
-        node.setOwnerTree(null);\r
-        // clear any references from the node\r
-        node.parentNode = null;\r
-        node.previousSibling = null;\r
-        node.nextSibling = null;\r
-        this.fireEvent("remove", this.ownerTree, this, node);\r
-        return node;\r
     },\r
 \r
-    \r
-    insertBefore : function(node, refNode){\r
-        if(!refNode){ // like standard Dom, refNode can be null for append\r
-            return this.appendChild(node);\r
+    // private\r
+    delayHide : function(){\r
+        if(!this.hidden && !this.hideTimer){\r
+            this.hideTimer = this.hide.defer(this.hideDelay, this);\r
         }\r
-        // nothing to do\r
-        if(node == refNode){\r
-            return false;\r
+    },\r
+\r
+    /**\r
+     * Hides this tooltip if visible.\r
+     */\r
+    hide: function(){\r
+        this.clearTimer('dismiss');\r
+        this.lastActive = new Date();\r
+        if(this.anchorEl){\r
+            this.anchorEl.hide();\r
         }\r
+        Ext.ToolTip.superclass.hide.call(this);\r
+        delete this.triggerElement;\r
+    },\r
 \r
-        if(this.fireEvent("beforeinsert", this.ownerTree, this, node, refNode) === false){\r
-            return false;\r
-        }\r
-        var index = this.childNodes.indexOf(refNode);\r
-        var oldParent = node.parentNode;\r
-        var refIndex = index;\r
-\r
-        // when moving internally, indexes will change after remove\r
-        if(oldParent == this && this.childNodes.indexOf(node) < index){\r
-            refIndex--;\r
+    /**\r
+     * Shows this tooltip at the current event target XY position.\r
+     */\r
+    show : function(){\r
+        if(this.anchor){\r
+            // pre-show it off screen so that the el will have dimensions\r
+            // for positioning calcs when getting xy next\r
+            this.showAt([-1000,-1000]);\r
+            this.origConstrainPosition = this.constrainPosition;\r
+            this.constrainPosition = false;\r
+            this.anchor = this.origAnchor;\r
         }\r
+        this.showAt(this.getTargetXY());\r
 \r
-        // it's a move, make sure we move it cleanly\r
-        if(oldParent){\r
-            if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index, refNode) === false){\r
-                return false;\r
-            }\r
-            oldParent.removeChild(node);\r
-        }\r
-        if(refIndex == 0){\r
-            this.setFirstChild(node);\r
-        }\r
-        this.childNodes.splice(refIndex, 0, node);\r
-        node.parentNode = this;\r
-        var ps = this.childNodes[refIndex-1];\r
-        if(ps){\r
-            node.previousSibling = ps;\r
-            ps.nextSibling = node;\r
+        if(this.anchor){\r
+            this.syncAnchor();\r
+            this.anchorEl.show();\r
+            this.constrainPosition = this.origConstrainPosition;\r
         }else{\r
-            node.previousSibling = null;\r
-        }\r
-        node.nextSibling = refNode;\r
-        refNode.previousSibling = node;\r
-        node.setOwnerTree(this.getOwnerTree());\r
-        this.fireEvent("insert", this.ownerTree, this, node, refNode);\r
-        if(oldParent){\r
-            node.fireEvent("move", this.ownerTree, node, oldParent, this, refIndex, refNode);\r
+            this.anchorEl.hide();\r
         }\r
-        return node;\r
     },\r
 \r
-    \r
-    remove : function(){\r
-        this.parentNode.removeChild(this);\r
-        return this;\r
+    // inherit docs\r
+    showAt : function(xy){\r
+        this.lastActive = new Date();\r
+        this.clearTimers();\r
+        Ext.ToolTip.superclass.showAt.call(this, xy);\r
+        if(this.dismissDelay && this.autoHide !== false){\r
+            this.dismissTimer = this.hide.defer(this.dismissDelay, this);\r
+        }\r
     },\r
 \r
-    \r
-    item : function(index){\r
-        return this.childNodes[index];\r
+    // private\r
+    syncAnchor : function(){\r
+        var anchorPos, targetPos, offset;\r
+        switch(this.tipAnchor.charAt(0)){\r
+            case 't':\r
+                anchorPos = 'b';\r
+                targetPos = 'tl';\r
+                offset = [20+this.anchorOffset, 2];\r
+                break;\r
+            case 'r':\r
+                anchorPos = 'l';\r
+                targetPos = 'tr';\r
+                offset = [-2, 11+this.anchorOffset];\r
+                break;\r
+            case 'b':\r
+                anchorPos = 't';\r
+                targetPos = 'bl';\r
+                offset = [20+this.anchorOffset, -2];\r
+                break;\r
+            default:\r
+                anchorPos = 'r';\r
+                targetPos = 'tl';\r
+                offset = [2, 11+this.anchorOffset];\r
+                break;\r
+        }\r
+        this.anchorEl.alignTo(this.el, anchorPos+'-'+targetPos, offset);\r
     },\r
 \r
-    \r
-    replaceChild : function(newChild, oldChild){\r
-        var s = oldChild ? oldChild.nextSibling : null;\r
-        this.removeChild(oldChild);\r
-        this.insertBefore(newChild, s);\r
-        return oldChild;\r
+    // private\r
+    setPagePosition : function(x, y){\r
+        Ext.ToolTip.superclass.setPagePosition.call(this, x, y);\r
+        if(this.anchor){\r
+            this.syncAnchor();\r
+        }\r
     },\r
 \r
-    \r
-    indexOf : function(child){\r
-        return this.childNodes.indexOf(child);\r
+    // private\r
+    clearTimer : function(name){\r
+        name = name + 'Timer';\r
+        clearTimeout(this[name]);\r
+        delete this[name];\r
     },\r
 \r
-    \r
-    getOwnerTree : function(){\r
-        // if it doesn't have one, look for one\r
-        if(!this.ownerTree){\r
-            var p = this;\r
-            while(p){\r
-                if(p.ownerTree){\r
-                    this.ownerTree = p.ownerTree;\r
-                    break;\r
-                }\r
-                p = p.parentNode;\r
-            }\r
-        }\r
-        return this.ownerTree;\r
+    // private\r
+    clearTimers : function(){\r
+        this.clearTimer('show');\r
+        this.clearTimer('dismiss');\r
+        this.clearTimer('hide');\r
     },\r
 \r
-    \r
-    getDepth : function(){\r
-        var depth = 0;\r
-        var p = this;\r
-        while(p.parentNode){\r
-            ++depth;\r
-            p = p.parentNode;\r
-        }\r
-        return depth;\r
+    // private\r
+    onShow : function(){\r
+        Ext.ToolTip.superclass.onShow.call(this);\r
+        Ext.getDoc().on('mousedown', this.onDocMouseDown, this);\r
     },\r
 \r
     // private\r
-    setOwnerTree : function(tree){\r
-        // if it's move, we need to update everyone\r
-        if(tree != this.ownerTree){\r
-            if(this.ownerTree){\r
-                this.ownerTree.unregisterNode(this);\r
-            }\r
-            this.ownerTree = tree;\r
-            var cs = this.childNodes;\r
-            for(var i = 0, len = cs.length; i < len; i++) {\r
-               cs[i].setOwnerTree(tree);\r
-            }\r
-            if(tree){\r
-                tree.registerNode(this);\r
-            }\r
-        }\r
+    onHide : function(){\r
+        Ext.ToolTip.superclass.onHide.call(this);\r
+        Ext.getDoc().un('mousedown', this.onDocMouseDown, this);\r
     },\r
 \r
-    \r
-    getPath : function(attr){\r
-        attr = attr || "id";\r
-        var p = this.parentNode;\r
-        var b = [this.attributes[attr]];\r
-        while(p){\r
-            b.unshift(p.attributes[attr]);\r
-            p = p.parentNode;\r
+    // private\r
+    onDocMouseDown : function(e){\r
+        if(this.autoHide !== true && !this.closable && !e.within(this.el.dom)){\r
+            this.disable();\r
+            this.enable.defer(100, this);\r
         }\r
-        var sep = this.getOwnerTree().pathSeparator;\r
-        return sep + b.join(sep);\r
     },\r
 \r
-    \r
-    bubble : function(fn, scope, args){\r
-        var p = this;\r
-        while(p){\r
-            if(fn.apply(scope || p, args || [p]) === false){\r
-                break;\r
-            }\r
-            p = p.parentNode;\r
-        }\r
+    // private\r
+    onDisable : function(){\r
+        this.clearTimers();\r
+        this.hide();\r
     },\r
 \r
-    \r
-    cascade : function(fn, scope, args){\r
-        if(fn.apply(scope || this, args || [this]) !== false){\r
-            var cs = this.childNodes;\r
-            for(var i = 0, len = cs.length; i < len; i++) {\r
-               cs[i].cascade(fn, scope, args);\r
+    // private\r
+    adjustPosition : function(x, y){\r
+        if(this.contstrainPosition){\r
+            var ay = this.targetXY[1], h = this.getSize().height;\r
+            if(y <= ay && (y+h) >= ay){\r
+                y = ay-h-5;\r
             }\r
         }\r
+        return {x : x, y: y};\r
     },\r
 \r
-    \r
-    eachChild : function(fn, scope, args){\r
-        var cs = this.childNodes;\r
-        for(var i = 0, len = cs.length; i < len; i++) {\r
-               if(fn.apply(scope || this, args || [cs[i]]) === false){\r
-                   break;\r
-               }\r
-        }\r
-    },\r
+    // private\r
+    onDestroy : function(){\r
+        Ext.getDoc().un('mousedown', this.onDocMouseDown, this);\r
+        Ext.ToolTip.superclass.onDestroy.call(this);\r
+    }\r
+});/**\r
+ * @class Ext.QuickTip\r
+ * @extends Ext.ToolTip\r
+ * A specialized tooltip class for tooltips that can be specified in markup and automatically managed by the global\r
+ * {@link Ext.QuickTips} instance.  See the QuickTips class header for additional usage details and examples.\r
+ * @constructor\r
+ * Create a new Tip\r
+ * @param {Object} config The configuration options\r
+ */\r
+Ext.QuickTip = Ext.extend(Ext.ToolTip, {\r
+    /**\r
+     * @cfg {Mixed} target The target HTMLElement, Ext.Element or id to associate with this quicktip (defaults to the document).\r
+     */\r
+    /**\r
+     * @cfg {Boolean} interceptTitles True to automatically use the element's DOM title value if available (defaults to false).\r
+     */\r
+    interceptTitles : false,\r
 \r
-    \r
-    findChild : function(attribute, value){\r
-        var cs = this.childNodes;\r
-        for(var i = 0, len = cs.length; i < len; i++) {\r
-               if(cs[i].attributes[attribute] == value){\r
-                   return cs[i];\r
-               }\r
-        }\r
-        return null;\r
+    // private\r
+    tagConfig : {\r
+        namespace : "ext",\r
+        attribute : "qtip",\r
+        width : "qwidth",\r
+        target : "target",\r
+        title : "qtitle",\r
+        hide : "hide",\r
+        cls : "qclass",\r
+        align : "qalign",\r
+        anchor : "anchor"\r
     },\r
 \r
-    \r
-    findChildBy : function(fn, scope){\r
-        var cs = this.childNodes;\r
-        for(var i = 0, len = cs.length; i < len; i++) {\r
-               if(fn.call(scope||cs[i], cs[i]) === true){\r
-                   return cs[i];\r
-               }\r
-        }\r
-        return null;\r
+    // private\r
+    initComponent : function(){\r
+        this.target = this.target || Ext.getDoc();\r
+        this.targets = this.targets || {};\r
+        Ext.QuickTip.superclass.initComponent.call(this);\r
     },\r
 \r
-    \r
-    sort : function(fn, scope){\r
-        var cs = this.childNodes;\r
-        var len = cs.length;\r
-        if(len > 0){\r
-            var sortFn = scope ? function(){fn.apply(scope, arguments);} : fn;\r
-            cs.sort(sortFn);\r
-            for(var i = 0; i < len; i++){\r
-                var n = cs[i];\r
-                n.previousSibling = cs[i-1];\r
-                n.nextSibling = cs[i+1];\r
-                if(i == 0){\r
-                    this.setFirstChild(n);\r
-                }\r
-                if(i == len-1){\r
-                    this.setLastChild(n);\r
+    /**\r
+     * Configures a new quick tip instance and assigns it to a target element.  The following config values are\r
+     * supported (for example usage, see the {@link Ext.QuickTips} class header):\r
+     * <div class="mdetail-params"><ul>\r
+     * <li>autoHide</li>\r
+     * <li>cls</li>\r
+     * <li>dismissDelay (overrides the singleton value)</li>\r
+     * <li>target (required)</li>\r
+     * <li>text (required)</li>\r
+     * <li>title</li>\r
+     * <li>width</li></ul></div>\r
+     * @param {Object} config The config object\r
+     */\r
+    register : function(config){\r
+        var cs = Ext.isArray(config) ? config : arguments;\r
+        for(var i = 0, len = cs.length; i < len; i++){\r
+            var c = cs[i];\r
+            var target = c.target;\r
+            if(target){\r
+                if(Ext.isArray(target)){\r
+                    for(var j = 0, jlen = target.length; j < jlen; j++){\r
+                        this.targets[Ext.id(target[j])] = c;\r
+                    }\r
+                } else{\r
+                    this.targets[Ext.id(target)] = c;\r
                 }\r
             }\r
         }\r
     },\r
 \r
-    \r
-    contains : function(node){\r
-        return node.isAncestor(this);\r
+    /**\r
+     * Removes this quick tip from its element and destroys it.\r
+     * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.\r
+     */\r
+    unregister : function(el){\r
+        delete this.targets[Ext.id(el)];\r
     },\r
-\r
     \r
-    isAncestor : function(node){\r
-        var p = this.parentNode;\r
-        while(p){\r
-            if(p == node){\r
-                return true;\r
+    /**\r
+     * Hides a visible tip or cancels an impending show for a particular element.\r
+     * @param {String/HTMLElement/Element} el The element that is the target of the tip.\r
+     */\r
+    cancelShow: function(el){\r
+        var at = this.activeTarget;\r
+        el = Ext.get(el).dom;\r
+        if(this.isVisible()){\r
+            if(at && at.el == el){\r
+                this.hide();\r
             }\r
-            p = p.parentNode;\r
+        }else if(at && at.el == el){\r
+            this.clearTimer('show');\r
         }\r
-        return false;\r
     },\r
 \r
-    toString : function(){\r
-        return "[Node"+(this.id?" "+this.id:"")+"]";\r
-    }\r
-});\r
-\r
-Ext.data.GroupingStore = Ext.extend(Ext.data.Store, {\r
-    \r
-    \r
-    remoteGroup : false,\r
-    \r
-    groupOnSort:false,\r
-\r
-    \r
-    clearGrouping : function(){\r
-        this.groupField = false;\r
-        if(this.remoteGroup){\r
-            if(this.baseParams){\r
-                delete this.baseParams.groupBy;\r
-            }\r
-            this.reload();\r
-        }else{\r
-            this.applySort();\r
-            this.fireEvent('datachanged', this);\r
+    // private\r
+    onTargetOver : function(e){\r
+        if(this.disabled){\r
+            return;\r
         }\r
-    },\r
-\r
-    \r
-    groupBy : function(field, forceRegroup){\r
-        if(this.groupField == field && !forceRegroup){\r
-            return; // already grouped by this field\r
+        this.targetXY = e.getXY();\r
+        var t = e.getTarget();\r
+        if(!t || t.nodeType !== 1 || t == document || t == document.body){\r
+            return;\r
         }\r
-        this.groupField = field;\r
-        if(this.remoteGroup){\r
-            if(!this.baseParams){\r
-                this.baseParams = {};\r
-            }\r
-            this.baseParams['groupBy'] = field;\r
+        if(this.activeTarget && t == this.activeTarget.el){\r
+            this.clearTimer('hide');\r
+            this.show();\r
+            return;\r
         }\r
-        if(this.groupOnSort){\r
-            this.sort(field);\r
+        if(t && this.targets[t.id]){\r
+            this.activeTarget = this.targets[t.id];\r
+            this.activeTarget.el = t;\r
+            this.anchor = this.activeTarget.anchor;\r
+            if(this.anchor){\r
+                this.anchorTarget = t;\r
+            }\r
+            this.delayShow();\r
             return;\r
         }\r
-        if(this.remoteGroup){\r
-            this.reload();\r
-        }else{\r
-            var si = this.sortInfo || {};\r
-            if(si.field != field){\r
-                this.applySort();\r
-            }else{\r
-                this.sortData(field);\r
+        \r
+        var ttp, et = Ext.fly(t), cfg = this.tagConfig;\r
+        var ns = cfg.namespace;\r
+        if(this.interceptTitles && t.title){\r
+            ttp = t.title;\r
+            t.qtip = ttp;\r
+            t.removeAttribute("title");\r
+            e.preventDefault();\r
+        } else{\r
+            ttp = t.qtip || et.getAttribute(cfg.attribute, ns);\r
+        }\r
+        if(ttp){\r
+            var autoHide = et.getAttribute(cfg.hide, ns);\r
+            this.activeTarget = {\r
+                el: t,\r
+                text: ttp,\r
+                width: et.getAttribute(cfg.width, ns),\r
+                autoHide: autoHide != "user" && autoHide !== 'false',\r
+                title: et.getAttribute(cfg.title, ns),\r
+                cls: et.getAttribute(cfg.cls, ns),\r
+                align: et.getAttribute(cfg.align, ns)\r
+                \r
+            };\r
+            this.anchor = et.getAttribute(cfg.anchor, ns);\r
+            if(this.anchor){\r
+                this.anchorTarget = t;\r
             }\r
-            this.fireEvent('datachanged', this);\r
+            this.delayShow();\r
         }\r
     },\r
 \r
     // private\r
-    applySort : function(){\r
-        Ext.data.GroupingStore.superclass.applySort.call(this);\r
-        if(!this.groupOnSort && !this.remoteGroup){\r
-            var gs = this.getGroupState();\r
-            if(gs && gs != this.sortInfo.field){\r
-                this.sortData(this.groupField);\r
-            }\r
+    onTargetOut : function(e){\r
+        this.clearTimer('show');\r
+        if(this.autoHide !== false){\r
+            this.delayHide();\r
         }\r
     },\r
 \r
-    // private\r
-    applyGrouping : function(alwaysFireChange){\r
-        if(this.groupField !== false){\r
-            this.groupBy(this.groupField, true);\r
-            return true;\r
-        }else{\r
-            if(alwaysFireChange === true){\r
-                this.fireEvent('datachanged', this);\r
+    // inherit docs\r
+    showAt : function(xy){\r
+        var t = this.activeTarget;\r
+        if(t){\r
+            if(!this.rendered){\r
+                this.render(Ext.getBody());\r
+                this.activeTarget = t;\r
+            }\r
+            if(t.width){\r
+                this.setWidth(t.width);\r
+                this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));\r
+                this.measureWidth = false;\r
+            } else{\r
+                this.measureWidth = true;\r
+            }\r
+            this.setTitle(t.title || '');\r
+            this.body.update(t.text);\r
+            this.autoHide = t.autoHide;\r
+            this.dismissDelay = t.dismissDelay || this.dismissDelay;\r
+            if(this.lastCls){\r
+                this.el.removeClass(this.lastCls);\r
+                delete this.lastCls;\r
+            }\r
+            if(t.cls){\r
+                this.el.addClass(t.cls);\r
+                this.lastCls = t.cls;\r
+            }\r
+            if(this.anchor){\r
+                this.constrainPosition = false;\r
+            }else if(t.align){ // TODO: this doesn't seem to work consistently\r
+                xy = this.el.getAlignToXY(t.el, t.align);\r
+                this.constrainPosition = false;\r
+            }else{\r
+                this.constrainPosition = true;\r
             }\r
-            return false;\r
         }\r
+        Ext.QuickTip.superclass.showAt.call(this, xy);\r
     },\r
 \r
-    // private\r
-    getGroupState : function(){\r
-        return this.groupOnSort && this.groupField !== false ?\r
-               (this.sortInfo ? this.sortInfo.field : undefined) : this.groupField;\r
+    // inherit docs\r
+    hide: function(){\r
+        delete this.activeTarget;\r
+        Ext.QuickTip.superclass.hide.call(this);\r
     }\r
+});/**\r
+ * @class Ext.QuickTips\r
+ * <p>Provides attractive and customizable tooltips for any element. The QuickTips\r
+ * singleton is used to configure and manage tooltips globally for multiple elements\r
+ * in a generic manner.  To create individual tooltips with maximum customizability,\r
+ * you should consider either {@link Ext.Tip} or {@link Ext.ToolTip}.</p>\r
+ * <p>Quicktips can be configured via tag attributes directly in markup, or by\r
+ * registering quick tips programmatically via the {@link #register} method.</p>\r
+ * <p>The singleton's instance of {@link Ext.QuickTip} is available via\r
+ * {@link #getQuickTip}, and supports all the methods, and all the all the\r
+ * configuration properties of Ext.QuickTip. These settings will apply to all\r
+ * tooltips shown by the singleton.</p>\r
+ * <p>Below is the summary of the configuration properties which can be used.\r
+ * For detailed descriptions see {@link #getQuickTip}</p>\r
+ * <p><b>QuickTips singleton configs (all are optional)</b></p>\r
+ * <div class="mdetail-params"><ul><li>dismissDelay</li>\r
+ * <li>hideDelay</li>\r
+ * <li>maxWidth</li>\r
+ * <li>minWidth</li>\r
+ * <li>showDelay</li>\r
+ * <li>trackMouse</li></ul></div>\r
+ * <p><b>Target element configs (optional unless otherwise noted)</b></p>\r
+ * <div class="mdetail-params"><ul><li>autoHide</li>\r
+ * <li>cls</li>\r
+ * <li>dismissDelay (overrides singleton value)</li>\r
+ * <li>target (required)</li>\r
+ * <li>text (required)</li>\r
+ * <li>title</li>\r
+ * <li>width</li></ul></div>\r
+ * <p>Here is an example showing how some of these config options could be used:</p>\r
+ * <pre><code>\r
+// Init the singleton.  Any tag-based quick tips will start working.\r
+Ext.QuickTips.init();\r
+\r
+// Apply a set of config properties to the singleton\r
+Ext.apply(Ext.QuickTips.getQuickTip(), {\r
+    maxWidth: 200,\r
+    minWidth: 100,\r
+    showDelay: 50,\r
+    trackMouse: true\r
 });\r
 \r
-Ext.ComponentMgr = function(){\r
-    var all = new Ext.util.MixedCollection();\r
-    var types = {};\r
-\r
+// Manually register a quick tip for a specific element\r
+Ext.QuickTips.register({\r
+    target: 'my-div',\r
+    title: 'My Tooltip',\r
+    text: 'This tooltip was added in code',\r
+    width: 100,\r
+    dismissDelay: 20\r
+});\r
+</code></pre>\r
+ * <p>To register a quick tip in markup, you simply add one or more of the valid QuickTip attributes prefixed with\r
+ * the <b>ext:</b> namespace.  The HTML element itself is automatically set as the quick tip target. Here is the summary\r
+ * of supported attributes (optional unless otherwise noted):</p>\r
+ * <ul><li><b>hide</b>: Specifying "user" is equivalent to setting autoHide = false.  Any other value will be the\r
+ * same as autoHide = true.</li>\r
+ * <li><b>qclass</b>: A CSS class to be applied to the quick tip (equivalent to the 'cls' target element config).</li>\r
+ * <li><b>qtip (required)</b>: The quick tip text (equivalent to the 'text' target element config).</li>\r
+ * <li><b>qtitle</b>: The quick tip title (equivalent to the 'title' target element config).</li>\r
+ * <li><b>qwidth</b>: The quick tip width (equivalent to the 'width' target element config).</li></ul>\r
+ * <p>Here is an example of configuring an HTML element to display a tooltip from markup:</p>\r
+ * <pre><code>\r
+// Add a quick tip to an HTML button\r
+&lt;input type="button" value="OK" ext:qtitle="OK Button" ext:qwidth="100"\r
+     ext:qtip="This is a quick tip from markup!">&lt;/input>\r
+</code></pre>\r
+ * @singleton\r
+ */\r
+Ext.QuickTips = function(){\r
+    var tip, locks = [];\r
     return {\r
-        \r
-        register : function(c){\r
-            all.add(c);\r
+        /**\r
+         * Initialize the global QuickTips instance and prepare any quick tips.\r
+         * @param {Boolean} autoRender True to render the QuickTips container immediately to preload images. (Defaults to true) \r
+         */\r
+        init : function(autoRender){\r
+            if(!tip){\r
+                if(!Ext.isReady){\r
+                    Ext.onReady(function(){\r
+                        Ext.QuickTips.init(autoRender);\r
+                    });\r
+                    return;\r
+                }\r
+                tip = new Ext.QuickTip({elements:'header,body'});\r
+                if(autoRender !== false){\r
+                    tip.render(Ext.getBody());\r
+                }\r
+            }\r
         },\r
 \r
-        \r
-        unregister : function(c){\r
-            all.remove(c);\r
+        /**\r
+         * Enable quick tips globally.\r
+         */\r
+        enable : function(){\r
+            if(tip){\r
+                locks.pop();\r
+                if(locks.length < 1){\r
+                    tip.enable();\r
+                }\r
+            }\r
         },\r
 \r
-        \r
-        get : function(id){\r
-            return all.get(id);\r
+        /**\r
+         * Disable quick tips globally.\r
+         */\r
+        disable : function(){\r
+            if(tip){\r
+                tip.disable();\r
+            }\r
+            locks.push(1);\r
         },\r
 \r
-        \r
-        onAvailable : function(id, fn, scope){\r
-            all.on("add", function(index, o){\r
-                if(o.id == id){\r
-                    fn.call(scope || o, o);\r
-                    all.un("add", fn, scope);\r
-                }\r
-            });\r
+        /**\r
+         * Returns true if quick tips are enabled, else false.\r
+         * @return {Boolean}\r
+         */\r
+        isEnabled : function(){\r
+            return tip !== undefined && !tip.disabled;\r
         },\r
 \r
-        \r
-        all : all,\r
-\r
-        \r
-        registerType : function(xtype, cls){\r
-            types[xtype] = cls;\r
-            cls.xtype = xtype;\r
+        /**\r
+         * Gets the global QuickTips instance.\r
+         */\r
+        getQuickTip : function(){\r
+            return tip;\r
         },\r
 \r
-        \r
-        create : function(config, defaultType){\r
-            return new types[config.xtype || defaultType](config);\r
-        }\r
-    };\r
-}();\r
-\r
+        /**\r
+         * Configures a new quick tip instance and assigns it to a target element.  See\r
+         * {@link Ext.QuickTip#register} for details.\r
+         * @param {Object} config The config object\r
+         */\r
+        register : function(){\r
+            tip.register.apply(tip, arguments);\r
+        },\r
 \r
-Ext.reg = Ext.ComponentMgr.registerType; // this will be called a lot internally, shorthand to keep the bytes down\r
+        /**\r
+         * Removes any registered quick tip from the target element and destroys it.\r
+         * @param {String/HTMLElement/Element} el The element from which the quick tip is to be removed.\r
+         */\r
+        unregister : function(){\r
+            tip.unregister.apply(tip, arguments);\r
+        },\r
 \r
-Ext.Component = function(config){\r
-    config = config || {};\r
-    if(config.initialConfig){\r
-        if(config.isAction){           // actions\r
-            this.baseAction = config;\r
+        /**\r
+         * Alias of {@link #register}.\r
+         * @param {Object} config The config object\r
+         */\r
+        tips :function(){\r
+            tip.register.apply(tip, arguments);\r
         }\r
-        config = config.initialConfig; // component cloning / action set up\r
-    }else if(config.tagName || config.dom || typeof config == "string"){ // element object\r
-        config = {applyTo: config, id: config.id || config};\r
     }\r
+}();/**\r
+ * @class Ext.tree.TreePanel\r
+ * @extends Ext.Panel\r
+ * <p>The TreePanel provides tree-structured UI representation of tree-structured data.</p>\r
+ * <p>{@link Ext.tree.TreeNode TreeNode}s added to the TreePanel may each contain metadata\r
+ * used by your application in their {@link Ext.tree.TreeNode#attributes attributes} property.</p>\r
+ * <p><b>A TreePanel must have a {@link #root} node before it is rendered.</b> This may either be\r
+ * specified using the {@link #root} config option, or using the {@link #setRootNode} method.\r
+ * <p>An example of tree rendered to an existing div:</p><pre><code>\r
+var tree = new Ext.tree.TreePanel({\r
+    renderTo: 'tree-div',\r
+    useArrows: true,\r
+    autoScroll: true,\r
+    animate: true,\r
+    enableDD: true,\r
+    containerScroll: true,\r
+    border: false,\r
+    // auto create TreeLoader\r
+    dataUrl: 'get-nodes.php',\r
 \r
-    \r
-    this.initialConfig = config;\r
-\r
-    Ext.apply(this, config);\r
-    this.addEvents(\r
-        \r
-        'disable',\r
-        \r
-        'enable',\r
-        \r
-        'beforeshow',\r
-        \r
-        'show',\r
-        \r
-        'beforehide',\r
-        \r
-        'hide',\r
-        \r
-        'beforerender',\r
-        \r
-        'render',\r
-        \r
-        'beforedestroy',\r
-        \r
-        'destroy',\r
-        \r
-        'beforestaterestore',\r
-        \r
-        'staterestore',\r
-        \r
-        'beforestatesave',\r
-        \r
-        'statesave'\r
-    );\r
-    this.getId();\r
-    Ext.ComponentMgr.register(this);\r
-    Ext.Component.superclass.constructor.call(this);\r
-\r
-    if(this.baseAction){\r
-        this.baseAction.addComponent(this);\r
+    root: {\r
+        nodeType: 'async',\r
+        text: 'Ext JS',\r
+        draggable: false,\r
+        id: 'source'\r
     }\r
+});\r
+\r
+tree.getRootNode().expand();\r
+ * </code></pre>\r
+ * <p>The example above would work with a data packet similar to this:</p><pre><code>\r
+[{\r
+    "text": "adapter",\r
+    "id": "source\/adapter",\r
+    "cls": "folder"\r
+}, {\r
+    "text": "dd",\r
+    "id": "source\/dd",\r
+    "cls": "folder"\r
+}, {\r
+    "text": "debug.js",\r
+    "id": "source\/debug.js",\r
+    "leaf": true,\r
+    "cls": "file"\r
+}]\r
+ * </code></pre>\r
+ * <p>An example of tree within a Viewport:</p><pre><code>\r
+new Ext.Viewport({\r
+    layout: 'border',\r
+    items: [{\r
+        region: 'west',\r
+        collapsible: true,\r
+        title: 'Navigation',\r
+        xtype: 'treepanel',\r
+        width: 200,\r
+        autoScroll: true,\r
+        split: true,\r
+        loader: new Ext.tree.TreeLoader(),\r
+        root: new Ext.tree.AsyncTreeNode({\r
+            expanded: true,\r
+            children: [{\r
+                text: 'Menu Option 1',\r
+                leaf: true\r
+            }, {\r
+                text: 'Menu Option 2',\r
+                leaf: true\r
+            }, {\r
+                text: 'Menu Option 3',\r
+                leaf: true\r
+            }]\r
+        }),\r
+        rootVisible: false,\r
+        listeners: {\r
+            click: function(n) {\r
+                Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.text + '"');\r
+            }\r
+        }\r
+    }, {\r
+        region: 'center',\r
+        xtype: 'tabpanel',\r
+        // remaining code not shown ...\r
+    }]\r
+});\r
+</code></pre>\r
+ *\r
+ * @cfg {Ext.tree.TreeNode} root The root node for the tree.\r
+ * @cfg {Boolean} rootVisible <tt>false</tt> to hide the root node (defaults to <tt>true</tt>)\r
+ * @cfg {Boolean} lines <tt>false</tt> to disable tree lines (defaults to <tt>true</tt>)\r
+ * @cfg {Boolean} enableDD <tt>true</tt> to enable drag and drop\r
+ * @cfg {Boolean} enableDrag <tt>true</tt> to enable just drag\r
+ * @cfg {Boolean} enableDrop <tt>true</tt> to enable just drop\r
+ * @cfg {Object} dragConfig Custom config to pass to the {@link Ext.tree.TreeDragZone} instance\r
+ * @cfg {Object} dropConfig Custom config to pass to the {@link Ext.tree.TreeDropZone} instance\r
+ * @cfg {String} ddGroup The DD group this TreePanel belongs to\r
+ * @cfg {Boolean} ddAppendOnly <tt>true</tt> if the tree should only allow append drops (use for trees which are sorted)\r
+ * @cfg {Boolean} ddScroll <tt>true</tt> to enable body scrolling\r
+ * @cfg {Boolean} containerScroll <tt>true</tt> to register this container with ScrollManager\r
+ * @cfg {Boolean} hlDrop <tt>false</tt> to disable node highlight on drop (defaults to the value of {@link Ext#enableFx})\r
+ * @cfg {String} hlColor The color of the node highlight (defaults to <tt>'C3DAF9'</tt>)\r
+ * @cfg {Boolean} animate <tt>true</tt> to enable animated expand/collapse (defaults to the value of {@link Ext#enableFx})\r
+ * @cfg {Boolean} singleExpand <tt>true</tt> if only 1 node per branch may be expanded\r
+ * @cfg {Object} selModel A tree selection model to use with this TreePanel (defaults to an {@link Ext.tree.DefaultSelectionModel})\r
+ * @cfg {Boolean} trackMouseOver <tt>false</tt> to disable mouse over highlighting\r
+ * @cfg {Ext.tree.TreeLoader} loader A {@link Ext.tree.TreeLoader} for use with this TreePanel\r
+ * @cfg {String} pathSeparator The token used to separate sub-paths in path strings (defaults to <tt>'/'</tt>)\r
+ * @cfg {Boolean} useArrows <tt>true</tt> to use Vista-style arrows in the tree (defaults to <tt>false</tt>)\r
+ * @cfg {String} requestMethod The HTTP request method for loading data (defaults to the value of {@link Ext.Ajax#method}).\r
+ *\r
+ * @constructor\r
+ * @param {Object} config\r
+ * @xtype treepanel\r
+ */\r
+Ext.tree.TreePanel = Ext.extend(Ext.Panel, {\r
+    rootVisible : true,\r
+    animate: Ext.enableFx,\r
+    lines : true,\r
+    enableDD : false,\r
+    hlDrop : Ext.enableFx,\r
+    pathSeparator: "/",\r
 \r
-    this.initComponent();\r
+    initComponent : function(){\r
+        Ext.tree.TreePanel.superclass.initComponent.call(this);\r
 \r
-    if(this.plugins){\r
-        if(Ext.isArray(this.plugins)){\r
-            for(var i = 0, len = this.plugins.length; i < len; i++){\r
-                this.plugins[i] = this.initPlugin(this.plugins[i]);\r
-            }\r
-        }else{\r
-            this.plugins = this.initPlugin(this.plugins);\r
+        if(!this.eventModel){\r
+            this.eventModel = new Ext.tree.TreeEventModel(this);\r
         }\r
-    }\r
 \r
-    if(this.stateful !== false){\r
-        this.initState(config);\r
-    }\r
+        // initialize the loader\r
+        var l = this.loader;\r
+        if(!l){\r
+            l = new Ext.tree.TreeLoader({\r
+                dataUrl: this.dataUrl,\r
+                requestMethod: this.requestMethod\r
+            });\r
+        }else if(typeof l == 'object' && !l.load){\r
+            l = new Ext.tree.TreeLoader(l);\r
+        }\r
+        this.loader = l;\r
 \r
-    if(this.applyTo){\r
-        this.applyToMarkup(this.applyTo);\r
-        delete this.applyTo;\r
-    }else if(this.renderTo){\r
-        this.render(this.renderTo);\r
-        delete this.renderTo;\r
-    }\r
-};\r
+        this.nodeHash = {};\r
 \r
-// private\r
-Ext.Component.AUTO_ID = 1000;\r
+        /**\r
+        * The root node of this tree.\r
+        * @type Ext.tree.TreeNode\r
+        * @property root\r
+        */\r
+        if(this.root){\r
+            var r = this.root;\r
+            delete this.root;\r
+            this.setRootNode(r);\r
+        }\r
 \r
-Ext.extend(Ext.Component, Ext.util.Observable, {\r
-    // Configs below are used for all Components when rendered by FormLayout.\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
 \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
+        this.addEvents(\r
 \r
-    \r
-    \r
-    \r
-\r
-    \r
-    disabledClass : "x-item-disabled",\r
-       \r
-    allowDomMove : true,\r
-       \r
-    autoShow : false,\r
-    \r
-    hideMode: 'display',\r
-    \r
-    hideParent: false,\r
+            /**\r
+            * @event append\r
+            * Fires when a new child node is appended to a node in this tree.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} parent The parent node\r
+            * @param {Node} node The newly appended node\r
+            * @param {Number} index The index of the newly appended node\r
+            */\r
+           "append",\r
+           /**\r
+            * @event remove\r
+            * Fires when a child node is removed from a node in this tree.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} parent The parent node\r
+            * @param {Node} node The child node removed\r
+            */\r
+           "remove",\r
+           /**\r
+            * @event movenode\r
+            * Fires when a node is moved to a new location in the tree\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} node The node moved\r
+            * @param {Node} oldParent The old parent of this node\r
+            * @param {Node} newParent The new parent of this node\r
+            * @param {Number} index The index it was moved to\r
+            */\r
+           "movenode",\r
+           /**\r
+            * @event insert\r
+            * Fires when a new child node is inserted in a node in this tree.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} parent The parent node\r
+            * @param {Node} node The child node inserted\r
+            * @param {Node} refNode The child node the node was inserted before\r
+            */\r
+           "insert",\r
+           /**\r
+            * @event beforeappend\r
+            * Fires before a new child is appended to a node in this tree, return false to cancel the append.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} parent The parent node\r
+            * @param {Node} node The child node to be appended\r
+            */\r
+           "beforeappend",\r
+           /**\r
+            * @event beforeremove\r
+            * Fires before a child is removed from a node in this tree, return false to cancel the remove.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} parent The parent node\r
+            * @param {Node} node The child node to be removed\r
+            */\r
+           "beforeremove",\r
+           /**\r
+            * @event beforemovenode\r
+            * Fires before a node is moved to a new location in the tree. Return false to cancel the move.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} node The node being moved\r
+            * @param {Node} oldParent The parent of the node\r
+            * @param {Node} newParent The new parent the node is moving to\r
+            * @param {Number} index The index it is being moved to\r
+            */\r
+           "beforemovenode",\r
+           /**\r
+            * @event beforeinsert\r
+            * Fires before a new child is inserted in a node in this tree, return false to cancel the insert.\r
+            * @param {Tree} tree The owner tree\r
+            * @param {Node} parent The parent node\r
+            * @param {Node} node The child node to be inserted\r
+            * @param {Node} refNode The child node the node is being inserted before\r
+            */\r
+            "beforeinsert",\r
 \r
-    \r
-    \r
-    hidden : false,\r
-    \r
-    disabled : false,\r
-    \r
-    rendered : false,\r
+            /**\r
+            * @event beforeload\r
+            * Fires before a node is loaded, return false to cancel\r
+            * @param {Node} node The node being loaded\r
+            */\r
+            "beforeload",\r
+            /**\r
+            * @event load\r
+            * Fires when a node is loaded\r
+            * @param {Node} node The node that was loaded\r
+            */\r
+            "load",\r
+            /**\r
+            * @event textchange\r
+            * Fires when the text for a node is changed\r
+            * @param {Node} node The node\r
+            * @param {String} text The new text\r
+            * @param {String} oldText The old text\r
+            */\r
+            "textchange",\r
+            /**\r
+            * @event beforeexpandnode\r
+            * Fires before a node is expanded, return false to cancel.\r
+            * @param {Node} node The node\r
+            * @param {Boolean} deep\r
+            * @param {Boolean} anim\r
+            */\r
+            "beforeexpandnode",\r
+            /**\r
+            * @event beforecollapsenode\r
+            * Fires before a node is collapsed, return false to cancel.\r
+            * @param {Node} node The node\r
+            * @param {Boolean} deep\r
+            * @param {Boolean} anim\r
+            */\r
+            "beforecollapsenode",\r
+            /**\r
+            * @event expandnode\r
+            * Fires when a node is expanded\r
+            * @param {Node} node The node\r
+            */\r
+            "expandnode",\r
+            /**\r
+            * @event disabledchange\r
+            * Fires when the disabled status of a node changes\r
+            * @param {Node} node The node\r
+            * @param {Boolean} disabled\r
+            */\r
+            "disabledchange",\r
+            /**\r
+            * @event collapsenode\r
+            * Fires when a node is collapsed\r
+            * @param {Node} node The node\r
+            */\r
+            "collapsenode",\r
+            /**\r
+            * @event beforeclick\r
+            * Fires before click processing on a node. Return false to cancel the default action.\r
+            * @param {Node} node The node\r
+            * @param {Ext.EventObject} e The event object\r
+            */\r
+            "beforeclick",\r
+            /**\r
+            * @event click\r
+            * Fires when a node is clicked\r
+            * @param {Node} node The node\r
+            * @param {Ext.EventObject} e The event object\r
+            */\r
+            "click",\r
+            /**\r
+            * @event checkchange\r
+            * Fires when a node with a checkbox's checked property changes\r
+            * @param {Node} this This node\r
+            * @param {Boolean} checked\r
+            */\r
+            "checkchange",\r
+            /**\r
+            * @event dblclick\r
+            * Fires when a node is double clicked\r
+            * @param {Node} node The node\r
+            * @param {Ext.EventObject} e The event object\r
+            */\r
+            "dblclick",\r
+            /**\r
+            * @event contextmenu\r
+            * Fires when a node is right clicked. To display a context menu in response to this\r
+            * event, first create a Menu object (see {@link Ext.menu.Menu} for details), then add\r
+            * a handler for this event:<pre><code>\r
+new Ext.tree.TreePanel({\r
+    title: 'My TreePanel',\r
+    root: new Ext.tree.AsyncTreeNode({\r
+        text: 'The Root',\r
+        children: [\r
+            { text: 'Child node 1', leaf: true },\r
+            { text: 'Child node 2', leaf: true }\r
+        ]\r
+    }),\r
+    contextMenu: new Ext.menu.Menu({\r
+        items: [{\r
+            id: 'delete-node',\r
+            text: 'Delete Node'\r
+        }],\r
+        listeners: {\r
+            itemclick: function(item) {\r
+                switch (item.id) {\r
+                    case 'delete-node':\r
+                        var n = item.parentMenu.contextNode;\r
+                        if (n.parentNode) {\r
+                            n.remove();\r
+                        }\r
+                        break;\r
+                }\r
+            }\r
+        }\r
+    }),\r
+    listeners: {\r
+        contextmenu: function(node, e) {\r
+//          Register the context node with the menu so that a Menu Item's handler function can access\r
+//          it via its {@link Ext.menu.BaseItem#parentMenu parentMenu} property.\r
+            node.select();\r
+            var c = node.getOwnerTree().contextMenu;\r
+            c.contextNode = node;\r
+            c.showAt(e.getXY());\r
+        }\r
+    }\r
+});\r
+</code></pre>\r
+            * @param {Node} node The node\r
+            * @param {Ext.EventObject} e The event object\r
+            */\r
+            "contextmenu",\r
+            /**\r
+            * @event beforechildrenrendered\r
+            * Fires right before the child nodes for a node are rendered\r
+            * @param {Node} node The node\r
+            */\r
+            "beforechildrenrendered",\r
+           /**\r
+             * @event startdrag\r
+             * Fires when a node starts being dragged\r
+             * @param {Ext.tree.TreePanel} this\r
+             * @param {Ext.tree.TreeNode} node\r
+             * @param {event} e The raw browser event\r
+             */\r
+            "startdrag",\r
+            /**\r
+             * @event enddrag\r
+             * Fires when a drag operation is complete\r
+             * @param {Ext.tree.TreePanel} this\r
+             * @param {Ext.tree.TreeNode} node\r
+             * @param {event} e The raw browser event\r
+             */\r
+            "enddrag",\r
+            /**\r
+             * @event dragdrop\r
+             * Fires when a dragged node is dropped on a valid DD target\r
+             * @param {Ext.tree.TreePanel} this\r
+             * @param {Ext.tree.TreeNode} node\r
+             * @param {DD} dd The dd it was dropped on\r
+             * @param {event} e The raw browser event\r
+             */\r
+            "dragdrop",\r
+            /**\r
+             * @event beforenodedrop\r
+             * Fires when a DD object is dropped on a node in this tree for preprocessing. Return false to cancel the drop. The dropEvent\r
+             * passed to handlers has the following properties:<br />\r
+             * <ul style="padding:5px;padding-left:16px;">\r
+             * <li>tree - The TreePanel</li>\r
+             * <li>target - The node being targeted for the drop</li>\r
+             * <li>data - The drag data from the drag source</li>\r
+             * <li>point - The point of the drop - append, above or below</li>\r
+             * <li>source - The drag source</li>\r
+             * <li>rawEvent - Raw mouse event</li>\r
+             * <li>dropNode - Drop node(s) provided by the source <b>OR</b> you can supply node(s)\r
+             * to be inserted by setting them on this object.</li>\r
+             * <li>cancel - Set this to true to cancel the drop.</li>\r
+             * <li>dropStatus - If the default drop action is cancelled but the drop is valid, setting this to true\r
+             * will prevent the animated "repair" from appearing.</li>\r
+             * </ul>\r
+             * @param {Object} dropEvent\r
+             */\r
+            "beforenodedrop",\r
+            /**\r
+             * @event nodedrop\r
+             * Fires after a DD object is dropped on a node in this tree. The dropEvent\r
+             * passed to handlers has the following properties:<br />\r
+             * <ul style="padding:5px;padding-left:16px;">\r
+             * <li>tree - The TreePanel</li>\r
+             * <li>target - The node being targeted for the drop</li>\r
+             * <li>data - The drag data from the drag source</li>\r
+             * <li>point - The point of the drop - append, above or below</li>\r
+             * <li>source - The drag source</li>\r
+             * <li>rawEvent - Raw mouse event</li>\r
+             * <li>dropNode - Dropped node(s).</li>\r
+             * </ul>\r
+             * @param {Object} dropEvent\r
+             */\r
+            "nodedrop",\r
+             /**\r
+             * @event nodedragover\r
+             * Fires when a tree node is being targeted for a drag drop, return false to signal drop not allowed. The dragOverEvent\r
+             * passed to handlers has the following properties:<br />\r
+             * <ul style="padding:5px;padding-left:16px;">\r
+             * <li>tree - The TreePanel</li>\r
+             * <li>target - The node being targeted for the drop</li>\r
+             * <li>data - The drag data from the drag source</li>\r
+             * <li>point - The point of the drop - append, above or below</li>\r
+             * <li>source - The drag source</li>\r
+             * <li>rawEvent - Raw mouse event</li>\r
+             * <li>dropNode - Drop node(s) provided by the source.</li>\r
+             * <li>cancel - Set this to true to signal drop not allowed.</li>\r
+             * </ul>\r
+             * @param {Object} dragOverEvent\r
+             */\r
+            "nodedragover"\r
+        );\r
+        if(this.singleExpand){\r
+            this.on("beforeexpandnode", this.restrictExpand, this);\r
+        }\r
+    },\r
 \r
     // private\r
-    ctype : "Ext.Component",\r
+    proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){\r
+        if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){\r
+            ename = ename+'node';\r
+        }\r
+        // args inline for performance while bubbling events\r
+        return this.fireEvent(ename, a1, a2, a3, a4, a5, a6);\r
+    },\r
 \r
-    // private\r
-    actionMode : "el",\r
 \r
-    // private\r
-    getActionEl : function(){\r
-        return this[this.actionMode];\r
+    /**\r
+     * Returns this root node for this tree\r
+     * @return {Node}\r
+     */\r
+    getRootNode : function(){\r
+        return this.root;\r
     },\r
 \r
-    initPlugin : function(p){\r
-        p.init(this);\r
-        return p;\r
+    /**\r
+     * Sets the root node for this tree. If the TreePanel has already rendered a root node, the\r
+     * previous root node (and all of its descendants) are destroyed before the new root node is rendered.\r
+     * @param {Node} node\r
+     * @return {Node}\r
+     */\r
+    setRootNode : function(node){\r
+        Ext.destroy(this.root);\r
+        if(!node.render){ // attributes passed\r
+            node = this.loader.createNode(node);\r
+        }\r
+        this.root = node;\r
+        node.ownerTree = this;\r
+        node.isRoot = true;\r
+        this.registerNode(node);\r
+        if(!this.rootVisible){\r
+            var uiP = node.attributes.uiProvider;\r
+            node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node);\r
+        }\r
+        if (this.innerCt) {\r
+            this.innerCt.update('');\r
+            this.afterRender();\r
+        }\r
+        return node;\r
     },\r
 \r
-    \r
-    initComponent : Ext.emptyFn,\r
-\r
-    \r
-    render : function(container, position){\r
-        if(!this.rendered && this.fireEvent("beforerender", this) !== false){\r
-            if(!container && this.el){\r
-                this.el = Ext.get(this.el);\r
-                container = this.el.dom.parentNode;\r
-                this.allowDomMove = false;\r
-            }\r
-            this.container = Ext.get(container);\r
-            if(this.ctCls){\r
-                this.container.addClass(this.ctCls);\r
-            }\r
-            this.rendered = true;\r
-            if(position !== undefined){\r
-                if(typeof position == 'number'){\r
-                    position = this.container.dom.childNodes[position];\r
-                }else{\r
-                    position = Ext.getDom(position);\r
-                }\r
-            }\r
-            this.onRender(this.container, position || null);\r
-            if(this.autoShow){\r
-                this.el.removeClass(['x-hidden','x-hide-' + this.hideMode]);\r
-            }\r
-            if(this.cls){\r
-                this.el.addClass(this.cls);\r
-                delete this.cls;\r
-            }\r
-            if(this.style){\r
-                this.el.applyStyles(this.style);\r
-                delete this.style;\r
-            }\r
-            if(this.overCls){\r
-                this.el.addClassOnOver(this.overCls);\r
-            }\r
-            this.fireEvent("render", this);\r
-            this.afterRender(this.container);\r
-            if(this.hidden){\r
-                this.hide();\r
-            }\r
-            if(this.disabled){\r
-                this.disable();\r
-            }\r
+    /**\r
+     * Gets a node in this tree by its id\r
+     * @param {String} id\r
+     * @return {Node}\r
+     */\r
+    getNodeById : function(id){\r
+        return this.nodeHash[id];\r
+    },\r
 \r
-            if(this.stateful !== false){\r
-                this.initStateEvents();\r
-            }\r
-        }\r
-        return this;\r
+    // private\r
+    registerNode : function(node){\r
+        this.nodeHash[node.id] = node;\r
     },\r
 \r
     // private\r
-    initState : function(config){\r
-        if(Ext.state.Manager){\r
-            var id = this.getStateId();\r
-            if(id){\r
-                var state = Ext.state.Manager.get(id);\r
-                if(state){\r
-                    if(this.fireEvent('beforestaterestore', this, state) !== false){\r
-                        this.applyState(state);\r
-                        this.fireEvent('staterestore', this, state);\r
-                    }\r
-                }\r
-            }\r
-        }\r
+    unregisterNode : function(node){\r
+        delete this.nodeHash[node.id];\r
     },\r
 \r
     // private\r
-    getStateId : function(){\r
-        return this.stateId || ((this.id.indexOf('ext-comp-') == 0 || this.id.indexOf('ext-gen') == 0) ? null : this.id);\r
+    toString : function(){\r
+        return "[Tree"+(this.id?" "+this.id:"")+"]";\r
     },\r
 \r
     // private\r
-    initStateEvents : function(){\r
-        if(this.stateEvents){\r
-            for(var i = 0, e; e = this.stateEvents[i]; i++){\r
-                this.on(e, this.saveState, this, {delay:100});\r
+    restrictExpand : function(node){\r
+        var p = node.parentNode;\r
+        if(p){\r
+            if(p.expandedChild && p.expandedChild.parentNode == p){\r
+                p.expandedChild.collapse();\r
             }\r
+            p.expandedChild = node;\r
         }\r
     },\r
 \r
-    // private\r
-    applyState : function(state, config){\r
-        if(state){\r
-            Ext.apply(this, state);\r
-        }\r
+    /**\r
+     * Retrieve an array of checked nodes, or an array of a specific attribute of checked nodes (e.g. "id")\r
+     * @param {String} attribute (optional) Defaults to null (return the actual nodes)\r
+     * @param {TreeNode} startNode (optional) The node to start from, defaults to the root\r
+     * @return {Array}\r
+     */\r
+    getChecked : function(a, startNode){\r
+        startNode = startNode || this.root;\r
+        var r = [];\r
+        var f = function(){\r
+            if(this.attributes.checked){\r
+                r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));\r
+            }\r
+        };\r
+        startNode.cascade(f);\r
+        return r;\r
     },\r
 \r
-    // private\r
-    getState : function(){\r
-        return null;\r
+    /**\r
+     * Returns the container element for this TreePanel.\r
+     * @return {Element} The container element for this TreePanel.\r
+     */\r
+    getEl : function(){\r
+        return this.el;\r
     },\r
 \r
-    // private\r
-    saveState : function(){\r
-        if(Ext.state.Manager){\r
-            var id = this.getStateId();\r
-            if(id){\r
-                var state = this.getState();\r
-                if(this.fireEvent('beforestatesave', this, state) !== false){\r
-                    Ext.state.Manager.set(id, state);\r
-                    this.fireEvent('statesave', this, state);\r
-                }\r
-            }\r
-        }\r
+    /**\r
+     * Returns the default {@link Ext.tree.TreeLoader} for this TreePanel.\r
+     * @return {Ext.tree.TreeLoader} The TreeLoader for this TreePanel.\r
+     */\r
+    getLoader : function(){\r
+        return this.loader;\r
     },\r
 \r
-    \r
-    applyToMarkup : function(el){\r
-        this.allowDomMove = false;\r
-        this.el = Ext.get(el);\r
-        this.render(this.el.dom.parentNode);\r
+    /**\r
+     * Expand all nodes\r
+     */\r
+    expandAll : function(){\r
+        this.root.expand(true);\r
     },\r
 \r
-    \r
-    addClass : function(cls){\r
-        if(this.el){\r
-            this.el.addClass(cls);\r
-        }else{\r
-            this.cls = this.cls ? this.cls + ' ' + cls : cls;\r
-        }\r
+    /**\r
+     * Collapse all nodes\r
+     */\r
+    collapseAll : function(){\r
+        this.root.collapse(true);\r
     },\r
 \r
-    \r
-    removeClass : function(cls){\r
-        if(this.el){\r
-            this.el.removeClass(cls);\r
-        }else if(this.cls){\r
-            this.cls = this.cls.split(' ').remove(cls).join(' ');\r
+    /**\r
+     * Returns the selection model used by this TreePanel.\r
+     * @return {TreeSelectionModel} The selection model used by this TreePanel\r
+     */\r
+    getSelectionModel : function(){\r
+        if(!this.selModel){\r
+            this.selModel = new Ext.tree.DefaultSelectionModel();\r
         }\r
+        return this.selModel;\r
     },\r
 \r
-    // private\r
-    // default function is not really useful\r
-    onRender : function(ct, position){\r
-        if(this.autoEl){\r
-            if(typeof this.autoEl == 'string'){\r
-                this.el = document.createElement(this.autoEl);\r
-            }else{\r
-                var div = document.createElement('div');\r
-                Ext.DomHelper.overwrite(div, this.autoEl);\r
-                this.el = div.firstChild;\r
-            }\r
-            if (!this.el.id) {\r
-               this.el.id = this.getId();\r
+    /**\r
+     * Expands a specified path in this TreePanel. A path can be retrieved from a node with {@link Ext.data.Node#getPath}\r
+     * @param {String} path\r
+     * @param {String} attr (optional) The attribute used in the path (see {@link Ext.data.Node#getPath} for more info)\r
+     * @param {Function} callback (optional) The callback to call when the expand is complete. The callback will be called with\r
+     * (bSuccess, oLastNode) where bSuccess is if the expand was successful and oLastNode is the last node that was expanded.\r
+     */\r
+    expandPath : function(path, attr, callback){\r
+        attr = attr || "id";\r
+        var keys = path.split(this.pathSeparator);\r
+        var curNode = this.root;\r
+        if(curNode.attributes[attr] != keys[1]){ // invalid root\r
+            if(callback){\r
+                callback(false, null);\r
             }\r
+            return;\r
         }\r
-        if(this.el){\r
-            this.el = Ext.get(this.el);\r
-            if(this.allowDomMove !== false){\r
-                ct.dom.insertBefore(this.el.dom, position);\r
+        var index = 1;\r
+        var f = function(){\r
+            if(++index == keys.length){\r
+                if(callback){\r
+                    callback(true, curNode);\r
+                }\r
+                return;\r
             }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getAutoCreate : function(){\r
-        var cfg = typeof this.autoCreate == "object" ?\r
-                      this.autoCreate : Ext.apply({}, this.defaultAutoCreate);\r
-        if(this.id && !cfg.id){\r
-            cfg.id = this.id;\r
-        }\r
-        return cfg;\r
+            var c = curNode.findChild(attr, keys[index]);\r
+            if(!c){\r
+                if(callback){\r
+                    callback(false, curNode);\r
+                }\r
+                return;\r
+            }\r
+            curNode = c;\r
+            c.expand(false, false, f);\r
+        };\r
+        curNode.expand(false, false, f);\r
     },\r
 \r
-    // private\r
-    afterRender : Ext.emptyFn,\r
-\r
-    \r
-    destroy : function(){\r
-        if(this.fireEvent("beforedestroy", this) !== false){\r
-            this.beforeDestroy();\r
-            if(this.rendered){\r
-                this.el.removeAllListeners();\r
-                this.el.remove();\r
-                if(this.actionMode == "container"){\r
-                    this.container.remove();\r
+    /**\r
+     * Selects the node in this tree at the specified path. A path can be retrieved from a node with {@link Ext.data.Node#getPath}\r
+     * @param {String} path\r
+     * @param {String} attr (optional) The attribute used in the path (see {@link Ext.data.Node#getPath} for more info)\r
+     * @param {Function} callback (optional) The callback to call when the selection is complete. The callback will be called with\r
+     * (bSuccess, oSelNode) where bSuccess is if the selection was successful and oSelNode is the selected node.\r
+     */\r
+    selectPath : function(path, attr, callback){\r
+        attr = attr || "id";\r
+        var keys = path.split(this.pathSeparator);\r
+        var v = keys.pop();\r
+        if(keys.length > 0){\r
+            var f = function(success, node){\r
+                if(success && node){\r
+                    var n = node.findChild(attr, v);\r
+                    if(n){\r
+                        n.select();\r
+                        if(callback){\r
+                            callback(true, n);\r
+                        }\r
+                    }else if(callback){\r
+                        callback(false, n);\r
+                    }\r
+                }else{\r
+                    if(callback){\r
+                        callback(false, n);\r
+                    }\r
                 }\r
+            };\r
+            this.expandPath(keys.join(this.pathSeparator), attr, f);\r
+        }else{\r
+            this.root.select();\r
+            if(callback){\r
+                callback(true, this.root);\r
             }\r
-            this.onDestroy();\r
-            Ext.ComponentMgr.unregister(this);\r
-            this.fireEvent("destroy", this);\r
-            this.purgeListeners();\r
         }\r
     },\r
 \r
-       // private\r
-    beforeDestroy : Ext.emptyFn,\r
-\r
-       // private\r
-    onDestroy  : Ext.emptyFn,\r
-\r
-    \r
-    getEl : function(){\r
-        return this.el;\r
+    /**\r
+     * Returns the underlying Element for this tree\r
+     * @return {Ext.Element} The Element\r
+     */\r
+    getTreeEl : function(){\r
+        return this.body;\r
     },\r
 \r
-    \r
-    getId : function(){\r
-        return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));\r
+    // private\r
+    onRender : function(ct, position){\r
+        Ext.tree.TreePanel.superclass.onRender.call(this, ct, position);\r
+        this.el.addClass('x-tree');\r
+        this.innerCt = this.body.createChild({tag:"ul",\r
+               cls:"x-tree-root-ct " +\r
+               (this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")});\r
     },\r
 \r
-    \r
-    getItemId : function(){\r
-        return this.itemId || this.getId();\r
-    },\r
+    // private\r
+    initEvents : function(){\r
+        Ext.tree.TreePanel.superclass.initEvents.call(this);\r
 \r
-    \r
-    focus : function(selectText, delay){\r
-        if(delay){\r
-            this.focus.defer(typeof delay == 'number' ? delay : 10, this, [selectText, false]);\r
-            return;\r
+        if(this.containerScroll){\r
+            Ext.dd.ScrollManager.register(this.body);\r
         }\r
-        if(this.rendered){\r
-            this.el.focus();\r
-            if(selectText === true){\r
-                this.el.dom.select();\r
-            }\r
+        if((this.enableDD || this.enableDrop) && !this.dropZone){\r
+           /**\r
+            * The dropZone used by this tree if drop is enabled (see {@link #enableDD} or {@link #enableDrop})\r
+            * @property dropZone\r
+            * @type Ext.tree.TreeDropZone\r
+            */\r
+             this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {\r
+               ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true\r
+           });\r
         }\r
-        return this;\r
+        if((this.enableDD || this.enableDrag) && !this.dragZone){\r
+           /**\r
+            * The dragZone used by this tree if drag is enabled (see {@link #enableDD} or {@link #enableDrag})\r
+            * @property dragZone\r
+            * @type Ext.tree.TreeDragZone\r
+            */\r
+            this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || {\r
+               ddGroup: this.ddGroup || "TreeDD",\r
+               scroll: this.ddScroll\r
+           });\r
+        }\r
+        this.getSelectionModel().init(this);\r
     },\r
 \r
     // private\r
-    blur : function(){\r
-        if(this.rendered){\r
-            this.el.blur();\r
+    afterRender : function(){\r
+        Ext.tree.TreePanel.superclass.afterRender.call(this);\r
+        this.root.render();\r
+        if(!this.rootVisible){\r
+            this.root.renderChildren();\r
         }\r
-        return this;\r
     },\r
 \r
-    \r
-    disable : function(){\r
+    onDestroy : function(){\r
         if(this.rendered){\r
-            this.onDisable();\r
+            this.body.removeAllListeners();\r
+            Ext.dd.ScrollManager.unregister(this.body);\r
+            if(this.dropZone){\r
+                this.dropZone.unreg();\r
+            }\r
+            if(this.dragZone){\r
+               this.dragZone.unreg();\r
+            }\r
         }\r
-        this.disabled = true;\r
-        this.fireEvent("disable", this);\r
-        return this;\r
-    },\r
+        this.root.destroy();\r
+        this.nodeHash = null;\r
+        Ext.tree.TreePanel.superclass.onDestroy.call(this);\r
+    }\r
 \r
-       // private\r
-    onDisable : function(){\r
-        this.getActionEl().addClass(this.disabledClass);\r
-        this.el.dom.disabled = true;\r
-    },\r
+    /**\r
+     * @cfg {String/Number} activeItem\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} autoDestroy\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Object/String/Function} autoLoad\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} autoWidth\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean/Number} bufferResize\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} defaultType\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Object} defaults\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} hideBorders\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Mixed} items\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} layout\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Object} layoutConfig\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} monitorResize\r
+     * @hide\r
+     */\r
+    /**\r
+     * @property items\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method cascade\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method doLayout\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method find\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method findBy\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method findById\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method findByType\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method getComponent\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method getLayout\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method getUpdater\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method insert\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method load\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method remove\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event add\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method removeAll\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event afterLayout\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event beforeadd\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event beforeremove\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event remove\r
+     * @hide\r
+     */\r
+\r
+\r
+\r
+    /**\r
+     * @cfg {String} allowDomMove  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} autoEl @hide\r
+     */\r
+    /**\r
+     * @cfg {String} applyTo  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} contentEl  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} disabledClass  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} elements  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} html  @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} preventBodyReset\r
+     * @hide\r
+     */\r
+    /**\r
+     * @property disabled\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method applyToMarkup\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method enable\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method disable\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method setDisabled\r
+     * @hide\r
+     */\r
+});\r
 \r
-    \r
-    enable : function(){\r
-        if(this.rendered){\r
-            this.onEnable();\r
-        }\r
-        this.disabled = false;\r
-        this.fireEvent("enable", this);\r
-        return this;\r
-    },\r
+Ext.tree.TreePanel.nodeTypes = {};\r
 \r
-       // private\r
-    onEnable : function(){\r
-        this.getActionEl().removeClass(this.disabledClass);\r
-        this.el.dom.disabled = false;\r
-    },\r
+Ext.reg('treepanel', Ext.tree.TreePanel);Ext.tree.TreeEventModel = function(tree){\r
+    this.tree = tree;\r
+    this.tree.on('render', this.initEvents, this);\r
+}\r
 \r
-    \r
-    setDisabled : function(disabled){\r
-        this[disabled ? "disable" : "enable"]();\r
+Ext.tree.TreeEventModel.prototype = {\r
+    initEvents : function(){\r
+        var el = this.tree.getTreeEl();\r
+        el.on('click', this.delegateClick, this);\r
+        if(this.tree.trackMouseOver !== false){\r
+            this.tree.innerCt.on('mouseover', this.delegateOver, this);\r
+            this.tree.innerCt.on('mouseout', this.delegateOut, this);\r
+        }\r
+        el.on('dblclick', this.delegateDblClick, this);\r
+        el.on('contextmenu', this.delegateContextMenu, this);\r
     },\r
 \r
-    \r
-    show: function(){\r
-        if(this.fireEvent("beforeshow", this) !== false){\r
-            this.hidden = false;\r
-            if(this.autoRender){\r
-                this.render(typeof this.autoRender == 'boolean' ? Ext.getBody() : this.autoRender);\r
-            }\r
-            if(this.rendered){\r
-                this.onShow();\r
+    getNode : function(e){\r
+        var t;\r
+        if(t = e.getTarget('.x-tree-node-el', 10)){\r
+            var id = Ext.fly(t, '_treeEvents').getAttribute('tree-node-id', 'ext');\r
+            if(id){\r
+                return this.tree.getNodeById(id);\r
             }\r
-            this.fireEvent("show", this);\r
         }\r
-        return this;\r
+        return null;\r
     },\r
 \r
-    // private\r
-    onShow : function(){\r
-        if(this.hideParent){\r
-            this.container.removeClass('x-hide-' + this.hideMode);\r
-        }else{\r
-            this.getActionEl().removeClass('x-hide-' + this.hideMode);\r
+    getNodeTarget : function(e){\r
+        var t = e.getTarget('.x-tree-node-icon', 1);\r
+        if(!t){\r
+            t = e.getTarget('.x-tree-node-el', 6);\r
         }\r
-\r
+        return t;\r
     },\r
 \r
-    \r
-    hide: function(){\r
-        if(this.fireEvent("beforehide", this) !== false){\r
-            this.hidden = true;\r
-            if(this.rendered){\r
-                this.onHide();\r
+    delegateOut : function(e, t){\r
+        if(!this.beforeEvent(e)){\r
+            return;\r
+        }\r
+        if(e.getTarget('.x-tree-ec-icon', 1)){\r
+            var n = this.getNode(e);\r
+            this.onIconOut(e, n);\r
+            if(n == this.lastEcOver){\r
+                delete this.lastEcOver;\r
             }\r
-            this.fireEvent("hide", this);\r
         }\r
-        return this;\r
-    },\r
-\r
-    // private\r
-    onHide : function(){\r
-        if(this.hideParent){\r
-            this.container.addClass('x-hide-' + this.hideMode);\r
-        }else{\r
-            this.getActionEl().addClass('x-hide-' + this.hideMode);\r
+        if((t = this.getNodeTarget(e)) && !e.within(t, true)){\r
+            this.onNodeOut(e, this.getNode(e));\r
         }\r
     },\r
 \r
-    \r
-    setVisible: function(visible){\r
-        if(visible) {\r
-            this.show();\r
-        }else{\r
-            this.hide();\r
+    delegateOver : function(e, t){\r
+        if(!this.beforeEvent(e)){\r
+            return;\r
+        }\r
+        if(Ext.isGecko && !this.trackingDoc){ // prevent hanging in FF\r
+            Ext.getBody().on('mouseover', this.trackExit, this);\r
+            this.trackingDoc = true;\r
+        }\r
+        if(this.lastEcOver){ // prevent hung highlight\r
+            this.onIconOut(e, this.lastEcOver);\r
+            delete this.lastEcOver;\r
+        }\r
+        if(e.getTarget('.x-tree-ec-icon', 1)){\r
+            this.lastEcOver = this.getNode(e);\r
+            this.onIconOver(e, this.lastEcOver);\r
+        }\r
+        if(t = this.getNodeTarget(e)){\r
+            this.onNodeOver(e, this.getNode(e));\r
         }\r
-        return this;\r
-    },\r
-\r
-    \r
-    isVisible : function(){\r
-        return this.rendered && this.getActionEl().isVisible();\r
-    },\r
-\r
-    \r
-    cloneConfig : function(overrides){\r
-        overrides = overrides || {};\r
-        var id = overrides.id || Ext.id();\r
-        var cfg = Ext.applyIf(overrides, this.initialConfig);\r
-        cfg.id = id; // prevent dup id\r
-        return new this.constructor(cfg);\r
-    },\r
-\r
-    \r
-    getXType : function(){\r
-        return this.constructor.xtype;\r
     },\r
 \r
-    \r
-    isXType : function(xtype, shallow){\r
-        //assume a string by default\r
-        if (typeof xtype == 'function'){\r
-            xtype = xtype.xtype; //handle being passed the class, eg. Ext.Component\r
-        }else if (typeof xtype == 'object'){\r
-            xtype = xtype.constructor.xtype; //handle being passed an instance\r
+    trackExit : function(e){\r
+        if(this.lastOverNode && !e.within(this.lastOverNode.ui.getEl())){\r
+            this.onNodeOut(e, this.lastOverNode);\r
+            delete this.lastOverNode;\r
+            Ext.getBody().un('mouseover', this.trackExit, this);\r
+            this.trackingDoc = false;\r
         }\r
-            \r
-        return !shallow ? ('/' + this.getXTypes() + '/').indexOf('/' + xtype + '/') != -1 : this.constructor.xtype == xtype;\r
     },\r
 \r
-    \r
-    getXTypes : function(){\r
-        var tc = this.constructor;\r
-        if(!tc.xtypes){\r
-            var c = [], sc = this;\r
-            while(sc && sc.constructor.xtype){\r
-                c.unshift(sc.constructor.xtype);\r
-                sc = sc.constructor.superclass;\r
-            }\r
-            tc.xtypeChain = c;\r
-            tc.xtypes = c.join('/');\r
+    delegateClick : function(e, t){\r
+        if(!this.beforeEvent(e)){\r
+            return;\r
         }\r
-        return tc.xtypes;\r
-    },\r
 \r
-    \r
-    findParentBy: function(fn) {\r
-        for (var p = this.ownerCt; (p != null) && !fn(p, this); p = p.ownerCt);\r
-        return p || null;\r
+        if(e.getTarget('input[type=checkbox]', 1)){\r
+            this.onCheckboxClick(e, this.getNode(e));\r
+        }\r
+        else if(e.getTarget('.x-tree-ec-icon', 1)){\r
+            this.onIconClick(e, this.getNode(e));\r
+        }\r
+        else if(this.getNodeTarget(e)){\r
+            this.onNodeClick(e, this.getNode(e));\r
+        }\r
     },\r
 \r
-    \r
-    findParentByType: function(xtype) {\r
-        return typeof xtype == 'function' ?\r
-            this.findParentBy(function(p){\r
-                return p.constructor === xtype;\r
-            }) :\r
-            this.findParentBy(function(p){\r
-                return p.constructor.xtype === xtype;\r
-            });\r
+    delegateDblClick : function(e, t){\r
+        if(this.beforeEvent(e) && this.getNodeTarget(e)){\r
+            this.onNodeDblClick(e, this.getNode(e));\r
+        }\r
     },\r
 \r
-    // internal function for auto removal of assigned event handlers on destruction\r
-    mon : function(item, ename, fn, scope, opt){\r
-        if(!this.mons){\r
-            this.mons = [];\r
-            this.on('beforedestroy', function(){\r
-                for(var i= 0, len = this.mons.length; i < len; i++){\r
-                    var m = this.mons[i];\r
-                    m.item.un(m.ename, m.fn, m.scope);\r
-                }\r
-            }, this);\r
+    delegateContextMenu : function(e, t){\r
+        if(this.beforeEvent(e) && this.getNodeTarget(e)){\r
+            this.onNodeContextMenu(e, this.getNode(e));\r
         }\r
-        this.mons.push({\r
-            item: item, ename: ename, fn: fn, scope: scope\r
-        });\r
-        item.on(ename, fn, scope, opt);\r
-    }\r
-});\r
-\r
-Ext.reg('component', Ext.Component);\r
-\r
-\r
-Ext.Action = function(config){\r
-    this.initialConfig = config;\r
-    this.items = [];\r
-}\r
-\r
-Ext.Action.prototype = {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    // private\r
-    isAction : true,\r
-\r
-    \r
-    setText : function(text){\r
-        this.initialConfig.text = text;\r
-        this.callEach('setText', [text]);\r
     },\r
 \r
-    \r
-    getText : function(){\r
-        return this.initialConfig.text;\r
+    onNodeClick : function(e, node){\r
+        node.ui.onClick(e);\r
     },\r
 \r
-    \r
-    setIconClass : function(cls){\r
-        this.initialConfig.iconCls = cls;\r
-        this.callEach('setIconClass', [cls]);\r
+    onNodeOver : function(e, node){\r
+        this.lastOverNode = node;\r
+        node.ui.onOver(e);\r
     },\r
 \r
-    \r
-    getIconClass : function(){\r
-        return this.initialConfig.iconCls;\r
+    onNodeOut : function(e, node){\r
+        node.ui.onOut(e);\r
     },\r
 \r
-    \r
-    setDisabled : function(v){\r
-        this.initialConfig.disabled = v;\r
-        this.callEach('setDisabled', [v]);\r
+    onIconOver : function(e, node){\r
+        node.ui.addClass('x-tree-ec-over');\r
     },\r
 \r
-    \r
-    enable : function(){\r
-        this.setDisabled(false);\r
+    onIconOut : function(e, node){\r
+        node.ui.removeClass('x-tree-ec-over');\r
     },\r
 \r
-    \r
-    disable : function(){\r
-        this.setDisabled(true);\r
+    onIconClick : function(e, node){\r
+        node.ui.ecClick(e);\r
     },\r
 \r
-    \r
-    isDisabled : function(){\r
-        return this.initialConfig.disabled;\r
+    onCheckboxClick : function(e, node){\r
+        node.ui.onCheckChange(e);\r
     },\r
 \r
-    \r
-    setHidden : function(v){\r
-        this.initialConfig.hidden = v;\r
-        this.callEach('setVisible', [!v]);\r
+    onNodeDblClick : function(e, node){\r
+        node.ui.onDblClick(e);\r
     },\r
 \r
-    \r
-    show : function(){\r
-        this.setHidden(false);\r
+    onNodeContextMenu : function(e, node){\r
+        node.ui.onContextMenu(e);\r
     },\r
 \r
-    \r
-    hide : function(){\r
-        this.setHidden(true);\r
+    beforeEvent : function(e){\r
+        if(this.disabled){\r
+            e.stopEvent();\r
+            return false;\r
+        }\r
+        return true;\r
     },\r
 \r
-    \r
-    isHidden : function(){\r
-        return this.initialConfig.hidden;\r
+    disable: function(){\r
+        this.disabled = true;\r
     },\r
 \r
-    \r
-    setHandler : function(fn, scope){\r
-        this.initialConfig.handler = fn;\r
-        this.initialConfig.scope = scope;\r
-        this.callEach('setHandler', [fn, scope]);\r
-    },\r
-\r
-    \r
-    each : function(fn, scope){\r
-        Ext.each(this.items, fn, scope);\r
-    },\r
-\r
-    // private\r
-    callEach : function(fnName, args){\r
-        var cs = this.items;\r
-        for(var i = 0, len = cs.length; i < len; i++){\r
-            cs[i][fnName].apply(cs[i], args);\r
-        }\r
-    },\r
-\r
-    // private\r
-    addComponent : function(comp){\r
-        this.items.push(comp);\r
-        comp.on('destroy', this.removeComponent, this);\r
-    },\r
-\r
-    // private\r
-    removeComponent : function(comp){\r
-        this.items.remove(comp);\r
-    },\r
-\r
-    \r
-    execute : function(){\r
-        this.initialConfig.handler.apply(this.initialConfig.scope || window, arguments);\r
-    }\r
-};\r
-\r
-(function(){\r
-Ext.Layer = function(config, existingEl){\r
-    config = config || {};\r
-    var dh = Ext.DomHelper;\r
-    var cp = config.parentEl, pel = cp ? Ext.getDom(cp) : document.body;\r
-    if(existingEl){\r
-        this.dom = Ext.getDom(existingEl);\r
-    }\r
-    if(!this.dom){\r
-        var o = config.dh || {tag: "div", cls: "x-layer"};\r
-        this.dom = dh.append(pel, o);\r
-    }\r
-    if(config.cls){\r
-        this.addClass(config.cls);\r
-    }\r
-    this.constrain = config.constrain !== false;\r
-    this.visibilityMode = Ext.Element.VISIBILITY;\r
-    if(config.id){\r
-        this.id = this.dom.id = config.id;\r
-    }else{\r
-        this.id = Ext.id(this.dom);\r
-    }\r
-    this.zindex = config.zindex || this.getZIndex();\r
-    this.position("absolute", this.zindex);\r
-    if(config.shadow){\r
-        this.shadowOffset = config.shadowOffset || 4;\r
-        this.shadow = new Ext.Shadow({\r
-            offset : this.shadowOffset,\r
-            mode : config.shadow\r
-        });\r
-    }else{\r
-        this.shadowOffset = 0;\r
+    enable: function(){\r
+        this.disabled = false;\r
     }\r
-    this.useShim = config.shim !== false && Ext.useShims;\r
-    this.useDisplay = config.useDisplay;\r
-    this.hide();\r
-};\r
-\r
-var supr = Ext.Element.prototype;\r
-\r
-// shims are shared among layer to keep from having 100 iframes\r
-var shims = [];\r
-\r
-Ext.extend(Ext.Layer, Ext.Element, {\r
+};/**\r
+ * @class Ext.tree.DefaultSelectionModel\r
+ * @extends Ext.util.Observable\r
+ * The default single selection for a TreePanel.\r
+ */\r
+Ext.tree.DefaultSelectionModel = function(config){\r
+   this.selNode = null;\r
+   \r
+   this.addEvents(\r
+       /**\r
+        * @event selectionchange\r
+        * Fires when the selected node changes\r
+        * @param {DefaultSelectionModel} this\r
+        * @param {TreeNode} node the new selection\r
+        */\r
+       "selectionchange",\r
 \r
-    getZIndex : function(){\r
-        return this.zindex || parseInt(this.getStyle("z-index"), 10) || 11000;\r
-    },\r
+       /**\r
+        * @event beforeselect\r
+        * Fires before the selected node changes, return false to cancel the change\r
+        * @param {DefaultSelectionModel} this\r
+        * @param {TreeNode} node the new selection\r
+        * @param {TreeNode} node the old selection\r
+        */\r
+       "beforeselect"\r
+   );\r
 \r
-    getShim : function(){\r
-        if(!this.useShim){\r
-            return null;\r
-        }\r
-        if(this.shim){\r
-            return this.shim;\r
-        }\r
-        var shim = shims.shift();\r
-        if(!shim){\r
-            shim = this.createShim();\r
-            shim.enableDisplayMode('block');\r
-            shim.dom.style.display = 'none';\r
-            shim.dom.style.visibility = 'visible';\r
-        }\r
-        var pn = this.dom.parentNode;\r
-        if(shim.dom.parentNode != pn){\r
-            pn.insertBefore(shim.dom, this.dom);\r
-        }\r
-        shim.setStyle('z-index', this.getZIndex()-2);\r
-        this.shim = shim;\r
-        return shim;\r
-    },\r
+    Ext.apply(this, config);\r
+    Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);\r
+};\r
 \r
-    hideShim : function(){\r
-        if(this.shim){\r
-            this.shim.setDisplayed(false);\r
-            shims.push(this.shim);\r
-            delete this.shim;\r
-        }\r
+Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {\r
+    init : function(tree){\r
+        this.tree = tree;\r
+        tree.getTreeEl().on("keydown", this.onKeyDown, this);\r
+        tree.on("click", this.onNodeClick, this);\r
     },\r
-\r
-    disableShadow : function(){\r
-        if(this.shadow){\r
-            this.shadowDisabled = true;\r
-            this.shadow.hide();\r
-            this.lastShadowOffset = this.shadowOffset;\r
-            this.shadowOffset = 0;\r
-        }\r
+    \r
+    onNodeClick : function(node, e){\r
+        this.select(node);\r
     },\r
-\r
-    enableShadow : function(show){\r
-        if(this.shadow){\r
-            this.shadowDisabled = false;\r
-            this.shadowOffset = this.lastShadowOffset;\r
-            delete this.lastShadowOffset;\r
-            if(show){\r
-                this.sync(true);\r
+    \r
+    /**\r
+     * Select a node.\r
+     * @param {TreeNode} node The node to select\r
+     * @return {TreeNode} The selected node\r
+     */\r
+    select : function(node){\r
+        var last = this.selNode;\r
+        if(node == last){\r
+            node.ui.onSelectedChange(true);\r
+        }else if(this.fireEvent('beforeselect', this, node, last) !== false){\r
+            if(last){\r
+                last.ui.onSelectedChange(false);\r
             }\r
+            this.selNode = node;\r
+            node.ui.onSelectedChange(true);\r
+            this.fireEvent("selectionchange", this, node, last);\r
         }\r
+        return node;\r
     },\r
-\r
-    // private\r
-    // this code can execute repeatedly in milliseconds (i.e. during a drag) so\r
-    // code size was sacrificed for effeciency (e.g. no getBox/setBox, no XY calls)\r
-    sync : function(doShow){\r
-        var sw = this.shadow;\r
-        if(!this.updating && this.isVisible() && (sw || this.useShim)){\r
-            var sh = this.getShim();\r
-\r
-            var w = this.getWidth(),\r
-                h = this.getHeight();\r
-\r
-            var l = this.getLeft(true),\r
-                t = this.getTop(true);\r
-\r
-            if(sw && !this.shadowDisabled){\r
-                if(doShow && !sw.isVisible()){\r
-                    sw.show(this);\r
-                }else{\r
-                    sw.realign(l, t, w, h);\r
-                }\r
-                if(sh){\r
-                    if(doShow){\r
-                       sh.show();\r
-                    }\r
-                    // fit the shim behind the shadow, so it is shimmed too\r
-                    var a = sw.adjusts, s = sh.dom.style;\r
-                    s.left = (Math.min(l, l+a.l))+"px";\r
-                    s.top = (Math.min(t, t+a.t))+"px";\r
-                    s.width = (w+a.w)+"px";\r
-                    s.height = (h+a.h)+"px";\r
-                }\r
-            }else if(sh){\r
-                if(doShow){\r
-                   sh.show();\r
-                }\r
-                sh.setSize(w, h);\r
-                sh.setLeftTop(l, t);\r
-            }\r
-\r
-        }\r
+    \r
+    /**\r
+     * Deselect a node.\r
+     * @param {TreeNode} node The node to unselect\r
+     */\r
+    unselect : function(node){\r
+        if(this.selNode == node){\r
+            this.clearSelections();\r
+        }    \r
     },\r
-\r
-    // private\r
-    destroy : function(){\r
-        this.hideShim();\r
-        if(this.shadow){\r
-            this.shadow.hide();\r
+    \r
+    /**\r
+     * Clear all selections\r
+     */\r
+    clearSelections : function(){\r
+        var n = this.selNode;\r
+        if(n){\r
+            n.ui.onSelectedChange(false);\r
+            this.selNode = null;\r
+            this.fireEvent("selectionchange", this, null);\r
         }\r
-        this.removeAllListeners();\r
-        Ext.removeNode(this.dom);\r
-        Ext.Element.uncache(this.id);\r
-    },\r
-\r
-    remove : function(){\r
-        this.destroy();\r
+        return n;\r
     },\r
-\r
-    // private\r
-    beginUpdate : function(){\r
-        this.updating = true;\r
+    \r
+    /**\r
+     * Get the selected node\r
+     * @return {TreeNode} The selected node\r
+     */\r
+    getSelectedNode : function(){\r
+        return this.selNode;    \r
     },\r
-\r
-    // private\r
-    endUpdate : function(){\r
-        this.updating = false;\r
-        this.sync(true);\r
+    \r
+    /**\r
+     * Returns true if the node is selected\r
+     * @param {TreeNode} node The node to check\r
+     * @return {Boolean}\r
+     */\r
+    isSelected : function(node){\r
+        return this.selNode == node;  \r
     },\r
 \r
-    // private\r
-    hideUnders : function(negOffset){\r
-        if(this.shadow){\r
-            this.shadow.hide();\r
+    /**\r
+     * Selects the node above the selected node in the tree, intelligently walking the nodes\r
+     * @return TreeNode The new selection\r
+     */\r
+    selectPrevious : function(){\r
+        var s = this.selNode || this.lastSelNode;\r
+        if(!s){\r
+            return null;\r
         }\r
-        this.hideShim();\r
-    },\r
-\r
-    // private\r
-    constrainXY : function(){\r
-        if(this.constrain){\r
-            var vw = Ext.lib.Dom.getViewWidth(),\r
-                vh = Ext.lib.Dom.getViewHeight();\r
-            var s = Ext.getDoc().getScroll();\r
-\r
-            var xy = this.getXY();\r
-            var x = xy[0], y = xy[1];\r
-            var w = this.dom.offsetWidth+this.shadowOffset, h = this.dom.offsetHeight+this.shadowOffset;\r
-            // only move it if it needs it\r
-            var moved = false;\r
-            // first validate right/bottom\r
-            if((x + w) > vw+s.left){\r
-                x = vw - w - this.shadowOffset;\r
-                moved = true;\r
-            }\r
-            if((y + h) > vh+s.top){\r
-                y = vh - h - this.shadowOffset;\r
-                moved = true;\r
-            }\r
-            // then make sure top/left isn't negative\r
-            if(x < s.left){\r
-                x = s.left;\r
-                moved = true;\r
-            }\r
-            if(y < s.top){\r
-                y = s.top;\r
-                moved = true;\r
-            }\r
-            if(moved){\r
-                if(this.avoidY){\r
-                    var ay = this.avoidY;\r
-                    if(y <= ay && (y+h) >= ay){\r
-                        y = ay-h-5;\r
-                    }\r
+        var ps = s.previousSibling;\r
+        if(ps){\r
+            if(!ps.isExpanded() || ps.childNodes.length < 1){\r
+                return this.select(ps);\r
+            } else{\r
+                var lc = ps.lastChild;\r
+                while(lc && lc.isExpanded() && lc.childNodes.length > 0){\r
+                    lc = lc.lastChild;\r
                 }\r
-                xy = [x, y];\r
-                this.storeXY(xy);\r
-                supr.setXY.call(this, xy);\r
-                this.sync();\r
+                return this.select(lc);\r
             }\r
+        } else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){\r
+            return this.select(s.parentNode);\r
         }\r
+        return null;\r
     },\r
 \r
-    isVisible : function(){\r
-        return this.visible;\r
+    /**\r
+     * Selects the node above the selected node in the tree, intelligently walking the nodes\r
+     * @return TreeNode The new selection\r
+     */\r
+    selectNext : function(){\r
+        var s = this.selNode || this.lastSelNode;\r
+        if(!s){\r
+            return null;\r
+        }\r
+        if(s.firstChild && s.isExpanded()){\r
+             return this.select(s.firstChild);\r
+         }else if(s.nextSibling){\r
+             return this.select(s.nextSibling);\r
+         }else if(s.parentNode){\r
+            var newS = null;\r
+            s.parentNode.bubble(function(){\r
+                if(this.nextSibling){\r
+                    newS = this.getOwnerTree().selModel.select(this.nextSibling);\r
+                    return false;\r
+                }\r
+            });\r
+            return newS;\r
+         }\r
+        return null;\r
     },\r
 \r
-    // private\r
-    showAction : function(){\r
-        this.visible = true; // track visibility to prevent getStyle calls\r
-        if(this.useDisplay === true){\r
-            this.setDisplayed("");\r
-        }else if(this.lastXY){\r
-            supr.setXY.call(this, this.lastXY);\r
-        }else if(this.lastLT){\r
-            supr.setLeftTop.call(this, this.lastLT[0], this.lastLT[1]);\r
+    onKeyDown : function(e){\r
+        var s = this.selNode || this.lastSelNode;\r
+        // undesirable, but required\r
+        var sm = this;\r
+        if(!s){\r
+            return;\r
         }\r
-    },\r
+        var k = e.getKey();\r
+        switch(k){\r
+             case e.DOWN:\r
+                 e.stopEvent();\r
+                 this.selectNext();\r
+             break;\r
+             case e.UP:\r
+                 e.stopEvent();\r
+                 this.selectPrevious();\r
+             break;\r
+             case e.RIGHT:\r
+                 e.preventDefault();\r
+                 if(s.hasChildNodes()){\r
+                     if(!s.isExpanded()){\r
+                         s.expand();\r
+                     }else if(s.firstChild){\r
+                         this.select(s.firstChild, e);\r
+                     }\r
+                 }\r
+             break;\r
+             case e.LEFT:\r
+                 e.preventDefault();\r
+                 if(s.hasChildNodes() && s.isExpanded()){\r
+                     s.collapse();\r
+                 }else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){\r
+                     this.select(s.parentNode, e);\r
+                 }\r
+             break;\r
+        };\r
+    }\r
+});\r
 \r
-    // private\r
-    hideAction : function(){\r
-        this.visible = false;\r
-        if(this.useDisplay === true){\r
-            this.setDisplayed(false);\r
+/**\r
+ * @class Ext.tree.MultiSelectionModel\r
+ * @extends Ext.util.Observable\r
+ * Multi selection for a TreePanel.\r
+ */\r
+Ext.tree.MultiSelectionModel = function(config){\r
+   this.selNodes = [];\r
+   this.selMap = {};\r
+   this.addEvents(\r
+       /**\r
+        * @event selectionchange\r
+        * Fires when the selected nodes change\r
+        * @param {MultiSelectionModel} this\r
+        * @param {Array} nodes Array of the selected nodes\r
+        */\r
+       "selectionchange"\r
+   );\r
+    Ext.apply(this, config);\r
+    Ext.tree.MultiSelectionModel.superclass.constructor.call(this);\r
+};\r
+\r
+Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {\r
+    init : function(tree){\r
+        this.tree = tree;\r
+        tree.getTreeEl().on("keydown", this.onKeyDown, this);\r
+        tree.on("click", this.onNodeClick, this);\r
+    },\r
+    \r
+    onNodeClick : function(node, e){\r
+        if(e.ctrlKey && this.isSelected(node)){\r
+            this.unselect(node);\r
         }else{\r
-            this.setLeftTop(-10000,-10000);\r
+            this.select(node, e, e.ctrlKey);\r
         }\r
     },\r
-\r
-    // overridden Element method\r
-    setVisible : function(v, a, d, c, e){\r
-        if(v){\r
-            this.showAction();\r
+    \r
+    /**\r
+     * Select a node.\r
+     * @param {TreeNode} node The node to select\r
+     * @param {EventObject} e (optional) An event associated with the selection\r
+     * @param {Boolean} keepExisting True to retain existing selections\r
+     * @return {TreeNode} The selected node\r
+     */\r
+    select : function(node, e, keepExisting){\r
+        if(keepExisting !== true){\r
+            this.clearSelections(true);\r
         }\r
-        if(a && v){\r
-            var cb = function(){\r
-                this.sync(true);\r
-                if(c){\r
-                    c();\r
-                }\r
-            }.createDelegate(this);\r
-            supr.setVisible.call(this, true, true, d, cb, e);\r
-        }else{\r
-            if(!v){\r
-                this.hideUnders(true);\r
-            }\r
-            var cb = c;\r
-            if(a){\r
-                cb = function(){\r
-                    this.hideAction();\r
-                    if(c){\r
-                        c();\r
-                    }\r
-                }.createDelegate(this);\r
-            }\r
-            supr.setVisible.call(this, v, a, d, cb, e);\r
-            if(v){\r
-                this.sync(true);\r
-            }else if(!a){\r
-                this.hideAction();\r
-            }\r
+        if(this.isSelected(node)){\r
+            this.lastSelNode = node;\r
+            return node;\r
         }\r
+        this.selNodes.push(node);\r
+        this.selMap[node.id] = node;\r
+        this.lastSelNode = node;\r
+        node.ui.onSelectedChange(true);\r
+        this.fireEvent("selectionchange", this, this.selNodes);\r
+        return node;\r
     },\r
-\r
-    storeXY : function(xy){\r
-        delete this.lastLT;\r
-        this.lastXY = xy;\r
+    \r
+    /**\r
+     * Deselect a node.\r
+     * @param {TreeNode} node The node to unselect\r
+     */\r
+    unselect : function(node){\r
+        if(this.selMap[node.id]){\r
+            node.ui.onSelectedChange(false);\r
+            var sn = this.selNodes;\r
+            var index = sn.indexOf(node);\r
+            if(index != -1){\r
+                this.selNodes.splice(index, 1);\r
+            }\r
+            delete this.selMap[node.id];\r
+            this.fireEvent("selectionchange", this, this.selNodes);\r
+        }\r
     },\r
-\r
-    storeLeftTop : function(left, top){\r
-        delete this.lastXY;\r
-        this.lastLT = [left, top];\r
+    \r
+    /**\r
+     * Clear all selections\r
+     */\r
+    clearSelections : function(suppressEvent){\r
+        var sn = this.selNodes;\r
+        if(sn.length > 0){\r
+            for(var i = 0, len = sn.length; i < len; i++){\r
+                sn[i].ui.onSelectedChange(false);\r
+            }\r
+            this.selNodes = [];\r
+            this.selMap = {};\r
+            if(suppressEvent !== true){\r
+                this.fireEvent("selectionchange", this, this.selNodes);\r
+            }\r
+        }\r
     },\r
-\r
-    // private\r
-    beforeFx : function(){\r
-        this.beforeAction();\r
-        return Ext.Layer.superclass.beforeFx.apply(this, arguments);\r
+    \r
+    /**\r
+     * Returns true if the node is selected\r
+     * @param {TreeNode} node The node to check\r
+     * @return {Boolean}\r
+     */\r
+    isSelected : function(node){\r
+        return this.selMap[node.id] ? true : false;  \r
     },\r
-\r
-    // private\r
-    afterFx : function(){\r
-        Ext.Layer.superclass.afterFx.apply(this, arguments);\r
-        this.sync(this.isVisible());\r
+    \r
+    /**\r
+     * Returns an array of the selected nodes\r
+     * @return {Array}\r
+     */\r
+    getSelectedNodes : function(){\r
+        return this.selNodes;    \r
     },\r
 \r
-    // private\r
-    beforeAction : function(){\r
-        if(!this.updating && this.shadow){\r
-            this.shadow.hide();\r
-        }\r
-    },\r
+    onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,\r
 \r
-    // overridden Element method\r
-    setLeft : function(left){\r
-        this.storeLeftTop(left, this.getTop(true));\r
-        supr.setLeft.apply(this, arguments);\r
-        this.sync();\r
-    },\r
+    selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,\r
 \r
-    setTop : function(top){\r
-        this.storeLeftTop(this.getLeft(true), top);\r
-        supr.setTop.apply(this, arguments);\r
-        this.sync();\r
-    },\r
+    selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious\r
+});/**\r
+ * @class Ext.data.Tree\r
+ * @extends Ext.util.Observable\r
+ * Represents a tree data structure and bubbles all the events for its nodes. The nodes\r
+ * in the tree have most standard DOM functionality.\r
+ * @constructor\r
+ * @param {Node} root (optional) The root node\r
+ */\r
+Ext.data.Tree = function(root){\r
+   this.nodeHash = {};\r
+   /**\r
+    * The root node for this tree\r
+    * @type Node\r
+    */\r
+   this.root = null;\r
+   if(root){\r
+       this.setRootNode(root);\r
+   }\r
+   this.addEvents(\r
+       /**\r
+        * @event append\r
+        * Fires when a new child node is appended to a node in this tree.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} parent The parent node\r
+        * @param {Node} node The newly appended node\r
+        * @param {Number} index The index of the newly appended node\r
+        */\r
+       "append",\r
+       /**\r
+        * @event remove\r
+        * Fires when a child node is removed from a node in this tree.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} parent The parent node\r
+        * @param {Node} node The child node removed\r
+        */\r
+       "remove",\r
+       /**\r
+        * @event move\r
+        * Fires when a node is moved to a new location in the tree\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} node The node moved\r
+        * @param {Node} oldParent The old parent of this node\r
+        * @param {Node} newParent The new parent of this node\r
+        * @param {Number} index The index it was moved to\r
+        */\r
+       "move",\r
+       /**\r
+        * @event insert\r
+        * Fires when a new child node is inserted in a node in this tree.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} parent The parent node\r
+        * @param {Node} node The child node inserted\r
+        * @param {Node} refNode The child node the node was inserted before\r
+        */\r
+       "insert",\r
+       /**\r
+        * @event beforeappend\r
+        * Fires before a new child is appended to a node in this tree, return false to cancel the append.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} parent The parent node\r
+        * @param {Node} node The child node to be appended\r
+        */\r
+       "beforeappend",\r
+       /**\r
+        * @event beforeremove\r
+        * Fires before a child is removed from a node in this tree, return false to cancel the remove.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} parent The parent node\r
+        * @param {Node} node The child node to be removed\r
+        */\r
+       "beforeremove",\r
+       /**\r
+        * @event beforemove\r
+        * Fires before a node is moved to a new location in the tree. Return false to cancel the move.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} node The node being moved\r
+        * @param {Node} oldParent The parent of the node\r
+        * @param {Node} newParent The new parent the node is moving to\r
+        * @param {Number} index The index it is being moved to\r
+        */\r
+       "beforemove",\r
+       /**\r
+        * @event beforeinsert\r
+        * Fires before a new child is inserted in a node in this tree, return false to cancel the insert.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} parent The parent node\r
+        * @param {Node} node The child node to be inserted\r
+        * @param {Node} refNode The child node the node is being inserted before\r
+        */\r
+       "beforeinsert"\r
+   );\r
 \r
-    setLeftTop : function(left, top){\r
-        this.storeLeftTop(left, top);\r
-        supr.setLeftTop.apply(this, arguments);\r
-        this.sync();\r
-    },\r
+    Ext.data.Tree.superclass.constructor.call(this);\r
+};\r
 \r
-    setXY : function(xy, a, d, c, e){\r
-        this.fixDisplay();\r
-        this.beforeAction();\r
-        this.storeXY(xy);\r
-        var cb = this.createCB(c);\r
-        supr.setXY.call(this, xy, a, d, cb, e);\r
-        if(!a){\r
-            cb();\r
-        }\r
-    },\r
+Ext.extend(Ext.data.Tree, Ext.util.Observable, {\r
+    /**\r
+     * @cfg {String} pathSeparator\r
+     * The token used to separate paths in node ids (defaults to '/').\r
+     */\r
+    pathSeparator: "/",\r
 \r
     // private\r
-    createCB : function(c){\r
-        var el = this;\r
-        return function(){\r
-            el.constrainXY();\r
-            el.sync(true);\r
-            if(c){\r
-                c();\r
-            }\r
-        };\r
-    },\r
-\r
-    // overridden Element method\r
-    setX : function(x, a, d, c, e){\r
-        this.setXY([x, this.getY()], a, d, c, e);\r
+    proxyNodeEvent : function(){\r
+        return this.fireEvent.apply(this, arguments);\r
     },\r
 \r
-    // overridden Element method\r
-    setY : function(y, a, d, c, e){\r
-        this.setXY([this.getX(), y], a, d, c, e);\r
+    /**\r
+     * Returns the root node for this tree.\r
+     * @return {Node}\r
+     */\r
+    getRootNode : function(){\r
+        return this.root;\r
     },\r
 \r
-    // overridden Element method\r
-    setSize : function(w, h, a, d, c, e){\r
-        this.beforeAction();\r
-        var cb = this.createCB(c);\r
-        supr.setSize.call(this, w, h, a, d, cb, e);\r
-        if(!a){\r
-            cb();\r
-        }\r
+    /**\r
+     * Sets the root node for this tree.\r
+     * @param {Node} node\r
+     * @return {Node}\r
+     */\r
+    setRootNode : function(node){\r
+        this.root = node;\r
+        node.ownerTree = this;\r
+        node.isRoot = true;\r
+        this.registerNode(node);\r
+        return node;\r
     },\r
 \r
-    // overridden Element method\r
-    setWidth : function(w, a, d, c, e){\r
-        this.beforeAction();\r
-        var cb = this.createCB(c);\r
-        supr.setWidth.call(this, w, a, d, cb, e);\r
-        if(!a){\r
-            cb();\r
-        }\r
+    /**\r
+     * Gets a node in this tree by its id.\r
+     * @param {String} id\r
+     * @return {Node}\r
+     */\r
+    getNodeById : function(id){\r
+        return this.nodeHash[id];\r
     },\r
 \r
-    // overridden Element method\r
-    setHeight : function(h, a, d, c, e){\r
-        this.beforeAction();\r
-        var cb = this.createCB(c);\r
-        supr.setHeight.call(this, h, a, d, cb, e);\r
-        if(!a){\r
-            cb();\r
-        }\r
+    // private\r
+    registerNode : function(node){\r
+        this.nodeHash[node.id] = node;\r
     },\r
 \r
-    // overridden Element method\r
-    setBounds : function(x, y, w, h, a, d, c, e){\r
-        this.beforeAction();\r
-        var cb = this.createCB(c);\r
-        if(!a){\r
-            this.storeXY([x, y]);\r
-            supr.setXY.call(this, [x, y]);\r
-            supr.setSize.call(this, w, h, a, d, cb, e);\r
-            cb();\r
-        }else{\r
-            supr.setBounds.call(this, x, y, w, h, a, d, cb, e);\r
-        }\r
-        return this;\r
+    // private\r
+    unregisterNode : function(node){\r
+        delete this.nodeHash[node.id];\r
     },\r
 \r
-    \r
-    setZIndex : function(zindex){\r
-        this.zindex = zindex;\r
-        this.setStyle("z-index", zindex + 2);\r
-        if(this.shadow){\r
-            this.shadow.setZIndex(zindex + 1);\r
-        }\r
-        if(this.shim){\r
-            this.shim.setStyle("z-index", zindex);\r
-        }\r
+    toString : function(){\r
+        return "[Tree"+(this.id?" "+this.id:"")+"]";\r
     }\r
 });\r
-})();\r
 \r
-Ext.Shadow = function(config){\r
-    Ext.apply(this, config);\r
-    if(typeof this.mode != "string"){\r
-        this.mode = this.defaultMode;\r
+/**\r
+ * @class Ext.data.Node\r
+ * @extends Ext.util.Observable\r
+ * @cfg {Boolean} leaf true if this node is a leaf and does not have children\r
+ * @cfg {String} id The id for this node. If one is not specified, one is generated.\r
+ * @constructor\r
+ * @param {Object} attributes The attributes/config for the node\r
+ */\r
+Ext.data.Node = function(attributes){\r
+    /**\r
+     * The attributes supplied for the node. You can use this property to access any custom attributes you supplied.\r
+     * @type {Object}\r
+     */\r
+    this.attributes = attributes || {};\r
+    this.leaf = this.attributes.leaf;\r
+    /**\r
+     * The node id. @type String\r
+     */\r
+    this.id = this.attributes.id;\r
+    if(!this.id){\r
+        this.id = Ext.id(null, "xnode-");\r
+        this.attributes.id = this.id;\r
     }\r
-    var o = this.offset, a = {h: 0};\r
-    var rad = Math.floor(this.offset/2);\r
-    switch(this.mode.toLowerCase()){ // all this hideous nonsense calculates the various offsets for shadows\r
-        case "drop":\r
-            a.w = 0;\r
-            a.l = a.t = o;\r
-            a.t -= 1;\r
-            if(Ext.isIE){\r
-                a.l -= this.offset + rad;\r
-                a.t -= this.offset + rad;\r
-                a.w -= rad;\r
-                a.h -= rad;\r
-                a.t += 1;\r
-            }\r
-        break;\r
-        case "sides":\r
-            a.w = (o*2);\r
-            a.l = -o;\r
-            a.t = o-1;\r
-            if(Ext.isIE){\r
-                a.l -= (this.offset - rad);\r
-                a.t -= this.offset + rad;\r
-                a.l += 1;\r
-                a.w -= (this.offset - rad)*2;\r
-                a.w -= rad + 1;\r
-                a.h -= 1;\r
-            }\r
-        break;\r
-        case "frame":\r
-            a.w = a.h = (o*2);\r
-            a.l = a.t = -o;\r
-            a.t += 1;\r
-            a.h -= 2;\r
-            if(Ext.isIE){\r
-                a.l -= (this.offset - rad);\r
-                a.t -= (this.offset - rad);\r
-                a.l += 1;\r
-                a.w -= (this.offset + rad + 1);\r
-                a.h -= (this.offset + rad);\r
-                a.h += 1;\r
-            }\r
-        break;\r
-    };\r
+    /**\r
+     * All child nodes of this node. @type Array\r
+     */\r
+    this.childNodes = [];\r
+    if(!this.childNodes.indexOf){ // indexOf is a must\r
+        this.childNodes.indexOf = function(o){\r
+            for(var i = 0, len = this.length; i < len; i++){\r
+                if(this[i] == o){\r
+                    return i;\r
+                }\r
+            }\r
+            return -1;\r
+        };\r
+    }\r
+    /**\r
+     * The parent node for this node. @type Node\r
+     */\r
+    this.parentNode = null;\r
+    /**\r
+     * The first direct child node of this node, or null if this node has no child nodes. @type Node\r
+     */\r
+    this.firstChild = null;\r
+    /**\r
+     * The last direct child node of this node, or null if this node has no child nodes. @type Node\r
+     */\r
+    this.lastChild = null;\r
+    /**\r
+     * The node immediately preceding this node in the tree, or null if there is no sibling node. @type Node\r
+     */\r
+    this.previousSibling = null;\r
+    /**\r
+     * The node immediately following this node in the tree, or null if there is no sibling node. @type Node\r
+     */\r
+    this.nextSibling = null;\r
 \r
-    this.adjusts = a;\r
+    this.addEvents({\r
+       /**\r
+        * @event append\r
+        * Fires when a new child node is appended\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} node The newly appended node\r
+        * @param {Number} index The index of the newly appended node\r
+        */\r
+       "append" : true,\r
+       /**\r
+        * @event remove\r
+        * Fires when a child node is removed\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} node The removed node\r
+        */\r
+       "remove" : true,\r
+       /**\r
+        * @event move\r
+        * Fires when this node is moved to a new location in the tree\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} oldParent The old parent of this node\r
+        * @param {Node} newParent The new parent of this node\r
+        * @param {Number} index The index it was moved to\r
+        */\r
+       "move" : true,\r
+       /**\r
+        * @event insert\r
+        * Fires when a new child node is inserted.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} node The child node inserted\r
+        * @param {Node} refNode The child node the node was inserted before\r
+        */\r
+       "insert" : true,\r
+       /**\r
+        * @event beforeappend\r
+        * Fires before a new child is appended, return false to cancel the append.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} node The child node to be appended\r
+        */\r
+       "beforeappend" : true,\r
+       /**\r
+        * @event beforeremove\r
+        * Fires before a child is removed, return false to cancel the remove.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} node The child node to be removed\r
+        */\r
+       "beforeremove" : true,\r
+       /**\r
+        * @event beforemove\r
+        * Fires before this node is moved to a new location in the tree. Return false to cancel the move.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} oldParent The parent of this node\r
+        * @param {Node} newParent The new parent this node is moving to\r
+        * @param {Number} index The index it is being moved to\r
+        */\r
+       "beforemove" : true,\r
+       /**\r
+        * @event beforeinsert\r
+        * Fires before a new child is inserted, return false to cancel the insert.\r
+        * @param {Tree} tree The owner tree\r
+        * @param {Node} this This node\r
+        * @param {Node} node The child node to be inserted\r
+        * @param {Node} refNode The child node the node is being inserted before\r
+        */\r
+       "beforeinsert" : true\r
+   });\r
+    this.listeners = this.attributes.listeners;\r
+    Ext.data.Node.superclass.constructor.call(this);\r
 };\r
 \r
-Ext.Shadow.prototype = {\r
-    \r
-    \r
-    offset: 4,\r
-\r
+Ext.extend(Ext.data.Node, Ext.util.Observable, {\r
     // private\r
-    defaultMode: "drop",\r
-\r
-    \r
-    show : function(target){\r
-        target = Ext.get(target);\r
-        if(!this.el){\r
-            this.el = Ext.Shadow.Pool.pull();\r
-            if(this.el.dom.nextSibling != target.dom){\r
-                this.el.insertBefore(target);\r
-            }\r
-        }\r
-        this.el.setStyle("z-index", this.zIndex || parseInt(target.getStyle("z-index"), 10)-1);\r
-        if(Ext.isIE){\r
-            this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")";\r
-        }\r
-        this.realign(\r
-            target.getLeft(true),\r
-            target.getTop(true),\r
-            target.getWidth(),\r
-            target.getHeight()\r
-        );\r
-        this.el.dom.style.display = "block";\r
-    },\r
-\r
-    \r
-    isVisible : function(){\r
-        return this.el ? true : false;  \r
-    },\r
-\r
-    \r
-    realign : function(l, t, w, h){\r
-        if(!this.el){\r
-            return;\r
+    fireEvent : function(evtName){\r
+        // first do standard event for this node\r
+        if(Ext.data.Node.superclass.fireEvent.apply(this, arguments) === false){\r
+            return false;\r
         }\r
-        var a = this.adjusts, d = this.el.dom, s = d.style;\r
-        var iea = 0;\r
-        s.left = (l+a.l)+"px";\r
-        s.top = (t+a.t)+"px";\r
-        var sw = (w+a.w), sh = (h+a.h), sws = sw +"px", shs = sh + "px";\r
-        if(s.width != sws || s.height != shs){\r
-            s.width = sws;\r
-            s.height = shs;\r
-            if(!Ext.isIE){\r
-                var cn = d.childNodes;\r
-                var sww = Math.max(0, (sw-12))+"px";\r
-                cn[0].childNodes[1].style.width = sww;\r
-                cn[1].childNodes[1].style.width = sww;\r
-                cn[2].childNodes[1].style.width = sww;\r
-                cn[1].style.height = Math.max(0, (sh-12))+"px";\r
+        // then bubble it up to the tree if the event wasn't cancelled\r
+        var ot = this.getOwnerTree();\r
+        if(ot){\r
+            if(ot.proxyNodeEvent.apply(ot, arguments) === false){\r
+                return false;\r
             }\r
         }\r
+        return true;\r
     },\r
 \r
-    \r
-    hide : function(){\r
-        if(this.el){\r
-            this.el.dom.style.display = "none";\r
-            Ext.Shadow.Pool.push(this.el);\r
-            delete this.el;\r
-        }\r
+    /**\r
+     * Returns true if this node is a leaf\r
+     * @return {Boolean}\r
+     */\r
+    isLeaf : function(){\r
+        return this.leaf === true;\r
     },\r
 \r
-    \r
-    setZIndex : function(z){\r
-        this.zIndex = z;\r
-        if(this.el){\r
-            this.el.setStyle("z-index", z);\r
-        }\r
-    }\r
-};\r
-\r
-// Private utility class that manages the internal Shadow cache\r
-Ext.Shadow.Pool = function(){\r
-    var p = [];\r
-    var markup = Ext.isIE ?\r
-                 '<div class="x-ie-shadow"></div>' :\r
-                 '<div class="x-shadow"><div class="xst"><div class="xstl"></div><div class="xstc"></div><div class="xstr"></div></div><div class="xsc"><div class="xsml"></div><div class="xsmc"></div><div class="xsmr"></div></div><div class="xsb"><div class="xsbl"></div><div class="xsbc"></div><div class="xsbr"></div></div></div>';\r
-    return {\r
-        pull : function(){\r
-            var sh = p.shift();\r
-            if(!sh){\r
-                sh = Ext.get(Ext.DomHelper.insertHtml("beforeBegin", document.body.firstChild, markup));\r
-                sh.autoBoxAdjust = false;\r
-            }\r
-            return sh;\r
-        },\r
-\r
-        push : function(sh){\r
-            p.push(sh);\r
-        }\r
-    };\r
-}();\r
-\r
-Ext.BoxComponent = Ext.extend(Ext.Component, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    \r
-\r
-       // private\r
-    initComponent : function(){\r
-        Ext.BoxComponent.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            'resize',\r
-            \r
-            'move'\r
-        );\r
+    // private\r
+    setFirstChild : function(node){\r
+        this.firstChild = node;\r
     },\r
 \r
-    // private, set in afterRender to signify that the component has been rendered\r
-    boxReady : false,\r
-    // private, used to defer height settings to subclasses\r
-    deferHeight: false,\r
+    //private\r
+    setLastChild : function(node){\r
+        this.lastChild = node;\r
+    },\r
 \r
-    \r
-    setSize : function(w, h){\r
-        // support for standard size objects\r
-        if(typeof w == 'object'){\r
-            h = w.height;\r
-            w = w.width;\r
-        }\r
-        // not rendered\r
-        if(!this.boxReady){\r
-            this.width = w;\r
-            this.height = h;\r
-            return this;\r
-        }\r
 \r
-        // prevent recalcs when not needed\r
-        if(this.lastSize && this.lastSize.width == w && this.lastSize.height == h){\r
-            return this;\r
-        }\r
-        this.lastSize = {width: w, height: h};\r
-        var adj = this.adjustSize(w, h);\r
-        var aw = adj.width, ah = adj.height;\r
-        if(aw !== undefined || ah !== undefined){ // this code is nasty but performs better with floaters\r
-            var rz = this.getResizeEl();\r
-            if(!this.deferHeight && aw !== undefined && ah !== undefined){\r
-                rz.setSize(aw, ah);\r
-            }else if(!this.deferHeight && ah !== undefined){\r
-                rz.setHeight(ah);\r
-            }else if(aw !== undefined){\r
-                rz.setWidth(aw);\r
-            }\r
-            this.onResize(aw, ah, w, h);\r
-            this.fireEvent('resize', this, aw, ah, w, h);\r
-        }\r
-        return this;\r
+    /**\r
+     * Returns true if this node is the last child of its parent\r
+     * @return {Boolean}\r
+     */\r
+    isLast : function(){\r
+       return (!this.parentNode ? true : this.parentNode.lastChild == this);\r
     },\r
 \r
-    \r
-    setWidth : function(width){\r
-        return this.setSize(width);\r
+    /**\r
+     * Returns true if this node is the first child of its parent\r
+     * @return {Boolean}\r
+     */\r
+    isFirst : function(){\r
+       return (!this.parentNode ? true : this.parentNode.firstChild == this);\r
     },\r
 \r
-    \r
-    setHeight : function(height){\r
-        return this.setSize(undefined, height);\r
+    /**\r
+     * Returns true if this node has one or more child nodes, else false.\r
+     * @return {Boolean}\r
+     */\r
+    hasChildNodes : function(){\r
+        return !this.isLeaf() && this.childNodes.length > 0;\r
     },\r
-\r
     \r
-    getSize : function(){\r
-        return this.el.getSize();\r
+    /**\r
+     * Returns true if this node has one or more child nodes, or if the <tt>expandable</tt>\r
+     * node attribute is explicitly specified as true (see {@link #attributes}), otherwise returns false.\r
+     * @return {Boolean}\r
+     */\r
+    isExpandable : function(){\r
+        return this.attributes.expandable || this.hasChildNodes();\r
     },\r
 \r
-    \r
-    getPosition : function(local){\r
-        if(local === true){\r
-            return [this.el.getLeft(true), this.el.getTop(true)];\r
-        }\r
-        return this.xy || this.el.getXY();\r
+    /**\r
+     * Insert node(s) as the last child node of this node.\r
+     * @param {Node/Array} node The node or Array of nodes to append\r
+     * @return {Node} The appended node if single append, or null if an array was passed\r
+     */\r
+    appendChild : function(node){\r
+        var multi = false;\r
+        if(Ext.isArray(node)){\r
+            multi = node;\r
+        }else if(arguments.length > 1){\r
+            multi = arguments;\r
+        }\r
+        // if passed an array or multiple args do them one by one\r
+        if(multi){\r
+            for(var i = 0, len = multi.length; i < len; i++) {\r
+               this.appendChild(multi[i]);\r
+            }\r
+        }else{\r
+            if(this.fireEvent("beforeappend", this.ownerTree, this, node) === false){\r
+                return false;\r
+            }\r
+            var index = this.childNodes.length;\r
+            var oldParent = node.parentNode;\r
+            // it's a move, make sure we move it cleanly\r
+            if(oldParent){\r
+                if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index) === false){\r
+                    return false;\r
+                }\r
+                oldParent.removeChild(node);\r
+            }\r
+            index = this.childNodes.length;\r
+            if(index === 0){\r
+                this.setFirstChild(node);\r
+            }\r
+            this.childNodes.push(node);\r
+            node.parentNode = this;\r
+            var ps = this.childNodes[index-1];\r
+            if(ps){\r
+                node.previousSibling = ps;\r
+                ps.nextSibling = node;\r
+            }else{\r
+                node.previousSibling = null;\r
+            }\r
+            node.nextSibling = null;\r
+            this.setLastChild(node);\r
+            node.setOwnerTree(this.getOwnerTree());\r
+            this.fireEvent("append", this.ownerTree, this, node, index);\r
+            if(oldParent){\r
+                node.fireEvent("move", this.ownerTree, node, oldParent, this, index);\r
+            }\r
+            return node;\r
+        }\r
     },\r
 \r
-    \r
-    getBox : function(local){\r
-        var s = this.el.getSize();\r
-        if(local === true){\r
-            s.x = this.el.getLeft(true);\r
-            s.y = this.el.getTop(true);\r
+    /**\r
+     * Removes a child node from this node.\r
+     * @param {Node} node The node to remove\r
+     * @return {Node} The removed node\r
+     */\r
+    removeChild : function(node){\r
+        var index = this.childNodes.indexOf(node);\r
+        if(index == -1){\r
+            return false;\r
+        }\r
+        if(this.fireEvent("beforeremove", this.ownerTree, this, node) === false){\r
+            return false;\r
+        }\r
+\r
+        // remove it from childNodes collection\r
+        this.childNodes.splice(index, 1);\r
+\r
+        // update siblings\r
+        if(node.previousSibling){\r
+            node.previousSibling.nextSibling = node.nextSibling;\r
+        }\r
+        if(node.nextSibling){\r
+            node.nextSibling.previousSibling = node.previousSibling;\r
+        }\r
+\r
+        // update child refs\r
+        if(this.firstChild == node){\r
+            this.setFirstChild(node.nextSibling);\r
+        }\r
+        if(this.lastChild == node){\r
+            this.setLastChild(node.previousSibling);\r
+        }\r
+\r
+        node.setOwnerTree(null);\r
+        // clear any references from the node\r
+        node.parentNode = null;\r
+        node.previousSibling = null;\r
+        node.nextSibling = null;\r
+        this.fireEvent("remove", this.ownerTree, this, node);\r
+        return node;\r
+    },\r
+\r
+    /**\r
+     * Inserts the first node before the second node in this nodes childNodes collection.\r
+     * @param {Node} node The node to insert\r
+     * @param {Node} refNode The node to insert before (if null the node is appended)\r
+     * @return {Node} The inserted node\r
+     */\r
+    insertBefore : function(node, refNode){\r
+        if(!refNode){ // like standard Dom, refNode can be null for append\r
+            return this.appendChild(node);\r
+        }\r
+        // nothing to do\r
+        if(node == refNode){\r
+            return false;\r
+        }\r
+\r
+        if(this.fireEvent("beforeinsert", this.ownerTree, this, node, refNode) === false){\r
+            return false;\r
+        }\r
+        var index = this.childNodes.indexOf(refNode);\r
+        var oldParent = node.parentNode;\r
+        var refIndex = index;\r
+\r
+        // when moving internally, indexes will change after remove\r
+        if(oldParent == this && this.childNodes.indexOf(node) < index){\r
+            refIndex--;\r
+        }\r
+\r
+        // it's a move, make sure we move it cleanly\r
+        if(oldParent){\r
+            if(node.fireEvent("beforemove", node.getOwnerTree(), node, oldParent, this, index, refNode) === false){\r
+                return false;\r
+            }\r
+            oldParent.removeChild(node);\r
+        }\r
+        if(refIndex === 0){\r
+            this.setFirstChild(node);\r
+        }\r
+        this.childNodes.splice(refIndex, 0, node);\r
+        node.parentNode = this;\r
+        var ps = this.childNodes[refIndex-1];\r
+        if(ps){\r
+            node.previousSibling = ps;\r
+            ps.nextSibling = node;\r
         }else{\r
-            var xy = this.xy || this.el.getXY();\r
-            s.x = xy[0];\r
-            s.y = xy[1];\r
+            node.previousSibling = null;\r
         }\r
-        return s;\r
+        node.nextSibling = refNode;\r
+        refNode.previousSibling = node;\r
+        node.setOwnerTree(this.getOwnerTree());\r
+        this.fireEvent("insert", this.ownerTree, this, node, refNode);\r
+        if(oldParent){\r
+            node.fireEvent("move", this.ownerTree, node, oldParent, this, refIndex, refNode);\r
+        }\r
+        return node;\r
     },\r
 \r
-    \r
-    updateBox : function(box){\r
-        this.setSize(box.width, box.height);\r
-        this.setPagePosition(box.x, box.y);\r
+    /**\r
+     * Removes this node from its parent\r
+     * @return {Node} this\r
+     */\r
+    remove : function(){\r
+        this.parentNode.removeChild(this);\r
         return this;\r
     },\r
 \r
-    // protected\r
-    getResizeEl : function(){\r
-        return this.resizeEl || this.el;\r
+    /**\r
+     * Returns the child node at the specified index.\r
+     * @param {Number} index\r
+     * @return {Node}\r
+     */\r
+    item : function(index){\r
+        return this.childNodes[index];\r
     },\r
 \r
-    // protected\r
-    getPositionEl : function(){\r
-        return this.positionEl || this.el;\r
+    /**\r
+     * Replaces one child node in this node with another.\r
+     * @param {Node} newChild The replacement node\r
+     * @param {Node} oldChild The node to replace\r
+     * @return {Node} The replaced node\r
+     */\r
+    replaceChild : function(newChild, oldChild){\r
+        var s = oldChild ? oldChild.nextSibling : null;\r
+        this.removeChild(oldChild);\r
+        this.insertBefore(newChild, s);\r
+        return oldChild;\r
     },\r
 \r
-    \r
-    setPosition : function(x, y){\r
-        if(x && typeof x[1] == 'number'){\r
-            y = x[1];\r
-            x = x[0];\r
-        }\r
-        this.x = x;\r
-        this.y = y;\r
-        if(!this.boxReady){\r
-            return this;\r
-        }\r
-        var adj = this.adjustPosition(x, y);\r
-        var ax = adj.x, ay = adj.y;\r
+    /**\r
+     * Returns the index of a child node\r
+     * @param {Node} node\r
+     * @return {Number} The index of the node or -1 if it was not found\r
+     */\r
+    indexOf : function(child){\r
+        return this.childNodes.indexOf(child);\r
+    },\r
 \r
-        var el = this.getPositionEl();\r
-        if(ax !== undefined || ay !== undefined){\r
-            if(ax !== undefined && ay !== undefined){\r
-                el.setLeftTop(ax, ay);\r
-            }else if(ax !== undefined){\r
-                el.setLeft(ax);\r
-            }else if(ay !== undefined){\r
-                el.setTop(ay);\r
+    /**\r
+     * Returns the tree this node is in.\r
+     * @return {Tree}\r
+     */\r
+    getOwnerTree : function(){\r
+        // if it doesn't have one, look for one\r
+        if(!this.ownerTree){\r
+            var p = this;\r
+            while(p){\r
+                if(p.ownerTree){\r
+                    this.ownerTree = p.ownerTree;\r
+                    break;\r
+                }\r
+                p = p.parentNode;\r
             }\r
-            this.onPosition(ax, ay);\r
-            this.fireEvent('move', this, ax, ay);\r
         }\r
-        return this;\r
+        return this.ownerTree;\r
     },\r
 \r
-    \r
-    setPagePosition : function(x, y){\r
-        if(x && typeof x[1] == 'number'){\r
-            y = x[1];\r
-            x = x[0];\r
-        }\r
-        this.pageX = x;\r
-        this.pageY = y;\r
-        if(!this.boxReady){\r
-            return;\r
-        }\r
-        if(x === undefined || y === undefined){ // cannot translate undefined points\r
-            return;\r
+    /**\r
+     * Returns depth of this node (the root node has a depth of 0)\r
+     * @return {Number}\r
+     */\r
+    getDepth : function(){\r
+        var depth = 0;\r
+        var p = this;\r
+        while(p.parentNode){\r
+            ++depth;\r
+            p = p.parentNode;\r
         }\r
-        var p = this.el.translatePoints(x, y);\r
-        this.setPosition(p.left, p.top);\r
-        return this;\r
+        return depth;\r
     },\r
 \r
     // private\r
-    onRender : function(ct, position){\r
-        Ext.BoxComponent.superclass.onRender.call(this, ct, position);\r
-        if(this.resizeEl){\r
-            this.resizeEl = Ext.get(this.resizeEl);\r
+    setOwnerTree : function(tree){\r
+        // if it is a move, we need to update everyone\r
+        if(tree != this.ownerTree){\r
+            if(this.ownerTree){\r
+                this.ownerTree.unregisterNode(this);\r
+            }\r
+            this.ownerTree = tree;\r
+            var cs = this.childNodes;\r
+            for(var i = 0, len = cs.length; i < len; i++) {\r
+               cs[i].setOwnerTree(tree);\r
+            }\r
+            if(tree){\r
+                tree.registerNode(this);\r
+            }\r
         }\r
-        if(this.positionEl){\r
-            this.positionEl = Ext.get(this.positionEl);\r
+    },\r
+    \r
+    /**\r
+     * Changes the id of this node.\r
+     * @param {String} id The new id for the node.\r
+     */\r
+    setId: function(id){\r
+        if(id !== this.id){\r
+            var t = this.ownerTree;\r
+            if(t){\r
+                t.unregisterNode(this);\r
+            }\r
+            this.id = id;\r
+            if(t){\r
+                t.registerNode(this);\r
+            }\r
+            this.onIdChange(id);\r
         }\r
     },\r
-\r
+    \r
     // private\r
-    afterRender : function(){\r
-        Ext.BoxComponent.superclass.afterRender.call(this);\r
-        this.boxReady = true;\r
-        this.setSize(this.width, this.height);\r
-        if(this.x || this.y){\r
-            this.setPosition(this.x, this.y);\r
-        }else if(this.pageX || this.pageY){\r
-            this.setPagePosition(this.pageX, this.pageY);\r
+    onIdChange: Ext.emptyFn,\r
+\r
+    /**\r
+     * Returns the path for this node. The path can be used to expand or select this node programmatically.\r
+     * @param {String} attr (optional) The attr to use for the path (defaults to the node's id)\r
+     * @return {String} The path\r
+     */\r
+    getPath : function(attr){\r
+        attr = attr || "id";\r
+        var p = this.parentNode;\r
+        var b = [this.attributes[attr]];\r
+        while(p){\r
+            b.unshift(p.attributes[attr]);\r
+            p = p.parentNode;\r
         }\r
+        var sep = this.getOwnerTree().pathSeparator;\r
+        return sep + b.join(sep);\r
     },\r
 \r
-    \r
-    syncSize : function(){\r
-        delete this.lastSize;\r
-        this.setSize(this.autoWidth ? undefined : this.el.getWidth(), this.autoHeight ? undefined : this.el.getHeight());\r
-        return this;\r
+    /**\r
+     * Bubbles up the tree from this node, calling the specified function with each node. The scope (<i>this</i>) of\r
+     * function call will be the scope provided or the current node. The arguments to the function\r
+     * will be the args provided or the current node. If the function returns false at any point,\r
+     * the bubble is stopped.\r
+     * @param {Function} fn The function to call\r
+     * @param {Object} scope (optional) The scope of the function (defaults to current node)\r
+     * @param {Array} args (optional) The args to call the function with (default to passing the current node)\r
+     */\r
+    bubble : function(fn, scope, args){\r
+        var p = this;\r
+        while(p){\r
+            if(fn.apply(scope || p, args || [p]) === false){\r
+                break;\r
+            }\r
+            p = p.parentNode;\r
+        }\r
     },\r
 \r
-    \r
-    onResize : function(adjWidth, adjHeight, rawWidth, rawHeight){\r
-\r
+    /**\r
+     * Cascades down the tree from this node, calling the specified function with each node. The scope (<i>this</i>) of\r
+     * function call will be the scope provided or the current node. The arguments to the function\r
+     * will be the args provided or the current node. If the function returns false at any point,\r
+     * the cascade is stopped on that branch.\r
+     * @param {Function} fn The function to call\r
+     * @param {Object} scope (optional) The scope of the function (defaults to current node)\r
+     * @param {Array} args (optional) The args to call the function with (default to passing the current node)\r
+     */\r
+    cascade : function(fn, scope, args){\r
+        if(fn.apply(scope || this, args || [this]) !== false){\r
+            var cs = this.childNodes;\r
+            for(var i = 0, len = cs.length; i < len; i++) {\r
+               cs[i].cascade(fn, scope, args);\r
+            }\r
+        }\r
     },\r
 \r
-    \r
-    onPosition : function(x, y){\r
-\r
+    /**\r
+     * Interates the child nodes of this node, calling the specified function with each node. The scope (<i>this</i>) of\r
+     * function call will be the scope provided or the current node. The arguments to the function\r
+     * will be the args provided or the current node. If the function returns false at any point,\r
+     * the iteration stops.\r
+     * @param {Function} fn The function to call\r
+     * @param {Object} scope (optional) The scope of the function (defaults to current node)\r
+     * @param {Array} args (optional) The args to call the function with (default to passing the current node)\r
+     */\r
+    eachChild : function(fn, scope, args){\r
+        var cs = this.childNodes;\r
+        for(var i = 0, len = cs.length; i < len; i++) {\r
+               if(fn.apply(scope || this, args || [cs[i]]) === false){\r
+                   break;\r
+               }\r
+        }\r
     },\r
 \r
-    // private\r
-    adjustSize : function(w, h){\r
-        if(this.autoWidth){\r
-            w = 'auto';\r
+    /**\r
+     * Finds the first child that has the attribute with the specified value.\r
+     * @param {String} attribute The attribute name\r
+     * @param {Mixed} value The value to search for\r
+     * @return {Node} The found child or null if none was found\r
+     */\r
+    findChild : function(attribute, value){\r
+        var cs = this.childNodes;\r
+        for(var i = 0, len = cs.length; i < len; i++) {\r
+               if(cs[i].attributes[attribute] == value){\r
+                   return cs[i];\r
+               }\r
         }\r
-        if(this.autoHeight){\r
-            h = 'auto';\r
+        return null;\r
+    },\r
+\r
+    /**\r
+     * Finds the first child by a custom function. The child matches if the function passed\r
+     * returns true.\r
+     * @param {Function} fn\r
+     * @param {Object} scope (optional)\r
+     * @return {Node} The found child or null if none was found\r
+     */\r
+    findChildBy : function(fn, scope){\r
+        var cs = this.childNodes;\r
+        for(var i = 0, len = cs.length; i < len; i++) {\r
+               if(fn.call(scope||cs[i], cs[i]) === true){\r
+                   return cs[i];\r
+               }\r
         }\r
-        return {width : w, height: h};\r
+        return null;\r
     },\r
 \r
-    // private\r
-    adjustPosition : function(x, y){\r
-        return {x : x, y: y};\r
-    }\r
-});\r
-Ext.reg('box', Ext.BoxComponent);\r
+    /**\r
+     * Sorts this nodes children using the supplied sort function\r
+     * @param {Function} fn\r
+     * @param {Object} scope (optional)\r
+     */\r
+    sort : function(fn, scope){\r
+        var cs = this.childNodes;\r
+        var len = cs.length;\r
+        if(len > 0){\r
+            var sortFn = scope ? function(){fn.apply(scope, arguments);} : fn;\r
+            cs.sort(sortFn);\r
+            for(var i = 0; i < len; i++){\r
+                var n = cs[i];\r
+                n.previousSibling = cs[i-1];\r
+                n.nextSibling = cs[i+1];\r
+                if(i === 0){\r
+                    this.setFirstChild(n);\r
+                }\r
+                if(i == len-1){\r
+                    this.setLastChild(n);\r
+                }\r
+            }\r
+        }\r
+    },\r
 \r
-Ext.SplitBar = function(dragElement, resizingElement, orientation, placement, existingProxy){\r
-    \r
-    \r
-    this.el = Ext.get(dragElement, true);\r
-    this.el.dom.unselectable = "on";\r
-    \r
-    this.resizingEl = Ext.get(resizingElement, true);\r
+    /**\r
+     * Returns true if this node is an ancestor (at any point) of the passed node.\r
+     * @param {Node} node\r
+     * @return {Boolean}\r
+     */\r
+    contains : function(node){\r
+        return node.isAncestor(this);\r
+    },\r
 \r
-    \r
-    this.orientation = orientation || Ext.SplitBar.HORIZONTAL;\r
-    \r
-    \r
-    this.minSize = 0;\r
-    \r
-    \r
-    this.maxSize = 2000;\r
-    \r
-    \r
-    this.animate = false;\r
-    \r
-    \r
-    this.useShim = false;\r
-    \r
-    \r
-    this.shim = null;\r
-    \r
-    if(!existingProxy){\r
-        \r
-        this.proxy = Ext.SplitBar.createProxy(this.orientation);\r
-    }else{\r
-        this.proxy = Ext.get(existingProxy).dom;\r
+    /**\r
+     * Returns true if the passed node is an ancestor (at any point) of this node.\r
+     * @param {Node} node\r
+     * @return {Boolean}\r
+     */\r
+    isAncestor : function(node){\r
+        var p = this.parentNode;\r
+        while(p){\r
+            if(p == node){\r
+                return true;\r
+            }\r
+            p = p.parentNode;\r
+        }\r
+        return false;\r
+    },\r
+\r
+    toString : function(){\r
+        return "[Node"+(this.id?" "+this.id:"")+"]";\r
     }\r
-    \r
-    this.dd = new Ext.dd.DDProxy(this.el.dom.id, "XSplitBars", {dragElId : this.proxy.id});\r
-    \r
-    \r
-    this.dd.b4StartDrag = this.onStartProxyDrag.createDelegate(this);\r
-    \r
-    \r
-    this.dd.endDrag = this.onEndProxyDrag.createDelegate(this);\r
-    \r
-    \r
-    this.dragSpecs = {};\r
-    \r
-    \r
-    this.adapter = new Ext.SplitBar.BasicLayoutAdapter();\r
-    this.adapter.init(this);\r
-    \r
-    if(this.orientation == Ext.SplitBar.HORIZONTAL){\r
-        \r
-        this.placement = placement || (this.el.getX() > this.resizingEl.getX() ? Ext.SplitBar.LEFT : Ext.SplitBar.RIGHT);\r
-        this.el.addClass("x-splitbar-h");\r
-    }else{\r
-        \r
-        this.placement = placement || (this.el.getY() > this.resizingEl.getY() ? Ext.SplitBar.TOP : Ext.SplitBar.BOTTOM);\r
-        this.el.addClass("x-splitbar-v");\r
+});/**\r
+ * @class Ext.tree.TreeNode\r
+ * @extends Ext.data.Node\r
+ * @cfg {String} text The text for this node\r
+ * @cfg {Boolean} expanded true to start the node expanded\r
+ * @cfg {Boolean} allowDrag False to make this node undraggable if {@link #draggable} = true (defaults to true)\r
+ * @cfg {Boolean} allowDrop False if this node cannot have child nodes dropped on it (defaults to true)\r
+ * @cfg {Boolean} disabled true to start the node disabled\r
+ * @cfg {String} icon The path to an icon for the node. The preferred way to do this\r
+ * is to use the cls or iconCls attributes and add the icon via a CSS background image.\r
+ * @cfg {String} cls A css class to be added to the node\r
+ * @cfg {String} iconCls A css class to be added to the nodes icon element for applying css background images\r
+ * @cfg {String} href URL of the link used for the node (defaults to #)\r
+ * @cfg {String} hrefTarget target frame for the link\r
+ * @cfg {Boolean} hidden True to render hidden. (Defaults to false).\r
+ * @cfg {String} qtip An Ext QuickTip for the node\r
+ * @cfg {Boolean} expandable If set to true, the node will always show a plus/minus icon, even when empty\r
+ * @cfg {String} qtipCfg An Ext QuickTip config for the node (used instead of qtip)\r
+ * @cfg {Boolean} singleClickExpand True for single click expand on this node\r
+ * @cfg {Function} uiProvider A UI <b>class</b> to use for this node (defaults to Ext.tree.TreeNodeUI)\r
+ * @cfg {Boolean} checked True to render a checked checkbox for this node, false to render an unchecked checkbox\r
+ * (defaults to undefined with no checkbox rendered)\r
+ * @cfg {Boolean} draggable True to make this node draggable (defaults to false)\r
+ * @cfg {Boolean} isTarget False to not allow this node to act as a drop target (defaults to true)\r
+ * @cfg {Boolean} allowChildren False to not allow this node to have child nodes (defaults to true)\r
+ * @cfg {Boolean} editable False to not allow this node to be edited by an (@link Ext.tree.TreeEditor} (defaults to true)\r
+ * @constructor\r
+ * @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node\r
+ */\r
+Ext.tree.TreeNode = function(attributes){\r
+    attributes = attributes || {};\r
+    if(typeof attributes == "string"){\r
+        attributes = {text: attributes};\r
     }\r
-    \r
-    this.addEvents(\r
-        \r
-        "resize",\r
-        \r
-        "moved",\r
-        \r
-        "beforeresize",\r
+    this.childrenRendered = false;\r
+    this.rendered = false;\r
+    Ext.tree.TreeNode.superclass.constructor.call(this, attributes);\r
+    this.expanded = attributes.expanded === true;\r
+    this.isTarget = attributes.isTarget !== false;\r
+    this.draggable = attributes.draggable !== false && attributes.allowDrag !== false;\r
+    this.allowChildren = attributes.allowChildren !== false && attributes.allowDrop !== false;\r
 \r
-        "beforeapply"\r
+    /**\r
+     * Read-only. The text for this node. To change it use setText().\r
+     * @type String\r
+     */\r
+    this.text = attributes.text;\r
+    /**\r
+     * True if this node is disabled.\r
+     * @type Boolean\r
+     */\r
+    this.disabled = attributes.disabled === true;\r
+    /**\r
+     * True if this node is hidden.\r
+     * @type Boolean\r
+     */\r
+    this.hidden = attributes.hidden === true;\r
+\r
+    this.addEvents(\r
+        /**\r
+        * @event textchange\r
+        * Fires when the text for this node is changed\r
+        * @param {Node} this This node\r
+        * @param {String} text The new text\r
+        * @param {String} oldText The old text\r
+        */\r
+        "textchange",\r
+        /**\r
+        * @event beforeexpand\r
+        * Fires before this node is expanded, return false to cancel.\r
+        * @param {Node} this This node\r
+        * @param {Boolean} deep\r
+        * @param {Boolean} anim\r
+        */\r
+        "beforeexpand",\r
+        /**\r
+        * @event beforecollapse\r
+        * Fires before this node is collapsed, return false to cancel.\r
+        * @param {Node} this This node\r
+        * @param {Boolean} deep\r
+        * @param {Boolean} anim\r
+        */\r
+        "beforecollapse",\r
+        /**\r
+        * @event expand\r
+        * Fires when this node is expanded\r
+        * @param {Node} this This node\r
+        */\r
+        "expand",\r
+        /**\r
+        * @event disabledchange\r
+        * Fires when the disabled status of this node changes\r
+        * @param {Node} this This node\r
+        * @param {Boolean} disabled\r
+        */\r
+        "disabledchange",\r
+        /**\r
+        * @event collapse\r
+        * Fires when this node is collapsed\r
+        * @param {Node} this This node\r
+        */\r
+        "collapse",\r
+        /**\r
+        * @event beforeclick\r
+        * Fires before click processing. Return false to cancel the default action.\r
+        * @param {Node} this This node\r
+        * @param {Ext.EventObject} e The event object\r
+        */\r
+        "beforeclick",\r
+        /**\r
+        * @event click\r
+        * Fires when this node is clicked\r
+        * @param {Node} this This node\r
+        * @param {Ext.EventObject} e The event object\r
+        */\r
+        "click",\r
+        /**\r
+        * @event checkchange\r
+        * Fires when a node with a checkbox's checked property changes\r
+        * @param {Node} this This node\r
+        * @param {Boolean} checked\r
+        */\r
+        "checkchange",\r
+        /**\r
+        * @event dblclick\r
+        * Fires when this node is double clicked\r
+        * @param {Node} this This node\r
+        * @param {Ext.EventObject} e The event object\r
+        */\r
+        "dblclick",\r
+        /**\r
+        * @event contextmenu\r
+        * Fires when this node is right clicked\r
+        * @param {Node} this This node\r
+        * @param {Ext.EventObject} e The event object\r
+        */\r
+        "contextmenu",\r
+        /**\r
+        * @event beforechildrenrendered\r
+        * Fires right before the child nodes for this node are rendered\r
+        * @param {Node} this This node\r
+        */\r
+        "beforechildrenrendered"\r
     );\r
 \r
-    Ext.SplitBar.superclass.constructor.call(this);\r
+    var uiClass = this.attributes.uiProvider || this.defaultUI || Ext.tree.TreeNodeUI;\r
+\r
+    /**\r
+     * Read-only. The UI for this node\r
+     * @type TreeNodeUI\r
+     */\r
+    this.ui = new uiClass(this);\r
 };\r
+Ext.extend(Ext.tree.TreeNode, Ext.data.Node, {\r
+    preventHScroll: true,\r
+    /**\r
+     * Returns true if this node is expanded\r
+     * @return {Boolean}\r
+     */\r
+    isExpanded : function(){\r
+        return this.expanded;\r
+    },\r
 \r
-Ext.extend(Ext.SplitBar, Ext.util.Observable, {\r
-    onStartProxyDrag : function(x, y){\r
-        this.fireEvent("beforeresize", this);\r
-        this.overlay =  Ext.DomHelper.append(document.body,  {cls: "x-drag-overlay", html: "&#160;"}, true);\r
-        this.overlay.unselectable();\r
-        this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));\r
-        this.overlay.show();\r
-        Ext.get(this.proxy).setDisplayed("block");\r
-        var size = this.adapter.getElementSize(this);\r
-        this.activeMinSize = this.getMinimumSize();\r
-        this.activeMaxSize = this.getMaximumSize();\r
-        var c1 = size - this.activeMinSize;\r
-        var c2 = Math.max(this.activeMaxSize - size, 0);\r
-        if(this.orientation == Ext.SplitBar.HORIZONTAL){\r
-            this.dd.resetConstraints();\r
-            this.dd.setXConstraint(\r
-                this.placement == Ext.SplitBar.LEFT ? c1 : c2, \r
-                this.placement == Ext.SplitBar.LEFT ? c2 : c1\r
-            );\r
-            this.dd.setYConstraint(0, 0);\r
-        }else{\r
-            this.dd.resetConstraints();\r
-            this.dd.setXConstraint(0, 0);\r
-            this.dd.setYConstraint(\r
-                this.placement == Ext.SplitBar.TOP ? c1 : c2, \r
-                this.placement == Ext.SplitBar.TOP ? c2 : c1\r
-            );\r
-         }\r
-        this.dragSpecs.startSize = size;\r
-        this.dragSpecs.startPoint = [x, y];\r
-        Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd, x, y);\r
+/**\r
+ * Returns the UI object for this node.\r
+ * @return {TreeNodeUI} The object which is providing the user interface for this tree\r
+ * node. Unless otherwise specified in the {@link #uiProvider}, this will be an instance\r
+ * of {@link Ext.tree.TreeNodeUI}\r
+ */\r
+    getUI : function(){\r
+        return this.ui;\r
     },\r
-    \r
-    \r
-    onEndProxyDrag : function(e){\r
-        Ext.get(this.proxy).setDisplayed(false);\r
-        var endPoint = Ext.lib.Event.getXY(e);\r
-        if(this.overlay){\r
-            Ext.destroy(this.overlay);\r
-            delete this.overlay;\r
-        }\r
-        var newSize;\r
-        if(this.orientation == Ext.SplitBar.HORIZONTAL){\r
-            newSize = this.dragSpecs.startSize + \r
-                (this.placement == Ext.SplitBar.LEFT ?\r
-                    endPoint[0] - this.dragSpecs.startPoint[0] :\r
-                    this.dragSpecs.startPoint[0] - endPoint[0]\r
-                );\r
-        }else{\r
-            newSize = this.dragSpecs.startSize + \r
-                (this.placement == Ext.SplitBar.TOP ?\r
-                    endPoint[1] - this.dragSpecs.startPoint[1] :\r
-                    this.dragSpecs.startPoint[1] - endPoint[1]\r
-                );\r
+\r
+    getLoader : function(){\r
+        var owner;\r
+        return this.loader || ((owner = this.getOwnerTree()) && owner.loader ? owner.loader : new Ext.tree.TreeLoader());\r
+    },\r
+\r
+    // private override\r
+    setFirstChild : function(node){\r
+        var of = this.firstChild;\r
+        Ext.tree.TreeNode.superclass.setFirstChild.call(this, node);\r
+        if(this.childrenRendered && of && node != of){\r
+            of.renderIndent(true, true);\r
         }\r
-        newSize = Math.min(Math.max(newSize, this.activeMinSize), this.activeMaxSize);\r
-        if(newSize != this.dragSpecs.startSize){\r
-            if(this.fireEvent('beforeapply', this, newSize) !== false){\r
-                this.adapter.setElementSize(this, newSize);\r
-                this.fireEvent("moved", this, newSize);\r
-                this.fireEvent("resize", this, newSize);\r
-            }\r
+        if(this.rendered){\r
+            this.renderIndent(true, true);\r
         }\r
     },\r
-    \r
-    \r
-    getAdapter : function(){\r
-        return this.adapter;\r
-    },\r
-    \r
-    \r
-    setAdapter : function(adapter){\r
-        this.adapter = adapter;\r
-        this.adapter.init(this);\r
-    },\r
-    \r
-    \r
-    getMinimumSize : function(){\r
-        return this.minSize;\r
+\r
+    // private override\r
+    setLastChild : function(node){\r
+        var ol = this.lastChild;\r
+        Ext.tree.TreeNode.superclass.setLastChild.call(this, node);\r
+        if(this.childrenRendered && ol && node != ol){\r
+            ol.renderIndent(true, true);\r
+        }\r
+        if(this.rendered){\r
+            this.renderIndent(true, true);\r
+        }\r
     },\r
-    \r
-    \r
-    setMinimumSize : function(minSize){\r
-        this.minSize = minSize;\r
+\r
+    // these methods are overridden to provide lazy rendering support\r
+    // private override\r
+    appendChild : function(n){\r
+        if(!n.render && !Ext.isArray(n)){\r
+            n = this.getLoader().createNode(n);\r
+        }\r
+        var node = Ext.tree.TreeNode.superclass.appendChild.call(this, n);\r
+        if(node && this.childrenRendered){\r
+            node.render();\r
+        }\r
+        this.ui.updateExpandIcon();\r
+        return node;\r
     },\r
-    \r
-    \r
-    getMaximumSize : function(){\r
-        return this.maxSize;\r
-    },\r
-    \r
-    \r
-    setMaximumSize : function(maxSize){\r
-        this.maxSize = maxSize;\r
-    },\r
-    \r
-    \r
-    setCurrentSize : function(size){\r
-        var oldAnimate = this.animate;\r
-        this.animate = false;\r
-        this.adapter.setElementSize(this, size);\r
-        this.animate = oldAnimate;\r
-    },\r
-    \r
-    \r
-    destroy : function(removeEl){\r
-        if(this.shim){\r
-            this.shim.remove();\r
+\r
+    // private override\r
+    removeChild : function(node){\r
+        this.ownerTree.getSelectionModel().unselect(node);\r
+        Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments);\r
+        // if it's been rendered remove dom node\r
+        if(this.childrenRendered){\r
+            node.ui.remove();\r
         }\r
-        this.dd.unreg();\r
-        Ext.destroy(Ext.get(this.proxy));\r
-        if(removeEl){\r
-            this.el.remove();\r
+        if(this.childNodes.length < 1){\r
+            this.collapse(false, false);\r
+        }else{\r
+            this.ui.updateExpandIcon();\r
         }\r
-    }\r
-});\r
-\r
+        if(!this.firstChild && !this.isHiddenRoot()) {\r
+            this.childrenRendered = false;\r
+        }\r
+        return node;\r
+    },\r
 \r
-Ext.SplitBar.createProxy = function(dir){\r
-    var proxy = new Ext.Element(document.createElement("div"));\r
-    proxy.unselectable();\r
-    var cls = 'x-splitbar-proxy';\r
-    proxy.addClass(cls + ' ' + (dir == Ext.SplitBar.HORIZONTAL ? cls +'-h' : cls + '-v'));\r
-    document.body.appendChild(proxy.dom);\r
-    return proxy.dom;\r
-};\r
+    // private override\r
+    insertBefore : function(node, refNode){\r
+        if(!node.render){ \r
+            node = this.getLoader().createNode(node);\r
+        }\r
+        var newNode = Ext.tree.TreeNode.superclass.insertBefore.call(this, node, refNode);\r
+        if(newNode && refNode && this.childrenRendered){\r
+            node.render();\r
+        }\r
+        this.ui.updateExpandIcon();\r
+        return newNode;\r
+    },\r
 \r
+    /**\r
+     * Sets the text for this node\r
+     * @param {String} text\r
+     */\r
+    setText : function(text){\r
+        var oldText = this.text;\r
+        this.text = text;\r
+        this.attributes.text = text;\r
+        if(this.rendered){ // event without subscribing\r
+            this.ui.onTextChange(this, text, oldText);\r
+        }\r
+        this.fireEvent("textchange", this, text, oldText);\r
+    },\r
 \r
-Ext.SplitBar.BasicLayoutAdapter = function(){\r
-};\r
+    /**\r
+     * Triggers selection of this node\r
+     */\r
+    select : function(){\r
+        this.getOwnerTree().getSelectionModel().select(this);\r
+    },\r
 \r
-Ext.SplitBar.BasicLayoutAdapter.prototype = {\r
-    // do nothing for now\r
-    init : function(s){\r
-    \r
+    /**\r
+     * Triggers deselection of this node\r
+     */\r
+    unselect : function(){\r
+        this.getOwnerTree().getSelectionModel().unselect(this);\r
     },\r
-    \r
-     getElementSize : function(s){\r
-        if(s.orientation == Ext.SplitBar.HORIZONTAL){\r
-            return s.resizingEl.getWidth();\r
-        }else{\r
-            return s.resizingEl.getHeight();\r
-        }\r
+\r
+    /**\r
+     * Returns true if this node is selected\r
+     * @return {Boolean}\r
+     */\r
+    isSelected : function(){\r
+        return this.getOwnerTree().getSelectionModel().isSelected(this);\r
     },\r
-    \r
-    \r
-    setElementSize : function(s, newSize, onComplete){\r
-        if(s.orientation == Ext.SplitBar.HORIZONTAL){\r
-            if(!s.animate){\r
-                s.resizingEl.setWidth(newSize);\r
-                if(onComplete){\r
-                    onComplete(s, newSize);\r
-                }\r
-            }else{\r
-                s.resizingEl.setWidth(newSize, true, .1, onComplete, 'easeOut');\r
+\r
+    /**\r
+     * Expand this node.\r
+     * @param {Boolean} deep (optional) True to expand all children as well\r
+     * @param {Boolean} anim (optional) false to cancel the default animation\r
+     * @param {Function} callback (optional) A callback to be called when\r
+     * expanding this node completes (does not wait for deep expand to complete).\r
+     * Called with 1 parameter, this node.\r
+     * @param {Object} scope (optional) The scope in which to execute the callback.\r
+     */\r
+    expand : function(deep, anim, callback, scope){\r
+        if(!this.expanded){\r
+            if(this.fireEvent("beforeexpand", this, deep, anim) === false){\r
+                return;\r
             }\r
-        }else{\r
-            \r
-            if(!s.animate){\r
-                s.resizingEl.setHeight(newSize);\r
-                if(onComplete){\r
-                    onComplete(s, newSize);\r
-                }\r
+            if(!this.childrenRendered){\r
+                this.renderChildren();\r
+            }\r
+            this.expanded = true;\r
+            if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){\r
+                this.ui.animExpand(function(){\r
+                    this.fireEvent("expand", this);\r
+                    this.runCallback(callback, scope || this, [this]);\r
+                    if(deep === true){\r
+                        this.expandChildNodes(true);\r
+                    }\r
+                }.createDelegate(this));\r
+                return;\r
             }else{\r
-                s.resizingEl.setHeight(newSize, true, .1, onComplete, 'easeOut');\r
+                this.ui.expand();\r
+                this.fireEvent("expand", this);\r
+                this.runCallback(callback, scope || this, [this]);\r
             }\r
+        }else{\r
+           this.runCallback(callback, scope || this, [this]);\r
+        }\r
+        if(deep === true){\r
+            this.expandChildNodes(true);\r
         }\r
-    }\r
-};\r
-\r
-\r
-Ext.SplitBar.AbsoluteLayoutAdapter = function(container){\r
-    this.basic = new Ext.SplitBar.BasicLayoutAdapter();\r
-    this.container = Ext.get(container);\r
-};\r
-\r
-Ext.SplitBar.AbsoluteLayoutAdapter.prototype = {\r
-    init : function(s){\r
-        this.basic.init(s);\r
-    },\r
-    \r
-    getElementSize : function(s){\r
-        return this.basic.getElementSize(s);\r
-    },\r
-    \r
-    setElementSize : function(s, newSize, onComplete){\r
-        this.basic.setElementSize(s, newSize, this.moveSplitter.createDelegate(this, [s]));\r
     },\r
     \r
-    moveSplitter : function(s){\r
-        var yes = Ext.SplitBar;\r
-        switch(s.placement){\r
-            case yes.LEFT:\r
-                s.el.setX(s.resizingEl.getRight());\r
-                break;\r
-            case yes.RIGHT:\r
-                s.el.setStyle("right", (this.container.getWidth() - s.resizingEl.getLeft()) + "px");\r
-                break;\r
-            case yes.TOP:\r
-                s.el.setY(s.resizingEl.getBottom());\r
-                break;\r
-            case yes.BOTTOM:\r
-                s.el.setY(s.resizingEl.getTop() - s.el.getHeight());\r
-                break;\r
+    runCallback: function(cb, scope, args){\r
+        if(Ext.isFunction(cb)){\r
+            cb.apply(scope, args);\r
         }\r
-    }\r
-};\r
-\r
-\r
-Ext.SplitBar.VERTICAL = 1;\r
-\r
-\r
-Ext.SplitBar.HORIZONTAL = 2;\r
-\r
-\r
-Ext.SplitBar.LEFT = 1;\r
-\r
-\r
-Ext.SplitBar.RIGHT = 2;\r
-\r
-\r
-Ext.SplitBar.TOP = 3;\r
-\r
-\r
-Ext.SplitBar.BOTTOM = 4;\r
-\r
-\r
-Ext.Container = Ext.extend(Ext.BoxComponent, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    \r
-    autoDestroy: true,\r
-    \r
-    \r
-    defaultType: 'panel',\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.Container.superclass.initComponent.call(this);\r
+    },\r
 \r
-        this.addEvents(\r
-            \r
-            'afterlayout',\r
-            \r
-            'beforeadd',\r
-            \r
-            'beforeremove',\r
-            \r
-            'add',\r
-            \r
-            'remove'\r
-        );\r
+    isHiddenRoot : function(){\r
+        return this.isRoot && !this.getOwnerTree().rootVisible;\r
+    },\r
 \r
-        \r
-        var items = this.items;\r
-        if(items){\r
-            delete this.items;\r
-            if(Ext.isArray(items) && items.length > 0){\r
-                this.add.apply(this, items);\r
+    /**\r
+     * Collapse this node.\r
+     * @param {Boolean} deep (optional) True to collapse all children as well\r
+     * @param {Boolean} anim (optional) false to cancel the default animation\r
+     * @param {Function} callback (optional) A callback to be called when\r
+     * expanding this node completes (does not wait for deep expand to complete).\r
+     * Called with 1 parameter, this node.\r
+     * @param {Object} scope (optional) The scope in which to execute the callback.\r
+     */\r
+    collapse : function(deep, anim, callback, scope){\r
+        if(this.expanded && !this.isHiddenRoot()){\r
+            if(this.fireEvent("beforecollapse", this, deep, anim) === false){\r
+                return;\r
+            }\r
+            this.expanded = false;\r
+            if((this.getOwnerTree().animate && anim !== false) || anim){\r
+                this.ui.animCollapse(function(){\r
+                    this.fireEvent("collapse", this);\r
+                    this.runCallback(callback, scope || this, [this]);\r
+                    if(deep === true){\r
+                        this.collapseChildNodes(true);\r
+                    }\r
+                }.createDelegate(this));\r
+                return;\r
             }else{\r
-                this.add(items);\r
+                this.ui.collapse();\r
+                this.fireEvent("collapse", this);\r
+                this.runCallback(callback, scope || this, [this]);\r
             }\r
+        }else if(!this.expanded){\r
+            this.runCallback(callback, scope || this, [this]);\r
         }\r
-    },\r
-\r
-    // private\r
-    initItems : function(){\r
-        if(!this.items){\r
-            this.items = new Ext.util.MixedCollection(false, this.getComponentId);\r
-            this.getLayout(); // initialize the layout\r
+        if(deep === true){\r
+            var cs = this.childNodes;\r
+            for(var i = 0, len = cs.length; i < len; i++) {\r
+               cs[i].collapse(true, false);\r
+            }\r
         }\r
     },\r
 \r
     // private\r
-    setLayout : function(layout){\r
-        if(this.layout && this.layout != layout){\r
-            this.layout.setContainer(null);\r
+    delayedExpand : function(delay){\r
+        if(!this.expandProcId){\r
+            this.expandProcId = this.expand.defer(delay, this);\r
         }\r
-        this.initItems();\r
-        this.layout = layout;\r
-        layout.setContainer(this);\r
     },\r
 \r
     // private\r
-    render : function(){\r
-        Ext.Container.superclass.render.apply(this, arguments);\r
-        if(this.layout){\r
-            if(typeof this.layout == 'string'){\r
-                this.layout = new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig);\r
-            }\r
-            this.setLayout(this.layout);\r
-\r
-            if(this.activeItem !== undefined){\r
-                var item = this.activeItem;\r
-                delete this.activeItem;\r
-                this.layout.setActiveItem(item);\r
-                return;\r
-            }\r
-        }\r
-        if(!this.ownerCt){\r
-            this.doLayout();\r
-        }\r
-        if(this.monitorResize === true){\r
-            Ext.EventManager.onWindowResize(this.doLayout, this, [false]);\r
+    cancelExpand : function(){\r
+        if(this.expandProcId){\r
+            clearTimeout(this.expandProcId);\r
         }\r
+        this.expandProcId = false;\r
     },\r
 \r
-    \r
-    getLayoutTarget : function(){\r
-        return this.el;\r
+    /**\r
+     * Toggles expanded/collapsed state of the node\r
+     */\r
+    toggle : function(){\r
+        if(this.expanded){\r
+            this.collapse();\r
+        }else{\r
+            this.expand();\r
+        }\r
     },\r
 \r
-    // private - used as the key lookup function for the items collection\r
-    getComponentId : function(comp){\r
-        return comp.itemId || comp.id;\r
+    /**\r
+     * Ensures all parent nodes are expanded, and if necessary, scrolls\r
+     * the node into view.\r
+     * @param {Function} callback (optional) A function to call when the node has been made visible.\r
+     * @param {Object} scope (optional) The scope in which to execute the callback.\r
+     */\r
+    ensureVisible : function(callback, scope){\r
+        var tree = this.getOwnerTree();\r
+        tree.expandPath(this.parentNode ? this.parentNode.getPath() : this.getPath(), false, function(){\r
+            var node = tree.getNodeById(this.id);  // Somehow if we don't do this, we lose changes that happened to node in the meantime\r
+            tree.getTreeEl().scrollChildIntoView(node.ui.anchor);\r
+            this.runCallback(callback, scope || this, [this]);\r
+        }.createDelegate(this));\r
     },\r
 \r
-    \r
-    add : function(comp){\r
-        if(!this.items){\r
-            this.initItems();\r
-        }\r
-        var a = arguments, len = a.length;\r
-        if(len > 1){\r
-            for(var i = 0; i < len; i++) {\r
-                this.add(a[i]);\r
-            }\r
-            return;\r
-        }\r
-        var c = this.lookupComponent(this.applyDefaults(comp));\r
-        var pos = this.items.length;\r
-        if(this.fireEvent('beforeadd', this, c, pos) !== false && this.onBeforeAdd(c) !== false){\r
-            this.items.add(c);\r
-            c.ownerCt = this;\r
-            this.fireEvent('add', this, c, pos);\r
+    /**\r
+     * Expand all child nodes\r
+     * @param {Boolean} deep (optional) true if the child nodes should also expand their child nodes\r
+     */\r
+    expandChildNodes : function(deep){\r
+        var cs = this.childNodes;\r
+        for(var i = 0, len = cs.length; i < len; i++) {\r
+               cs[i].expand(deep);\r
         }\r
-        return c;\r
     },\r
 \r
-    \r
-    insert : function(index, comp){\r
-        if(!this.items){\r
-            this.initItems();\r
-        }\r
-        var a = arguments, len = a.length;\r
-        if(len > 2){\r
-            for(var i = len-1; i >= 1; --i) {\r
-                this.insert(index, a[i]);\r
-            }\r
-            return;\r
-        }\r
-        var c = this.lookupComponent(this.applyDefaults(comp));\r
-\r
-        if(c.ownerCt == this && this.items.indexOf(c) < index){\r
-            --index;\r
+    /**\r
+     * Collapse all child nodes\r
+     * @param {Boolean} deep (optional) true if the child nodes should also collapse their child nodes\r
+     */\r
+    collapseChildNodes : function(deep){\r
+        var cs = this.childNodes;\r
+        for(var i = 0, len = cs.length; i < len; i++) {\r
+               cs[i].collapse(deep);\r
         }\r
+    },\r
 \r
-        if(this.fireEvent('beforeadd', this, c, index) !== false && this.onBeforeAdd(c) !== false){\r
-            this.items.insert(index, c);\r
-            c.ownerCt = this;\r
-            this.fireEvent('add', this, c, index);\r
+    /**\r
+     * Disables this node\r
+     */\r
+    disable : function(){\r
+        this.disabled = true;\r
+        this.unselect();\r
+        if(this.rendered && this.ui.onDisableChange){ // event without subscribing\r
+            this.ui.onDisableChange(this, true);\r
         }\r
-        return c;\r
+        this.fireEvent("disabledchange", this, true);\r
     },\r
 \r
-    // private\r
-    applyDefaults : function(c){\r
-        if(this.defaults){\r
-            if(typeof c == 'string'){\r
-                c = Ext.ComponentMgr.get(c);\r
-                Ext.apply(c, this.defaults);\r
-            }else if(!c.events){\r
-                Ext.applyIf(c, this.defaults);\r
-            }else{\r
-                Ext.apply(c, this.defaults);\r
-            }\r
+    /**\r
+     * Enables this node\r
+     */\r
+    enable : function(){\r
+        this.disabled = false;\r
+        if(this.rendered && this.ui.onDisableChange){ // event without subscribing\r
+            this.ui.onDisableChange(this, false);\r
         }\r
-        return c;\r
+        this.fireEvent("disabledchange", this, false);\r
     },\r
 \r
     // private\r
-    onBeforeAdd : function(item){\r
-        if(item.ownerCt){\r
-            item.ownerCt.remove(item, false);\r
+    renderChildren : function(suppressEvent){\r
+        if(suppressEvent !== false){\r
+            this.fireEvent("beforechildrenrendered", this);\r
         }\r
-        if(this.hideBorders === true){\r
-            item.border = (item.border === true);\r
+        var cs = this.childNodes;\r
+        for(var i = 0, len = cs.length; i < len; i++){\r
+            cs[i].render(true);\r
         }\r
+        this.childrenRendered = true;\r
     },\r
 \r
-    \r
-    remove : function(comp, autoDestroy){\r
-        var c = this.getComponent(comp);\r
-        if(c && this.fireEvent('beforeremove', this, c) !== false){\r
-            this.items.remove(c);\r
-            delete c.ownerCt;\r
-            if(autoDestroy === true || (autoDestroy !== false && this.autoDestroy)){\r
-                c.destroy();\r
-            }\r
-            if(this.layout && this.layout.activeItem == c){\r
-                delete this.layout.activeItem;\r
+    // private\r
+    sort : function(fn, scope){\r
+        Ext.tree.TreeNode.superclass.sort.apply(this, arguments);\r
+        if(this.childrenRendered){\r
+            var cs = this.childNodes;\r
+            for(var i = 0, len = cs.length; i < len; i++){\r
+                cs[i].render(true);\r
             }\r
-            this.fireEvent('remove', this, c);\r
-        }\r
-        return c;\r
-    },\r
-    \r
-    \r
-    removeAll: function(autoDestroy){\r
-        var item, items = [];\r
-        while((item = this.items.last())){\r
-            items.unshift(this.remove(item, autoDestroy));\r
-        }\r
-        return items;\r
-    },\r
-\r
-    \r
-    getComponent : function(comp){\r
-        if(typeof comp == 'object'){\r
-            return comp;\r
         }\r
-        return this.items.get(comp);\r
     },\r
 \r
     // private\r
-    lookupComponent : function(comp){\r
-        if(typeof comp == 'string'){\r
-            return Ext.ComponentMgr.get(comp);\r
-        }else if(!comp.events){\r
-            return this.createComponent(comp);\r
+    render : function(bulkRender){\r
+        this.ui.render(bulkRender);\r
+        if(!this.rendered){\r
+            // make sure it is registered\r
+            this.getOwnerTree().registerNode(this);\r
+            this.rendered = true;\r
+            if(this.expanded){\r
+                this.expanded = false;\r
+                this.expand(false, false);\r
+            }\r
         }\r
-        return comp;\r
     },\r
 \r
     // private\r
-    createComponent : function(config){\r
-        return Ext.ComponentMgr.create(config, this.defaultType);\r
-    },\r
-\r
-    \r
-    doLayout : function(shallow){\r
-        if(this.rendered && this.layout){\r
-            this.layout.layout();\r
+    renderIndent : function(deep, refresh){\r
+        if(refresh){\r
+            this.ui.childIndent = null;\r
         }\r
-        if(shallow !== false && this.items){\r
-            var cs = this.items.items;\r
-            for(var i = 0, len = cs.length; i < len; i++) {\r
-                var c  = cs[i];\r
-                if(c.doLayout){\r
-                    c.doLayout();\r
-                }\r
+        this.ui.renderIndent();\r
+        if(deep === true && this.childrenRendered){\r
+            var cs = this.childNodes;\r
+            for(var i = 0, len = cs.length; i < len; i++){\r
+                cs[i].renderIndent(true, refresh);\r
             }\r
         }\r
     },\r
 \r
-    \r
-    getLayout : function(){\r
-        if(!this.layout){\r
-            var layout = new Ext.layout.ContainerLayout(this.layoutConfig);\r
-            this.setLayout(layout);\r
-        }\r
-        return this.layout;\r
+    beginUpdate : function(){\r
+        this.childrenRendered = false;\r
     },\r
 \r
-    // private\r
-    beforeDestroy : function(){\r
-        if(this.items){\r
-            Ext.destroy.apply(Ext, this.items.items);\r
-        }\r
-        if(this.monitorResize){\r
-            Ext.EventManager.removeResizeListener(this.doLayout, this);\r
-        }\r
-        if (this.layout && this.layout.destroy) {\r
-            this.layout.destroy();\r
+    endUpdate : function(){\r
+        if(this.expanded && this.rendered){\r
+            this.renderChildren();\r
         }\r
-        Ext.Container.superclass.beforeDestroy.call(this);\r
     },\r
 \r
-    \r
-    bubble : function(fn, scope, args){\r
-        var p = this;\r
-        while(p){\r
-            if(fn.apply(scope || p, args || [p]) === false){\r
-                break;\r
+    destroy : function(){\r
+        if(this.childNodes){\r
+            for(var i = 0,l = this.childNodes.length; i < l; i++){\r
+                this.childNodes[i].destroy();\r
             }\r
-            p = p.ownerCt;\r
+            this.childNodes = null;\r
+        }\r
+        if(this.ui.destroy){\r
+            this.ui.destroy();\r
         }\r
     },\r
-\r
     \r
-    cascade : function(fn, scope, args){\r
-        if(fn.apply(scope || this, args || [this]) !== false){\r
-            if(this.items){\r
-                var cs = this.items.items;\r
-                for(var i = 0, len = cs.length; i < len; i++){\r
-                    if(cs[i].cascade){\r
-                        cs[i].cascade(fn, scope, args);\r
-                    }else{\r
-                        fn.apply(scope || cs[i], args || [cs[i]]);\r
-                    }\r
+    // private\r
+    onIdChange: function(id){\r
+        this.ui.onIdChange(id);\r
+    }\r
+});\r
+\r
+Ext.tree.TreePanel.nodeTypes.node = Ext.tree.TreeNode;/**\r
+ * @class Ext.tree.AsyncTreeNode\r
+ * @extends Ext.tree.TreeNode\r
+ * @cfg {TreeLoader} loader A TreeLoader to be used by this node (defaults to the loader defined on the tree)\r
+ * @constructor\r
+ * @param {Object/String} attributes The attributes/config for the node or just a string with the text for the node \r
+ */\r
+ Ext.tree.AsyncTreeNode = function(config){\r
+    this.loaded = config && config.loaded === true;\r
+    this.loading = false;\r
+    Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);\r
+    /**\r
+    * @event beforeload\r
+    * Fires before this node is loaded, return false to cancel\r
+    * @param {Node} this This node\r
+    */\r
+    this.addEvents('beforeload', 'load');\r
+    /**\r
+    * @event load\r
+    * Fires when this node is loaded\r
+    * @param {Node} this This node\r
+    */\r
+    /**\r
+     * The loader used by this node (defaults to using the tree's defined loader)\r
+     * @type TreeLoader\r
+     * @property loader\r
+     */\r
+};\r
+Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {\r
+    expand : function(deep, anim, callback, scope){\r
+        if(this.loading){ // if an async load is already running, waiting til it's done\r
+            var timer;\r
+            var f = function(){\r
+                if(!this.loading){ // done loading\r
+                    clearInterval(timer);\r
+                    this.expand(deep, anim, callback, scope);\r
                 }\r
+            }.createDelegate(this);\r
+            timer = setInterval(f, 200);\r
+            return;\r
+        }\r
+        if(!this.loaded){\r
+            if(this.fireEvent("beforeload", this) === false){\r
+                return;\r
+            }\r
+            this.loading = true;\r
+            this.ui.beforeLoad(this);\r
+            var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();\r
+            if(loader){\r
+                loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback, scope]), this);\r
+                return;\r
             }\r
         }\r
+        Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback, scope);\r
     },\r
-\r
     \r
-    findById : function(id){\r
-        var m, ct = this;\r
-        this.cascade(function(c){\r
-            if(ct != c && c.id === id){\r
-                m = c;\r
-                return false;\r
-            }\r
-        });\r
-        return m || null;\r
+    /**\r
+     * Returns true if this node is currently loading\r
+     * @return {Boolean}\r
+     */\r
+    isLoading : function(){\r
+        return this.loading;  \r
     },\r
-\r
     \r
-    findByType : function(xtype, shallow){\r
-        return this.findBy(function(c){\r
-            return c.isXType(xtype, shallow);\r
-        });\r
+    loadComplete : function(deep, anim, callback, scope){\r
+        this.loading = false;\r
+        this.loaded = true;\r
+        this.ui.afterLoad(this);\r
+        this.fireEvent("load", this);\r
+        this.expand(deep, anim, callback, scope);\r
     },\r
-\r
     \r
-    find : function(prop, value){\r
-        return this.findBy(function(c){\r
-            return c[prop] === value;\r
-        });\r
+    /**\r
+     * Returns true if this node has been loaded\r
+     * @return {Boolean}\r
+     */\r
+    isLoaded : function(){\r
+        return this.loaded;\r
     },\r
-\r
     \r
-    findBy : function(fn, scope){\r
-        var m = [], ct = this;\r
-        this.cascade(function(c){\r
-            if(ct != c && fn.call(scope || c, c, ct) === true){\r
-                m.push(c);\r
-            }\r
-        });\r
-        return m;\r
+    hasChildNodes : function(){\r
+        if(!this.isLeaf() && !this.loaded){\r
+            return true;\r
+        }else{\r
+            return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Trigger a reload for this node\r
+     * @param {Function} callback\r
+     * @param {Object} scope (optional) The scope in which to execute the callback.\r
+     */\r
+    reload : function(callback, scope){\r
+        this.collapse(false, false);\r
+        while(this.firstChild){\r
+            this.removeChild(this.firstChild).destroy();\r
+        }\r
+        this.childrenRendered = false;\r
+        this.loaded = false;\r
+        if(this.isHiddenRoot()){\r
+            this.expanded = false;\r
+        }\r
+        this.expand(false, false, callback, scope);\r
     }\r
 });\r
 \r
-Ext.Container.LAYOUTS = {};\r
-Ext.reg('container', Ext.Container);\r
-\r
-Ext.layout.ContainerLayout = function(config){\r
-    Ext.apply(this, config);\r
+Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode;/**\r
+ * @class Ext.tree.TreeNodeUI\r
+ * This class provides the default UI implementation for Ext TreeNodes.\r
+ * The TreeNode UI implementation is separate from the\r
+ * tree implementation, and allows customizing of the appearance of\r
+ * tree nodes.<br>\r
+ * <p>\r
+ * If you are customizing the Tree's user interface, you\r
+ * may need to extend this class, but you should never need to instantiate this class.<br>\r
+ * <p>\r
+ * This class provides access to the user interface components of an Ext TreeNode, through\r
+ * {@link Ext.tree.TreeNode#getUI}\r
+ */\r
+Ext.tree.TreeNodeUI = function(node){\r
+    this.node = node;\r
+    this.rendered = false;\r
+    this.animating = false;\r
+    this.wasLeaf = true;\r
+    this.ecc = 'x-tree-ec-icon x-tree-elbow';\r
+    this.emptyIcon = Ext.BLANK_IMAGE_URL;\r
 };\r
 \r
-Ext.layout.ContainerLayout.prototype = {\r
-    \r
-    \r
-\r
-    \r
-\r
-    // private\r
-    monitorResize:false,\r
-    // private\r
-    activeItem : null,\r
-\r
+Ext.tree.TreeNodeUI.prototype = {\r
     // private\r
-    layout : function(){\r
-        var target = this.container.getLayoutTarget();\r
-        this.onLayout(this.container, target);\r
-        this.container.fireEvent('afterlayout', this.container, this);\r
+    removeChild : function(node){\r
+        if(this.rendered){\r
+            this.ctNode.removeChild(node.ui.getEl());\r
+        } \r
     },\r
 \r
     // private\r
-    onLayout : function(ct, target){\r
-        this.renderAll(ct, target);\r
+    beforeLoad : function(){\r
+         this.addClass("x-tree-node-loading");\r
     },\r
 \r
     // private\r
-    isValidParent : function(c, target){\r
-               var el = c.getPositionEl ? c.getPositionEl() : c.getEl();\r
-               return el.dom.parentNode == target.dom;\r
+    afterLoad : function(){\r
+         this.removeClass("x-tree-node-loading");\r
     },\r
 \r
     // private\r
-    renderAll : function(ct, target){\r
-        var items = ct.items.items;\r
-        for(var i = 0, len = items.length; i < len; i++) {\r
-            var c = items[i];\r
-            if(c && (!c.rendered || !this.isValidParent(c, target))){\r
-                this.renderItem(c, i, target);\r
-            }\r
+    onTextChange : function(node, text, oldText){\r
+        if(this.rendered){\r
+            this.textNode.innerHTML = text;\r
         }\r
     },\r
 \r
     // private\r
-    renderItem : function(c, position, target){\r
-        if(c && !c.rendered){\r
-            c.render(target, position);\r
-            if(this.extraCls){\r
-               var t = c.getPositionEl ? c.getPositionEl() : c;\r
-               t.addClass(this.extraCls);\r
-            }\r
-            if (this.renderHidden && c != this.activeItem) {\r
-                c.hide();\r
-            }\r
-        }else if(c && !this.isValidParent(c, target)){\r
-            if(this.extraCls){\r
-                var t = c.getPositionEl ? c.getPositionEl() : c;\r
-               t.addClass(this.extraCls);\r
-            }\r
-            if(typeof position == 'number'){\r
-                position = target.dom.childNodes[position];\r
-            }\r
-            target.dom.insertBefore(c.getEl().dom, position || null);\r
-            if (this.renderHidden && c != this.activeItem) {\r
-                c.hide();\r
-            }\r
-        }\r
+    onDisableChange : function(node, state){\r
+        this.disabled = state;\r
+               if (this.checkbox) {\r
+                       this.checkbox.disabled = state;\r
+               }        \r
+        if(state){\r
+            this.addClass("x-tree-node-disabled");\r
+        }else{\r
+            this.removeClass("x-tree-node-disabled");\r
+        } \r
     },\r
 \r
     // private\r
-    onResize: function(){\r
-        if(this.container.collapsed){\r
-            return;\r
-        }\r
-        var b = this.container.bufferResize;\r
-        if(b){\r
-            if(!this.resizeTask){\r
-                this.resizeTask = new Ext.util.DelayedTask(this.layout, this);\r
-                this.resizeBuffer = typeof b == 'number' ? b : 100;\r
-            }\r
-            this.resizeTask.delay(this.resizeBuffer);\r
+    onSelectedChange : function(state){\r
+        if(state){\r
+            this.focus();\r
+            this.addClass("x-tree-selected");\r
         }else{\r
-            this.layout();\r
+            //this.blur();\r
+            this.removeClass("x-tree-selected");\r
         }\r
     },\r
 \r
     // private\r
-    setContainer : function(ct){\r
-        if(this.monitorResize && ct != this.container){\r
-            if(this.container){\r
-                this.container.un('resize', this.onResize, this);\r
+    onMove : function(tree, node, oldParent, newParent, index, refNode){\r
+        this.childIndent = null;\r
+        if(this.rendered){\r
+            var targetNode = newParent.ui.getContainer();\r
+            if(!targetNode){//target not rendered\r
+                this.holder = document.createElement("div");\r
+                this.holder.appendChild(this.wrap);\r
+                return;\r
             }\r
-            if(ct){\r
-                ct.on('resize', this.onResize, this);\r
+            var insertBefore = refNode ? refNode.ui.getEl() : null;\r
+            if(insertBefore){\r
+                targetNode.insertBefore(this.wrap, insertBefore);\r
+            }else{\r
+                targetNode.appendChild(this.wrap);\r
             }\r
+            this.node.renderIndent(true, oldParent != newParent);\r
         }\r
-        this.container = ct;\r
     },\r
 \r
-    // private\r
-    parseMargins : function(v){\r
-        var ms = v.split(' ');\r
-        var len = ms.length;\r
-        if(len == 1){\r
-            ms[1] = ms[0];\r
-            ms[2] = ms[0];\r
-            ms[3] = ms[0];\r
+/**\r
+ * Adds one or more CSS classes to the node's UI element.\r
+ * Duplicate classes are automatically filtered out.\r
+ * @param {String/Array} className The CSS class to add, or an array of classes\r
+ */\r
+    addClass : function(cls){\r
+        if(this.elNode){\r
+            Ext.fly(this.elNode).addClass(cls);\r
         }\r
-        if(len == 2){\r
-            ms[2] = ms[0];\r
-            ms[3] = ms[1];\r
+    },\r
+\r
+/**\r
+ * Removes one or more CSS classes from the node's UI element.\r
+ * @param {String/Array} className The CSS class to remove, or an array of classes\r
+ */\r
+    removeClass : function(cls){\r
+        if(this.elNode){\r
+            Ext.fly(this.elNode).removeClass(cls);  \r
         }\r
-        return {\r
-            top:parseInt(ms[0], 10) || 0,\r
-            right:parseInt(ms[1], 10) || 0,\r
-            bottom:parseInt(ms[2], 10) || 0,\r
-            left:parseInt(ms[3], 10) || 0\r
-        };\r
     },\r
 \r
-    \r
-    destroy : Ext.emptyFn\r
-};\r
-Ext.Container.LAYOUTS['auto'] = Ext.layout.ContainerLayout;\r
+    // private\r
+    remove : function(){\r
+        if(this.rendered){\r
+            this.holder = document.createElement("div");\r
+            this.holder.appendChild(this.wrap);\r
+        }  \r
+    },\r
 \r
-Ext.layout.FitLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
     // private\r
-    monitorResize:true,\r
+    fireEvent : function(){\r
+        return this.node.fireEvent.apply(this.node, arguments);  \r
+    },\r
 \r
     // private\r
-    onLayout : function(ct, target){\r
-        Ext.layout.FitLayout.superclass.onLayout.call(this, ct, target);\r
-        if(!this.container.collapsed){\r
-            this.setItemSize(this.activeItem || ct.items.itemAt(0), target.getStyleSize());\r
+    initEvents : function(){\r
+        this.node.on("move", this.onMove, this);\r
+\r
+        if(this.node.disabled){\r
+            this.addClass("x-tree-node-disabled");\r
+                       if (this.checkbox) {\r
+                               this.checkbox.disabled = true;\r
+                       }            \r
+        }\r
+        if(this.node.hidden){\r
+            this.hide();\r
+        }\r
+        var ot = this.node.getOwnerTree();\r
+        var dd = ot.enableDD || ot.enableDrag || ot.enableDrop;\r
+        if(dd && (!this.node.isRoot || ot.rootVisible)){\r
+            Ext.dd.Registry.register(this.elNode, {\r
+                node: this.node,\r
+                handles: this.getDDHandles(),\r
+                isHandle: false\r
+            });\r
         }\r
     },\r
 \r
     // private\r
-    setItemSize : function(item, size){\r
-        if(item && size.height > 0){ // display none?\r
-            item.setSize(size);\r
+    getDDHandles : function(){\r
+        return [this.iconNode, this.textNode, this.elNode];\r
+    },\r
+\r
+/**\r
+ * Hides this node.\r
+ */\r
+    hide : function(){\r
+        this.node.hidden = true;\r
+        if(this.wrap){\r
+            this.wrap.style.display = "none";\r
         }\r
-    }\r
-});\r
-Ext.Container.LAYOUTS['fit'] = Ext.layout.FitLayout;\r
+    },\r
 \r
-Ext.layout.CardLayout = Ext.extend(Ext.layout.FitLayout, {\r
-    \r
-    deferredRender : false,\r
+/**\r
+ * Shows this node.\r
+ */\r
+    show : function(){\r
+        this.node.hidden = false;\r
+        if(this.wrap){\r
+            this.wrap.style.display = "";\r
+        } \r
+    },\r
 \r
     // private\r
-    renderHidden : true,\r
-\r
-    \r
-    setActiveItem : function(item){\r
-        item = this.container.getComponent(item);\r
-        if(this.activeItem != item){\r
-            if(this.activeItem){\r
-                this.activeItem.hide();\r
-            }\r
-            this.activeItem = item;\r
-            item.show();\r
-            this.layout();\r
+    onContextMenu : function(e){\r
+        if (this.node.hasListener("contextmenu") || this.node.getOwnerTree().hasListener("contextmenu")) {\r
+            e.preventDefault();\r
+            this.focus();\r
+            this.fireEvent("contextmenu", this.node, e);\r
         }\r
     },\r
 \r
     // private\r
-    renderAll : function(ct, target){\r
-        if(this.deferredRender){\r
-            this.renderItem(this.activeItem, undefined, target);\r
-        }else{\r
-            Ext.layout.CardLayout.superclass.renderAll.call(this, ct, target);\r
+    onClick : function(e){\r
+        if(this.dropping){\r
+            e.stopEvent();\r
+            return;\r
         }\r
-    }\r
-});\r
-Ext.Container.LAYOUTS['card'] = Ext.layout.CardLayout;\r
+        if(this.fireEvent("beforeclick", this.node, e) !== false){\r
+            var a = e.getTarget('a');\r
+            if(!this.disabled && this.node.attributes.href && a){\r
+                this.fireEvent("click", this.node, e);\r
+                return;\r
+            }else if(a && e.ctrlKey){\r
+                e.stopEvent();\r
+            }\r
+            e.preventDefault();\r
+            if(this.disabled){\r
+                return;\r
+            }\r
 \r
-Ext.layout.AnchorLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
-    // private\r
-    monitorResize:true,\r
+            if(this.node.attributes.singleClickExpand && !this.animating && this.node.isExpandable()){\r
+                this.node.toggle();\r
+            }\r
 \r
-    // private\r
-    getAnchorViewSize : function(ct, target){\r
-        return target.dom == document.body ?\r
-                   target.getViewSize() : target.getStyleSize();\r
+            this.fireEvent("click", this.node, e);\r
+        }else{\r
+            e.stopEvent();\r
+        }\r
     },\r
 \r
     // private\r
-    onLayout : function(ct, target){\r
-        Ext.layout.AnchorLayout.superclass.onLayout.call(this, ct, target);\r
-\r
-        var size = this.getAnchorViewSize(ct, target);\r
-\r
-        var w = size.width, h = size.height;\r
-\r
-        if(w < 20 || h < 20){\r
+    onDblClick : function(e){\r
+        e.preventDefault();\r
+        if(this.disabled){\r
             return;\r
         }\r
-\r
-        // find the container anchoring size\r
-        var aw, ah;\r
-        if(ct.anchorSize){\r
-            if(typeof ct.anchorSize == 'number'){\r
-                aw = ct.anchorSize;\r
-            }else{\r
-                aw = ct.anchorSize.width;\r
-                ah = ct.anchorSize.height;\r
-            }\r
-        }else{\r
-            aw = ct.initialConfig.width;\r
-            ah = ct.initialConfig.height;\r
+        if(this.checkbox){\r
+            this.toggleCheck();\r
+        }\r
+        if(!this.animating && this.node.isExpandable()){\r
+            this.node.toggle();\r
         }\r
+        this.fireEvent("dblclick", this.node, e);\r
+    },\r
 \r
-        var cs = ct.items.items, len = cs.length, i, c, a, cw, ch;\r
-        for(i = 0; i < len; i++){\r
-            c = cs[i];\r
-            if(c.anchor){\r
-                a = c.anchorSpec;\r
-                if(!a){ // cache all anchor values\r
-                    var vs = c.anchor.split(' ');\r
-                    c.anchorSpec = a = {\r
-                        right: this.parseAnchor(vs[0], c.initialConfig.width, aw),\r
-                        bottom: this.parseAnchor(vs[1], c.initialConfig.height, ah)\r
-                    };\r
-                }\r
-                cw = a.right ? this.adjustWidthAnchor(a.right(w), c) : undefined;\r
-                ch = a.bottom ? this.adjustHeightAnchor(a.bottom(h), c) : undefined;\r
+    onOver : function(e){\r
+        this.addClass('x-tree-node-over');\r
+    },\r
 \r
-                if(cw || ch){\r
-                    c.setSize(cw || undefined, ch || undefined);\r
-                }\r
-            }\r
-        }\r
+    onOut : function(e){\r
+        this.removeClass('x-tree-node-over');\r
     },\r
 \r
     // private\r
-    parseAnchor : function(a, start, cstart){\r
-        if(a && a != 'none'){\r
-            var last;\r
-            if(/^(r|right|b|bottom)$/i.test(a)){   // standard anchor\r
-                var diff = cstart - start;\r
-                return function(v){\r
-                    if(v !== last){\r
-                        last = v;\r
-                        return v - diff;\r
-                    }\r
-                }\r
-            }else if(a.indexOf('%') != -1){\r
-                var ratio = parseFloat(a.replace('%', ''))*.01;   // percentage\r
-                return function(v){\r
-                    if(v !== last){\r
-                        last = v;\r
-                        return Math.floor(v*ratio);\r
-                    }\r
-                }\r
-            }else{\r
-                a = parseInt(a, 10);\r
-                if(!isNaN(a)){                            // simple offset adjustment\r
-                    return function(v){\r
-                        if(v !== last){\r
-                            last = v;\r
-                            return v + a;\r
-                        }\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return false;\r
+    onCheckChange : function(){\r
+        var checked = this.checkbox.checked;\r
+               // fix for IE6\r
+               this.checkbox.defaultChecked = checked;         \r
+        this.node.attributes.checked = checked;\r
+        this.fireEvent('checkchange', this.node, checked);\r
     },\r
 \r
     // private\r
-    adjustWidthAnchor : function(value, comp){\r
-        return value;\r
+    ecClick : function(e){\r
+        if(!this.animating && this.node.isExpandable()){\r
+            this.node.toggle();\r
+        }\r
     },\r
 \r
     // private\r
-    adjustHeightAnchor : function(value, comp){\r
-        return value;\r
-    }\r
-    \r
+    startDrop : function(){\r
+        this.dropping = true;\r
+    },\r
     \r
-});\r
-Ext.Container.LAYOUTS['anchor'] = Ext.layout.AnchorLayout;\r
-\r
-Ext.layout.ColumnLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
-    // private\r
-    monitorResize:true,\r
-    \r
-    \r
-    extraCls: 'x-column',\r
-\r
-    scrollOffset : 0,\r
+    // delayed drop so the click event doesn't get fired on a drop\r
+    endDrop : function(){ \r
+       setTimeout(function(){\r
+           this.dropping = false;\r
+       }.createDelegate(this), 50); \r
+    },\r
 \r
     // private\r
-    isValidParent : function(c, target){\r
-        return (c.getPositionEl ? c.getPositionEl() : c.getEl()).dom.parentNode == this.innerCt.dom;\r
+    expand : function(){\r
+        this.updateExpandIcon();\r
+        this.ctNode.style.display = "";\r
     },\r
 \r
     // private\r
-    onLayout : function(ct, target){\r
-        var cs = ct.items.items, len = cs.length, c, i;\r
-\r
-        if(!this.innerCt){\r
-            target.addClass('x-column-layout-ct');\r
-\r
-            // the innerCt prevents wrapping and shuffling while\r
-            // the container is resizing\r
-            this.innerCt = target.createChild({cls:'x-column-inner'});\r
-            this.innerCt.createChild({cls:'x-clear'});\r
-        }\r
-        this.renderAll(ct, this.innerCt);\r
-\r
-        var size = Ext.isIE && target.dom != Ext.getBody().dom ? target.getStyleSize() : target.getViewSize();\r
-\r
-        if(size.width < 1 && size.height < 1){ // display none?\r
-            return;\r
-        }\r
-\r
-        var w = size.width - target.getPadding('lr') - this.scrollOffset,\r
-            h = size.height - target.getPadding('tb'),\r
-            pw = w;\r
-\r
-        this.innerCt.setWidth(w);\r
-        \r
-        // some columns can be percentages while others are fixed\r
-        // so we need to make 2 passes\r
-\r
-        for(i = 0; i < len; i++){\r
-            c = cs[i];\r
-            if(!c.columnWidth){\r
-                pw -= (c.getSize().width + c.getEl().getMargins('lr'));\r
-            }\r
+    focus : function(){\r
+        if(!this.node.preventHScroll){\r
+            try{this.anchor.focus();\r
+            }catch(e){}\r
+        }else{\r
+            try{\r
+                var noscroll = this.node.getOwnerTree().getTreeEl().dom;\r
+                var l = noscroll.scrollLeft;\r
+                this.anchor.focus();\r
+                noscroll.scrollLeft = l;\r
+            }catch(e){}\r
         }\r
+    },\r
 \r
-        pw = pw < 0 ? 0 : pw;\r
-\r
-        for(i = 0; i < len; i++){\r
-            c = cs[i];\r
-            if(c.columnWidth){\r
-                c.setSize(Math.floor(c.columnWidth*pw) - c.getEl().getMargins('lr'));\r
-            }\r
+/**\r
+ * Sets the checked status of the tree node to the passed value, or, if no value was passed,\r
+ * toggles the checked status. If the node was rendered with no checkbox, this has no effect.\r
+ * @param {Boolean} (optional) The new checked status.\r
+ */\r
+    toggleCheck : function(value){\r
+        var cb = this.checkbox;\r
+        if(cb){\r
+            cb.checked = (value === undefined ? !cb.checked : value);\r
+            this.onCheckChange();\r
         }\r
-    }\r
-    \r
-    \r
-});\r
-\r
-Ext.Container.LAYOUTS['column'] = Ext.layout.ColumnLayout;\r
+    },\r
 \r
-Ext.layout.BorderLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
-    // private\r
-    monitorResize:true,\r
     // private\r
-    rendered : false,\r
+    blur : function(){\r
+        try{\r
+            this.anchor.blur();\r
+        }catch(e){} \r
+    },\r
 \r
     // private\r
-    onLayout : function(ct, target){\r
-        var collapsed;\r
-        if(!this.rendered){\r
-            target.position();\r
-            target.addClass('x-border-layout-ct');\r
-            var items = ct.items.items;\r
-            collapsed = [];\r
-            for(var i = 0, len = items.length; i < len; i++) {\r
-                var c = items[i];\r
-                var pos = c.region;\r
-                if(c.collapsed){\r
-                    collapsed.push(c);\r
-                }\r
-                c.collapsed = false;\r
-                if(!c.rendered){\r
-                    c.cls = c.cls ? c.cls +' x-border-panel' : 'x-border-panel';\r
-                    c.render(target, i);\r
-                }\r
-                this[pos] = pos != 'center' && c.split ?\r
-                    new Ext.layout.BorderLayout.SplitRegion(this, c.initialConfig, pos) :\r
-                    new Ext.layout.BorderLayout.Region(this, c.initialConfig, pos);\r
-                this[pos].render(target, c);\r
-            }\r
-            this.rendered = true;\r
-        }\r
-\r
-        var size = target.getViewSize();\r
-        if(size.width < 20 || size.height < 20){ // display none?\r
-            if(collapsed){\r
-                this.restoreCollapsed = collapsed;\r
-            }\r
+    animExpand : function(callback){\r
+        var ct = Ext.get(this.ctNode);\r
+        ct.stopFx();\r
+        if(!this.node.isExpandable()){\r
+            this.updateExpandIcon();\r
+            this.ctNode.style.display = "";\r
+            Ext.callback(callback);\r
             return;\r
-        }else if(this.restoreCollapsed){\r
-            collapsed = this.restoreCollapsed;\r
-            delete this.restoreCollapsed;\r
-        }\r
-\r
-        var w = size.width, h = size.height;\r
-        var centerW = w, centerH = h, centerY = 0, centerX = 0;\r
-\r
-        var n = this.north, s = this.south, west = this.west, e = this.east, c = this.center;\r
-        if(!c && Ext.layout.BorderLayout.WARN !== false){\r
-            throw 'No center region defined in BorderLayout ' + ct.id;\r
-        }\r
-\r
-        if(n && n.isVisible()){\r
-            var b = n.getSize();\r
-            var m = n.getMargins();\r
-            b.width = w - (m.left+m.right);\r
-            b.x = m.left;\r
-            b.y = m.top;\r
-            centerY = b.height + b.y + m.bottom;\r
-            centerH -= centerY;\r
-            n.applyLayout(b);\r
-        }\r
-        if(s && s.isVisible()){\r
-            var b = s.getSize();\r
-            var m = s.getMargins();\r
-            b.width = w - (m.left+m.right);\r
-            b.x = m.left;\r
-            var totalHeight = (b.height + m.top + m.bottom);\r
-            b.y = h - totalHeight + m.top;\r
-            centerH -= totalHeight;\r
-            s.applyLayout(b);\r
-        }\r
-        if(west && west.isVisible()){\r
-            var b = west.getSize();\r
-            var m = west.getMargins();\r
-            b.height = centerH - (m.top+m.bottom);\r
-            b.x = m.left;\r
-            b.y = centerY + m.top;\r
-            var totalWidth = (b.width + m.left + m.right);\r
-            centerX += totalWidth;\r
-            centerW -= totalWidth;\r
-            west.applyLayout(b);\r
-        }\r
-        if(e && e.isVisible()){\r
-            var b = e.getSize();\r
-            var m = e.getMargins();\r
-            b.height = centerH - (m.top+m.bottom);\r
-            var totalWidth = (b.width + m.left + m.right);\r
-            b.x = w - totalWidth + m.left;\r
-            b.y = centerY + m.top;\r
-            centerW -= totalWidth;\r
-            e.applyLayout(b);\r
-        }\r
-\r
-        if(c){\r
-            var m = c.getMargins();\r
-            var centerBox = {\r
-                x: centerX + m.left,\r
-                y: centerY + m.top,\r
-                width: centerW - (m.left+m.right),\r
-                height: centerH - (m.top+m.bottom)\r
-            };\r
-            c.applyLayout(centerBox);\r
-        }\r
-        if(collapsed){\r
-            for(var i = 0, len = collapsed.length; i < len; i++){\r
-                collapsed[i].collapse(false);\r
-            }\r
-        }\r
-\r
-        if(Ext.isIE && Ext.isStrict){ // workaround IE strict repainting issue\r
-            target.repaint();\r
         }\r
+        this.animating = true;\r
+        this.updateExpandIcon();\r
+        \r
+        ct.slideIn('t', {\r
+           callback : function(){\r
+               this.animating = false;\r
+               Ext.callback(callback);\r
+            },\r
+            scope: this,\r
+            duration: this.node.ownerTree.duration || .25\r
+        });\r
     },\r
 \r
-    // inherit docs\r
-    destroy: function() {\r
-        var r = ['north', 'south', 'east', 'west'];\r
-        for (var i = 0; i < r.length; i++) {\r
-            var region = this[r[i]];\r
-            if(region){\r
-                if(region.destroy){\r
-                       region.destroy();\r
-                   }else if (region.split){\r
-                       region.split.destroy(true);\r
-                   }\r
-            }\r
-        }\r
-        Ext.layout.BorderLayout.superclass.destroy.call(this);\r
-    }\r
-    \r
-    \r
-});\r
-\r
-\r
-Ext.layout.BorderLayout.Region = function(layout, config, pos){\r
-    Ext.apply(this, config);\r
-    this.layout = layout;\r
-    this.position = pos;\r
-    this.state = {};\r
-    if(typeof this.margins == 'string'){\r
-        this.margins = this.layout.parseMargins(this.margins);\r
-    }\r
-    this.margins = Ext.applyIf(this.margins || {}, this.defaultMargins);\r
-    if(this.collapsible){\r
-        if(typeof this.cmargins == 'string'){\r
-            this.cmargins = this.layout.parseMargins(this.cmargins);\r
-        }\r
-        if(this.collapseMode == 'mini' && !this.cmargins){\r
-            this.cmargins = {left:0,top:0,right:0,bottom:0};\r
-        }else{\r
-            this.cmargins = Ext.applyIf(this.cmargins || {},\r
-                pos == 'north' || pos == 'south' ? this.defaultNSCMargins : this.defaultEWCMargins);\r
-        }\r
-    }\r
-};\r
-\r
-Ext.layout.BorderLayout.Region.prototype = {\r
-    \r
-    \r
-       \r
-    \r
-    \r
-    \r
-    \r
-    collapsible : false,\r
-    \r
-    split:false,\r
-    \r
-    floatable: true,\r
-    \r
-    minWidth:50,\r
-    \r
-    minHeight:50,\r
-\r
-    // private\r
-    defaultMargins : {left:0,top:0,right:0,bottom:0},\r
-    // private\r
-    defaultNSCMargins : {left:5,top:5,right:5,bottom:5},\r
-    // private\r
-    defaultEWCMargins : {left:5,top:0,right:5,bottom:0},\r
-\r
-    \r
-    isCollapsed : false,\r
-\r
-    \r
-    \r
-    \r
-\r
     // private\r
-    render : function(ct, p){\r
-        this.panel = p;\r
-        p.el.enableDisplayMode();\r
-        this.targetEl = ct;\r
-        this.el = p.el;\r
-\r
-        var gs = p.getState, ps = this.position;\r
-        p.getState = function(){\r
-            return Ext.apply(gs.call(p) || {}, this.state);\r
-        }.createDelegate(this);\r
-\r
-        if(ps != 'center'){\r
-            p.allowQueuedExpand = false;\r
-            p.on({\r
-                beforecollapse: this.beforeCollapse,\r
-                collapse: this.onCollapse,\r
-                beforeexpand: this.beforeExpand,\r
-                expand: this.onExpand,\r
-                hide: this.onHide,\r
-                show: this.onShow,\r
-                scope: this\r
-            });\r
-            if(this.collapsible){\r
-                p.collapseEl = 'el';\r
-                p.slideAnchor = this.getSlideAnchor();\r
-            }\r
-            if(p.tools && p.tools.toggle){\r
-                p.tools.toggle.addClass('x-tool-collapse-'+ps);\r
-                p.tools.toggle.addClassOnOver('x-tool-collapse-'+ps+'-over');\r
-            }\r
-        }\r
+    highlight : function(){\r
+        var tree = this.node.getOwnerTree();\r
+        Ext.fly(this.wrap).highlight(\r
+            tree.hlColor || "C3DAF9",\r
+            {endColor: tree.hlBaseColor}\r
+        );\r
     },\r
 \r
     // private\r
-    getCollapsedEl : function(){\r
-        if(!this.collapsedEl){\r
-            if(!this.toolTemplate){\r
-                var tt = new Ext.Template(\r
-                     '<div class="x-tool x-tool-{id}">&#160;</div>'\r
-                );\r
-                tt.disableFormats = true;\r
-                tt.compile();\r
-                Ext.layout.BorderLayout.Region.prototype.toolTemplate = tt;\r
-            }\r
-            this.collapsedEl = this.targetEl.createChild({\r
-                cls: "x-layout-collapsed x-layout-collapsed-"+this.position,\r
-                id: this.panel.id + '-xcollapsed'\r
-            });\r
-            this.collapsedEl.enableDisplayMode('block');\r
-\r
-            if(this.collapseMode == 'mini'){\r
-                this.collapsedEl.addClass('x-layout-cmini-'+this.position);\r
-                this.miniCollapsedEl = this.collapsedEl.createChild({\r
-                    cls: "x-layout-mini x-layout-mini-"+this.position, html: "&#160;"\r
-                });\r
-                this.miniCollapsedEl.addClassOnOver('x-layout-mini-over');\r
-                this.collapsedEl.addClassOnOver("x-layout-collapsed-over");\r
-                this.collapsedEl.on('click', this.onExpandClick, this, {stopEvent:true});\r
-            }else {\r
-                var t = this.toolTemplate.append(\r
-                        this.collapsedEl.dom,\r
-                        {id:'expand-'+this.position}, true);\r
-                t.addClassOnOver('x-tool-expand-'+this.position+'-over');\r
-                t.on('click', this.onExpandClick, this, {stopEvent:true});\r
-                \r
-                if(this.floatable !== false){\r
-                   this.collapsedEl.addClassOnOver("x-layout-collapsed-over");\r
-                   this.collapsedEl.on("click", this.collapseClick, this);\r
-                }\r
-            }\r
-        }\r
-        return this.collapsedEl;\r
+    collapse : function(){\r
+        this.updateExpandIcon();\r
+        this.ctNode.style.display = "none";\r
     },\r
 \r
     // private\r
-    onExpandClick : function(e){\r
-        if(this.isSlid){\r
-            this.afterSlideIn();\r
-            this.panel.expand(false);\r
-        }else{\r
-            this.panel.expand();\r
-        }\r
-    },\r
+    animCollapse : function(callback){\r
+        var ct = Ext.get(this.ctNode);\r
+        ct.enableDisplayMode('block');\r
+        ct.stopFx();\r
 \r
-    // private\r
-    onCollapseClick : function(e){\r
-        this.panel.collapse();\r
-    },\r
+        this.animating = true;\r
+        this.updateExpandIcon();\r
 \r
-    // private\r
-    beforeCollapse : function(p, animate){\r
-        this.lastAnim = animate;\r
-        if(this.splitEl){\r
-            this.splitEl.hide();\r
-        }\r
-        this.getCollapsedEl().show();\r
-        this.panel.el.setStyle('z-index', 100);\r
-        this.isCollapsed = true;\r
-        this.layout.layout();\r
+        ct.slideOut('t', {\r
+            callback : function(){\r
+               this.animating = false;\r
+               Ext.callback(callback);\r
+            },\r
+            scope: this,\r
+            duration: this.node.ownerTree.duration || .25\r
+        });\r
     },\r
 \r
     // private\r
-    onCollapse : function(animate){\r
-        this.panel.el.setStyle('z-index', 1);\r
-        if(this.lastAnim === false || this.panel.animCollapse === false){\r
-            this.getCollapsedEl().dom.style.visibility = 'visible';\r
-        }else{\r
-            this.getCollapsedEl().slideIn(this.panel.slideAnchor, {duration:.2});\r
-        }\r
-        this.state.collapsed = true;\r
-        this.panel.saveState();\r
+    getContainer : function(){\r
+        return this.ctNode;  \r
     },\r
 \r
     // private\r
-    beforeExpand : function(animate){\r
-        var c = this.getCollapsedEl();\r
-        this.el.show();\r
-        if(this.position == 'east' || this.position == 'west'){\r
-            this.panel.setSize(undefined, c.getHeight());\r
-        }else{\r
-            this.panel.setSize(c.getWidth(), undefined);\r
-        }\r
-        c.hide();\r
-        c.dom.style.visibility = 'hidden';\r
-        this.panel.el.setStyle('z-index', 100);\r
+    getEl : function(){\r
+        return this.wrap;  \r
     },\r
 \r
     // private\r
-    onExpand : function(){\r
-        this.isCollapsed = false;\r
-        if(this.splitEl){\r
-            this.splitEl.show();\r
-        }\r
-        this.layout.layout();\r
-        this.panel.el.setStyle('z-index', 1);\r
-        this.state.collapsed = false;\r
-        this.panel.saveState();\r
+    appendDDGhost : function(ghostNode){\r
+        ghostNode.appendChild(this.elNode.cloneNode(true));\r
     },\r
 \r
     // private\r
-    collapseClick : function(e){\r
-        if(this.isSlid){\r
-           e.stopPropagation();\r
-           this.slideIn();\r
-        }else{\r
-           e.stopPropagation();\r
-           this.slideOut();\r
-        }\r
+    getDDRepairXY : function(){\r
+        return Ext.lib.Dom.getXY(this.iconNode);\r
     },\r
 \r
     // private\r
-    onHide : function(){\r
-        if(this.isCollapsed){\r
-            this.getCollapsedEl().hide();\r
-        }else if(this.splitEl){\r
-            this.splitEl.hide();\r
-        }\r
+    onRender : function(){\r
+        this.render();    \r
     },\r
 \r
     // private\r
-    onShow : function(){\r
-        if(this.isCollapsed){\r
-            this.getCollapsedEl().show();\r
-        }else if(this.splitEl){\r
-            this.splitEl.show();\r
-        }\r
-    },\r
-\r
-    \r
-    isVisible : function(){\r
-        return !this.panel.hidden;\r
-    },\r
-\r
-    \r
-    getMargins : function(){\r
-        return this.isCollapsed && this.cmargins ? this.cmargins : this.margins;\r
-    },\r
-\r
-    \r
-    getSize : function(){\r
-        return this.isCollapsed ? this.getCollapsedEl().getSize() : this.panel.getSize();\r
-    },\r
+    render : function(bulkRender){\r
+        var n = this.node, a = n.attributes;\r
+        var targetNode = n.parentNode ? \r
+              n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom;\r
+        \r
+        if(!this.rendered){\r
+            this.rendered = true;\r
 \r
-    \r
-    setPanel : function(panel){\r
-        this.panel = panel;\r
-    },\r
+            this.renderElements(n, a, targetNode, bulkRender);\r
 \r
-    \r
-    getMinWidth: function(){\r
-        return this.minWidth;\r
-    },\r
-\r
-    \r
-    getMinHeight: function(){\r
-        return this.minHeight;\r
+            if(a.qtip){\r
+               if(this.textNode.setAttributeNS){\r
+                   this.textNode.setAttributeNS("ext", "qtip", a.qtip);\r
+                   if(a.qtipTitle){\r
+                       this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle);\r
+                   }\r
+               }else{\r
+                   this.textNode.setAttribute("ext:qtip", a.qtip);\r
+                   if(a.qtipTitle){\r
+                       this.textNode.setAttribute("ext:qtitle", a.qtipTitle);\r
+                   }\r
+               } \r
+            }else if(a.qtipCfg){\r
+                a.qtipCfg.target = Ext.id(this.textNode);\r
+                Ext.QuickTips.register(a.qtipCfg);\r
+            }\r
+            this.initEvents();\r
+            if(!this.node.expanded){\r
+                this.updateExpandIcon(true);\r
+            }\r
+        }else{\r
+            if(bulkRender === true) {\r
+                targetNode.appendChild(this.wrap);\r
+            }\r
+        }\r
     },\r
 \r
     // private\r
-    applyLayoutCollapsed : function(box){\r
-        var ce = this.getCollapsedEl();\r
-        ce.setLeftTop(box.x, box.y);\r
-        ce.setSize(box.width, box.height);\r
-    },\r
+    renderElements : function(n, a, targetNode, bulkRender){\r
+        // add some indent caching, this helps performance when rendering a large tree\r
+        this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';\r
 \r
-    // private\r
-    applyLayout : function(box){\r
-        if(this.isCollapsed){\r
-            this.applyLayoutCollapsed(box);\r
+        var cb = typeof a.checked == 'boolean';\r
+\r
+        var href = a.href ? a.href : Ext.isGecko ? "" : "#";\r
+        var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',\r
+            '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",\r
+            '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',\r
+            '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',\r
+            cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',\r
+            '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',\r
+             a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",\r
+            '<ul class="x-tree-node-ct" style="display:none;"></ul>',\r
+            "</li>"].join('');\r
+\r
+        var nel;\r
+        if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){\r
+            this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);\r
         }else{\r
-            this.panel.setPosition(box.x, box.y);\r
-            this.panel.setSize(box.width, box.height);\r
+            this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);\r
+        }\r
+        \r
+        this.elNode = this.wrap.childNodes[0];\r
+        this.ctNode = this.wrap.childNodes[1];\r
+        var cs = this.elNode.childNodes;\r
+        this.indentNode = cs[0];\r
+        this.ecNode = cs[1];\r
+        this.iconNode = cs[2];\r
+        var index = 3;\r
+        if(cb){\r
+            this.checkbox = cs[3];\r
+                       // fix for IE6\r
+                       this.checkbox.defaultChecked = this.checkbox.checked;                                           \r
+            index++;\r
         }\r
+        this.anchor = cs[index];\r
+        this.textNode = cs[index].firstChild;\r
     },\r
 \r
-    // private\r
-    beforeSlide: function(){\r
-        this.panel.beforeEffect();\r
+/**\r
+ * Returns the &lt;a> element that provides focus for the node's UI.\r
+ * @return {HtmlElement} The DOM anchor element.\r
+ */\r
+    getAnchor : function(){\r
+        return this.anchor;\r
+    },\r
+    \r
+/**\r
+ * Returns the text node.\r
+ * @return {HtmlNode} The DOM text node.\r
+ */\r
+    getTextEl : function(){\r
+        return this.textNode;\r
+    },\r
+    \r
+/**\r
+ * Returns the icon &lt;img> element.\r
+ * @return {HtmlElement} The DOM image element.\r
+ */\r
+    getIconEl : function(){\r
+        return this.iconNode;\r
     },\r
 \r
-    // private\r
-    afterSlide : function(){\r
-        this.panel.afterEffect();\r
+/**\r
+ * Returns the checked status of the node. If the node was rendered with no\r
+ * checkbox, it returns false.\r
+ * @return {Boolean} The checked flag.\r
+ */\r
+    isChecked : function(){\r
+        return this.checkbox ? this.checkbox.checked : false; \r
     },\r
 \r
     // private\r
-    initAutoHide : function(){\r
-        if(this.autoHide !== false){\r
-            if(!this.autoHideHd){\r
-                var st = new Ext.util.DelayedTask(this.slideIn, this);\r
-                this.autoHideHd = {\r
-                    "mouseout": function(e){\r
-                        if(!e.within(this.el, true)){\r
-                            st.delay(500);\r
-                        }\r
-                    },\r
-                    "mouseover" : function(e){\r
-                        st.cancel();\r
-                    },\r
-                    scope : this\r
-                };\r
+    updateExpandIcon : function(){\r
+        if(this.rendered){\r
+            var n = this.node, c1, c2;\r
+            var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow";\r
+            var hasChild = n.hasChildNodes();\r
+            if(hasChild || n.attributes.expandable){\r
+                if(n.expanded){\r
+                    cls += "-minus";\r
+                    c1 = "x-tree-node-collapsed";\r
+                    c2 = "x-tree-node-expanded";\r
+                }else{\r
+                    cls += "-plus";\r
+                    c1 = "x-tree-node-expanded";\r
+                    c2 = "x-tree-node-collapsed";\r
+                }\r
+                if(this.wasLeaf){\r
+                    this.removeClass("x-tree-node-leaf");\r
+                    this.wasLeaf = false;\r
+                }\r
+                if(this.c1 != c1 || this.c2 != c2){\r
+                    Ext.fly(this.elNode).replaceClass(c1, c2);\r
+                    this.c1 = c1; this.c2 = c2;\r
+                }\r
+            }else{\r
+                if(!this.wasLeaf){\r
+                    Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf");\r
+                    delete this.c1;\r
+                    delete this.c2;\r
+                    this.wasLeaf = true;\r
+                }\r
+            }\r
+            var ecc = "x-tree-ec-icon "+cls;\r
+            if(this.ecc != ecc){\r
+                this.ecNode.className = ecc;\r
+                this.ecc = ecc;\r
             }\r
-            this.el.on(this.autoHideHd);\r
         }\r
     },\r
-\r
+    \r
     // private\r
-    clearAutoHide : function(){\r
-        if(this.autoHide !== false){\r
-            this.el.un("mouseout", this.autoHideHd.mouseout);\r
-            this.el.un("mouseover", this.autoHideHd.mouseover);\r
+    onIdChange: function(id){\r
+        if(this.rendered){\r
+            this.elNode.setAttribute('ext:tree-node-id', id);\r
         }\r
     },\r
 \r
     // private\r
-    clearMonitor : function(){\r
-        Ext.getDoc().un("click", this.slideInIf, this);\r
-    },\r
-\r
-    // these names are backwards but not changed for compat\r
-    // private\r
-    slideOut : function(){\r
-        if(this.isSlid || this.el.hasActiveFx()){\r
-            return;\r
-        }\r
-        this.isSlid = true;\r
-        var ts = this.panel.tools;\r
-        if(ts && ts.toggle){\r
-            ts.toggle.hide();\r
-        }\r
-        this.el.show();\r
-        if(this.position == 'east' || this.position == 'west'){\r
-            this.panel.setSize(undefined, this.collapsedEl.getHeight());\r
-        }else{\r
-            this.panel.setSize(this.collapsedEl.getWidth(), undefined);\r
-        }\r
-        this.restoreLT = [this.el.dom.style.left, this.el.dom.style.top];\r
-        this.el.alignTo(this.collapsedEl, this.getCollapseAnchor());\r
-        this.el.setStyle("z-index", 102);\r
-        this.panel.el.replaceClass('x-panel-collapsed', 'x-panel-floating');\r
-        if(this.animFloat !== false){\r
-            this.beforeSlide();\r
-            this.el.slideIn(this.getSlideAnchor(), {\r
-                callback: function(){\r
-                    this.afterSlide();\r
-                    this.initAutoHide();\r
-                    Ext.getDoc().on("click", this.slideInIf, this);\r
-                },\r
-                scope: this,\r
-                block: true\r
-            });\r
-        }else{\r
-            this.initAutoHide();\r
-             Ext.getDoc().on("click", this.slideInIf, this);\r
+    getChildIndent : function(){\r
+        if(!this.childIndent){\r
+            var buf = [];\r
+            var p = this.node;\r
+            while(p){\r
+                if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){\r
+                    if(!p.isLast()) {\r
+                        buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');\r
+                    } else {\r
+                        buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');\r
+                    }\r
+                }\r
+                p = p.parentNode;\r
+            }\r
+            this.childIndent = buf.join("");\r
         }\r
+        return this.childIndent;\r
     },\r
 \r
     // private\r
-    afterSlideIn : function(){\r
-        this.clearAutoHide();\r
-        this.isSlid = false;\r
-        this.clearMonitor();\r
-        this.el.setStyle("z-index", "");\r
-        this.panel.el.replaceClass('x-panel-floating', 'x-panel-collapsed');\r
-        this.el.dom.style.left = this.restoreLT[0];\r
-        this.el.dom.style.top = this.restoreLT[1];\r
-\r
-        var ts = this.panel.tools;\r
-        if(ts && ts.toggle){\r
-            ts.toggle.show();\r
+    renderIndent : function(){\r
+        if(this.rendered){\r
+            var indent = "";\r
+            var p = this.node.parentNode;\r
+            if(p){\r
+                indent = p.ui.getChildIndent();\r
+            }\r
+            if(this.indentMarkup != indent){ // don't rerender if not required\r
+                this.indentNode.innerHTML = indent;\r
+                this.indentMarkup = indent;\r
+            }\r
+            this.updateExpandIcon();\r
         }\r
     },\r
 \r
-    // private\r
-    slideIn : function(cb){\r
-        if(!this.isSlid || this.el.hasActiveFx()){\r
-            Ext.callback(cb);\r
-            return;\r
+    destroy : function(){\r
+        if(this.elNode){\r
+            Ext.dd.Registry.unregister(this.elNode.id);\r
         }\r
-        this.isSlid = false;\r
-        if(this.animFloat !== false){\r
-            this.beforeSlide();\r
-            this.el.slideOut(this.getSlideAnchor(), {\r
-                callback: function(){\r
-                    this.el.hide();\r
-                    this.afterSlide();\r
-                    this.afterSlideIn();\r
-                    Ext.callback(cb);\r
-                },\r
-                scope: this,\r
-                block: true\r
-            });\r
+        delete this.elNode;\r
+        delete this.ctNode;\r
+        delete this.indentNode;\r
+        delete this.ecNode;\r
+        delete this.iconNode;\r
+        delete this.checkbox;\r
+        delete this.anchor;\r
+        delete this.textNode;\r
+        \r
+        if (this.holder){\r
+             delete this.wrap;\r
+             Ext.removeNode(this.holder);\r
+             delete this.holder;\r
         }else{\r
-            this.el.hide();\r
-            this.afterSlideIn();\r
+            Ext.removeNode(this.wrap);\r
+            delete this.wrap;\r
         }\r
-    },\r
+    }\r
+};\r
 \r
+/**\r
+ * @class Ext.tree.RootTreeNodeUI\r
+ * This class provides the default UI implementation for <b>root</b> Ext TreeNodes.\r
+ * The RootTreeNode UI implementation allows customizing the appearance of the root tree node.<br>\r
+ * <p>\r
+ * If you are customizing the Tree's user interface, you\r
+ * may need to extend this class, but you should never need to instantiate this class.<br>\r
+ */\r
+Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {\r
     // private\r
-    slideInIf : function(e){\r
-        if(!e.within(this.el)){\r
-            this.slideIn();\r
+    render : function(){\r
+        if(!this.rendered){\r
+            var targetNode = this.node.ownerTree.innerCt.dom;\r
+            this.node.expanded = true;\r
+            targetNode.innerHTML = '<div class="x-tree-root-node"></div>';\r
+            this.wrap = this.ctNode = targetNode.firstChild;\r
         }\r
     },\r
+    collapse : Ext.emptyFn,\r
+    expand : Ext.emptyFn\r
+});/**\r
+ * @class Ext.tree.TreeLoader\r
+ * @extends Ext.util.Observable\r
+ * A TreeLoader provides for lazy loading of an {@link Ext.tree.TreeNode}'s child\r
+ * nodes from a specified URL. The response must be a JavaScript Array definition\r
+ * whose elements are node definition objects. e.g.:\r
+ * <pre><code>\r
+    [{\r
+        id: 1,\r
+        text: 'A leaf Node',\r
+        leaf: true\r
+    },{\r
+        id: 2,\r
+        text: 'A folder Node',\r
+        children: [{\r
+            id: 3,\r
+            text: 'A child Node',\r
+            leaf: true\r
+        }]\r
+   }]\r
+</code></pre>\r
+ * <br><br>\r
+ * A server request is sent, and child nodes are loaded only when a node is expanded.\r
+ * The loading node's id is passed to the server under the parameter name "node" to\r
+ * enable the server to produce the correct child nodes.\r
+ * <br><br>\r
+ * To pass extra parameters, an event handler may be attached to the "beforeload"\r
+ * event, and the parameters specified in the TreeLoader's baseParams property:\r
+ * <pre><code>\r
+    myTreeLoader.on("beforeload", function(treeLoader, node) {\r
+        this.baseParams.category = node.attributes.category;\r
+    }, this);\r
+</code></pre>\r
+ * This would pass an HTTP parameter called "category" to the server containing\r
+ * the value of the Node's "category" attribute.\r
+ * @constructor\r
+ * Creates a new Treeloader.\r
+ * @param {Object} config A config object containing config properties.\r
+ */\r
+Ext.tree.TreeLoader = function(config){\r
+    this.baseParams = {};\r
+    Ext.apply(this, config);\r
 \r
-    // private\r
-    anchors : {\r
-        "west" : "left",\r
-        "east" : "right",\r
-        "north" : "top",\r
-        "south" : "bottom"\r
-    },\r
-\r
-    // private\r
-    sanchors : {\r
-        "west" : "l",\r
-        "east" : "r",\r
-        "north" : "t",\r
-        "south" : "b"\r
-    },\r
+    this.addEvents(\r
+        /**\r
+         * @event beforeload\r
+         * Fires before a network request is made to retrieve the Json text which specifies a node's children.\r
+         * @param {Object} This TreeLoader object.\r
+         * @param {Object} node The {@link Ext.tree.TreeNode} object being loaded.\r
+         * @param {Object} callback The callback function specified in the {@link #load} call.\r
+         */\r
+        "beforeload",\r
+        /**\r
+         * @event load\r
+         * Fires when the node has been successfuly loaded.\r
+         * @param {Object} This TreeLoader object.\r
+         * @param {Object} node The {@link Ext.tree.TreeNode} object being loaded.\r
+         * @param {Object} response The response object containing the data from the server.\r
+         */\r
+        "load",\r
+        /**\r
+         * @event loadexception\r
+         * Fires if the network request failed.\r
+         * @param {Object} This TreeLoader object.\r
+         * @param {Object} node The {@link Ext.tree.TreeNode} object being loaded.\r
+         * @param {Object} response The response object containing the data from the server.\r
+         */\r
+        "loadexception"\r
+    );\r
+    Ext.tree.TreeLoader.superclass.constructor.call(this);\r
+    if(typeof this.paramOrder == 'string'){\r
+        this.paramOrder = this.paramOrder.split(/[\s,|]/);\r
+    }\r
+};\r
 \r
-    // private\r
-    canchors : {\r
-        "west" : "tl-tr",\r
-        "east" : "tr-tl",\r
-        "north" : "tl-bl",\r
-        "south" : "bl-tl"\r
-    },\r
+Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, {\r
+    /**\r
+    * @cfg {String} dataUrl The URL from which to request a Json string which\r
+    * specifies an array of node definition objects representing the child nodes\r
+    * to be loaded.\r
+    */\r
+    /**\r
+     * @cfg {String} requestMethod The HTTP request method for loading data (defaults to the value of {@link Ext.Ajax#method}).\r
+     */\r
+    /**\r
+     * @cfg {String} url Equivalent to {@link #dataUrl}.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} preloadChildren If set to true, the loader recursively loads "children" attributes when doing the first load on nodes.\r
+     */\r
+    /**\r
+    * @cfg {Object} baseParams (optional) An object containing properties which\r
+    * specify HTTP parameters to be passed to each request for child nodes.\r
+    */\r
+    /**\r
+    * @cfg {Object} baseAttrs (optional) An object containing attributes to be added to all nodes\r
+    * created by this loader. If the attributes sent by the server have an attribute in this object,\r
+    * they take priority.\r
+    */\r
+    /**\r
+    * @cfg {Object} uiProviders (optional) An object containing properties which\r
+    * specify custom {@link Ext.tree.TreeNodeUI} implementations. If the optional\r
+    * <i>uiProvider</i> attribute of a returned child node is a string rather\r
+    * than a reference to a TreeNodeUI implementation, then that string value\r
+    * is used as a property name in the uiProviders object.\r
+    */\r
+    uiProviders : {},\r
 \r
-    // private\r
-    getAnchor : function(){\r
-        return this.anchors[this.position];\r
-    },\r
+    /**\r
+    * @cfg {Boolean} clearOnLoad (optional) Default to true. Remove previously existing\r
+    * child nodes before loading.\r
+    */\r
+    clearOnLoad : true,\r
 \r
-    // private\r
-    getCollapseAnchor : function(){\r
-        return this.canchors[this.position];\r
+    /**\r
+     * @cfg {Array/String} paramOrder Defaults to <tt>undefined</tt>. Only used when using directFn.\r
+     * A list of params to be executed\r
+     * server side.  Specify the params in the order in which they must be executed on the server-side\r
+     * as either (1) an Array of String values, or (2) a String of params delimited by either whitespace,\r
+     * comma, or pipe. For example,\r
+     * any of the following would be acceptable:<pre><code>\r
+paramOrder: ['param1','param2','param3']\r
+paramOrder: 'param1 param2 param3'\r
+paramOrder: 'param1,param2,param3'\r
+paramOrder: 'param1|param2|param'\r
+     </code></pre>\r
+     */\r
+    paramOrder: undefined,\r
+\r
+    /**\r
+     * @cfg {Boolean} paramsAsHash Only used when using directFn.\r
+     * Send parameters as a collection of named arguments (defaults to <tt>false</tt>). Providing a\r
+     * <tt>{@link #paramOrder}</tt> nullifies this configuration.\r
+     */\r
+    paramsAsHash: false,\r
+\r
+    /**\r
+     * @cfg {Function} directFn\r
+     * Function to call when executing a request.\r
+     */\r
+    directFn : undefined,\r
+\r
+    /**\r
+     * Load an {@link Ext.tree.TreeNode} from the URL specified in the constructor.\r
+     * This is called automatically when a node is expanded, but may be used to reload\r
+     * a node (or append new children if the {@link #clearOnLoad} option is false.)\r
+     * @param {Ext.tree.TreeNode} node\r
+     * @param {Function} callback\r
+     * @param (Object) scope\r
+     */\r
+    load : function(node, callback, scope){\r
+        if(this.clearOnLoad){\r
+            while(node.firstChild){\r
+                node.removeChild(node.firstChild);\r
+            }\r
+        }\r
+        if(this.doPreload(node)){ // preloaded json children\r
+            this.runCallback(callback, scope || node, []);\r
+        }else if(this.directFn || this.dataUrl || this.url){\r
+            this.requestData(node, callback, scope || node);\r
+        }\r
     },\r
 \r
-    // private\r
-    getSlideAnchor : function(){\r
-        return this.sanchors[this.position];\r
+    doPreload : function(node){\r
+        if(node.attributes.children){\r
+            if(node.childNodes.length < 1){ // preloaded?\r
+                var cs = node.attributes.children;\r
+                node.beginUpdate();\r
+                for(var i = 0, len = cs.length; i < len; i++){\r
+                    var cn = node.appendChild(this.createNode(cs[i]));\r
+                    if(this.preloadChildren){\r
+                        this.doPreload(cn);\r
+                    }\r
+                }\r
+                node.endUpdate();\r
+            }\r
+            return true;\r
+        }\r
+        return false;\r
     },\r
 \r
-    // private\r
-    getAlignAdj : function(){\r
-        var cm = this.cmargins;\r
-        switch(this.position){\r
-            case "west":\r
-                return [0, 0];\r
-            break;\r
-            case "east":\r
-                return [0, 0];\r
-            break;\r
-            case "north":\r
-                return [0, 0];\r
-            break;\r
-            case "south":\r
-                return [0, 0];\r
-            break;\r
+    getParams: function(node){\r
+        var buf = [], bp = this.baseParams;\r
+        if(this.directFn){\r
+            buf.push(node.id);\r
+            if(bp){\r
+                if(this.paramOrder){\r
+                    for(var i = 0, len = this.paramOrder.length; i < len; i++){\r
+                        buf.push(bp[this.paramOrder[i]]);\r
+                    }\r
+                }else if(this.paramsAsHash){\r
+                    buf.push(bp);\r
+                }\r
+            }\r
+            return buf;\r
+        }else{\r
+            for(var key in bp){\r
+                if(!Ext.isFunction(bp[key])){\r
+                    buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&");\r
+                }\r
+            }\r
+            buf.push("node=", encodeURIComponent(node.id));\r
+            return buf.join("");\r
         }\r
     },\r
 \r
-    // private\r
-    getExpandAdj : function(){\r
-        var c = this.collapsedEl, cm = this.cmargins;\r
-        switch(this.position){\r
-            case "west":\r
-                return [-(cm.right+c.getWidth()+cm.left), 0];\r
-            break;\r
-            case "east":\r
-                return [cm.right+c.getWidth()+cm.left, 0];\r
-            break;\r
-            case "north":\r
-                return [0, -(cm.top+cm.bottom+c.getHeight())];\r
-            break;\r
-            case "south":\r
-                return [0, cm.top+cm.bottom+c.getHeight()];\r
-            break;\r
+    requestData : function(node, callback, scope){\r
+        if(this.fireEvent("beforeload", this, node, callback) !== false){\r
+            if(this.directFn){\r
+                var args = this.getParams(node);\r
+                args.push(this.processDirectResponse.createDelegate(this, [{callback: callback, node: node, scope: scope}], true));\r
+                this.directFn.apply(window, args);\r
+            }else{\r
+                this.transId = Ext.Ajax.request({\r
+                    method:this.requestMethod,\r
+                    url: this.dataUrl||this.url,\r
+                    success: this.handleResponse,\r
+                    failure: this.handleFailure,\r
+                    scope: this,\r
+                    argument: {callback: callback, node: node, scope: scope},\r
+                    params: this.getParams(node)\r
+                });\r
+            }\r
+        }else{\r
+            // if the load is cancelled, make sure we notify\r
+            // the node that we are done\r
+            this.runCallback(callback, scope || node, []);\r
         }\r
-    }\r
-};\r
-\r
-\r
-Ext.layout.BorderLayout.SplitRegion = function(layout, config, pos){\r
-    Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this, layout, config, pos);\r
-    // prevent switch\r
-    this.applyLayout = this.applyFns[pos];\r
-};\r
-\r
-Ext.extend(Ext.layout.BorderLayout.SplitRegion, Ext.layout.BorderLayout.Region, {\r
-    \r
-    splitTip : "Drag to resize.",\r
-    \r
-    collapsibleSplitTip : "Drag to resize. Double click to hide.",\r
-    \r
-    useSplitTips : false,\r
+    },\r
 \r
-    // private\r
-    splitSettings : {\r
-        north : {\r
-            orientation: Ext.SplitBar.VERTICAL,\r
-            placement: Ext.SplitBar.TOP,\r
-            maxFn : 'getVMaxSize',\r
-            minProp: 'minHeight',\r
-            maxProp: 'maxHeight'\r
-        },\r
-        south : {\r
-            orientation: Ext.SplitBar.VERTICAL,\r
-            placement: Ext.SplitBar.BOTTOM,\r
-            maxFn : 'getVMaxSize',\r
-            minProp: 'minHeight',\r
-            maxProp: 'maxHeight'\r
-        },\r
-        east : {\r
-            orientation: Ext.SplitBar.HORIZONTAL,\r
-            placement: Ext.SplitBar.RIGHT,\r
-            maxFn : 'getHMaxSize',\r
-            minProp: 'minWidth',\r
-            maxProp: 'maxWidth'\r
-        },\r
-        west : {\r
-            orientation: Ext.SplitBar.HORIZONTAL,\r
-            placement: Ext.SplitBar.LEFT,\r
-            maxFn : 'getHMaxSize',\r
-            minProp: 'minWidth',\r
-            maxProp: 'maxWidth'\r
+    processDirectResponse: function(result, response, args){\r
+        if(response.status){\r
+            this.handleResponse({\r
+                responseData: Ext.isArray(result) ? result : null,\r
+                responseText: result,\r
+                argument: args\r
+            });\r
+        }else{\r
+            this.handleFailure({\r
+                argument: args\r
+            });\r
         }\r
     },\r
 \r
     // private\r
-    applyFns : {\r
-        west : function(box){\r
-            if(this.isCollapsed){\r
-                return this.applyLayoutCollapsed(box);\r
-            }\r
-            var sd = this.splitEl.dom, s = sd.style;\r
-            this.panel.setPosition(box.x, box.y);\r
-            var sw = sd.offsetWidth;\r
-            s.left = (box.x+box.width-sw)+'px';\r
-            s.top = (box.y)+'px';\r
-            s.height = Math.max(0, box.height)+'px';\r
-            this.panel.setSize(box.width-sw, box.height);\r
-        },\r
-        east : function(box){\r
-            if(this.isCollapsed){\r
-                return this.applyLayoutCollapsed(box);\r
-            }\r
-            var sd = this.splitEl.dom, s = sd.style;\r
-            var sw = sd.offsetWidth;\r
-            this.panel.setPosition(box.x+sw, box.y);\r
-            s.left = (box.x)+'px';\r
-            s.top = (box.y)+'px';\r
-            s.height = Math.max(0, box.height)+'px';\r
-            this.panel.setSize(box.width-sw, box.height);\r
-        },\r
-        north : function(box){\r
-            if(this.isCollapsed){\r
-                return this.applyLayoutCollapsed(box);\r
-            }\r
-            var sd = this.splitEl.dom, s = sd.style;\r
-            var sh = sd.offsetHeight;\r
-            this.panel.setPosition(box.x, box.y);\r
-            s.left = (box.x)+'px';\r
-            s.top = (box.y+box.height-sh)+'px';\r
-            s.width = Math.max(0, box.width)+'px';\r
-            this.panel.setSize(box.width, box.height-sh);\r
-        },\r
-        south : function(box){\r
-            if(this.isCollapsed){\r
-                return this.applyLayoutCollapsed(box);\r
-            }\r
-            var sd = this.splitEl.dom, s = sd.style;\r
-            var sh = sd.offsetHeight;\r
-            this.panel.setPosition(box.x, box.y+sh);\r
-            s.left = (box.x)+'px';\r
-            s.top = (box.y)+'px';\r
-            s.width = Math.max(0, box.width)+'px';\r
-            this.panel.setSize(box.width, box.height-sh);\r
+    runCallback: function(cb, scope, args){\r
+        if(Ext.isFunction(cb)){\r
+            cb.apply(scope, args);\r
         }\r
     },\r
 \r
-    // private\r
-    render : function(ct, p){\r
-        Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this, ct, p);\r
-\r
-        var ps = this.position;\r
-\r
-        this.splitEl = ct.createChild({\r
-            cls: "x-layout-split x-layout-split-"+ps, html: "&#160;",\r
-            id: this.panel.id + '-xsplit'\r
-        });\r
+    isLoading : function(){\r
+        return !!this.transId;\r
+    },\r
 \r
-        if(this.collapseMode == 'mini'){\r
-            this.miniSplitEl = this.splitEl.createChild({\r
-                cls: "x-layout-mini x-layout-mini-"+ps, html: "&#160;"\r
-            });\r
-            this.miniSplitEl.addClassOnOver('x-layout-mini-over');\r
-            this.miniSplitEl.on('click', this.onCollapseClick, this, {stopEvent:true});\r
+    abort : function(){\r
+        if(this.isLoading()){\r
+            Ext.Ajax.abort(this.transId);\r
         }\r
+    },\r
 \r
-        var s = this.splitSettings[ps];\r
-\r
-        this.split = new Ext.SplitBar(this.splitEl.dom, p.el, s.orientation);\r
-        this.split.placement = s.placement;\r
-        this.split.getMaximumSize = this[s.maxFn].createDelegate(this);\r
-        this.split.minSize = this.minSize || this[s.minProp];\r
-        this.split.on("beforeapply", this.onSplitMove, this);\r
-        this.split.useShim = this.useShim === true;\r
-        this.maxSize = this.maxSize || this[s.maxProp];\r
-\r
-        if(p.hidden){\r
-            this.splitEl.hide();\r
+    /**\r
+    * <p>Override this function for custom TreeNode node implementation, or to\r
+    * modify the attributes at creation time.</p>\r
+    * Example:<pre><code>\r
+new Ext.tree.TreePanel({\r
+    ...\r
+    new Ext.tree.TreeLoader({\r
+        url: 'dataUrl',\r
+        createNode: function(attr) {\r
+//          Allow consolidation consignments to have\r
+//          consignments dropped into them.\r
+            if (attr.isConsolidation) {\r
+                attr.iconCls = 'x-consol',\r
+                attr.allowDrop = true;\r
+            }\r
+            return Ext.tree.TreeLoader.prototype.call(this, attr);\r
         }\r
-\r
-        if(this.useSplitTips){\r
-            this.splitEl.dom.title = this.collapsible ? this.collapsibleSplitTip : this.splitTip;\r
+    }),\r
+    ...\r
+});\r
+</code></pre>\r
+    * @param attr {Object} The attributes from which to create the new node.\r
+    */\r
+    createNode : function(attr){\r
+        // apply baseAttrs, nice idea Corey!\r
+        if(this.baseAttrs){\r
+            Ext.applyIf(attr, this.baseAttrs);\r
         }\r
-        if(this.collapsible){\r
-            this.splitEl.on("dblclick", this.onCollapseClick,  this);\r
+        if(this.applyLoader !== false){\r
+            attr.loader = this;\r
         }\r
-    },\r
-\r
-    //docs inherit from superclass\r
-    getSize : function(){\r
-        if(this.isCollapsed){\r
-            return this.collapsedEl.getSize();\r
+        if(typeof attr.uiProvider == 'string'){\r
+           attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);\r
         }\r
-        var s = this.panel.getSize();\r
-        if(this.position == 'north' || this.position == 'south'){\r
-            s.height += this.splitEl.dom.offsetHeight;\r
+        if(attr.nodeType){\r
+            return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);\r
         }else{\r
-            s.width += this.splitEl.dom.offsetWidth;\r
+            return attr.leaf ?\r
+                        new Ext.tree.TreeNode(attr) :\r
+                        new Ext.tree.AsyncTreeNode(attr);\r
         }\r
-        return s;\r
     },\r
 \r
-    // private\r
-    getHMaxSize : function(){\r
-         var cmax = this.maxSize || 10000;\r
-         var center = this.layout.center;\r
-         return Math.min(cmax, (this.el.getWidth()+center.el.getWidth())-center.getMinWidth());\r
+    processResponse : function(response, node, callback, scope){\r
+        var json = response.responseText;\r
+        try {\r
+            var o = response.responseData || Ext.decode(json);\r
+            node.beginUpdate();\r
+            for(var i = 0, len = o.length; i < len; i++){\r
+                var n = this.createNode(o[i]);\r
+                if(n){\r
+                    node.appendChild(n);\r
+                }\r
+            }\r
+            node.endUpdate();\r
+            this.runCallback(callback, scope || node, [node]);\r
+        }catch(e){\r
+            this.handleFailure(response);\r
+        }\r
     },\r
 \r
-    // private\r
-    getVMaxSize : function(){\r
-        var cmax = this.maxSize || 10000;\r
-        var center = this.layout.center;\r
-        return Math.min(cmax, (this.el.getHeight()+center.el.getHeight())-center.getMinHeight());\r
+    handleResponse : function(response){\r
+        this.transId = false;\r
+        var a = response.argument;\r
+        this.processResponse(response, a.node, a.callback, a.scope);\r
+        this.fireEvent("load", this, a.node, response);\r
     },\r
 \r
-    // private\r
-    onSplitMove : function(split, newSize){\r
-        var s = this.panel.getSize();\r
-        this.lastSplitSize = newSize;\r
-        if(this.position == 'north' || this.position == 'south'){\r
-            this.panel.setSize(s.width, newSize);\r
-            this.state.height = newSize;\r
+    handleFailure : function(response){\r
+        this.transId = false;\r
+        var a = response.argument;\r
+        this.fireEvent("loadexception", this, a.node, response);\r
+        this.runCallback(a.callback, a.scope || a.node, [a.node]);\r
+    }\r
+});/**
+ * @class Ext.tree.TreeFilter
+ * Note this class is experimental and doesn't update the indent (lines) or expand collapse icons of the nodes
+ * @param {TreePanel} tree
+ * @param {Object} config (optional)
+ */
+Ext.tree.TreeFilter = function(tree, config){
+    this.tree = tree;
+    this.filtered = {};
+    Ext.apply(this, config);
+};
+
+Ext.tree.TreeFilter.prototype = {
+    clearBlank:false,
+    reverse:false,
+    autoClear:false,
+    remove:false,
+
+     /**
+     * Filter the data by a specific attribute.
+     * @param {String/RegExp} value Either string that the attribute value
+     * should start with or a RegExp to test against the attribute
+     * @param {String} attr (optional) The attribute passed in your node's attributes collection. Defaults to "text".
+     * @param {TreeNode} startNode (optional) The node to start the filter at.
+     */
+    filter : function(value, attr, startNode){
+        attr = attr || "text";
+        var f;
+        if(typeof value == "string"){
+            var vlen = value.length;
+            // auto clear empty filter
+            if(vlen == 0 && this.clearBlank){
+                this.clear();
+                return;
+            }
+            value = value.toLowerCase();
+            f = function(n){
+                return n.attributes[attr].substr(0, vlen).toLowerCase() == value;
+            };
+        }else if(value.exec){ // regex?
+            f = function(n){
+                return value.test(n.attributes[attr]);
+            };
+        }else{
+            throw 'Illegal filter type, must be string or regex';
+        }
+        this.filterBy(f, null, startNode);
+       },
+
+    /**
+     * Filter by a function. The passed function will be called with each
+     * node in the tree (or from the startNode). If the function returns true, the node is kept
+     * otherwise it is filtered. If a node is filtered, its children are also filtered.
+     * @param {Function} fn The filter function
+     * @param {Object} scope (optional) The scope of the function (defaults to the current node)
+     */
+    filterBy : function(fn, scope, startNode){
+        startNode = startNode || this.tree.root;
+        if(this.autoClear){
+            this.clear();
+        }
+        var af = this.filtered, rv = this.reverse;
+        var f = function(n){
+            if(n == startNode){
+                return true;
+            }
+            if(af[n.id]){
+                return false;
+            }
+            var m = fn.call(scope || n, n);
+            if(!m || rv){
+                af[n.id] = n;
+                n.ui.hide();
+                return false;
+            }
+            return true;
+        };
+        startNode.cascade(f);
+        if(this.remove){
+           for(var id in af){
+               if(typeof id != "function"){
+                   var n = af[id];
+                   if(n && n.parentNode){
+                       n.parentNode.removeChild(n);
+                   }
+               }
+           }
+        }
+    },
+
+    /**
+     * Clears the current filter. Note: with the "remove" option
+     * set a filter cannot be cleared.
+     */
+    clear : function(){
+        var t = this.tree;
+        var af = this.filtered;
+        for(var id in af){
+            if(typeof id != "function"){
+                var n = af[id];
+                if(n){
+                    n.ui.show();
+                }
+            }
+        }
+        this.filtered = {};
+    }
+};
+/**\r
+ * @class Ext.tree.TreeSorter\r
+ * Provides sorting of nodes in a {@link Ext.tree.TreePanel}.  The TreeSorter automatically monitors events on the \r
+ * associated TreePanel that might affect the tree's sort order (beforechildrenrendered, append, insert and textchange).\r
+ * Example usage:<br />\r
+ * <pre><code>\r
+new Ext.tree.TreeSorter(myTree, {\r
+    folderSort: true,\r
+    dir: "desc",\r
+    sortType: function(node) {\r
+        // sort by a custom, typed attribute:\r
+        return parseInt(node.id, 10);\r
+    }\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * @param {TreePanel} tree\r
+ * @param {Object} config\r
+ */\r
+Ext.tree.TreeSorter = function(tree, config){\r
+    /**\r
+     * @cfg {Boolean} folderSort True to sort leaf nodes under non-leaf nodes (defaults to false)\r
+     */\r
+    /** \r
+     * @cfg {String} property The named attribute on the node to sort by (defaults to "text").  Note that this \r
+     * property is only used if no {@link #sortType} function is specified, otherwise it is ignored.\r
+     */\r
+    /** \r
+     * @cfg {String} dir The direction to sort ("asc" or "desc," case-insensitive, defaults to "asc")\r
+     */\r
+    /** \r
+     * @cfg {String} leafAttr The attribute used to determine leaf nodes when {@link #folderSort} = true (defaults to "leaf")\r
+     */\r
+    /** \r
+     * @cfg {Boolean} caseSensitive true for case-sensitive sort (defaults to false)\r
+     */\r
+    /** \r
+     * @cfg {Function} sortType A custom "casting" function used to convert node values before sorting.  The function\r
+     * will be called with a single parameter (the {@link Ext.tree.TreeNode} being evaluated) and is expected to return\r
+     * the node's sort value cast to the specific data type required for sorting.  This could be used, for example, when\r
+     * a node's text (or other attribute) should be sorted as a date or numeric value.  See the class description for \r
+     * example usage.  Note that if a sortType is specified, any {@link #property} config will be ignored.\r
+     */\r
+    \r
+    Ext.apply(this, config);\r
+    tree.on("beforechildrenrendered", this.doSort, this);\r
+    tree.on("append", this.updateSort, this);\r
+    tree.on("insert", this.updateSort, this);\r
+    tree.on("textchange", this.updateSortParent, this);\r
+    \r
+    var dsc = this.dir && this.dir.toLowerCase() == "desc";\r
+    var p = this.property || "text";\r
+    var sortType = this.sortType;\r
+    var fs = this.folderSort;\r
+    var cs = this.caseSensitive === true;\r
+    var leafAttr = this.leafAttr || 'leaf';\r
+\r
+    this.sortFn = function(n1, n2){\r
+        if(fs){\r
+            if(n1.attributes[leafAttr] && !n2.attributes[leafAttr]){\r
+                return 1;\r
+            }\r
+            if(!n1.attributes[leafAttr] && n2.attributes[leafAttr]){\r
+                return -1;\r
+            }\r
+        }\r
+       var v1 = sortType ? sortType(n1) : (cs ? n1.attributes[p] : n1.attributes[p].toUpperCase());\r
+       var v2 = sortType ? sortType(n2) : (cs ? n2.attributes[p] : n2.attributes[p].toUpperCase());\r
+       if(v1 < v2){\r
+                       return dsc ? +1 : -1;\r
+               }else if(v1 > v2){\r
+                       return dsc ? -1 : +1;\r
         }else{\r
-            this.panel.setSize(newSize, s.height);\r
-            this.state.width = newSize;\r
+               return 0;\r
         }\r
-        this.layout.layout();\r
-        this.panel.saveState();\r
-        return false;\r
-    },\r
+    };\r
+};\r
 \r
+Ext.tree.TreeSorter.prototype = {\r
+    doSort : function(node){\r
+        node.sort(this.sortFn);\r
+    },\r
     \r
-    getSplitBar : function(){\r
-        return this.split;\r
+    compareNodes : function(n1, n2){\r
+        return (n1.text.toUpperCase() > n2.text.toUpperCase() ? 1 : -1);\r
     },\r
     \r
-    // inherit docs\r
-    destroy : function() {\r
-        Ext.destroy(\r
-            this.miniSplitEl, \r
-            this.split, \r
-            this.splitEl\r
-        );\r
+    updateSort : function(tree, node){\r
+        if(node.childrenRendered){\r
+            this.doSort.defer(1, this, [node]);\r
+        }\r
+    },\r
+    \r
+    updateSortParent : function(node){\r
+               var p = node.parentNode;\r
+               if(p && p.childrenRendered){\r
+            this.doSort.defer(1, this, [p]);\r
+        }\r
     }\r
-});\r
+};/**\r
+ * @class Ext.tree.TreeDropZone\r
+ * @extends Ext.dd.DropZone\r
+ * @constructor\r
+ * @param {String/HTMLElement/Element} tree The {@link Ext.tree.TreePanel} for which to enable dropping\r
+ * @param {Object} config\r
+ */\r
+if(Ext.dd.DropZone){\r
+    \r
+Ext.tree.TreeDropZone = function(tree, config){\r
+    /**\r
+     * @cfg {Boolean} allowParentInsert\r
+     * Allow inserting a dragged node between an expanded parent node and its first child that will become a\r
+     * sibling of the parent when dropped (defaults to false)\r
+     */\r
+    this.allowParentInsert = config.allowParentInsert || false;\r
+    /**\r
+     * @cfg {String} allowContainerDrop\r
+     * True if drops on the tree container (outside of a specific tree node) are allowed (defaults to false)\r
+     */\r
+    this.allowContainerDrop = config.allowContainerDrop || false;\r
+    /**\r
+     * @cfg {String} appendOnly\r
+     * True if the tree should only allow append drops (use for trees which are sorted, defaults to false)\r
+     */\r
+    this.appendOnly = config.appendOnly || false;\r
+\r
+    Ext.tree.TreeDropZone.superclass.constructor.call(this, tree.getTreeEl(), config);\r
+    /**\r
+    * The TreePanel for this drop zone\r
+    * @type Ext.tree.TreePanel\r
+    * @property\r
+    */\r
+    this.tree = tree;\r
+    /**\r
+    * Arbitrary data that can be associated with this tree and will be included in the event object that gets\r
+    * passed to any nodedragover event handler (defaults to {})\r
+    * @type Ext.tree.TreePanel\r
+    * @property\r
+    */\r
+    this.dragOverData = {};\r
+    // private\r
+    this.lastInsertClass = "x-tree-no-status";\r
+};\r
 \r
-Ext.Container.LAYOUTS['border'] = Ext.layout.BorderLayout;\r
+Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, {\r
+    /**\r
+     * @cfg {String} ddGroup\r
+     * A named drag drop group to which this object belongs.  If a group is specified, then this object will only\r
+     * interact with other drag drop objects in the same group (defaults to 'TreeDD').\r
+     */\r
+    ddGroup : "TreeDD",\r
 \r
-Ext.layout.FormLayout = Ext.extend(Ext.layout.AnchorLayout, {\r
-    \r
-    labelSeparator : ':',\r
+    /**\r
+     * @cfg {String} expandDelay\r
+     * The delay in milliseconds to wait before expanding a target tree node while dragging a droppable node\r
+     * over the target (defaults to 1000)\r
+     */\r
+    expandDelay : 1000,\r
 \r
     // private\r
-    getAnchorViewSize : function(ct, target){\r
-        return (ct.body||ct.el).getStyleSize();\r
+    expandNode : function(node){\r
+        if(node.hasChildNodes() && !node.isExpanded()){\r
+            node.expand(false, null, this.triggerCacheRefresh.createDelegate(this));\r
+        }\r
     },\r
 \r
     // private\r
-    setContainer : function(ct){\r
-        Ext.layout.FormLayout.superclass.setContainer.call(this, ct);\r
+    queueExpand : function(node){\r
+        this.expandProcId = this.expandNode.defer(this.expandDelay, this, [node]);\r
+    },\r
 \r
-        if(ct.labelAlign){\r
-            ct.addClass('x-form-label-'+ct.labelAlign);\r
+    // private\r
+    cancelExpand : function(){\r
+        if(this.expandProcId){\r
+            clearTimeout(this.expandProcId);\r
+            this.expandProcId = false;\r
         }\r
+    },\r
 \r
-        if(ct.hideLabels){\r
-            this.labelStyle = "display:none";\r
-            this.elementStyle = "padding-left:0;";\r
-            this.labelAdjust = 0;\r
-        }else{\r
-            this.labelSeparator = ct.labelSeparator || this.labelSeparator;\r
-            ct.labelWidth = ct.labelWidth || 100;\r
-            if(typeof ct.labelWidth == 'number'){\r
-                var pad = (typeof ct.labelPad == 'number' ? ct.labelPad : 5);\r
-                this.labelAdjust = ct.labelWidth+pad;\r
-                this.labelStyle = "width:"+ct.labelWidth+"px;";\r
-                this.elementStyle = "padding-left:"+(ct.labelWidth+pad)+'px';\r
-            }\r
-            if(ct.labelAlign == 'top'){\r
-                this.labelStyle = "width:auto;";\r
-                this.labelAdjust = 0;\r
-                this.elementStyle = "padding-left:0;";\r
-            }\r
-        }\r
-\r
-        if(!this.fieldTpl){\r
-            // the default field template used by all form layouts\r
-            var t = new Ext.Template(\r
-                '<div class="x-form-item {5}" tabIndex="-1">',\r
-                    '<label for="{0}" style="{2}" class="x-form-item-label">{1}{4}</label>',\r
-                    '<div class="x-form-element" id="x-form-el-{0}" style="{3}">',\r
-                    '</div><div class="{6}"></div>',\r
-                '</div>'\r
-            );\r
-            t.disableFormats = true;\r
-            t.compile();\r
-            Ext.layout.FormLayout.prototype.fieldTpl = t;\r
+    // private\r
+    isValidDropPoint : function(n, pt, dd, e, data){\r
+        if(!n || !data){ return false; }\r
+        var targetNode = n.node;\r
+        var dropNode = data.node;\r
+        // default drop rules\r
+        if(!(targetNode && targetNode.isTarget && pt)){\r
+            return false;\r
         }\r
-    },\r
-    \r
-    //private\r
-    getLabelStyle: function(s){\r
-        var ls = '', items = [this.labelStyle, s];\r
-        for (var i = 0, len = items.length; i < len; ++i){\r
-            if (items[i]){\r
-                ls += items[i];\r
-                if (ls.substr(-1, 1) != ';'){\r
-                    ls += ';'\r
-                }\r
-            }\r
+        if(pt == "append" && targetNode.allowChildren === false){\r
+            return false;\r
         }\r
-        return ls;\r
+        if((pt == "above" || pt == "below") && (targetNode.parentNode && targetNode.parentNode.allowChildren === false)){\r
+            return false;\r
+        }\r
+        if(dropNode && (targetNode == dropNode || dropNode.contains(targetNode))){\r
+            return false;\r
+        }\r
+        // reuse the object\r
+        var overEvent = this.dragOverData;\r
+        overEvent.tree = this.tree;\r
+        overEvent.target = targetNode;\r
+        overEvent.data = data;\r
+        overEvent.point = pt;\r
+        overEvent.source = dd;\r
+        overEvent.rawEvent = e;\r
+        overEvent.dropNode = dropNode;\r
+        overEvent.cancel = false;  \r
+        var result = this.tree.fireEvent("nodedragover", overEvent);\r
+        return overEvent.cancel === false && result !== false;\r
     },\r
 \r
     // private\r
-    renderItem : function(c, position, target){\r
-        if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){\r
-            var args = [\r
-                   c.id, c.fieldLabel,\r
-                   this.getLabelStyle(c.labelStyle),\r
-                   this.elementStyle||'',\r
-                   typeof c.labelSeparator == 'undefined' ? this.labelSeparator : c.labelSeparator,\r
-                   (c.itemCls||this.container.itemCls||'') + (c.hideLabel ? ' x-hide-label' : ''),\r
-                   c.clearCls || 'x-form-clear-left' \r
-            ];\r
-            if(typeof position == 'number'){\r
-                position = target.dom.childNodes[position] || null;\r
-            }\r
-            if(position){\r
-                this.fieldTpl.insertBefore(position, args);\r
-            }else{\r
-                this.fieldTpl.append(target, args);\r
-            }\r
-            c.render('x-form-el-'+c.id);\r
-        }else {\r
-            Ext.layout.FormLayout.superclass.renderItem.apply(this, arguments);\r
+    getDropPoint : function(e, n, dd){\r
+        var tn = n.node;\r
+        if(tn.isRoot){\r
+            return tn.allowChildren !== false ? "append" : false; // always append for root\r
+        }\r
+        var dragEl = n.ddel;\r
+        var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight;\r
+        var y = Ext.lib.Event.getPageY(e);\r
+        var noAppend = tn.allowChildren === false || tn.isLeaf();\r
+        if(this.appendOnly || tn.parentNode.allowChildren === false){\r
+            return noAppend ? false : "append";\r
+        }\r
+        var noBelow = false;\r
+        if(!this.allowParentInsert){\r
+            noBelow = tn.hasChildNodes() && tn.isExpanded();\r
+        }\r
+        var q = (b - t) / (noAppend ? 2 : 3);\r
+        if(y >= t && y < (t + q)){\r
+            return "above";\r
+        }else if(!noBelow && (noAppend || y >= b-q && y <= b)){\r
+            return "below";\r
+        }else{\r
+            return "append";\r
         }\r
     },\r
 \r
     // private\r
-    adjustWidthAnchor : function(value, comp){\r
-        return value - (comp.isFormField  ? (comp.hideLabel ? 0 : this.labelAdjust) : 0);\r
+    onNodeEnter : function(n, dd, e, data){\r
+        this.cancelExpand();\r
     },\r
-\r
-    // private\r
-    isValidParent : function(c, target){\r
-        return true;\r
-    }\r
-\r
     \r
-});\r
+    onContainerOver : function(dd, e, data) {\r
+        if (this.allowContainerDrop && this.isValidDropPoint({ ddel: this.tree.getRootNode().ui.elNode, node: this.tree.getRootNode() }, "append", dd, e, data)) {\r
+            return this.dropAllowed;\r
+        }\r
+        return this.dropNotAllowed;\r
+    },\r
 \r
-Ext.Container.LAYOUTS['form'] = Ext.layout.FormLayout;\r
+    // private\r
+    onNodeOver : function(n, dd, e, data){\r
+        var pt = this.getDropPoint(e, n, dd);\r
+        var node = n.node;\r
+        \r
+        // auto node expand check\r
+        if(!this.expandProcId && pt == "append" && node.hasChildNodes() && !n.node.isExpanded()){\r
+            this.queueExpand(node);\r
+        }else if(pt != "append"){\r
+            this.cancelExpand();\r
+        }\r
+        \r
+        // set the insert point style on the target node\r
+        var returnCls = this.dropNotAllowed;\r
+        if(this.isValidDropPoint(n, pt, dd, e, data)){\r
+           if(pt){\r
+               var el = n.ddel;\r
+               var cls;\r
+               if(pt == "above"){\r
+                   returnCls = n.node.isFirst() ? "x-tree-drop-ok-above" : "x-tree-drop-ok-between";\r
+                   cls = "x-tree-drag-insert-above";\r
+               }else if(pt == "below"){\r
+                   returnCls = n.node.isLast() ? "x-tree-drop-ok-below" : "x-tree-drop-ok-between";\r
+                   cls = "x-tree-drag-insert-below";\r
+               }else{\r
+                   returnCls = "x-tree-drop-ok-append";\r
+                   cls = "x-tree-drag-append";\r
+               }\r
+               if(this.lastInsertClass != cls){\r
+                   Ext.fly(el).replaceClass(this.lastInsertClass, cls);\r
+                   this.lastInsertClass = cls;\r
+               }\r
+           }\r
+       }\r
+       return returnCls;\r
+    },\r
 \r
-Ext.layout.Accordion = Ext.extend(Ext.layout.FitLayout, {\r
-    \r
-    fill : true,\r
-    \r
-    autoWidth : true,\r
-    \r
-    titleCollapse : true,\r
-    \r
-    hideCollapseTool : false,\r
-    \r
-    collapseFirst : false,\r
-    \r
-    animate : false,\r
-    \r
-    sequence : false,\r
-    \r
-    activeOnTop : false,\r
+    // private\r
+    onNodeOut : function(n, dd, e, data){\r
+        this.cancelExpand();\r
+        this.removeDropIndicators(n);\r
+    },\r
 \r
-    renderItem : function(c){\r
-        if(this.animate === false){\r
-            c.animCollapse = false;\r
-        }\r
-        c.collapsible = true;\r
-        if(this.autoWidth){\r
-            c.autoWidth = true;\r
-        }\r
-        if(this.titleCollapse){\r
-            c.titleCollapse = true;\r
+    // private\r
+    onNodeDrop : function(n, dd, e, data){\r
+        var point = this.getDropPoint(e, n, dd);\r
+        var targetNode = n.node;\r
+        targetNode.ui.startDrop();\r
+        if(!this.isValidDropPoint(n, point, dd, e, data)){\r
+            targetNode.ui.endDrop();\r
+            return false;\r
         }\r
-        if(this.hideCollapseTool){\r
-            c.hideCollapseTool = true;\r
+        // first try to find the drop node\r
+        var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, point, e) : null);\r
+        return this.processDrop(targetNode, data, point, dd, e, dropNode);\r
+    },\r
+    \r
+    onContainerDrop : function(dd, e, data){\r
+        if (this.allowContainerDrop && this.isValidDropPoint({ ddel: this.tree.getRootNode().ui.elNode, node: this.tree.getRootNode() }, "append", dd, e, data)) {\r
+            var targetNode = this.tree.getRootNode();       \r
+            targetNode.ui.startDrop();\r
+            var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, 'append', e) : null);\r
+            return this.processDrop(targetNode, data, 'append', dd, e, dropNode);\r
         }\r
-        if(this.collapseFirst !== undefined){\r
-            c.collapseFirst = this.collapseFirst;\r
+        return false;\r
+    },\r
+    \r
+    // private\r
+    processDrop: function(target, data, point, dd, e, dropNode){\r
+        var dropEvent = {\r
+            tree : this.tree,\r
+            target: target,\r
+            data: data,\r
+            point: point,\r
+            source: dd,\r
+            rawEvent: e,\r
+            dropNode: dropNode,\r
+            cancel: !dropNode,\r
+            dropStatus: false\r
+        };\r
+        var retval = this.tree.fireEvent("beforenodedrop", dropEvent);\r
+        if(retval === false || dropEvent.cancel === true || !dropEvent.dropNode){\r
+            target.ui.endDrop();\r
+            return dropEvent.dropStatus;\r
         }\r
-        if(!this.activeItem && !c.collapsed){\r
-            this.activeItem = c;\r
-        }else if(this.activeItem){\r
-            c.collapsed = true;\r
+    \r
+        target = dropEvent.target;\r
+        if(point == 'append' && !target.isExpanded()){\r
+            target.expand(false, null, function(){\r
+                this.completeDrop(dropEvent);\r
+            }.createDelegate(this));\r
+        }else{\r
+            this.completeDrop(dropEvent);\r
         }\r
-        Ext.layout.Accordion.superclass.renderItem.apply(this, arguments);\r
-        c.header.addClass('x-accordion-hd');\r
-        c.on('beforeexpand', this.beforeExpand, this);\r
+        return true;\r
     },\r
 \r
     // private\r
-    beforeExpand : function(p, anim){\r
-        var ai = this.activeItem;\r
-        if(ai){\r
-            if(this.sequence){\r
-                delete this.activeItem;\r
-                if (!ai.collapsed){\r
-                    ai.collapse({callback:function(){\r
-                        p.expand(anim || true);\r
-                    }, scope: this});\r
-                    return false;\r
-                }\r
+    completeDrop : function(de){\r
+        var ns = de.dropNode, p = de.point, t = de.target;\r
+        if(!Ext.isArray(ns)){\r
+            ns = [ns];\r
+        }\r
+        var n;\r
+        for(var i = 0, len = ns.length; i < len; i++){\r
+            n = ns[i];\r
+            if(p == "above"){\r
+                t.parentNode.insertBefore(n, t);\r
+            }else if(p == "below"){\r
+                t.parentNode.insertBefore(n, t.nextSibling);\r
             }else{\r
-                ai.collapse(this.animate);\r
+                t.appendChild(n);\r
             }\r
         }\r
-        this.activeItem = p;\r
-        if(this.activeOnTop){\r
-            p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);\r
+        n.ui.focus();\r
+        if(Ext.enableFx && this.tree.hlDrop){\r
+            n.ui.highlight();\r
         }\r
-        this.layout();\r
+        t.ui.endDrop();\r
+        this.tree.fireEvent("nodedrop", de);\r
     },\r
 \r
     // private\r
-    setItemSize : function(item, size){\r
-        if(this.fill && item){\r
-            var items = this.container.items.items;\r
-            var hh = 0;\r
-            for(var i = 0, len = items.length; i < len; i++){\r
-                var p = items[i];\r
-                if(p != item){\r
-                    hh += (p.getSize().height - p.bwrap.getHeight());\r
-                }\r
-            }\r
-            size.height -= hh;\r
-            item.setSize(size);\r
+    afterNodeMoved : function(dd, data, e, targetNode, dropNode){\r
+        if(Ext.enableFx && this.tree.hlDrop){\r
+            dropNode.ui.focus();\r
+            dropNode.ui.highlight();\r
         }\r
-    }\r
-});\r
-Ext.Container.LAYOUTS['accordion'] = Ext.layout.Accordion;\r
-\r
-Ext.layout.TableLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
-    \r
+        this.tree.fireEvent("nodedrop", this.tree, targetNode, data, dd, e);\r
+    },\r
 \r
     // private\r
-    monitorResize:false,\r
+    getTree : function(){\r
+        return this.tree;\r
+    },\r
 \r
     // private\r
-    setContainer : function(ct){\r
-        Ext.layout.TableLayout.superclass.setContainer.call(this, ct);\r
+    removeDropIndicators : function(n){\r
+        if(n && n.ddel){\r
+            var el = n.ddel;\r
+            Ext.fly(el).removeClass([\r
+                    "x-tree-drag-insert-above",\r
+                    "x-tree-drag-insert-below",\r
+                    "x-tree-drag-append"]);\r
+            this.lastInsertClass = "_noclass";\r
+        }\r
+    },\r
 \r
-        this.currentRow = 0;\r
-        this.currentColumn = 0;\r
-        this.cells = [];\r
+    // private\r
+    beforeDragDrop : function(target, e, id){\r
+        this.cancelExpand();\r
+        return true;\r
     },\r
 \r
     // private\r
-    onLayout : function(ct, target){\r
-        var cs = ct.items.items, len = cs.length, c, i;\r
+    afterRepair : function(data){\r
+        if(data && Ext.enableFx){\r
+            data.node.ui.highlight();\r
+        }\r
+        this.hideProxy();\r
+    }    \r
+});\r
 \r
-        if(!this.table){\r
-            target.addClass('x-table-layout-ct');\r
+}/**\r
+ * @class Ext.tree.TreeDragZone\r
+ * @extends Ext.dd.DragZone\r
+ * @constructor\r
+ * @param {String/HTMLElement/Element} tree The {@link Ext.tree.TreePanel} for which to enable dragging\r
+ * @param {Object} config\r
+ */\r
+if(Ext.dd.DragZone){\r
+Ext.tree.TreeDragZone = function(tree, config){\r
+    Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.innerCt, config);\r
+    /**\r
+    * The TreePanel for this drag zone\r
+    * @type Ext.tree.TreePanel\r
+    * @property\r
+    */\r
+    this.tree = tree;\r
+};\r
 \r
-            this.table = target.createChild(\r
-                {tag:'table', cls:'x-table-layout', cellspacing: 0, cn: {tag: 'tbody'}}, null, true);\r
+Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {\r
+    /**\r
+     * @cfg {String} ddGroup\r
+     * A named drag drop group to which this object belongs.  If a group is specified, then this object will only\r
+     * interact with other drag drop objects in the same group (defaults to 'TreeDD').\r
+     */\r
+    ddGroup : "TreeDD",\r
 \r
-            this.renderAll(ct, target);\r
-        }\r
+    // private\r
+    onBeforeDrag : function(data, e){\r
+        var n = data.node;\r
+        return n && n.draggable && !n.disabled;\r
     },\r
 \r
     // private\r
-    getRow : function(index){\r
-        var row = this.table.tBodies[0].childNodes[index];\r
-        if(!row){\r
-            row = document.createElement('tr');\r
-            this.table.tBodies[0].appendChild(row);\r
-        }\r
-        return row;\r
+    onInitDrag : function(e){\r
+        var data = this.dragData;\r
+        this.tree.getSelectionModel().select(data.node);\r
+        this.tree.eventModel.disable();\r
+        this.proxy.update("");\r
+        data.node.ui.appendDDGhost(this.proxy.ghost.dom);\r
+        this.tree.fireEvent("startdrag", this.tree, data.node, e);\r
     },\r
 \r
     // private\r
-       getNextCell : function(c){\r
-               var cell = this.getNextNonSpan(this.currentColumn, this.currentRow);\r
-               var curCol = this.currentColumn = cell[0], curRow = this.currentRow = cell[1];\r
-               for(var rowIndex = curRow; rowIndex < curRow + (c.rowspan || 1); rowIndex++){\r
-                       if(!this.cells[rowIndex]){\r
-                               this.cells[rowIndex] = [];\r
-                       }\r
-                       for(var colIndex = curCol; colIndex < curCol + (c.colspan || 1); colIndex++){\r
-                               this.cells[rowIndex][colIndex] = true;\r
-                       }\r
-               }\r
-               var td = document.createElement('td');\r
-               if(c.cellId){\r
-                       td.id = c.cellId;\r
-               }\r
-               var cls = 'x-table-layout-cell';\r
-               if(c.cellCls){\r
-                       cls += ' ' + c.cellCls;\r
-               }\r
-               td.className = cls;\r
-               if(c.colspan){\r
-                       td.colSpan = c.colspan;\r
-               }\r
-               if(c.rowspan){\r
-                       td.rowSpan = c.rowspan;\r
-               }\r
-               this.getRow(curRow).appendChild(td);\r
-               return td;\r
-       },\r
-    \r
+    getRepairXY : function(e, data){\r
+        return data.node.ui.getDDRepairXY();\r
+    },\r
+\r
     // private\r
-       getNextNonSpan: function(colIndex, rowIndex){\r
-               var cols = this.columns;\r
-               while((cols && colIndex >= cols) || (this.cells[rowIndex] && this.cells[rowIndex][colIndex])) {\r
-                       if(cols && colIndex >= cols){\r
-                               rowIndex++;\r
-                               colIndex = 0;\r
-                       }else{\r
-                               colIndex++;\r
-                       }\r
-               }\r
-               return [colIndex, rowIndex];\r
-       },\r
+    onEndDrag : function(data, e){\r
+        this.tree.eventModel.enable.defer(100, this.tree.eventModel);\r
+        this.tree.fireEvent("enddrag", this.tree, data.node, e);\r
+    },\r
 \r
     // private\r
-    renderItem : function(c, position, target){\r
-        if(c && !c.rendered){\r
-            c.render(this.getNextCell(c));\r
-            if(this.extraCls){\r
-                var t = c.getPositionEl ? c.getPositionEl() : c;\r
-                t.addClass(this.extraCls);\r
-            }\r
-        }\r
+    onValidDrop : function(dd, e, id){\r
+        this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);\r
+        this.hideProxy();\r
     },\r
 \r
     // private\r
-    isValidParent : function(c, target){\r
-        return true;\r
-    }\r
-\r
-    \r
-});\r
-\r
-Ext.Container.LAYOUTS['table'] = Ext.layout.TableLayout;\r
-\r
-Ext.layout.AbsoluteLayout = Ext.extend(Ext.layout.AnchorLayout, {\r
+    beforeInvalidDrop : function(e, id){\r
+        // this scrolls the original position back into view\r
+        var sm = this.tree.getSelectionModel();\r
+        sm.clearSelections();\r
+        sm.select(this.dragData.node);\r
+    },\r
     \r
-    extraCls: 'x-abs-layout-item',\r
-    isForm: false,\r
     // private\r
-    setContainer : function(ct){\r
-        Ext.layout.AbsoluteLayout.superclass.setContainer.call(this, ct);\r
-        if(ct.isXType('form')){\r
-            this.isForm = true;\r
+    afterRepair : function(){\r
+        if (Ext.enableFx && this.tree.hlDrop) {\r
+            Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");\r
         }\r
-    },\r
-\r
-    onLayout : function(ct, target){\r
-        if(this.isForm){ ct.body.position(); } else { target.position(); }\r
-        Ext.layout.AbsoluteLayout.superclass.onLayout.call(this, ct, target);\r
-    },\r
-\r
-    // private\r
-    getAnchorViewSize : function(ct, target){\r
-        return this.isForm ? ct.body.getStyleSize() : Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this, ct, target);\r
-    },\r
-\r
-    // private\r
-    isValidParent : function(c, target){\r
-        return this.isForm ? true : Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this, c, target);\r
-    },\r
-\r
-    // private\r
-    adjustWidthAnchor : function(value, comp){\r
-        return value ? value - comp.getPosition(true)[0] : value;\r
-    },\r
-\r
-    // private\r
-    adjustHeightAnchor : function(value, comp){\r
-        return  value ? value - comp.getPosition(true)[1] : value;\r
+        this.dragging = false;\r
     }\r
-    \r
 });\r
-Ext.Container.LAYOUTS['absolute'] = Ext.layout.AbsoluteLayout;\r
-\r
-Ext.Viewport = Ext.extend(Ext.Container, {\r
-       \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
+}/**
+ * @class Ext.tree.TreeEditor
+ * @extends Ext.Editor
+ * Provides editor functionality for inline tree node editing.  Any valid {@link Ext.form.Field} subclass can be used
+ * as the editor field.
+ * @constructor
+ * @param {TreePanel} tree
+ * @param {Object} fieldConfig (optional) Either a prebuilt {@link Ext.form.Field} instance or a Field config object
+ * that will be applied to the default field instance (defaults to a {@link Ext.form.TextField}).
+ * @param {Object} config (optional) A TreeEditor config object
+ */
+Ext.tree.TreeEditor = function(tree, fc, config){
+    fc = fc || {};
+    var field = fc.events ? fc : new Ext.form.TextField(fc);
+    Ext.tree.TreeEditor.superclass.constructor.call(this, field, config);
+
+    this.tree = tree;
+
+    if(!tree.rendered){
+        tree.on('render', this.initEditor, this);
+    }else{
+        this.initEditor(tree);
+    }
+};
+
+Ext.extend(Ext.tree.TreeEditor, Ext.Editor, {
+    /**
+     * @cfg {String} alignment
+     * The position to align to (see {@link Ext.Element#alignTo} for more details, defaults to "l-l").
+     */
+    alignment: "l-l",
+    // inherit
+    autoSize: false,
+    /**
+     * @cfg {Boolean} hideEl
+     * True to hide the bound element while the editor is displayed (defaults to false)
+     */
+    hideEl : false,
+    /**
+     * @cfg {String} cls
+     * CSS class to apply to the editor (defaults to "x-small-editor x-tree-editor")
+     */
+    cls: "x-small-editor x-tree-editor",
+    /**
+     * @cfg {Boolean} shim
+     * True to shim the editor if selects/iframes could be displayed beneath it (defaults to false)
+     */
+    shim:false,
+    // inherit
+    shadow:"frame",
+    /**
+     * @cfg {Number} maxWidth
+     * The maximum width in pixels of the editor field (defaults to 250).  Note that if the maxWidth would exceed
+     * the containing tree element's size, it will be automatically limited for you to the container width, taking
+     * scroll and client offsets into account prior to each edit.
+     */
+    maxWidth: 250,
+    /**
+     * @cfg {Number} editDelay The number of milliseconds between clicks to register a double-click that will trigger
+     * editing on the current node (defaults to 350).  If two clicks occur on the same node within this time span,
+     * the editor for the node will display, otherwise it will be processed as a regular click.
+     */
+    editDelay : 350,
+
+    initEditor : function(tree){
+        tree.on('beforeclick', this.beforeNodeClick, this);
+        tree.on('dblclick', this.onNodeDblClick, this);
+        this.on('complete', this.updateNode, this);
+        this.on('beforestartedit', this.fitToTree, this);
+        this.on('startedit', this.bindScroll, this, {delay:10});
+        this.on('specialkey', this.onSpecialKey, this);
+    },
+
+    // private
+    fitToTree : function(ed, el){
+        var td = this.tree.getTreeEl().dom, nd = el.dom;
+        if(td.scrollLeft >  nd.offsetLeft){ // ensure the node left point is visible
+            td.scrollLeft = nd.offsetLeft;
+        }
+        var w = Math.min(
+                this.maxWidth,
+                (td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - /*cushion*/5);
+        this.setSize(w, '');
+    },
+
+    /**
+     * Edit the text of the passed {@link Ext.tree.TreeNode TreeNode}.
+     * @param node {Ext.tree.TreeNode} The TreeNode to edit. The TreeNode must be {@link Ext.tree.TreeNode#editable editable}.
+     */
+    triggerEdit : function(node, defer){
+        this.completeEdit();
+               if(node.attributes.editable !== false){
+           /**
+            * The {@link Ext.tree.TreeNode TreeNode} this editor is bound to. Read-only.
+            * @type Ext.tree.TreeNode
+            * @property editNode
+            */
+                       this.editNode = node;
+            if(this.tree.autoScroll){
+                Ext.fly(node.ui.getEl()).scrollIntoView(this.tree.body);
+            }
+            var value = node.text || '';
+            if (!Ext.isGecko && Ext.isEmpty(node.text)){
+                node.setText('&#160;');
+            }
+            this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, value]);
+            return false;
+        }
+    },
+
+    // private
+    bindScroll : function(){
+        this.tree.getTreeEl().on('scroll', this.cancelEdit, this);
+    },
+
+    // private
+    beforeNodeClick : function(node, e){
+        clearTimeout(this.autoEditTimer);
+        if(this.tree.getSelectionModel().isSelected(node)){
+            e.stopEvent();
+            return this.triggerEdit(node);
+        }
+    },
+
+    onNodeDblClick : function(node, e){
+        clearTimeout(this.autoEditTimer);
+    },
+
+    // private
+    updateNode : function(ed, value){
+        this.tree.getTreeEl().un('scroll', this.cancelEdit, this);
+        this.editNode.setText(value);
+    },
+
+    // private
+    onHide : function(){
+        Ext.tree.TreeEditor.superclass.onHide.call(this);
+        if(this.editNode){
+            this.editNode.ui.focus.defer(50, this.editNode.ui);
+        }
+    },
+
+    // private
+    onSpecialKey : function(field, e){
+        var k = e.getKey();
+        if(k == e.ESC){
+            e.stopEvent();
+            this.cancelEdit();
+        }else if(k == e.ENTER && !e.hasModifier()){
+            e.stopEvent();
+            this.completeEdit();
+        }
+    }
+});/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> \r
+    is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> \r
+*/\r
+\r
+var swfobject = function() {\r
+    \r
+    var UNDEF = "undefined",\r
+        OBJECT = "object",\r
+        SHOCKWAVE_FLASH = "Shockwave Flash",\r
+        SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",\r
+        FLASH_MIME_TYPE = "application/x-shockwave-flash",\r
+        EXPRESS_INSTALL_ID = "SWFObjectExprInst",\r
+        ON_READY_STATE_CHANGE = "onreadystatechange",\r
+        \r
+        win = window,\r
+        doc = document,\r
+        nav = navigator,\r
+        \r
+        plugin = false,\r
+        domLoadFnArr = [main],\r
+        regObjArr = [],\r
+        objIdArr = [],\r
+        listenersArr = [],\r
+        storedAltContent,\r
+        storedAltContentId,\r
+        storedCallbackFn,\r
+        storedCallbackObj,\r
+        isDomLoaded = false,\r
+        isExpressInstallActive = false,\r
+        dynamicStylesheet,\r
+        dynamicStylesheetMedia,\r
+        autoHideShow = true,\r
+    \r
+    /* Centralized function for browser feature detection\r
+        - User agent string detection is only used when no good alternative is possible\r
+        - Is executed directly for optimal performance\r
+    */  \r
+    ua = function() {\r
+        var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,\r
+            u = nav.userAgent.toLowerCase(),\r
+            p = nav.platform.toLowerCase(),\r
+            windows = p ? /win/.test(p) : /win/.test(u),\r
+            mac = p ? /mac/.test(p) : /mac/.test(u),\r
+            webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit\r
+            ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html\r
+            playerVersion = [0,0,0],\r
+            d = null;\r
+        if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {\r
+            d = nav.plugins[SHOCKWAVE_FLASH].description;\r
+            if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+\r
+                plugin = true;\r
+                ie = false; // cascaded feature detection for Internet Explorer\r
+                d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");\r
+                playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);\r
+                playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);\r
+                playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0;\r
+            }\r
+        }\r
+        else if (typeof win.ActiveXObject != UNDEF) {\r
+            try {\r
+                var a = new ActiveXObject(SHOCKWAVE_FLASH_AX);\r
+                if (a) { // a will return null when ActiveX is disabled\r
+                    d = a.GetVariable("$version");\r
+                    if (d) {\r
+                        ie = true; // cascaded feature detection for Internet Explorer\r
+                        d = d.split(" ")[1].split(",");\r
+                        playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];\r
+                    }\r
+                }\r
+            }\r
+            catch(e) {}\r
+        }\r
+        return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac };\r
+    }(),\r
     \r
+    /* Cross-browser onDomLoad\r
+        - Will fire an event as soon as the DOM of a web page is loaded\r
+        - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/\r
+        - Regular onload serves as fallback\r
+    */ \r
+    onDomLoad = function() {\r
+        if (!ua.w3) { return; }\r
+        if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically \r
+            callDomLoadFunctions();\r
+        }\r
+        if (!isDomLoaded) {\r
+            if (typeof doc.addEventListener != UNDEF) {\r
+                doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false);\r
+            }       \r
+            if (ua.ie && ua.win) {\r
+                doc.attachEvent(ON_READY_STATE_CHANGE, function() {\r
+                    if (doc.readyState == "complete") {\r
+                        doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee);\r
+                        callDomLoadFunctions();\r
+                    }\r
+                });\r
+                if (win == top) { // if not inside an iframe\r
+                    (function(){\r
+                        if (isDomLoaded) { return; }\r
+                        try {\r
+                            doc.documentElement.doScroll("left");\r
+                        }\r
+                        catch(e) {\r
+                            setTimeout(arguments.callee, 0);\r
+                            return;\r
+                        }\r
+                        callDomLoadFunctions();\r
+                    })();\r
+                }\r
+            }\r
+            if (ua.wk) {\r
+                (function(){\r
+                    if (isDomLoaded) { return; }\r
+                    if (!/loaded|complete/.test(doc.readyState)) {\r
+                        setTimeout(arguments.callee, 0);\r
+                        return;\r
+                    }\r
+                    callDomLoadFunctions();\r
+                })();\r
+            }\r
+            addLoadEvent(callDomLoadFunctions);\r
+        }\r
+    }();\r
     \r
-    initComponent : function() {\r
-        Ext.Viewport.superclass.initComponent.call(this);\r
-        document.getElementsByTagName('html')[0].className += ' x-viewport';\r
-        this.el = Ext.getBody();\r
-        this.el.setHeight = Ext.emptyFn;\r
-        this.el.setWidth = Ext.emptyFn;\r
-        this.el.setSize = Ext.emptyFn;\r
-        this.el.dom.scroll = 'no';\r
-        this.allowDomMove = false;\r
-        this.autoWidth = true;\r
-        this.autoHeight = true;\r
-        Ext.EventManager.onWindowResize(this.fireResize, this);\r
-        this.renderTo = this.el;\r
-    },\r
-\r
-    fireResize : function(w, h){\r
-        this.fireEvent('resize', this, w, h, w, h);\r
+    function callDomLoadFunctions() {\r
+        if (isDomLoaded) { return; }\r
+        try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early\r
+            var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span"));\r
+            t.parentNode.removeChild(t);\r
+        }\r
+        catch (e) { return; }\r
+        isDomLoaded = true;\r
+        var dl = domLoadFnArr.length;\r
+        for (var i = 0; i < dl; i++) {\r
+            domLoadFnArr[i]();\r
+        }\r
     }\r
-});\r
-Ext.reg('viewport', Ext.Viewport);\r
-\r
-Ext.Panel = Ext.extend(Ext.Container, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
     \r
+    function addDomLoadEvent(fn) {\r
+        if (isDomLoaded) {\r
+            fn();\r
+        }\r
+        else { \r
+            domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+\r
+        }\r
+    }\r
     \r
+    /* Cross-browser onload\r
+        - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/\r
+        - Will fire an event as soon as a web page including all of its assets are loaded \r
+     */\r
+    function addLoadEvent(fn) {\r
+        if (typeof win.addEventListener != UNDEF) {\r
+            win.addEventListener("load", fn, false);\r
+        }\r
+        else if (typeof doc.addEventListener != UNDEF) {\r
+            doc.addEventListener("load", fn, false);\r
+        }\r
+        else if (typeof win.attachEvent != UNDEF) {\r
+            addListener(win, "onload", fn);\r
+        }\r
+        else if (typeof win.onload == "function") {\r
+            var fnOld = win.onload;\r
+            win.onload = function() {\r
+                fnOld();\r
+                fn();\r
+            };\r
+        }\r
+        else {\r
+            win.onload = fn;\r
+        }\r
+    }\r
     \r
+    /* Main function\r
+        - Will preferably execute onDomLoad, otherwise onload (as a fallback)\r
+    */\r
+    function main() { \r
+        if (plugin) {\r
+            testPlayerVersion();\r
+        }\r
+        else {\r
+            matchVersions();\r
+        }\r
+    }\r
     \r
-     \r
+    /* Detect the Flash Player version for non-Internet Explorer browsers\r
+        - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description:\r
+          a. Both release and build numbers can be detected\r
+          b. Avoid wrong descriptions by corrupt installers provided by Adobe\r
+          c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports\r
+        - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available\r
+    */\r
+    function testPlayerVersion() {\r
+        var b = doc.getElementsByTagName("body")[0];\r
+        var o = createElement(OBJECT);\r
+        o.setAttribute("type", FLASH_MIME_TYPE);\r
+        var t = b.appendChild(o);\r
+        if (t) {\r
+            var counter = 0;\r
+            (function(){\r
+                if (typeof t.GetVariable != UNDEF) {\r
+                    var d = t.GetVariable("$version");\r
+                    if (d) {\r
+                        d = d.split(" ")[1].split(",");\r
+                        ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];\r
+                    }\r
+                }\r
+                else if (counter < 10) {\r
+                    counter++;\r
+                    setTimeout(arguments.callee, 10);\r
+                    return;\r
+                }\r
+                b.removeChild(o);\r
+                t = null;\r
+                matchVersions();\r
+            })();\r
+        }\r
+        else {\r
+            matchVersions();\r
+        }\r
+    }\r
     \r
+    /* Perform Flash Player and SWF version matching; static publishing only\r
+    */\r
+    function matchVersions() {\r
+        var rl = regObjArr.length;\r
+        if (rl > 0) {\r
+            for (var i = 0; i < rl; i++) { // for each registered object element\r
+                var id = regObjArr[i].id;\r
+                var cb = regObjArr[i].callbackFn;\r
+                var cbObj = {success:false, id:id};\r
+                if (ua.pv[0] > 0) {\r
+                    var obj = getElementById(id);\r
+                    if (obj) {\r
+                        if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match!\r
+                            setVisibility(id, true);\r
+                            if (cb) {\r
+                                cbObj.success = true;\r
+                                cbObj.ref = getObjectById(id);\r
+                                cb(cbObj);\r
+                            }\r
+                        }\r
+                        else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported\r
+                            var att = {};\r
+                            att.data = regObjArr[i].expressInstall;\r
+                            att.width = obj.getAttribute("width") || "0";\r
+                            att.height = obj.getAttribute("height") || "0";\r
+                            if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); }\r
+                            if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); }\r
+                            // parse HTML object param element's name-value pairs\r
+                            var par = {};\r
+                            var p = obj.getElementsByTagName("param");\r
+                            var pl = p.length;\r
+                            for (var j = 0; j < pl; j++) {\r
+                                if (p[j].getAttribute("name").toLowerCase() != "movie") {\r
+                                    par[p[j].getAttribute("name")] = p[j].getAttribute("value");\r
+                                }\r
+                            }\r
+                            showExpressInstall(att, par, id, cb);\r
+                        }\r
+                        else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF\r
+                            displayAltContent(obj);\r
+                            if (cb) { cb(cbObj); }\r
+                        }\r
+                    }\r
+                }\r
+                else {  // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content)\r
+                    setVisibility(id, true);\r
+                    if (cb) {\r
+                        var o = getObjectById(id); // test whether there is an HTML object element or not\r
+                        if (o && typeof o.SetVariable != UNDEF) { \r
+                            cbObj.success = true;\r
+                            cbObj.ref = o;\r
+                        }\r
+                        cb(cbObj);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
     \r
+    function getObjectById(objectIdStr) {\r
+        var r = null;\r
+        var o = getElementById(objectIdStr);\r
+        if (o && o.nodeName == "OBJECT") {\r
+            if (typeof o.SetVariable != UNDEF) {\r
+                r = o;\r
+            }\r
+            else {\r
+                var n = o.getElementsByTagName(OBJECT)[0];\r
+                if (n) {\r
+                    r = n;\r
+                }\r
+            }\r
+        }\r
+        return r;\r
+    }\r
     \r
+    /* Requirements for Adobe Express Install\r
+        - only one instance can be active at a time\r
+        - fp 6.0.65 or higher\r
+        - Win/Mac OS only\r
+        - no Webkit engines older than version 312\r
+    */\r
+    function canExpressInstall() {\r
+        return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312);\r
+    }\r
     \r
-\r
+    /* Show the Adobe Express Install dialog\r
+        - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75\r
+    */\r
+    function showExpressInstall(att, par, replaceElemIdStr, callbackFn) {\r
+        isExpressInstallActive = true;\r
+        storedCallbackFn = callbackFn || null;\r
+        storedCallbackObj = {success:false, id:replaceElemIdStr};\r
+        var obj = getElementById(replaceElemIdStr);\r
+        if (obj) {\r
+            if (obj.nodeName == "OBJECT") { // static publishing\r
+                storedAltContent = abstractAltContent(obj);\r
+                storedAltContentId = null;\r
+            }\r
+            else { // dynamic publishing\r
+                storedAltContent = obj;\r
+                storedAltContentId = replaceElemIdStr;\r
+            }\r
+            att.id = EXPRESS_INSTALL_ID;\r
+            if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; }\r
+            if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; }\r
+            doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";\r
+            var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn",\r
+                fv = "MMredirectURL=" + win.location.toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title;\r
+            if (typeof par.flashvars != UNDEF) {\r
+                par.flashvars += "&" + fv;\r
+            }\r
+            else {\r
+                par.flashvars = fv;\r
+            }\r
+            // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,\r
+            // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work\r
+            if (ua.ie && ua.win && obj.readyState != 4) {\r
+                var newObj = createElement("div");\r
+                replaceElemIdStr += "SWFObjectNew";\r
+                newObj.setAttribute("id", replaceElemIdStr);\r
+                obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf\r
+                obj.style.display = "none";\r
+                (function(){\r
+                    if (obj.readyState == 4) {\r
+                        obj.parentNode.removeChild(obj);\r
+                    }\r
+                    else {\r
+                        setTimeout(arguments.callee, 10);\r
+                    }\r
+                })();\r
+            }\r
+            createSWF(att, par, replaceElemIdStr);\r
+        }\r
+    }\r
     \r
-    baseCls : 'x-panel',\r
+    /* Functions to abstract and display alternative content\r
+    */\r
+    function displayAltContent(obj) {\r
+        if (ua.ie && ua.win && obj.readyState != 4) {\r
+            // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it,\r
+            // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work\r
+            var el = createElement("div");\r
+            obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content\r
+            el.parentNode.replaceChild(abstractAltContent(obj), el);\r
+            obj.style.display = "none";\r
+            (function(){\r
+                if (obj.readyState == 4) {\r
+                    obj.parentNode.removeChild(obj);\r
+                }\r
+                else {\r
+                    setTimeout(arguments.callee, 10);\r
+                }\r
+            })();\r
+        }\r
+        else {\r
+            obj.parentNode.replaceChild(abstractAltContent(obj), obj);\r
+        }\r
+    } \r
+\r
+    function abstractAltContent(obj) {\r
+        var ac = createElement("div");\r
+        if (ua.win && ua.ie) {\r
+            ac.innerHTML = obj.innerHTML;\r
+        }\r
+        else {\r
+            var nestedObj = obj.getElementsByTagName(OBJECT)[0];\r
+            if (nestedObj) {\r
+                var c = nestedObj.childNodes;\r
+                if (c) {\r
+                    var cl = c.length;\r
+                    for (var i = 0; i < cl; i++) {\r
+                        if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {\r
+                            ac.appendChild(c[i].cloneNode(true));\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return ac;\r
+    }\r
     \r
-    collapsedCls : 'x-panel-collapsed',\r
+    /* Cross-browser dynamic SWF creation\r
+    */\r
+    function createSWF(attObj, parObj, id) {\r
+        var r, el = getElementById(id);\r
+        if (ua.wk && ua.wk < 312) { return r; }\r
+        if (el) {\r
+            if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content\r
+                attObj.id = id;\r
+            }\r
+            if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML\r
+                var att = "";\r
+                for (var i in attObj) {\r
+                    if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries\r
+                        if (i.toLowerCase() == "data") {\r
+                            parObj.movie = attObj[i];\r
+                        }\r
+                        else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword\r
+                            att += ' class="' + attObj[i] + '"';\r
+                        }\r
+                        else if (i.toLowerCase() != "classid") {\r
+                            att += ' ' + i + '="' + attObj[i] + '"';\r
+                        }\r
+                    }\r
+                }\r
+                var par = "";\r
+                for (var j in parObj) {\r
+                    if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries\r
+                        par += '<param name="' + j + '" value="' + parObj[j] + '" />';\r
+                    }\r
+                }\r
+                el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>';\r
+                objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only)\r
+                r = getElementById(attObj.id);  \r
+            }\r
+            else { // well-behaving browsers\r
+                var o = createElement(OBJECT);\r
+                o.setAttribute("type", FLASH_MIME_TYPE);\r
+                for (var m in attObj) {\r
+                    if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries\r
+                        if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword\r
+                            o.setAttribute("class", attObj[m]);\r
+                        }\r
+                        else if (m.toLowerCase() != "classid") { // filter out IE specific attribute\r
+                            o.setAttribute(m, attObj[m]);\r
+                        }\r
+                    }\r
+                }\r
+                for (var n in parObj) {\r
+                    if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element\r
+                        createObjParam(o, n, parObj[n]);\r
+                    }\r
+                }\r
+                el.parentNode.replaceChild(o, el);\r
+                r = o;\r
+            }\r
+        }\r
+        return r;\r
+    }\r
     \r
-    maskDisabled: true,\r
+    function createObjParam(el, pName, pValue) {\r
+        var p = createElement("param");\r
+        p.setAttribute("name", pName);  \r
+        p.setAttribute("value", pValue);\r
+        el.appendChild(p);\r
+    }\r
     \r
-    animCollapse: Ext.enableFx,\r
+    /* Cross-browser SWF removal\r
+        - Especially needed to safely and completely remove a SWF in Internet Explorer\r
+    */\r
+    function removeSWF(id) {\r
+        var obj = getElementById(id);\r
+        if (obj && obj.nodeName == "OBJECT") {\r
+            if (ua.ie && ua.win) {\r
+                obj.style.display = "none";\r
+                (function(){\r
+                    if (obj.readyState == 4) {\r
+                        removeObjectInIE(id);\r
+                    }\r
+                    else {\r
+                        setTimeout(arguments.callee, 10);\r
+                    }\r
+                })();\r
+            }\r
+            else {\r
+                obj.parentNode.removeChild(obj);\r
+            }\r
+        }\r
+    }\r
     \r
-    headerAsText: true,\r
+    function removeObjectInIE(id) {\r
+        var obj = getElementById(id);\r
+        if (obj) {\r
+            for (var i in obj) {\r
+                if (typeof obj[i] == "function") {\r
+                    obj[i] = null;\r
+                }\r
+            }\r
+            obj.parentNode.removeChild(obj);\r
+        }\r
+    }\r
     \r
-    buttonAlign: 'right',\r
+    /* Functions to optimize JavaScript compression\r
+    */\r
+    function getElementById(id) {\r
+        var el = null;\r
+        try {\r
+            el = doc.getElementById(id);\r
+        }\r
+        catch (e) {}\r
+        return el;\r
+    }\r
     \r
-    collapsed : false,\r
+    function createElement(el) {\r
+        return doc.createElement(el);\r
+    }\r
     \r
-    collapseFirst: true,\r
+    /* Updated attachEvent function for Internet Explorer\r
+        - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks\r
+    */  \r
+    function addListener(target, eventType, fn) {\r
+        target.attachEvent(eventType, fn);\r
+        listenersArr[listenersArr.length] = [target, eventType, fn];\r
+    }\r
     \r
-    minButtonWidth:75,\r
+    /* Flash Player and SWF content version matching\r
+    */\r
+    function hasPlayerVersion(rv) {\r
+        var pv = ua.pv, v = rv.split(".");\r
+        v[0] = parseInt(v[0], 10);\r
+        v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0"\r
+        v[2] = parseInt(v[2], 10) || 0;\r
+        return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false;\r
+    }\r
     \r
-    elements : 'body',\r
-\r
-    // protected - these could be used to customize the behavior of the window,\r
-    // but changing them would not be useful without further mofifications and\r
-    // could lead to unexpected or undesirable results.\r
-    toolTarget : 'header',\r
-    collapseEl : 'bwrap',\r
-    slideAnchor : 't',\r
-    disabledClass: '',\r
-\r
-    // private, notify box this class will handle heights\r
-    deferHeight: true,\r
-    // private\r
-    expandDefaults: {\r
-        duration:.25\r
-    },\r
-    // private\r
-    collapseDefaults: {\r
-        duration:.25\r
-    },\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.Panel.superclass.initComponent.call(this);\r
-\r
-        this.addEvents(\r
-            \r
-            'bodyresize',\r
-            \r
-            'titlechange',\r
-            \r
-            'iconchange',\r
-            \r
-            'collapse',\r
-            \r
-            'expand',\r
-            \r
-            'beforecollapse',\r
-            \r
-            'beforeexpand',\r
-            \r
-            'beforeclose',\r
-            \r
-            'close',\r
-            \r
-            'activate',\r
-            \r
-            'deactivate'\r
-        );\r
-\r
-        // shortcuts\r
-        if(this.tbar){\r
-            this.elements += ',tbar';\r
-            if(typeof this.tbar == 'object'){\r
-                this.topToolbar = this.tbar;\r
+    /* Cross-browser dynamic CSS creation\r
+        - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php\r
+    */  \r
+    function createCSS(sel, decl, media, newStyle) {\r
+        if (ua.ie && ua.mac) { return; }\r
+        var h = doc.getElementsByTagName("head")[0];\r
+        if (!h) { return; } // to also support badly authored HTML pages that lack a head element\r
+        var m = (media && typeof media == "string") ? media : "screen";\r
+        if (newStyle) {\r
+            dynamicStylesheet = null;\r
+            dynamicStylesheetMedia = null;\r
+        }\r
+        if (!dynamicStylesheet || dynamicStylesheetMedia != m) { \r
+            // create dynamic stylesheet + get a global reference to it\r
+            var s = createElement("style");\r
+            s.setAttribute("type", "text/css");\r
+            s.setAttribute("media", m);\r
+            dynamicStylesheet = h.appendChild(s);\r
+            if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) {\r
+                dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1];\r
             }\r
-            delete this.tbar;\r
+            dynamicStylesheetMedia = m;\r
         }\r
-        if(this.bbar){\r
-            this.elements += ',bbar';\r
-            if(typeof this.bbar == 'object'){\r
-                this.bottomToolbar = this.bbar;\r
+        // add style rule\r
+        if (ua.ie && ua.win) {\r
+            if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) {\r
+                dynamicStylesheet.addRule(sel, decl);\r
             }\r
-            delete this.bbar;\r
         }\r
-\r
-        if(this.header === true){\r
-            this.elements += ',header';\r
-            delete this.header;\r
-        }else if(this.title && this.header !== false){\r
-            this.elements += ',header';\r
-        }\r
-\r
-        if(this.footer === true){\r
-            this.elements += ',footer';\r
-            delete this.footer;\r
-        }\r
-\r
-        if(this.buttons){\r
-            var btns = this.buttons;\r
-            \r
-            this.buttons = [];\r
-            for(var i = 0, len = btns.length; i < len; i++) {\r
-                if(btns[i].render){ // button instance\r
-                    btns[i].ownerCt = this;\r
-                    this.buttons.push(btns[i]);\r
-                }else{\r
-                    this.addButton(btns[i]);\r
-                }\r
-            }\r
-        }\r
-        if(this.autoLoad){\r
-            this.on('render', this.doAutoLoad, this, {delay:10});\r
-        }\r
-    },\r
-\r
-    // private\r
-    createElement : function(name, pnode){\r
-        if(this[name]){\r
-            pnode.appendChild(this[name].dom);\r
-            return;\r
-        }\r
-\r
-        if(name === 'bwrap' || this.elements.indexOf(name) != -1){\r
-            if(this[name+'Cfg']){\r
-                this[name] = Ext.fly(pnode).createChild(this[name+'Cfg']);\r
-            }else{\r
-                var el = document.createElement('div');\r
-                el.className = this[name+'Cls'];\r
-                this[name] = Ext.get(pnode.appendChild(el));\r
-            }\r
-            if(this[name+'CssClass']){\r
-                this[name].addClass(this[name+'CssClass']);\r
+        else {\r
+            if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) {\r
+                dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}"));\r
             }\r
-            if(this[name+'Style']){\r
-                this[name].applyStyles(this[name+'Style']);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.Panel.superclass.onRender.call(this, ct, position);\r
-\r
-        this.createClasses();\r
-\r
-        if(this.el){ // existing markup\r
-            this.el.addClass(this.baseCls);\r
-            this.header = this.el.down('.'+this.headerCls);\r
-            this.bwrap = this.el.down('.'+this.bwrapCls);\r
-            var cp = this.bwrap ? this.bwrap : this.el;\r
-            this.tbar = cp.down('.'+this.tbarCls);\r
-            this.body = cp.down('.'+this.bodyCls);\r
-            this.bbar = cp.down('.'+this.bbarCls);\r
-            this.footer = cp.down('.'+this.footerCls);\r
-            this.fromMarkup = true;\r
-        }else{\r
-            this.el = ct.createChild({\r
-                id: this.id,\r
-                cls: this.baseCls\r
-            }, position);\r
         }\r
-        var el = this.el, d = el.dom;\r
-\r
-        if(this.cls){\r
-            this.el.addClass(this.cls);\r
+    }\r
+    \r
+    function setVisibility(id, isVisible) {\r
+        if (!autoHideShow) { return; }\r
+        var v = isVisible ? "visible" : "hidden";\r
+        if (isDomLoaded && getElementById(id)) {\r
+            getElementById(id).style.visibility = v;\r
         }\r
-\r
-        if(this.buttons){\r
-            this.elements += ',footer';\r
+        else {\r
+            createCSS("#" + id, "visibility:" + v);\r
         }\r
+    }\r
 \r
-        // This block allows for maximum flexibility and performance when using existing markup\r
-\r
-        // framing requires special markup\r
-        if(this.frame){\r
-            el.insertHtml('afterBegin', String.format(Ext.Element.boxMarkup, this.baseCls));\r
-\r
-            this.createElement('header', d.firstChild.firstChild.firstChild);\r
-            this.createElement('bwrap', d);\r
-\r
-            // append the mid and bottom frame to the bwrap\r
-            var bw = this.bwrap.dom;\r
-            var ml = d.childNodes[1], bl = d.childNodes[2];\r
-            bw.appendChild(ml);\r
-            bw.appendChild(bl);\r
-\r
-            var mc = bw.firstChild.firstChild.firstChild;\r
-            this.createElement('tbar', mc);\r
-            this.createElement('body', mc);\r
-            this.createElement('bbar', mc);\r
-            this.createElement('footer', bw.lastChild.firstChild.firstChild);\r
-\r
-            if(!this.footer){\r
-                this.bwrap.dom.lastChild.className += ' x-panel-nofooter';\r
-            }\r
-        }else{\r
-            this.createElement('header', d);\r
-            this.createElement('bwrap', d);\r
-\r
-            // append the mid and bottom frame to the bwrap\r
-            var bw = this.bwrap.dom;\r
-            this.createElement('tbar', bw);\r
-            this.createElement('body', bw);\r
-            this.createElement('bbar', bw);\r
-            this.createElement('footer', bw);\r
-\r
-            if(!this.header){\r
-                this.body.addClass(this.bodyCls + '-noheader');\r
-                if(this.tbar){\r
-                    this.tbar.addClass(this.tbarCls + '-noheader');\r
+    /* Filter to avoid XSS attacks\r
+    */\r
+    function urlEncodeIfNecessary(s) {\r
+        var regex = /[\\\"<>\.;]/;\r
+        var hasBadChars = regex.exec(s) != null;\r
+        return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;\r
+    }\r
+    \r
+    /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only)\r
+    */\r
+    var cleanup = function() {\r
+        if (ua.ie && ua.win) {\r
+            window.attachEvent("onunload", function() {\r
+                // remove listeners to avoid memory leaks\r
+                var ll = listenersArr.length;\r
+                for (var i = 0; i < ll; i++) {\r
+                    listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]);\r
                 }\r
-            }\r
-        }\r
-\r
-        if(this.border === false){\r
-            this.el.addClass(this.baseCls + '-noborder');\r
-            this.body.addClass(this.bodyCls + '-noborder');\r
-            if(this.header){\r
-                this.header.addClass(this.headerCls + '-noborder');\r
-            }\r
-            if(this.footer){\r
-                this.footer.addClass(this.footerCls + '-noborder');\r
-            }\r
-            if(this.tbar){\r
-                this.tbar.addClass(this.tbarCls + '-noborder');\r
-            }\r
-            if(this.bbar){\r
-                this.bbar.addClass(this.bbarCls + '-noborder');\r
-            }\r
-        }\r
-\r
-        if(this.bodyBorder === false){\r
-           this.body.addClass(this.bodyCls + '-noborder');\r
-        }\r
-\r
-        this.bwrap.enableDisplayMode('block');\r
-\r
-        if(this.header){\r
-            this.header.unselectable();\r
-\r
-            // for tools, we need to wrap any existing header markup\r
-            if(this.headerAsText){\r
-                this.header.dom.innerHTML =\r
-                    '<span class="' + this.headerTextCls + '">'+this.header.dom.innerHTML+'</span>';\r
-\r
-                if(this.iconCls){\r
-                    this.setIconClass(this.iconCls);\r
+                // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect\r
+                var il = objIdArr.length;\r
+                for (var j = 0; j < il; j++) {\r
+                    removeSWF(objIdArr[j]);\r
                 }\r
-            }\r
-        }\r
-\r
-        if(this.floating){\r
-            this.makeFloating(this.floating);\r
+                // cleanup library's main closures to avoid memory leaks\r
+                for (var k in ua) {\r
+                    ua[k] = null;\r
+                }\r
+                ua = null;\r
+                for (var l in swfobject) {\r
+                    swfobject[l] = null;\r
+                }\r
+                swfobject = null;\r
+            });\r
         }\r
-\r
-        if(this.collapsible){\r
-            this.tools = this.tools ? this.tools.slice(0) : [];\r
-            if(!this.hideCollapseTool){\r
-                this.tools[this.collapseFirst?'unshift':'push']({\r
-                    id: 'toggle',\r
-                    handler : this.toggleCollapse,\r
-                    scope: this\r
-                });\r
-            }\r
-            if(this.titleCollapse && this.header){\r
-                this.header.on('click', this.toggleCollapse, this);\r
-                this.header.setStyle('cursor', 'pointer');\r
+    }();\r
+    \r
+    return {\r
+        /* Public API\r
+            - Reference: http://code.google.com/p/swfobject/wiki/documentation\r
+        */ \r
+        registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) {\r
+            if (ua.w3 && objectIdStr && swfVersionStr) {\r
+                var regObj = {};\r
+                regObj.id = objectIdStr;\r
+                regObj.swfVersion = swfVersionStr;\r
+                regObj.expressInstall = xiSwfUrlStr;\r
+                regObj.callbackFn = callbackFn;\r
+                regObjArr[regObjArr.length] = regObj;\r
+                setVisibility(objectIdStr, false);\r
+            }\r
+            else if (callbackFn) {\r
+                callbackFn({success:false, id:objectIdStr});\r
             }\r
-        }\r
-        if(this.tools){\r
-            var ts = this.tools;\r
-            this.tools = {};\r
-            this.addTool.apply(this, ts);\r
-        }else{\r
-            this.tools = {};\r
-        }\r
-\r
-        if(this.buttons && this.buttons.length > 0){\r
-            // tables are required to maintain order and for correct IE layout\r
-            var tb = this.footer.createChild({cls:'x-panel-btns-ct', cn: {\r
-                cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,\r
-                html:'<table cellspacing="0"><tbody><tr></tr></tbody></table><div class="x-clear"></div>'\r
-            }}, null, true);\r
-            var tr = tb.getElementsByTagName('tr')[0];\r
-            for(var i = 0, len = this.buttons.length; i < len; i++) {\r
-                var b = this.buttons[i];\r
-                var td = document.createElement('td');\r
-                td.className = 'x-panel-btn-td';\r
-                b.render(tr.appendChild(td));\r
+        },\r
+        \r
+        getObjectById: function(objectIdStr) {\r
+            if (ua.w3) {\r
+                return getObjectById(objectIdStr);\r
             }\r
-        }\r
-\r
-        if(this.tbar && this.topToolbar){\r
-            if(Ext.isArray(this.topToolbar)){\r
-                this.topToolbar = new Ext.Toolbar(this.topToolbar);\r
+        },\r
+        \r
+        embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) {\r
+            var callbackObj = {success:false, id:replaceElemIdStr};\r
+            if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) {\r
+                setVisibility(replaceElemIdStr, false);\r
+                addDomLoadEvent(function() {\r
+                    widthStr += ""; // auto-convert to string\r
+                    heightStr += "";\r
+                    var att = {};\r
+                    if (attObj && typeof attObj === OBJECT) {\r
+                        for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs\r
+                            att[i] = attObj[i];\r
+                        }\r
+                    }\r
+                    att.data = swfUrlStr;\r
+                    att.width = widthStr;\r
+                    att.height = heightStr;\r
+                    var par = {}; \r
+                    if (parObj && typeof parObj === OBJECT) {\r
+                        for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs\r
+                            par[j] = parObj[j];\r
+                        }\r
+                    }\r
+                    if (flashvarsObj && typeof flashvarsObj === OBJECT) {\r
+                        for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs\r
+                            if (typeof par.flashvars != UNDEF) {\r
+                                par.flashvars += "&" + k + "=" + flashvarsObj[k];\r
+                            }\r
+                            else {\r
+                                par.flashvars = k + "=" + flashvarsObj[k];\r
+                            }\r
+                        }\r
+                    }\r
+                    if (hasPlayerVersion(swfVersionStr)) { // create SWF\r
+                        var obj = createSWF(att, par, replaceElemIdStr);\r
+                        if (att.id == replaceElemIdStr) {\r
+                            setVisibility(replaceElemIdStr, true);\r
+                        }\r
+                        callbackObj.success = true;\r
+                        callbackObj.ref = obj;\r
+                    }\r
+                    else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install\r
+                        att.data = xiSwfUrlStr;\r
+                        showExpressInstall(att, par, replaceElemIdStr, callbackFn);\r
+                        return;\r
+                    }\r
+                    else { // show alternative content\r
+                        setVisibility(replaceElemIdStr, true);\r
+                    }\r
+                    if (callbackFn) { callbackFn(callbackObj); }\r
+                });\r
             }\r
-            this.topToolbar.render(this.tbar);\r
-            this.topToolbar.ownerCt = this;\r
-        }\r
-        if(this.bbar && this.bottomToolbar){\r
-            if(Ext.isArray(this.bottomToolbar)){\r
-                this.bottomToolbar = new Ext.Toolbar(this.bottomToolbar);\r
+            else if (callbackFn) { callbackFn(callbackObj); }\r
+        },\r
+        \r
+        switchOffAutoHideShow: function() {\r
+            autoHideShow = false;\r
+        },\r
+        \r
+        ua: ua,\r
+        \r
+        getFlashPlayerVersion: function() {\r
+            return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] };\r
+        },\r
+        \r
+        hasFlashPlayerVersion: hasPlayerVersion,\r
+        \r
+        createSWF: function(attObj, parObj, replaceElemIdStr) {\r
+            if (ua.w3) {\r
+                return createSWF(attObj, parObj, replaceElemIdStr);\r
             }\r
-            this.bottomToolbar.render(this.bbar);\r
-            this.bottomToolbar.ownerCt = this;\r
-        }\r
-    },\r
-\r
-    \r
-    setIconClass : function(cls){\r
-        var old = this.iconCls;\r
-        this.iconCls = cls;\r
-        if(this.rendered && this.header){\r
-            if(this.frame){\r
-                this.header.addClass('x-panel-icon');\r
-                this.header.replaceClass(old, this.iconCls);\r
-            }else{\r
-                var hd = this.header.dom;\r
-                var img = hd.firstChild && String(hd.firstChild.tagName).toLowerCase() == 'img' ? hd.firstChild : null;\r
-                if(img){\r
-                    Ext.fly(img).replaceClass(old, this.iconCls);\r
-                }else{\r
-                    Ext.DomHelper.insertBefore(hd.firstChild, {\r
-                        tag:'img', src: Ext.BLANK_IMAGE_URL, cls:'x-panel-inline-icon '+this.iconCls\r
-                    });\r
-                 }\r
+            else {\r
+                return undefined;\r
             }\r
-        }\r
-        this.fireEvent('iconchange', this, cls, old);\r
-    },\r
-\r
-    // private\r
-    makeFloating : function(cfg){\r
-        this.floating = true;\r
-        this.el = new Ext.Layer(\r
-            typeof cfg == 'object' ? cfg : {\r
-                shadow: this.shadow !== undefined ? this.shadow : 'sides',\r
-                shadowOffset: this.shadowOffset,\r
-                constrain:false,\r
-                shim: this.shim === false ? false : undefined\r
-            }, this.el\r
-        );\r
-    },\r
-\r
-    \r
-    getTopToolbar : function(){\r
-        return this.topToolbar;\r
-    },\r
-\r
-    \r
-    getBottomToolbar : function(){\r
-        return this.bottomToolbar;\r
-    },\r
-\r
-    \r
-    addButton : function(config, handler, scope){\r
-        var bc = {\r
-            handler: handler,\r
-            scope: scope,\r
-            minWidth: this.minButtonWidth,\r
-            hideParent:true\r
-        };\r
-        if(typeof config == "string"){\r
-            bc.text = config;\r
-        }else{\r
-            Ext.apply(bc, config);\r
-        }\r
-        var btn = new Ext.Button(bc);\r
-        btn.ownerCt = this;\r
-        if(!this.buttons){\r
-            this.buttons = [];\r
-        }\r
-        this.buttons.push(btn);\r
-        return btn;\r
-    },\r
-\r
-    // private\r
-    addTool : function(){\r
-        if(!this[this.toolTarget]) { // no where to render tools!\r
-            return;\r
-        }\r
-        if(!this.toolTemplate){\r
-            // initialize the global tool template on first use\r
-            var tt = new Ext.Template(\r
-                 '<div class="x-tool x-tool-{id}">&#160;</div>'\r
-            );\r
-            tt.disableFormats = true;\r
-            tt.compile();\r
-            Ext.Panel.prototype.toolTemplate = tt;\r
-        }\r
-        for(var i = 0, a = arguments, len = a.length; i < len; i++) {\r
-            var tc = a[i];\r
-            if(!this.tools[tc.id]){\r
-                   var overCls = 'x-tool-'+tc.id+'-over';\r
-                   var t = this.toolTemplate.insertFirst((tc.align !== 'left') ? this[this.toolTarget] : this[this.toolTarget].child('span'), tc, true);\r
-                   this.tools[tc.id] = t;\r
-                   t.enableDisplayMode('block');\r
-                   t.on('click', this.createToolHandler(t, tc, overCls, this));\r
-                   if(tc.on){\r
-                       t.on(tc.on);\r
-                   }\r
-                   if(tc.hidden){\r
-                       t.hide();\r
-                   }\r
-                   if(tc.qtip){\r
-                       if(typeof tc.qtip == 'object'){\r
-                           Ext.QuickTips.register(Ext.apply({\r
-                                 target: t.id\r
-                           }, tc.qtip));\r
-                       } else {\r
-                           t.dom.qtip = tc.qtip;\r
-                       }\r
-                   }\r
-                   t.addClassOnOver(overCls);\r
+        },\r
+        \r
+        showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) {\r
+            if (ua.w3 && canExpressInstall()) {\r
+                showExpressInstall(att, par, replaceElemIdStr, callbackFn);\r
             }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onShow : function(){\r
-        if(this.floating){\r
-            return this.el.show();\r
-        }\r
-        Ext.Panel.superclass.onShow.call(this);\r
-    },\r
-\r
-    // private\r
-    onHide : function(){\r
-        if(this.floating){\r
-            return this.el.hide();\r
-        }\r
-        Ext.Panel.superclass.onHide.call(this);\r
-    },\r
-\r
-    // private\r
-    createToolHandler : function(t, tc, overCls, panel){\r
-        return function(e){\r
-            t.removeClass(overCls);\r
-            e.stopEvent();\r
-            if(tc.handler){\r
-                tc.handler.call(tc.scope || t, e, t, panel);\r
+        },\r
+        \r
+        removeSWF: function(objElemIdStr) {\r
+            if (ua.w3) {\r
+                removeSWF(objElemIdStr);\r
             }\r
-        };\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        if(this.fromMarkup && this.height === undefined && !this.autoHeight){\r
-            this.height = this.el.getHeight();\r
-        }\r
-        if(this.floating && !this.hidden && !this.initHidden){\r
-            this.el.show();\r
-        }\r
-        if(this.title){\r
-            this.setTitle(this.title);\r
-        }\r
-        this.setAutoScroll();\r
-        if(this.html){\r
-            this.body.update(typeof this.html == 'object' ?\r
-                             Ext.DomHelper.markup(this.html) :\r
-                             this.html);\r
-            delete this.html;\r
-        }\r
-        if(this.contentEl){\r
-            var ce = Ext.getDom(this.contentEl);\r
-            Ext.fly(ce).removeClass(['x-hidden', 'x-hide-display']);\r
-            this.body.dom.appendChild(ce);\r
-        }\r
-        if(this.collapsed){\r
-            this.collapsed = false;\r
-            this.collapse(false);\r
-        }\r
-        Ext.Panel.superclass.afterRender.call(this); // do sizing calcs last\r
-        this.initEvents();\r
-    },\r
-\r
-    // private\r
-    setAutoScroll : function(){\r
-        if(this.rendered && this.autoScroll){\r
-            var el = this.body || this.el;\r
-            if(el){\r
-                el.setOverflow('auto');\r
+        },\r
+        \r
+        createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) {\r
+            if (ua.w3) {\r
+                createCSS(selStr, declStr, mediaStr, newStyleBoolean);\r
             }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getKeyMap : function(){\r
-        if(!this.keyMap){\r
-            this.keyMap = new Ext.KeyMap(this.el, this.keys);\r
-        }\r
-        return this.keyMap;\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        if(this.keys){\r
-            this.getKeyMap();\r
-        }\r
-        if(this.draggable){\r
-            this.initDraggable();\r
-        }\r
-    },\r
-\r
-    // private\r
-    initDraggable : function(){\r
+        },\r
         \r
-        this.dd = new Ext.Panel.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);\r
-    },\r
-\r
-    // private\r
-    beforeEffect : function(){\r
-        if(this.floating){\r
-            this.el.beforeAction();\r
-        }\r
-        this.el.addClass('x-panel-animated');\r
-    },\r
-\r
-    // private\r
-    afterEffect : function(){\r
-        this.syncShadow();\r
-        this.el.removeClass('x-panel-animated');\r
-    },\r
-\r
-    // private - wraps up an animation param with internal callbacks\r
-    createEffect : function(a, cb, scope){\r
-        var o = {\r
-            scope:scope,\r
-            block:true\r
-        };\r
-        if(a === true){\r
-            o.callback = cb;\r
-            return o;\r
-        }else if(!a.callback){\r
-            o.callback = cb;\r
-        }else { // wrap it up\r
-            o.callback = function(){\r
-                cb.call(scope);\r
-                Ext.callback(a.callback, a.scope);\r
-            };\r
-        }\r
-        return Ext.applyIf(o, a);\r
-    },\r
-\r
-    \r
-    collapse : function(animate){\r
-        if(this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforecollapse', this, animate) === false){\r
-            return;\r
-        }\r
-        var doAnim = animate === true || (animate !== false && this.animCollapse);\r
-        this.beforeEffect();\r
-        this.onCollapse(doAnim, animate);\r
-        return this;\r
-    },\r
-\r
-    // private\r
-    onCollapse : function(doAnim, animArg){\r
-        if(doAnim){\r
-            this[this.collapseEl].slideOut(this.slideAnchor,\r
-                    Ext.apply(this.createEffect(animArg||true, this.afterCollapse, this),\r
-                        this.collapseDefaults));\r
-        }else{\r
-            this[this.collapseEl].hide();\r
-            this.afterCollapse();\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterCollapse : function(){\r
-        this.collapsed = true;\r
-        this.el.addClass(this.collapsedCls);\r
-        this.afterEffect();\r
-        this.fireEvent('collapse', this);\r
-    },\r
-\r
-    \r
-    expand : function(animate){\r
-        if(!this.collapsed || this.el.hasFxBlock() || this.fireEvent('beforeexpand', this, animate) === false){\r
-            return;\r
-        }\r
-        var doAnim = animate === true || (animate !== false && this.animCollapse);\r
-        this.el.removeClass(this.collapsedCls);\r
-        this.beforeEffect();\r
-        this.onExpand(doAnim, animate);\r
-        return this;\r
-    },\r
-\r
-    // private\r
-    onExpand : function(doAnim, animArg){\r
-        if(doAnim){\r
-            this[this.collapseEl].slideIn(this.slideAnchor,\r
-                    Ext.apply(this.createEffect(animArg||true, this.afterExpand, this),\r
-                        this.expandDefaults));\r
-        }else{\r
-            this[this.collapseEl].show();\r
-            this.afterExpand();\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterExpand : function(){\r
-        this.collapsed = false;\r
-        this.afterEffect();\r
-        this.fireEvent('expand', this);\r
-    },\r
-\r
-    \r
-    toggleCollapse : function(animate){\r
-        this[this.collapsed ? 'expand' : 'collapse'](animate);\r
-        return this;\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        if(this.rendered && this.maskDisabled){\r
-            this.el.mask();\r
-        }\r
-        Ext.Panel.superclass.onDisable.call(this);\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        if(this.rendered && this.maskDisabled){\r
-            this.el.unmask();\r
-        }\r
-        Ext.Panel.superclass.onEnable.call(this);\r
-    },\r
-\r
-    // private\r
-    onResize : function(w, h){\r
-        if(w !== undefined || h !== undefined){\r
-            if(!this.collapsed){\r
-                if(typeof w == 'number'){\r
-                    this.body.setWidth(\r
-                            this.adjustBodyWidth(w - this.getFrameWidth()));\r
-                }else if(w == 'auto'){\r
-                    this.body.setWidth(w);\r
-                }\r
-\r
-                if(typeof h == 'number'){\r
-                    this.body.setHeight(\r
-                            this.adjustBodyHeight(h - this.getFrameHeight()));\r
-                }else if(h == 'auto'){\r
-                    this.body.setHeight(h);\r
-                }\r
-                \r
-                if(this.disabled && this.el._mask){\r
-                    this.el._mask.setSize(this.el.dom.clientWidth, this.el.getHeight());\r
+        addDomLoadEvent: addDomLoadEvent,\r
+        \r
+        addLoadEvent: addLoadEvent,\r
+        \r
+        getQueryParamValue: function(param) {\r
+            var q = doc.location.search || doc.location.hash;\r
+            if (q) {\r
+                if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark\r
+                if (param == null) {\r
+                    return urlEncodeIfNecessary(q);\r
                 }\r
-            }else{\r
-                this.queuedBodySize = {width: w, height: h};\r
-                if(!this.queuedExpand && this.allowQueuedExpand !== false){\r
-                    this.queuedExpand = true;\r
-                    this.on('expand', function(){\r
-                        delete this.queuedExpand;\r
-                        this.onResize(this.queuedBodySize.width, this.queuedBodySize.height);\r
-                        this.doLayout();\r
-                    }, this, {single:true});\r
+                var pairs = q.split("&");\r
+                for (var i = 0; i < pairs.length; i++) {\r
+                    if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {\r
+                        return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1)));\r
+                    }\r
                 }\r
             }\r
-            this.fireEvent('bodyresize', this, w, h);\r
-        }\r
-        this.syncShadow();\r
-    },\r
-\r
-    // private\r
-    adjustBodyHeight : function(h){\r
-        return h;\r
-    },\r
-\r
-    // private\r
-    adjustBodyWidth : function(w){\r
-        return w;\r
-    },\r
-\r
-    // private\r
-    onPosition : function(){\r
-        this.syncShadow();\r
-    },\r
-\r
-    \r
-    getFrameWidth : function(){\r
-        var w = this.el.getFrameWidth('lr');\r
-\r
-        if(this.frame){\r
-            var l = this.bwrap.dom.firstChild;\r
-            w += (Ext.fly(l).getFrameWidth('l') + Ext.fly(l.firstChild).getFrameWidth('r'));\r
-            var mc = this.bwrap.dom.firstChild.firstChild.firstChild;\r
-            w += Ext.fly(mc).getFrameWidth('lr');\r
-        }\r
-        return w;\r
-    },\r
-\r
-    \r
-    getFrameHeight : function(){\r
-        var h  = this.el.getFrameWidth('tb');\r
-        h += (this.tbar ? this.tbar.getHeight() : 0) +\r
-             (this.bbar ? this.bbar.getHeight() : 0);\r
-\r
-        if(this.frame){\r
-            var hd = this.el.dom.firstChild;\r
-            var ft = this.bwrap.dom.lastChild;\r
-            h += (hd.offsetHeight + ft.offsetHeight);\r
-            var mc = this.bwrap.dom.firstChild.firstChild.firstChild;\r
-            h += Ext.fly(mc).getFrameWidth('tb');\r
-        }else{\r
-            h += (this.header ? this.header.getHeight() : 0) +\r
-                (this.footer ? this.footer.getHeight() : 0);\r
-        }\r
-        return h;\r
-    },\r
-\r
-    \r
-    getInnerWidth : function(){\r
-        return this.getSize().width - this.getFrameWidth();\r
-    },\r
-\r
-    \r
-    getInnerHeight : function(){\r
-        return this.getSize().height - this.getFrameHeight();\r
-    },\r
-\r
-    // private\r
-    syncShadow : function(){\r
-        if(this.floating){\r
-            this.el.sync(true);\r
-        }\r
-    },\r
-\r
-    // private\r
-    getLayoutTarget : function(){\r
-        return this.body;\r
-    },\r
-\r
-    \r
-    setTitle : function(title, iconCls){\r
-        this.title = title;\r
-        if(this.header && this.headerAsText){\r
-            this.header.child('span').update(title);\r
-        }\r
-        if(iconCls){\r
-            this.setIconClass(iconCls);\r
-        }\r
-        this.fireEvent('titlechange', this, title);\r
-        return this;\r
-    },\r
-\r
-    \r
-    getUpdater : function(){\r
-        return this.body.getUpdater();\r
-    },\r
-\r
-     \r
-    load : function(){\r
-        var um = this.body.getUpdater();\r
-        um.update.apply(um, arguments);\r
-        return this;\r
-    },\r
-\r
-    // private\r
-    beforeDestroy : function(){\r
-        if(this.header){\r
-            this.header.removeAllListeners();\r
-            if(this.headerAsText){\r
-                Ext.Element.uncache(this.header.child('span'));\r
-            }\r
-        }\r
-        Ext.Element.uncache(\r
-            this.header,\r
-            this.tbar,\r
-            this.bbar,\r
-            this.footer,\r
-            this.body,\r
-            this.bwrap\r
-        );\r
-        if(this.tools){\r
-            for(var k in this.tools){\r
-                Ext.destroy(this.tools[k]);\r
-            }\r
-        }\r
-        if(this.buttons){\r
-            for(var b in this.buttons){\r
-                Ext.destroy(this.buttons[b]);\r
-            }\r
-        }\r
-        Ext.destroy(\r
-            this.topToolbar,\r
-            this.bottomToolbar\r
-        );\r
-        Ext.Panel.superclass.beforeDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    createClasses : function(){\r
-        this.headerCls = this.baseCls + '-header';\r
-        this.headerTextCls = this.baseCls + '-header-text';\r
-        this.bwrapCls = this.baseCls + '-bwrap';\r
-        this.tbarCls = this.baseCls + '-tbar';\r
-        this.bodyCls = this.baseCls + '-body';\r
-        this.bbarCls = this.baseCls + '-bbar';\r
-        this.footerCls = this.baseCls + '-footer';\r
-    },\r
-\r
-    // private\r
-    createGhost : function(cls, useShim, appendTo){\r
-        var el = document.createElement('div');\r
-        el.className = 'x-panel-ghost ' + (cls ? cls : '');\r
-        if(this.header){\r
-            el.appendChild(this.el.dom.firstChild.cloneNode(true));\r
-        }\r
-        Ext.fly(el.appendChild(document.createElement('ul'))).setHeight(this.bwrap.getHeight());\r
-        el.style.width = this.el.dom.offsetWidth + 'px';;\r
-        if(!appendTo){\r
-            this.container.dom.appendChild(el);\r
-        }else{\r
-            Ext.getDom(appendTo).appendChild(el);\r
-        }\r
-        if(useShim !== false && this.el.useShim !== false){\r
-            var layer = new Ext.Layer({shadow:false, useDisplay:true, constrain:false}, el);\r
-            layer.show();\r
-            return layer;\r
-        }else{\r
-            return new Ext.Element(el);\r
-        }\r
-    },\r
-\r
-    // private\r
-    doAutoLoad : function(){\r
-        this.body.load(\r
-            typeof this.autoLoad == 'object' ?\r
-                this.autoLoad : {url: this.autoLoad});\r
-    },\r
-    \r
-    \r
-    getTool: function(id) {\r
-        return this.tools[id];\r
-    }\r
-\r
-\r
-});\r
-Ext.reg('panel', Ext.Panel);\r
-\r
-\r
-Ext.Window = Ext.extend(Ext.Panel, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    baseCls : 'x-window',\r
-    \r
-    resizable:true,\r
-    \r
-    draggable:true,\r
-    \r
-    closable : true,\r
-    \r
-    constrain:false,\r
-    \r
-    constrainHeader:false,\r
-    \r
-    plain:false,\r
-    \r
-    minimizable : false,\r
-    \r
-    maximizable : false,\r
-    \r
-    minHeight: 100,\r
-    \r
-    minWidth: 200,\r
-    \r
-    expandOnShow: true,\r
-    \r
-    closeAction: 'close',\r
-    \r
-    elements: 'header,body',\r
-\r
-    // inherited docs, same default\r
-    collapsible:false,\r
-\r
-    // private\r
-    initHidden : true,\r
-    \r
-    monitorResize : true,\r
-    \r
-    frame:true,\r
-    \r
-    floating:true,\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.Window.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            \r
-            \r
-            'resize',\r
-            \r
-            'maximize',\r
-            \r
-            'minimize',\r
-            \r
-            'restore'\r
-        );\r
-    },\r
-\r
-    // private\r
-    getState : function(){\r
-        return Ext.apply(Ext.Window.superclass.getState.call(this) || {}, this.getBox());\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.Window.superclass.onRender.call(this, ct, position);\r
-\r
-        if(this.plain){\r
-            this.el.addClass('x-window-plain');\r
-        }\r
-\r
-        // this element allows the Window to be focused for keyboard events\r
-        this.focusEl = this.el.createChild({\r
-                    tag: "a", href:"#", cls:"x-dlg-focus",\r
-                    tabIndex:"-1", html: "&#160;"});\r
-        this.focusEl.swallowEvent('click', true);\r
-\r
-        this.proxy = this.el.createProxy("x-window-proxy");\r
-        this.proxy.enableDisplayMode('block');\r
-\r
-        if(this.modal){\r
-            this.mask = this.container.createChild({cls:"ext-el-mask"}, this.el.dom);\r
-            this.mask.enableDisplayMode("block");\r
-            this.mask.hide();\r
-            this.mask.on('click', this.focus, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.Window.superclass.initEvents.call(this);\r
-        if(this.animateTarget){\r
-            this.setAnimateTarget(this.animateTarget);\r
-        }\r
-\r
-        if(this.resizable){\r
-            this.resizer = new Ext.Resizable(this.el, {\r
-                minWidth: this.minWidth,\r
-                minHeight:this.minHeight,\r
-                handles: this.resizeHandles || "all",\r
-                pinned: true,\r
-                resizeElement : this.resizerAction\r
-            });\r
-            this.resizer.window = this;\r
-            this.resizer.on("beforeresize", this.beforeResize, this);\r
-        }\r
-\r
-        if(this.draggable){\r
-            this.header.addClass("x-window-draggable");\r
-        }\r
-        this.initTools();\r
-\r
-        this.el.on("mousedown", this.toFront, this);\r
-        this.manager = this.manager || Ext.WindowMgr;\r
-        this.manager.register(this);\r
-        this.hidden = true;\r
-        if(this.maximized){\r
-            this.maximized = false;\r
-            this.maximize();\r
-        }\r
-        if(this.closable){\r
-            var km = this.getKeyMap();\r
-            km.on(27, this.onEsc, this);\r
-            km.disable();\r
-        }\r
-    },\r
-\r
-    initDraggable : function(){\r
-        \r
-        this.dd = new Ext.Window.DD(this);\r
-    },\r
-\r
-   // private\r
-    onEsc : function(){\r
-        this[this.closeAction]();\r
-    },\r
-\r
-    // private\r
-    beforeDestroy : function(){\r
-        this.hide();\r
-        if(this.doAnchor){\r
-            Ext.EventManager.removeResizeListener(this.doAnchor, this);\r
-            Ext.EventManager.un(window, 'scroll', this.doAnchor, this);\r
-        }\r
-        Ext.destroy(\r
-            this.focusEl,\r
-            this.resizer,\r
-            this.dd,\r
-            this.proxy,\r
-            this.mask\r
-        );\r
-        Ext.Window.superclass.beforeDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.manager){\r
-            this.manager.unregister(this);\r
-        }\r
-        Ext.Window.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    initTools : function(){\r
-        if(this.minimizable){\r
-            this.addTool({\r
-                id: 'minimize',\r
-                handler: this.minimize.createDelegate(this, [])\r
-            });\r
-        }\r
-        if(this.maximizable){\r
-            this.addTool({\r
-                id: 'maximize',\r
-                handler: this.maximize.createDelegate(this, [])\r
-            });\r
-            this.addTool({\r
-                id: 'restore',\r
-                handler: this.restore.createDelegate(this, []),\r
-                hidden:true\r
-            });\r
-            this.header.on('dblclick', this.toggleMaximize, this);\r
-        }\r
-        if(this.closable){\r
-            this.addTool({\r
-                id: 'close',\r
-                handler: this[this.closeAction].createDelegate(this, [])\r
-            });\r
-        }\r
-    },\r
-\r
-    // private\r
-    resizerAction : function(){\r
-        var box = this.proxy.getBox();\r
-        this.proxy.hide();\r
-        this.window.handleResize(box);\r
-        return box;\r
-    },\r
-\r
-    // private\r
-    beforeResize : function(){\r
-        this.resizer.minHeight = Math.max(this.minHeight, this.getFrameHeight() + 40); // 40 is a magic minimum content size?\r
-        this.resizer.minWidth = Math.max(this.minWidth, this.getFrameWidth() + 40);\r
-        this.resizeBox = this.el.getBox();\r
-    },\r
-\r
-    // private\r
-    updateHandles : function(){\r
-        if(Ext.isIE && this.resizer){\r
-            this.resizer.syncHandleHeight();\r
-            this.el.repaint();\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleResize : function(box){\r
-        var rz = this.resizeBox;\r
-        if(rz.x != box.x || rz.y != box.y){\r
-            this.updateBox(box);\r
-        }else{\r
-            this.setSize(box);\r
-        }\r
-        this.focus();\r
-        this.updateHandles();\r
-        this.saveState();\r
-        if(this.layout){\r
-            this.doLayout();\r
-        }\r
-        this.fireEvent("resize", this, box.width, box.height);\r
-    },\r
-\r
-    \r
-    focus : function(){\r
-        var f = this.focusEl, db = this.defaultButton, t = typeof db;\r
-        if(t != 'undefined'){\r
-            if(t == 'number'){\r
-                f = this.buttons[db];\r
-            }else if(t == 'string'){\r
-                f = Ext.getCmp(db);\r
-            }else{\r
-                f = db;\r
-            }\r
-        }\r
-        f.focus.defer(10, f);\r
-    },\r
-\r
-    \r
-    setAnimateTarget : function(el){\r
-        el = Ext.get(el);\r
-        this.animateTarget = el;\r
-    },\r
-\r
-    // private\r
-    beforeShow : function(){\r
-        delete this.el.lastXY;\r
-        delete this.el.lastLT;\r
-        if(this.x === undefined || this.y === undefined){\r
-            var xy = this.el.getAlignToXY(this.container, 'c-c');\r
-            var pos = this.el.translatePoints(xy[0], xy[1]);\r
-            this.x = this.x === undefined? pos.left : this.x;\r
-            this.y = this.y === undefined? pos.top : this.y;\r
-        }\r
-        this.el.setLeftTop(this.x, this.y);\r
-\r
-        if(this.expandOnShow){\r
-            this.expand(false);\r
-        }\r
-\r
-        if(this.modal){\r
-            Ext.getBody().addClass("x-body-masked");\r
-            this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));\r
-            this.mask.show();\r
-        }\r
-    },\r
-\r
-    \r
-    show : function(animateTarget, cb, scope){\r
-        if(!this.rendered){\r
-            this.render(Ext.getBody());\r
-        }\r
-        if(this.hidden === false){\r
-            this.toFront();\r
-            return;\r
-        }\r
-        if(this.fireEvent("beforeshow", this) === false){\r
-            return;\r
-        }\r
-        if(cb){\r
-            this.on('show', cb, scope, {single:true});\r
-        }\r
-        this.hidden = false;\r
-        if(animateTarget !== undefined){\r
-            this.setAnimateTarget(animateTarget);\r
-        }\r
-        this.beforeShow();\r
-        if(this.animateTarget){\r
-            this.animShow();\r
-        }else{\r
-            this.afterShow();\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterShow : function(){\r
-        this.proxy.hide();\r
-        this.el.setStyle('display', 'block');\r
-        this.el.show();\r
-        if(this.maximized){\r
-            this.fitContainer();\r
-        }\r
-        if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug\r
-               this.cascade(this.setAutoScroll);\r
-        }\r
-\r
-        if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){\r
-            Ext.EventManager.onWindowResize(this.onWindowResize, this);\r
-        }\r
-        this.doConstrain();\r
-        if(this.layout){\r
-            this.doLayout();\r
-        }\r
-        if(this.keyMap){\r
-            this.keyMap.enable();\r
-        }\r
-        this.toFront();\r
-        this.updateHandles();\r
-        this.fireEvent("show", this);\r
-    },\r
-\r
-    // private\r
-    animShow : function(){\r
-        this.proxy.show();\r
-        this.proxy.setBox(this.animateTarget.getBox());\r
-        this.proxy.setOpacity(0);\r
-        var b = this.getBox(false);\r
-        b.callback = this.afterShow;\r
-        b.scope = this;\r
-        b.duration = .25;\r
-        b.easing = 'easeNone';\r
-        b.opacity = .5;\r
-        b.block = true;\r
-        this.el.setStyle('display', 'none');\r
-        this.proxy.shift(b);\r
-    },\r
-\r
-    \r
-    hide : function(animateTarget, cb, scope){\r
-        if(this.activeGhost){ // drag active?\r
-            this.hide.defer(100, this, [animateTarget, cb, scope]);\r
-            return;\r
-        }\r
-        if(this.hidden || this.fireEvent("beforehide", this) === false){\r
-            return;\r
-        }\r
-        if(cb){\r
-            this.on('hide', cb, scope, {single:true});\r
-        }\r
-        this.hidden = true;\r
-        if(animateTarget !== undefined){\r
-            this.setAnimateTarget(animateTarget);\r
-        }\r
-        if(this.animateTarget){\r
-            this.animHide();\r
-        }else{\r
-            this.el.hide();\r
-            this.afterHide();\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterHide : function(){\r
-        this.proxy.hide();\r
-        if(this.monitorResize || this.modal || this.constrain || this.constrainHeader){\r
-            Ext.EventManager.removeResizeListener(this.onWindowResize, this);\r
-        }\r
-        if(this.modal){\r
-            this.mask.hide();\r
-            Ext.getBody().removeClass("x-body-masked");\r
-        }\r
-        if(this.keyMap){\r
-            this.keyMap.disable();\r
-        }\r
-        this.fireEvent("hide", this);\r
-    },\r
-\r
-    // private\r
-    animHide : function(){\r
-        this.proxy.setOpacity(.5);\r
-        this.proxy.show();\r
-        var tb = this.getBox(false);\r
-        this.proxy.setBox(tb);\r
-        this.el.hide();\r
-        var b = this.animateTarget.getBox();\r
-        b.callback = this.afterHide;\r
-        b.scope = this;\r
-        b.duration = .25;\r
-        b.easing = 'easeNone';\r
-        b.block = true;\r
-        b.opacity = 0;\r
-        this.proxy.shift(b);\r
-    },\r
-\r
-    // private\r
-    onWindowResize : function(){\r
-        if(this.maximized){\r
-            this.fitContainer();\r
-        }\r
-        if(this.modal){\r
-            this.mask.setSize('100%', '100%');\r
-            var force = this.mask.dom.offsetHeight;\r
-            this.mask.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));\r
-        }\r
-        this.doConstrain();\r
-    },\r
-\r
-    // private\r
-    doConstrain : function(){\r
-        if(this.constrain || this.constrainHeader){\r
-            var offsets;\r
-            if(this.constrain){\r
-                offsets = {\r
-                    right:this.el.shadowOffset,\r
-                    left:this.el.shadowOffset,\r
-                    bottom:this.el.shadowOffset\r
-                };\r
-            }else {\r
-                var s = this.getSize();\r
-                offsets = {\r
-                    right:-(s.width - 100),\r
-                    bottom:-(s.height - 25)\r
-                };\r
-            }\r
-\r
-            var xy = this.el.getConstrainToXY(this.container, true, offsets);\r
-            if(xy){\r
-                this.setPosition(xy[0], xy[1]);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private - used for dragging\r
-    ghost : function(cls){\r
-        var ghost = this.createGhost(cls);\r
-        var box = this.getBox(true);\r
-        ghost.setLeftTop(box.x, box.y);\r
-        ghost.setWidth(box.width);\r
-        this.el.hide();\r
-        this.activeGhost = ghost;\r
-        return ghost;\r
-    },\r
-\r
-    // private\r
-    unghost : function(show, matchPosition){\r
-        if(show !== false){\r
-            this.el.show();\r
-            this.focus();\r
-               if(Ext.isMac && Ext.isGecko){ // work around stupid FF 2.0/Mac scroll bar bug\r
-                       this.cascade(this.setAutoScroll);\r
-               }\r
-        }\r
-        if(matchPosition !== false){\r
-            this.setPosition(this.activeGhost.getLeft(true), this.activeGhost.getTop(true));\r
-        }\r
-        this.activeGhost.hide();\r
-        this.activeGhost.remove();\r
-        delete this.activeGhost;\r
-    },\r
-\r
-    \r
-    minimize : function(){\r
-        this.fireEvent('minimize', this);\r
-    },\r
-\r
-    \r
-    close : function(){\r
-        if(this.fireEvent("beforeclose", this) !== false){\r
-            this.hide(null, function(){\r
-                this.fireEvent('close', this);\r
-                this.destroy();\r
-            }, this);\r
-        }\r
-    },\r
-\r
-    \r
-    maximize : function(){\r
-        if(!this.maximized){\r
-            this.expand(false);\r
-            this.restoreSize = this.getSize();\r
-            this.restorePos = this.getPosition(true);\r
-            if (this.maximizable){\r
-                this.tools.maximize.hide();\r
-                this.tools.restore.show();\r
-            }\r
-            this.maximized = true;\r
-            this.el.disableShadow();\r
-\r
-            if(this.dd){\r
-                this.dd.lock();\r
-            }\r
-            if(this.collapsible){\r
-                this.tools.toggle.hide();\r
-            }\r
-            this.el.addClass('x-window-maximized');\r
-            this.container.addClass('x-window-maximized-ct');\r
-\r
-            this.setPosition(0, 0);\r
-            this.fitContainer();\r
-            this.fireEvent('maximize', this);\r
-        }\r
-    },\r
-\r
-    \r
-    restore : function(){\r
-        if(this.maximized){\r
-            this.el.removeClass('x-window-maximized');\r
-            this.tools.restore.hide();\r
-            this.tools.maximize.show();\r
-            this.setPosition(this.restorePos[0], this.restorePos[1]);\r
-            this.setSize(this.restoreSize.width, this.restoreSize.height);\r
-            delete this.restorePos;\r
-            delete this.restoreSize;\r
-            this.maximized = false;\r
-            this.el.enableShadow(true);\r
-\r
-            if(this.dd){\r
-                this.dd.unlock();\r
-            }\r
-            if(this.collapsible){\r
-                this.tools.toggle.show();\r
-            }\r
-            this.container.removeClass('x-window-maximized-ct');\r
-\r
-            this.doConstrain();\r
-            this.fireEvent('restore', this);\r
-        }\r
-    },\r
-\r
-    \r
-    toggleMaximize : function(){\r
-        this[this.maximized ? 'restore' : 'maximize']();\r
-    },\r
-\r
-    // private\r
-    fitContainer : function(){\r
-        var vs = this.container.getViewSize();\r
-        this.setSize(vs.width, vs.height);\r
-    },\r
-\r
-    // private\r
-    // z-index is managed by the WindowManager and may be overwritten at any time\r
-    setZIndex : function(index){\r
-        if(this.modal){\r
-            this.mask.setStyle("z-index", index);\r
-        }\r
-        this.el.setZIndex(++index);\r
-        index += 5;\r
-\r
-        if(this.resizer){\r
-            this.resizer.proxy.setStyle("z-index", ++index);\r
-        }\r
-\r
-        this.lastZIndex = index;\r
-    },\r
-\r
-    \r
-    alignTo : function(element, position, offsets){\r
-        var xy = this.el.getAlignToXY(element, position, offsets);\r
-        this.setPagePosition(xy[0], xy[1]);\r
-        return this;\r
-    },\r
-\r
-    \r
-    anchorTo : function(el, alignment, offsets, monitorScroll){\r
-      if(this.doAnchor){\r
-          Ext.EventManager.removeResizeListener(this.doAnchor, this);\r
-          Ext.EventManager.un(window, 'scroll', this.doAnchor, this);\r
-      }\r
-      this.doAnchor = function(){\r
-          this.alignTo(el, alignment, offsets);\r
-      };\r
-      Ext.EventManager.onWindowResize(this.doAnchor, this);\r
-      \r
-      var tm = typeof monitorScroll;\r
-      if(tm != 'undefined'){\r
-          Ext.EventManager.on(window, 'scroll', this.doAnchor, this,\r
-              {buffer: tm == 'number' ? monitorScroll : 50});\r
-      }\r
-      this.doAnchor();\r
-      return this;\r
-    },\r
-\r
-    \r
-    toFront : function(e){\r
-        if(this.manager.bringToFront(this)){\r
-            if(!e || !e.getTarget().focus){\r
-                this.focus();\r
-            }\r
-        }\r
-        return this;\r
-    },\r
-\r
-    \r
-    setActive : function(active){\r
-        if(active){\r
-            if(!this.maximized){\r
-                this.el.enableShadow(true);\r
-            }\r
-            this.fireEvent('activate', this);\r
-        }else{\r
-            this.el.disableShadow();\r
-            this.fireEvent('deactivate', this);\r
-        }\r
-    },\r
-\r
-    \r
-    toBack : function(){\r
-        this.manager.sendToBack(this);\r
-        return this;\r
-    },\r
-\r
-    \r
-    center : function(){\r
-        var xy = this.el.getAlignToXY(this.container, 'c-c');\r
-        this.setPagePosition(xy[0], xy[1]);\r
-        return this;\r
-    }\r
-\r
-    \r
-});\r
-Ext.reg('window', Ext.Window);\r
-\r
-// private - custom Window DD implementation\r
-Ext.Window.DD = function(win){\r
-    this.win = win;\r
-    Ext.Window.DD.superclass.constructor.call(this, win.el.id, 'WindowDD-'+win.id);\r
-    this.setHandleElId(win.header.id);\r
-    this.scroll = false;\r
-};\r
-\r
-Ext.extend(Ext.Window.DD, Ext.dd.DD, {\r
-    moveOnly:true,\r
-    headerOffsets:[100, 25],\r
-    startDrag : function(){\r
-        var w = this.win;\r
-        this.proxy = w.ghost();\r
-        if(w.constrain !== false){\r
-            var so = w.el.shadowOffset;\r
-            this.constrainTo(w.container, {right: so, left: so, bottom: so});\r
-        }else if(w.constrainHeader !== false){\r
-            var s = this.proxy.getSize();\r
-            this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])});\r
-        }\r
-    },\r
-    b4Drag : Ext.emptyFn,\r
-\r
-    onDrag : function(e){\r
-        this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY());\r
-    },\r
-\r
-    endDrag : function(e){\r
-        this.win.unghost();\r
-        this.win.saveState();\r
-    }\r
-});\r
-\r
-\r
-Ext.WindowGroup = function(){\r
-    var list = {};\r
-    var accessList = [];\r
-    var front = null;\r
-\r
-    // private\r
-    var sortWindows = function(d1, d2){\r
-        return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;\r
-    };\r
-\r
-    // private\r
-    var orderWindows = function(){\r
-        var a = accessList, len = a.length;\r
-        if(len > 0){\r
-            a.sort(sortWindows);\r
-            var seed = a[0].manager.zseed;\r
-            for(var i = 0; i < len; i++){\r
-                var win = a[i];\r
-                if(win && !win.hidden){\r
-                    win.setZIndex(seed + (i*10));\r
-                }\r
-            }\r
-        }\r
-        activateLast();\r
-    };\r
-\r
-    // private\r
-    var setActiveWin = function(win){\r
-        if(win != front){\r
-            if(front){\r
-                front.setActive(false);\r
-            }\r
-            front = win;\r
-            if(win){\r
-                win.setActive(true);\r
-            }\r
-        }\r
-    };\r
-\r
-    // private\r
-    var activateLast = function(){\r
-        for(var i = accessList.length-1; i >=0; --i) {\r
-            if(!accessList[i].hidden){\r
-                setActiveWin(accessList[i]);\r
-                return;\r
-            }\r
-        }\r
-        // none to activate\r
-        setActiveWin(null);\r
-    };\r
-\r
-    return {\r
-        \r
-        zseed : 9000,\r
-\r
-        // private\r
-        register : function(win){\r
-            list[win.id] = win;\r
-            accessList.push(win);\r
-            win.on('hide', activateLast);\r
-        },\r
-\r
-        // private\r
-        unregister : function(win){\r
-            delete list[win.id];\r
-            win.un('hide', activateLast);\r
-            accessList.remove(win);\r
-        },\r
-\r
-        \r
-        get : function(id){\r
-            return typeof id == "object" ? id : list[id];\r
-        },\r
-\r
-        \r
-        bringToFront : function(win){\r
-            win = this.get(win);\r
-            if(win != front){\r
-                win._lastAccess = new Date().getTime();\r
-                orderWindows();\r
-                return true;\r
-            }\r
-            return false;\r
-        },\r
-\r
-        \r
-        sendToBack : function(win){\r
-            win = this.get(win);\r
-            win._lastAccess = -(new Date().getTime());\r
-            orderWindows();\r
-            return win;\r
-        },\r
-\r
-        \r
-        hideAll : function(){\r
-            for(var id in list){\r
-                if(list[id] && typeof list[id] != "function" && list[id].isVisible()){\r
-                    list[id].hide();\r
-                }\r
-            }\r
-        },\r
-\r
-        \r
-        getActive : function(){\r
-            return front;\r
-        },\r
-\r
-        \r
-        getBy : function(fn, scope){\r
-            var r = [];\r
-            for(var i = accessList.length-1; i >=0; --i) {\r
-                var win = accessList[i];\r
-                if(fn.call(scope||win, win) !== false){\r
-                    r.push(win);\r
-                }\r
-            }\r
-            return r;\r
-        },\r
-\r
-        \r
-        each : function(fn, scope){\r
-            for(var id in list){\r
-                if(list[id] && typeof list[id] != "function"){\r
-                    if(fn.call(scope || list[id], list[id]) === false){\r
-                        return;\r
-                    }\r
-                }\r
-            }\r
-        }\r
-    };\r
-};\r
-\r
-\r
-\r
-Ext.WindowMgr = new Ext.WindowGroup();\r
-\r
-Ext.dd.PanelProxy = function(panel, config){\r
-    this.panel = panel;\r
-    this.id = this.panel.id +'-ddproxy';\r
-    Ext.apply(this, config);\r
-};\r
-\r
-Ext.dd.PanelProxy.prototype = {\r
-    \r
-    insertProxy : true,\r
-\r
-    // private overrides\r
-    setStatus : Ext.emptyFn,\r
-    reset : Ext.emptyFn,\r
-    update : Ext.emptyFn,\r
-    stop : Ext.emptyFn,\r
-    sync: Ext.emptyFn,\r
-\r
-    \r
-    getEl : function(){\r
-        return this.ghost;\r
-    },\r
-\r
-    \r
-    getGhost : function(){\r
-        return this.ghost;\r
-    },\r
-\r
-    \r
-    getProxy : function(){\r
-        return this.proxy;\r
-    },\r
-\r
-    \r
-    hide : function(){\r
-        if(this.ghost){\r
-            if(this.proxy){\r
-                this.proxy.remove();\r
-                delete this.proxy;\r
-            }\r
-            this.panel.el.dom.style.display = '';\r
-            this.ghost.remove();\r
-            delete this.ghost;\r
-        }\r
-    },\r
-\r
-    \r
-    show : function(){\r
-        if(!this.ghost){\r
-            this.ghost = this.panel.createGhost(undefined, undefined, Ext.getBody());\r
-            this.ghost.setXY(this.panel.el.getXY())\r
-            if(this.insertProxy){\r
-                this.proxy = this.panel.el.insertSibling({cls:'x-panel-dd-spacer'});\r
-                this.proxy.setSize(this.panel.getSize());\r
-            }\r
-            this.panel.el.dom.style.display = 'none';\r
-        }\r
-    },\r
-\r
-    // private\r
-    repair : function(xy, callback, scope){\r
-        this.hide();\r
-        if(typeof callback == "function"){\r
-            callback.call(scope || this);\r
-        }\r
-    },\r
-\r
-    \r
-    moveProxy : function(parentNode, before){\r
-        if(this.proxy){\r
-            parentNode.insertBefore(this.proxy.dom, before);\r
-        }\r
-    }\r
-};\r
-\r
-// private - DD implementation for Panels\r
-Ext.Panel.DD = function(panel, cfg){\r
-    this.panel = panel;\r
-    this.dragData = {panel: panel};\r
-    this.proxy = new Ext.dd.PanelProxy(panel, cfg);\r
-    Ext.Panel.DD.superclass.constructor.call(this, panel.el, cfg);\r
-    var h = panel.header;\r
-    if(h){\r
-        this.setHandleElId(h.id);\r
-    }\r
-    (h ? h : this.panel.body).setStyle('cursor', 'move');\r
-    this.scroll = false;\r
-};\r
-\r
-Ext.extend(Ext.Panel.DD, Ext.dd.DragSource, {\r
-    showFrame: Ext.emptyFn,\r
-    startDrag: Ext.emptyFn,\r
-    b4StartDrag: function(x, y) {\r
-        this.proxy.show();\r
-    },\r
-    b4MouseDown: function(e) {\r
-        var x = e.getPageX();\r
-        var y = e.getPageY();\r
-        this.autoOffset(x, y);\r
-    },\r
-    onInitDrag : function(x, y){\r
-        this.onStartDrag(x, y);\r
-        return true;\r
-    },\r
-    createFrame : Ext.emptyFn,\r
-    getDragEl : function(e){\r
-        return this.proxy.ghost.dom;\r
-    },\r
-    endDrag : function(e){\r
-        this.proxy.hide();\r
-        this.panel.saveState();\r
-    },\r
-\r
-    autoOffset : function(x, y) {\r
-        x -= this.startPageX;\r
-        y -= this.startPageY;\r
-        this.setDelta(x, y);\r
-    }\r
-});\r
-\r
-Ext.state.Provider = function(){\r
-    \r
-    this.addEvents("statechange");\r
-    this.state = {};\r
-    Ext.state.Provider.superclass.constructor.call(this);\r
-};\r
-Ext.extend(Ext.state.Provider, Ext.util.Observable, {\r
-    \r
-    get : function(name, defaultValue){\r
-        return typeof this.state[name] == "undefined" ?\r
-            defaultValue : this.state[name];\r
-    },\r
-    \r
-    \r
-    clear : function(name){\r
-        delete this.state[name];\r
-        this.fireEvent("statechange", this, name, null);\r
-    },\r
-    \r
-    \r
-    set : function(name, value){\r
-        this.state[name] = value;\r
-        this.fireEvent("statechange", this, name, value);\r
-    },\r
-    \r
-    \r
-    decodeValue : function(cookie){\r
-        var re = /^(a|n|d|b|s|o)\:(.*)$/;\r
-        var matches = re.exec(unescape(cookie));\r
-        if(!matches || !matches[1]) return; // non state cookie\r
-        var type = matches[1];\r
-        var v = matches[2];\r
-        switch(type){\r
-            case "n":\r
-                return parseFloat(v);\r
-            case "d":\r
-                return new Date(Date.parse(v));\r
-            case "b":\r
-                return (v == "1");\r
-            case "a":\r
-                var all = [];\r
-                var values = v.split("^");\r
-                for(var i = 0, len = values.length; i < len; i++){\r
-                    all.push(this.decodeValue(values[i]));\r
-                }\r
-                return all;\r
-           case "o":\r
-                var all = {};\r
-                var values = v.split("^");\r
-                for(var i = 0, len = values.length; i < len; i++){\r
-                    var kv = values[i].split("=");\r
-                    all[kv[0]] = this.decodeValue(kv[1]);\r
-                }\r
-                return all;\r
-           default:\r
-                return v;\r
-        }\r
-    },\r
-    \r
-    \r
-    encodeValue : function(v){\r
-        var enc;\r
-        if(typeof v == "number"){\r
-            enc = "n:" + v;\r
-        }else if(typeof v == "boolean"){\r
-            enc = "b:" + (v ? "1" : "0");\r
-        }else if(Ext.isDate(v)){\r
-            enc = "d:" + v.toGMTString();\r
-        }else if(Ext.isArray(v)){\r
-            var flat = "";\r
-            for(var i = 0, len = v.length; i < len; i++){\r
-                flat += this.encodeValue(v[i]);\r
-                if(i != len-1) flat += "^";\r
-            }\r
-            enc = "a:" + flat;\r
-        }else if(typeof v == "object"){\r
-            var flat = "";\r
-            for(var key in v){\r
-                if(typeof v[key] != "function" && v[key] !== undefined){\r
-                    flat += key + "=" + this.encodeValue(v[key]) + "^";\r
-                }\r
-            }\r
-            enc = "o:" + flat.substring(0, flat.length-1);\r
-        }else{\r
-            enc = "s:" + v;\r
-        }\r
-        return escape(enc);        \r
-    }\r
-});\r
-\r
-\r
-Ext.state.Manager = function(){\r
-    var provider = new Ext.state.Provider();\r
-\r
-    return {\r
-        \r
-        setProvider : function(stateProvider){\r
-            provider = stateProvider;\r
-        },\r
-\r
-        \r
-        get : function(key, defaultValue){\r
-            return provider.get(key, defaultValue);\r
-        },\r
-\r
-        \r
-         set : function(key, value){\r
-            provider.set(key, value);\r
-        },\r
-\r
-        \r
-        clear : function(key){\r
-            provider.clear(key);\r
-        },\r
-\r
-        \r
-        getProvider : function(){\r
-            return provider;\r
-        }\r
-    };\r
-}();\r
-\r
-\r
-Ext.state.CookieProvider = function(config){\r
-    Ext.state.CookieProvider.superclass.constructor.call(this);\r
-    this.path = "/";\r
-    this.expires = new Date(new Date().getTime()+(1000*60*60*24*7)); //7 days\r
-    this.domain = null;\r
-    this.secure = false;\r
-    Ext.apply(this, config);\r
-    this.state = this.readCookies();\r
-};\r
-\r
-Ext.extend(Ext.state.CookieProvider, Ext.state.Provider, {\r
-    // private\r
-    set : function(name, value){\r
-        if(typeof value == "undefined" || value === null){\r
-            this.clear(name);\r
-            return;\r
-        }\r
-        this.setCookie(name, value);\r
-        Ext.state.CookieProvider.superclass.set.call(this, name, value);\r
-    },\r
-\r
-    // private\r
-    clear : function(name){\r
-        this.clearCookie(name);\r
-        Ext.state.CookieProvider.superclass.clear.call(this, name);\r
-    },\r
-\r
-    // private\r
-    readCookies : function(){\r
-        var cookies = {};\r
-        var c = document.cookie + ";";\r
-        var re = /\s?(.*?)=(.*?);/g;\r
-       var matches;\r
-       while((matches = re.exec(c)) != null){\r
-            var name = matches[1];\r
-            var value = matches[2];\r
-            if(name && name.substring(0,3) == "ys-"){\r
-                cookies[name.substr(3)] = this.decodeValue(value);\r
-            }\r
-        }\r
-        return cookies;\r
-    },\r
-\r
-    // private\r
-    setCookie : function(name, value){\r
-        document.cookie = "ys-"+ name + "=" + this.encodeValue(value) +\r
-           ((this.expires == null) ? "" : ("; expires=" + this.expires.toGMTString())) +\r
-           ((this.path == null) ? "" : ("; path=" + this.path)) +\r
-           ((this.domain == null) ? "" : ("; domain=" + this.domain)) +\r
-           ((this.secure == true) ? "; secure" : "");\r
-    },\r
-\r
-    // private\r
-    clearCookie : function(name){\r
-        document.cookie = "ys-" + name + "=null; expires=Thu, 01-Jan-70 00:00:01 GMT" +\r
-           ((this.path == null) ? "" : ("; path=" + this.path)) +\r
-           ((this.domain == null) ? "" : ("; domain=" + this.domain)) +\r
-           ((this.secure == true) ? "; secure" : "");\r
-    }\r
-});\r
-\r
-Ext.DataView = Ext.extend(Ext.BoxComponent, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    selectedClass : "x-view-selected",\r
-    \r
-    emptyText : "",\r
-\r
-    \r
-    deferEmptyText: true,\r
-    \r
-    trackOver: false,\r
-\r
-    //private\r
-    last: false,\r
-\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.DataView.superclass.initComponent.call(this);\r
-        if(typeof this.tpl == "string"){\r
-            this.tpl = new Ext.XTemplate(this.tpl);\r
-        }\r
-\r
-        this.addEvents(\r
-            \r
-            "beforeclick",\r
-            \r
-            "click",\r
-            \r
-            "mouseenter",\r
-            \r
-            "mouseleave",\r
-            \r
-            "containerclick",\r
-            \r
-            "dblclick",\r
-            \r
-            "contextmenu",\r
-            \r
-            "selectionchange",\r
-\r
-            \r
-            "beforeselect"\r
-        );\r
-\r
-        this.all = new Ext.CompositeElementLite();\r
-        this.selected = new Ext.CompositeElementLite();\r
-    },\r
-\r
-    // private\r
-    onRender : function(){\r
-        if(!this.el){\r
-            this.el = document.createElement('div');\r
-            this.el.id = this.id;\r
-        }\r
-        Ext.DataView.superclass.onRender.apply(this, arguments);\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.DataView.superclass.afterRender.call(this);\r
-\r
-        this.el.on({\r
-            "click": this.onClick,\r
-            "dblclick": this.onDblClick,\r
-            "contextmenu": this.onContextMenu,\r
-            scope:this\r
-        });\r
-\r
-        if(this.overClass || this.trackOver){\r
-            this.el.on({\r
-                "mouseover": this.onMouseOver,\r
-                "mouseout": this.onMouseOut,\r
-                scope:this\r
-            });\r
-        }\r
-\r
-        if(this.store){\r
-            this.setStore(this.store, true);\r
-        }\r
-    },\r
-\r
-    \r
-    refresh : function(){\r
-        this.clearSelections(false, true);\r
-        this.el.update("");\r
-        var records = this.store.getRange();\r
-        if(records.length < 1){\r
-            if(!this.deferEmptyText || this.hasSkippedEmptyText){\r
-                this.el.update(this.emptyText);\r
-            }\r
-            this.hasSkippedEmptyText = true;\r
-            this.all.clear();\r
-            return;\r
-        }\r
-        this.tpl.overwrite(this.el, this.collectData(records, 0));\r
-        this.all.fill(Ext.query(this.itemSelector, this.el.dom));\r
-        this.updateIndexes(0);\r
-    },\r
-\r
-    \r
-    prepareData : function(data){\r
-        return data;\r
-    },\r
-\r
-    \r
-    collectData : function(records, startIndex){\r
-        var r = [];\r
-        for(var i = 0, len = records.length; i < len; i++){\r
-            r[r.length] = this.prepareData(records[i].data, startIndex+i, records[i]);\r
-        }\r
-        return r;\r
-    },\r
-\r
-    // private\r
-    bufferRender : function(records){\r
-        var div = document.createElement('div');\r
-        this.tpl.overwrite(div, this.collectData(records));\r
-        return Ext.query(this.itemSelector, div);\r
-    },\r
-\r
-    // private\r
-    onUpdate : function(ds, record){\r
-        var index = this.store.indexOf(record);\r
-        var sel = this.isSelected(index);\r
-        var original = this.all.elements[index];\r
-        var node = this.bufferRender([record], index)[0];\r
-\r
-        this.all.replaceElement(index, node, true);\r
-        if(sel){\r
-            this.selected.replaceElement(original, node);\r
-            this.all.item(index).addClass(this.selectedClass);\r
-        }\r
-        this.updateIndexes(index, index);\r
-    },\r
-\r
-    // private\r
-    onAdd : function(ds, records, index){\r
-        if(this.all.getCount() == 0){\r
-            this.refresh();\r
-            return;\r
-        }\r
-        var nodes = this.bufferRender(records, index), n, a = this.all.elements;\r
-        if(index < this.all.getCount()){\r
-            n = this.all.item(index).insertSibling(nodes, 'before', true);\r
-            a.splice.apply(a, [index, 0].concat(nodes));\r
-        }else{\r
-            n = this.all.last().insertSibling(nodes, 'after', true);\r
-            a.push.apply(a, nodes);\r
-        }\r
-        this.updateIndexes(index);\r
-    },\r
-\r
-    // private\r
-    onRemove : function(ds, record, index){\r
-        this.deselect(index);\r
-        this.all.removeElement(index, true);\r
-        this.updateIndexes(index);\r
-    },\r
-\r
-    \r
-    refreshNode : function(index){\r
-        this.onUpdate(this.store, this.store.getAt(index));\r
-    },\r
-\r
-    // private\r
-    updateIndexes : function(startIndex, endIndex){\r
-        var ns = this.all.elements;\r
-        startIndex = startIndex || 0;\r
-        endIndex = endIndex || ((endIndex === 0) ? 0 : (ns.length - 1));\r
-        for(var i = startIndex; i <= endIndex; i++){\r
-            ns[i].viewIndex = i;\r
-        }\r
-    },\r
-    \r
-    \r
-    getStore : function(){\r
-        return this.store;\r
-    },\r
-\r
-    \r
-    setStore : function(store, initial){\r
-        if(!initial && this.store){\r
-            this.store.un("beforeload", this.onBeforeLoad, this);\r
-            this.store.un("datachanged", this.refresh, this);\r
-            this.store.un("add", this.onAdd, this);\r
-            this.store.un("remove", this.onRemove, this);\r
-            this.store.un("update", this.onUpdate, this);\r
-            this.store.un("clear", this.refresh, this);\r
-        }\r
-        if(store){\r
-            store = Ext.StoreMgr.lookup(store);\r
-            store.on("beforeload", this.onBeforeLoad, this);\r
-            store.on("datachanged", this.refresh, this);\r
-            store.on("add", this.onAdd, this);\r
-            store.on("remove", this.onRemove, this);\r
-            store.on("update", this.onUpdate, this);\r
-            store.on("clear", this.refresh, this);\r
-        }\r
-        this.store = store;\r
-        if(store){\r
-            this.refresh();\r
-        }\r
-    },\r
-\r
-    \r
-    findItemFromChild : function(node){\r
-        return Ext.fly(node).findParent(this.itemSelector, this.el);\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        var item = e.getTarget(this.itemSelector, this.el);\r
-        if(item){\r
-            var index = this.indexOf(item);\r
-            if(this.onItemClick(item, index, e) !== false){\r
-                this.fireEvent("click", this, index, item, e);\r
-            }\r
-        }else{\r
-            if(this.fireEvent("containerclick", this, e) !== false){\r
-                this.clearSelections();\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onContextMenu : function(e){\r
-        var item = e.getTarget(this.itemSelector, this.el);\r
-        if(item){\r
-            this.fireEvent("contextmenu", this, this.indexOf(item), item, e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDblClick : function(e){\r
-        var item = e.getTarget(this.itemSelector, this.el);\r
-        if(item){\r
-            this.fireEvent("dblclick", this, this.indexOf(item), item, e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMouseOver : function(e){\r
-        var item = e.getTarget(this.itemSelector, this.el);\r
-        if(item && item !== this.lastItem){\r
-            this.lastItem = item;\r
-            Ext.fly(item).addClass(this.overClass);\r
-            this.fireEvent("mouseenter", this, this.indexOf(item), item, e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMouseOut : function(e){\r
-        if(this.lastItem){\r
-            if(!e.within(this.lastItem, true, true)){\r
-                Ext.fly(this.lastItem).removeClass(this.overClass);\r
-                this.fireEvent("mouseleave", this, this.indexOf(this.lastItem), this.lastItem, e);\r
-                delete this.lastItem;\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onItemClick : function(item, index, e){\r
-        if(this.fireEvent("beforeclick", this, index, item, e) === false){\r
-            return false;\r
-        }\r
-        if(this.multiSelect){\r
-            this.doMultiSelection(item, index, e);\r
-            e.preventDefault();\r
-        }else if(this.singleSelect){\r
-            this.doSingleSelection(item, index, e);\r
-            e.preventDefault();\r
-        }\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    doSingleSelection : function(item, index, e){\r
-        if(e.ctrlKey && this.isSelected(index)){\r
-            this.deselect(index);\r
-        }else{\r
-            this.select(index, false);\r
-        }\r
-    },\r
-\r
-    // private\r
-    doMultiSelection : function(item, index, e){\r
-        if(e.shiftKey && this.last !== false){\r
-            var last = this.last;\r
-            this.selectRange(last, index, e.ctrlKey);\r
-            this.last = last; // reset the last\r
-        }else{\r
-            if((e.ctrlKey||this.simpleSelect) && this.isSelected(index)){\r
-                this.deselect(index);\r
-            }else{\r
-                this.select(index, e.ctrlKey || e.shiftKey || this.simpleSelect);\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    getSelectionCount : function(){\r
-        return this.selected.getCount()\r
-    },\r
-\r
-    \r
-    getSelectedNodes : function(){\r
-        return this.selected.elements;\r
-    },\r
-\r
-    \r
-    getSelectedIndexes : function(){\r
-        var indexes = [], s = this.selected.elements;\r
-        for(var i = 0, len = s.length; i < len; i++){\r
-            indexes.push(s[i].viewIndex);\r
-        }\r
-        return indexes;\r
-    },\r
-\r
-    \r
-    getSelectedRecords : function(){\r
-        var r = [], s = this.selected.elements;\r
-        for(var i = 0, len = s.length; i < len; i++){\r
-            r[r.length] = this.store.getAt(s[i].viewIndex);\r
-        }\r
-        return r;\r
-    },\r
-\r
-    \r
-    getRecords : function(nodes){\r
-        var r = [], s = nodes;\r
-        for(var i = 0, len = s.length; i < len; i++){\r
-            r[r.length] = this.store.getAt(s[i].viewIndex);\r
-        }\r
-        return r;\r
-    },\r
-\r
-    \r
-    getRecord : function(node){\r
-        return this.store.getAt(node.viewIndex);\r
-    },\r
-\r
-    \r
-    clearSelections : function(suppressEvent, skipUpdate){\r
-        if((this.multiSelect || this.singleSelect) && this.selected.getCount() > 0){\r
-            if(!skipUpdate){\r
-                this.selected.removeClass(this.selectedClass);\r
-            }\r
-            this.selected.clear();\r
-            this.last = false;\r
-            if(!suppressEvent){\r
-                this.fireEvent("selectionchange", this, this.selected.elements);\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    isSelected : function(node){\r
-        return this.selected.contains(this.getNode(node));\r
-    },\r
-\r
-    \r
-    deselect : function(node){\r
-        if(this.isSelected(node)){\r
-            node = this.getNode(node);\r
-            this.selected.removeElement(node);\r
-            if(this.last == node.viewIndex){\r
-                this.last = false;\r
-            }\r
-            Ext.fly(node).removeClass(this.selectedClass);\r
-            this.fireEvent("selectionchange", this, this.selected.elements);\r
-        }\r
-    },\r
-\r
-    \r
-    select : function(nodeInfo, keepExisting, suppressEvent){\r
-        if(Ext.isArray(nodeInfo)){\r
-            if(!keepExisting){\r
-                this.clearSelections(true);\r
-            }\r
-            for(var i = 0, len = nodeInfo.length; i < len; i++){\r
-                this.select(nodeInfo[i], true, true);\r
-            }\r
-               if(!suppressEvent){\r
-                   this.fireEvent("selectionchange", this, this.selected.elements);\r
-               }\r
-        } else{\r
-            var node = this.getNode(nodeInfo);\r
-            if(!keepExisting){\r
-                this.clearSelections(true);\r
-            }\r
-            if(node && !this.isSelected(node)){\r
-                if(this.fireEvent("beforeselect", this, node, this.selected.elements) !== false){\r
-                    Ext.fly(node).addClass(this.selectedClass);\r
-                    this.selected.add(node);\r
-                    this.last = node.viewIndex;\r
-                    if(!suppressEvent){\r
-                        this.fireEvent("selectionchange", this, this.selected.elements);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    selectRange : function(start, end, keepExisting){\r
-        if(!keepExisting){\r
-            this.clearSelections(true);\r
-        }\r
-        this.select(this.getNodes(start, end), true);\r
-    },\r
-\r
-    \r
-    getNode : function(nodeInfo){\r
-        if(typeof nodeInfo == "string"){\r
-            return document.getElementById(nodeInfo);\r
-        }else if(typeof nodeInfo == "number"){\r
-            return this.all.elements[nodeInfo];\r
-        }\r
-        return nodeInfo;\r
-    },\r
-\r
-    \r
-    getNodes : function(start, end){\r
-        var ns = this.all.elements;\r
-        start = start || 0;\r
-        end = typeof end == "undefined" ? Math.max(ns.length - 1, 0) : end;\r
-        var nodes = [], i;\r
-        if(start <= end){\r
-            for(i = start; i <= end && ns[i]; i++){\r
-                nodes.push(ns[i]);\r
-            }\r
-        } else{\r
-            for(i = start; i >= end && ns[i]; i--){\r
-                nodes.push(ns[i]);\r
-            }\r
-        }\r
-        return nodes;\r
-    },\r
-\r
-    \r
-    indexOf : function(node){\r
-        node = this.getNode(node);\r
-        if(typeof node.viewIndex == "number"){\r
-            return node.viewIndex;\r
-        }\r
-        return this.all.indexOf(node);\r
-    },\r
-\r
-    // private\r
-    onBeforeLoad : function(){\r
-        if(this.loadingText){\r
-            this.clearSelections(false, true);\r
-            this.el.update('<div class="loading-indicator">'+this.loadingText+'</div>');\r
-            this.all.clear();\r
-        }\r
-    },\r
-\r
-    onDestroy : function(){\r
-        Ext.DataView.superclass.onDestroy.call(this);\r
-        this.setStore(null);\r
-    }\r
-});\r
-\r
-Ext.reg('dataview', Ext.DataView);\r
-\r
-Ext.ColorPalette = function(config){\r
-    Ext.ColorPalette.superclass.constructor.call(this, config);\r
-    this.addEvents(\r
-        \r
-        'select'\r
-    );\r
-\r
-    if(this.handler){\r
-        this.on("select", this.handler, this.scope, true);\r
-    }\r
-};\r
-Ext.extend(Ext.ColorPalette, Ext.Component, {\r
-       \r
-    \r
-    itemCls : "x-color-palette",\r
-    \r
-    value : null,\r
-    clickEvent:'click',\r
-    // private\r
-    ctype: "Ext.ColorPalette",\r
-\r
-    \r
-    allowReselect : false,\r
-\r
-    \r
-    colors : [\r
-        "000000", "993300", "333300", "003300", "003366", "000080", "333399", "333333",\r
-        "800000", "FF6600", "808000", "008000", "008080", "0000FF", "666699", "808080",\r
-        "FF0000", "FF9900", "99CC00", "339966", "33CCCC", "3366FF", "800080", "969696",\r
-        "FF00FF", "FFCC00", "FFFF00", "00FF00", "00FFFF", "00CCFF", "993366", "C0C0C0",\r
-        "FF99CC", "FFCC99", "FFFF99", "CCFFCC", "CCFFFF", "99CCFF", "CC99FF", "FFFFFF"\r
-    ],\r
-\r
-    // private\r
-    onRender : function(container, position){\r
-        var t = this.tpl || new Ext.XTemplate(\r
-            '<tpl for="."><a href="#" class="color-{.}" hidefocus="on"><em><span style="background:#{.}" unselectable="on">&#160;</span></em></a></tpl>'\r
-        );\r
-        var el = document.createElement("div");\r
-        el.id = this.getId();\r
-        el.className = this.itemCls;\r
-        t.overwrite(el, this.colors);\r
-        container.dom.insertBefore(el, position);\r
-        this.el = Ext.get(el);\r
-        this.el.on(this.clickEvent, this.handleClick,  this, {delegate: "a"});\r
-        if(this.clickEvent != 'click'){\r
-            this.el.on('click', Ext.emptyFn,  this, {delegate: "a", preventDefault:true});\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.ColorPalette.superclass.afterRender.call(this);\r
-        if(this.value){\r
-            var s = this.value;\r
-            this.value = null;\r
-            this.select(s);\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleClick : function(e, t){\r
-        e.preventDefault();\r
-        if(!this.disabled){\r
-            var c = t.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];\r
-            this.select(c.toUpperCase());\r
-        }\r
-    },\r
-\r
-    \r
-    select : function(color){\r
-        color = color.replace("#", "");\r
-        if(color != this.value || this.allowReselect){\r
-            var el = this.el;\r
-            if(this.value){\r
-                el.child("a.color-"+this.value).removeClass("x-color-palette-sel");\r
-            }\r
-            el.child("a.color-"+color).addClass("x-color-palette-sel");\r
-            this.value = color;\r
-            this.fireEvent("select", this, color);\r
-        }\r
-    }\r
-\r
-    \r
-});\r
-Ext.reg('colorpalette', Ext.ColorPalette);\r
-\r
-Ext.DatePicker = Ext.extend(Ext.Component, {\r
-    \r
-    todayText : "Today",\r
-    \r
-    okText : "&#160;OK&#160;", // &#160; to give the user extra clicking room\r
-    \r
-    cancelText : "Cancel",\r
-    \r
-    todayTip : "{0} (Spacebar)",\r
-    \r
-    minText : "This date is before the minimum date",\r
-    \r
-    maxText : "This date is after the maximum date",\r
-    \r
-    format : "m/d/y",\r
-    \r
-    disabledDaysText : "Disabled",\r
-    \r
-    disabledDatesText : "Disabled",\r
-    \r
-    constrainToViewport : true,\r
-    \r
-    monthNames : Date.monthNames,\r
-    \r
-    dayNames : Date.dayNames,\r
-    \r
-    nextText: 'Next Month (Control+Right)',\r
-    \r
-    prevText: 'Previous Month (Control+Left)',\r
-    \r
-    monthYearText: 'Choose a month (Control+Up/Down to move years)',\r
-    \r
-    startDay : 0,\r
-    \r
-    showToday : true,\r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.DatePicker.superclass.initComponent.call(this);\r
-\r
-        this.value = this.value ?\r
-                 this.value.clearTime() : new Date().clearTime();\r
-\r
-        this.addEvents(\r
-            \r
-            'select'\r
-        );\r
-\r
-        if(this.handler){\r
-            this.on("select", this.handler,  this.scope || this);\r
-        }\r
-\r
-        this.initDisabledDays();\r
-    },\r
-\r
-    // private\r
-    initDisabledDays : function(){\r
-        if(!this.disabledDatesRE && this.disabledDates){\r
-            var dd = this.disabledDates;\r
-            var re = "(?:";\r
-            for(var i = 0; i < dd.length; i++){\r
-                re += dd[i];\r
-                if(i != dd.length-1) re += "|";\r
-            }\r
-            this.disabledDatesRE = new RegExp(re + ")");\r
-        }\r
-    },\r
-    \r
-    \r
-    setDisabledDates : function(dd){\r
-        if(Ext.isArray(dd)){\r
-            this.disabledDates = dd;\r
-            this.disabledDatesRE = null;\r
-        }else{\r
-            this.disabledDatesRE = dd;\r
-        }\r
-        this.initDisabledDays();\r
-        this.update(this.value, true);\r
-    },\r
-    \r
-    \r
-    setDisabledDays : function(dd){\r
-        this.disabledDays = dd;\r
-        this.update(this.value, true);\r
-    },\r
-    \r
-    \r
-    setMinDate : function(dt){\r
-        this.minDate = dt;\r
-        this.update(this.value, true);\r
-    },\r
-    \r
-    \r
-    setMaxDate : function(dt){\r
-        this.maxDate = dt;\r
-        this.update(this.value, true);\r
-    },\r
-\r
-    \r
-    setValue : function(value){\r
-        var old = this.value;\r
-        this.value = value.clearTime(true);\r
-        if(this.el){\r
-            this.update(this.value);\r
-        }\r
-    },\r
-\r
-    \r
-    getValue : function(){\r
-        return this.value;\r
-    },\r
-\r
-    // private\r
-    focus : function(){\r
-        if(this.el){\r
-            this.update(this.activeDate);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRender : function(container, position){\r
-        var m = [\r
-             '<table cellspacing="0">',\r
-                '<tr><td class="x-date-left"><a href="#" title="', this.prevText ,'">&#160;</a></td><td class="x-date-middle" align="center"></td><td class="x-date-right"><a href="#" title="', this.nextText ,'">&#160;</a></td></tr>',\r
-                '<tr><td colspan="3"><table class="x-date-inner" cellspacing="0"><thead><tr>'];\r
-        var dn = this.dayNames;\r
-        for(var i = 0; i < 7; i++){\r
-            var d = this.startDay+i;\r
-            if(d > 6){\r
-                d = d-7;\r
-            }\r
-            m.push("<th><span>", dn[d].substr(0,1), "</span></th>");\r
-        }\r
-        m[m.length] = "</tr></thead><tbody><tr>";\r
-        for(var i = 0; i < 42; i++) {\r
-            if(i % 7 == 0 && i != 0){\r
-                m[m.length] = "</tr><tr>";\r
-            }\r
-            m[m.length] = '<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>';\r
-        }\r
-        m.push('</tr></tbody></table></td></tr>', \r
-                this.showToday ? '<tr><td colspan="3" class="x-date-bottom" align="center"></td></tr>' : '', \r
-                '</table><div class="x-date-mp"></div>');\r
-\r
-        var el = document.createElement("div");\r
-        el.className = "x-date-picker";\r
-        el.innerHTML = m.join("");\r
-\r
-        container.dom.insertBefore(el, position);\r
-\r
-        this.el = Ext.get(el);\r
-        this.eventEl = Ext.get(el.firstChild);\r
-\r
-        this.leftClickRpt = new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), {\r
-            handler: this.showPrevMonth,\r
-            scope: this,\r
-            preventDefault:true,\r
-            stopDefault:true\r
-        });\r
-\r
-        this.rightClickRpt = new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), {\r
-            handler: this.showNextMonth,\r
-            scope: this,\r
-            preventDefault:true,\r
-            stopDefault:true\r
-        });\r
-\r
-        this.eventEl.on("mousewheel", this.handleMouseWheel,  this);\r
-\r
-        this.monthPicker = this.el.down('div.x-date-mp');\r
-        this.monthPicker.enableDisplayMode('block');\r
-        \r
-        var kn = new Ext.KeyNav(this.eventEl, {\r
-            "left" : function(e){\r
-                e.ctrlKey ?\r
-                    this.showPrevMonth() :\r
-                    this.update(this.activeDate.add("d", -1));\r
-            },\r
-\r
-            "right" : function(e){\r
-                e.ctrlKey ?\r
-                    this.showNextMonth() :\r
-                    this.update(this.activeDate.add("d", 1));\r
-            },\r
-\r
-            "up" : function(e){\r
-                e.ctrlKey ?\r
-                    this.showNextYear() :\r
-                    this.update(this.activeDate.add("d", -7));\r
-            },\r
-\r
-            "down" : function(e){\r
-                e.ctrlKey ?\r
-                    this.showPrevYear() :\r
-                    this.update(this.activeDate.add("d", 7));\r
-            },\r
-\r
-            "pageUp" : function(e){\r
-                this.showNextMonth();\r
-            },\r
-\r
-            "pageDown" : function(e){\r
-                this.showPrevMonth();\r
-            },\r
-\r
-            "enter" : function(e){\r
-                e.stopPropagation();\r
-                return true;\r
-            },\r
-\r
-            scope : this\r
-        });\r
-\r
-        this.eventEl.on("click", this.handleDateClick,  this, {delegate: "a.x-date-date"});\r
-\r
-        this.el.unselectable();\r
-        \r
-        this.cells = this.el.select("table.x-date-inner tbody td");\r
-        this.textNodes = this.el.query("table.x-date-inner tbody span");\r
-\r
-        this.mbtn = new Ext.Button({\r
-            text: "&#160;",\r
-            tooltip: this.monthYearText,\r
-            renderTo: this.el.child("td.x-date-middle", true)\r
-        });\r
-\r
-        this.mbtn.on('click', this.showMonthPicker, this);\r
-        this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");\r
-\r
-        if(this.showToday){\r
-            this.todayKeyListener = this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday,  this);\r
-            var today = (new Date()).dateFormat(this.format);\r
-            this.todayBtn = new Ext.Button({\r
-                renderTo: this.el.child("td.x-date-bottom", true),\r
-                text: String.format(this.todayText, today),\r
-                tooltip: String.format(this.todayTip, today),\r
-                handler: this.selectToday,\r
-                scope: this\r
-            });\r
-        }\r
-        \r
-        if(Ext.isIE){\r
-            this.el.repaint();\r
-        }\r
-        this.update(this.value);\r
-    },\r
-\r
-    // private\r
-    createMonthPicker : function(){\r
-        if(!this.monthPicker.dom.firstChild){\r
-            var buf = ['<table border="0" cellspacing="0">'];\r
-            for(var i = 0; i < 6; i++){\r
-                buf.push(\r
-                    '<tr><td class="x-date-mp-month"><a href="#">', this.monthNames[i].substr(0, 3), '</a></td>',\r
-                    '<td class="x-date-mp-month x-date-mp-sep"><a href="#">', this.monthNames[i+6].substr(0, 3), '</a></td>',\r
-                    i == 0 ?\r
-                    '<td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-prev"></a></td><td class="x-date-mp-ybtn" align="center"><a class="x-date-mp-next"></a></td></tr>' :\r
-                    '<td class="x-date-mp-year"><a href="#"></a></td><td class="x-date-mp-year"><a href="#"></a></td></tr>'\r
-                );\r
-            }\r
-            buf.push(\r
-                '<tr class="x-date-mp-btns"><td colspan="4"><button type="button" class="x-date-mp-ok">',\r
-                    this.okText,\r
-                    '</button><button type="button" class="x-date-mp-cancel">',\r
-                    this.cancelText,\r
-                    '</button></td></tr>',\r
-                '</table>'\r
-            );\r
-            this.monthPicker.update(buf.join(''));\r
-            this.monthPicker.on('click', this.onMonthClick, this);\r
-            this.monthPicker.on('dblclick', this.onMonthDblClick, this);\r
-\r
-            this.mpMonths = this.monthPicker.select('td.x-date-mp-month');\r
-            this.mpYears = this.monthPicker.select('td.x-date-mp-year');\r
-\r
-            this.mpMonths.each(function(m, a, i){\r
-                i += 1;\r
-                if((i%2) == 0){\r
-                    m.dom.xmonth = 5 + Math.round(i * .5);\r
-                }else{\r
-                    m.dom.xmonth = Math.round((i-1) * .5);\r
-                }\r
-            });\r
-        }\r
-    },\r
-\r
-    // private\r
-    showMonthPicker : function(){\r
-        this.createMonthPicker();\r
-        var size = this.el.getSize();\r
-        this.monthPicker.setSize(size);\r
-        this.monthPicker.child('table').setSize(size);\r
-\r
-        this.mpSelMonth = (this.activeDate || this.value).getMonth();\r
-        this.updateMPMonth(this.mpSelMonth);\r
-        this.mpSelYear = (this.activeDate || this.value).getFullYear();\r
-        this.updateMPYear(this.mpSelYear);\r
-\r
-        this.monthPicker.slideIn('t', {duration:.2});\r
-    },\r
-\r
-    // private\r
-    updateMPYear : function(y){\r
-        this.mpyear = y;\r
-        var ys = this.mpYears.elements;\r
-        for(var i = 1; i <= 10; i++){\r
-            var td = ys[i-1], y2;\r
-            if((i%2) == 0){\r
-                y2 = y + Math.round(i * .5);\r
-                td.firstChild.innerHTML = y2;\r
-                td.xyear = y2;\r
-            }else{\r
-                y2 = y - (5-Math.round(i * .5));\r
-                td.firstChild.innerHTML = y2;\r
-                td.xyear = y2;\r
-            }\r
-            this.mpYears.item(i-1)[y2 == this.mpSelYear ? 'addClass' : 'removeClass']('x-date-mp-sel');\r
-        }\r
-    },\r
-\r
-    // private\r
-    updateMPMonth : function(sm){\r
-        this.mpMonths.each(function(m, a, i){\r
-            m[m.dom.xmonth == sm ? 'addClass' : 'removeClass']('x-date-mp-sel');\r
-        });\r
-    },\r
-\r
-    // private\r
-    selectMPMonth: function(m){\r
-        \r
-    },\r
-\r
-    // private\r
-    onMonthClick : function(e, t){\r
-        e.stopEvent();\r
-        var el = new Ext.Element(t), pn;\r
-        if(el.is('button.x-date-mp-cancel')){\r
-            this.hideMonthPicker();\r
-        }\r
-        else if(el.is('button.x-date-mp-ok')){\r
-            var d = new Date(this.mpSelYear, this.mpSelMonth, (this.activeDate || this.value).getDate());\r
-            if(d.getMonth() != this.mpSelMonth){\r
-                // "fix" the JS rolling date conversion if needed\r
-                d = new Date(this.mpSelYear, this.mpSelMonth, 1).getLastDateOfMonth();\r
-            }\r
-            this.update(d);\r
-            this.hideMonthPicker();\r
-        }\r
-        else if(pn = el.up('td.x-date-mp-month', 2)){\r
-            this.mpMonths.removeClass('x-date-mp-sel');\r
-            pn.addClass('x-date-mp-sel');\r
-            this.mpSelMonth = pn.dom.xmonth;\r
-        }\r
-        else if(pn = el.up('td.x-date-mp-year', 2)){\r
-            this.mpYears.removeClass('x-date-mp-sel');\r
-            pn.addClass('x-date-mp-sel');\r
-            this.mpSelYear = pn.dom.xyear;\r
-        }\r
-        else if(el.is('a.x-date-mp-prev')){\r
-            this.updateMPYear(this.mpyear-10);\r
-        }\r
-        else if(el.is('a.x-date-mp-next')){\r
-            this.updateMPYear(this.mpyear+10);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMonthDblClick : function(e, t){\r
-        e.stopEvent();\r
-        var el = new Ext.Element(t), pn;\r
-        if(pn = el.up('td.x-date-mp-month', 2)){\r
-            this.update(new Date(this.mpSelYear, pn.dom.xmonth, (this.activeDate || this.value).getDate()));\r
-            this.hideMonthPicker();\r
-        }\r
-        else if(pn = el.up('td.x-date-mp-year', 2)){\r
-            this.update(new Date(pn.dom.xyear, this.mpSelMonth, (this.activeDate || this.value).getDate()));\r
-            this.hideMonthPicker();\r
-        }\r
-    },\r
-\r
-    // private\r
-    hideMonthPicker : function(disableAnim){\r
-        if(this.monthPicker){\r
-            if(disableAnim === true){\r
-                this.monthPicker.hide();\r
-            }else{\r
-                this.monthPicker.slideOut('t', {duration:.2});\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    showPrevMonth : function(e){\r
-        this.update(this.activeDate.add("mo", -1));\r
-    },\r
-\r
-    // private\r
-    showNextMonth : function(e){\r
-        this.update(this.activeDate.add("mo", 1));\r
-    },\r
-\r
-    // private\r
-    showPrevYear : function(){\r
-        this.update(this.activeDate.add("y", -1));\r
-    },\r
-\r
-    // private\r
-    showNextYear : function(){\r
-        this.update(this.activeDate.add("y", 1));\r
-    },\r
-\r
-    // private\r
-    handleMouseWheel : function(e){\r
-        var delta = e.getWheelDelta();\r
-        if(delta > 0){\r
-            this.showPrevMonth();\r
-            e.stopEvent();\r
-        } else if(delta < 0){\r
-            this.showNextMonth();\r
-            e.stopEvent();\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleDateClick : function(e, t){\r
-        e.stopEvent();\r
-        if(t.dateValue && !Ext.fly(t.parentNode).hasClass("x-date-disabled")){\r
-            this.setValue(new Date(t.dateValue));\r
-            this.fireEvent("select", this, this.value);\r
-        }\r
-    },\r
-\r
-    // private\r
-    selectToday : function(){\r
-        if(this.todayBtn && !this.todayBtn.disabled){\r
-               this.setValue(new Date().clearTime());\r
-               this.fireEvent("select", this, this.value);\r
-        }\r
-    },\r
-\r
-    // private\r
-    update : function(date, forceRefresh){\r
-        var vd = this.activeDate;\r
-        this.activeDate = date;\r
-        if(!forceRefresh && vd && this.el){\r
-            var t = date.getTime();\r
-            if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){\r
-                this.cells.removeClass("x-date-selected");\r
-                this.cells.each(function(c){\r
-                   if(c.dom.firstChild.dateValue == t){\r
-                       c.addClass("x-date-selected");\r
-                       setTimeout(function(){\r
-                            try{c.dom.firstChild.focus();}catch(e){}\r
-                       }, 50);\r
-                       return false;\r
-                   }\r
-                });\r
-                return;\r
-            }\r
-        }\r
-        var days = date.getDaysInMonth();\r
-        var firstOfMonth = date.getFirstDateOfMonth();\r
-        var startingPos = firstOfMonth.getDay()-this.startDay;\r
-\r
-        if(startingPos <= this.startDay){\r
-            startingPos += 7;\r
-        }\r
-\r
-        var pm = date.add("mo", -1);\r
-        var prevStart = pm.getDaysInMonth()-startingPos;\r
-\r
-        var cells = this.cells.elements;\r
-        var textEls = this.textNodes;\r
-        days += startingPos;\r
-\r
-        // convert everything to numbers so it's fast\r
-        var day = 86400000;\r
-        var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();\r
-        var today = new Date().clearTime().getTime();\r
-        var sel = date.clearTime().getTime();\r
-        var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;\r
-        var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;\r
-        var ddMatch = this.disabledDatesRE;\r
-        var ddText = this.disabledDatesText;\r
-        var ddays = this.disabledDays ? this.disabledDays.join("") : false;\r
-        var ddaysText = this.disabledDaysText;\r
-        var format = this.format;\r
-        \r
-        if(this.showToday){\r
-            var td = new Date().clearTime();\r
-            var disable = (td < min || td > max || \r
-                (ddMatch && format && ddMatch.test(td.dateFormat(format))) || \r
-                (ddays && ddays.indexOf(td.getDay()) != -1));\r
-                        \r
-            this.todayBtn.setDisabled(disable);\r
-            this.todayKeyListener[disable ? 'disable' : 'enable']();\r
-        }\r
-\r
-        var setCellClass = function(cal, cell){\r
-            cell.title = "";\r
-            var t = d.getTime();\r
-            cell.firstChild.dateValue = t;\r
-            if(t == today){\r
-                cell.className += " x-date-today";\r
-                cell.title = cal.todayText;\r
-            }\r
-            if(t == sel){\r
-                cell.className += " x-date-selected";\r
-                setTimeout(function(){\r
-                    try{cell.firstChild.focus();}catch(e){}\r
-                }, 50);\r
-            }\r
-            // disabling\r
-            if(t < min) {\r
-                cell.className = " x-date-disabled";\r
-                cell.title = cal.minText;\r
-                return;\r
-            }\r
-            if(t > max) {\r
-                cell.className = " x-date-disabled";\r
-                cell.title = cal.maxText;\r
-                return;\r
-            }\r
-            if(ddays){\r
-                if(ddays.indexOf(d.getDay()) != -1){\r
-                    cell.title = ddaysText;\r
-                    cell.className = " x-date-disabled";\r
-                }\r
-            }\r
-            if(ddMatch && format){\r
-                var fvalue = d.dateFormat(format);\r
-                if(ddMatch.test(fvalue)){\r
-                    cell.title = ddText.replace("%0", fvalue);\r
-                    cell.className = " x-date-disabled";\r
-                }\r
-            }\r
-        };\r
-\r
-        var i = 0;\r
-        for(; i < startingPos; i++) {\r
-            textEls[i].innerHTML = (++prevStart);\r
-            d.setDate(d.getDate()+1);\r
-            cells[i].className = "x-date-prevday";\r
-            setCellClass(this, cells[i]);\r
-        }\r
-        for(; i < days; i++){\r
-            var intDay = i - startingPos + 1;\r
-            textEls[i].innerHTML = (intDay);\r
-            d.setDate(d.getDate()+1);\r
-            cells[i].className = "x-date-active";\r
-            setCellClass(this, cells[i]);\r
-        }\r
-        var extraDays = 0;\r
-        for(; i < 42; i++) {\r
-             textEls[i].innerHTML = (++extraDays);\r
-             d.setDate(d.getDate()+1);\r
-             cells[i].className = "x-date-nextday";\r
-             setCellClass(this, cells[i]);\r
-        }\r
-\r
-        this.mbtn.setText(this.monthNames[date.getMonth()] + " " + date.getFullYear());\r
-\r
-        if(!this.internalRender){\r
-            var main = this.el.dom.firstChild;\r
-            var w = main.offsetWidth;\r
-            this.el.setWidth(w + this.el.getBorderWidth("lr"));\r
-            Ext.fly(main).setWidth(w);\r
-            this.internalRender = true;\r
-            // opera does not respect the auto grow header center column\r
-            // then, after it gets a width opera refuses to recalculate\r
-            // without a second pass\r
-            if(Ext.isOpera && !this.secondPass){\r
-                main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px";\r
-                this.secondPass = true;\r
-                this.update.defer(10, this, [date]);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    beforeDestroy : function() {\r
-        if(this.rendered){\r
-            Ext.destroy(\r
-                this.leftClickRpt,\r
-                this.rightClickRpt,\r
-                this.monthPicker,\r
-                this.eventEl,\r
-                this.mbtn,\r
-                this.todayBtn\r
-            );\r
-        }\r
-    }\r
-\r
-    \r
-});\r
-Ext.reg('datepicker', Ext.DatePicker);\r
-\r
-Ext.TabPanel = Ext.extend(Ext.Panel,  {\r
-    \r
-    \r
-    \r
-    monitorResize : true,\r
-    \r
-    deferredRender : true,\r
-    \r
-    tabWidth: 120,\r
-    \r
-    minTabWidth: 30,\r
-    \r
-    resizeTabs:false,\r
-    \r
-    enableTabScroll: false,\r
-    \r
-    scrollIncrement : 0,\r
-    \r
-    scrollRepeatInterval : 400,\r
-    \r
-    scrollDuration : .35,\r
-    \r
-    animScroll : true,\r
-    \r
-    tabPosition: 'top',\r
-    \r
-    baseCls: 'x-tab-panel',\r
-    \r
-    autoTabs : false,\r
-    \r
-    autoTabSelector:'div.x-tab',\r
-    \r
-    activeTab : null,\r
-    \r
-    tabMargin : 2,\r
-    \r
-    plain: false,\r
-    \r
-    wheelIncrement : 20,\r
-\r
-    \r
-    idDelimiter : '__',\r
-\r
-    // private\r
-    itemCls : 'x-tab-item',\r
-\r
-    // private config overrides\r
-    elements: 'body',\r
-    headerAsText: false,\r
-    frame: false,\r
-    hideBorders:true,\r
-\r
-    // private\r
-    initComponent : function(){\r
-        this.frame = false;\r
-        Ext.TabPanel.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            'beforetabchange',\r
-            \r
-            'tabchange',\r
-            \r
-            'contextmenu'\r
-        );\r
-        this.setLayout(new Ext.layout.CardLayout({\r
-            deferredRender: this.deferredRender\r
-        }));\r
-        if(this.tabPosition == 'top'){\r
-            this.elements += ',header';\r
-            this.stripTarget = 'header';\r
-        }else {\r
-            this.elements += ',footer';\r
-            this.stripTarget = 'footer';\r
-        }\r
-        if(!this.stack){\r
-            this.stack = Ext.TabPanel.AccessStack();\r
-        }\r
-        this.initItems();\r
-    },\r
-\r
-    // private\r
-    render : function(){\r
-        Ext.TabPanel.superclass.render.apply(this, arguments);\r
-        if(this.activeTab !== undefined){\r
-            var item = this.activeTab;\r
-            delete this.activeTab;\r
-            this.setActiveTab(item);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.TabPanel.superclass.onRender.call(this, ct, position);\r
-\r
-        if(this.plain){\r
-            var pos = this.tabPosition == 'top' ? 'header' : 'footer';\r
-            this[pos].addClass('x-tab-panel-'+pos+'-plain');\r
-        }\r
-\r
-        var st = this[this.stripTarget];\r
-\r
-        this.stripWrap = st.createChild({cls:'x-tab-strip-wrap', cn:{\r
-            tag:'ul', cls:'x-tab-strip x-tab-strip-'+this.tabPosition}});\r
-\r
-        var beforeEl = (this.tabPosition=='bottom' ? this.stripWrap : null);\r
-        this.stripSpacer = st.createChild({cls:'x-tab-strip-spacer'}, beforeEl);\r
-        this.strip = new Ext.Element(this.stripWrap.dom.firstChild);\r
-\r
-        this.edge = this.strip.createChild({tag:'li', cls:'x-tab-edge'});\r
-        this.strip.createChild({cls:'x-clear'});\r
-\r
-        this.body.addClass('x-tab-panel-body-'+this.tabPosition);\r
-\r
-        if(!this.itemTpl){\r
-            var tt = new Ext.Template(\r
-                 '<li class="{cls}" id="{id}"><a class="x-tab-strip-close" onclick="return false;"></a>',\r
-                 '<a class="x-tab-right" href="#" onclick="return false;"><em class="x-tab-left">',\r
-                 '<span class="x-tab-strip-inner"><span class="x-tab-strip-text {iconCls}">{text}</span></span>',\r
-                 '</em></a></li>'\r
-            );\r
-            tt.disableFormats = true;\r
-            tt.compile();\r
-            Ext.TabPanel.prototype.itemTpl = tt;\r
-        }\r
-\r
-        this.items.each(this.initTab, this);\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.TabPanel.superclass.afterRender.call(this);\r
-        if(this.autoTabs){\r
-            this.readTabs(false);\r
-        }\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.TabPanel.superclass.initEvents.call(this);\r
-        this.on('add', this.onAdd, this);\r
-        this.on('remove', this.onRemove, this);\r
-\r
-        this.strip.on('mousedown', this.onStripMouseDown, this);\r
-        this.strip.on('contextmenu', this.onStripContextMenu, this);\r
-        if(this.enableTabScroll){\r
-            this.strip.on('mousewheel', this.onWheel, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    findTargets : function(e){\r
-        var item = null;\r
-        var itemEl = e.getTarget('li', this.strip);\r
-        if(itemEl){\r
-            item = this.getComponent(itemEl.id.split(this.idDelimiter)[1]);\r
-            if(item.disabled){\r
-                return {\r
-                    close : null,\r
-                    item : null,\r
-                    el : null\r
-                };\r
-            }\r
-        }\r
-        return {\r
-            close : e.getTarget('.x-tab-strip-close', this.strip),\r
-            item : item,\r
-            el : itemEl\r
-        };\r
-    },\r
-\r
-    // private\r
-    onStripMouseDown : function(e){\r
-        if(e.button != 0){\r
-            return;\r
-        }\r
-        e.preventDefault();\r
-        var t = this.findTargets(e);\r
-        if(t.close){\r
-            this.remove(t.item);\r
-            return;\r
-        }\r
-        if(t.item && t.item != this.activeTab){\r
-            this.setActiveTab(t.item);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onStripContextMenu : function(e){\r
-        e.preventDefault();\r
-        var t = this.findTargets(e);\r
-        if(t.item){\r
-            this.fireEvent('contextmenu', this, t.item, e);\r
-        }\r
-    },\r
-\r
-    \r
-    readTabs : function(removeExisting){\r
-        if(removeExisting === true){\r
-            this.items.each(function(item){\r
-                this.remove(item);\r
-            }, this);\r
-        }\r
-        var tabs = this.el.query(this.autoTabSelector);\r
-        for(var i = 0, len = tabs.length; i < len; i++){\r
-            var tab = tabs[i];\r
-            var title = tab.getAttribute('title');\r
-            tab.removeAttribute('title');\r
-            this.add({\r
-                title: title,\r
-                el: tab\r
-            });\r
-        }\r
-    },\r
-\r
-    // private\r
-    initTab : function(item, index){\r
-        var before = this.strip.dom.childNodes[index];\r
-        var cls = item.closable ? 'x-tab-strip-closable' : '';\r
-        if(item.disabled){\r
-            cls += ' x-item-disabled';\r
-        }\r
-        if(item.iconCls){\r
-            cls += ' x-tab-with-icon';\r
-        }\r
-        if(item.tabCls){\r
-            cls += ' ' + item.tabCls;\r
-        }\r
-\r
-        var p = {\r
-            id: this.id + this.idDelimiter + item.getItemId(),\r
-            text: item.title,\r
-            cls: cls,\r
-            iconCls: item.iconCls || ''\r
-        };\r
-        var el = before ?\r
-                 this.itemTpl.insertBefore(before, p) :\r
-                 this.itemTpl.append(this.strip, p);\r
-\r
-        Ext.fly(el).addClassOnOver('x-tab-strip-over');\r
-\r
-        if(item.tabTip){\r
-            Ext.fly(el).child('span.x-tab-strip-text', true).qtip = item.tabTip;\r
-        }\r
-        item.tabEl = el;\r
-\r
-        item.on('disable', this.onItemDisabled, this);\r
-        item.on('enable', this.onItemEnabled, this);\r
-        item.on('titlechange', this.onItemTitleChanged, this);\r
-        item.on('iconchange', this.onItemIconChanged, this);\r
-        item.on('beforeshow', this.onBeforeShowItem, this);\r
-    },\r
-\r
-    // private\r
-    onAdd : function(tp, item, index){\r
-        this.initTab(item, index);\r
-        if(this.items.getCount() == 1){\r
-            this.syncSize();\r
-        }\r
-        this.delegateUpdates();\r
-    },\r
-\r
-    // private\r
-    onBeforeAdd : function(item){\r
-        var existing = item.events ? (this.items.containsKey(item.getItemId()) ? item : null) : this.items.get(item);\r
-        if(existing){\r
-            this.setActiveTab(item);\r
-            return false;\r
-        }\r
-        Ext.TabPanel.superclass.onBeforeAdd.apply(this, arguments);\r
-        var es = item.elements;\r
-        item.elements = es ? es.replace(',header', '') : es;\r
-        item.border = (item.border === true);\r
-    },\r
-\r
-    // private\r
-    onRemove : function(tp, item){\r
-        Ext.destroy(Ext.get(this.getTabEl(item)));\r
-        this.stack.remove(item);\r
-        item.un('disable', this.onItemDisabled, this);\r
-        item.un('enable', this.onItemEnabled, this);\r
-        item.un('titlechange', this.onItemTitleChanged, this);\r
-        item.un('iconchange', this.onItemIconChanged, this);\r
-        item.un('beforeshow', this.onBeforeShowItem, this);\r
-        if(item == this.activeTab){\r
-            var next = this.stack.next();\r
-            if(next){\r
-                this.setActiveTab(next);\r
-            }else if(this.items.getCount() > 0){\r
-                this.setActiveTab(0);\r
-            }else{\r
-                this.activeTab = null;\r
-            }\r
-        }\r
-        this.delegateUpdates();\r
-    },\r
-\r
-    // private\r
-    onBeforeShowItem : function(item){\r
-        if(item != this.activeTab){\r
-            this.setActiveTab(item);\r
-            return false;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onItemDisabled : function(item){\r
-        var el = this.getTabEl(item);\r
-        if(el){\r
-            Ext.fly(el).addClass('x-item-disabled');\r
-        }\r
-        this.stack.remove(item);\r
-    },\r
-\r
-    // private\r
-    onItemEnabled : function(item){\r
-        var el = this.getTabEl(item);\r
-        if(el){\r
-            Ext.fly(el).removeClass('x-item-disabled');\r
-        }\r
-    },\r
-\r
-    // private\r
-    onItemTitleChanged : function(item){\r
-        var el = this.getTabEl(item);\r
-        if(el){\r
-            Ext.fly(el).child('span.x-tab-strip-text', true).innerHTML = item.title;\r
-        }\r
-    },\r
-    \r
-    //private\r
-    onItemIconChanged: function(item, iconCls, oldCls){\r
-        var el = this.getTabEl(item);\r
-        if(el){\r
-            Ext.fly(el).child('span.x-tab-strip-text').replaceClass(oldCls, iconCls);\r
-        }\r
-    },\r
-\r
-    \r
-    getTabEl : function(item){\r
-        var itemId = (typeof item === 'number')?this.items.items[item].getItemId() : item.getItemId();\r
-        return document.getElementById(this.id+this.idDelimiter+itemId);\r
-    },\r
-\r
-    // private\r
-    onResize : function(){\r
-        Ext.TabPanel.superclass.onResize.apply(this, arguments);\r
-        this.delegateUpdates();\r
-    },\r
-\r
-    \r
-    beginUpdate : function(){\r
-        this.suspendUpdates = true;\r
-    },\r
-\r
-    \r
-    endUpdate : function(){\r
-        this.suspendUpdates = false;\r
-        this.delegateUpdates();\r
-    },\r
-\r
-    \r
-    hideTabStripItem : function(item){\r
-        item = this.getComponent(item);\r
-        var el = this.getTabEl(item);\r
-        if(el){\r
-            el.style.display = 'none';\r
-            this.delegateUpdates();\r
-        }\r
-        this.stack.remove(item);\r
-    },\r
-\r
-    \r
-    unhideTabStripItem : function(item){\r
-        item = this.getComponent(item);\r
-        var el = this.getTabEl(item);\r
-        if(el){\r
-            el.style.display = '';\r
-            this.delegateUpdates();\r
-        }\r
-    },\r
-\r
-    // private\r
-    delegateUpdates : function(){\r
-        if(this.suspendUpdates){\r
-            return;\r
-        }\r
-        if(this.resizeTabs && this.rendered){\r
-            this.autoSizeTabs();\r
-        }\r
-        if(this.enableTabScroll && this.rendered){\r
-            this.autoScrollTabs();\r
-        }\r
-    },\r
-\r
-    // private\r
-    autoSizeTabs : function(){\r
-        var count = this.items.length;\r
-        var ce = this.tabPosition != 'bottom' ? 'header' : 'footer';\r
-        var ow = this[ce].dom.offsetWidth;\r
-        var aw = this[ce].dom.clientWidth;\r
-\r
-        if(!this.resizeTabs || count < 1 || !aw){ // !aw for display:none\r
-            return;\r
-        }\r
-\r
-        var each = Math.max(Math.min(Math.floor((aw-4) / count) - this.tabMargin, this.tabWidth), this.minTabWidth); // -4 for float errors in IE\r
-        this.lastTabWidth = each;\r
-        var lis = this.stripWrap.dom.getElementsByTagName('li');\r
-        for(var i = 0, len = lis.length-1; i < len; i++) { // -1 for the "edge" li\r
-            var li = lis[i];\r
-            var inner = li.childNodes[1].firstChild.firstChild;\r
-            var tw = li.offsetWidth;\r
-            var iw = inner.offsetWidth;\r
-            inner.style.width = (each - (tw-iw)) + 'px';\r
-        }\r
-    },\r
-\r
-    // private\r
-    adjustBodyWidth : function(w){\r
-        if(this.header){\r
-            this.header.setWidth(w);\r
-        }\r
-        if(this.footer){\r
-            this.footer.setWidth(w);\r
-        }\r
-        return w;\r
-    },\r
-\r
-    \r
-    setActiveTab : function(item){\r
-        item = this.getComponent(item);\r
-        if(!item || this.fireEvent('beforetabchange', this, item, this.activeTab) === false){\r
-            return;\r
-        }\r
-        if(!this.rendered){\r
-            this.activeTab = item;\r
-            return;\r
-        }\r
-        if(this.activeTab != item){\r
-            if(this.activeTab){\r
-                var oldEl = this.getTabEl(this.activeTab);\r
-                if(oldEl){\r
-                    Ext.fly(oldEl).removeClass('x-tab-strip-active');\r
-                }\r
-                this.activeTab.fireEvent('deactivate', this.activeTab);\r
-            }\r
-            var el = this.getTabEl(item);\r
-            Ext.fly(el).addClass('x-tab-strip-active');\r
-            this.activeTab = item;\r
-            this.stack.add(item);\r
-\r
-            this.layout.setActiveItem(item);\r
-            if(this.layoutOnTabChange && item.doLayout){\r
-                item.doLayout();\r
-            }\r
-            if(this.scrolling){\r
-                this.scrollToTab(item, this.animScroll);\r
-            }\r
-\r
-            item.fireEvent('activate', item);\r
-            this.fireEvent('tabchange', this, item);\r
-        }\r
-    },\r
-\r
-    \r
-    getActiveTab : function(){\r
-        return this.activeTab || null;\r
-    },\r
-\r
-    \r
-    getItem : function(item){\r
-        return this.getComponent(item);\r
-    },\r
-\r
-    // private\r
-    autoScrollTabs : function(){\r
-        this.pos = this.tabPosition=='bottom' ? this.footer : this.header;\r
-        var count = this.items.length;\r
-        var ow = this.pos.dom.offsetWidth;\r
-        var tw = this.pos.dom.clientWidth;\r
-\r
-        var wrap = this.stripWrap;\r
-        var wd = wrap.dom;\r
-        var cw = wd.offsetWidth;\r
-        var pos = this.getScrollPos();\r
-        var l = this.edge.getOffsetsTo(this.stripWrap)[0] + pos;\r
-\r
-        if(!this.enableTabScroll || count < 1 || cw < 20){ // 20 to prevent display:none issues\r
-            return;\r
-        }\r
-        if(l <= tw){\r
-            wd.scrollLeft = 0;\r
-            wrap.setWidth(tw);\r
-            if(this.scrolling){\r
-                this.scrolling = false;\r
-                this.pos.removeClass('x-tab-scrolling');\r
-                this.scrollLeft.hide();\r
-                this.scrollRight.hide();\r
-                if(Ext.isAir || Ext.isSafari){\r
-                    wd.style.marginLeft = '';\r
-                    wd.style.marginRight = '';\r
-                }\r
-            }\r
-        }else{\r
-            if(!this.scrolling){\r
-                this.pos.addClass('x-tab-scrolling');\r
-                if(Ext.isAir || Ext.isSafari){\r
-                    wd.style.marginLeft = '18px';\r
-                    wd.style.marginRight = '18px';\r
-                }\r
-            }\r
-            tw -= wrap.getMargins('lr');\r
-            wrap.setWidth(tw > 20 ? tw : 20);\r
-            if(!this.scrolling){\r
-                if(!this.scrollLeft){\r
-                    this.createScrollers();\r
-                }else{\r
-                    this.scrollLeft.show();\r
-                    this.scrollRight.show();\r
-                }\r
-            }\r
-            this.scrolling = true;\r
-            if(pos > (l-tw)){ // ensure it stays within bounds\r
-                wd.scrollLeft = l-tw;\r
-            }else{ // otherwise, make sure the active tab is still visible\r
-                this.scrollToTab(this.activeTab, false);\r
-            }\r
-            this.updateScrollButtons();\r
-        }\r
-    },\r
-\r
-    // private\r
-    createScrollers : function(){\r
-        this.pos.addClass('x-tab-scrolling-' + this.tabPosition);\r
-        var h = this.stripWrap.dom.offsetHeight;\r
-\r
-        // left\r
-        var sl = this.pos.insertFirst({\r
-            cls:'x-tab-scroller-left'\r
-        });\r
-        sl.setHeight(h);\r
-        sl.addClassOnOver('x-tab-scroller-left-over');\r
-        this.leftRepeater = new Ext.util.ClickRepeater(sl, {\r
-            interval : this.scrollRepeatInterval,\r
-            handler: this.onScrollLeft,\r
-            scope: this\r
-        });\r
-        this.scrollLeft = sl;\r
-\r
-        // right\r
-        var sr = this.pos.insertFirst({\r
-            cls:'x-tab-scroller-right'\r
-        });\r
-        sr.setHeight(h);\r
-        sr.addClassOnOver('x-tab-scroller-right-over');\r
-        this.rightRepeater = new Ext.util.ClickRepeater(sr, {\r
-            interval : this.scrollRepeatInterval,\r
-            handler: this.onScrollRight,\r
-            scope: this\r
-        });\r
-        this.scrollRight = sr;\r
-    },\r
-\r
-    // private\r
-    getScrollWidth : function(){\r
-        return this.edge.getOffsetsTo(this.stripWrap)[0] + this.getScrollPos();\r
-    },\r
-\r
-    // private\r
-    getScrollPos : function(){\r
-        return parseInt(this.stripWrap.dom.scrollLeft, 10) || 0;\r
-    },\r
-\r
-    // private\r
-    getScrollArea : function(){\r
-        return parseInt(this.stripWrap.dom.clientWidth, 10) || 0;\r
-    },\r
-\r
-    // private\r
-    getScrollAnim : function(){\r
-        return {duration:this.scrollDuration, callback: this.updateScrollButtons, scope: this};\r
-    },\r
-\r
-    // private\r
-    getScrollIncrement : function(){\r
-        return this.scrollIncrement || (this.resizeTabs ? this.lastTabWidth+2 : 100);\r
-    },\r
-\r
-    \r
-\r
-    scrollToTab : function(item, animate){\r
-        if(!item){ return; }\r
-        var el = this.getTabEl(item);\r
-        var pos = this.getScrollPos(), area = this.getScrollArea();\r
-        var left = Ext.fly(el).getOffsetsTo(this.stripWrap)[0] + pos;\r
-        var right = left + el.offsetWidth;\r
-        if(left < pos){\r
-            this.scrollTo(left, animate);\r
-        }else if(right > (pos + area)){\r
-            this.scrollTo(right - area, animate);\r
-        }\r
-    },\r
-\r
-    // private\r
-    scrollTo : function(pos, animate){\r
-        this.stripWrap.scrollTo('left', pos, animate ? this.getScrollAnim() : false);\r
-        if(!animate){\r
-            this.updateScrollButtons();\r
-        }\r
-    },\r
-\r
-    onWheel : function(e){\r
-        var d = e.getWheelDelta()*this.wheelIncrement*-1;\r
-        e.stopEvent();\r
-\r
-        var pos = this.getScrollPos();\r
-        var newpos = pos + d;\r
-        var sw = this.getScrollWidth()-this.getScrollArea();\r
-\r
-        var s = Math.max(0, Math.min(sw, newpos));\r
-        if(s != pos){\r
-            this.scrollTo(s, false);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onScrollRight : function(){\r
-        var sw = this.getScrollWidth()-this.getScrollArea();\r
-        var pos = this.getScrollPos();\r
-        var s = Math.min(sw, pos + this.getScrollIncrement());\r
-        if(s != pos){\r
-            this.scrollTo(s, this.animScroll);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onScrollLeft : function(){\r
-        var pos = this.getScrollPos();\r
-        var s = Math.max(0, pos - this.getScrollIncrement());\r
-        if(s != pos){\r
-            this.scrollTo(s, this.animScroll);\r
-        }\r
-    },\r
-\r
-    // private\r
-    updateScrollButtons : function(){\r
-        var pos = this.getScrollPos();\r
-        this.scrollLeft[pos == 0 ? 'addClass' : 'removeClass']('x-tab-scroller-left-disabled');\r
-        this.scrollRight[pos >= (this.getScrollWidth()-this.getScrollArea()) ? 'addClass' : 'removeClass']('x-tab-scroller-right-disabled');\r
-    },\r
-\r
-    // private\r
-    beforeDestroy : function() {\r
-        if(this.items){\r
-            this.items.each(function(item){\r
-                if(item && item.tabEl){\r
-                    Ext.get(item.tabEl).removeAllListeners();\r
-                    item.tabEl = null;\r
-                }\r
-            }, this);\r
-        }\r
-        if(this.strip){\r
-            this.strip.removeAllListeners();\r
-        }\r
-        Ext.TabPanel.superclass.beforeDestroy.apply(this);\r
-    }\r
-\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-});\r
-Ext.reg('tabpanel', Ext.TabPanel);\r
-\r
-\r
-Ext.TabPanel.prototype.activate = Ext.TabPanel.prototype.setActiveTab;\r
-\r
-// private utility class used by TabPanel\r
-Ext.TabPanel.AccessStack = function(){\r
-    var items = [];\r
-    return {\r
-        add : function(item){\r
-            items.push(item);\r
-            if(items.length > 10){\r
-                items.shift();\r
-            }\r
-        },\r
-\r
-        remove : function(item){\r
-            var s = [];\r
-            for(var i = 0, len = items.length; i < len; i++) {\r
-                if(items[i] != item){\r
-                    s.push(items[i]);\r
-                }\r
-            }\r
-            items = s;\r
-        },\r
-\r
-        next : function(){\r
-            return items.pop();\r
-        }\r
-    };\r
-};\r
-\r
-\r
-\r
-\r
-Ext.Button = Ext.extend(Ext.Component, {\r
-    \r
-    hidden : false,\r
-    \r
-    disabled : false,\r
-    \r
-    pressed : false,\r
-    \r
-\r
-    \r
-\r
-    \r
-\r
-    \r
-    enableToggle: false,\r
-    \r
-    \r
-    \r
-    menuAlign : "tl-bl?",\r
-\r
-    \r
-    \r
-    type : 'button',\r
-\r
-    // private\r
-    menuClassTarget: 'tr',\r
-\r
-    \r
-    clickEvent : 'click',\r
-\r
-    \r
-    handleMouseEvents : true,\r
-\r
-    \r
-    tooltipType : 'qtip',\r
-\r
-    \r
-    buttonSelector : "button:first-child",\r
-\r
-    \r
-    \r
-\r
-    initComponent : function(){\r
-        Ext.Button.superclass.initComponent.call(this);\r
-\r
-        this.addEvents(\r
-            \r
-            "click",\r
-            \r
-            "toggle",\r
-            \r
-            'mouseover',\r
-            \r
-            'mouseout',\r
-            \r
-            'menushow',\r
-            \r
-            'menuhide',\r
-            \r
-            'menutriggerover',\r
-            \r
-            'menutriggerout'\r
-        );\r
-        if(this.menu){\r
-            this.menu = Ext.menu.MenuMgr.get(this.menu);\r
-        }\r
-        if(typeof this.toggleGroup === 'string'){\r
-            this.enableToggle = true;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        if(!this.template){\r
-            if(!Ext.Button.buttonTemplate){\r
-                // hideous table template\r
-                Ext.Button.buttonTemplate = new Ext.Template(\r
-                    '<table border="0" cellpadding="0" cellspacing="0" class="x-btn-wrap"><tbody><tr>',\r
-                    '<td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><em unselectable="on"><button class="x-btn-text" type="{1}">{0}</button></em></td><td class="x-btn-right"><i>&#160;</i></td>',\r
-                    "</tr></tbody></table>");\r
-            }\r
-            this.template = Ext.Button.buttonTemplate;\r
-        }\r
-        var btn, targs = [this.text || '&#160;', this.type];\r
-\r
-        if(position){\r
-            btn = this.template.insertBefore(position, targs, true);\r
-        }else{\r
-            btn = this.template.append(ct, targs, true);\r
-        }\r
-        var btnEl = btn.child(this.buttonSelector);\r
-        btnEl.on('focus', this.onFocus, this);\r
-        btnEl.on('blur', this.onBlur, this);\r
-\r
-        this.initButtonEl(btn, btnEl);\r
-\r
-        if(this.menu){\r
-            this.el.child(this.menuClassTarget).addClass("x-btn-with-menu");\r
-        }\r
-        Ext.ButtonToggleMgr.register(this);\r
-    },\r
-\r
-    // private\r
-    initButtonEl : function(btn, btnEl){\r
-\r
-        this.el = btn;\r
-        btn.addClass("x-btn");\r
-\r
-        if(this.id){\r
-            this.el.dom.id = this.el.id = this.id;\r
-        }\r
-        if(this.icon){\r
-            btnEl.setStyle('background-image', 'url(' +this.icon +')');\r
-        }\r
-        if(this.iconCls){\r
-            btnEl.addClass(this.iconCls);\r
-            if(!this.cls){\r
-                btn.addClass(this.text ? 'x-btn-text-icon' : 'x-btn-icon');\r
-            }\r
-        }\r
-        if(this.tabIndex !== undefined){\r
-            btnEl.dom.tabIndex = this.tabIndex;\r
-        }\r
-        if(this.tooltip){\r
-            if(typeof this.tooltip == 'object'){\r
-                Ext.QuickTips.register(Ext.apply({\r
-                      target: btnEl.id\r
-                }, this.tooltip));\r
-            } else {\r
-                btnEl.dom[this.tooltipType] = this.tooltip;\r
-            }\r
-        }\r
-\r
-        if(this.pressed){\r
-            this.el.addClass("x-btn-pressed");\r
-        }\r
-\r
-        if(this.handleMouseEvents){\r
-            btn.on("mouseover", this.onMouseOver, this);\r
-            // new functionality for monitoring on the document level\r
-            //btn.on("mouseout", this.onMouseOut, this);\r
-            btn.on("mousedown", this.onMouseDown, this);\r
-        }\r
-\r
-        if(this.menu){\r
-            this.menu.on("show", this.onMenuShow, this);\r
-            this.menu.on("hide", this.onMenuHide, this);\r
-        }\r
-\r
-        if(this.repeat){\r
-            var repeater = new Ext.util.ClickRepeater(btn,\r
-                typeof this.repeat == "object" ? this.repeat : {}\r
-            );\r
-            repeater.on("click", this.onClick,  this);\r
-        }\r
-\r
-        btn.on(this.clickEvent, this.onClick, this);\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.Button.superclass.afterRender.call(this);\r
-        if(Ext.isIE6){\r
-            this.autoWidth.defer(1, this);\r
-        }else{\r
-            this.autoWidth();\r
-        }\r
-    },\r
-\r
-    \r
-    setIconClass : function(cls){\r
-        if(this.el){\r
-            this.el.child(this.buttonSelector).replaceClass(this.iconCls, cls);\r
-        }\r
-        this.iconCls = cls;\r
-    },\r
-\r
-    // private\r
-    beforeDestroy: function(){\r
-       if(this.rendered){\r
-            var btnEl = this.el.child(this.buttonSelector);\r
-            if(btnEl){\r
-                if(this.tooltip){\r
-                    Ext.QuickTips.unregister(btnEl);\r
-                }\r
-                btnEl.removeAllListeners();\r
-            }\r
-           }\r
-        if(this.menu){\r
-            Ext.destroy(this.menu);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.rendered){\r
-            Ext.ButtonToggleMgr.unregister(this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    autoWidth : function(){\r
-        if(this.el){\r
-            this.el.setWidth("auto");\r
-            if(Ext.isIE7 && Ext.isStrict){\r
-                var ib = this.el.child(this.buttonSelector);\r
-                if(ib && ib.getWidth() > 20){\r
-                    ib.clip();\r
-                    ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));\r
-                }\r
-            }\r
-            if(this.minWidth){\r
-                if(this.el.getWidth() < this.minWidth){\r
-                    this.el.setWidth(this.minWidth);\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    setHandler : function(handler, scope){\r
-        this.handler = handler;\r
-        this.scope = scope;\r
-    },\r
-\r
-    \r
-    setText : function(text){\r
-        this.text = text;\r
-        if(this.el){\r
-            this.el.child("td.x-btn-center " + this.buttonSelector).update(text);\r
-        }\r
-        this.autoWidth();\r
-    },\r
-\r
-    \r
-    getText : function(){\r
-        return this.text;\r
-    },\r
-\r
-    \r
-    toggle : function(state){\r
-        state = state === undefined ? !this.pressed : state;\r
-        if(state != this.pressed){\r
-            if(state){\r
-                this.el.addClass("x-btn-pressed");\r
-                this.pressed = true;\r
-                this.fireEvent("toggle", this, true);\r
-            }else{\r
-                this.el.removeClass("x-btn-pressed");\r
-                this.pressed = false;\r
-                this.fireEvent("toggle", this, false);\r
-            }\r
-            if(this.toggleHandler){\r
-                this.toggleHandler.call(this.scope || this, this, state);\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    focus : function(){\r
-        this.el.child(this.buttonSelector).focus();\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        if(this.el){\r
-            if(!Ext.isIE6 || !this.text){\r
-                this.el.addClass(this.disabledClass);\r
-            }\r
-            this.el.dom.disabled = true;\r
-        }\r
-        this.disabled = true;\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        if(this.el){\r
-            if(!Ext.isIE6 || !this.text){\r
-                this.el.removeClass(this.disabledClass);\r
-            }\r
-            this.el.dom.disabled = false;\r
-        }\r
-        this.disabled = false;\r
-    },\r
-\r
-    \r
-    showMenu : function(){\r
-        if(this.menu){\r
-            this.menu.show(this.el, this.menuAlign);\r
-        }\r
-        return this;\r
-    },\r
-\r
-    \r
-    hideMenu : function(){\r
-        if(this.menu){\r
-            this.menu.hide();\r
-        }\r
-        return this;\r
-    },\r
-\r
-    \r
-    hasVisibleMenu : function(){\r
-        return this.menu && this.menu.isVisible();\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        if(e){\r
-            e.preventDefault();\r
-        }\r
-        if(e.button != 0){\r
-            return;\r
-        }\r
-        if(!this.disabled){\r
-            if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){\r
-                this.toggle();\r
-            }\r
-            if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
-                this.showMenu();\r
-            }\r
-            this.fireEvent("click", this, e);\r
-            if(this.handler){\r
-                //this.el.removeClass("x-btn-over");\r
-                this.handler.call(this.scope || this, this, e);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    isMenuTriggerOver : function(e, internal){\r
-        return this.menu && !internal;\r
-    },\r
-\r
-    // private\r
-    isMenuTriggerOut : function(e, internal){\r
-        return this.menu && !internal;\r
-    },\r
-\r
-    // private\r
-    onMouseOver : function(e){\r
-        if(!this.disabled){\r
-            var internal = e.within(this.el,  true);\r
-            if(!internal){\r
-                this.el.addClass("x-btn-over");\r
-                if(!this.monitoringMouseOver){\r
-                    Ext.getDoc().on('mouseover', this.monitorMouseOver, this);\r
-                    this.monitoringMouseOver = true;\r
-                }\r
-                this.fireEvent('mouseover', this, e);\r
-            }\r
-            if(this.isMenuTriggerOver(e, internal)){\r
-                this.fireEvent('menutriggerover', this, this.menu, e);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    monitorMouseOver : function(e){\r
-        if(e.target != this.el.dom && !e.within(this.el)){\r
-            if(this.monitoringMouseOver){\r
-                Ext.getDoc().un('mouseover', this.monitorMouseOver, this);\r
-                this.monitoringMouseOver = false;\r
-            }\r
-            this.onMouseOut(e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMouseOut : function(e){\r
-        var internal = e.within(this.el) && e.target != this.el.dom;\r
-        this.el.removeClass("x-btn-over");\r
-        this.fireEvent('mouseout', this, e);\r
-        if(this.isMenuTriggerOut(e, internal)){\r
-            this.fireEvent('menutriggerout', this, this.menu, e);\r
-        }\r
-    },\r
-    // private\r
-    onFocus : function(e){\r
-        if(!this.disabled){\r
-            this.el.addClass("x-btn-focus");\r
-        }\r
-    },\r
-    // private\r
-    onBlur : function(e){\r
-        this.el.removeClass("x-btn-focus");\r
-    },\r
-\r
-    // private\r
-    getClickEl : function(e, isUp){\r
-       return this.el;\r
-    },\r
-\r
-    // private\r
-    onMouseDown : function(e){\r
-        if(!this.disabled && e.button == 0){\r
-            this.getClickEl(e).addClass("x-btn-click");\r
-            Ext.getDoc().on('mouseup', this.onMouseUp, this);\r
-        }\r
-    },\r
-    // private\r
-    onMouseUp : function(e){\r
-        if(e.button == 0){\r
-            this.getClickEl(e, true).removeClass("x-btn-click");\r
-            Ext.getDoc().un('mouseup', this.onMouseUp, this);\r
-        }\r
-    },\r
-    // private\r
-    onMenuShow : function(e){\r
-        this.ignoreNextClick = 0;\r
-        this.el.addClass("x-btn-menu-active");\r
-        this.fireEvent('menushow', this, this.menu);\r
-    },\r
-    // private\r
-    onMenuHide : function(e){\r
-        this.el.removeClass("x-btn-menu-active");\r
-        this.ignoreNextClick = this.restoreClick.defer(250, this);\r
-        this.fireEvent('menuhide', this, this.menu);\r
-    },\r
-\r
-    // private\r
-    restoreClick : function(){\r
-        this.ignoreNextClick = 0;\r
-    }\r
-\r
-\r
-\r
-    \r
-});\r
-Ext.reg('button', Ext.Button);\r
-\r
-// Private utility class used by Button\r
-Ext.ButtonToggleMgr = function(){\r
-   var groups = {};\r
-\r
-   function toggleGroup(btn, state){\r
-       if(state){\r
-           var g = groups[btn.toggleGroup];\r
-           for(var i = 0, l = g.length; i < l; i++){\r
-               if(g[i] != btn){\r
-                   g[i].toggle(false);\r
-               }\r
-           }\r
-       }\r
-   }\r
-\r
-   return {\r
-       register : function(btn){\r
-           if(!btn.toggleGroup){\r
-               return;\r
-           }\r
-           var g = groups[btn.toggleGroup];\r
-           if(!g){\r
-               g = groups[btn.toggleGroup] = [];\r
-           }\r
-           g.push(btn);\r
-           btn.on("toggle", toggleGroup);\r
-       },\r
-\r
-       unregister : function(btn){\r
-           if(!btn.toggleGroup){\r
-               return;\r
-           }\r
-           var g = groups[btn.toggleGroup];\r
-           if(g){\r
-               g.remove(btn);\r
-               btn.un("toggle", toggleGroup);\r
-           }\r
-       }\r
-   };\r
-}();\r
-\r
-Ext.SplitButton = Ext.extend(Ext.Button, {\r
-       // private\r
-    arrowSelector : 'button:last',\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.SplitButton.superclass.initComponent.call(this);\r
-        \r
-        this.addEvents("arrowclick");\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        // this is one sweet looking template!\r
-        var tpl = new Ext.Template(\r
-            '<table cellspacing="0" class="x-btn-menu-wrap x-btn"><tr><td>',\r
-            '<table cellspacing="0" class="x-btn-wrap x-btn-menu-text-wrap"><tbody>',\r
-            '<tr><td class="x-btn-left"><i>&#160;</i></td><td class="x-btn-center"><button class="x-btn-text" type="{1}">{0}</button></td></tr>',\r
-            "</tbody></table></td><td>",\r
-            '<table cellspacing="0" class="x-btn-wrap x-btn-menu-arrow-wrap"><tbody>',\r
-            '<tr><td class="x-btn-center"><button class="x-btn-menu-arrow-el" type="button">&#160;</button></td><td class="x-btn-right"><i>&#160;</i></td></tr>',\r
-            "</tbody></table></td></tr></table>"\r
-        );\r
-        var btn, targs = [this.text || '&#160;', this.type];\r
-        if(position){\r
-            btn = tpl.insertBefore(position, targs, true);\r
-        }else{\r
-            btn = tpl.append(ct, targs, true);\r
-        }\r
-        var btnEl = btn.child(this.buttonSelector);\r
-\r
-        this.initButtonEl(btn, btnEl);\r
-        this.arrowBtnTable = btn.child("table:last");\r
-        if(this.arrowTooltip){\r
-            btn.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;\r
-        }\r
-    },\r
-\r
-    // private\r
-    autoWidth : function(){\r
-        if(this.el){\r
-            var tbl = this.el.child("table:first");\r
-            var tbl2 = this.el.child("table:last");\r
-            this.el.setWidth("auto");\r
-            tbl.setWidth("auto");\r
-            if(Ext.isIE7 && Ext.isStrict){\r
-                var ib = this.el.child(this.buttonSelector);\r
-                if(ib && ib.getWidth() > 20){\r
-                    ib.clip();\r
-                    ib.setWidth(Ext.util.TextMetrics.measure(ib, this.text).width+ib.getFrameWidth('lr'));\r
-                }\r
-            }\r
-            if(this.minWidth){\r
-                if((tbl.getWidth()+tbl2.getWidth()) < this.minWidth){\r
-                    tbl.setWidth(this.minWidth-tbl2.getWidth());\r
-                }\r
-            }\r
-            this.el.setWidth(tbl.getWidth()+tbl2.getWidth());\r
-        } \r
-    },\r
-\r
-    \r
-    setArrowHandler : function(handler, scope){\r
-        this.arrowHandler = handler;\r
-        this.scope = scope;  \r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        e.preventDefault();\r
-        if(!this.disabled){\r
-            if(e.getTarget(".x-btn-menu-arrow-wrap")){\r
-                if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
-                    this.showMenu();\r
-                }\r
-                this.fireEvent("arrowclick", this, e);\r
-                if(this.arrowHandler){\r
-                    this.arrowHandler.call(this.scope || this, this, e);\r
-                }\r
-            }else{\r
-                if(this.enableToggle){\r
-                    this.toggle();\r
-                }\r
-                this.fireEvent("click", this, e);\r
-                if(this.handler){\r
-                    this.handler.call(this.scope || this, this, e);\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getClickEl : function(e, isUp){\r
-        if(!isUp){\r
-            return (this.lastClickEl = e.getTarget("table", 10, true));\r
-        }\r
-        return this.lastClickEl;\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        if(this.el){\r
-            if(!Ext.isIE6){\r
-                this.el.addClass("x-item-disabled");\r
-            }\r
-            this.el.child(this.buttonSelector).dom.disabled = true;\r
-            this.el.child(this.arrowSelector).dom.disabled = true;\r
-        }\r
-        this.disabled = true;\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        if(this.el){\r
-            if(!Ext.isIE6){\r
-                this.el.removeClass("x-item-disabled");\r
-            }\r
-            this.el.child(this.buttonSelector).dom.disabled = false;\r
-            this.el.child(this.arrowSelector).dom.disabled = false;\r
-        }\r
-        this.disabled = false;\r
-    },\r
-\r
-    // private\r
-    isMenuTriggerOver : function(e){\r
-        return this.menu && e.within(this.arrowBtnTable) && !e.within(this.arrowBtnTable, true);\r
-    },\r
-\r
-    // private\r
-    isMenuTriggerOut : function(e, internal){\r
-        return this.menu && !e.within(this.arrowBtnTable);\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        Ext.destroy(this.arrowBtnTable);\r
-        Ext.SplitButton.superclass.onDestroy.call(this);\r
-    }\r
-});\r
-\r
-// backwards compat\r
-Ext.MenuButton = Ext.SplitButton;\r
-\r
-\r
-Ext.reg('splitbutton', Ext.SplitButton);\r
-\r
-Ext.CycleButton = Ext.extend(Ext.SplitButton, {\r
-    \r
-    \r
-    \r
-    \r
-       \r
-\r
-    // private\r
-    getItemText : function(item){\r
-        if(item && this.showText === true){\r
-            var text = '';\r
-            if(this.prependText){\r
-                text += this.prependText;\r
-            }\r
-            text += item.text;\r
-            return text;\r
-        }\r
-        return undefined;\r
-    },\r
-\r
-    \r
-    setActiveItem : function(item, suppressEvent){\r
-        if(typeof item != 'object'){\r
-            item = this.menu.items.get(item);\r
-        }\r
-        if(item){\r
-            if(!this.rendered){\r
-                this.text = this.getItemText(item);\r
-                this.iconCls = item.iconCls;\r
-            }else{\r
-                var t = this.getItemText(item);\r
-                if(t){\r
-                    this.setText(t);\r
-                }\r
-                this.setIconClass(item.iconCls);\r
-            }\r
-            this.activeItem = item;\r
-            if(!item.checked){\r
-                item.setChecked(true, true);\r
-            }\r
-            if(this.forceIcon){\r
-                this.setIconClass(this.forceIcon);\r
-            }\r
-            if(!suppressEvent){\r
-                this.fireEvent('change', this, item);\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    getActiveItem : function(){\r
-        return this.activeItem;\r
-    },\r
-\r
-    // private\r
-    initComponent : function(){\r
-        this.addEvents(\r
-            \r
-            "change"\r
-        );\r
-\r
-        if(this.changeHandler){\r
-            this.on('change', this.changeHandler, this.scope||this);\r
-            delete this.changeHandler;\r
-        }\r
-\r
-        this.itemCount = this.items.length;\r
-\r
-        this.menu = {cls:'x-cycle-menu', items:[]};\r
-        var checked;\r
-        for(var i = 0, len = this.itemCount; i < len; i++){\r
-            var item = this.items[i];\r
-            item.group = item.group || this.id;\r
-            item.itemIndex = i;\r
-            item.checkHandler = this.checkHandler;\r
-            item.scope = this;\r
-            item.checked = item.checked || false;\r
-            this.menu.items.push(item);\r
-            if(item.checked){\r
-                checked = item;\r
-            }\r
-        }\r
-        this.setActiveItem(checked, true);\r
-        Ext.CycleButton.superclass.initComponent.call(this);\r
-\r
-        this.on('click', this.toggleSelected, this);\r
-    },\r
-\r
-    // private\r
-    checkHandler : function(item, pressed){\r
-        if(pressed){\r
-            this.setActiveItem(item);\r
-        }\r
-    },\r
-\r
-    \r
-    toggleSelected : function(){\r
-        this.menu.render();\r
-               \r
-               var nextIdx, checkItem;\r
-               for (var i = 1; i < this.itemCount; i++) {\r
-                       nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;\r
-                       // check the potential item\r
-                       checkItem = this.menu.items.itemAt(nextIdx);\r
-                       // if its not disabled then check it.\r
-                       if (!checkItem.disabled) {\r
-                               checkItem.setChecked(true);\r
-                               break;\r
-                       }\r
-               }\r
-    }\r
-});\r
-Ext.reg('cycle', Ext.CycleButton);\r
\r
- Ext.Toolbar = function(config){\r
-    if(Ext.isArray(config)){\r
-        config = {buttons:config};\r
-    }\r
-    Ext.Toolbar.superclass.constructor.call(this, config);\r
-};\r
-\r
-(function(){\r
-\r
-var T = Ext.Toolbar;\r
-\r
-Ext.extend(T, Ext.BoxComponent, {\r
-\r
-    trackMenus : true,\r
-\r
-    // private\r
-    initComponent : function(){\r
-        T.superclass.initComponent.call(this);\r
-\r
-        if(this.items){\r
-            this.buttons = this.items;\r
-        }\r
-        \r
-        this.items = new Ext.util.MixedCollection(false, function(o){\r
-            return o.itemId || o.id || Ext.id();\r
-        });\r
-    },\r
-\r
-    // private\r
-    autoCreate: {\r
-        cls:'x-toolbar x-small-editor',\r
-        html:'<table cellspacing="0"><tr></tr></table>'\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);\r
-        this.tr = this.el.child("tr", true);\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        T.superclass.afterRender.call(this);\r
-        if(this.buttons){\r
-            this.add.apply(this, this.buttons);\r
-            delete this.buttons;\r
-        }\r
-    },\r
-\r
-    \r
-    add : function(){\r
-        var a = arguments, l = a.length;\r
-        for(var i = 0; i < l; i++){\r
-            var el = a[i];\r
-            if(el.isFormField){ // some kind of form field\r
-                this.addField(el);\r
-            }else if(el.render){ // some kind of Toolbar.Item\r
-                this.addItem(el);\r
-            }else if(typeof el == "string"){ // string\r
-                if(el == "separator" || el == "-"){\r
-                    this.addSeparator();\r
-                }else if(el == " "){\r
-                    this.addSpacer();\r
-                }else if(el == "->"){\r
-                    this.addFill();\r
-                }else{\r
-                    this.addText(el);\r
-                }\r
-            }else if(el.tagName){ // element\r
-                this.addElement(el);\r
-            }else if(typeof el == "object"){ // must be button config?\r
-                if(el.xtype){\r
-                    this.addField(Ext.ComponentMgr.create(el, 'button'));\r
-                }else{\r
-                    this.addButton(el);\r
-                }\r
-            }\r
-        }\r
-    },\r
-    \r
-    \r
-    addSeparator : function(){\r
-        return this.addItem(new T.Separator());\r
-    },\r
-\r
-    \r
-    addSpacer : function(){\r
-        return this.addItem(new T.Spacer());\r
-    },\r
-\r
-    \r
-    addFill : function(){\r
-        return this.addItem(new T.Fill());\r
-    },\r
-\r
-    \r
-    addElement : function(el){\r
-        return this.addItem(new T.Item(el));\r
-    },\r
-    \r
-    \r
-    addItem : function(item){\r
-        var td = this.nextBlock();\r
-        this.initMenuTracking(item);\r
-        item.render(td);\r
-        this.items.add(item);\r
-        return item;\r
-    },\r
-    \r
-    \r
-    addButton : function(config){\r
-        if(Ext.isArray(config)){\r
-            var buttons = [];\r
-            for(var i = 0, len = config.length; i < len; i++) {\r
-                buttons.push(this.addButton(config[i]));\r
-            }\r
-            return buttons;\r
-        }\r
-        var b = config;\r
-        if(!(config instanceof T.Button)){\r
-            b = config.split ? \r
-                new T.SplitButton(config) :\r
-                new T.Button(config);\r
-        }\r
-        var td = this.nextBlock();\r
-        this.initMenuTracking(b);\r
-        b.render(td);\r
-        this.items.add(b);\r
-        return b;\r
-    },\r
-\r
-    // private\r
-    initMenuTracking : function(item){\r
-        if(this.trackMenus && item.menu){\r
-            item.on({\r
-                'menutriggerover' : this.onButtonTriggerOver,\r
-                'menushow' : this.onButtonMenuShow,\r
-                'menuhide' : this.onButtonMenuHide,\r
-                scope: this\r
-            })\r
-        }\r
-    },\r
-\r
-    \r
-    addText : function(text){\r
-        return this.addItem(new T.TextItem(text));\r
-    },\r
-    \r
-    \r
-    insertButton : function(index, item){\r
-        if(Ext.isArray(item)){\r
-            var buttons = [];\r
-            for(var i = 0, len = item.length; i < len; i++) {\r
-               buttons.push(this.insertButton(index + i, item[i]));\r
-            }\r
-            return buttons;\r
-        }\r
-        if (!(item instanceof T.Button)){\r
-           item = new T.Button(item);\r
-        }\r
-        var td = document.createElement("td");\r
-        this.tr.insertBefore(td, this.tr.childNodes[index]);\r
-        this.initMenuTracking(item);\r
-        item.render(td);\r
-        this.items.insert(index, item);\r
-        return item;\r
-    },\r
-    \r
-    \r
-    addDom : function(config, returnEl){\r
-        var td = this.nextBlock();\r
-        Ext.DomHelper.overwrite(td, config);\r
-        var ti = new T.Item(td.firstChild);\r
-        ti.render(td);\r
-        this.items.add(ti);\r
-        return ti;\r
-    },\r
-\r
-    \r
-    addField : function(field){\r
-        var td = this.nextBlock();\r
-        field.render(td);\r
-        var ti = new T.Item(td.firstChild);\r
-        ti.render(td);\r
-        this.items.add(field);\r
-        return ti;\r
-    },\r
-\r
-    // private\r
-    nextBlock : function(){\r
-        var td = document.createElement("td");\r
-        this.tr.appendChild(td);\r
-        return td;\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        Ext.Toolbar.superclass.onDestroy.call(this);\r
-        if(this.rendered){\r
-            if(this.items){ // rendered?\r
-                Ext.destroy.apply(Ext, this.items.items);\r
-            }\r
-            Ext.Element.uncache(this.tr);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        this.items.each(function(item){\r
-             if(item.disable){\r
-                 item.disable();\r
-             }\r
-        });\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        this.items.each(function(item){\r
-             if(item.enable){\r
-                 item.enable();\r
-             }\r
-        });\r
-    },\r
-\r
-    // private\r
-    onButtonTriggerOver : function(btn){\r
-        if(this.activeMenuBtn && this.activeMenuBtn != btn){\r
-            this.activeMenuBtn.hideMenu();\r
-            btn.showMenu();\r
-            this.activeMenuBtn = btn;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onButtonMenuShow : function(btn){\r
-        this.activeMenuBtn = btn;\r
-    },\r
-\r
-    // private\r
-    onButtonMenuHide : function(btn){\r
-        delete this.activeMenuBtn;\r
-    }\r
-\r
-    \r
-});\r
-Ext.reg('toolbar', Ext.Toolbar);\r
-\r
-\r
-T.Item = function(el){\r
-    this.el = Ext.getDom(el);\r
-    this.id = Ext.id(this.el);\r
-    this.hidden = false;\r
-};\r
-\r
-T.Item.prototype = {\r
-    \r
-    \r
-    getEl : function(){\r
-       return this.el;  \r
-    },\r
-\r
-    // private\r
-    render : function(td){\r
-        this.td = td;\r
-        td.appendChild(this.el);\r
-    },\r
-    \r
-    \r
-    destroy : function(){\r
-        if(this.el){\r
-            var el = Ext.get(this.el);\r
-            Ext.destroy(el);\r
-        }\r
-        Ext.removeNode(this.td);\r
-    },\r
-    \r
-    \r
-    show: function(){\r
-        this.hidden = false;\r
-        this.td.style.display = "";\r
-    },\r
-    \r
-    \r
-    hide: function(){\r
-        this.hidden = true;\r
-        this.td.style.display = "none";\r
-    },\r
-    \r
-    \r
-    setVisible: function(visible){\r
-        if(visible) {\r
-            this.show();\r
-        }else{\r
-            this.hide();\r
-        }\r
-    },\r
-    \r
-    \r
-    focus : function(){\r
-        Ext.fly(this.el).focus();\r
-    },\r
-    \r
-    \r
-    disable : function(){\r
-        Ext.fly(this.td).addClass("x-item-disabled");\r
-        this.disabled = true;\r
-        this.el.disabled = true;\r
-    },\r
-    \r
-    \r
-    enable : function(){\r
-        Ext.fly(this.td).removeClass("x-item-disabled");\r
-        this.disabled = false;\r
-        this.el.disabled = false;\r
-    }\r
-};\r
-Ext.reg('tbitem', T.Item);\r
-\r
-\r
-\r
-T.Separator = function(){\r
-    var s = document.createElement("span");\r
-    s.className = "ytb-sep";\r
-    T.Separator.superclass.constructor.call(this, s);\r
-};\r
-Ext.extend(T.Separator, T.Item, {\r
-    enable:Ext.emptyFn,\r
-    disable:Ext.emptyFn,\r
-    focus:Ext.emptyFn\r
-});\r
-Ext.reg('tbseparator', T.Separator);\r
-\r
-\r
-T.Spacer = function(){\r
-    var s = document.createElement("div");\r
-    s.className = "ytb-spacer";\r
-    T.Spacer.superclass.constructor.call(this, s);\r
-};\r
-Ext.extend(T.Spacer, T.Item, {\r
-    enable:Ext.emptyFn,\r
-    disable:Ext.emptyFn,\r
-    focus:Ext.emptyFn\r
-});\r
-\r
-Ext.reg('tbspacer', T.Spacer);\r
-\r
-\r
-T.Fill = Ext.extend(T.Spacer, {\r
-    // private\r
-    render : function(td){\r
-        td.style.width = '100%';\r
-        T.Fill.superclass.render.call(this, td);\r
-    }\r
-});\r
-Ext.reg('tbfill', T.Fill);\r
-\r
-\r
-T.TextItem = function(t){\r
-    var s = document.createElement("span");\r
-    s.className = "ytb-text";\r
-    s.innerHTML = t.text ? t.text : t;\r
-    T.TextItem.superclass.constructor.call(this, s);\r
-};\r
-Ext.extend(T.TextItem, T.Item, {\r
-    enable:Ext.emptyFn,\r
-    disable:Ext.emptyFn,\r
-    focus:Ext.emptyFn\r
-});\r
-Ext.reg('tbtext', T.TextItem);\r
-\r
-\r
-\r
-T.Button = Ext.extend(Ext.Button, {\r
-    hideParent : true,\r
-\r
-    onDestroy : function(){\r
-        T.Button.superclass.onDestroy.call(this);\r
-        if(this.container){\r
-            this.container.remove();\r
-        }\r
-    }\r
-});\r
-Ext.reg('tbbutton', T.Button);\r
-\r
-\r
-T.SplitButton = Ext.extend(Ext.SplitButton, {\r
-    hideParent : true,\r
-\r
-    onDestroy : function(){\r
-        T.SplitButton.superclass.onDestroy.call(this);\r
-        if(this.container){\r
-            this.container.remove();\r
-        }\r
-    }\r
-});\r
-\r
-Ext.reg('tbsplit', T.SplitButton);\r
-// backwards compat\r
-T.MenuButton = T.SplitButton;\r
-\r
-})();\r
-\r
-\r
-Ext.PagingToolbar = Ext.extend(Ext.Toolbar, {\r
-    \r
-    \r
-    \r
-    pageSize: 20,\r
-    \r
-    displayMsg : 'Displaying {0} - {1} of {2}',\r
-    \r
-    emptyMsg : 'No data to display',\r
-    \r
-    beforePageText : "Page",\r
-    \r
-    afterPageText : "of {0}",\r
-    \r
-    firstText : "First Page",\r
-    \r
-    prevText : "Previous Page",\r
-    \r
-    nextText : "Next Page",\r
-    \r
-    lastText : "Last Page",\r
-    \r
-    refreshText : "Refresh",\r
-\r
-    \r
-    paramNames : {start: 'start', limit: 'limit'},\r
-\r
-    // private\r
-    initComponent : function(){\r
-        this.addEvents(\r
-            \r
-            'change',\r
-            \r
-            'beforechange'\r
-        );\r
-        Ext.PagingToolbar.superclass.initComponent.call(this);\r
-        this.cursor = 0;\r
-        this.bind(this.store);\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.PagingToolbar.superclass.onRender.call(this, ct, position);\r
-        this.first = this.addButton({\r
-            tooltip: this.firstText,\r
-            iconCls: "x-tbar-page-first",\r
-            disabled: true,\r
-            handler: this.onClick.createDelegate(this, ["first"])\r
-        });\r
-        this.prev = this.addButton({\r
-            tooltip: this.prevText,\r
-            iconCls: "x-tbar-page-prev",\r
-            disabled: true,\r
-            handler: this.onClick.createDelegate(this, ["prev"])\r
-        });\r
-        this.addSeparator();\r
-        this.add(this.beforePageText);\r
-        this.field = Ext.get(this.addDom({\r
-           tag: "input",\r
-           type: "text",\r
-           size: "3",\r
-           value: "1",\r
-           cls: "x-tbar-page-number"\r
-        }).el);\r
-        this.field.on("keydown", this.onPagingKeydown, this);\r
-        this.field.on("focus", function(){this.dom.select();});\r
-        this.field.on("blur", this.onPagingBlur, this);\r
-        this.afterTextEl = this.addText(String.format(this.afterPageText, 1));\r
-        this.field.setHeight(18);\r
-        this.addSeparator();\r
-        this.next = this.addButton({\r
-            tooltip: this.nextText,\r
-            iconCls: "x-tbar-page-next",\r
-            disabled: true,\r
-            handler: this.onClick.createDelegate(this, ["next"])\r
-        });\r
-        this.last = this.addButton({\r
-            tooltip: this.lastText,\r
-            iconCls: "x-tbar-page-last",\r
-            disabled: true,\r
-            handler: this.onClick.createDelegate(this, ["last"])\r
-        });\r
-        this.addSeparator();\r
-        this.loading = this.addButton({\r
-            tooltip: this.refreshText,\r
-            iconCls: "x-tbar-loading",\r
-            handler: this.onClick.createDelegate(this, ["refresh"])\r
-        });\r
-\r
-        if(this.displayInfo){\r
-            this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'});\r
-        }\r
-        if(this.dsLoaded){\r
-            this.onLoad.apply(this, this.dsLoaded);\r
-        }\r
-    },\r
-\r
-    // private\r
-    updateInfo : function(){\r
-        if(this.displayEl){\r
-            var count = this.store.getCount();\r
-            var msg = count == 0 ?\r
-                this.emptyMsg :\r
-                String.format(\r
-                    this.displayMsg,\r
-                    this.cursor+1, this.cursor+count, this.store.getTotalCount()\r
-                );\r
-            this.displayEl.update(msg);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onLoad : function(store, r, o){\r
-        if(!this.rendered){\r
-            this.dsLoaded = [store, r, o];\r
-            return;\r
-        }\r
-       this.cursor = o.params ? o.params[this.paramNames.start] : 0;\r
-       var d = this.getPageData(), ap = d.activePage, ps = d.pages;\r
-\r
-        this.afterTextEl.el.innerHTML = String.format(this.afterPageText, d.pages);\r
-        this.field.dom.value = ap;\r
-        this.first.setDisabled(ap == 1);\r
-        this.prev.setDisabled(ap == 1);\r
-        this.next.setDisabled(ap == ps);\r
-        this.last.setDisabled(ap == ps);\r
-        this.loading.enable();\r
-        this.updateInfo();\r
-        this.fireEvent('change', this, d);\r
-    },\r
-\r
-    // private\r
-    getPageData : function(){\r
-        var total = this.store.getTotalCount();\r
-        return {\r
-            total : total,\r
-            activePage : Math.ceil((this.cursor+this.pageSize)/this.pageSize),\r
-            pages :  total < this.pageSize ? 1 : Math.ceil(total/this.pageSize)\r
-        };\r
-    },\r
-\r
-    // private\r
-    onLoadError : function(){\r
-        if(!this.rendered){\r
-            return;\r
-        }\r
-        this.loading.enable();\r
-    },\r
-\r
-    // private\r
-    readPage : function(d){\r
-        var v = this.field.dom.value, pageNum;\r
-        if (!v || isNaN(pageNum = parseInt(v, 10))) {\r
-            this.field.dom.value = d.activePage;\r
-            return false;\r
-        }\r
-        return pageNum;\r
-    },\r
-\r
-    //private\r
-    onPagingBlur: function(e){\r
-        this.field.dom.value = this.getPageData().activePage;\r
-    },\r
-\r
-    // private\r
-    onPagingKeydown : function(e){\r
-        var k = e.getKey(), d = this.getPageData(), pageNum;\r
-        if (k == e.RETURN) {\r
-            e.stopEvent();\r
-            pageNum = this.readPage(d);\r
-            if(pageNum !== false){\r
-                pageNum = Math.min(Math.max(1, pageNum), d.pages) - 1;\r
-                this.doLoad(pageNum * this.pageSize);\r
-            }\r
-        }else if (k == e.HOME || k == e.END){\r
-            e.stopEvent();\r
-            pageNum = k == e.HOME ? 1 : d.pages;\r
-            this.field.dom.value = pageNum;\r
-        }else if (k == e.UP || k == e.PAGEUP || k == e.DOWN || k == e.PAGEDOWN){\r
-            e.stopEvent();\r
-            if(pageNum = this.readPage(d)){\r
-                var increment = e.shiftKey ? 10 : 1;\r
-                if(k == e.DOWN || k == e.PAGEDOWN){\r
-                    increment *= -1;\r
-                }\r
-                pageNum += increment;\r
-                if(pageNum >= 1 & pageNum <= d.pages){\r
-                    this.field.dom.value = pageNum;\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    beforeLoad : function(){\r
-        if(this.rendered && this.loading){\r
-            this.loading.disable();\r
-        }\r
-    },\r
-\r
-    // private\r
-    doLoad : function(start){\r
-        var o = {}, pn = this.paramNames;\r
-        o[pn.start] = start;\r
-        o[pn.limit] = this.pageSize;\r
-        if(this.fireEvent('beforechange', this, o) !== false){\r
-            this.store.load({params:o});\r
-        }\r
-    },\r
-\r
-    \r
-    changePage: function(page){\r
-        this.doLoad(((page-1) * this.pageSize).constrain(0, this.store.getTotalCount()));\r
-    },\r
-\r
-    // private\r
-    onClick : function(which){\r
-        var store = this.store;\r
-        switch(which){\r
-            case "first":\r
-                this.doLoad(0);\r
-            break;\r
-            case "prev":\r
-                this.doLoad(Math.max(0, this.cursor-this.pageSize));\r
-            break;\r
-            case "next":\r
-                this.doLoad(this.cursor+this.pageSize);\r
-            break;\r
-            case "last":\r
-                var total = store.getTotalCount();\r
-                var extra = total % this.pageSize;\r
-                var lastStart = extra ? (total - extra) : total-this.pageSize;\r
-                this.doLoad(lastStart);\r
-            break;\r
-            case "refresh":\r
-                this.doLoad(this.cursor);\r
-            break;\r
-        }\r
-    },\r
-\r
-    \r
-    unbind : function(store){\r
-        store = Ext.StoreMgr.lookup(store);\r
-        store.un("beforeload", this.beforeLoad, this);\r
-        store.un("load", this.onLoad, this);\r
-        store.un("loadexception", this.onLoadError, this);\r
-        this.store = undefined;\r
-    },\r
-\r
-    \r
-    bind : function(store){\r
-        store = Ext.StoreMgr.lookup(store);\r
-        store.on("beforeload", this.beforeLoad, this);\r
-        store.on("load", this.onLoad, this);\r
-        store.on("loadexception", this.onLoadError, this);\r
-        this.store = store;\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.store){\r
-            this.unbind(this.store);\r
-        }\r
-        Ext.PagingToolbar.superclass.onDestroy.call(this);\r
-    }\r
-});\r
-Ext.reg('paging', Ext.PagingToolbar);\r
-\r
-Ext.Resizable = function(el, config){\r
-    this.el = Ext.get(el);\r
-    \r
-    if(config && config.wrap){\r
-        config.resizeChild = this.el;\r
-        this.el = this.el.wrap(typeof config.wrap == "object" ? config.wrap : {cls:"xresizable-wrap"});\r
-        this.el.id = this.el.dom.id = config.resizeChild.id + "-rzwrap";\r
-        this.el.setStyle("overflow", "hidden");\r
-        this.el.setPositioning(config.resizeChild.getPositioning());\r
-        config.resizeChild.clearPositioning();\r
-        if(!config.width || !config.height){\r
-            var csize = config.resizeChild.getSize();\r
-            this.el.setSize(csize.width, csize.height);\r
-        }\r
-        if(config.pinned && !config.adjustments){\r
-            config.adjustments = "auto";\r
-        }\r
-    }\r
-\r
-    \r
-    this.proxy = this.el.createProxy({tag: "div", cls: "x-resizable-proxy", id: this.el.id + "-rzproxy"}, Ext.getBody());\r
-    this.proxy.unselectable();\r
-    this.proxy.enableDisplayMode('block');\r
-\r
-    Ext.apply(this, config);\r
-    \r
-    if(this.pinned){\r
-        this.disableTrackOver = true;\r
-        this.el.addClass("x-resizable-pinned");\r
-    }\r
-    // if the element isn't positioned, make it relative\r
-    var position = this.el.getStyle("position");\r
-    if(position != "absolute" && position != "fixed"){\r
-        this.el.setStyle("position", "relative");\r
-    }\r
-    if(!this.handles){ // no handles passed, must be legacy style\r
-        this.handles = 's,e,se';\r
-        if(this.multiDirectional){\r
-            this.handles += ',n,w';\r
-        }\r
-    }\r
-    if(this.handles == "all"){\r
-        this.handles = "n s e w ne nw se sw";\r
-    }\r
-    var hs = this.handles.split(/\s*?[,;]\s*?| /);\r
-    var ps = Ext.Resizable.positions;\r
-    for(var i = 0, len = hs.length; i < len; i++){\r
-        if(hs[i] && ps[hs[i]]){\r
-            var pos = ps[hs[i]];\r
-            this[pos] = new Ext.Resizable.Handle(this, pos, this.disableTrackOver, this.transparent);\r
-        }\r
-    }\r
-    // legacy\r
-    this.corner = this.southeast;\r
-    \r
-    if(this.handles.indexOf("n") != -1 || this.handles.indexOf("w") != -1){\r
-        this.updateBox = true;\r
-    }   \r
-   \r
-    this.activeHandle = null;\r
-    \r
-    if(this.resizeChild){\r
-        if(typeof this.resizeChild == "boolean"){\r
-            this.resizeChild = Ext.get(this.el.dom.firstChild, true);\r
-        }else{\r
-            this.resizeChild = Ext.get(this.resizeChild, true);\r
-        }\r
-    }\r
-    \r
-    if(this.adjustments == "auto"){\r
-        var rc = this.resizeChild;\r
-        var hw = this.west, he = this.east, hn = this.north, hs = this.south;\r
-        if(rc && (hw || hn)){\r
-            rc.position("relative");\r
-            rc.setLeft(hw ? hw.el.getWidth() : 0);\r
-            rc.setTop(hn ? hn.el.getHeight() : 0);\r
-        }\r
-        this.adjustments = [\r
-            (he ? -he.el.getWidth() : 0) + (hw ? -hw.el.getWidth() : 0),\r
-            (hn ? -hn.el.getHeight() : 0) + (hs ? -hs.el.getHeight() : 0) -1 \r
-        ];\r
-    }\r
-    \r
-    if(this.draggable){\r
-        this.dd = this.dynamic ? \r
-            this.el.initDD(null) : this.el.initDDProxy(null, {dragElId: this.proxy.id});\r
-        this.dd.setHandleElId(this.resizeChild ? this.resizeChild.id : this.el.id);\r
-    }\r
-    \r
-    // public events\r
-    this.addEvents(\r
-        "beforeresize",\r
-        "resize"\r
-    );\r
-    \r
-    if(this.width !== null && this.height !== null){\r
-        this.resizeTo(this.width, this.height);\r
-    }else{\r
-        this.updateChildSize();\r
-    }\r
-    if(Ext.isIE){\r
-        this.el.dom.style.zoom = 1;\r
-    }\r
-    Ext.Resizable.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.Resizable, Ext.util.Observable, {\r
-        resizeChild : false,\r
-        adjustments : [0, 0],\r
-        minWidth : 5,\r
-        minHeight : 5,\r
-        maxWidth : 10000,\r
-        maxHeight : 10000,\r
-        enabled : true,\r
-        animate : false,\r
-        duration : .35,\r
-        dynamic : false,\r
-        handles : false,\r
-        multiDirectional : false,\r
-        disableTrackOver : false,\r
-        easing : 'easeOutStrong',\r
-        widthIncrement : 0,\r
-        heightIncrement : 0,\r
-        pinned : false,\r
-        width : null,\r
-        height : null,\r
-        preserveRatio : false,\r
-        transparent: false,\r
-        minX: 0,\r
-        minY: 0,\r
-        draggable: false,\r
-\r
-        \r
-        \r
-\r
-        \r
-        \r
-    \r
-    \r
-    resizeTo : function(width, height){\r
-        this.el.setSize(width, height);\r
-        this.updateChildSize();\r
-        this.fireEvent("resize", this, width, height, null);\r
-    },\r
-\r
-    // private\r
-    startSizing : function(e, handle){\r
-        this.fireEvent("beforeresize", this, e);\r
-        if(this.enabled){ // 2nd enabled check in case disabled before beforeresize handler\r
-\r
-            if(!this.overlay){\r
-                this.overlay = this.el.createProxy({tag: "div", cls: "x-resizable-overlay", html: "&#160;"}, Ext.getBody());\r
-                this.overlay.unselectable();\r
-                this.overlay.enableDisplayMode("block");\r
-                this.overlay.on("mousemove", this.onMouseMove, this);\r
-                this.overlay.on("mouseup", this.onMouseUp, this);\r
-            }\r
-            this.overlay.setStyle("cursor", handle.el.getStyle("cursor"));\r
-\r
-            this.resizing = true;\r
-            this.startBox = this.el.getBox();\r
-            this.startPoint = e.getXY();\r
-            this.offsets = [(this.startBox.x + this.startBox.width) - this.startPoint[0],\r
-                            (this.startBox.y + this.startBox.height) - this.startPoint[1]];\r
-\r
-            this.overlay.setSize(Ext.lib.Dom.getViewWidth(true), Ext.lib.Dom.getViewHeight(true));\r
-            this.overlay.show();\r
-\r
-            if(this.constrainTo) {\r
-                var ct = Ext.get(this.constrainTo);\r
-                this.resizeRegion = ct.getRegion().adjust(\r
-                    ct.getFrameWidth('t'),\r
-                    ct.getFrameWidth('l'),\r
-                    -ct.getFrameWidth('b'),\r
-                    -ct.getFrameWidth('r')\r
-                );\r
-            }\r
-\r
-            this.proxy.setStyle('visibility', 'hidden'); // workaround display none\r
-            this.proxy.show();\r
-            this.proxy.setBox(this.startBox);\r
-            if(!this.dynamic){\r
-                this.proxy.setStyle('visibility', 'visible');\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMouseDown : function(handle, e){\r
-        if(this.enabled){\r
-            e.stopEvent();\r
-            this.activeHandle = handle;\r
-            this.startSizing(e, handle);\r
-        }          \r
-    },\r
-\r
-    // private\r
-    onMouseUp : function(e){\r
-        var size = this.resizeElement();\r
-        this.resizing = false;\r
-        this.handleOut();\r
-        this.overlay.hide();\r
-        this.proxy.hide();\r
-        this.fireEvent("resize", this, size.width, size.height, e);\r
-    },\r
-\r
-    // private\r
-    updateChildSize : function(){\r
-        if(this.resizeChild){\r
-            var el = this.el;\r
-            var child = this.resizeChild;\r
-            var adj = this.adjustments;\r
-            if(el.dom.offsetWidth){\r
-                var b = el.getSize(true);\r
-                child.setSize(b.width+adj[0], b.height+adj[1]);\r
-            }\r
-            // Second call here for IE\r
-            // The first call enables instant resizing and\r
-            // the second call corrects scroll bars if they\r
-            // exist\r
-            if(Ext.isIE){\r
-                setTimeout(function(){\r
-                    if(el.dom.offsetWidth){\r
-                        var b = el.getSize(true);\r
-                        child.setSize(b.width+adj[0], b.height+adj[1]);\r
-                    }\r
-                }, 10);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    snap : function(value, inc, min){\r
-        if(!inc || !value) return value;\r
-        var newValue = value;\r
-        var m = value % inc;\r
-        if(m > 0){\r
-            if(m > (inc/2)){\r
-                newValue = value + (inc-m);\r
-            }else{\r
-                newValue = value - m;\r
-            }\r
-        }\r
-        return Math.max(min, newValue);\r
-    },\r
-\r
-    \r
-    resizeElement : function(){\r
-        var box = this.proxy.getBox();\r
-        if(this.updateBox){\r
-            this.el.setBox(box, false, this.animate, this.duration, null, this.easing);\r
-        }else{\r
-            this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);\r
-        }\r
-        this.updateChildSize();\r
-        if(!this.dynamic){\r
-            this.proxy.hide();\r
-        }\r
-        return box;\r
-    },\r
-\r
-    // private\r
-    constrain : function(v, diff, m, mx){\r
-        if(v - diff < m){\r
-            diff = v - m;    \r
-        }else if(v - diff > mx){\r
-            diff = mx - v; \r
-        }\r
-        return diff;                \r
-    },\r
-\r
-    // private\r
-    onMouseMove : function(e){\r
-        if(this.enabled){\r
-            try{// try catch so if something goes wrong the user doesn't get hung\r
-\r
-            if(this.resizeRegion && !this.resizeRegion.contains(e.getPoint())) {\r
-                return;\r
-            }\r
-\r
-            //var curXY = this.startPoint;\r
-            var curSize = this.curSize || this.startBox;\r
-            var x = this.startBox.x, y = this.startBox.y;\r
-            var ox = x, oy = y;\r
-            var w = curSize.width, h = curSize.height;\r
-            var ow = w, oh = h;\r
-            var mw = this.minWidth, mh = this.minHeight;\r
-            var mxw = this.maxWidth, mxh = this.maxHeight;\r
-            var wi = this.widthIncrement;\r
-            var hi = this.heightIncrement;\r
-            \r
-            var eventXY = e.getXY();\r
-            var diffX = -(this.startPoint[0] - Math.max(this.minX, eventXY[0]));\r
-            var diffY = -(this.startPoint[1] - Math.max(this.minY, eventXY[1]));\r
-            \r
-            var pos = this.activeHandle.position;\r
-            \r
-            switch(pos){\r
-                case "east":\r
-                    w += diffX; \r
-                    w = Math.min(Math.max(mw, w), mxw);\r
-                    break;\r
-                case "south":\r
-                    h += diffY;\r
-                    h = Math.min(Math.max(mh, h), mxh);\r
-                    break;\r
-                case "southeast":\r
-                    w += diffX; \r
-                    h += diffY;\r
-                    w = Math.min(Math.max(mw, w), mxw);\r
-                    h = Math.min(Math.max(mh, h), mxh);\r
-                    break;\r
-                case "north":\r
-                    diffY = this.constrain(h, diffY, mh, mxh);\r
-                    y += diffY;\r
-                    h -= diffY;\r
-                    break;\r
-                case "west":\r
-                    diffX = this.constrain(w, diffX, mw, mxw);\r
-                    x += diffX;\r
-                    w -= diffX;\r
-                    break;\r
-                case "northeast":\r
-                    w += diffX; \r
-                    w = Math.min(Math.max(mw, w), mxw);\r
-                    diffY = this.constrain(h, diffY, mh, mxh);\r
-                    y += diffY;\r
-                    h -= diffY;\r
-                    break;\r
-                case "northwest":\r
-                    diffX = this.constrain(w, diffX, mw, mxw);\r
-                    diffY = this.constrain(h, diffY, mh, mxh);\r
-                    y += diffY;\r
-                    h -= diffY;\r
-                    x += diffX;\r
-                    w -= diffX;\r
-                    break;\r
-               case "southwest":\r
-                    diffX = this.constrain(w, diffX, mw, mxw);\r
-                    h += diffY;\r
-                    h = Math.min(Math.max(mh, h), mxh);\r
-                    x += diffX;\r
-                    w -= diffX;\r
-                    break;\r
-            }\r
-            \r
-            var sw = this.snap(w, wi, mw);\r
-            var sh = this.snap(h, hi, mh);\r
-            if(sw != w || sh != h){\r
-                switch(pos){\r
-                    case "northeast":\r
-                        y -= sh - h;\r
-                    break;\r
-                    case "north":\r
-                        y -= sh - h;\r
-                        break;\r
-                    case "southwest":\r
-                        x -= sw - w;\r
-                    break;\r
-                    case "west":\r
-                        x -= sw - w;\r
-                        break;\r
-                    case "northwest":\r
-                        x -= sw - w;\r
-                        y -= sh - h;\r
-                    break;\r
-                }\r
-                w = sw;\r
-                h = sh;\r
-            }\r
-            \r
-            if(this.preserveRatio){\r
-                switch(pos){\r
-                    case "southeast":\r
-                    case "east":\r
-                        h = oh * (w/ow);\r
-                        h = Math.min(Math.max(mh, h), mxh);\r
-                        w = ow * (h/oh);\r
-                       break;\r
-                    case "south":\r
-                        w = ow * (h/oh);\r
-                        w = Math.min(Math.max(mw, w), mxw);\r
-                        h = oh * (w/ow);\r
-                        break;\r
-                    case "northeast":\r
-                        w = ow * (h/oh);\r
-                        w = Math.min(Math.max(mw, w), mxw);\r
-                        h = oh * (w/ow);\r
-                    break;\r
-                    case "north":\r
-                        var tw = w;\r
-                        w = ow * (h/oh);\r
-                        w = Math.min(Math.max(mw, w), mxw);\r
-                        h = oh * (w/ow);\r
-                        x += (tw - w) / 2;\r
-                        break;\r
-                    case "southwest":\r
-                        h = oh * (w/ow);\r
-                        h = Math.min(Math.max(mh, h), mxh);\r
-                        var tw = w;\r
-                        w = ow * (h/oh);\r
-                        x += tw - w;\r
-                        break;\r
-                    case "west":\r
-                        var th = h;\r
-                        h = oh * (w/ow);\r
-                        h = Math.min(Math.max(mh, h), mxh);\r
-                        y += (th - h) / 2;\r
-                        var tw = w;\r
-                        w = ow * (h/oh);\r
-                        x += tw - w;\r
-                       break;\r
-                    case "northwest":\r
-                        var tw = w;\r
-                        var th = h;\r
-                        h = oh * (w/ow);\r
-                        h = Math.min(Math.max(mh, h), mxh);\r
-                        w = ow * (h/oh);\r
-                        y += th - h;\r
-                         x += tw - w;\r
-                       break;\r
-                        \r
-                }\r
-            }\r
-            this.proxy.setBounds(x, y, w, h);\r
-            if(this.dynamic){\r
-                this.resizeElement();\r
-            }\r
-            }catch(e){}\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleOver : function(){\r
-        if(this.enabled){\r
-            this.el.addClass("x-resizable-over");\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleOut : function(){\r
-        if(!this.resizing){\r
-            this.el.removeClass("x-resizable-over");\r
-        }\r
-    },\r
-    \r
-    \r
-    getEl : function(){\r
-        return this.el;\r
-    },\r
-    \r
-    \r
-    getResizeChild : function(){\r
-        return this.resizeChild;\r
-    },\r
-    \r
-    \r
-    destroy : function(removeEl){\r
-        if(this.dd){\r
-            this.dd.destroy();\r
-        }\r
-        if(this.overlay){\r
-            Ext.destroy(this.overlay);\r
-            this.overlay = null;\r
-        }\r
-        Ext.destroy(this.proxy);\r
-        this.proxy = null;\r
-        \r
-        var ps = Ext.Resizable.positions;\r
-        for(var k in ps){\r
-            if(typeof ps[k] != "function" && this[ps[k]]){\r
-                this[ps[k]].destroy();\r
-            }\r
-        }\r
-        if(removeEl){\r
-            this.el.update("");\r
-            Ext.destroy(this.el);\r
-            this.el = null;\r
-        }\r
-    },\r
-\r
-    syncHandleHeight : function(){\r
-        var h = this.el.getHeight(true);\r
-        if(this.west){\r
-            this.west.el.setHeight(h);\r
-        }\r
-        if(this.east){\r
-            this.east.el.setHeight(h);\r
-        }\r
-    }\r
-});\r
-\r
-// private\r
-// hash to map config positions to true positions\r
-Ext.Resizable.positions = {\r
-    n: "north", s: "south", e: "east", w: "west", se: "southeast", sw: "southwest", nw: "northwest", ne: "northeast"\r
-};\r
-\r
-// private\r
-Ext.Resizable.Handle = function(rz, pos, disableTrackOver, transparent){\r
-    if(!this.tpl){\r
-        // only initialize the template if resizable is used\r
-        var tpl = Ext.DomHelper.createTemplate(\r
-            {tag: "div", cls: "x-resizable-handle x-resizable-handle-{0}"}\r
-        );\r
-        tpl.compile();\r
-        Ext.Resizable.Handle.prototype.tpl = tpl;\r
-    }\r
-    this.position = pos;\r
-    this.rz = rz;\r
-    this.el = this.tpl.append(rz.el.dom, [this.position], true);\r
-    this.el.unselectable();\r
-    if(transparent){\r
-        this.el.setOpacity(0);\r
-    }\r
-    this.el.on("mousedown", this.onMouseDown, this);\r
-    if(!disableTrackOver){\r
-        this.el.on("mouseover", this.onMouseOver, this);\r
-        this.el.on("mouseout", this.onMouseOut, this);\r
-    }\r
-};\r
-\r
-// private\r
-Ext.Resizable.Handle.prototype = {\r
-    // private\r
-    afterResize : function(rz){\r
-        // do nothing    \r
-    },\r
-    // private\r
-    onMouseDown : function(e){\r
-        this.rz.onMouseDown(this, e);\r
-    },\r
-    // private\r
-    onMouseOver : function(e){\r
-        this.rz.handleOver(this, e);\r
-    },\r
-    // private\r
-    onMouseOut : function(e){\r
-        this.rz.handleOut(this, e);\r
-    },\r
-    // private\r
-    destroy : function(){\r
-        Ext.destroy(this.el);\r
-        this.el = null;\r
-    }\r
-};\r
-\r
-\r
-\r
-\r
-\r
-Ext.Editor = function(field, config){\r
-    this.field = field;\r
-    Ext.Editor.superclass.constructor.call(this, config);\r
-};\r
-\r
-Ext.extend(Ext.Editor, Ext.Component, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    value : "",\r
-    \r
-    alignment: "c-c?",\r
-    \r
-    shadow : "frame",\r
-    \r
-    constrain : false,\r
-    \r
-    swallowKeys : true,\r
-    \r
-    completeOnEnter : false,\r
-    \r
-    cancelOnEsc : false,\r
-    \r
-    updateEl : false,\r
-\r
-    initComponent : function(){\r
-        Ext.Editor.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            "beforestartedit",\r
-            \r
-            "startedit",\r
-            \r
-            "beforecomplete",\r
-            \r
-            "complete",\r
-            \r
-            "canceledit",\r
-            \r
-            "specialkey"\r
-        );\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        this.el = new Ext.Layer({\r
-            shadow: this.shadow,\r
-            cls: "x-editor",\r
-            parentEl : ct,\r
-            shim : this.shim,\r
-            shadowOffset:4,\r
-            id: this.id,\r
-            constrain: this.constrain\r
-        });\r
-        this.el.setStyle("overflow", Ext.isGecko ? "auto" : "hidden");\r
-        if(this.field.msgTarget != 'title'){\r
-            this.field.msgTarget = 'qtip';\r
-        }\r
-        this.field.inEditor = true;\r
-        this.field.render(this.el);\r
-        if(Ext.isGecko){\r
-            this.field.el.dom.setAttribute('autocomplete', 'off');\r
-        }\r
-        this.field.on("specialkey", this.onSpecialKey, this);\r
-        if(this.swallowKeys){\r
-            this.field.el.swallowEvent(['keydown','keypress']);\r
-        }\r
-        this.field.show();\r
-        this.field.on("blur", this.onBlur, this);\r
-        if(this.field.grow){\r
-            this.field.on("autosize", this.el.sync,  this.el, {delay:1});\r
-        }\r
-    },\r
-\r
-    // private\r
-    onSpecialKey : function(field, e){\r
-        var key = e.getKey();\r
-        if(this.completeOnEnter && key == e.ENTER){\r
-            e.stopEvent();\r
-            this.completeEdit();\r
-        }else if(this.cancelOnEsc && key == e.ESC){\r
-            this.cancelEdit();\r
-        }else{\r
-            this.fireEvent('specialkey', field, e);\r
-        }\r
-        if(this.field.triggerBlur && (key == e.ENTER || key == e.ESC || key == e.TAB)){\r
-            this.field.triggerBlur();\r
-        }\r
-    },\r
-\r
-    \r
-    startEdit : function(el, value){\r
-        if(this.editing){\r
-            this.completeEdit();\r
-        }\r
-        this.boundEl = Ext.get(el);\r
-        var v = value !== undefined ? value : this.boundEl.dom.innerHTML;\r
-        if(!this.rendered){\r
-            this.render(this.parentEl || document.body);\r
-        }\r
-        if(this.fireEvent("beforestartedit", this, this.boundEl, v) === false){\r
-            return;\r
-        }\r
-        this.startValue = v;\r
-        this.field.setValue(v);\r
-        this.doAutoSize();\r
-        this.el.alignTo(this.boundEl, this.alignment);\r
-        this.editing = true;\r
-        this.show();\r
-    },\r
-\r
-    // private\r
-    doAutoSize : function(){\r
-        if(this.autoSize){\r
-            var sz = this.boundEl.getSize();\r
-            switch(this.autoSize){\r
-                case "width":\r
-                    this.setSize(sz.width,  "");\r
-                break;\r
-                case "height":\r
-                    this.setSize("",  sz.height);\r
-                break;\r
-                default:\r
-                    this.setSize(sz.width,  sz.height);\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    setSize : function(w, h){\r
-        delete this.field.lastSize;\r
-        this.field.setSize(w, h);\r
-        if(this.el){\r
-               if(Ext.isGecko2 || Ext.isOpera){\r
-                   // prevent layer scrollbars\r
-                   this.el.setSize(w, h);\r
-               }\r
-            this.el.sync();\r
-        }\r
-    },\r
-\r
-    \r
-    realign : function(){\r
-        this.el.alignTo(this.boundEl, this.alignment);\r
-    },\r
-\r
-    \r
-    completeEdit : function(remainVisible){\r
-        if(!this.editing){\r
-            return;\r
-        }\r
-        var v = this.getValue();\r
-        if(this.revertInvalid !== false && !this.field.isValid()){\r
-            v = this.startValue;\r
-            this.cancelEdit(true);\r
-        }\r
-        if(String(v) === String(this.startValue) && this.ignoreNoChange){\r
-            this.editing = false;\r
-            this.hide();\r
-            return;\r
-        }\r
-        if(this.fireEvent("beforecomplete", this, v, this.startValue) !== false){\r
-            this.editing = false;\r
-            if(this.updateEl && this.boundEl){\r
-                this.boundEl.update(v);\r
-            }\r
-            if(remainVisible !== true){\r
-                this.hide();\r
-            }\r
-            this.fireEvent("complete", this, v, this.startValue);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onShow : function(){\r
-        this.el.show();\r
-        if(this.hideEl !== false){\r
-            this.boundEl.hide();\r
-        }\r
-        this.field.show();\r
-        if(Ext.isIE && !this.fixIEFocus){ // IE has problems with focusing the first time\r
-            this.fixIEFocus = true;\r
-            this.deferredFocus.defer(50, this);\r
-        }else{\r
-            this.field.focus();\r
-        }\r
-        this.fireEvent("startedit", this.boundEl, this.startValue);\r
-    },\r
-\r
-    deferredFocus : function(){\r
-        if(this.editing){\r
-            this.field.focus();\r
-        }\r
-    },\r
-\r
-    \r
-    cancelEdit : function(remainVisible){\r
-        if(this.editing){\r
-            var v = this.getValue();\r
-            this.setValue(this.startValue);\r
-            if(remainVisible !== true){\r
-                this.hide();\r
-            }\r
-            this.fireEvent("canceledit", this, v, this.startValue);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onBlur : function(){\r
-        if(this.allowBlur !== true && this.editing){\r
-            this.completeEdit();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onHide : function(){\r
-        if(this.editing){\r
-            this.completeEdit();\r
-            return;\r
-        }\r
-        this.field.blur();\r
-        if(this.field.collapse){\r
-            this.field.collapse();\r
-        }\r
-        this.el.hide();\r
-        if(this.hideEl !== false){\r
-            this.boundEl.show();\r
-        }\r
-    },\r
-\r
-    \r
-    setValue : function(v){\r
-        this.field.setValue(v);\r
-    },\r
-\r
-    \r
-    getValue : function(){\r
-        return this.field.getValue();\r
-    },\r
-\r
-    beforeDestroy : function(){\r
-        Ext.destroy(this.field);\r
-        this.field = null;\r
-    }\r
-});\r
-Ext.reg('editor', Ext.Editor);\r
-\r
-Ext.MessageBox = function(){\r
-    var dlg, opt, mask, waitTimer;\r
-    var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl;\r
-    var buttons, activeTextEl, bwidth, iconCls = '';\r
-\r
-    // private\r
-    var handleButton = function(button){\r
-        if(dlg.isVisible()){\r
-            dlg.hide();\r
-            Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1);\r
-        }\r
-    };\r
-\r
-    // private\r
-    var handleHide = function(){\r
-        if(opt && opt.cls){\r
-            dlg.el.removeClass(opt.cls);\r
-        }\r
-        progressBar.reset();\r
-    };\r
-\r
-    // private\r
-    var handleEsc = function(d, k, e){\r
-        if(opt && opt.closable !== false){\r
-            dlg.hide();\r
-        }\r
-        if(e){\r
-            e.stopEvent();\r
-        }\r
-    };\r
-\r
-    // private\r
-    var updateButtons = function(b){\r
-        var width = 0;\r
-        if(!b){\r
-            buttons["ok"].hide();\r
-            buttons["cancel"].hide();\r
-            buttons["yes"].hide();\r
-            buttons["no"].hide();\r
-            return width;\r
-        }\r
-        dlg.footer.dom.style.display = '';\r
-        for(var k in buttons){\r
-            if(typeof buttons[k] != "function"){\r
-                if(b[k]){\r
-                    buttons[k].show();\r
-                    buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]);\r
-                    width += buttons[k].el.getWidth()+15;\r
-                }else{\r
-                    buttons[k].hide();\r
-                }\r
-            }\r
-        }\r
-        return width;\r
-    };\r
-\r
-    return {\r
-        \r
-        getDialog : function(titleText){\r
-           if(!dlg){\r
-                dlg = new Ext.Window({\r
-                    autoCreate : true,\r
-                    title:titleText,\r
-                    resizable:false,\r
-                    constrain:true,\r
-                    constrainHeader:true,\r
-                    minimizable : false,\r
-                    maximizable : false,\r
-                    stateful: false,\r
-                    modal: true,\r
-                    shim:true,\r
-                    buttonAlign:"center",\r
-                    width:400,\r
-                    height:100,\r
-                    minHeight: 80,\r
-                    plain:true,\r
-                    footer:true,\r
-                    closable:true,\r
-                    close : function(){\r
-                        if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){\r
-                            handleButton("no");\r
-                        }else{\r
-                            handleButton("cancel");\r
-                        }\r
-                    }\r
-                });\r
-                buttons = {};\r
-                var bt = this.buttonText;\r
-                //TODO: refactor this block into a buttons config to pass into the Window constructor\r
-                buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok"));\r
-                buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes"));\r
-                buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no"));\r
-                buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel"));\r
-                buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets';\r
-                dlg.render(document.body);\r
-                dlg.getEl().addClass('x-window-dlg');\r
-                mask = dlg.mask;\r
-                bodyEl = dlg.body.createChild({\r
-                    html:'<div class="ext-mb-icon"></div><div class="ext-mb-content"><span class="ext-mb-text"></span><br /><div class="ext-mb-fix-cursor"><input type="text" class="ext-mb-input" /><textarea class="ext-mb-textarea"></textarea></div></div>'\r
-                });\r
-                iconEl = Ext.get(bodyEl.dom.firstChild);\r
-                var contentEl = bodyEl.dom.childNodes[1];\r
-                msgEl = Ext.get(contentEl.firstChild);\r
-                textboxEl = Ext.get(contentEl.childNodes[2].firstChild);\r
-                textboxEl.enableDisplayMode();\r
-                textboxEl.addKeyListener([10,13], function(){\r
-                    if(dlg.isVisible() && opt && opt.buttons){\r
-                        if(opt.buttons.ok){\r
-                            handleButton("ok");\r
-                        }else if(opt.buttons.yes){\r
-                            handleButton("yes");\r
-                        }\r
-                    }\r
-                });\r
-                textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]);\r
-                textareaEl.enableDisplayMode();\r
-                progressBar = new Ext.ProgressBar({\r
-                    renderTo:bodyEl\r
-                });\r
-               bodyEl.createChild({cls:'x-clear'});\r
-            }\r
-            return dlg;\r
-        },\r
-\r
-        \r
-        updateText : function(text){\r
-            if(!dlg.isVisible() && !opt.width){\r
-                dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows\r
-            }\r
-            msgEl.update(text || '&#160;');\r
-\r
-            var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0;\r
-            var mw = msgEl.getWidth() + msgEl.getMargins('lr');\r
-            var fw = dlg.getFrameWidth('lr');\r
-            var bw = dlg.body.getFrameWidth('lr');\r
-            if (Ext.isIE && iw > 0){\r
-                //3 pixels get subtracted in the icon CSS for an IE margin issue,\r
-                //so we have to add it back here for the overall width to be consistent\r
-                iw += 3;\r
-            }\r
-            var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth),\r
-                        Math.max(opt.minWidth || this.minWidth, bwidth || 0));\r
-\r
-            if(opt.prompt === true){\r
-                activeTextEl.setWidth(w-iw-fw-bw);\r
-            }\r
-            if(opt.progress === true || opt.wait === true){\r
-                progressBar.setSize(w-iw-fw-bw);\r
-            }\r
-            if(Ext.isIE && w == bwidth){\r
-                w += 4; //Add offset when the content width is smaller than the buttons.    \r
-            }\r
-            dlg.setSize(w, 'auto').center();\r
-            return this;\r
-        },\r
-\r
-        \r
-        updateProgress : function(value, progressText, msg){\r
-            progressBar.updateProgress(value, progressText);\r
-            if(msg){\r
-                this.updateText(msg);\r
-            }\r
-            return this;\r
-        },\r
-\r
-        \r
-        isVisible : function(){\r
-            return dlg && dlg.isVisible();\r
-        },\r
-\r
-        \r
-        hide : function(){\r
-            var proxy = dlg.activeGhost;\r
-            if(this.isVisible() || proxy) {\r
-                dlg.hide();\r
-                handleHide();\r
-                if (proxy) {\r
-                    proxy.hide();\r
-                } \r
-            }\r
-            return this;\r
-        },\r
-\r
-        \r
-        show : function(options){\r
-            if(this.isVisible()){\r
-                this.hide();\r
-            }\r
-            opt = options;\r
-            var d = this.getDialog(opt.title || "&#160;");\r
-\r
-            d.setTitle(opt.title || "&#160;");\r
-            var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true);\r
-            d.tools.close.setDisplayed(allowClose);\r
-            activeTextEl = textboxEl;\r
-            opt.prompt = opt.prompt || (opt.multiline ? true : false);\r
-            if(opt.prompt){\r
-                if(opt.multiline){\r
-                    textboxEl.hide();\r
-                    textareaEl.show();\r
-                    textareaEl.setHeight(typeof opt.multiline == "number" ?\r
-                        opt.multiline : this.defaultTextHeight);\r
-                    activeTextEl = textareaEl;\r
-                }else{\r
-                    textboxEl.show();\r
-                    textareaEl.hide();\r
-                }\r
-            }else{\r
-                textboxEl.hide();\r
-                textareaEl.hide();\r
-            }\r
-            activeTextEl.dom.value = opt.value || "";\r
-            if(opt.prompt){\r
-                d.focusEl = activeTextEl;\r
-            }else{\r
-                var bs = opt.buttons;\r
-                var db = null;\r
-                if(bs && bs.ok){\r
-                    db = buttons["ok"];\r
-                }else if(bs && bs.yes){\r
-                    db = buttons["yes"];\r
-                }\r
-                if (db){\r
-                    d.focusEl = db;\r
-                }\r
-            }\r
-            if(opt.iconCls){\r
-              d.setIconClass(opt.iconCls);\r
-            }\r
-            this.setIcon(opt.icon);\r
-            bwidth = updateButtons(opt.buttons);\r
-            progressBar.setVisible(opt.progress === true || opt.wait === true);\r
-            this.updateProgress(0, opt.progressText);\r
-            this.updateText(opt.msg);\r
-            if(opt.cls){\r
-                d.el.addClass(opt.cls);\r
-            }\r
-            d.proxyDrag = opt.proxyDrag === true;\r
-            d.modal = opt.modal !== false;\r
-            d.mask = opt.modal !== false ? mask : false;\r
-            if(!d.isVisible()){\r
-                // force it to the end of the z-index stack so it gets a cursor in FF\r
-                document.body.appendChild(dlg.el.dom);\r
-                d.setAnimateTarget(opt.animEl);\r
-                d.show(opt.animEl);\r
-            }\r
-\r
-            //workaround for window internally enabling keymap in afterShow\r
-            d.on('show', function(){\r
-                if(allowClose === true){\r
-                    d.keyMap.enable();\r
-                }else{\r
-                    d.keyMap.disable();\r
-                }\r
-            }, this, {single:true});\r
-\r
-            if(opt.wait === true){\r
-                progressBar.wait(opt.waitConfig);\r
-            }\r
-            return this;\r
-        },\r
-\r
-        \r
-        setIcon : function(icon){\r
-            if(icon && icon != ''){\r
-                iconEl.removeClass('x-hidden');\r
-                iconEl.replaceClass(iconCls, icon);\r
-                iconCls = icon;\r
-            }else{\r
-                iconEl.replaceClass(iconCls, 'x-hidden');\r
-                iconCls = '';\r
-            }\r
-            return this;\r
-        },\r
-\r
-        \r
-        progress : function(title, msg, progressText){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: false,\r
-                progress:true,\r
-                closable:false,\r
-                minWidth: this.minProgressWidth,\r
-                progressText: progressText\r
-            });\r
-            return this;\r
-        },\r
-\r
-        \r
-        wait : function(msg, title, config){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: false,\r
-                closable:false,\r
-                wait:true,\r
-                modal:true,\r
-                minWidth: this.minProgressWidth,\r
-                waitConfig: config\r
-            });\r
-            return this;\r
-        },\r
-\r
-        \r
-        alert : function(title, msg, fn, scope){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: this.OK,\r
-                fn: fn,\r
-                scope : scope\r
-            });\r
-            return this;\r
-        },\r
-\r
-        \r
-        confirm : function(title, msg, fn, scope){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: this.YESNO,\r
-                fn: fn,\r
-                scope : scope,\r
-                icon: this.QUESTION\r
-            });\r
-            return this;\r
-        },\r
-\r
-        \r
-        prompt : function(title, msg, fn, scope, multiline, value){\r
-            this.show({\r
-                title : title,\r
-                msg : msg,\r
-                buttons: this.OKCANCEL,\r
-                fn: fn,\r
-                minWidth:250,\r
-                scope : scope,\r
-                prompt:true,\r
-                multiline: multiline,\r
-                value: value\r
-            });\r
-            return this;\r
-        },\r
-\r
-        \r
-        OK : {ok:true},\r
-        \r
-        CANCEL : {cancel:true},\r
-        \r
-        OKCANCEL : {ok:true, cancel:true},\r
-        \r
-        YESNO : {yes:true, no:true},\r
-        \r
-        YESNOCANCEL : {yes:true, no:true, cancel:true},\r
-        \r
-        INFO : 'ext-mb-info',\r
-        \r
-        WARNING : 'ext-mb-warning',\r
-        \r
-        QUESTION : 'ext-mb-question',\r
-        \r
-        ERROR : 'ext-mb-error',\r
-\r
-        \r
-        defaultTextHeight : 75,\r
-        \r
-        maxWidth : 600,\r
-        \r
-        minWidth : 100,\r
-        \r
-        minProgressWidth : 250,\r
-        \r
-        buttonText : {\r
-            ok : "OK",\r
-            cancel : "Cancel",\r
-            yes : "Yes",\r
-            no : "No"\r
-        }\r
-    };\r
-}();\r
-\r
-\r
-Ext.Msg = Ext.MessageBox;\r
-\r
-Ext.Tip = Ext.extend(Ext.Panel, {\r
-    \r
-    \r
-    \r
-    minWidth : 40,\r
-    \r
-    maxWidth : 300,\r
-    \r
-    shadow : "sides",\r
-    \r
-    defaultAlign : "tl-bl?",\r
-    autoRender: true,\r
-    quickShowInterval : 250,\r
-\r
-    // private panel overrides\r
-    frame:true,\r
-    hidden:true,\r
-    baseCls: 'x-tip',\r
-    floating:{shadow:true,shim:true,useDisplay:true,constrain:false},\r
-    autoHeight:true,\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.Tip.superclass.initComponent.call(this);\r
-        if(this.closable && !this.title){\r
-            this.elements += ',header';\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.Tip.superclass.afterRender.call(this);\r
-        if(this.closable){\r
-            this.addTool({\r
-                id: 'close',\r
-                handler: this.hide,\r
-                scope: this\r
-            });\r
-        }\r
-    },\r
-\r
-    \r
-    showAt : function(xy){\r
-        Ext.Tip.superclass.show.call(this);\r
-        if(this.measureWidth !== false && (!this.initialConfig || typeof this.initialConfig.width != 'number')){\r
-            this.doAutoWidth();\r
-        }\r
-        if(this.constrainPosition){\r
-            xy = this.el.adjustForConstraints(xy);\r
-        }\r
-        this.setPagePosition(xy[0], xy[1]);\r
-    },\r
-\r
-    // protected\r
-    doAutoWidth : function(){\r
-        var bw = this.body.getTextWidth();\r
-        if(this.title){\r
-            bw = Math.max(bw, this.header.child('span').getTextWidth(this.title));\r
-        }\r
-        bw += this.getFrameWidth() + (this.closable ? 20 : 0) + this.body.getPadding("lr");\r
-        this.setWidth(bw.constrain(this.minWidth, this.maxWidth));\r
-        \r
-        // IE7 repaint bug on initial show\r
-        if(Ext.isIE7 && !this.repainted){\r
-            this.el.repaint();\r
-            this.repainted = true;\r
-        }\r
-    },\r
-\r
-    \r
-    showBy : function(el, pos){\r
-        if(!this.rendered){\r
-            this.render(Ext.getBody());\r
-        }\r
-        this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign));\r
-    },\r
-\r
-    initDraggable : function(){\r
-        this.dd = new Ext.Tip.DD(this, typeof this.draggable == 'boolean' ? null : this.draggable);\r
-        this.header.addClass('x-tip-draggable');\r
-    }\r
-});\r
-\r
-// private - custom Tip DD implementation\r
-Ext.Tip.DD = function(tip, config){\r
-    Ext.apply(this, config);\r
-    this.tip = tip;\r
-    Ext.Tip.DD.superclass.constructor.call(this, tip.el.id, 'WindowDD-'+tip.id);\r
-    this.setHandleElId(tip.header.id);\r
-    this.scroll = false;\r
-};\r
-\r
-Ext.extend(Ext.Tip.DD, Ext.dd.DD, {\r
-    moveOnly:true,\r
-    scroll:false,\r
-    headerOffsets:[100, 25],\r
-    startDrag : function(){\r
-        this.tip.el.disableShadow();\r
-    },\r
-    endDrag : function(e){\r
-        this.tip.el.enableShadow(true);\r
-    }\r
-});\r
-\r
-Ext.ToolTip = Ext.extend(Ext.Tip, {\r
-    \r
-    \r
-    \r
-    showDelay: 500,\r
-    \r
-    hideDelay: 200,\r
-    \r
-    dismissDelay: 5000,\r
-    \r
-    mouseOffset: [15,18],\r
-    \r
-    trackMouse : false,\r
-    constrainPosition: true,\r
-\r
-    // private\r
-    initComponent: function(){\r
-        Ext.ToolTip.superclass.initComponent.call(this);\r
-        this.lastActive = new Date();\r
-        this.initTarget();\r
-    },\r
-\r
-    // private\r
-    initTarget : function(){\r
-        if(this.target){\r
-            this.target = Ext.get(this.target);\r
-            this.target.on('mouseover', this.onTargetOver, this);\r
-            this.target.on('mouseout', this.onTargetOut, this);\r
-            this.target.on('mousemove', this.onMouseMove, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMouseMove : function(e){\r
-        this.targetXY = e.getXY();\r
-        if(!this.hidden && this.trackMouse){\r
-            this.setPagePosition(this.getTargetXY());\r
-        }\r
-    },\r
-\r
-    // private\r
-    getTargetXY : function(){\r
-        return [this.targetXY[0]+this.mouseOffset[0], this.targetXY[1]+this.mouseOffset[1]];\r
-    },\r
-\r
-    // private\r
-    onTargetOver : function(e){\r
-        if(this.disabled || e.within(this.target.dom, true)){\r
-            return;\r
-        }\r
-        this.clearTimer('hide');\r
-        this.targetXY = e.getXY();\r
-        this.delayShow();\r
-    },\r
-\r
-    // private\r
-    delayShow : function(){\r
-        if(this.hidden && !this.showTimer){\r
-            if(this.lastActive.getElapsed() < this.quickShowInterval){\r
-                this.show();\r
-            }else{\r
-                this.showTimer = this.show.defer(this.showDelay, this);\r
-            }\r
-        }else if(!this.hidden && this.autoHide !== false){\r
-            this.show();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onTargetOut : function(e){\r
-        if(this.disabled || e.within(this.target.dom, true)){\r
-            return;\r
-        }\r
-        this.clearTimer('show');\r
-        if(this.autoHide !== false){\r
-            this.delayHide();\r
-        }\r
-    },\r
-\r
-    // private\r
-    delayHide : function(){\r
-        if(!this.hidden && !this.hideTimer){\r
-            this.hideTimer = this.hide.defer(this.hideDelay, this);\r
-        }\r
-    },\r
-\r
-    \r
-    hide: function(){\r
-        this.clearTimer('dismiss');\r
-        this.lastActive = new Date();\r
-        Ext.ToolTip.superclass.hide.call(this);\r
-    },\r
-\r
-    \r
-    show : function(){\r
-        this.showAt(this.getTargetXY());\r
-    },\r
-\r
-    // inherit docs\r
-    showAt : function(xy){\r
-        this.lastActive = new Date();\r
-        this.clearTimers();\r
-        Ext.ToolTip.superclass.showAt.call(this, xy);\r
-        if(this.dismissDelay && this.autoHide !== false){\r
-            this.dismissTimer = this.hide.defer(this.dismissDelay, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    clearTimer : function(name){\r
-        name = name + 'Timer';\r
-        clearTimeout(this[name]);\r
-        delete this[name];\r
-    },\r
-\r
-    // private\r
-    clearTimers : function(){\r
-        this.clearTimer('show');\r
-        this.clearTimer('dismiss');\r
-        this.clearTimer('hide');\r
-    },\r
-\r
-    // private\r
-    onShow : function(){\r
-        Ext.ToolTip.superclass.onShow.call(this);\r
-        Ext.getDoc().on('mousedown', this.onDocMouseDown, this);\r
-    },\r
-\r
-    // private\r
-    onHide : function(){\r
-        Ext.ToolTip.superclass.onHide.call(this);\r
-        Ext.getDoc().un('mousedown', this.onDocMouseDown, this);\r
-    },\r
-\r
-    // private\r
-    onDocMouseDown : function(e){\r
-        if(this.autoHide !== false && !e.within(this.el.dom)){\r
-            this.disable();\r
-            this.enable.defer(100, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        this.clearTimers();\r
-        this.hide();\r
-    },\r
-\r
-    // private\r
-    adjustPosition : function(x, y){\r
-        // keep the position from being under the mouse\r
-        var ay = this.targetXY[1], h = this.getSize().height;\r
-        if(this.constrainPosition && y <= ay && (y+h) >= ay){\r
-            y = ay-h-5;\r
-        }\r
-        return {x : x, y: y};\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        Ext.ToolTip.superclass.onDestroy.call(this);\r
-        if(this.target){\r
-            this.target.un('mouseover', this.onTargetOver, this);\r
-            this.target.un('mouseout', this.onTargetOut, this);\r
-            this.target.un('mousemove', this.onMouseMove, this);\r
-        }\r
-    }\r
-});\r
-\r
-Ext.QuickTip = Ext.extend(Ext.ToolTip, {\r
-    \r
-    \r
-    interceptTitles : false,\r
-\r
-    // private\r
-    tagConfig : {\r
-        namespace : "ext",\r
-        attribute : "qtip",\r
-        width : "qwidth",\r
-        target : "target",\r
-        title : "qtitle",\r
-        hide : "hide",\r
-        cls : "qclass",\r
-        align : "qalign"\r
-    },\r
-\r
-    // private\r
-    initComponent : function(){\r
-        this.target = this.target || Ext.getDoc();\r
-        this.targets = this.targets || {};\r
-        Ext.QuickTip.superclass.initComponent.call(this);\r
-    },\r
-\r
-    \r
-    register : function(config){\r
-        var cs = Ext.isArray(config) ? config : arguments;\r
-        for(var i = 0, len = cs.length; i < len; i++){\r
-            var c = cs[i];\r
-            var target = c.target;\r
-            if(target){\r
-                if(Ext.isArray(target)){\r
-                    for(var j = 0, jlen = target.length; j < jlen; j++){\r
-                        this.targets[Ext.id(target[j])] = c;\r
-                    }\r
-                } else{\r
-                    this.targets[Ext.id(target)] = c;\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    unregister : function(el){\r
-        delete this.targets[Ext.id(el)];\r
-    },\r
-\r
-    // private\r
-    onTargetOver : function(e){\r
-        if(this.disabled){\r
-            return;\r
-        }\r
-        this.targetXY = e.getXY();\r
-        var t = e.getTarget();\r
-        if(!t || t.nodeType !== 1 || t == document || t == document.body){\r
-            return;\r
-        }\r
-        if(this.activeTarget && t == this.activeTarget.el){\r
-            this.clearTimer('hide');\r
-            this.show();\r
-            return;\r
-        }\r
-        if(t && this.targets[t.id]){\r
-            this.activeTarget = this.targets[t.id];\r
-            this.activeTarget.el = t;\r
-            this.delayShow();\r
-            return;\r
-        }\r
-        var ttp, et = Ext.fly(t), cfg = this.tagConfig;\r
-        var ns = cfg.namespace;\r
-        if(this.interceptTitles && t.title){\r
-            ttp = t.title;\r
-            t.qtip = ttp;\r
-            t.removeAttribute("title");\r
-            e.preventDefault();\r
-        } else{\r
-            ttp = t.qtip || et.getAttributeNS(ns, cfg.attribute);\r
-        }\r
-        if(ttp){\r
-            var autoHide = et.getAttributeNS(ns, cfg.hide);\r
-            this.activeTarget = {\r
-                el: t,\r
-                text: ttp,\r
-                width: et.getAttributeNS(ns, cfg.width),\r
-                autoHide: autoHide != "user" && autoHide !== 'false',\r
-                title: et.getAttributeNS(ns, cfg.title),\r
-                cls: et.getAttributeNS(ns, cfg.cls),\r
-                align: et.getAttributeNS(ns, cfg.align)\r
-            };\r
-            this.delayShow();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onTargetOut : function(e){\r
-        this.clearTimer('show');\r
-        if(this.autoHide !== false){\r
-            this.delayHide();\r
-        }\r
-    },\r
-\r
-    // inherit docs\r
-    showAt : function(xy){\r
-        var t = this.activeTarget;\r
-        if(t){\r
-            if(!this.rendered){\r
-                this.render(Ext.getBody());\r
-                this.activeTarget = t;\r
-            }\r
-            if(t.width){\r
-                this.setWidth(t.width);\r
-                this.body.setWidth(this.adjustBodyWidth(t.width - this.getFrameWidth()));\r
-                this.measureWidth = false;\r
-            } else{\r
-                this.measureWidth = true;\r
-            }\r
-            this.setTitle(t.title || '');\r
-            this.body.update(t.text);\r
-            this.autoHide = t.autoHide;\r
-            this.dismissDelay = t.dismissDelay || this.dismissDelay;\r
-            if(this.lastCls){\r
-                this.el.removeClass(this.lastCls);\r
-                delete this.lastCls;\r
-            }\r
-            if(t.cls){\r
-                this.el.addClass(t.cls);\r
-                this.lastCls = t.cls;\r
-            }\r
-            if(t.align){ // TODO: this doesn't seem to work consistently\r
-                xy = this.el.getAlignToXY(t.el, t.align);\r
-                this.constrainPosition = false;\r
-            } else{\r
-                this.constrainPosition = true;\r
-            }\r
-        }\r
-        Ext.QuickTip.superclass.showAt.call(this, xy);\r
-    },\r
-\r
-    // inherit docs\r
-    hide: function(){\r
-        delete this.activeTarget;\r
-        Ext.QuickTip.superclass.hide.call(this);\r
-    }\r
-});\r
-\r
-Ext.QuickTips = function(){\r
-    var tip, locks = [];\r
-    return {\r
-        \r
-        init : function(autoRender){\r
-                   if(!tip){\r
-                       if(!Ext.isReady){\r
-                           Ext.onReady(function(){\r
-                               Ext.QuickTips.init(autoRender);\r
-                           });\r
-                           return;\r
-                       }\r
-                       tip = new Ext.QuickTip({elements:'header,body'});\r
-                       if(autoRender !== false){\r
-                           tip.render(Ext.getBody());\r
-                       }\r
-                   }\r
-        },\r
-\r
-        \r
-        enable : function(){\r
-            if(tip){\r
-                locks.pop();\r
-                if(locks.length < 1){\r
-                    tip.enable();\r
-                }\r
-            }\r
-        },\r
-\r
-        \r
-        disable : function(){\r
-            if(tip){\r
-                tip.disable();\r
-            }\r
-            locks.push(1);\r
-        },\r
-\r
-        \r
-        isEnabled : function(){\r
-            return tip !== undefined && !tip.disabled;\r
-        },\r
-\r
-        \r
-        getQuickTip : function(){\r
-            return tip;\r
-        },\r
-\r
-        \r
-        register : function(){\r
-            tip.register.apply(tip, arguments);\r
-        },\r
-\r
-        \r
-        unregister : function(){\r
-            tip.unregister.apply(tip, arguments);\r
-        },\r
-\r
-        \r
-        tips :function(){\r
-            tip.register.apply(tip, arguments);\r
-        }\r
-    }\r
-}();\r
-\r
-Ext.tree.TreePanel = Ext.extend(Ext.Panel, {\r
-    rootVisible : true,\r
-    animate: Ext.enableFx,\r
-    lines : true,\r
-    enableDD : false,\r
-    hlDrop : Ext.enableFx,\r
-    pathSeparator: "/",\r
-\r
-    initComponent : function(){\r
-        Ext.tree.TreePanel.superclass.initComponent.call(this);\r
-\r
-        if(!this.eventModel){\r
-            this.eventModel = new Ext.tree.TreeEventModel(this);\r
-        }\r
-        \r
-        // initialize the loader\r
-        var l = this.loader;\r
-        if(!l){\r
-            l = new Ext.tree.TreeLoader({\r
-                dataUrl: this.dataUrl\r
-            });\r
-        }else if(typeof l == 'object' && !l.load){\r
-            l = new Ext.tree.TreeLoader(l);\r
-        }\r
-        this.loader = l;\r
-        \r
-        this.nodeHash = {};\r
-\r
-        \r
-        if(this.root){\r
-           this.setRootNode(this.root);\r
-        }\r
-\r
-        this.addEvents(\r
-\r
-            \r
-           "append",\r
-           \r
-           "remove",\r
-           \r
-           "movenode",\r
-           \r
-           "insert",\r
-           \r
-           "beforeappend",\r
-           \r
-           "beforeremove",\r
-           \r
-           "beforemovenode",\r
-           \r
-            "beforeinsert",\r
-\r
-            \r
-            "beforeload",\r
-            \r
-            "load",\r
-            \r
-            "textchange",\r
-            \r
-            "beforeexpandnode",\r
-            \r
-            "beforecollapsenode",\r
-            \r
-            "expandnode",\r
-            \r
-            "disabledchange",\r
-            \r
-            "collapsenode",\r
-            \r
-            "beforeclick",\r
-            \r
-            "click",\r
-            \r
-            "checkchange",\r
-            \r
-            "dblclick",\r
-            \r
-            "contextmenu",\r
-            \r
-            "beforechildrenrendered",\r
-           \r
-            "startdrag",\r
-            \r
-            "enddrag",\r
-            \r
-            "dragdrop",\r
-            \r
-            "beforenodedrop",\r
-            \r
-            "nodedrop",\r
-             \r
-            "nodedragover"\r
-        );\r
-        if(this.singleExpand){\r
-            this.on("beforeexpandnode", this.restrictExpand, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    proxyNodeEvent : function(ename, a1, a2, a3, a4, a5, a6){\r
-        if(ename == 'collapse' || ename == 'expand' || ename == 'beforecollapse' || ename == 'beforeexpand' || ename == 'move' || ename == 'beforemove'){\r
-            ename = ename+'node';\r
-        }\r
-        // args inline for performance while bubbling events\r
-        return this.fireEvent(ename, a1, a2, a3, a4, a5, a6);\r
-    },\r
-\r
-\r
-    \r
-    getRootNode : function(){\r
-        return this.root;\r
-    },\r
-\r
-    \r
-    setRootNode : function(node){\r
-        if(!node.render){ // attributes passed\r
-            node = this.loader.createNode(node);\r
-        }\r
-        this.root = node;\r
-        node.ownerTree = this;\r
-        node.isRoot = true;\r
-        this.registerNode(node);\r
-        if(!this.rootVisible){\r
-               var uiP = node.attributes.uiProvider;\r
-               node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node); \r
-        }\r
-        return node;\r
-    },\r
-\r
-    \r
-    getNodeById : function(id){\r
-        return this.nodeHash[id];\r
-    },\r
-\r
-    // private\r
-    registerNode : function(node){\r
-        this.nodeHash[node.id] = node;\r
-    },\r
-\r
-    // private\r
-    unregisterNode : function(node){\r
-        delete this.nodeHash[node.id];\r
-    },\r
-\r
-    // private\r
-    toString : function(){\r
-        return "[Tree"+(this.id?" "+this.id:"")+"]";\r
-    },\r
-\r
-    // private\r
-    restrictExpand : function(node){\r
-        var p = node.parentNode;\r
-        if(p){\r
-            if(p.expandedChild && p.expandedChild.parentNode == p){\r
-                p.expandedChild.collapse();\r
-            }\r
-            p.expandedChild = node;\r
-        }\r
-    },\r
-\r
-    \r
-    getChecked : function(a, startNode){\r
-        startNode = startNode || this.root;\r
-        var r = [];\r
-        var f = function(){\r
-            if(this.attributes.checked){\r
-                r.push(!a ? this : (a == 'id' ? this.id : this.attributes[a]));\r
-            }\r
-        }\r
-        startNode.cascade(f);\r
-        return r;\r
-    },\r
-\r
-    \r
-    getEl : function(){\r
-        return this.el;\r
-    },\r
-\r
-    \r
-    getLoader : function(){\r
-        return this.loader;\r
-    },\r
-\r
-    \r
-    expandAll : function(){\r
-        this.root.expand(true);\r
-    },\r
-\r
-    \r
-    collapseAll : function(){\r
-        this.root.collapse(true);\r
-    },\r
-\r
-    \r
-    getSelectionModel : function(){\r
-        if(!this.selModel){\r
-            this.selModel = new Ext.tree.DefaultSelectionModel();\r
-        }\r
-        return this.selModel;\r
-    },\r
-\r
-    \r
-    expandPath : function(path, attr, callback){\r
-        attr = attr || "id";\r
-        var keys = path.split(this.pathSeparator);\r
-        var curNode = this.root;\r
-        if(curNode.attributes[attr] != keys[1]){ // invalid root\r
-            if(callback){\r
-                callback(false, null);\r
-            }\r
-            return;\r
-        }\r
-        var index = 1;\r
-        var f = function(){\r
-            if(++index == keys.length){\r
-                if(callback){\r
-                    callback(true, curNode);\r
-                }\r
-                return;\r
-            }\r
-            var c = curNode.findChild(attr, keys[index]);\r
-            if(!c){\r
-                if(callback){\r
-                    callback(false, curNode);\r
-                }\r
-                return;\r
-            }\r
-            curNode = c;\r
-            c.expand(false, false, f);\r
-        };\r
-        curNode.expand(false, false, f);\r
-    },\r
-\r
-    \r
-    selectPath : function(path, attr, callback){\r
-        attr = attr || "id";\r
-        var keys = path.split(this.pathSeparator);\r
-        var v = keys.pop();\r
-        if(keys.length > 0){\r
-            var f = function(success, node){\r
-                if(success && node){\r
-                    var n = node.findChild(attr, v);\r
-                    if(n){\r
-                        n.select();\r
-                        if(callback){\r
-                            callback(true, n);\r
-                        }\r
-                    }else if(callback){\r
-                        callback(false, n);\r
-                    }\r
-                }else{\r
-                    if(callback){\r
-                        callback(false, n);\r
-                    }\r
-                }\r
-            };\r
-            this.expandPath(keys.join(this.pathSeparator), attr, f);\r
-        }else{\r
-            this.root.select();\r
-            if(callback){\r
-                callback(true, this.root);\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    getTreeEl : function(){\r
-        return this.body;\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.tree.TreePanel.superclass.onRender.call(this, ct, position);\r
-        this.el.addClass('x-tree');\r
-        this.innerCt = this.body.createChild({tag:"ul",\r
-               cls:"x-tree-root-ct " +\r
-               (this.useArrows ? 'x-tree-arrows' : this.lines ? "x-tree-lines" : "x-tree-no-lines")});\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.tree.TreePanel.superclass.initEvents.call(this);\r
-\r
-        if(this.containerScroll){\r
-            Ext.dd.ScrollManager.register(this.body);\r
-        }\r
-        if((this.enableDD || this.enableDrop) && !this.dropZone){\r
-           \r
-             this.dropZone = new Ext.tree.TreeDropZone(this, this.dropConfig || {\r
-               ddGroup: this.ddGroup || "TreeDD", appendOnly: this.ddAppendOnly === true\r
-           });\r
-        }\r
-        if((this.enableDD || this.enableDrag) && !this.dragZone){\r
-           \r
-            this.dragZone = new Ext.tree.TreeDragZone(this, this.dragConfig || {\r
-               ddGroup: this.ddGroup || "TreeDD",\r
-               scroll: this.ddScroll\r
-           });\r
-        }\r
-        this.getSelectionModel().init(this);\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.tree.TreePanel.superclass.afterRender.call(this);\r
-        this.root.render();\r
-        if(!this.rootVisible){\r
-            this.root.renderChildren();\r
-        }\r
-    },\r
-\r
-    onDestroy : function(){\r
-        if(this.rendered){\r
-            this.body.removeAllListeners();\r
-            Ext.dd.ScrollManager.unregister(this.body);\r
-            if(this.dropZone){\r
-                this.dropZone.unreg();\r
-            }\r
-            if(this.dragZone){\r
-               this.dragZone.unreg();\r
-            }\r
-        }\r
-        this.root.destroy();\r
-        this.nodeHash = null;\r
-        Ext.tree.TreePanel.superclass.onDestroy.call(this);\r
-    }\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-\r
-\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-});\r
-\r
-Ext.tree.TreePanel.nodeTypes = {};\r
-\r
-Ext.reg('treepanel', Ext.tree.TreePanel);\r
-Ext.tree.TreeEventModel = function(tree){\r
-    this.tree = tree;\r
-    this.tree.on('render', this.initEvents, this);\r
-}\r
-\r
-Ext.tree.TreeEventModel.prototype = {\r
-    initEvents : function(){\r
-        var el = this.tree.getTreeEl();\r
-        el.on('click', this.delegateClick, this);\r
-        if(this.tree.trackMouseOver !== false){\r
-            el.on('mouseover', this.delegateOver, this);\r
-            el.on('mouseout', this.delegateOut, this);\r
-        }\r
-        el.on('dblclick', this.delegateDblClick, this);\r
-        el.on('contextmenu', this.delegateContextMenu, this);\r
-    },\r
-\r
-    getNode : function(e){\r
-        var t;\r
-        if(t = e.getTarget('.x-tree-node-el', 10)){\r
-            var id = Ext.fly(t, '_treeEvents').getAttributeNS('ext', 'tree-node-id');\r
-            if(id){\r
-                return this.tree.getNodeById(id);\r
-            }\r
-        }\r
-        return null;\r
-    },\r
-\r
-    getNodeTarget : function(e){\r
-        var t = e.getTarget('.x-tree-node-icon', 1);\r
-        if(!t){\r
-            t = e.getTarget('.x-tree-node-el', 6);\r
-        }\r
-        return t;\r
-    },\r
-\r
-    delegateOut : function(e, t){\r
-        if(!this.beforeEvent(e)){\r
-            return;\r
-        }\r
-        if(e.getTarget('.x-tree-ec-icon', 1)){\r
-            var n = this.getNode(e);\r
-            this.onIconOut(e, n);\r
-            if(n == this.lastEcOver){\r
-                delete this.lastEcOver;\r
-            }\r
-        }\r
-        if((t = this.getNodeTarget(e)) && !e.within(t, true)){\r
-            this.onNodeOut(e, this.getNode(e));\r
-        }\r
-    },\r
-\r
-    delegateOver : function(e, t){\r
-        if(!this.beforeEvent(e)){\r
-            return;\r
-        }\r
-        if(this.lastEcOver){ // prevent hung highlight\r
-            this.onIconOut(e, this.lastEcOver);\r
-            delete this.lastEcOver;\r
-        }\r
-        if(e.getTarget('.x-tree-ec-icon', 1)){\r
-            this.lastEcOver = this.getNode(e);\r
-            this.onIconOver(e, this.lastEcOver);\r
-        }\r
-        if(t = this.getNodeTarget(e)){\r
-            this.onNodeOver(e, this.getNode(e));\r
-        }\r
-    },\r
-\r
-    delegateClick : function(e, t){\r
-        if(!this.beforeEvent(e)){\r
-            return;\r
-        }\r
-\r
-        if(e.getTarget('input[type=checkbox]', 1)){\r
-            this.onCheckboxClick(e, this.getNode(e));\r
-        }\r
-        else if(e.getTarget('.x-tree-ec-icon', 1)){\r
-            this.onIconClick(e, this.getNode(e));\r
-        }\r
-        else if(this.getNodeTarget(e)){\r
-            this.onNodeClick(e, this.getNode(e));\r
-        }\r
-    },\r
-\r
-    delegateDblClick : function(e, t){\r
-        if(this.beforeEvent(e) && this.getNodeTarget(e)){\r
-            this.onNodeDblClick(e, this.getNode(e));\r
-        }\r
-    },\r
-\r
-    delegateContextMenu : function(e, t){\r
-        if(this.beforeEvent(e) && this.getNodeTarget(e)){\r
-            this.onNodeContextMenu(e, this.getNode(e));\r
-        }\r
-    },\r
-\r
-    onNodeClick : function(e, node){\r
-        node.ui.onClick(e);\r
-    },\r
-\r
-    onNodeOver : function(e, node){\r
-        node.ui.onOver(e);\r
-    },\r
-\r
-    onNodeOut : function(e, node){\r
-        node.ui.onOut(e);\r
-    },\r
-\r
-    onIconOver : function(e, node){\r
-        node.ui.addClass('x-tree-ec-over');\r
-    },\r
-\r
-    onIconOut : function(e, node){\r
-        node.ui.removeClass('x-tree-ec-over');\r
-    },\r
-\r
-    onIconClick : function(e, node){\r
-        node.ui.ecClick(e);\r
-    },\r
-\r
-    onCheckboxClick : function(e, node){\r
-        node.ui.onCheckChange(e);\r
-    },\r
-\r
-    onNodeDblClick : function(e, node){\r
-        node.ui.onDblClick(e);\r
-    },\r
-\r
-    onNodeContextMenu : function(e, node){\r
-        node.ui.onContextMenu(e);\r
-    },\r
-\r
-    beforeEvent : function(e){\r
-        if(this.disabled){\r
-            e.stopEvent();\r
-            return false;\r
-        }\r
-        return true;\r
-    },\r
-\r
-    disable: function(){\r
-        this.disabled = true;\r
-    },\r
-\r
-    enable: function(){\r
-        this.disabled = false;\r
-    }\r
-};\r
-\r
-Ext.tree.DefaultSelectionModel = function(config){\r
-   this.selNode = null;\r
-   \r
-   this.addEvents(\r
-       \r
-       "selectionchange",\r
-\r
-       \r
-       "beforeselect"\r
-   );\r
-\r
-    Ext.apply(this, config);\r
-    Ext.tree.DefaultSelectionModel.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.tree.DefaultSelectionModel, Ext.util.Observable, {\r
-    init : function(tree){\r
-        this.tree = tree;\r
-        tree.getTreeEl().on("keydown", this.onKeyDown, this);\r
-        tree.on("click", this.onNodeClick, this);\r
-    },\r
-    \r
-    onNodeClick : function(node, e){\r
-        this.select(node);\r
-    },\r
-    \r
-    \r
-    select : function(node){\r
-        var last = this.selNode;\r
-        if(last != node && this.fireEvent('beforeselect', this, node, last) !== false){\r
-            if(last){\r
-                last.ui.onSelectedChange(false);\r
-            }\r
-            this.selNode = node;\r
-            node.ui.onSelectedChange(true);\r
-            this.fireEvent("selectionchange", this, node, last);\r
-        }\r
-        return node;\r
-    },\r
-    \r
-    \r
-    unselect : function(node){\r
-        if(this.selNode == node){\r
-            this.clearSelections();\r
-        }    \r
-    },\r
-    \r
-    \r
-    clearSelections : function(){\r
-        var n = this.selNode;\r
-        if(n){\r
-            n.ui.onSelectedChange(false);\r
-            this.selNode = null;\r
-            this.fireEvent("selectionchange", this, null);\r
-        }\r
-        return n;\r
-    },\r
-    \r
-    \r
-    getSelectedNode : function(){\r
-        return this.selNode;    \r
-    },\r
-    \r
-    \r
-    isSelected : function(node){\r
-        return this.selNode == node;  \r
-    },\r
-\r
-    \r
-    selectPrevious : function(){\r
-        var s = this.selNode || this.lastSelNode;\r
-        if(!s){\r
-            return null;\r
-        }\r
-        var ps = s.previousSibling;\r
-        if(ps){\r
-            if(!ps.isExpanded() || ps.childNodes.length < 1){\r
-                return this.select(ps);\r
-            } else{\r
-                var lc = ps.lastChild;\r
-                while(lc && lc.isExpanded() && lc.childNodes.length > 0){\r
-                    lc = lc.lastChild;\r
-                }\r
-                return this.select(lc);\r
-            }\r
-        } else if(s.parentNode && (this.tree.rootVisible || !s.parentNode.isRoot)){\r
-            return this.select(s.parentNode);\r
-        }\r
-        return null;\r
-    },\r
-\r
-    \r
-    selectNext : function(){\r
-        var s = this.selNode || this.lastSelNode;\r
-        if(!s){\r
-            return null;\r
-        }\r
-        if(s.firstChild && s.isExpanded()){\r
-             return this.select(s.firstChild);\r
-         }else if(s.nextSibling){\r
-             return this.select(s.nextSibling);\r
-         }else if(s.parentNode){\r
-            var newS = null;\r
-            s.parentNode.bubble(function(){\r
-                if(this.nextSibling){\r
-                    newS = this.getOwnerTree().selModel.select(this.nextSibling);\r
-                    return false;\r
-                }\r
-            });\r
-            return newS;\r
-         }\r
-        return null;\r
-    },\r
-\r
-    onKeyDown : function(e){\r
-        var s = this.selNode || this.lastSelNode;\r
-        // undesirable, but required\r
-        var sm = this;\r
-        if(!s){\r
-            return;\r
-        }\r
-        var k = e.getKey();\r
-        switch(k){\r
-             case e.DOWN:\r
-                 e.stopEvent();\r
-                 this.selectNext();\r
-             break;\r
-             case e.UP:\r
-                 e.stopEvent();\r
-                 this.selectPrevious();\r
-             break;\r
-             case e.RIGHT:\r
-                 e.preventDefault();\r
-                 if(s.hasChildNodes()){\r
-                     if(!s.isExpanded()){\r
-                         s.expand();\r
-                     }else if(s.firstChild){\r
-                         this.select(s.firstChild, e);\r
-                     }\r
-                 }\r
-             break;\r
-             case e.LEFT:\r
-                 e.preventDefault();\r
-                 if(s.hasChildNodes() && s.isExpanded()){\r
-                     s.collapse();\r
-                 }else if(s.parentNode && (this.tree.rootVisible || s.parentNode != this.tree.getRootNode())){\r
-                     this.select(s.parentNode, e);\r
-                 }\r
-             break;\r
-        };\r
-    }\r
-});\r
-\r
-\r
-Ext.tree.MultiSelectionModel = function(config){\r
-   this.selNodes = [];\r
-   this.selMap = {};\r
-   this.addEvents(\r
-       \r
-       "selectionchange"\r
-   );\r
-    Ext.apply(this, config);\r
-    Ext.tree.MultiSelectionModel.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.tree.MultiSelectionModel, Ext.util.Observable, {\r
-    init : function(tree){\r
-        this.tree = tree;\r
-        tree.getTreeEl().on("keydown", this.onKeyDown, this);\r
-        tree.on("click", this.onNodeClick, this);\r
-    },\r
-    \r
-    onNodeClick : function(node, e){\r
-        this.select(node, e, e.ctrlKey);\r
-    },\r
-    \r
-    \r
-    select : function(node, e, keepExisting){\r
-        if(keepExisting !== true){\r
-            this.clearSelections(true);\r
-        }\r
-        if(this.isSelected(node)){\r
-            this.lastSelNode = node;\r
-            return node;\r
-        }\r
-        this.selNodes.push(node);\r
-        this.selMap[node.id] = node;\r
-        this.lastSelNode = node;\r
-        node.ui.onSelectedChange(true);\r
-        this.fireEvent("selectionchange", this, this.selNodes);\r
-        return node;\r
-    },\r
-    \r
-    \r
-    unselect : function(node){\r
-        if(this.selMap[node.id]){\r
-            node.ui.onSelectedChange(false);\r
-            var sn = this.selNodes;\r
-            var index = sn.indexOf(node);\r
-            if(index != -1){\r
-                this.selNodes.splice(index, 1);\r
-            }\r
-            delete this.selMap[node.id];\r
-            this.fireEvent("selectionchange", this, this.selNodes);\r
-        }\r
-    },\r
-    \r
-    \r
-    clearSelections : function(suppressEvent){\r
-        var sn = this.selNodes;\r
-        if(sn.length > 0){\r
-            for(var i = 0, len = sn.length; i < len; i++){\r
-                sn[i].ui.onSelectedChange(false);\r
-            }\r
-            this.selNodes = [];\r
-            this.selMap = {};\r
-            if(suppressEvent !== true){\r
-                this.fireEvent("selectionchange", this, this.selNodes);\r
-            }\r
-        }\r
-    },\r
-    \r
-    \r
-    isSelected : function(node){\r
-        return this.selMap[node.id] ? true : false;  \r
-    },\r
-    \r
-    \r
-    getSelectedNodes : function(){\r
-        return this.selNodes;    \r
-    },\r
-\r
-    onKeyDown : Ext.tree.DefaultSelectionModel.prototype.onKeyDown,\r
-\r
-    selectNext : Ext.tree.DefaultSelectionModel.prototype.selectNext,\r
-\r
-    selectPrevious : Ext.tree.DefaultSelectionModel.prototype.selectPrevious\r
-});\r
-\r
-Ext.tree.TreeNode = function(attributes){\r
-    attributes = attributes || {};\r
-    if(typeof attributes == "string"){\r
-        attributes = {text: attributes};\r
-    }\r
-    this.childrenRendered = false;\r
-    this.rendered = false;\r
-    Ext.tree.TreeNode.superclass.constructor.call(this, attributes);\r
-    this.expanded = attributes.expanded === true;\r
-    this.isTarget = attributes.isTarget !== false;\r
-    this.draggable = attributes.draggable !== false && attributes.allowDrag !== false;\r
-    this.allowChildren = attributes.allowChildren !== false && attributes.allowDrop !== false;\r
-\r
-    \r
-    this.text = attributes.text;\r
-    \r
-    this.disabled = attributes.disabled === true;\r
-\r
-    this.addEvents(\r
-        \r
-        "textchange",\r
-        \r
-        "beforeexpand",\r
-        \r
-        "beforecollapse",\r
-        \r
-        "expand",\r
-        \r
-        "disabledchange",\r
-        \r
-        "collapse",\r
-        \r
-        "beforeclick",\r
-        \r
-        "click",\r
-        \r
-        "checkchange",\r
-        \r
-        "dblclick",\r
-        \r
-        "contextmenu",\r
-        \r
-        "beforechildrenrendered"\r
-    );\r
-\r
-    var uiClass = this.attributes.uiProvider || this.defaultUI || Ext.tree.TreeNodeUI;\r
-\r
-    \r
-    this.ui = new uiClass(this);\r
-};\r
-Ext.extend(Ext.tree.TreeNode, Ext.data.Node, {\r
-    preventHScroll: true,\r
-    \r
-    isExpanded : function(){\r
-        return this.expanded;\r
-    },\r
-\r
-\r
-    getUI : function(){\r
-        return this.ui;\r
-    },\r
-\r
-    getLoader : function(){\r
-        var owner;\r
-        return this.loader || ((owner = this.getOwnerTree()) && owner.loader ? owner.loader : new Ext.tree.TreeLoader());\r
-    },\r
-\r
-    // private override\r
-    setFirstChild : function(node){\r
-        var of = this.firstChild;\r
-        Ext.tree.TreeNode.superclass.setFirstChild.call(this, node);\r
-        if(this.childrenRendered && of && node != of){\r
-            of.renderIndent(true, true);\r
-        }\r
-        if(this.rendered){\r
-            this.renderIndent(true, true);\r
-        }\r
-    },\r
-\r
-    // private override\r
-    setLastChild : function(node){\r
-        var ol = this.lastChild;\r
-        Ext.tree.TreeNode.superclass.setLastChild.call(this, node);\r
-        if(this.childrenRendered && ol && node != ol){\r
-            ol.renderIndent(true, true);\r
-        }\r
-        if(this.rendered){\r
-            this.renderIndent(true, true);\r
-        }\r
-    },\r
-\r
-    // these methods are overridden to provide lazy rendering support\r
-    // private override\r
-    appendChild : function(n){\r
-        if(!n.render && !Ext.isArray(n)){\r
-            n = this.getLoader().createNode(n);\r
-        }\r
-        var node = Ext.tree.TreeNode.superclass.appendChild.call(this, n);\r
-        if(node && this.childrenRendered){\r
-            node.render();\r
-        }\r
-        this.ui.updateExpandIcon();\r
-        return node;\r
-    },\r
-\r
-    // private override\r
-    removeChild : function(node){\r
-        this.ownerTree.getSelectionModel().unselect(node);\r
-        Ext.tree.TreeNode.superclass.removeChild.apply(this, arguments);\r
-        // if it's been rendered remove dom node\r
-        if(this.childrenRendered){\r
-            node.ui.remove();\r
-        }\r
-        if(this.childNodes.length < 1){\r
-            this.collapse(false, false);\r
-        }else{\r
-            this.ui.updateExpandIcon();\r
-        }\r
-        if(!this.firstChild && !this.isHiddenRoot()) {\r
-            this.childrenRendered = false;\r
-        }\r
-        return node;\r
-    },\r
-\r
-    // private override\r
-    insertBefore : function(node, refNode){\r
-        if(!node.render){ \r
-            node = this.getLoader().createNode(node);\r
-        }\r
-        var newNode = Ext.tree.TreeNode.superclass.insertBefore.apply(this, arguments);\r
-        if(newNode && refNode && this.childrenRendered){\r
-            node.render();\r
-        }\r
-        this.ui.updateExpandIcon();\r
-        return newNode;\r
-    },\r
-\r
-    \r
-    setText : function(text){\r
-        var oldText = this.text;\r
-        this.text = text;\r
-        this.attributes.text = text;\r
-        if(this.rendered){ // event without subscribing\r
-            this.ui.onTextChange(this, text, oldText);\r
-        }\r
-        this.fireEvent("textchange", this, text, oldText);\r
-    },\r
-\r
-    \r
-    select : function(){\r
-        this.getOwnerTree().getSelectionModel().select(this);\r
-    },\r
-\r
-    \r
-    unselect : function(){\r
-        this.getOwnerTree().getSelectionModel().unselect(this);\r
-    },\r
-\r
-    \r
-    isSelected : function(){\r
-        return this.getOwnerTree().getSelectionModel().isSelected(this);\r
-    },\r
-\r
-    \r
-    expand : function(deep, anim, callback){\r
-        if(!this.expanded){\r
-            if(this.fireEvent("beforeexpand", this, deep, anim) === false){\r
-                return;\r
-            }\r
-            if(!this.childrenRendered){\r
-                this.renderChildren();\r
-            }\r
-            this.expanded = true;\r
-            if(!this.isHiddenRoot() && (this.getOwnerTree().animate && anim !== false) || anim){\r
-                this.ui.animExpand(function(){\r
-                    this.fireEvent("expand", this);\r
-                    if(typeof callback == "function"){\r
-                        callback(this);\r
-                    }\r
-                    if(deep === true){\r
-                        this.expandChildNodes(true);\r
-                    }\r
-                }.createDelegate(this));\r
-                return;\r
-            }else{\r
-                this.ui.expand();\r
-                this.fireEvent("expand", this);\r
-                if(typeof callback == "function"){\r
-                    callback(this);\r
-                }\r
-            }\r
-        }else{\r
-           if(typeof callback == "function"){\r
-               callback(this);\r
-           }\r
-        }\r
-        if(deep === true){\r
-            this.expandChildNodes(true);\r
-        }\r
-    },\r
-\r
-    isHiddenRoot : function(){\r
-        return this.isRoot && !this.getOwnerTree().rootVisible;\r
-    },\r
-\r
-    \r
-    collapse : function(deep, anim){\r
-        if(this.expanded && !this.isHiddenRoot()){\r
-            if(this.fireEvent("beforecollapse", this, deep, anim) === false){\r
-                return;\r
-            }\r
-            this.expanded = false;\r
-            if((this.getOwnerTree().animate && anim !== false) || anim){\r
-                this.ui.animCollapse(function(){\r
-                    this.fireEvent("collapse", this);\r
-                    if(deep === true){\r
-                        this.collapseChildNodes(true);\r
-                    }\r
-                }.createDelegate(this));\r
-                return;\r
-            }else{\r
-                this.ui.collapse();\r
-                this.fireEvent("collapse", this);\r
-            }\r
-        }\r
-        if(deep === true){\r
-            var cs = this.childNodes;\r
-            for(var i = 0, len = cs.length; i < len; i++) {\r
-               cs[i].collapse(true, false);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    delayedExpand : function(delay){\r
-        if(!this.expandProcId){\r
-            this.expandProcId = this.expand.defer(delay, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    cancelExpand : function(){\r
-        if(this.expandProcId){\r
-            clearTimeout(this.expandProcId);\r
-        }\r
-        this.expandProcId = false;\r
-    },\r
-\r
-    \r
-    toggle : function(){\r
-        if(this.expanded){\r
-            this.collapse();\r
-        }else{\r
-            this.expand();\r
-        }\r
-    },\r
-\r
-    \r
-    ensureVisible : function(callback){\r
-        var tree = this.getOwnerTree();\r
-        tree.expandPath(this.parentNode ? this.parentNode.getPath() : this.getPath(), false, function(){\r
-            var node = tree.getNodeById(this.id);  // Somehow if we don't do this, we lose changes that happened to node in the meantime\r
-            tree.getTreeEl().scrollChildIntoView(node.ui.anchor);\r
-            Ext.callback(callback);\r
-        }.createDelegate(this));\r
-    },\r
-\r
-    \r
-    expandChildNodes : function(deep){\r
-        var cs = this.childNodes;\r
-        for(var i = 0, len = cs.length; i < len; i++) {\r
-               cs[i].expand(deep);\r
-        }\r
-    },\r
-\r
-    \r
-    collapseChildNodes : function(deep){\r
-        var cs = this.childNodes;\r
-        for(var i = 0, len = cs.length; i < len; i++) {\r
-               cs[i].collapse(deep);\r
-        }\r
-    },\r
-\r
-    \r
-    disable : function(){\r
-        this.disabled = true;\r
-        this.unselect();\r
-        if(this.rendered && this.ui.onDisableChange){ // event without subscribing\r
-            this.ui.onDisableChange(this, true);\r
-        }\r
-        this.fireEvent("disabledchange", this, true);\r
-    },\r
-\r
-    \r
-    enable : function(){\r
-        this.disabled = false;\r
-        if(this.rendered && this.ui.onDisableChange){ // event without subscribing\r
-            this.ui.onDisableChange(this, false);\r
-        }\r
-        this.fireEvent("disabledchange", this, false);\r
-    },\r
-\r
-    // private\r
-    renderChildren : function(suppressEvent){\r
-        if(suppressEvent !== false){\r
-            this.fireEvent("beforechildrenrendered", this);\r
-        }\r
-        var cs = this.childNodes;\r
-        for(var i = 0, len = cs.length; i < len; i++){\r
-            cs[i].render(true);\r
-        }\r
-        this.childrenRendered = true;\r
-    },\r
-\r
-    // private\r
-    sort : function(fn, scope){\r
-        Ext.tree.TreeNode.superclass.sort.apply(this, arguments);\r
-        if(this.childrenRendered){\r
-            var cs = this.childNodes;\r
-            for(var i = 0, len = cs.length; i < len; i++){\r
-                cs[i].render(true);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    render : function(bulkRender){\r
-        this.ui.render(bulkRender);\r
-        if(!this.rendered){\r
-            // make sure it is registered\r
-            this.getOwnerTree().registerNode(this);\r
-            this.rendered = true;\r
-            if(this.expanded){\r
-                this.expanded = false;\r
-                this.expand(false, false);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    renderIndent : function(deep, refresh){\r
-        if(refresh){\r
-            this.ui.childIndent = null;\r
-        }\r
-        this.ui.renderIndent();\r
-        if(deep === true && this.childrenRendered){\r
-            var cs = this.childNodes;\r
-            for(var i = 0, len = cs.length; i < len; i++){\r
-                cs[i].renderIndent(true, refresh);\r
-            }\r
-        }\r
-    },\r
-\r
-    beginUpdate : function(){\r
-        this.childrenRendered = false;\r
-    },\r
-\r
-    endUpdate : function(){\r
-        if(this.expanded && this.rendered){\r
-            this.renderChildren();\r
-        }\r
-    },\r
-\r
-    destroy : function(){\r
-        if(this.childNodes){\r
-               for(var i = 0,l = this.childNodes.length; i < l; i++){\r
-                   this.childNodes[i].destroy();\r
-               }\r
-            this.childNodes = null;\r
-        }\r
-        if(this.ui.destroy){\r
-            this.ui.destroy();\r
-        }\r
-    }\r
-});\r
-\r
-Ext.tree.TreePanel.nodeTypes.node = Ext.tree.TreeNode;\r
-\r
- Ext.tree.AsyncTreeNode = function(config){\r
-    this.loaded = config && config.loaded === true;\r
-    this.loading = false;\r
-    Ext.tree.AsyncTreeNode.superclass.constructor.apply(this, arguments);\r
-    \r
-    this.addEvents('beforeload', 'load');\r
-    \r
-    \r
-};\r
-Ext.extend(Ext.tree.AsyncTreeNode, Ext.tree.TreeNode, {\r
-    expand : function(deep, anim, callback){\r
-        if(this.loading){ // if an async load is already running, waiting til it's done\r
-            var timer;\r
-            var f = function(){\r
-                if(!this.loading){ // done loading\r
-                    clearInterval(timer);\r
-                    this.expand(deep, anim, callback);\r
-                }\r
-            }.createDelegate(this);\r
-            timer = setInterval(f, 200);\r
-            return;\r
-        }\r
-        if(!this.loaded){\r
-            if(this.fireEvent("beforeload", this) === false){\r
-                return;\r
-            }\r
-            this.loading = true;\r
-            this.ui.beforeLoad(this);\r
-            var loader = this.loader || this.attributes.loader || this.getOwnerTree().getLoader();\r
-            if(loader){\r
-                loader.load(this, this.loadComplete.createDelegate(this, [deep, anim, callback]));\r
-                return;\r
-            }\r
-        }\r
-        Ext.tree.AsyncTreeNode.superclass.expand.call(this, deep, anim, callback);\r
-    },\r
-    \r
-    \r
-    isLoading : function(){\r
-        return this.loading;  \r
-    },\r
-    \r
-    loadComplete : function(deep, anim, callback){\r
-        this.loading = false;\r
-        this.loaded = true;\r
-        this.ui.afterLoad(this);\r
-        this.fireEvent("load", this);\r
-        this.expand(deep, anim, callback);\r
-    },\r
-    \r
-    \r
-    isLoaded : function(){\r
-        return this.loaded;\r
-    },\r
-    \r
-    hasChildNodes : function(){\r
-        if(!this.isLeaf() && !this.loaded){\r
-            return true;\r
-        }else{\r
-            return Ext.tree.AsyncTreeNode.superclass.hasChildNodes.call(this);\r
-        }\r
-    },\r
-\r
-    \r
-    reload : function(callback){\r
-        this.collapse(false, false);\r
-        while(this.firstChild){\r
-            this.removeChild(this.firstChild).destroy();\r
-        }\r
-        this.childrenRendered = false;\r
-        this.loaded = false;\r
-        if(this.isHiddenRoot()){\r
-            this.expanded = false;\r
-        }\r
-        this.expand(false, false, callback);\r
-    }\r
-});\r
-\r
-Ext.tree.TreePanel.nodeTypes.async = Ext.tree.AsyncTreeNode;\r
-\r
-Ext.tree.TreeNodeUI = function(node){\r
-    this.node = node;\r
-    this.rendered = false;\r
-    this.animating = false;\r
-    this.wasLeaf = true;\r
-    this.ecc = 'x-tree-ec-icon x-tree-elbow';\r
-    this.emptyIcon = Ext.BLANK_IMAGE_URL;\r
-};\r
-\r
-Ext.tree.TreeNodeUI.prototype = {\r
-    // private\r
-    removeChild : function(node){\r
-        if(this.rendered){\r
-            this.ctNode.removeChild(node.ui.getEl());\r
-        } \r
-    },\r
-\r
-    // private\r
-    beforeLoad : function(){\r
-         this.addClass("x-tree-node-loading");\r
-    },\r
-\r
-    // private\r
-    afterLoad : function(){\r
-         this.removeClass("x-tree-node-loading");\r
-    },\r
-\r
-    // private\r
-    onTextChange : function(node, text, oldText){\r
-        if(this.rendered){\r
-            this.textNode.innerHTML = text;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDisableChange : function(node, state){\r
-        this.disabled = state;\r
-               if (this.checkbox) {\r
-                       this.checkbox.disabled = state;\r
-               }        \r
-        if(state){\r
-            this.addClass("x-tree-node-disabled");\r
-        }else{\r
-            this.removeClass("x-tree-node-disabled");\r
-        } \r
-    },\r
-\r
-    // private\r
-    onSelectedChange : function(state){\r
-        if(state){\r
-            this.focus();\r
-            this.addClass("x-tree-selected");\r
-        }else{\r
-            //this.blur();\r
-            this.removeClass("x-tree-selected");\r
-        }\r
-    },\r
-\r
-    // private\r
-    onMove : function(tree, node, oldParent, newParent, index, refNode){\r
-        this.childIndent = null;\r
-        if(this.rendered){\r
-            var targetNode = newParent.ui.getContainer();\r
-            if(!targetNode){//target not rendered\r
-                this.holder = document.createElement("div");\r
-                this.holder.appendChild(this.wrap);\r
-                return;\r
-            }\r
-            var insertBefore = refNode ? refNode.ui.getEl() : null;\r
-            if(insertBefore){\r
-                targetNode.insertBefore(this.wrap, insertBefore);\r
-            }else{\r
-                targetNode.appendChild(this.wrap);\r
-            }\r
-            this.node.renderIndent(true);\r
-        }\r
-    },\r
-\r
-\r
-    addClass : function(cls){\r
-        if(this.elNode){\r
-            Ext.fly(this.elNode).addClass(cls);\r
-        }\r
-    },\r
-\r
-\r
-    removeClass : function(cls){\r
-        if(this.elNode){\r
-            Ext.fly(this.elNode).removeClass(cls);  \r
-        }\r
-    },\r
-\r
-    // private\r
-    remove : function(){\r
-        if(this.rendered){\r
-            this.holder = document.createElement("div");\r
-            this.holder.appendChild(this.wrap);\r
-        }  \r
-    },\r
-\r
-    // private\r
-    fireEvent : function(){\r
-        return this.node.fireEvent.apply(this.node, arguments);  \r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        this.node.on("move", this.onMove, this);\r
-\r
-        if(this.node.disabled){\r
-            this.addClass("x-tree-node-disabled");\r
-                       if (this.checkbox) {\r
-                               this.checkbox.disabled = true;\r
-                       }            \r
-        }\r
-        if(this.node.hidden){\r
-            this.hide();\r
-        }\r
-        var ot = this.node.getOwnerTree();\r
-        var dd = ot.enableDD || ot.enableDrag || ot.enableDrop;\r
-        if(dd && (!this.node.isRoot || ot.rootVisible)){\r
-            Ext.dd.Registry.register(this.elNode, {\r
-                node: this.node,\r
-                handles: this.getDDHandles(),\r
-                isHandle: false\r
-            });\r
-        }\r
-    },\r
-\r
-    // private\r
-    getDDHandles : function(){\r
-        return [this.iconNode, this.textNode, this.elNode];\r
-    },\r
-\r
-\r
-    hide : function(){\r
-        this.node.hidden = true;\r
-        if(this.wrap){\r
-            this.wrap.style.display = "none";\r
-        }\r
-    },\r
-\r
-\r
-    show : function(){\r
-        this.node.hidden = false;\r
-        if(this.wrap){\r
-            this.wrap.style.display = "";\r
-        } \r
-    },\r
-\r
-    // private\r
-    onContextMenu : function(e){\r
-        if (this.node.hasListener("contextmenu") || this.node.getOwnerTree().hasListener("contextmenu")) {\r
-            e.preventDefault();\r
-            this.focus();\r
-            this.fireEvent("contextmenu", this.node, e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        if(this.dropping){\r
-            e.stopEvent();\r
-            return;\r
-        }\r
-        if(this.fireEvent("beforeclick", this.node, e) !== false){\r
-            var a = e.getTarget('a');\r
-            if(!this.disabled && this.node.attributes.href && a){\r
-                this.fireEvent("click", this.node, e);\r
-                return;\r
-            }else if(a && e.ctrlKey){\r
-                e.stopEvent();\r
-            }\r
-            e.preventDefault();\r
-            if(this.disabled){\r
-                return;\r
-            }\r
-\r
-            if(this.node.attributes.singleClickExpand && !this.animating && this.node.isExpandable()){\r
-                this.node.toggle();\r
-            }\r
-\r
-            this.fireEvent("click", this.node, e);\r
-        }else{\r
-            e.stopEvent();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDblClick : function(e){\r
-        e.preventDefault();\r
-        if(this.disabled){\r
-            return;\r
-        }\r
-        if(this.checkbox){\r
-            this.toggleCheck();\r
-        }\r
-        if(!this.animating && this.node.isExpandable()){\r
-            this.node.toggle();\r
-        }\r
-        this.fireEvent("dblclick", this.node, e);\r
-    },\r
-\r
-    onOver : function(e){\r
-        this.addClass('x-tree-node-over');\r
-    },\r
-\r
-    onOut : function(e){\r
-        this.removeClass('x-tree-node-over');\r
-    },\r
-\r
-    // private\r
-    onCheckChange : function(){\r
-        var checked = this.checkbox.checked;\r
-               // fix for IE6\r
-               this.checkbox.defaultChecked = checked;\r
-        this.node.attributes.checked = checked;\r
-        this.fireEvent('checkchange', this.node, checked);\r
-    },\r
-\r
-    // private\r
-    ecClick : function(e){\r
-        if(!this.animating && this.node.isExpandable()){\r
-            this.node.toggle();\r
-        }\r
-    },\r
-\r
-    // private\r
-    startDrop : function(){\r
-        this.dropping = true;\r
-    },\r
-    \r
-    // delayed drop so the click event doesn't get fired on a drop\r
-    endDrop : function(){ \r
-       setTimeout(function(){\r
-           this.dropping = false;\r
-       }.createDelegate(this), 50); \r
-    },\r
-\r
-    // private\r
-    expand : function(){\r
-        this.updateExpandIcon();\r
-        this.ctNode.style.display = "";\r
-    },\r
-\r
-    // private\r
-    focus : function(){\r
-        if(!this.node.preventHScroll){\r
-            try{this.anchor.focus();\r
-            }catch(e){}\r
-        }else{\r
-            try{\r
-                var noscroll = this.node.getOwnerTree().getTreeEl().dom;\r
-                var l = noscroll.scrollLeft;\r
-                this.anchor.focus();\r
-                noscroll.scrollLeft = l;\r
-            }catch(e){}\r
-        }\r
-    },\r
-\r
-\r
-    toggleCheck : function(value){\r
-        var cb = this.checkbox;\r
-        if(cb){\r
-            cb.checked = (value === undefined ? !cb.checked : value);\r
-            this.onCheckChange();\r
-        }\r
-    },\r
-\r
-    // private\r
-    blur : function(){\r
-        try{\r
-            this.anchor.blur();\r
-        }catch(e){} \r
-    },\r
-\r
-    // private\r
-    animExpand : function(callback){\r
-        var ct = Ext.get(this.ctNode);\r
-        ct.stopFx();\r
-        if(!this.node.isExpandable()){\r
-            this.updateExpandIcon();\r
-            this.ctNode.style.display = "";\r
-            Ext.callback(callback);\r
-            return;\r
-        }\r
-        this.animating = true;\r
-        this.updateExpandIcon();\r
-        \r
-        ct.slideIn('t', {\r
-           callback : function(){\r
-               this.animating = false;\r
-               Ext.callback(callback);\r
-            },\r
-            scope: this,\r
-            duration: this.node.ownerTree.duration || .25\r
-        });\r
-    },\r
-\r
-    // private\r
-    highlight : function(){\r
-        var tree = this.node.getOwnerTree();\r
-        Ext.fly(this.wrap).highlight(\r
-            tree.hlColor || "C3DAF9",\r
-            {endColor: tree.hlBaseColor}\r
-        );\r
-    },\r
-\r
-    // private\r
-    collapse : function(){\r
-        this.updateExpandIcon();\r
-        this.ctNode.style.display = "none";\r
-    },\r
-\r
-    // private\r
-    animCollapse : function(callback){\r
-        var ct = Ext.get(this.ctNode);\r
-        ct.enableDisplayMode('block');\r
-        ct.stopFx();\r
-\r
-        this.animating = true;\r
-        this.updateExpandIcon();\r
-\r
-        ct.slideOut('t', {\r
-            callback : function(){\r
-               this.animating = false;\r
-               Ext.callback(callback);\r
-            },\r
-            scope: this,\r
-            duration: this.node.ownerTree.duration || .25\r
-        });\r
-    },\r
-\r
-    // private\r
-    getContainer : function(){\r
-        return this.ctNode;  \r
-    },\r
-\r
-    // private\r
-    getEl : function(){\r
-        return this.wrap;  \r
-    },\r
-\r
-    // private\r
-    appendDDGhost : function(ghostNode){\r
-        ghostNode.appendChild(this.elNode.cloneNode(true));\r
-    },\r
-\r
-    // private\r
-    getDDRepairXY : function(){\r
-        return Ext.lib.Dom.getXY(this.iconNode);\r
-    },\r
-\r
-    // private\r
-    onRender : function(){\r
-        this.render();    \r
-    },\r
-\r
-    // private\r
-    render : function(bulkRender){\r
-        var n = this.node, a = n.attributes;\r
-        var targetNode = n.parentNode ? \r
-              n.parentNode.ui.getContainer() : n.ownerTree.innerCt.dom;\r
-        \r
-        if(!this.rendered){\r
-            this.rendered = true;\r
-\r
-            this.renderElements(n, a, targetNode, bulkRender);\r
-\r
-            if(a.qtip){\r
-               if(this.textNode.setAttributeNS){\r
-                   this.textNode.setAttributeNS("ext", "qtip", a.qtip);\r
-                   if(a.qtipTitle){\r
-                       this.textNode.setAttributeNS("ext", "qtitle", a.qtipTitle);\r
-                   }\r
-               }else{\r
-                   this.textNode.setAttribute("ext:qtip", a.qtip);\r
-                   if(a.qtipTitle){\r
-                       this.textNode.setAttribute("ext:qtitle", a.qtipTitle);\r
-                   }\r
-               } \r
-            }else if(a.qtipCfg){\r
-                a.qtipCfg.target = Ext.id(this.textNode);\r
-                Ext.QuickTips.register(a.qtipCfg);\r
-            }\r
-            this.initEvents();\r
-            if(!this.node.expanded){\r
-                this.updateExpandIcon(true);\r
-            }\r
-        }else{\r
-            if(bulkRender === true) {\r
-                targetNode.appendChild(this.wrap);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    renderElements : function(n, a, targetNode, bulkRender){\r
-        // add some indent caching, this helps performance when rendering a large tree\r
-        this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';\r
-\r
-        var cb = typeof a.checked == 'boolean';\r
-\r
-        var href = a.href ? a.href : Ext.isGecko ? "" : "#";\r
-        var buf = ['<li class="x-tree-node"><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',\r
-            '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",\r
-            '<img src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',\r
-            '<img src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',\r
-            cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',\r
-            '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',\r
-             a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",\r
-            '<ul class="x-tree-node-ct" style="display:none;"></ul>',\r
-            "</li>"].join('');\r
-\r
-        var nel;\r
-        if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){\r
-            this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);\r
-        }else{\r
-            this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);\r
-        }\r
-        \r
-        this.elNode = this.wrap.childNodes[0];\r
-        this.ctNode = this.wrap.childNodes[1];\r
-        var cs = this.elNode.childNodes;\r
-        this.indentNode = cs[0];\r
-        this.ecNode = cs[1];\r
-        this.iconNode = cs[2];\r
-        var index = 3;\r
-        if(cb){\r
-            this.checkbox = cs[3];\r
-                       // fix for IE6\r
-                       this.checkbox.defaultChecked = this.checkbox.checked;                   \r
-            index++;\r
-        }\r
-        this.anchor = cs[index];\r
-        this.textNode = cs[index].firstChild;\r
-    },\r
-\r
-\r
-    getAnchor : function(){\r
-        return this.anchor;\r
-    },\r
-    \r
-\r
-    getTextEl : function(){\r
-        return this.textNode;\r
-    },\r
-    \r
-\r
-    getIconEl : function(){\r
-        return this.iconNode;\r
-    },\r
-\r
-\r
-    isChecked : function(){\r
-        return this.checkbox ? this.checkbox.checked : false; \r
-    },\r
-\r
-    // private\r
-    updateExpandIcon : function(){\r
-        if(this.rendered){\r
-            var n = this.node, c1, c2;\r
-            var cls = n.isLast() ? "x-tree-elbow-end" : "x-tree-elbow";\r
-            if(n.isExpandable()){\r
-                if(n.expanded){\r
-                    cls += "-minus";\r
-                    c1 = "x-tree-node-collapsed";\r
-                    c2 = "x-tree-node-expanded";\r
-                }else{\r
-                    cls += "-plus";\r
-                    c1 = "x-tree-node-expanded";\r
-                    c2 = "x-tree-node-collapsed";\r
-                }\r
-                if(this.wasLeaf){\r
-                    this.removeClass("x-tree-node-leaf");\r
-                    this.wasLeaf = false;\r
-                }\r
-                if(this.c1 != c1 || this.c2 != c2){\r
-                    Ext.fly(this.elNode).replaceClass(c1, c2);\r
-                    this.c1 = c1; this.c2 = c2;\r
-                }\r
-            }else{\r
-                if(!this.wasLeaf){\r
-                    Ext.fly(this.elNode).replaceClass("x-tree-node-expanded", "x-tree-node-leaf");\r
-                    delete this.c1;\r
-                    delete this.c2;\r
-                    this.wasLeaf = true;\r
-                }\r
-            }\r
-            var ecc = "x-tree-ec-icon "+cls;\r
-            if(this.ecc != ecc){\r
-                this.ecNode.className = ecc;\r
-                this.ecc = ecc;\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getChildIndent : function(){\r
-        if(!this.childIndent){\r
-            var buf = [];\r
-            var p = this.node;\r
-            while(p){\r
-                if(!p.isRoot || (p.isRoot && p.ownerTree.rootVisible)){\r
-                    if(!p.isLast()) {\r
-                        buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-elbow-line" />');\r
-                    } else {\r
-                        buf.unshift('<img src="'+this.emptyIcon+'" class="x-tree-icon" />');\r
-                    }\r
-                }\r
-                p = p.parentNode;\r
-            }\r
-            this.childIndent = buf.join("");\r
-        }\r
-        return this.childIndent;\r
-    },\r
-\r
-    // private\r
-    renderIndent : function(){\r
-        if(this.rendered){\r
-            var indent = "";\r
-            var p = this.node.parentNode;\r
-            if(p){\r
-                indent = p.ui.getChildIndent();\r
-            }\r
-            if(this.indentMarkup != indent){ // don't rerender if not required\r
-                this.indentNode.innerHTML = indent;\r
-                this.indentMarkup = indent;\r
-            }\r
-            this.updateExpandIcon();\r
-        }\r
-    },\r
-\r
-    destroy : function(){\r
-        if(this.elNode){\r
-            Ext.dd.Registry.unregister(this.elNode.id);\r
-        }\r
-        delete this.elNode;\r
-        delete this.ctNode;\r
-        delete this.indentNode;\r
-        delete this.ecNode;\r
-        delete this.iconNode;\r
-        delete this.checkbox;\r
-        delete this.anchor;\r
-        delete this.textNode;\r
-        \r
-        if (this.holder){\r
-             delete this.wrap;\r
-             Ext.removeNode(this.holder);\r
-             delete this.holder;\r
-        }else{\r
-            Ext.removeNode(this.wrap);\r
-            delete this.wrap;\r
-        }\r
-    }\r
-};\r
-\r
-\r
-Ext.tree.RootTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {\r
-    // private\r
-    render : function(){\r
-        if(!this.rendered){\r
-            var targetNode = this.node.ownerTree.innerCt.dom;\r
-            this.node.expanded = true;\r
-            targetNode.innerHTML = '<div class="x-tree-root-node"></div>';\r
-            this.wrap = this.ctNode = targetNode.firstChild;\r
-        }\r
-    },\r
-    collapse : Ext.emptyFn,\r
-    expand : Ext.emptyFn\r
-});\r
-\r
-Ext.tree.TreeLoader = function(config){\r
-    this.baseParams = {};\r
-    Ext.apply(this, config);\r
-\r
-    this.addEvents(\r
-        \r
-        "beforeload",\r
-        \r
-        "load",\r
-        \r
-        "loadexception"\r
-    );\r
-\r
-    Ext.tree.TreeLoader.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.tree.TreeLoader, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    uiProviders : {},\r
-\r
-    \r
-    clearOnLoad : true,\r
-\r
-    \r
-    load : function(node, callback){\r
-        if(this.clearOnLoad){\r
-            while(node.firstChild){\r
-                node.removeChild(node.firstChild);\r
-            }\r
-        }\r
-        if(this.doPreload(node)){ // preloaded json children\r
-            if(typeof callback == "function"){\r
-                callback();\r
-            }\r
-        }else if(this.dataUrl||this.url){\r
-            this.requestData(node, callback);\r
-        }\r
-    },\r
-\r
-    doPreload : function(node){\r
-        if(node.attributes.children){\r
-            if(node.childNodes.length < 1){ // preloaded?\r
-                var cs = node.attributes.children;\r
-                node.beginUpdate();\r
-                for(var i = 0, len = cs.length; i < len; i++){\r
-                    var cn = node.appendChild(this.createNode(cs[i]));\r
-                    if(this.preloadChildren){\r
-                        this.doPreload(cn);\r
-                    }\r
-                }\r
-                node.endUpdate();\r
-            }\r
-            return true;\r
-        }else {\r
-            return false;\r
-        }\r
-    },\r
-\r
-    getParams: function(node){\r
-        var buf = [], bp = this.baseParams;\r
-        for(var key in bp){\r
-            if(typeof bp[key] != "function"){\r
-                buf.push(encodeURIComponent(key), "=", encodeURIComponent(bp[key]), "&");\r
-            }\r
-        }\r
-        buf.push("node=", encodeURIComponent(node.id));\r
-        return buf.join("");\r
-    },\r
-\r
-    requestData : function(node, callback){\r
-        if(this.fireEvent("beforeload", this, node, callback) !== false){\r
-            this.transId = Ext.Ajax.request({\r
-                method:this.requestMethod,\r
-                url: this.dataUrl||this.url,\r
-                success: this.handleResponse,\r
-                failure: this.handleFailure,\r
-                scope: this,\r
-                argument: {callback: callback, node: node},\r
-                params: this.getParams(node)\r
-            });\r
-        }else{\r
-            // if the load is cancelled, make sure we notify\r
-            // the node that we are done\r
-            if(typeof callback == "function"){\r
-                callback();\r
-            }\r
-        }\r
-    },\r
-\r
-    isLoading : function(){\r
-        return !!this.transId;\r
-    },\r
-\r
-    abort : function(){\r
-        if(this.isLoading()){\r
-            Ext.Ajax.abort(this.transId);\r
-        }\r
-    },\r
-\r
-    \r
-    createNode : function(attr){\r
-        // apply baseAttrs, nice idea Corey!\r
-        if(this.baseAttrs){\r
-            Ext.applyIf(attr, this.baseAttrs);\r
-        }\r
-        if(this.applyLoader !== false){\r
-            attr.loader = this;\r
-        }\r
-        if(typeof attr.uiProvider == 'string'){\r
-           attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);\r
-        }\r
-        if(attr.nodeType){\r
-            return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);\r
-        }else{\r
-            return attr.leaf ?\r
-                        new Ext.tree.TreeNode(attr) :\r
-                        new Ext.tree.AsyncTreeNode(attr);\r
-        }\r
-    },\r
-\r
-    processResponse : function(response, node, callback){\r
-        var json = response.responseText;\r
-        try {\r
-            var o = eval("("+json+")");\r
-            node.beginUpdate();\r
-            for(var i = 0, len = o.length; i < len; i++){\r
-                var n = this.createNode(o[i]);\r
-                if(n){\r
-                    node.appendChild(n);\r
-                }\r
-            }\r
-            node.endUpdate();\r
-            if(typeof callback == "function"){\r
-                callback(this, node);\r
-            }\r
-        }catch(e){\r
-            this.handleFailure(response);\r
-        }\r
-    },\r
-\r
-    handleResponse : function(response){\r
-        this.transId = false;\r
-        var a = response.argument;\r
-        this.processResponse(response, a.node, a.callback);\r
-        this.fireEvent("load", this, a.node, response);\r
-    },\r
-\r
-    handleFailure : function(response){\r
-        this.transId = false;\r
-        var a = response.argument;\r
-        this.fireEvent("loadexception", this, a.node, response);\r
-        if(typeof a.callback == "function"){\r
-            a.callback(this, a.node);\r
-        }\r
-    }\r
-});\r
-\r
-Ext.tree.TreeFilter = function(tree, config){\r
-    this.tree = tree;\r
-    this.filtered = {};\r
-    Ext.apply(this, config);\r
-};\r
-\r
-Ext.tree.TreeFilter.prototype = {\r
-    clearBlank:false,\r
-    reverse:false,\r
-    autoClear:false,\r
-    remove:false,\r
-\r
-     \r
-    filter : function(value, attr, startNode){\r
-        attr = attr || "text";\r
-        var f;\r
-        if(typeof value == "string"){\r
-            var vlen = value.length;\r
-            // auto clear empty filter\r
-            if(vlen == 0 && this.clearBlank){\r
-                this.clear();\r
-                return;\r
-            }\r
-            value = value.toLowerCase();\r
-            f = function(n){\r
-                return n.attributes[attr].substr(0, vlen).toLowerCase() == value;\r
-            };\r
-        }else if(value.exec){ // regex?\r
-            f = function(n){\r
-                return value.test(n.attributes[attr]);\r
-            };\r
-        }else{\r
-            throw 'Illegal filter type, must be string or regex';\r
-        }\r
-        this.filterBy(f, null, startNode);\r
-       },\r
-    \r
-    \r
-    filterBy : function(fn, scope, startNode){\r
-        startNode = startNode || this.tree.root;\r
-        if(this.autoClear){\r
-            this.clear();\r
-        }\r
-        var af = this.filtered, rv = this.reverse;\r
-        var f = function(n){\r
-            if(n == startNode){\r
-                return true;\r
-            }\r
-            if(af[n.id]){\r
-                return false;\r
-            }\r
-            var m = fn.call(scope || n, n);\r
-            if(!m || rv){\r
-                af[n.id] = n;\r
-                n.ui.hide();\r
-                return false;\r
-            }\r
-            return true;\r
-        };\r
-        startNode.cascade(f);\r
-        if(this.remove){\r
-           for(var id in af){\r
-               if(typeof id != "function"){\r
-                   var n = af[id];\r
-                   if(n && n.parentNode){\r
-                       n.parentNode.removeChild(n);\r
-                   }\r
-               }\r
-           } \r
-        }\r
-    },\r
-    \r
-    \r
-    clear : function(){\r
-        var t = this.tree;\r
-        var af = this.filtered;\r
-        for(var id in af){\r
-            if(typeof id != "function"){\r
-                var n = af[id];\r
-                if(n){\r
-                    n.ui.show();\r
-                }\r
-            }\r
-        }\r
-        this.filtered = {}; \r
-    }\r
-};\r
-\r
-\r
-Ext.tree.TreeSorter = function(tree, config){\r
-    \r
-       \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    Ext.apply(this, config);\r
-    tree.on("beforechildrenrendered", this.doSort, this);\r
-    tree.on("append", this.updateSort, this);\r
-    tree.on("insert", this.updateSort, this);\r
-    tree.on("textchange", this.updateSortParent, this);\r
-    \r
-    var dsc = this.dir && this.dir.toLowerCase() == "desc";\r
-    var p = this.property || "text";\r
-    var sortType = this.sortType;\r
-    var fs = this.folderSort;\r
-    var cs = this.caseSensitive === true;\r
-    var leafAttr = this.leafAttr || 'leaf';\r
-\r
-    this.sortFn = function(n1, n2){\r
-        if(fs){\r
-            if(n1.attributes[leafAttr] && !n2.attributes[leafAttr]){\r
-                return 1;\r
-            }\r
-            if(!n1.attributes[leafAttr] && n2.attributes[leafAttr]){\r
-                return -1;\r
-            }\r
-        }\r
-       var v1 = sortType ? sortType(n1) : (cs ? n1.attributes[p] : n1.attributes[p].toUpperCase());\r
-       var v2 = sortType ? sortType(n2) : (cs ? n2.attributes[p] : n2.attributes[p].toUpperCase());\r
-       if(v1 < v2){\r
-                       return dsc ? +1 : -1;\r
-               }else if(v1 > v2){\r
-                       return dsc ? -1 : +1;\r
-        }else{\r
-               return 0;\r
-        }\r
-    };\r
-};\r
-\r
-Ext.tree.TreeSorter.prototype = {\r
-    doSort : function(node){\r
-        node.sort(this.sortFn);\r
-    },\r
-    \r
-    compareNodes : function(n1, n2){\r
-        return (n1.text.toUpperCase() > n2.text.toUpperCase() ? 1 : -1);\r
-    },\r
-    \r
-    updateSort : function(tree, node){\r
-        if(node.childrenRendered){\r
-            this.doSort.defer(1, this, [node]);\r
-        }\r
-    },\r
-    \r
-    updateSortParent : function(node){\r
-               var p = node.parentNode;\r
-               if(p && p.childrenRendered){\r
-            this.doSort.defer(1, this, [p]);\r
-        }\r
-    }\r
-};\r
-\r
-if(Ext.dd.DropZone){\r
-    \r
-Ext.tree.TreeDropZone = function(tree, config){\r
-    \r
-    this.allowParentInsert = false;\r
-    \r
-    this.allowContainerDrop = false;\r
-    \r
-    this.appendOnly = false;\r
-    Ext.tree.TreeDropZone.superclass.constructor.call(this, tree.innerCt, config);\r
-    \r
-    this.tree = tree;\r
-    \r
-    this.dragOverData = {};\r
-    // private\r
-    this.lastInsertClass = "x-tree-no-status";\r
-};\r
-\r
-Ext.extend(Ext.tree.TreeDropZone, Ext.dd.DropZone, {\r
-    \r
-    ddGroup : "TreeDD",\r
-\r
-    \r
-    expandDelay : 1000,\r
-\r
-    // private\r
-    expandNode : function(node){\r
-        if(node.hasChildNodes() && !node.isExpanded()){\r
-            node.expand(false, null, this.triggerCacheRefresh.createDelegate(this));\r
-        }\r
-    },\r
-\r
-    // private\r
-    queueExpand : function(node){\r
-        this.expandProcId = this.expandNode.defer(this.expandDelay, this, [node]);\r
-    },\r
-\r
-    // private\r
-    cancelExpand : function(){\r
-        if(this.expandProcId){\r
-            clearTimeout(this.expandProcId);\r
-            this.expandProcId = false;\r
-        }\r
-    },\r
-\r
-    // private\r
-    isValidDropPoint : function(n, pt, dd, e, data){\r
-        if(!n || !data){ return false; }\r
-        var targetNode = n.node;\r
-        var dropNode = data.node;\r
-        // default drop rules\r
-        if(!(targetNode && targetNode.isTarget && pt)){\r
-            return false;\r
-        }\r
-        if(pt == "append" && targetNode.allowChildren === false){\r
-            return false;\r
-        }\r
-        if((pt == "above" || pt == "below") && (targetNode.parentNode && targetNode.parentNode.allowChildren === false)){\r
-            return false;\r
-        }\r
-        if(dropNode && (targetNode == dropNode || dropNode.contains(targetNode))){\r
-            return false;\r
-        }\r
-        // reuse the object\r
-        var overEvent = this.dragOverData;\r
-        overEvent.tree = this.tree;\r
-        overEvent.target = targetNode;\r
-        overEvent.data = data;\r
-        overEvent.point = pt;\r
-        overEvent.source = dd;\r
-        overEvent.rawEvent = e;\r
-        overEvent.dropNode = dropNode;\r
-        overEvent.cancel = false;  \r
-        var result = this.tree.fireEvent("nodedragover", overEvent);\r
-        return overEvent.cancel === false && result !== false;\r
-    },\r
-\r
-    // private\r
-    getDropPoint : function(e, n, dd){\r
-        var tn = n.node;\r
-        if(tn.isRoot){\r
-            return tn.allowChildren !== false ? "append" : false; // always append for root\r
-        }\r
-        var dragEl = n.ddel;\r
-        var t = Ext.lib.Dom.getY(dragEl), b = t + dragEl.offsetHeight;\r
-        var y = Ext.lib.Event.getPageY(e);\r
-        var noAppend = tn.allowChildren === false || tn.isLeaf();\r
-        if(this.appendOnly || tn.parentNode.allowChildren === false){\r
-            return noAppend ? false : "append";\r
-        }\r
-        var noBelow = false;\r
-        if(!this.allowParentInsert){\r
-            noBelow = tn.hasChildNodes() && tn.isExpanded();\r
-        }\r
-        var q = (b - t) / (noAppend ? 2 : 3);\r
-        if(y >= t && y < (t + q)){\r
-            return "above";\r
-        }else if(!noBelow && (noAppend || y >= b-q && y <= b)){\r
-            return "below";\r
-        }else{\r
-            return "append";\r
-        }\r
-    },\r
-\r
-    // private\r
-    onNodeEnter : function(n, dd, e, data){\r
-        this.cancelExpand();\r
-    },\r
-\r
-    // private\r
-    onNodeOver : function(n, dd, e, data){\r
-        var pt = this.getDropPoint(e, n, dd);\r
-        var node = n.node;\r
-        \r
-        // auto node expand check\r
-        if(!this.expandProcId && pt == "append" && node.hasChildNodes() && !n.node.isExpanded()){\r
-            this.queueExpand(node);\r
-        }else if(pt != "append"){\r
-            this.cancelExpand();\r
-        }\r
-        \r
-        // set the insert point style on the target node\r
-        var returnCls = this.dropNotAllowed;\r
-        if(this.isValidDropPoint(n, pt, dd, e, data)){\r
-           if(pt){\r
-               var el = n.ddel;\r
-               var cls;\r
-               if(pt == "above"){\r
-                   returnCls = n.node.isFirst() ? "x-tree-drop-ok-above" : "x-tree-drop-ok-between";\r
-                   cls = "x-tree-drag-insert-above";\r
-               }else if(pt == "below"){\r
-                   returnCls = n.node.isLast() ? "x-tree-drop-ok-below" : "x-tree-drop-ok-between";\r
-                   cls = "x-tree-drag-insert-below";\r
-               }else{\r
-                   returnCls = "x-tree-drop-ok-append";\r
-                   cls = "x-tree-drag-append";\r
-               }\r
-               if(this.lastInsertClass != cls){\r
-                   Ext.fly(el).replaceClass(this.lastInsertClass, cls);\r
-                   this.lastInsertClass = cls;\r
-               }\r
-           }\r
-       }\r
-       return returnCls;\r
-    },\r
-\r
-    // private\r
-    onNodeOut : function(n, dd, e, data){\r
-        this.cancelExpand();\r
-        this.removeDropIndicators(n);\r
-    },\r
-\r
-    // private\r
-    onNodeDrop : function(n, dd, e, data){\r
-        var point = this.getDropPoint(e, n, dd);\r
-        var targetNode = n.node;\r
-        targetNode.ui.startDrop();\r
-        if(!this.isValidDropPoint(n, point, dd, e, data)){\r
-            targetNode.ui.endDrop();\r
-            return false;\r
-        }\r
-        // first try to find the drop node\r
-        var dropNode = data.node || (dd.getTreeNode ? dd.getTreeNode(data, targetNode, point, e) : null);\r
-        var dropEvent = {\r
-            tree : this.tree,\r
-            target: targetNode,\r
-            data: data,\r
-            point: point,\r
-            source: dd,\r
-            rawEvent: e,\r
-            dropNode: dropNode,\r
-            cancel: !dropNode,\r
-            dropStatus: false\r
-        };\r
-        var retval = this.tree.fireEvent("beforenodedrop", dropEvent);\r
-        if(retval === false || dropEvent.cancel === true || !dropEvent.dropNode){\r
-            targetNode.ui.endDrop();\r
-            return dropEvent.dropStatus;\r
-        }\r
-        // allow target changing\r
-        targetNode = dropEvent.target;\r
-        if(point == "append" && !targetNode.isExpanded()){\r
-            targetNode.expand(false, null, function(){\r
-                this.completeDrop(dropEvent);\r
-            }.createDelegate(this));\r
-        }else{\r
-            this.completeDrop(dropEvent);\r
-        }\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    completeDrop : function(de){\r
-        var ns = de.dropNode, p = de.point, t = de.target;\r
-        if(!Ext.isArray(ns)){\r
-            ns = [ns];\r
-        }\r
-        var n;\r
-        for(var i = 0, len = ns.length; i < len; i++){\r
-            n = ns[i];\r
-            if(p == "above"){\r
-                t.parentNode.insertBefore(n, t);\r
-            }else if(p == "below"){\r
-                t.parentNode.insertBefore(n, t.nextSibling);\r
-            }else{\r
-                t.appendChild(n);\r
-            }\r
-        }\r
-        n.ui.focus();\r
-        if(Ext.enableFx && this.tree.hlDrop){\r
-            n.ui.highlight();\r
-        }\r
-        t.ui.endDrop();\r
-        this.tree.fireEvent("nodedrop", de);\r
-    },\r
-\r
-    // private\r
-    afterNodeMoved : function(dd, data, e, targetNode, dropNode){\r
-        if(Ext.enableFx && this.tree.hlDrop){\r
-            dropNode.ui.focus();\r
-            dropNode.ui.highlight();\r
-        }\r
-        this.tree.fireEvent("nodedrop", this.tree, targetNode, data, dd, e);\r
-    },\r
-\r
-    // private\r
-    getTree : function(){\r
-        return this.tree;\r
-    },\r
-\r
-    // private\r
-    removeDropIndicators : function(n){\r
-        if(n && n.ddel){\r
-            var el = n.ddel;\r
-            Ext.fly(el).removeClass([\r
-                    "x-tree-drag-insert-above",\r
-                    "x-tree-drag-insert-below",\r
-                    "x-tree-drag-append"]);\r
-            this.lastInsertClass = "_noclass";\r
-        }\r
-    },\r
-\r
-    // private\r
-    beforeDragDrop : function(target, e, id){\r
-        this.cancelExpand();\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    afterRepair : function(data){\r
-        if(data && Ext.enableFx){\r
-            data.node.ui.highlight();\r
-        }\r
-        this.hideProxy();\r
-    }    \r
-});\r
-\r
-}\r
-\r
-if(Ext.dd.DragZone){\r
-Ext.tree.TreeDragZone = function(tree, config){\r
-    Ext.tree.TreeDragZone.superclass.constructor.call(this, tree.getTreeEl(), config);\r
-    \r
-    this.tree = tree;\r
-};\r
-\r
-Ext.extend(Ext.tree.TreeDragZone, Ext.dd.DragZone, {\r
-    \r
-    ddGroup : "TreeDD",\r
-\r
-    // private\r
-    onBeforeDrag : function(data, e){\r
-        var n = data.node;\r
-        return n && n.draggable && !n.disabled;\r
-    },\r
-\r
-    // private\r
-    onInitDrag : function(e){\r
-        var data = this.dragData;\r
-        this.tree.getSelectionModel().select(data.node);\r
-        this.tree.eventModel.disable();\r
-        this.proxy.update("");\r
-        data.node.ui.appendDDGhost(this.proxy.ghost.dom);\r
-        this.tree.fireEvent("startdrag", this.tree, data.node, e);\r
-    },\r
-\r
-    // private\r
-    getRepairXY : function(e, data){\r
-        return data.node.ui.getDDRepairXY();\r
-    },\r
-\r
-    // private\r
-    onEndDrag : function(data, e){\r
-        this.tree.eventModel.enable.defer(100, this.tree.eventModel);\r
-        this.tree.fireEvent("enddrag", this.tree, data.node, e);\r
-    },\r
-\r
-    // private\r
-    onValidDrop : function(dd, e, id){\r
-        this.tree.fireEvent("dragdrop", this.tree, this.dragData.node, dd, e);\r
-        this.hideProxy();\r
-    },\r
-\r
-    // private\r
-    beforeInvalidDrop : function(e, id){\r
-        // this scrolls the original position back into view\r
-        var sm = this.tree.getSelectionModel();\r
-        sm.clearSelections();\r
-        sm.select(this.dragData.node);\r
-    },\r
-    \r
-    // private\r
-    afterRepair : function(){\r
-        if (Ext.enableFx && this.tree.hlDrop) {\r
-            Ext.Element.fly(this.dragData.ddel).highlight(this.hlColor || "c3daf9");\r
-        }\r
-        this.dragging = false;\r
-    }\r
-});\r
-}\r
-\r
-Ext.tree.TreeEditor = function(tree, fc, config){\r
-    fc = fc || {};\r
-    var field = fc.events ? fc : new Ext.form.TextField(fc);\r
-    Ext.tree.TreeEditor.superclass.constructor.call(this, field, config);\r
-\r
-    this.tree = tree;\r
-\r
-    if(!tree.rendered){\r
-        tree.on('render', this.initEditor, this);\r
-    }else{\r
-        this.initEditor(tree);\r
-    }\r
-};\r
-\r
-Ext.extend(Ext.tree.TreeEditor, Ext.Editor, {\r
-    \r
-    alignment: "l-l",\r
-    // inherit\r
-    autoSize: false,\r
-    \r
-    hideEl : false,\r
-    \r
-    cls: "x-small-editor x-tree-editor",\r
-    \r
-    shim:false,\r
-    // inherit\r
-    shadow:"frame",\r
-    \r
-    maxWidth: 250,\r
-    \r
-    editDelay : 350,\r
-\r
-    initEditor : function(tree){\r
-        tree.on('beforeclick', this.beforeNodeClick, this);\r
-        tree.on('dblclick', this.onNodeDblClick, this);\r
-        this.on('complete', this.updateNode, this);\r
-        this.on('beforestartedit', this.fitToTree, this);\r
-        this.on('startedit', this.bindScroll, this, {delay:10});\r
-        this.on('specialkey', this.onSpecialKey, this);\r
-    },\r
-\r
-    // private\r
-    fitToTree : function(ed, el){\r
-        var td = this.tree.getTreeEl().dom, nd = el.dom;\r
-        if(td.scrollLeft >  nd.offsetLeft){ // ensure the node left point is visible\r
-            td.scrollLeft = nd.offsetLeft;\r
-        }\r
-        var w = Math.min(\r
-                this.maxWidth,\r
-                (td.clientWidth > 20 ? td.clientWidth : td.offsetWidth) - Math.max(0, nd.offsetLeft-td.scrollLeft) - 5);\r
-        this.setSize(w, '');\r
-    },\r
-\r
-    // private\r
-    triggerEdit : function(node, defer){\r
-        this.completeEdit();\r
-               if(node.attributes.editable !== false){\r
-              \r
-                       this.editNode = node;\r
-            if(this.tree.autoScroll){\r
-                node.ui.getEl().scrollIntoView(this.tree.body);\r
-            }\r
-            this.autoEditTimer = this.startEdit.defer(this.editDelay, this, [node.ui.textNode, node.text]);\r
-            return false;\r
-        }\r
-    },\r
-\r
-    // private\r
-    bindScroll : function(){\r
-        this.tree.getTreeEl().on('scroll', this.cancelEdit, this);\r
-    },\r
-\r
-    // private\r
-    beforeNodeClick : function(node, e){\r
-        clearTimeout(this.autoEditTimer);\r
-        if(this.tree.getSelectionModel().isSelected(node)){\r
-            e.stopEvent();\r
-            return this.triggerEdit(node);\r
-        }\r
-    },\r
-\r
-    onNodeDblClick : function(node, e){\r
-        clearTimeout(this.autoEditTimer);\r
-    },\r
-\r
-    // private\r
-    updateNode : function(ed, value){\r
-        this.tree.getTreeEl().un('scroll', this.cancelEdit, this);\r
-        this.editNode.setText(value);\r
-    },\r
-\r
-    // private\r
-    onHide : function(){\r
-        Ext.tree.TreeEditor.superclass.onHide.call(this);\r
-        if(this.editNode){\r
-            this.editNode.ui.focus.defer(50, this.editNode.ui);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onSpecialKey : function(field, e){\r
-        var k = e.getKey();\r
-        if(k == e.ESC){\r
-            e.stopEvent();\r
-            this.cancelEdit();\r
-        }else if(k == e.ENTER && !e.hasModifier()){\r
-            e.stopEvent();\r
-            this.completeEdit();\r
-        }\r
-    }\r
-});\r
-\r
-Ext.menu.Menu = function(config){\r
-    if(Ext.isArray(config)){\r
-        config = {items:config};\r
-    }\r
-    Ext.apply(this, config);\r
-    this.id = this.id || Ext.id();\r
-    this.addEvents(\r
-        \r
-        'beforeshow',\r
-        \r
-        'beforehide',\r
-        \r
-        'show',\r
-        \r
-        'hide',\r
-        \r
-        'click',\r
-        \r
-        'mouseover',\r
-        \r
-        'mouseout',\r
-        \r
-        'itemclick'\r
-    );\r
-    Ext.menu.MenuMgr.register(this);\r
-    Ext.menu.Menu.superclass.constructor.call(this);\r
-    var mis = this.items;\r
-    \r
-\r
-    this.items = new Ext.util.MixedCollection();\r
-    if(mis){\r
-        this.add.apply(this, mis);\r
-    }\r
-};\r
-\r
-Ext.extend(Ext.menu.Menu, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    minWidth : 120,\r
-    \r
-    shadow : "sides",\r
-    \r
-    subMenuAlign : "tl-tr?",\r
-    \r
-    defaultAlign : "tl-bl?",\r
-    \r
-    allowOtherMenus : false,\r
-    \r
-    ignoreParentClicks : false,\r
-\r
-    // private\r
-    hidden:true,\r
-\r
-    // private\r
-    createEl : function(){\r
-        return new Ext.Layer({\r
-            cls: "x-menu",\r
-            shadow:this.shadow,\r
-            constrain: false,\r
-            parentEl: this.parentEl || document.body,\r
-            zindex:15000\r
-        });\r
-    },\r
-\r
-    // private\r
-    render : function(){\r
-        if(this.el){\r
-            return;\r
-        }\r
-        var el = this.el = this.createEl();\r
-\r
-        if(!this.keyNav){\r
-            this.keyNav = new Ext.menu.MenuNav(this);\r
-        }\r
-        if(this.plain){\r
-            el.addClass("x-menu-plain");\r
-        }\r
-        if(this.cls){\r
-            el.addClass(this.cls);\r
-        }\r
-        // generic focus element\r
-        this.focusEl = el.createChild({\r
-            tag: "a", cls: "x-menu-focus", href: "#", onclick: "return false;", tabIndex:"-1"\r
-        });\r
-        var ul = el.createChild({tag: "ul", cls: "x-menu-list"});\r
-        ul.on("click", this.onClick, this);\r
-        ul.on("mouseover", this.onMouseOver, this);\r
-        ul.on("mouseout", this.onMouseOut, this);\r
-        this.items.each(function(item){\r
-            var li = document.createElement("li");\r
-            li.className = "x-menu-list-item";\r
-            ul.dom.appendChild(li);\r
-            item.render(li, this);\r
-        }, this);\r
-        this.ul = ul;\r
-        this.autoWidth();\r
-    },\r
-\r
-    // private\r
-    autoWidth : function(){\r
-        var el = this.el, ul = this.ul;\r
-        if(!el){\r
-            return;\r
-        }\r
-        var w = this.width;\r
-        if(w){\r
-            el.setWidth(w);\r
-        }else if(Ext.isIE){\r
-            el.setWidth(this.minWidth);\r
-            var t = el.dom.offsetWidth; // force recalc\r
-            el.setWidth(ul.getWidth()+el.getFrameWidth("lr"));\r
-        }\r
-    },\r
-\r
-    // private\r
-    delayAutoWidth : function(){\r
-        if(this.el){\r
-            if(!this.awTask){\r
-                this.awTask = new Ext.util.DelayedTask(this.autoWidth, this);\r
-            }\r
-            this.awTask.delay(20);\r
-        }\r
-    },\r
-\r
-    // private\r
-    findTargetItem : function(e){\r
-        var t = e.getTarget(".x-menu-list-item", this.ul,  true);\r
-        if(t && t.menuItemId){\r
-            return this.items.get(t.menuItemId);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        var t;\r
-        if(t = this.findTargetItem(e)){\r
-            if(t.menu && this.ignoreParentClicks){\r
-                t.expandMenu();\r
-            }else{\r
-                t.onClick(e);\r
-                this.fireEvent("click", this, t, e);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    setActiveItem : function(item, autoExpand){\r
-        if(item != this.activeItem){\r
-            if(this.activeItem){\r
-                this.activeItem.deactivate();\r
-            }\r
-            this.activeItem = item;\r
-            item.activate(autoExpand);\r
-        }else if(autoExpand){\r
-            item.expandMenu();\r
-        }\r
-    },\r
-\r
-    // private\r
-    tryActivate : function(start, step){\r
-        var items = this.items;\r
-        for(var i = start, len = items.length; i >= 0 && i < len; i+= step){\r
-            var item = items.get(i);\r
-            if(!item.disabled && item.canActivate){\r
-                this.setActiveItem(item, false);\r
-                return item;\r
-            }\r
-        }\r
-        return false;\r
-    },\r
-\r
-    // private\r
-    onMouseOver : function(e){\r
-        var t;\r
-        if(t = this.findTargetItem(e)){\r
-            if(t.canActivate && !t.disabled){\r
-                this.setActiveItem(t, true);\r
-            }\r
-        }\r
-        this.over = true;\r
-        this.fireEvent("mouseover", this, e, t);\r
-    },\r
-\r
-    // private\r
-    onMouseOut : function(e){\r
-        var t;\r
-        if(t = this.findTargetItem(e)){\r
-            if(t == this.activeItem && t.shouldDeactivate(e)){\r
-                this.activeItem.deactivate();\r
-                delete this.activeItem;\r
-            }\r
-        }\r
-        this.over = false;\r
-        this.fireEvent("mouseout", this, e, t);\r
-    },\r
-\r
-    \r
-    isVisible : function(){\r
-        return this.el && !this.hidden;\r
-    },\r
-\r
-    \r
-    show : function(el, pos, parentMenu){\r
-        this.parentMenu = parentMenu;\r
-        if(!this.el){\r
-            this.render();\r
-        }\r
-        this.fireEvent("beforeshow", this);\r
-        this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign), parentMenu, false);\r
-    },\r
-\r
-    \r
-    showAt : function(xy, parentMenu, _e){\r
-        this.parentMenu = parentMenu;\r
-        if(!this.el){\r
-            this.render();\r
-        }\r
-        if(_e !== false){\r
-            this.fireEvent("beforeshow", this);\r
-            xy = this.el.adjustForConstraints(xy);\r
-        }\r
-        this.el.setXY(xy);\r
-        this.el.show();\r
-        this.hidden = false;\r
-        this.focus();\r
-        this.fireEvent("show", this);\r
-    },\r
-\r
-\r
-\r
-    focus : function(){\r
-        if(!this.hidden){\r
-            this.doFocus.defer(50, this);\r
-        }\r
-    },\r
-\r
-    doFocus : function(){\r
-        if(!this.hidden){\r
-            this.focusEl.focus();\r
-        }\r
-    },\r
-\r
-    \r
-    hide : function(deep){\r
-        if(this.el && this.isVisible()){\r
-            this.fireEvent("beforehide", this);\r
-            if(this.activeItem){\r
-                this.activeItem.deactivate();\r
-                this.activeItem = null;\r
-            }\r
-            this.el.hide();\r
-            this.hidden = true;\r
-            this.fireEvent("hide", this);\r
-        }\r
-        if(deep === true && this.parentMenu){\r
-            this.parentMenu.hide(true);\r
-        }\r
-    },\r
-\r
-    \r
-    add : function(){\r
-        var a = arguments, l = a.length, item;\r
-        for(var i = 0; i < l; i++){\r
-            var el = a[i];\r
-            if(el.render){ // some kind of Item\r
-                item = this.addItem(el);\r
-            }else if(typeof el == "string"){ // string\r
-                if(el == "separator" || el == "-"){\r
-                    item = this.addSeparator();\r
-                }else{\r
-                    item = this.addText(el);\r
-                }\r
-            }else if(el.tagName || el.el){ // element\r
-                item = this.addElement(el);\r
-            }else if(typeof el == "object"){ // must be menu item config?\r
-                Ext.applyIf(el, this.defaults);\r
-                item = this.addMenuItem(el);\r
-            }\r
-        }\r
-        return item;\r
-    },\r
-\r
-    \r
-    getEl : function(){\r
-        if(!this.el){\r
-            this.render();\r
-        }\r
-        return this.el;\r
-    },\r
-\r
-    \r
-    addSeparator : function(){\r
-        return this.addItem(new Ext.menu.Separator());\r
-    },\r
-\r
-    \r
-    addElement : function(el){\r
-        return this.addItem(new Ext.menu.BaseItem(el));\r
-    },\r
-\r
-    \r
-    addItem : function(item){\r
-        this.items.add(item);\r
-        if(this.ul){\r
-            var li = document.createElement("li");\r
-            li.className = "x-menu-list-item";\r
-            this.ul.dom.appendChild(li);\r
-            item.render(li, this);\r
-            this.delayAutoWidth();\r
-        }\r
-        return item;\r
-    },\r
-\r
-    \r
-    addMenuItem : function(config){\r
-        if(!(config instanceof Ext.menu.Item)){\r
-            if(typeof config.checked == "boolean"){ // must be check menu item config?\r
-                config = new Ext.menu.CheckItem(config);\r
-            }else{\r
-                config = new Ext.menu.Item(config);\r
-            }\r
-        }\r
-        return this.addItem(config);\r
-    },\r
-\r
-    \r
-    addText : function(text){\r
-        return this.addItem(new Ext.menu.TextItem(text));\r
-    },\r
-\r
-    \r
-    insert : function(index, item){\r
-        this.items.insert(index, item);\r
-        if(this.ul){\r
-            var li = document.createElement("li");\r
-            li.className = "x-menu-list-item";\r
-            this.ul.dom.insertBefore(li, this.ul.dom.childNodes[index]);\r
-            item.render(li, this);\r
-            this.delayAutoWidth();\r
-        }\r
-        return item;\r
-    },\r
-\r
-    \r
-    remove : function(item){\r
-        this.items.removeKey(item.id);\r
-        item.destroy();\r
-    },\r
-\r
-    \r
-    removeAll : function(){\r
-       if(this.items){\r
-               var f;\r
-               while(f = this.items.first()){\r
-                   this.remove(f);\r
-               }\r
-       }\r
-    },\r
-\r
-    \r
-    destroy : function(){\r
-        this.beforeDestroy();\r
-        Ext.menu.MenuMgr.unregister(this);\r
-        if (this.keyNav) {\r
-               this.keyNav.disable();\r
-        }\r
-        this.removeAll();\r
-        if (this.ul) {\r
-               this.ul.removeAllListeners();\r
-        }\r
-        if (this.el) {\r
-               this.el.destroy();\r
-        }\r
-    },\r
-\r
-       // private\r
-    beforeDestroy : Ext.emptyFn\r
-\r
-});\r
-\r
-// MenuNav is a private utility class used internally by the Menu\r
-Ext.menu.MenuNav = function(menu){\r
-    Ext.menu.MenuNav.superclass.constructor.call(this, menu.el);\r
-    this.scope = this.menu = menu;\r
-};\r
-\r
-Ext.extend(Ext.menu.MenuNav, Ext.KeyNav, {\r
-    doRelay : function(e, h){\r
-        var k = e.getKey();\r
-        if(!this.menu.activeItem && e.isNavKeyPress() && k != e.SPACE && k != e.RETURN){\r
-            this.menu.tryActivate(0, 1);\r
-            return false;\r
-        }\r
-        return h.call(this.scope || this, e, this.menu);\r
-    },\r
-\r
-    up : function(e, m){\r
-        if(!m.tryActivate(m.items.indexOf(m.activeItem)-1, -1)){\r
-            m.tryActivate(m.items.length-1, -1);\r
-        }\r
-    },\r
-\r
-    down : function(e, m){\r
-        if(!m.tryActivate(m.items.indexOf(m.activeItem)+1, 1)){\r
-            m.tryActivate(0, 1);\r
-        }\r
-    },\r
-\r
-    right : function(e, m){\r
-        if(m.activeItem){\r
-            m.activeItem.expandMenu(true);\r
-        }\r
-    },\r
-\r
-    left : function(e, m){\r
-        m.hide();\r
-        if(m.parentMenu && m.parentMenu.activeItem){\r
-            m.parentMenu.activeItem.activate();\r
-        }\r
-    },\r
-\r
-    enter : function(e, m){\r
-        if(m.activeItem){\r
-            e.stopPropagation();\r
-            m.activeItem.onClick(e);\r
-            m.fireEvent("click", this, m.activeItem);\r
-            return true;\r
-        }\r
-    }\r
-});\r
-\r
-Ext.menu.MenuMgr = function(){\r
-   var menus, active, groups = {}, attached = false, lastShow = new Date();\r
-\r
-   // private - called when first menu is created\r
-   function init(){\r
-       menus = {};\r
-       active = new Ext.util.MixedCollection();\r
-       Ext.getDoc().addKeyListener(27, function(){\r
-           if(active.length > 0){\r
-               hideAll();\r
-           }\r
-       });\r
-   }\r
-\r
-   // private\r
-   function hideAll(){\r
-       if(active && active.length > 0){\r
-           var c = active.clone();\r
-           c.each(function(m){\r
-               m.hide();\r
-           });\r
-       }\r
-   }\r
-\r
-   // private\r
-   function onHide(m){\r
-       active.remove(m);\r
-       if(active.length < 1){\r
-           Ext.getDoc().un("mousedown", onMouseDown);\r
-           attached = false;\r
-       }\r
-   }\r
-\r
-   // private\r
-   function onShow(m){\r
-       var last = active.last();\r
-       lastShow = new Date();\r
-       active.add(m);\r
-       if(!attached){\r
-           Ext.getDoc().on("mousedown", onMouseDown);\r
-           attached = true;\r
-       }\r
-       if(m.parentMenu){\r
-          m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"), 10) + 3);\r
-          m.parentMenu.activeChild = m;\r
-       }else if(last && last.isVisible()){\r
-          m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"), 10) + 3);\r
-       }\r
-   }\r
-\r
-   // private\r
-   function onBeforeHide(m){\r
-       if(m.activeChild){\r
-           m.activeChild.hide();\r
-       }\r
-       if(m.autoHideTimer){\r
-           clearTimeout(m.autoHideTimer);\r
-           delete m.autoHideTimer;\r
-       }\r
-   }\r
-\r
-   // private\r
-   function onBeforeShow(m){\r
-       var pm = m.parentMenu;\r
-       if(!pm && !m.allowOtherMenus){\r
-           hideAll();\r
-       }else if(pm && pm.activeChild){\r
-           pm.activeChild.hide();\r
-       }\r
-   }\r
-\r
-   // private\r
-   function onMouseDown(e){\r
-       if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu")){\r
-           hideAll();\r
-       }\r
-   }\r
-\r
-   // private\r
-   function onBeforeCheck(mi, state){\r
-       if(state){\r
-           var g = groups[mi.group];\r
-           for(var i = 0, l = g.length; i < l; i++){\r
-               if(g[i] != mi){\r
-                   g[i].setChecked(false);\r
-               }\r
-           }\r
-       }\r
-   }\r
-\r
-   return {\r
-\r
-       \r
-       hideAll : function(){\r
-            hideAll();  \r
-       },\r
-\r
-       // private\r
-       register : function(menu){\r
-           if(!menus){\r
-               init();\r
-           }\r
-           menus[menu.id] = menu;\r
-           menu.on("beforehide", onBeforeHide);\r
-           menu.on("hide", onHide);\r
-           menu.on("beforeshow", onBeforeShow);\r
-           menu.on("show", onShow);\r
-           var g = menu.group;\r
-           if(g && menu.events["checkchange"]){\r
-               if(!groups[g]){\r
-                   groups[g] = [];\r
-               }\r
-               groups[g].push(menu);\r
-               menu.on("checkchange", onCheck);\r
-           }\r
-       },\r
-\r
-        \r
-       get : function(menu){\r
-           if(typeof menu == "string"){ // menu id\r
-               if(!menus){  // not initialized, no menus to return\r
-                   return null;\r
-               }\r
-               return menus[menu];\r
-           }else if(menu.events){  // menu instance\r
-               return menu;\r
-           }else if(typeof menu.length == 'number'){ // array of menu items?\r
-               return new Ext.menu.Menu({items:menu});\r
-           }else{ // otherwise, must be a config\r
-               return new Ext.menu.Menu(menu);\r
-           }\r
-       },\r
-\r
-       // private\r
-       unregister : function(menu){\r
-           delete menus[menu.id];\r
-           menu.un("beforehide", onBeforeHide);\r
-           menu.un("hide", onHide);\r
-           menu.un("beforeshow", onBeforeShow);\r
-           menu.un("show", onShow);\r
-           var g = menu.group;\r
-           if(g && menu.events["checkchange"]){\r
-               groups[g].remove(menu);\r
-               menu.un("checkchange", onCheck);\r
-           }\r
-       },\r
-\r
-       // private\r
-       registerCheckable : function(menuItem){\r
-           var g = menuItem.group;\r
-           if(g){\r
-               if(!groups[g]){\r
-                   groups[g] = [];\r
-               }\r
-               groups[g].push(menuItem);\r
-               menuItem.on("beforecheckchange", onBeforeCheck);\r
-           }\r
-       },\r
-\r
-       // private\r
-       unregisterCheckable : function(menuItem){\r
-           var g = menuItem.group;\r
-           if(g){\r
-               groups[g].remove(menuItem);\r
-               menuItem.un("beforecheckchange", onBeforeCheck);\r
-           }\r
-       },\r
-\r
-       getCheckedItem : function(groupId){\r
-           var g = groups[groupId];\r
-           if(g){\r
-               for(var i = 0, l = g.length; i < l; i++){\r
-                   if(g[i].checked){\r
-                       return g[i];\r
-                   }\r
-               }\r
-           }\r
-           return null;\r
-       },\r
-\r
-       setCheckedItem : function(groupId, itemId){\r
-           var g = groups[groupId];\r
-           if(g){\r
-               for(var i = 0, l = g.length; i < l; i++){\r
-                   if(g[i].id == itemId){\r
-                       g[i].setChecked(true);\r
-                   }\r
-               }\r
-           }\r
-           return null;\r
-       }\r
-   };\r
-}();\r
-\r
-\r
-Ext.menu.BaseItem = function(config){\r
-    Ext.menu.BaseItem.superclass.constructor.call(this, config);\r
-\r
-    this.addEvents(\r
-        \r
-        'click',\r
-        \r
-        'activate',\r
-        \r
-        'deactivate'\r
-    );\r
-\r
-    if(this.handler){\r
-        this.on("click", this.handler, this.scope);\r
-    }\r
-};\r
-\r
-Ext.extend(Ext.menu.BaseItem, Ext.Component, {\r
-    \r
-    \r
-    \r
-    canActivate : false,\r
-    \r
-    activeClass : "x-menu-item-active",\r
-    \r
-    hideOnClick : true,\r
-    \r
-    hideDelay : 100,\r
-\r
-    // private\r
-    ctype: "Ext.menu.BaseItem",\r
-\r
-    // private\r
-    actionMode : "container",\r
-\r
-    // private\r
-    render : function(container, parentMenu){\r
-        \r
-        this.parentMenu = parentMenu;\r
-        Ext.menu.BaseItem.superclass.render.call(this, container);\r
-        this.container.menuItemId = this.id;\r
-    },\r
-\r
-    // private\r
-    onRender : function(container, position){\r
-        this.el = Ext.get(this.el);\r
-        if(this.id){\r
-            this.el.id = this.id;\r
-        }\r
-        container.dom.appendChild(this.el.dom);\r
-    },\r
-\r
-    \r
-    setHandler : function(handler, scope){\r
-        if(this.handler){\r
-            this.un("click", this.handler, this.scope);\r
-        }\r
-        this.on("click", this.handler = handler, this.scope = scope);\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        if(!this.disabled && this.fireEvent("click", this, e) !== false\r
-                && this.parentMenu.fireEvent("itemclick", this, e) !== false){\r
-            this.handleClick(e);\r
-        }else{\r
-            e.stopEvent();\r
-        }\r
-    },\r
-\r
-    // private\r
-    activate : function(){\r
-        if(this.disabled){\r
-            return false;\r
-        }\r
-        var li = this.container;\r
-        li.addClass(this.activeClass);\r
-        this.region = li.getRegion().adjust(2, 2, -2, -2);\r
-        this.fireEvent("activate", this);\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    deactivate : function(){\r
-        this.container.removeClass(this.activeClass);\r
-        this.fireEvent("deactivate", this);\r
-    },\r
-\r
-    // private\r
-    shouldDeactivate : function(e){\r
-        return !this.region || !this.region.contains(e.getPoint());\r
-    },\r
-\r
-    // private\r
-    handleClick : function(e){\r
-        if(this.hideOnClick){\r
-            this.parentMenu.hide.defer(this.hideDelay, this.parentMenu, [true]);\r
-        }\r
-    },\r
-\r
-    // private\r
-    expandMenu : function(autoActivate){\r
-        // do nothing\r
-    },\r
-\r
-    // private\r
-    hideMenu : function(){\r
-        // do nothing\r
-    }\r
-});\r
-\r
-Ext.menu.TextItem = function(cfg){\r
-    if(typeof cfg == 'string'){\r
-        cfg = {text: cfg}\r
-    }\r
-    Ext.menu.TextItem.superclass.constructor.call(this, cfg);\r
-};\r
-\r
-Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, {\r
-    \r
-    \r
-    hideOnClick : false,\r
-    \r
-    itemCls : "x-menu-text",\r
-\r
-    // private\r
-    onRender : function(){\r
-        var s = document.createElement("span");\r
-        s.className = this.itemCls;\r
-        s.innerHTML = this.text;\r
-        this.el = s;\r
-        Ext.menu.TextItem.superclass.onRender.apply(this, arguments);\r
-    }\r
-});\r
-\r
-Ext.menu.Separator = function(config){\r
-    Ext.menu.Separator.superclass.constructor.call(this, config);\r
-};\r
-\r
-Ext.extend(Ext.menu.Separator, Ext.menu.BaseItem, {\r
-    \r
-    itemCls : "x-menu-sep",\r
-    \r
-    hideOnClick : false,\r
-\r
-    // private\r
-    onRender : function(li){\r
-        var s = document.createElement("span");\r
-        s.className = this.itemCls;\r
-        s.innerHTML = "&#160;";\r
-        this.el = s;\r
-        li.addClass("x-menu-sep-li");\r
-        Ext.menu.Separator.superclass.onRender.apply(this, arguments);\r
-    }\r
-});\r
-\r
-Ext.menu.Item = function(config){\r
-    Ext.menu.Item.superclass.constructor.call(this, config);\r
-    if(this.menu){\r
-        this.menu = Ext.menu.MenuMgr.get(this.menu);\r
-    }\r
-};\r
-Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    itemCls : "x-menu-item",\r
-    \r
-    canActivate : true,\r
-    \r
-    showDelay: 200,\r
-    // doc'd in BaseItem\r
-    hideDelay: 200,\r
-\r
-    // private\r
-    ctype: "Ext.menu.Item",\r
-\r
-    // private\r
-    onRender : function(container, position){\r
-        var el = document.createElement("a");\r
-        el.hideFocus = true;\r
-        el.unselectable = "on";\r
-        el.href = this.href || "#";\r
-        if(this.hrefTarget){\r
-            el.target = this.hrefTarget;\r
-        }\r
-        el.className = this.itemCls + (this.menu ?  " x-menu-item-arrow" : "") + (this.cls ?  " " + this.cls : "");\r
-        el.innerHTML = String.format(\r
-                '<img src="{0}" class="x-menu-item-icon {2}" />{1}',\r
-                this.icon || Ext.BLANK_IMAGE_URL, this.itemText||this.text, this.iconCls || '');\r
-        this.el = el;\r
-        Ext.menu.Item.superclass.onRender.call(this, container, position);\r
-    },\r
-\r
-    \r
-    setText : function(text){\r
-        this.text = text;\r
-        if(this.rendered){\r
-            this.el.update(String.format(\r
-                '<img src="{0}" class="x-menu-item-icon {2}">{1}',\r
-                this.icon || Ext.BLANK_IMAGE_URL, this.text, this.iconCls || ''));\r
-            this.parentMenu.autoWidth();\r
-        }\r
-    },\r
-\r
-    \r
-    setIconClass : function(cls){\r
-        var oldCls = this.iconCls;\r
-        this.iconCls = cls;\r
-        if(this.rendered){\r
-            this.el.child('img.x-menu-item-icon').replaceClass(oldCls, this.iconCls);\r
-        }\r
-    },\r
-    \r
-    //private\r
-    beforeDestroy: function(){\r
-        if (this.menu){\r
-            this.menu.destroy();\r
-        }\r
-        Ext.menu.Item.superclass.beforeDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    handleClick : function(e){\r
-        if(!this.href){ // if no link defined, stop the event automatically\r
-            e.stopEvent();\r
-        }\r
-        Ext.menu.Item.superclass.handleClick.apply(this, arguments);\r
-    },\r
-\r
-    // private\r
-    activate : function(autoExpand){\r
-        if(Ext.menu.Item.superclass.activate.apply(this, arguments)){\r
-            this.focus();\r
-            if(autoExpand){\r
-                this.expandMenu();\r
-            }\r
-        }\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    shouldDeactivate : function(e){\r
-        if(Ext.menu.Item.superclass.shouldDeactivate.call(this, e)){\r
-            if(this.menu && this.menu.isVisible()){\r
-                return !this.menu.getEl().getRegion().contains(e.getPoint());\r
-            }\r
-            return true;\r
-        }\r
-        return false;\r
-    },\r
-\r
-    // private\r
-    deactivate : function(){\r
-        Ext.menu.Item.superclass.deactivate.apply(this, arguments);\r
-        this.hideMenu();\r
-    },\r
-\r
-    // private\r
-    expandMenu : function(autoActivate){\r
-        if(!this.disabled && this.menu){\r
-            clearTimeout(this.hideTimer);\r
-            delete this.hideTimer;\r
-            if(!this.menu.isVisible() && !this.showTimer){\r
-                this.showTimer = this.deferExpand.defer(this.showDelay, this, [autoActivate]);\r
-            }else if (this.menu.isVisible() && autoActivate){\r
-                this.menu.tryActivate(0, 1);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    deferExpand : function(autoActivate){\r
-        delete this.showTimer;\r
-        this.menu.show(this.container, this.parentMenu.subMenuAlign || "tl-tr?", this.parentMenu);\r
-        if(autoActivate){\r
-            this.menu.tryActivate(0, 1);\r
-        }\r
-    },\r
-\r
-    // private\r
-    hideMenu : function(){\r
-        clearTimeout(this.showTimer);\r
-        delete this.showTimer;\r
-        if(!this.hideTimer && this.menu && this.menu.isVisible()){\r
-            this.hideTimer = this.deferHide.defer(this.hideDelay, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    deferHide : function(){\r
-        delete this.hideTimer;\r
-        if(this.menu.over){\r
-            this.parentMenu.setActiveItem(this, false);\r
-        }else{\r
-            this.menu.hide();\r
-        }\r
-    }\r
-});\r
-\r
-Ext.menu.CheckItem = function(config){\r
-    Ext.menu.CheckItem.superclass.constructor.call(this, config);\r
-    this.addEvents(\r
-        \r
-        "beforecheckchange" ,\r
-        \r
-        "checkchange"\r
-    );\r
-    \r
-    if(this.checkHandler){\r
-        this.on('checkchange', this.checkHandler, this.scope);\r
-    }\r
-    Ext.menu.MenuMgr.registerCheckable(this);\r
-};\r
-Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, {\r
-    \r
-    \r
-    itemCls : "x-menu-item x-menu-check-item",\r
-    \r
-    groupClass : "x-menu-group-item",\r
-\r
-    \r
-    checked: false,\r
-\r
-    // private\r
-    ctype: "Ext.menu.CheckItem",\r
-\r
-    // private\r
-    onRender : function(c){\r
-        Ext.menu.CheckItem.superclass.onRender.apply(this, arguments);\r
-        if(this.group){\r
-            this.el.addClass(this.groupClass);\r
-        }\r
-        if(this.checked){\r
-            this.checked = false;\r
-            this.setChecked(true, true);\r
-        }\r
-    },\r
-\r
-    // private\r
-    destroy : function(){\r
-        Ext.menu.MenuMgr.unregisterCheckable(this);\r
-        Ext.menu.CheckItem.superclass.destroy.apply(this, arguments);\r
-    },\r
-\r
-    \r
-    setChecked : function(state, suppressEvent){\r
-        if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){\r
-            if(this.container){\r
-                this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");\r
-            }\r
-            this.checked = state;\r
-            if(suppressEvent !== true){\r
-                this.fireEvent("checkchange", this, state);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleClick : function(e){\r
-       if(!this.disabled && !(this.checked && this.group)){// disable unselect on radio item\r
-           this.setChecked(!this.checked);\r
-       }\r
-       Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments);\r
-    }\r
-});\r
-\r
-Ext.menu.Adapter = function(component, config){\r
-    Ext.menu.Adapter.superclass.constructor.call(this, config);\r
-    this.component = component;\r
-};\r
-Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, {\r
-    // private\r
-    canActivate : true,\r
-\r
-    // private\r
-    onRender : function(container, position){\r
-        this.component.render(container);\r
-        this.el = this.component.getEl();\r
-    },\r
-\r
-    // private\r
-    activate : function(){\r
-        if(this.disabled){\r
-            return false;\r
-        }\r
-        this.component.focus();\r
-        this.fireEvent("activate", this);\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    deactivate : function(){\r
-        this.fireEvent("deactivate", this);\r
-    },\r
-\r
-    // private\r
-    disable : function(){\r
-        this.component.disable();\r
-        Ext.menu.Adapter.superclass.disable.call(this);\r
-    },\r
-\r
-    // private\r
-    enable : function(){\r
-        this.component.enable();\r
-        Ext.menu.Adapter.superclass.enable.call(this);\r
-    }\r
-});\r
-\r
-Ext.menu.DateItem = function(config){\r
-    Ext.menu.DateItem.superclass.constructor.call(this, new Ext.DatePicker(config), config);\r
-    \r
-    this.picker = this.component;\r
-    this.addEvents('select');\r
-    \r
-    this.picker.on("render", function(picker){\r
-        picker.getEl().swallowEvent("click");\r
-        picker.container.addClass("x-menu-date-item");\r
-    });\r
-\r
-    this.picker.on("select", this.onSelect, this);\r
-};\r
-\r
-Ext.extend(Ext.menu.DateItem, Ext.menu.Adapter, {\r
-    // private\r
-    onSelect : function(picker, date){\r
-        this.fireEvent("select", this, date, picker);\r
-        Ext.menu.DateItem.superclass.handleClick.call(this);\r
-    }\r
-});\r
-\r
-Ext.menu.ColorItem = function(config){\r
-    Ext.menu.ColorItem.superclass.constructor.call(this, new Ext.ColorPalette(config), config);\r
-    \r
-    this.palette = this.component;\r
-    this.relayEvents(this.palette, ["select"]);\r
-    if(this.selectHandler){\r
-        this.on('select', this.selectHandler, this.scope);\r
-    }\r
-};\r
-Ext.extend(Ext.menu.ColorItem, Ext.menu.Adapter);\r
-\r
-Ext.menu.DateMenu = function(config){\r
-    Ext.menu.DateMenu.superclass.constructor.call(this, config);\r
-    this.plain = true;\r
-    var di = new Ext.menu.DateItem(config);\r
-    this.add(di);\r
-    \r
-    this.picker = di.picker;\r
-    \r
-    this.relayEvents(di, ["select"]);\r
-\r
-    this.on('beforeshow', function(){\r
-        if(this.picker){\r
-            this.picker.hideMonthPicker(true);\r
-        }\r
-    }, this);\r
-};\r
-Ext.extend(Ext.menu.DateMenu, Ext.menu.Menu, {\r
-    cls:'x-date-menu',\r
-\r
-    // private\r
-    beforeDestroy : function() {\r
-        this.picker.destroy();\r
-    }\r
-});\r
-\r
-Ext.menu.ColorMenu = function(config){\r
-    Ext.menu.ColorMenu.superclass.constructor.call(this, config);\r
-    this.plain = true;\r
-    var ci = new Ext.menu.ColorItem(config);\r
-    this.add(ci);\r
-    \r
-    this.palette = ci.palette;\r
-    \r
-    this.relayEvents(ci, ["select"]);\r
-};\r
-Ext.extend(Ext.menu.ColorMenu, Ext.menu.Menu, {\r
-    //private\r
-    beforeDestroy: function(){\r
-        this.palette.destroy();\r
-    }\r
-});\r
-\r
-Ext.form.Field = Ext.extend(Ext.BoxComponent,  {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    \r
-    invalidClass : "x-form-invalid",\r
-    \r
-    invalidText : "The value in this field is invalid",\r
-    \r
-    focusClass : "x-form-focus",\r
-    \r
-    validationEvent : "keyup",\r
-    \r
-    validateOnBlur : true,\r
-    \r
-    validationDelay : 250,\r
-    \r
-    defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"},\r
-    \r
-    fieldClass : "x-form-field",\r
-    \r
-    msgTarget : 'qtip',\r
-    \r
-    msgFx : 'normal',\r
-    \r
-    readOnly : false,\r
-    \r
-    disabled : false,\r
-\r
-    // private\r
-    isFormField : true,\r
-\r
-    // private\r
-    hasFocus : false,\r
-\r
-       // private\r
-       initComponent : function(){\r
-        Ext.form.Field.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            'focus',\r
-            \r
-            'blur',\r
-            \r
-            'specialkey',\r
-            \r
-            'change',\r
-            \r
-            'invalid',\r
-            \r
-            'valid'\r
-        );\r
-    },\r
-\r
-    \r
-    getName: function(){\r
-         return this.rendered && this.el.dom.name ? this.el.dom.name : (this.hiddenName || '');\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.form.Field.superclass.onRender.call(this, ct, position);\r
-        if(!this.el){\r
-            var cfg = this.getAutoCreate();\r
-            if(!cfg.name){\r
-                cfg.name = this.name || this.id;\r
-            }\r
-            if(this.inputType){\r
-                cfg.type = this.inputType;\r
-            }\r
-            this.el = ct.createChild(cfg, position);\r
-        }\r
-        var type = this.el.dom.type;\r
-        if(type){\r
-            if(type == 'password'){\r
-                type = 'text';\r
-            }\r
-            this.el.addClass('x-form-'+type);\r
-        }\r
-        if(this.readOnly){\r
-            this.el.dom.readOnly = true;\r
-        }\r
-        if(this.tabIndex !== undefined){\r
-            this.el.dom.setAttribute('tabIndex', this.tabIndex);\r
-        }\r
-\r
-        this.el.addClass([this.fieldClass, this.cls]);\r
-    },\r
-\r
-    // private\r
-    initValue : function(){\r
-        if(this.value !== undefined){\r
-            this.setValue(this.value);\r
-        }else if(this.el.dom.value.length > 0 && this.el.dom.value != this.emptyText){\r
-            this.setValue(this.el.dom.value);\r
-        }\r
-        // reference to original value for reset\r
-        this.originalValue = this.getValue();\r
-    },\r
-\r
-    \r
-    isDirty : function() {\r
-        if(this.disabled) {\r
-            return false;\r
-        }\r
-        return String(this.getValue()) !== String(this.originalValue);\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.form.Field.superclass.afterRender.call(this);\r
-        this.initEvents();\r
-        this.initValue();\r
-    },\r
-\r
-    // private\r
-    fireKey : function(e){\r
-        if(e.isSpecialKey()){\r
-            this.fireEvent("specialkey", this, e);\r
-        }\r
-    },\r
-\r
-    \r
-    reset : function(){\r
-        this.setValue(this.originalValue);\r
-        this.clearInvalid();\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        this.el.on(Ext.isIE || Ext.isSafari3 ? "keydown" : "keypress", this.fireKey,  this);\r
-        this.el.on("focus", this.onFocus,  this);\r
-\r
-        // fix weird FF/Win editor issue when changing OS window focus\r
-        var o = this.inEditor && Ext.isWindows && Ext.isGecko ? {buffer:10} : null;\r
-        this.el.on("blur", this.onBlur,  this, o);\r
-    },\r
-\r
-    // private\r
-    onFocus : function(){\r
-        if(this.focusClass){\r
-            this.el.addClass(this.focusClass);\r
-        }\r
-        if(!this.hasFocus){\r
-            this.hasFocus = true;\r
-            this.startValue = this.getValue();\r
-            this.fireEvent("focus", this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    beforeBlur : Ext.emptyFn,\r
-\r
-    // private\r
-    onBlur : function(){\r
-        this.beforeBlur();\r
-        if(this.focusClass){\r
-            this.el.removeClass(this.focusClass);\r
-        }\r
-        this.hasFocus = false;\r
-        if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){\r
-            this.validate();\r
-        }\r
-        var v = this.getValue();\r
-        if(String(v) !== String(this.startValue)){\r
-            this.fireEvent('change', this, v, this.startValue);\r
-        }\r
-        this.fireEvent("blur", this);\r
-    },\r
-\r
-    \r
-    isValid : function(preventMark){\r
-        if(this.disabled){\r
-            return true;\r
-        }\r
-        var restore = this.preventMark;\r
-        this.preventMark = preventMark === true;\r
-        var v = this.validateValue(this.processValue(this.getRawValue()));\r
-        this.preventMark = restore;\r
-        return v;\r
-    },\r
-\r
-    \r
-    validate : function(){\r
-        if(this.disabled || this.validateValue(this.processValue(this.getRawValue()))){\r
-            this.clearInvalid();\r
-            return true;\r
-        }\r
-        return false;\r
-    },\r
-\r
-    // protected - should be overridden by subclasses if necessary to prepare raw values for validation\r
-    processValue : function(value){\r
-        return value;\r
-    },\r
-\r
-    // private\r
-    // Subclasses should provide the validation implementation by overriding this\r
-    validateValue : function(value){\r
-        return true;\r
-    },\r
-\r
-    \r
-    markInvalid : function(msg){\r
-        if(!this.rendered || this.preventMark){ // not rendered\r
-            return;\r
-        }\r
-        this.el.addClass(this.invalidClass);\r
-        msg = msg || this.invalidText;\r
-\r
-        switch(this.msgTarget){\r
-            case 'qtip':\r
-                this.el.dom.qtip = msg;\r
-                this.el.dom.qclass = 'x-form-invalid-tip';\r
-                if(Ext.QuickTips){ // fix for floating editors interacting with DND\r
-                    Ext.QuickTips.enable();\r
-                }\r
-                break;\r
-            case 'title':\r
-                this.el.dom.title = msg;\r
-                break;\r
-            case 'under':\r
-                if(!this.errorEl){\r
-                    var elp = this.getErrorCt();\r
-                    if(!elp){ // field has no container el\r
-                        this.el.dom.title = msg;\r
-                        break;\r
-                    }\r
-                    this.errorEl = elp.createChild({cls:'x-form-invalid-msg'});\r
-                    this.errorEl.setWidth(elp.getWidth(true)-20);\r
-                }\r
-                this.errorEl.update(msg);\r
-                Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this);\r
-                break;\r
-            case 'side':\r
-                if(!this.errorIcon){\r
-                    var elp = this.getErrorCt();\r
-                    if(!elp){ // field has no container el\r
-                        this.el.dom.title = msg;\r
-                        break;\r
-                    }\r
-                    this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});\r
-                }\r
-                this.alignErrorIcon();\r
-                this.errorIcon.dom.qtip = msg;\r
-                this.errorIcon.dom.qclass = 'x-form-invalid-tip';\r
-                this.errorIcon.show();\r
-                this.on('resize', this.alignErrorIcon, this);\r
-                break;\r
-            default:\r
-                var t = Ext.getDom(this.msgTarget);\r
-                t.innerHTML = msg;\r
-                t.style.display = this.msgDisplay;\r
-                break;\r
-        }\r
-        this.fireEvent('invalid', this, msg);\r
-    },\r
-\r
-    // private\r
-    getErrorCt : function(){\r
-        return this.el.findParent('.x-form-element', 5, true) || // use form element wrap if available\r
-            this.el.findParent('.x-form-field-wrap', 5, true);   // else direct field wrap\r
-    },\r
-\r
-    // private\r
-    alignErrorIcon : function(){\r
-        this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]);\r
-    },\r
-\r
-    \r
-    clearInvalid : function(){\r
-        if(!this.rendered || this.preventMark){ // not rendered\r
-            return;\r
-        }\r
-        this.el.removeClass(this.invalidClass);\r
-        switch(this.msgTarget){\r
-            case 'qtip':\r
-                this.el.dom.qtip = '';\r
-                break;\r
-            case 'title':\r
-                this.el.dom.title = '';\r
-                break;\r
-            case 'under':\r
-                if(this.errorEl){\r
-                    Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this);\r
-                }\r
-                break;\r
-            case 'side':\r
-                if(this.errorIcon){\r
-                    this.errorIcon.dom.qtip = '';\r
-                    this.errorIcon.hide();\r
-                    this.un('resize', this.alignErrorIcon, this);\r
-                }\r
-                break;\r
-            default:\r
-                var t = Ext.getDom(this.msgTarget);\r
-                t.innerHTML = '';\r
-                t.style.display = 'none';\r
-                break;\r
-        }\r
-        this.fireEvent('valid', this);\r
-    },\r
-\r
-    \r
-    getRawValue : function(){\r
-        var v = this.rendered ? this.el.getValue() : Ext.value(this.value, '');\r
-        if(v === this.emptyText){\r
-            v = '';\r
-        }\r
-        return v;\r
-    },\r
-\r
-    \r
-    getValue : function(){\r
-        if(!this.rendered) {\r
-            return this.value;\r
-        }\r
-        var v = this.el.getValue();\r
-        if(v === this.emptyText || v === undefined){\r
-            v = '';\r
-        }\r
-        return v;\r
-    },\r
-\r
-    \r
-    setRawValue : function(v){\r
-        return this.el.dom.value = (v === null || v === undefined ? '' : v);\r
-    },\r
-\r
-    \r
-    setValue : function(v){\r
-        this.value = v;\r
-        if(this.rendered){\r
-            this.el.dom.value = (v === null || v === undefined ? '' : v);\r
-            this.validate();\r
-        }\r
-    },\r
-\r
-    // private\r
-    adjustSize : function(w, h){\r
-        var s = Ext.form.Field.superclass.adjustSize.call(this, w, h);\r
-        s.width = this.adjustWidth(this.el.dom.tagName, s.width);\r
-        return s;\r
-    },\r
-\r
-    // private\r
-    adjustWidth : function(tag, w){\r
-        tag = tag.toLowerCase();\r
-        if(typeof w == 'number' && !Ext.isSafari){\r
-            if(Ext.isIE && (tag == 'input' || tag == 'textarea')){\r
-                if(tag == 'input' && !Ext.isStrict){\r
-                    return this.inEditor ? w : w - 3;\r
-                }\r
-                if(tag == 'input' && Ext.isStrict){\r
-                    return w - (Ext.isIE6 ? 4 : 1);\r
-                }\r
-                if(tag == 'textarea' && Ext.isStrict){\r
-                    return w-2;\r
-                }\r
-            }else if(Ext.isOpera && Ext.isStrict){\r
-                if(tag == 'input'){\r
-                    return w + 2;\r
-                }\r
-                if(tag == 'textarea'){\r
-                    return w-2;\r
-                }\r
-            }\r
-        }\r
-        return w;\r
-    }\r
-\r
-    \r
-    \r
-\r
-    \r
-});\r
-\r
-Ext.form.MessageTargets = {\r
-    'qtip' : {\r
-        mark: function(f){\r
-            this.el.dom.qtip = msg;\r
-            this.el.dom.qclass = 'x-form-invalid-tip';\r
-            if(Ext.QuickTips){ // fix for floating editors interacting with DND\r
-                Ext.QuickTips.enable();\r
-            }\r
-        },\r
-        clear: function(f){\r
-            this.el.dom.qtip = '';\r
-        }\r
-    },\r
-    'title' : {\r
-        mark: function(f){\r
-            this.el.dom.title = msg;\r
-        },\r
-        clear: function(f){\r
-            this.el.dom.title = '';\r
-        }\r
-    },\r
-    'under' : {\r
-        mark: function(f){\r
-            if(!this.errorEl){\r
-                var elp = this.getErrorCt();\r
-                if(!elp){ // field has no container el\r
-                    this.el.dom.title = msg;\r
-                    return;\r
-                }\r
-                this.errorEl = elp.createChild({cls:'x-form-invalid-msg'});\r
-                this.errorEl.setWidth(elp.getWidth(true)-20);\r
-            }\r
-            this.errorEl.update(msg);\r
-            Ext.form.Field.msgFx[this.msgFx].show(this.errorEl, this);\r
-        },\r
-        clear: function(f){\r
-            if(this.errorEl){\r
-                Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl, this);\r
-            }else{\r
-                this.el.dom.title = '';\r
-            }\r
-        }\r
-    },\r
-    'side' : {\r
-        mark: function(f){\r
-            if(!this.errorIcon){\r
-                var elp = this.getErrorCt();\r
-                if(!elp){ // field has no container el\r
-                    this.el.dom.title = msg;\r
-                    return;\r
-                }\r
-                this.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});\r
-            }\r
-            this.alignErrorIcon();\r
-            this.errorIcon.dom.qtip = msg;\r
-            this.errorIcon.dom.qclass = 'x-form-invalid-tip';\r
-            this.errorIcon.show();\r
-            this.on('resize', this.alignErrorIcon, this);\r
-        },\r
-        clear: function(f){\r
-            if(this.errorIcon){\r
-                this.errorIcon.dom.qtip = '';\r
-                this.errorIcon.hide();\r
-                this.un('resize', this.alignErrorIcon, this);\r
-            }else{\r
-                this.el.dom.title = '';\r
-            }\r
-        }\r
-    },\r
-    'around' : {\r
-        mark: function(f){\r
-\r
-        },\r
-        clear: function(f){\r
-\r
-        }\r
-    }\r
-};\r
-\r
-\r
-// anything other than normal should be considered experimental\r
-Ext.form.Field.msgFx = {\r
-    normal : {\r
-        show: function(msgEl, f){\r
-            msgEl.setDisplayed('block');\r
-        },\r
-\r
-        hide : function(msgEl, f){\r
-            msgEl.setDisplayed(false).update('');\r
-        }\r
-    },\r
-\r
-    slide : {\r
-        show: function(msgEl, f){\r
-            msgEl.slideIn('t', {stopFx:true});\r
-        },\r
-\r
-        hide : function(msgEl, f){\r
-            msgEl.slideOut('t', {stopFx:true,useDisplay:true});\r
-        }\r
-    },\r
-\r
-    slideRight : {\r
-        show: function(msgEl, f){\r
-            msgEl.fixDisplay();\r
-            msgEl.alignTo(f.el, 'tl-tr');\r
-            msgEl.slideIn('l', {stopFx:true});\r
-        },\r
-\r
-        hide : function(msgEl, f){\r
-            msgEl.slideOut('l', {stopFx:true,useDisplay:true});\r
-        }\r
-    }\r
-};\r
-Ext.reg('field', Ext.form.Field);\r
-\r
-\r
-Ext.form.TextField = Ext.extend(Ext.form.Field,  {\r
-    \r
-    \r
-    \r
-    grow : false,\r
-    \r
-    growMin : 30,\r
-    \r
-    growMax : 800,\r
-    \r
-    vtype : null,\r
-    \r
-    maskRe : null,\r
-    \r
-    disableKeyFilter : false,\r
-    \r
-    allowBlank : true,\r
-    \r
-    minLength : 0,\r
-    \r
-    maxLength : Number.MAX_VALUE,\r
-    \r
-    minLengthText : "The minimum length for this field is {0}",\r
-    \r
-    maxLengthText : "The maximum length for this field is {0}",\r
-    \r
-    selectOnFocus : false,\r
-    \r
-    blankText : "This field is required",\r
-    \r
-    validator : null,\r
-    \r
-    regex : null,\r
-    \r
-    regexText : "",\r
-    \r
-    emptyText : null,\r
-    \r
-    emptyClass : 'x-form-empty-field',\r
-\r
-    \r
-\r
-    initComponent : function(){\r
-        Ext.form.TextField.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            'autosize',\r
-\r
-            \r
-            'keydown',\r
-            \r
-            'keyup',\r
-            \r
-            'keypress'\r
-        );\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.form.TextField.superclass.initEvents.call(this);\r
-        if(this.validationEvent == 'keyup'){\r
-            this.validationTask = new Ext.util.DelayedTask(this.validate, this);\r
-            this.el.on('keyup', this.filterValidation, this);\r
-        }\r
-        else if(this.validationEvent !== false){\r
-            this.el.on(this.validationEvent, this.validate, this, {buffer: this.validationDelay});\r
-        }\r
-        if(this.selectOnFocus || this.emptyText){\r
-            this.on("focus", this.preFocus, this);\r
-            this.el.on('mousedown', function(){\r
-                if(!this.hasFocus){\r
-                    this.el.on('mouseup', function(e){\r
-                        e.preventDefault();\r
-                    }, this, {single:true});\r
-                }\r
-            }, this);\r
-            if(this.emptyText){\r
-                this.on('blur', this.postBlur, this);\r
-                this.applyEmptyText();\r
-            }\r
-        }\r
-        if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype+'Mask']))){\r
-            this.el.on("keypress", this.filterKeys, this);\r
-        }\r
-        if(this.grow){\r
-            this.el.on("keyup", this.onKeyUpBuffered,  this, {buffer:50});\r
-            this.el.on("click", this.autoSize,  this);\r
-        }\r
-\r
-        if(this.enableKeyEvents){\r
-            this.el.on("keyup", this.onKeyUp, this);\r
-            this.el.on("keydown", this.onKeyDown, this);\r
-            this.el.on("keypress", this.onKeyPress, this);\r
-        }\r
-    },\r
-\r
-    processValue : function(value){\r
-        if(this.stripCharsRe){\r
-            var newValue = value.replace(this.stripCharsRe, '');\r
-            if(newValue !== value){\r
-                this.setRawValue(newValue);\r
-                return newValue;\r
-            }\r
-        }\r
-        return value;\r
-    },\r
-\r
-    filterValidation : function(e){\r
-        if(!e.isNavKeyPress()){\r
-            this.validationTask.delay(this.validationDelay);\r
-        }\r
-    },\r
-    \r
-    //private\r
-    onDisable: function(){\r
-        Ext.form.TextField.superclass.onDisable.call(this);\r
-        if(Ext.isIE){\r
-            this.el.dom.unselectable = 'on';\r
-        }\r
-    },\r
-    \r
-    //private\r
-    onEnable: function(){\r
-        Ext.form.TextField.superclass.onEnable.call(this);\r
-        if(Ext.isIE){\r
-            this.el.dom.unselectable = '';\r
-        }\r
-    },\r
-\r
-    // private\r
-    onKeyUpBuffered : function(e){\r
-        if(!e.isNavKeyPress()){\r
-            this.autoSize();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onKeyUp : function(e){\r
-        this.fireEvent('keyup', this, e);\r
-    },\r
-\r
-    // private\r
-    onKeyDown : function(e){\r
-        this.fireEvent('keydown', this, e);\r
-    },\r
-\r
-    // private\r
-    onKeyPress : function(e){\r
-        this.fireEvent('keypress', this, e);\r
-    },\r
-\r
-    \r
-    reset : function(){\r
-        Ext.form.TextField.superclass.reset.call(this);\r
-        this.applyEmptyText();\r
-    },\r
-\r
-    applyEmptyText : function(){\r
-        if(this.rendered && this.emptyText && this.getRawValue().length < 1 && !this.hasFocus){\r
-            this.setRawValue(this.emptyText);\r
-            this.el.addClass(this.emptyClass);\r
-        }\r
-    },\r
-\r
-    // private\r
-    preFocus : function(){\r
-        if(this.emptyText){\r
-            if(this.el.dom.value == this.emptyText){\r
-                this.setRawValue('');\r
-            }\r
-            this.el.removeClass(this.emptyClass);\r
-        }\r
-        if(this.selectOnFocus){\r
-            this.el.dom.select();\r
-        }\r
-    },\r
-\r
-    // private\r
-    postBlur : function(){\r
-        this.applyEmptyText();\r
-    },\r
-\r
-    // private\r
-    filterKeys : function(e){\r
-        if(e.ctrlKey){\r
-            return;\r
-        }\r
-        var k = e.getKey();\r
-        if(Ext.isGecko && (e.isNavKeyPress() || k == e.BACKSPACE || (k == e.DELETE && e.button == -1))){\r
-            return;\r
-        }\r
-        var c = e.getCharCode(), cc = String.fromCharCode(c);\r
-        if(!Ext.isGecko && e.isSpecialKey() && !cc){\r
-            return;\r
-        }\r
-        if(!this.maskRe.test(cc)){\r
-            e.stopEvent();\r
-        }\r
-    },\r
-\r
-    setValue : function(v){\r
-        if(this.emptyText && this.el && v !== undefined && v !== null && v !== ''){\r
-            this.el.removeClass(this.emptyClass);\r
-        }\r
-        Ext.form.TextField.superclass.setValue.apply(this, arguments);\r
-        this.applyEmptyText();\r
-        this.autoSize();\r
-    },\r
-\r
-    \r
-    validateValue : function(value){\r
-        if(value.length < 1 || value === this.emptyText){ // if it's blank\r
-             if(this.allowBlank){\r
-                 this.clearInvalid();\r
-                 return true;\r
-             }else{\r
-                 this.markInvalid(this.blankText);\r
-                 return false;\r
-             }\r
-        }\r
-        if(value.length < this.minLength){\r
-            this.markInvalid(String.format(this.minLengthText, this.minLength));\r
-            return false;\r
-        }\r
-        if(value.length > this.maxLength){\r
-            this.markInvalid(String.format(this.maxLengthText, this.maxLength));\r
-            return false;\r
-        }\r
-        if(this.vtype){\r
-            var vt = Ext.form.VTypes;\r
-            if(!vt[this.vtype](value, this)){\r
-                this.markInvalid(this.vtypeText || vt[this.vtype +'Text']);\r
-                return false;\r
-            }\r
-        }\r
-        if(typeof this.validator == "function"){\r
-            var msg = this.validator(value);\r
-            if(msg !== true){\r
-                this.markInvalid(msg);\r
-                return false;\r
-            }\r
-        }\r
-        if(this.regex && !this.regex.test(value)){\r
-            this.markInvalid(this.regexText);\r
-            return false;\r
-        }\r
-        return true;\r
-    },\r
-\r
-    \r
-    selectText : function(start, end){\r
-        var v = this.getRawValue();\r
-        var doFocus = false;\r
-        if(v.length > 0){\r
-            start = start === undefined ? 0 : start;\r
-            end = end === undefined ? v.length : end;\r
-            var d = this.el.dom;\r
-            if(d.setSelectionRange){\r
-                d.setSelectionRange(start, end);\r
-            }else if(d.createTextRange){\r
-                var range = d.createTextRange();\r
-                range.moveStart("character", start);\r
-                range.moveEnd("character", end-v.length);\r
-                range.select();\r
-            }\r
-            doFocus = Ext.isGecko || Ext.isOpera;\r
-        }else{\r
-            doFocus = true;\r
-        }\r
-        if(doFocus){\r
-            this.focus();\r
-        }\r
-    },\r
-\r
-    \r
-    autoSize : function(){\r
-        if(!this.grow || !this.rendered){\r
-            return;\r
-        }\r
-        if(!this.metrics){\r
-            this.metrics = Ext.util.TextMetrics.createInstance(this.el);\r
-        }\r
-        var el = this.el;\r
-        var v = el.dom.value;\r
-        var d = document.createElement('div');\r
-        d.appendChild(document.createTextNode(v));\r
-        v = d.innerHTML;\r
-        Ext.removeNode(d);\r
-        d = null;\r
-        v += "&#160;";\r
-        var w = Math.min(this.growMax, Math.max(this.metrics.getWidth(v) +  10, this.growMin));\r
-        this.el.setWidth(w);\r
-        this.fireEvent("autosize", this, w);\r
-    }\r
-});\r
-Ext.reg('textfield', Ext.form.TextField);\r
-\r
-\r
-Ext.form.TriggerField = Ext.extend(Ext.form.TextField,  {\r
-    \r
-    \r
-    defaultAutoCreate : {tag: "input", type: "text", size: "16", autocomplete: "off"},\r
-    \r
-    hideTrigger:false,\r
-\r
-    \r
-    autoSize: Ext.emptyFn,\r
-    // private\r
-    monitorTab : true,\r
-    // private\r
-    deferHeight : true,\r
-    // private\r
-    mimicing : false,\r
-\r
-    // private\r
-    onResize : function(w, h){\r
-        Ext.form.TriggerField.superclass.onResize.call(this, w, h);\r
-        if(typeof w == 'number'){\r
-            this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth()));\r
-        }\r
-        this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());\r
-    },\r
-\r
-    // private\r
-    adjustSize : Ext.BoxComponent.prototype.adjustSize,\r
-\r
-    // private\r
-    getResizeEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private\r
-    getPositionEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private\r
-    alignErrorIcon : function(){\r
-        if(this.wrap){\r
-            this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.form.TriggerField.superclass.onRender.call(this, ct, position);\r
-        this.wrap = this.el.wrap({cls: "x-form-field-wrap"});\r
-        this.trigger = this.wrap.createChild(this.triggerConfig ||\r
-                {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass});\r
-        if(this.hideTrigger){\r
-            this.trigger.setDisplayed(false);\r
-        }\r
-        this.initTrigger();\r
-        if(!this.width){\r
-            this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());\r
-        }\r
-    },\r
-\r
-    afterRender : function(){\r
-        Ext.form.TriggerField.superclass.afterRender.call(this);\r
-        var y;\r
-        if(Ext.isIE && !this.hideTrigger && this.el.getY() != (y = this.trigger.getY())){\r
-            this.el.position();\r
-            this.el.setY(y);\r
-        }\r
-    },\r
-\r
-    // private\r
-    initTrigger : function(){\r
-        this.trigger.on("click", this.onTriggerClick, this, {preventDefault:true});\r
-        this.trigger.addClassOnOver('x-form-trigger-over');\r
-        this.trigger.addClassOnClick('x-form-trigger-click');\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.trigger){\r
-            this.trigger.removeAllListeners();\r
-            this.trigger.remove();\r
-        }\r
-        if(this.wrap){\r
-            this.wrap.remove();\r
-        }\r
-        Ext.form.TriggerField.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    onFocus : function(){\r
-        Ext.form.TriggerField.superclass.onFocus.call(this);\r
-        if(!this.mimicing){\r
-            this.wrap.addClass('x-trigger-wrap-focus');\r
-            this.mimicing = true;\r
-            Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, {delay: 10});\r
-            if(this.monitorTab){\r
-                this.el.on("keydown", this.checkTab, this);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    checkTab : function(e){\r
-        if(e.getKey() == e.TAB){\r
-            this.triggerBlur();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onBlur : function(){\r
-        // do nothing\r
-    },\r
-\r
-    // private\r
-    mimicBlur : function(e){\r
-        if(!this.wrap.contains(e.target) && this.validateBlur(e)){\r
-            this.triggerBlur();\r
-        }\r
-    },\r
-\r
-    // private\r
-    triggerBlur : function(){\r
-        this.mimicing = false;\r
-        Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this);\r
-        if(this.monitorTab && this.el){\r
-            this.el.un("keydown", this.checkTab, this);\r
-        }\r
-        this.beforeBlur();\r
-        if(this.wrap){\r
-            this.wrap.removeClass('x-trigger-wrap-focus');\r
-        }\r
-        Ext.form.TriggerField.superclass.onBlur.call(this);\r
-    },\r
-\r
-    beforeBlur : Ext.emptyFn, \r
-\r
-    // private\r
-    // This should be overriden by any subclass that needs to check whether or not the field can be blurred.\r
-    validateBlur : function(e){\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        Ext.form.TriggerField.superclass.onDisable.call(this);\r
-        if(this.wrap){\r
-            this.wrap.addClass(this.disabledClass);\r
-            this.el.removeClass(this.disabledClass);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        Ext.form.TriggerField.superclass.onEnable.call(this);\r
-        if(this.wrap){\r
-            this.wrap.removeClass(this.disabledClass);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onShow : function(){\r
-        if(this.wrap){\r
-            this.wrap.dom.style.display = '';\r
-            this.wrap.dom.style.visibility = 'visible';\r
-        }\r
-    },\r
-\r
-    // private\r
-    onHide : function(){\r
-        this.wrap.dom.style.display = 'none';\r
-    },\r
-\r
-    \r
-    onTriggerClick : Ext.emptyFn\r
-\r
-    \r
-    \r
-    \r
-});\r
-\r
-// TwinTriggerField is not a public class to be used directly.  It is meant as an abstract base class\r
-// to be extended by an implementing class.  For an example of implementing this class, see the custom\r
-// SearchField implementation here: http://extjs.com/deploy/ext/examples/form/custom.html\r
-Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, {\r
-    initComponent : function(){\r
-        Ext.form.TwinTriggerField.superclass.initComponent.call(this);\r
-\r
-        this.triggerConfig = {\r
-            tag:'span', cls:'x-form-twin-triggers', cn:[\r
-            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},\r
-            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}\r
-        ]};\r
-    },\r
-\r
-    getTrigger : function(index){\r
-        return this.triggers[index];\r
-    },\r
-\r
-    initTrigger : function(){\r
-        var ts = this.trigger.select('.x-form-trigger', true);\r
-        this.wrap.setStyle('overflow', 'hidden');\r
-        var triggerField = this;\r
-        ts.each(function(t, all, index){\r
-            t.hide = function(){\r
-                var w = triggerField.wrap.getWidth();\r
-                this.dom.style.display = 'none';\r
-                triggerField.el.setWidth(w-triggerField.trigger.getWidth());\r
-            };\r
-            t.show = function(){\r
-                var w = triggerField.wrap.getWidth();\r
-                this.dom.style.display = '';\r
-                triggerField.el.setWidth(w-triggerField.trigger.getWidth());\r
-            };\r
-            var triggerIndex = 'Trigger'+(index+1);\r
-\r
-            if(this['hide'+triggerIndex]){\r
-                t.dom.style.display = 'none';\r
-            }\r
-            t.on("click", this['on'+triggerIndex+'Click'], this, {preventDefault:true});\r
-            t.addClassOnOver('x-form-trigger-over');\r
-            t.addClassOnClick('x-form-trigger-click');\r
-        }, this);\r
-        this.triggers = ts.elements;\r
-    },\r
-\r
-    onTrigger1Click : Ext.emptyFn,\r
-    onTrigger2Click : Ext.emptyFn\r
-});\r
-Ext.reg('trigger', Ext.form.TriggerField);\r
-\r
-Ext.form.TextArea = Ext.extend(Ext.form.TextField,  {\r
-    \r
-    growMin : 60,\r
-    \r
-    growMax: 1000,\r
-    growAppend : '&#160;\n&#160;',\r
-    growPad : 0,\r
-\r
-    enterIsSpecial : false,\r
-\r
-    \r
-    preventScrollbars: false,\r
-    \r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        if(!this.el){\r
-            this.defaultAutoCreate = {\r
-                tag: "textarea",\r
-                style:"width:100px;height:60px;",\r
-                autocomplete: "off"\r
-            };\r
-        }\r
-        Ext.form.TextArea.superclass.onRender.call(this, ct, position);\r
-        if(this.grow){\r
-            this.textSizeEl = Ext.DomHelper.append(document.body, {\r
-                tag: "pre", cls: "x-form-grow-sizer"\r
-            });\r
-            if(this.preventScrollbars){\r
-                this.el.setStyle("overflow", "hidden");\r
-            }\r
-            this.el.setHeight(this.growMin);\r
-        }\r
-    },\r
-\r
-    onDestroy : function(){\r
-        if(this.textSizeEl){\r
-            Ext.removeNode(this.textSizeEl);\r
-        }\r
-        Ext.form.TextArea.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    fireKey : function(e){\r
-        if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){\r
-            this.fireEvent("specialkey", this, e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onKeyUp : function(e){\r
-        if(!e.isNavKeyPress() || e.getKey() == e.ENTER){\r
-            this.autoSize();\r
-        }\r
-        Ext.form.TextArea.superclass.onKeyUp.call(this, e);\r
-    },\r
-\r
-    \r
-    autoSize : function(){\r
-        if(!this.grow || !this.textSizeEl){\r
-            return;\r
-        }\r
-        var el = this.el;\r
-        var v = el.dom.value;\r
-        var ts = this.textSizeEl;\r
-        ts.innerHTML = '';\r
-        ts.appendChild(document.createTextNode(v));\r
-        v = ts.innerHTML;\r
-\r
-        Ext.fly(ts).setWidth(this.el.getWidth());\r
-        if(v.length < 1){\r
-            v = "&#160;&#160;";\r
-        }else{\r
-            if(Ext.isIE){\r
-                v = v.replace(/\n/g, '<p>&#160;</p>');\r
-            }\r
-            v += this.growAppend;\r
-        }\r
-        ts.innerHTML = v;\r
-        var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin)+this.growPad);\r
-        if(h != this.lastHeight){\r
-            this.lastHeight = h;\r
-            this.el.setHeight(h);\r
-            this.fireEvent("autosize", this, h);\r
-        }\r
-    }\r
-});\r
-Ext.reg('textarea', Ext.form.TextArea);\r
-\r
-Ext.form.NumberField = Ext.extend(Ext.form.TextField,  {\r
-    \r
-    \r
-    fieldClass: "x-form-field x-form-num-field",\r
-    \r
-    allowDecimals : true,\r
-    \r
-    decimalSeparator : ".",\r
-    \r
-    decimalPrecision : 2,\r
-    \r
-    allowNegative : true,\r
-    \r
-    minValue : Number.NEGATIVE_INFINITY,\r
-    \r
-    maxValue : Number.MAX_VALUE,\r
-    \r
-    minText : "The minimum value for this field is {0}",\r
-    \r
-    maxText : "The maximum value for this field is {0}",\r
-    \r
-    nanText : "{0} is not a valid number",\r
-    \r
-    baseChars : "0123456789",\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.form.NumberField.superclass.initEvents.call(this);\r
-        var allowed = this.baseChars+'';\r
-        if(this.allowDecimals){\r
-            allowed += this.decimalSeparator;\r
-        }\r
-        if(this.allowNegative){\r
-            allowed += "-";\r
-        }\r
-        this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');\r
-        var keyPress = function(e){\r
-            var k = e.getKey();\r
-            if(!Ext.isIE && (e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){\r
-                return;\r
-            }\r
-            var c = e.getCharCode();\r
-            if(allowed.indexOf(String.fromCharCode(c)) === -1){\r
-                e.stopEvent();\r
-            }\r
-        };\r
-        this.el.on("keypress", keyPress, this);\r
-    },\r
-\r
-    // private\r
-    validateValue : function(value){\r
-        if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){\r
-            return false;\r
-        }\r
-        if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid\r
-             return true;\r
-        }\r
-        value = String(value).replace(this.decimalSeparator, ".");\r
-        if(isNaN(value)){\r
-            this.markInvalid(String.format(this.nanText, value));\r
-            return false;\r
-        }\r
-        var num = this.parseValue(value);\r
-        if(num < this.minValue){\r
-            this.markInvalid(String.format(this.minText, this.minValue));\r
-            return false;\r
-        }\r
-        if(num > this.maxValue){\r
-            this.markInvalid(String.format(this.maxText, this.maxValue));\r
-            return false;\r
-        }\r
-        return true;\r
-    },\r
-\r
-    getValue : function(){\r
-        return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));\r
-    },\r
-\r
-    setValue : function(v){\r
-       v = typeof v == 'number' ? v : parseFloat(String(v).replace(this.decimalSeparator, "."));\r
-        v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator);\r
-        Ext.form.NumberField.superclass.setValue.call(this, v);\r
-    },\r
-\r
-    // private\r
-    parseValue : function(value){\r
-        value = parseFloat(String(value).replace(this.decimalSeparator, "."));\r
-        return isNaN(value) ? '' : value;\r
-    },\r
-\r
-    // private\r
-    fixPrecision : function(value){\r
-        var nan = isNaN(value);\r
-        if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){\r
-           return nan ? '' : value;\r
-        }\r
-        return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));\r
-    },\r
-\r
-    beforeBlur : function(){\r
-        var v = this.parseValue(this.getRawValue());\r
-        if(v || v === 0){\r
-            this.setValue(this.fixPrecision(v));\r
-        }\r
-    }\r
-});\r
-Ext.reg('numberfield', Ext.form.NumberField);\r
-\r
-Ext.form.DateField = Ext.extend(Ext.form.TriggerField,  {\r
-    \r
-    format : "m/d/Y",\r
-    \r
-    altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",\r
-    \r
-    disabledDaysText : "Disabled",\r
-    \r
-    disabledDatesText : "Disabled",\r
-    \r
-    minText : "The date in this field must be equal to or after {0}",\r
-    \r
-    maxText : "The date in this field must be equal to or before {0}",\r
-    \r
-    invalidText : "{0} is not a valid date - it must be in the format {1}",\r
-    \r
-    triggerClass : 'x-form-date-trigger',\r
-    \r
-    showToday : true,\r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    // private\r
-    defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"},\r
-\r
-    initComponent : function(){\r
-        Ext.form.DateField.superclass.initComponent.call(this);\r
-        \r
-        this.addEvents(\r
-            \r
-            'select'\r
-        );\r
-        \r
-        if(typeof this.minValue == "string"){\r
-            this.minValue = this.parseDate(this.minValue);\r
-        }\r
-        if(typeof this.maxValue == "string"){\r
-            this.maxValue = this.parseDate(this.maxValue);\r
-        }\r
-        this.disabledDatesRE = null;\r
-        this.initDisabledDays();\r
-    },\r
-\r
-    // private\r
-    initDisabledDays : function(){\r
-        if(this.disabledDates){\r
-            var dd = this.disabledDates;\r
-            var re = "(?:";\r
-            for(var i = 0; i < dd.length; i++){\r
-                re += dd[i];\r
-                if(i != dd.length-1) re += "|";\r
-            }\r
-            this.disabledDatesRE = new RegExp(re + ")");\r
-        }\r
-    },\r
-\r
-    \r
-    setDisabledDates : function(dd){\r
-        this.disabledDates = dd;\r
-        this.initDisabledDays();\r
-        if(this.menu){\r
-            this.menu.picker.setDisabledDates(this.disabledDatesRE);\r
-        }\r
-    },\r
-\r
-    \r
-    setDisabledDays : function(dd){\r
-        this.disabledDays = dd;\r
-        if(this.menu){\r
-            this.menu.picker.setDisabledDays(dd);\r
-        }\r
-    },\r
-\r
-    \r
-    setMinValue : function(dt){\r
-        this.minValue = (typeof dt == "string" ? this.parseDate(dt) : dt);\r
-        if(this.menu){\r
-            this.menu.picker.setMinDate(this.minValue);\r
-        }\r
-    },\r
-\r
-    \r
-    setMaxValue : function(dt){\r
-        this.maxValue = (typeof dt == "string" ? this.parseDate(dt) : dt);\r
-        if(this.menu){\r
-            this.menu.picker.setMaxDate(this.maxValue);\r
-        }\r
-    },\r
-\r
-    // private\r
-    validateValue : function(value){\r
-        value = this.formatDate(value);\r
-        if(!Ext.form.DateField.superclass.validateValue.call(this, value)){\r
-            return false;\r
-        }\r
-        if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid\r
-             return true;\r
-        }\r
-        var svalue = value;\r
-        value = this.parseDate(value);\r
-        if(!value){\r
-            this.markInvalid(String.format(this.invalidText, svalue, this.format));\r
-            return false;\r
-        }\r
-        var time = value.getTime();\r
-        if(this.minValue && time < this.minValue.getTime()){\r
-            this.markInvalid(String.format(this.minText, this.formatDate(this.minValue)));\r
-            return false;\r
-        }\r
-        if(this.maxValue && time > this.maxValue.getTime()){\r
-            this.markInvalid(String.format(this.maxText, this.formatDate(this.maxValue)));\r
-            return false;\r
-        }\r
-        if(this.disabledDays){\r
-            var day = value.getDay();\r
-            for(var i = 0; i < this.disabledDays.length; i++) {\r
-               if(day === this.disabledDays[i]){\r
-                   this.markInvalid(this.disabledDaysText);\r
-                    return false;\r
-               }\r
-            }\r
-        }\r
-        var fvalue = this.formatDate(value);\r
-        if(this.disabledDatesRE && this.disabledDatesRE.test(fvalue)){\r
-            this.markInvalid(String.format(this.disabledDatesText, fvalue));\r
-            return false;\r
-        }\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    // Provides logic to override the default TriggerField.validateBlur which just returns true\r
-    validateBlur : function(){\r
-        return !this.menu || !this.menu.isVisible();\r
-    },\r
-\r
-    \r
-    getValue : function(){\r
-        return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || "";\r
-    },\r
-\r
-    \r
-    setValue : function(date){\r
-        Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));\r
-    },\r
-\r
-    // private\r
-    parseDate : function(value){\r
-        if(!value || Ext.isDate(value)){\r
-            return value;\r
-        }\r
-        var v = Date.parseDate(value, this.format);\r
-        if(!v && this.altFormats){\r
-            if(!this.altFormatsArray){\r
-                this.altFormatsArray = this.altFormats.split("|");\r
-            }\r
-            for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){\r
-                v = Date.parseDate(value, this.altFormatsArray[i]);\r
-            }\r
-        }\r
-        return v;\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.menu) {\r
-            this.menu.destroy();\r
-        }\r
-        if(this.wrap){\r
-            this.wrap.remove();\r
-        }\r
-        Ext.form.DateField.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    formatDate : function(date){\r
-        return Ext.isDate(date) ? date.dateFormat(this.format) : date;\r
-    },\r
-\r
-    // private\r
-    menuListeners : {\r
-        select: function(m, d){\r
-            this.setValue(d);\r
-            this.fireEvent('select', this, d);\r
-        },\r
-        show : function(){ // retain focus styling\r
-            this.onFocus();\r
-        },\r
-        hide : function(){\r
-            this.focus.defer(10, this);\r
-            var ml = this.menuListeners;\r
-            this.menu.un("select", ml.select,  this);\r
-            this.menu.un("show", ml.show,  this);\r
-            this.menu.un("hide", ml.hide,  this);\r
-        }\r
-    },\r
-\r
-    \r
-    // private\r
-    // Implements the default empty TriggerField.onTriggerClick function to display the DatePicker\r
-    onTriggerClick : function(){\r
-        if(this.disabled){\r
-            return;\r
-        }\r
-        if(this.menu == null){\r
-            this.menu = new Ext.menu.DateMenu();\r
-        }\r
-        Ext.apply(this.menu.picker,  {\r
-            minDate : this.minValue,\r
-            maxDate : this.maxValue,\r
-            disabledDatesRE : this.disabledDatesRE,\r
-            disabledDatesText : this.disabledDatesText,\r
-            disabledDays : this.disabledDays,\r
-            disabledDaysText : this.disabledDaysText,\r
-            format : this.format,\r
-            showToday : this.showToday,\r
-            minText : String.format(this.minText, this.formatDate(this.minValue)),\r
-            maxText : String.format(this.maxText, this.formatDate(this.maxValue))\r
-        });\r
-        this.menu.on(Ext.apply({}, this.menuListeners, {\r
-            scope:this\r
-        }));\r
-        this.menu.picker.setValue(this.getValue() || new Date());\r
-        this.menu.show(this.el, "tl-bl?");\r
-    },\r
-\r
-    // private\r
-    beforeBlur : function(){\r
-        var v = this.parseDate(this.getRawValue());\r
-        if(v){\r
-            this.setValue(v);\r
-        }\r
-    }\r
-\r
-    \r
-    \r
-    \r
-    \r
-});\r
-Ext.reg('datefield', Ext.form.DateField);\r
-\r
-Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    // private\r
-    defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    listClass: '',\r
-    \r
-    selectedClass: 'x-combo-selected',\r
-    \r
-    triggerClass : 'x-form-arrow-trigger',\r
-    \r
-    shadow:'sides',\r
-    \r
-    listAlign: 'tl-bl?',\r
-    \r
-    maxHeight: 300,\r
-    \r
-    minHeight: 90,\r
-    \r
-    triggerAction: 'query',\r
-    \r
-    minChars : 4,\r
-    \r
-    typeAhead: false,\r
-    \r
-    queryDelay: 500,\r
-    \r
-    pageSize: 0,\r
-    \r
-    selectOnFocus:false,\r
-    \r
-    queryParam: 'query',\r
-    \r
-    loadingText: 'Loading...',\r
-    \r
-    resizable: false,\r
-    \r
-    handleHeight : 8,\r
-    \r
-    editable: true,\r
-    \r
-    allQuery: '',\r
-    \r
-    mode: 'remote',\r
-    \r
-    minListWidth : 70,\r
-    \r
-    forceSelection:false,\r
-    \r
-    typeAheadDelay : 250,\r
-    \r
-\r
-    \r
-    lazyInit : true,\r
-\r
-    \r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.form.ComboBox.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            'expand',\r
-            \r
-            'collapse',\r
-            \r
-            'beforeselect',\r
-            \r
-            'select',\r
-            \r
-            'beforequery'\r
-        );\r
-        if(this.transform){\r
-            this.allowDomMove = false;\r
-            var s = Ext.getDom(this.transform);\r
-            if(!this.hiddenName){\r
-                this.hiddenName = s.name;\r
-            }\r
-            if(!this.store){\r
-                this.mode = 'local';\r
-                var d = [], opts = s.options;\r
-                for(var i = 0, len = opts.length;i < len; i++){\r
-                    var o = opts[i];\r
-                    var value = (Ext.isIE ? o.getAttributeNode('value').specified : o.hasAttribute('value')) ? o.value : o.text;\r
-                    if(o.selected) {\r
-                        this.value = value;\r
-                    }\r
-                    d.push([value, o.text]);\r
-                }\r
-                this.store = new Ext.data.SimpleStore({\r
-                    'id': 0,\r
-                    fields: ['value', 'text'],\r
-                    data : d\r
-                });\r
-                this.valueField = 'value';\r
-                this.displayField = 'text';\r
-            }\r
-            s.name = Ext.id(); // wipe out the name in case somewhere else they have a reference\r
-            if(!this.lazyRender){\r
-                this.target = true;\r
-                this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);\r
-                Ext.removeNode(s); // remove it\r
-                this.render(this.el.parentNode);\r
-            }else{\r
-                Ext.removeNode(s); // remove it\r
-            }\r
-        }\r
-        //auto-configure store from local array data\r
-        else if(Ext.isArray(this.store)){\r
-            if (Ext.isArray(this.store[0])){\r
-                this.store = new Ext.data.SimpleStore({\r
-                    fields: ['value','text'],\r
-                    data: this.store\r
-                });\r
-                this.valueField = 'value';\r
-            }else{\r
-                this.store = new Ext.data.SimpleStore({\r
-                    fields: ['text'],\r
-                    data: this.store,\r
-                    expandData: true\r
-                });\r
-                this.valueField = 'text';\r
-            }\r
-            this.displayField = 'text';\r
-            this.mode = 'local';\r
-        }\r
-\r
-        this.selectedIndex = -1;\r
-        if(this.mode == 'local'){\r
-            if(this.initialConfig.queryDelay === undefined){\r
-                this.queryDelay = 10;\r
-            }\r
-            if(this.initialConfig.minChars === undefined){\r
-                this.minChars = 0;\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.form.ComboBox.superclass.onRender.call(this, ct, position);\r
-        if(this.hiddenName){\r
-            this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName,\r
-                    id: (this.hiddenId||this.hiddenName)}, 'before', true);\r
-\r
-            // prevent input submission\r
-            this.el.dom.removeAttribute('name');\r
-        }\r
-        if(Ext.isGecko){\r
-            this.el.dom.setAttribute('autocomplete', 'off');\r
-        }\r
-\r
-        if(!this.lazyInit){\r
-            this.initList();\r
-        }else{\r
-            this.on('focus', this.initList, this, {single: true});\r
-        }\r
-\r
-        if(!this.editable){\r
-            this.editable = true;\r
-            this.setEditable(false);\r
-        }\r
-    },\r
-\r
-    // private\r
-    initValue : function(){\r
-        Ext.form.ComboBox.superclass.initValue.call(this);\r
-        if(this.hiddenField){\r
-            this.hiddenField.value =\r
-                this.hiddenValue !== undefined ? this.hiddenValue :\r
-                this.value !== undefined ? this.value : '';\r
-        }\r
-    },\r
-\r
-    // private\r
-    initList : function(){\r
-        if(!this.list){\r
-            var cls = 'x-combo-list';\r
-\r
-            this.list = new Ext.Layer({\r
-                shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false\r
-            });\r
-\r
-            var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);\r
-            this.list.setWidth(lw);\r
-            this.list.swallowEvent('mousewheel');\r
-            this.assetHeight = 0;\r
-\r
-            if(this.title){\r
-                this.header = this.list.createChild({cls:cls+'-hd', html: this.title});\r
-                this.assetHeight += this.header.getHeight();\r
-            }\r
-\r
-            this.innerList = this.list.createChild({cls:cls+'-inner'});\r
-            this.innerList.on('mouseover', this.onViewOver, this);\r
-            this.innerList.on('mousemove', this.onViewMove, this);\r
-            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));\r
-\r
-            if(this.pageSize){\r
-                this.footer = this.list.createChild({cls:cls+'-ft'});\r
-                this.pageTb = new Ext.PagingToolbar({\r
-                    store:this.store,\r
-                    pageSize: this.pageSize,\r
-                    renderTo:this.footer\r
-                });\r
-                this.assetHeight += this.footer.getHeight();\r
-            }\r
-\r
-            if(!this.tpl){\r
-                \r
-                this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>';\r
-                \r
-            }\r
-\r
-            \r
-            this.view = new Ext.DataView({\r
-                applyTo: this.innerList,\r
-                tpl: this.tpl,\r
-                singleSelect: true,\r
-                selectedClass: this.selectedClass,\r
-                itemSelector: this.itemSelector || '.' + cls + '-item'\r
-            });\r
-\r
-            this.view.on('click', this.onViewClick, this);\r
-\r
-            this.bindStore(this.store, true);\r
-\r
-            if(this.resizable){\r
-                this.resizer = new Ext.Resizable(this.list,  {\r
-                   pinned:true, handles:'se'\r
-                });\r
-                this.resizer.on('resize', function(r, w, h){\r
-                    this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;\r
-                    this.listWidth = w;\r
-                    this.innerList.setWidth(w - this.list.getFrameWidth('lr'));\r
-                    this.restrictHeight();\r
-                }, this);\r
-                this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');\r
-            }\r
-        }\r
-    },\r
-    \r
-    \r
-    getStore : function(){\r
-        return this.store;\r
-    },\r
-\r
-    // private\r
-    bindStore : function(store, initial){\r
-        if(this.store && !initial){\r
-            this.store.un('beforeload', this.onBeforeLoad, this);\r
-            this.store.un('load', this.onLoad, this);\r
-            this.store.un('loadexception', this.collapse, this);\r
-            if(!store){\r
-                this.store = null;\r
-                if(this.view){\r
-                    this.view.setStore(null);\r
-                }\r
-            }\r
-        }\r
-        if(store){\r
-            this.store = Ext.StoreMgr.lookup(store);\r
-\r
-            this.store.on('beforeload', this.onBeforeLoad, this);\r
-            this.store.on('load', this.onLoad, this);\r
-            this.store.on('loadexception', this.collapse, this);\r
-\r
-            if(this.view){\r
-                this.view.setStore(store);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.form.ComboBox.superclass.initEvents.call(this);\r
-\r
-        this.keyNav = new Ext.KeyNav(this.el, {\r
-            "up" : function(e){\r
-                this.inKeyMode = true;\r
-                this.selectPrev();\r
-            },\r
-\r
-            "down" : function(e){\r
-                if(!this.isExpanded()){\r
-                    this.onTriggerClick();\r
-                }else{\r
-                    this.inKeyMode = true;\r
-                    this.selectNext();\r
-                }\r
-            },\r
-\r
-            "enter" : function(e){\r
-                this.onViewClick();\r
-                this.delayedCheck = true;\r
-                this.unsetDelayCheck.defer(10, this);\r
-            },\r
-\r
-            "esc" : function(e){\r
-                this.collapse();\r
-            },\r
-\r
-            "tab" : function(e){\r
-                this.onViewClick(false);\r
-                return true;\r
-            },\r
-\r
-            scope : this,\r
-\r
-            doRelay : function(foo, bar, hname){\r
-                if(hname == 'down' || this.scope.isExpanded()){\r
-                   return Ext.KeyNav.prototype.doRelay.apply(this, arguments);\r
-                }\r
-                return true;\r
-            },\r
-\r
-            forceKeyDown : true\r
-        });\r
-        this.queryDelay = Math.max(this.queryDelay || 10,\r
-                this.mode == 'local' ? 10 : 250);\r
-        this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);\r
-        if(this.typeAhead){\r
-            this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);\r
-        }\r
-        if(this.editable !== false){\r
-            this.el.on("keyup", this.onKeyUp, this);\r
-        }\r
-        if(this.forceSelection){\r
-            this.on('blur', this.doForce, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.view){\r
-            Ext.destroy(this.view);\r
-        }\r
-        if(this.list){\r
-            if(this.innerList){\r
-                this.innerList.un('mouseover', this.onViewOver, this);\r
-                this.innerList.un('mousemove', this.onViewMove, this);\r
-            }\r
-            this.list.destroy();\r
-        }\r
-        if (this.dqTask){\r
-            this.dqTask.cancel();\r
-            this.dqTask = null;\r
-        }\r
-        this.bindStore(null);\r
-        Ext.form.ComboBox.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    unsetDelayCheck : function(){\r
-        delete this.delayedCheck;\r
-    },\r
-\r
-    // private\r
-    fireKey : function(e){\r
-        if(e.isNavKeyPress() && !this.isExpanded() && !this.delayedCheck){\r
-            this.fireEvent("specialkey", this, e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onResize: function(w, h){\r
-        Ext.form.ComboBox.superclass.onResize.apply(this, arguments);\r
-        if(this.list && this.listWidth === undefined){\r
-            var lw = Math.max(w, this.minListWidth);\r
-            this.list.setWidth(lw);\r
-            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));\r
-        }\r
-    },\r
-\r
-    // private\r
-    onEnable: function(){\r
-        Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);\r
-        if(this.hiddenField){\r
-            this.hiddenField.disabled = false;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onDisable: function(){\r
-        Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);\r
-        if(this.hiddenField){\r
-            this.hiddenField.disabled = true;\r
-        }\r
-    },\r
-\r
-    \r
-    setEditable : function(value){\r
-        if(value == this.editable){\r
-            return;\r
-        }\r
-        this.editable = value;\r
-        if(!value){\r
-            this.el.dom.setAttribute('readOnly', true);\r
-            this.el.on('mousedown', this.onTriggerClick,  this);\r
-            this.el.addClass('x-combo-noedit');\r
-        }else{\r
-            this.el.dom.removeAttribute('readOnly');\r
-            this.el.un('mousedown', this.onTriggerClick,  this);\r
-            this.el.removeClass('x-combo-noedit');\r
-        }\r
-    },\r
-\r
-    // private\r
-    onBeforeLoad : function(){\r
-        if(!this.hasFocus){\r
-            return;\r
-        }\r
-        this.innerList.update(this.loadingText ?\r
-               '<div class="loading-indicator">'+this.loadingText+'</div>' : '');\r
-        this.restrictHeight();\r
-        this.selectedIndex = -1;\r
-    },\r
-\r
-    // private\r
-    onLoad : function(){\r
-        if(!this.hasFocus){\r
-            return;\r
-        }\r
-        if(this.store.getCount() > 0){\r
-            this.expand();\r
-            this.restrictHeight();\r
-            if(this.lastQuery == this.allQuery){\r
-                if(this.editable){\r
-                    this.el.dom.select();\r
-                }\r
-                if(!this.selectByValue(this.value, true)){\r
-                    this.select(0, true);\r
-                }\r
-            }else{\r
-                this.selectNext();\r
-                if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){\r
-                    this.taTask.delay(this.typeAheadDelay);\r
-                }\r
-            }\r
-        }else{\r
-            this.onEmptyResults();\r
-        }\r
-        //this.el.focus();\r
-    },\r
-\r
-    // private\r
-    onTypeAhead : function(){\r
-        if(this.store.getCount() > 0){\r
-            var r = this.store.getAt(0);\r
-            var newValue = r.data[this.displayField];\r
-            var len = newValue.length;\r
-            var selStart = this.getRawValue().length;\r
-            if(selStart != len){\r
-                this.setRawValue(newValue);\r
-                this.selectText(selStart, newValue.length);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onSelect : function(record, index){\r
-        if(this.fireEvent('beforeselect', this, record, index) !== false){\r
-            this.setValue(record.data[this.valueField || this.displayField]);\r
-            this.collapse();\r
-            this.fireEvent('select', this, record, index);\r
-        }\r
-    },\r
-\r
-    \r
-    getValue : function(){\r
-        if(this.valueField){\r
-            return typeof this.value != 'undefined' ? this.value : '';\r
-        }else{\r
-            return Ext.form.ComboBox.superclass.getValue.call(this);\r
-        }\r
-    },\r
-\r
-    \r
-    clearValue : function(){\r
-        if(this.hiddenField){\r
-            this.hiddenField.value = '';\r
-        }\r
-        this.setRawValue('');\r
-        this.lastSelectionText = '';\r
-        this.applyEmptyText();\r
-        this.value = '';\r
-    },\r
-\r
-    \r
-    setValue : function(v){\r
-        var text = v;\r
-        if(this.valueField){\r
-            var r = this.findRecord(this.valueField, v);\r
-            if(r){\r
-                text = r.data[this.displayField];\r
-            }else if(this.valueNotFoundText !== undefined){\r
-                text = this.valueNotFoundText;\r
-            }\r
-        }\r
-        this.lastSelectionText = text;\r
-        if(this.hiddenField){\r
-            this.hiddenField.value = v;\r
-        }\r
-        Ext.form.ComboBox.superclass.setValue.call(this, text);\r
-        this.value = v;\r
-    },\r
-\r
-    // private\r
-    findRecord : function(prop, value){\r
-        var record;\r
-        if(this.store.getCount() > 0){\r
-            this.store.each(function(r){\r
-                if(r.data[prop] == value){\r
-                    record = r;\r
-                    return false;\r
-                }\r
-            });\r
-        }\r
-        return record;\r
-    },\r
-\r
-    // private\r
-    onViewMove : function(e, t){\r
-        this.inKeyMode = false;\r
-    },\r
-\r
-    // private\r
-    onViewOver : function(e, t){\r
-        if(this.inKeyMode){ // prevent key nav and mouse over conflicts\r
-            return;\r
-        }\r
-        var item = this.view.findItemFromChild(t);\r
-        if(item){\r
-            var index = this.view.indexOf(item);\r
-            this.select(index, false);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onViewClick : function(doFocus){\r
-        var index = this.view.getSelectedIndexes()[0];\r
-        var r = this.store.getAt(index);\r
-        if(r){\r
-            this.onSelect(r, index);\r
-        }\r
-        if(doFocus !== false){\r
-            this.el.focus();\r
-        }\r
-    },\r
-\r
-    // private\r
-    restrictHeight : function(){\r
-        this.innerList.dom.style.height = '';\r
-        var inner = this.innerList.dom;\r
-        var pad = this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight;\r
-        var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);\r
-        var ha = this.getPosition()[1]-Ext.getBody().getScroll().top;\r
-        var hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;\r
-        var space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadowOffset-pad-5;\r
-        h = Math.min(h, space, this.maxHeight);\r
-\r
-        this.innerList.setHeight(h);\r
-        this.list.beginUpdate();\r
-        this.list.setHeight(h+pad);\r
-        this.list.alignTo(this.wrap, this.listAlign);\r
-        this.list.endUpdate();\r
-    },\r
-\r
-    // private\r
-    onEmptyResults : function(){\r
-        this.collapse();\r
-    },\r
-\r
-    \r
-    isExpanded : function(){\r
-        return this.list && this.list.isVisible();\r
-    },\r
-\r
-    \r
-    selectByValue : function(v, scrollIntoView){\r
-        if(v !== undefined && v !== null){\r
-            var r = this.findRecord(this.valueField || this.displayField, v);\r
-            if(r){\r
-                this.select(this.store.indexOf(r), scrollIntoView);\r
-                return true;\r
-            }\r
-        }\r
-        return false;\r
-    },\r
-\r
-    \r
-    select : function(index, scrollIntoView){\r
-        this.selectedIndex = index;\r
-        this.view.select(index);\r
-        if(scrollIntoView !== false){\r
-            var el = this.view.getNode(index);\r
-            if(el){\r
-                this.innerList.scrollChildIntoView(el, false);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    selectNext : function(){\r
-        var ct = this.store.getCount();\r
-        if(ct > 0){\r
-            if(this.selectedIndex == -1){\r
-                this.select(0);\r
-            }else if(this.selectedIndex < ct-1){\r
-                this.select(this.selectedIndex+1);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    selectPrev : function(){\r
-        var ct = this.store.getCount();\r
-        if(ct > 0){\r
-            if(this.selectedIndex == -1){\r
-                this.select(0);\r
-            }else if(this.selectedIndex != 0){\r
-                this.select(this.selectedIndex-1);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onKeyUp : function(e){\r
-        if(this.editable !== false && !e.isSpecialKey()){\r
-            this.lastKey = e.getKey();\r
-            this.dqTask.delay(this.queryDelay);\r
-        }\r
-    },\r
-\r
-    // private\r
-    validateBlur : function(){\r
-        return !this.list || !this.list.isVisible();\r
-    },\r
-\r
-    // private\r
-    initQuery : function(){\r
-        this.doQuery(this.getRawValue());\r
-    },\r
-\r
-    // private\r
-    doForce : function(){\r
-        if(this.el.dom.value.length > 0){\r
-            this.el.dom.value =\r
-                this.lastSelectionText === undefined ? '' : this.lastSelectionText;\r
-            this.applyEmptyText();\r
-        }\r
-    },\r
-\r
-    \r
-    doQuery : function(q, forceAll){\r
-        if(q === undefined || q === null){\r
-            q = '';\r
-        }\r
-        var qe = {\r
-            query: q,\r
-            forceAll: forceAll,\r
-            combo: this,\r
-            cancel:false\r
-        };\r
-        if(this.fireEvent('beforequery', qe)===false || qe.cancel){\r
-            return false;\r
-        }\r
-        q = qe.query;\r
-        forceAll = qe.forceAll;\r
-        if(forceAll === true || (q.length >= this.minChars)){\r
-            if(this.lastQuery !== q){\r
-                this.lastQuery = q;\r
-                if(this.mode == 'local'){\r
-                    this.selectedIndex = -1;\r
-                    if(forceAll){\r
-                        this.store.clearFilter();\r
-                    }else{\r
-                        this.store.filter(this.displayField, q);\r
-                    }\r
-                    this.onLoad();\r
-                }else{\r
-                    this.store.baseParams[this.queryParam] = q;\r
-                    this.store.load({\r
-                        params: this.getParams(q)\r
-                    });\r
-                    this.expand();\r
-                }\r
-            }else{\r
-                this.selectedIndex = -1;\r
-                this.onLoad();\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getParams : function(q){\r
-        var p = {};\r
-        //p[this.queryParam] = q;\r
-        if(this.pageSize){\r
-            p.start = 0;\r
-            p.limit = this.pageSize;\r
-        }\r
-        return p;\r
-    },\r
-\r
-    \r
-    collapse : function(){\r
-        if(!this.isExpanded()){\r
-            return;\r
-        }\r
-        this.list.hide();\r
-        Ext.getDoc().un('mousewheel', this.collapseIf, this);\r
-        Ext.getDoc().un('mousedown', this.collapseIf, this);\r
-        this.fireEvent('collapse', this);\r
-    },\r
-\r
-    // private\r
-    collapseIf : function(e){\r
-        if(!e.within(this.wrap) && !e.within(this.list)){\r
-            this.collapse();\r
-        }\r
-    },\r
-\r
-    \r
-    expand : function(){\r
-        if(this.isExpanded() || !this.hasFocus){\r
-            return;\r
-        }\r
-        this.list.alignTo(this.wrap, this.listAlign);\r
-        this.list.show();\r
-        this.innerList.setOverflow('auto'); // necessary for FF 2.0/Mac\r
-        Ext.getDoc().on('mousewheel', this.collapseIf, this);\r
-        Ext.getDoc().on('mousedown', this.collapseIf, this);\r
-        this.fireEvent('expand', this);\r
-    },\r
-\r
-    \r
-    // private\r
-    // Implements the default empty TriggerField.onTriggerClick function\r
-    onTriggerClick : function(){\r
-        if(this.disabled){\r
-            return;\r
-        }\r
-        if(this.isExpanded()){\r
-            this.collapse();\r
-            this.el.focus();\r
-        }else {\r
-            this.onFocus({});\r
-            if(this.triggerAction == 'all') {\r
-                this.doQuery(this.allQuery, true);\r
-            } else {\r
-                this.doQuery(this.getRawValue());\r
-            }\r
-            this.el.focus();\r
-        }\r
-    }\r
-\r
-    \r
-    \r
-    \r
-    \r
-\r
-});\r
-Ext.reg('combo', Ext.form.ComboBox);\r
-\r
-Ext.form.Checkbox = Ext.extend(Ext.form.Field,  {\r
-    \r
-    checkedCls: 'x-form-check-checked',\r
-    \r
-    focusCls: 'x-form-check-focus',\r
-    \r
-    overCls: 'x-form-check-over',\r
-    \r
-    mouseDownCls: 'x-form-check-down',\r
-    \r
-    tabIndex: 0,\r
-    \r
-    checked: false,\r
-    \r
-    defaultAutoCreate: {tag: 'input', type: 'checkbox', autocomplete: 'off'},\r
-    \r
-    \r
-    \r
-    \r
-\r
-\r
-    // private\r
-    baseCls: 'x-form-check',\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.form.Checkbox.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            'check'\r
-        );\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.form.Checkbox.superclass.initEvents.call(this);\r
-        this.initCheckEvents();\r
-    },\r
-\r
-    // private\r
-    initCheckEvents : function(){\r
-        this.innerWrap.removeAllListeners();\r
-        this.innerWrap.addClassOnOver(this.overCls);\r
-        this.innerWrap.addClassOnClick(this.mouseDownCls);\r
-        this.innerWrap.on('click', this.onClick, this);\r
-        this.innerWrap.on('keyup', this.onKeyUp, this);\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.form.Checkbox.superclass.onRender.call(this, ct, position);\r
-        if(this.inputValue !== undefined){\r
-            this.el.dom.value = this.inputValue;\r
-        }\r
-        this.el.addClass('x-hidden');\r
-\r
-        this.innerWrap = this.el.wrap({\r
-            tabIndex: this.tabIndex,\r
-            cls: this.baseCls+'-wrap-inner'\r
-        });\r
-        this.wrap = this.innerWrap.wrap({cls: this.baseCls+'-wrap'});\r
-\r
-        if(this.boxLabel){\r
-            this.labelEl = this.innerWrap.createChild({\r
-                tag: 'label',\r
-                htmlFor: this.el.id,\r
-                cls: 'x-form-cb-label',\r
-                html: this.boxLabel\r
-            });\r
-        }\r
-\r
-        this.imageEl = this.innerWrap.createChild({\r
-            tag: 'img',\r
-            src: Ext.BLANK_IMAGE_URL,\r
-            cls: this.baseCls\r
-        }, this.el);\r
-\r
-        if(this.checked){\r
-            this.setValue(true);\r
-        }else{\r
-            this.checked = this.el.dom.checked;\r
-        }\r
-        this.originalValue = this.checked;\r
-    },\r
-    \r
-    // private\r
-    afterRender : function(){\r
-        Ext.form.Checkbox.superclass.afterRender.call(this);\r
-        this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls);\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.rendered){\r
-            Ext.destroy(this.imageEl, this.labelEl, this.innerWrap, this.wrap);\r
-        }\r
-        Ext.form.Checkbox.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    onFocus: function(e) {\r
-        Ext.form.Checkbox.superclass.onFocus.call(this, e);\r
-        this.el.addClass(this.focusCls);\r
-    },\r
-\r
-    // private\r
-    onBlur: function(e) {\r
-        Ext.form.Checkbox.superclass.onBlur.call(this, e);\r
-        this.el.removeClass(this.focusCls);\r
-    },\r
-\r
-    // private\r
-    onResize : function(){\r
-        Ext.form.Checkbox.superclass.onResize.apply(this, arguments);\r
-        if(!this.boxLabel && !this.fieldLabel){\r
-            this.el.alignTo(this.wrap, 'c-c');\r
-        }\r
-    },\r
-\r
-    // private\r
-    onKeyUp : function(e){\r
-        if(e.getKey() == Ext.EventObject.SPACE){\r
-            this.onClick(e);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        if (!this.disabled && !this.readOnly) {\r
-            this.toggleValue();\r
-        }\r
-        e.stopEvent();\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        Ext.form.Checkbox.superclass.onEnable.call(this);\r
-        this.initCheckEvents();\r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        Ext.form.Checkbox.superclass.onDisable.call(this);\r
-        this.innerWrap.removeAllListeners();\r
-    },\r
-\r
-    toggleValue : function(){\r
-        this.setValue(!this.checked);\r
-    },\r
-\r
-    // private\r
-    getResizeEl : function(){\r
-        if(!this.resizeEl){\r
-            this.resizeEl = Ext.isSafari ? this.wrap : (this.wrap.up('.x-form-element', 5) || this.wrap);\r
-        }\r
-        return this.resizeEl;\r
-    },\r
-\r
-    // private\r
-    getPositionEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private\r
-    getActionEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    \r
-    markInvalid : Ext.emptyFn,\r
-    \r
-    clearInvalid : Ext.emptyFn,\r
-\r
-    // private\r
-    initValue : Ext.emptyFn,\r
-\r
-    \r
-    getValue : function(){\r
-        if(this.rendered){\r
-            return this.el.dom.checked;\r
-        }\r
-        return this.checked;\r
-    },\r
-\r
-    \r
-    setValue : function(v) {\r
-        var checked = this.checked;\r
-        this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');\r
-        \r
-        if(this.rendered){\r
-            this.el.dom.checked = this.checked;\r
-            this.el.dom.defaultChecked = this.checked;\r
-            this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls);\r
-        }\r
-\r
-        if(checked != this.checked){\r
-            this.fireEvent("check", this, this.checked);\r
-            if(this.handler){\r
-                this.handler.call(this.scope || this, this, this.checked);\r
-            }\r
-        }\r
-    }\r
-\r
-    \r
-    \r
-    \r
-});\r
-Ext.reg('checkbox', Ext.form.Checkbox);\r
-\r
-\r
-Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, {\r
-    \r
-    \r
-    columns : 'auto',\r
-    \r
-    vertical : false,\r
-    \r
-    allowBlank : true,\r
-    \r
-    blankText : "You must select at least one item in this group",\r
-    \r
-    // private\r
-    defaultType : 'checkbox',\r
-    \r
-    // private\r
-    groupCls: 'x-form-check-group',\r
-    \r
-    // private\r
-    onRender : function(ct, position){\r
-        if(!this.el){\r
-            var panelCfg = {\r
-                cls: this.groupCls,\r
-                layout: 'column',\r
-                border: false,\r
-                renderTo: ct\r
-            };\r
-            var colCfg = {\r
-                defaultType: this.defaultType,\r
-                layout: 'form',\r
-                border: false,\r
-                defaults: {\r
-                    hideLabel: true,\r
-                    anchor: '100%'\r
-                }\r
-            }\r
-            \r
-            if(this.items[0].items){\r
-                \r
-                // The container has standard ColumnLayout configs, so pass them in directly\r
-                \r
-                Ext.apply(panelCfg, {\r
-                    layoutConfig: {columns: this.items.length},\r
-                    defaults: this.defaults,\r
-                    items: this.items\r
-                })\r
-                for(var i=0, len=this.items.length; i<len; i++){\r
-                    Ext.applyIf(this.items[i], colCfg);\r
-                };\r
-                \r
-            }else{\r
-                \r
-                // The container has field item configs, so we have to generate the column\r
-                // panels first then move the items into the columns as needed.\r
-                \r
-                var numCols, cols = [];\r
-                \r
-                if(typeof this.columns == 'string'){ // 'auto' so create a col per item\r
-                    this.columns = this.items.length;\r
-                }\r
-                if(!Ext.isArray(this.columns)){\r
-                    var cs = [];\r
-                    for(var i=0; i<this.columns; i++){\r
-                        cs.push((100/this.columns)*.01); // distribute by even %\r
-                    }\r
-                    this.columns = cs;\r
-                }\r
-                \r
-                numCols = this.columns.length;\r
-                \r
-                // Generate the column configs with the correct width setting\r
-                for(var i=0; i<numCols; i++){\r
-                    var cc = Ext.apply({items:[]}, colCfg);\r
-                    cc[this.columns[i] <= 1 ? 'columnWidth' : 'width'] = this.columns[i];\r
-                    if(this.defaults){\r
-                        cc.defaults = Ext.apply(cc.defaults || {}, this.defaults)\r
-                    }\r
-                    cols.push(cc);\r
-                };\r
-                \r
-                // Distribute the original items into the columns\r
-                if(this.vertical){\r
-                    var rows = Math.ceil(this.items.length / numCols), ri = 0;\r
-                    for(var i=0, len=this.items.length; i<len; i++){\r
-                        if(i>0 && i%rows==0){\r
-                            ri++;\r
-                        }\r
-                        if(this.items[i].fieldLabel){\r
-                            this.items[i].hideLabel = false;\r
-                        }\r
-                        cols[ri].items.push(this.items[i]);\r
-                    };\r
-                }else{\r
-                    for(var i=0, len=this.items.length; i<len; i++){\r
-                        var ci = i % numCols;\r
-                        if(this.items[i].fieldLabel){\r
-                            this.items[i].hideLabel = false;\r
-                        }\r
-                        cols[ci].items.push(this.items[i]);\r
-                    };\r
-                }\r
-                \r
-                Ext.apply(panelCfg, {\r
-                    layoutConfig: {columns: numCols},\r
-                    items: cols\r
-                });\r
-            }\r
-            \r
-            this.panel = new Ext.Panel(panelCfg);\r
-            this.el = this.panel.getEl();\r
-            \r
-            if(this.forId && this.itemCls){\r
-                var l = this.el.up(this.itemCls).child('label', true);\r
-                if(l){\r
-                    l.setAttribute('htmlFor', this.forId);\r
-                }\r
-            }\r
-            \r
-            var fields = this.panel.findBy(function(c){\r
-                return c.isFormField;\r
-            }, this);\r
-            \r
-            this.items = new Ext.util.MixedCollection();\r
-            this.items.addAll(fields);\r
-        }\r
-        Ext.form.CheckboxGroup.superclass.onRender.call(this, ct, position);\r
-    },\r
-    \r
-    // private\r
-    validateValue : function(value){\r
-        if(!this.allowBlank){\r
-            var blank = true;\r
-            this.items.each(function(f){\r
-                if(f.checked){\r
-                    return blank = false;\r
-                }\r
-            }, this);\r
-            if(blank){\r
-                this.markInvalid(this.blankText);\r
-                return false;\r
-            }\r
-        }\r
-        return true;\r
-    },\r
-    \r
-    // private\r
-    onDisable : function(){\r
-        this.items.each(function(item){\r
-            item.disable();\r
-        })\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        this.items.each(function(item){\r
-            item.enable();\r
-        })\r
-    },\r
-    \r
-    // private\r
-    onResize : function(w, h){\r
-        this.panel.setSize(w, h);\r
-        this.panel.doLayout();\r
-    },\r
-    \r
-    // inherit docs from Field\r
-    reset : function(){\r
-        Ext.form.CheckboxGroup.superclass.reset.call(this);\r
-        this.items.each(function(c){\r
-            if(c.reset){\r
-                c.reset();\r
-            }\r
-        }, this);\r
-    },\r
-    \r
-    \r
-    \r
-    initValue : Ext.emptyFn,\r
-    \r
-    getValue : Ext.emptyFn,\r
-    \r
-    getRawValue : Ext.emptyFn,\r
-    \r
-    setValue : Ext.emptyFn,\r
-    \r
-    setRawValue : Ext.emptyFn\r
-    \r
-});\r
-\r
-Ext.reg('checkboxgroup', Ext.form.CheckboxGroup);\r
-\r
-\r
-Ext.form.Radio = Ext.extend(Ext.form.Checkbox, {\r
-    // private\r
-    inputType: 'radio',\r
-    // private\r
-    baseCls: 'x-form-radio',\r
-    \r
-    \r
-    getGroupValue : function(){\r
-        var c = this.getParent().child('input[name='+this.el.dom.name+']:checked', true);\r
-        return c ? c.value : null;\r
-    },\r
-    \r
-    // private\r
-    getParent : function(){\r
-        return this.el.up('form') || Ext.getBody();\r
-    },\r
-\r
-    // private\r
-    toggleValue : function() {\r
-        if(!this.checked){\r
-            var els = this.getParent().select('input[name='+this.el.dom.name+']');\r
-            els.each(function(el){\r
-                if(el.dom.id == this.id){\r
-                    this.setValue(true);\r
-                }else{\r
-                    Ext.getCmp(el.dom.id).setValue(false);\r
-                }\r
-            }, this);\r
-        }\r
-    },\r
-    \r
-    \r
-    setValue : function(v){\r
-        if(typeof v=='boolean') {\r
-            Ext.form.Radio.superclass.setValue.call(this, v);\r
-        }else{\r
-            var r = this.getParent().child('input[name='+this.el.dom.name+'][value='+v+']', true);\r
-            if(r && !r.checked){\r
-                Ext.getCmp(r.id).toggleValue();\r
-            };\r
-        }\r
-    },\r
-    \r
-    \r
-    markInvalid : Ext.emptyFn,\r
-    \r
-    clearInvalid : Ext.emptyFn\r
-    \r
-});\r
-Ext.reg('radio', Ext.form.Radio);\r
-\r
-\r
-Ext.form.RadioGroup = Ext.extend(Ext.form.CheckboxGroup, {\r
-    \r
-    allowBlank : true,\r
-    \r
-    blankText : "You must select one item in this group",\r
-    \r
-    // private\r
-    defaultType : 'radio',\r
-    \r
-    // private\r
-    groupCls: 'x-form-radio-group'\r
-});\r
-\r
-Ext.reg('radiogroup', Ext.form.RadioGroup);\r
-\r
-\r
-Ext.form.Hidden = Ext.extend(Ext.form.Field, {\r
-    // private\r
-    inputType : 'hidden',\r
-\r
-    // private\r
-    onRender : function(){\r
-        Ext.form.Hidden.superclass.onRender.apply(this, arguments);\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        this.originalValue = this.getValue();\r
-    },\r
-\r
-    // These are all private overrides\r
-    setSize : Ext.emptyFn,\r
-    setWidth : Ext.emptyFn,\r
-    setHeight : Ext.emptyFn,\r
-    setPosition : Ext.emptyFn,\r
-    setPagePosition : Ext.emptyFn,\r
-    markInvalid : Ext.emptyFn,\r
-    clearInvalid : Ext.emptyFn\r
-});\r
-Ext.reg('hidden', Ext.form.Hidden);\r
-\r
-Ext.form.BasicForm = function(el, config){\r
-    Ext.apply(this, config);\r
-    \r
-    this.items = new Ext.util.MixedCollection(false, function(o){\r
-        return o.id || (o.id = Ext.id());\r
-    });\r
-    this.addEvents(\r
-        \r
-        'beforeaction',\r
-        \r
-        'actionfailed',\r
-        \r
-        'actioncomplete'\r
-    );\r
-\r
-    if(el){\r
-        this.initEl(el);\r
-    }\r
-    Ext.form.BasicForm.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    timeout: 30,\r
-\r
-    // private\r
-    activeAction : null,\r
-\r
-    \r
-    trackResetOnLoad : false,\r
-\r
-    \r
-    \r
-\r
-    // private\r
-    initEl : function(el){\r
-        this.el = Ext.get(el);\r
-        this.id = this.el.id || Ext.id();\r
-        if(!this.standardSubmit){\r
-            this.el.on('submit', this.onSubmit, this);\r
-        }\r
-        this.el.addClass('x-form');\r
-    },\r
-\r
-    \r
-    getEl: function(){\r
-        return this.el;\r
-    },\r
-\r
-    // private\r
-    onSubmit : function(e){\r
-        e.stopEvent();\r
-    },\r
-\r
-    // private\r
-    destroy: function() {\r
-        this.items.each(function(f){\r
-            Ext.destroy(f);\r
-        });\r
-        if(this.el){\r
-            this.el.removeAllListeners();\r
-            this.el.remove();\r
-        }\r
-        this.purgeListeners();\r
-    },\r
-\r
-    \r
-    isValid : function(){\r
-        var valid = true;\r
-        this.items.each(function(f){\r
-           if(!f.validate()){\r
-               valid = false;\r
-           }\r
-        });\r
-        return valid;\r
-    },\r
-\r
-    \r
-    isDirty : function(){\r
-        var dirty = false;\r
-        this.items.each(function(f){\r
-           if(f.isDirty()){\r
-               dirty = true;\r
-               return false;\r
-           }\r
-        });\r
-        return dirty;\r
-    },\r
-\r
-    \r
-    doAction : function(action, options){\r
-        if(typeof action == 'string'){\r
-            action = new Ext.form.Action.ACTION_TYPES[action](this, options);\r
-        }\r
-        if(this.fireEvent('beforeaction', this, action) !== false){\r
-            this.beforeAction(action);\r
-            action.run.defer(100, action);\r
-        }\r
-        return this;\r
-    },\r
-\r
-    \r
-    submit : function(options){\r
-        if(this.standardSubmit){\r
-            var v = this.isValid();\r
-            if(v){\r
-                this.el.dom.submit();\r
-            }\r
-            return v;\r
-        }\r
-        this.doAction('submit', options);\r
-        return this;\r
-    },\r
-\r
-    \r
-    load : function(options){\r
-        this.doAction('load', options);\r
-        return this;\r
-    },\r
-\r
-    \r
-    updateRecord : function(record){\r
-        record.beginEdit();\r
-        var fs = record.fields;\r
-        fs.each(function(f){\r
-            var field = this.findField(f.name);\r
-            if(field){\r
-                record.set(f.name, field.getValue());\r
-            }\r
-        }, this);\r
-        record.endEdit();\r
-        return this;\r
-    },\r
-\r
-    \r
-    loadRecord : function(record){\r
-        this.setValues(record.data);\r
-        return this;\r
-    },\r
-\r
-    // private\r
-    beforeAction : function(action){\r
-        var o = action.options;\r
-        if(o.waitMsg){\r
-            if(this.waitMsgTarget === true){\r
-                this.el.mask(o.waitMsg, 'x-mask-loading');\r
-            }else if(this.waitMsgTarget){\r
-                this.waitMsgTarget = Ext.get(this.waitMsgTarget);\r
-                this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');\r
-            }else{\r
-                Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...');\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    afterAction : function(action, success){\r
-        this.activeAction = null;\r
-        var o = action.options;\r
-        if(o.waitMsg){\r
-            if(this.waitMsgTarget === true){\r
-                this.el.unmask();\r
-            }else if(this.waitMsgTarget){\r
-                this.waitMsgTarget.unmask();\r
-            }else{\r
-                Ext.MessageBox.updateProgress(1);\r
-                Ext.MessageBox.hide();\r
-            }\r
-        }\r
-        if(success){\r
-            if(o.reset){\r
-                this.reset();\r
-            }\r
-            Ext.callback(o.success, o.scope, [this, action]);\r
-            this.fireEvent('actioncomplete', this, action);\r
-        }else{\r
-            Ext.callback(o.failure, o.scope, [this, action]);\r
-            this.fireEvent('actionfailed', this, action);\r
-        }\r
-    },\r
-\r
-    \r
-    findField : function(id){\r
-        var field = this.items.get(id);\r
-        if(!field){\r
-            this.items.each(function(f){\r
-                if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){\r
-                    field = f;\r
-                    return false;\r
-                }\r
-            });\r
-        }\r
-        return field || null;\r
-    },\r
-\r
-\r
-    \r
-    markInvalid : function(errors){\r
-        if(Ext.isArray(errors)){\r
-            for(var i = 0, len = errors.length; i < len; i++){\r
-                var fieldError = errors[i];\r
-                var f = this.findField(fieldError.id);\r
-                if(f){\r
-                    f.markInvalid(fieldError.msg);\r
-                }\r
-            }\r
-        }else{\r
-            var field, id;\r
-            for(id in errors){\r
-                if(typeof errors[id] != 'function' && (field = this.findField(id))){\r
-                    field.markInvalid(errors[id]);\r
-                }\r
-            }\r
-        }\r
-        return this;\r
-    },\r
-\r
-    \r
-    setValues : function(values){\r
-        if(Ext.isArray(values)){ // array of objects\r
-            for(var i = 0, len = values.length; i < len; i++){\r
-                var v = values[i];\r
-                var f = this.findField(v.id);\r
-                if(f){\r
-                    f.setValue(v.value);\r
-                    if(this.trackResetOnLoad){\r
-                        f.originalValue = f.getValue();\r
-                    }\r
-                }\r
-            }\r
-        }else{ // object hash\r
-            var field, id;\r
-            for(id in values){\r
-                if(typeof values[id] != 'function' && (field = this.findField(id))){\r
-                    field.setValue(values[id]);\r
-                    if(this.trackResetOnLoad){\r
-                        field.originalValue = field.getValue();\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        return this;\r
-    },\r
-\r
-    \r
-    getValues : function(asString){\r
-        var fs = Ext.lib.Ajax.serializeForm(this.el.dom);\r
-        if(asString === true){\r
-            return fs;\r
-        }\r
-        return Ext.urlDecode(fs);\r
-    },\r
-\r
-    \r
-    clearInvalid : function(){\r
-        this.items.each(function(f){\r
-           f.clearInvalid();\r
-        });\r
-        return this;\r
-    },\r
-\r
-    \r
-    reset : function(){\r
-        this.items.each(function(f){\r
-            f.reset();\r
-        });\r
-        return this;\r
-    },\r
-\r
-    \r
-    add : function(){\r
-        this.items.addAll(Array.prototype.slice.call(arguments, 0));\r
-        return this;\r
-    },\r
-\r
-\r
-    \r
-    remove : function(field){\r
-        this.items.remove(field);\r
-        return this;\r
-    },\r
-\r
-    \r
-    render : function(){\r
-        this.items.each(function(f){\r
-            if(f.isFormField && !f.rendered && document.getElementById(f.id)){ // if the element exists\r
-                f.applyToMarkup(f.id);\r
-            }\r
-        });\r
-        return this;\r
-    },\r
-\r
-    \r
-    applyToFields : function(o){\r
-        this.items.each(function(f){\r
-           Ext.apply(f, o);\r
-        });\r
-        return this;\r
-    },\r
-\r
-    \r
-    applyIfToFields : function(o){\r
-        this.items.each(function(f){\r
-           Ext.applyIf(f, o);\r
-        });\r
-        return this;\r
-    }\r
-});\r
-\r
-// back compat\r
-Ext.BasicForm = Ext.form.BasicForm;\r
-\r
-Ext.FormPanel = Ext.extend(Ext.Panel, {\r
-       \r
-    \r
-    \r
-    \r
-    \r
-    buttonAlign:'center',\r
-\r
-    \r
-    minButtonWidth:75,\r
-\r
-    \r
-    labelAlign:'left',\r
-\r
-    \r
-    monitorValid : false,\r
-\r
-    \r
-    monitorPoll : 200,\r
-\r
-    \r
-    layout: 'form',\r
-\r
-    // private\r
-    initComponent :function(){\r
-        this.form = this.createForm();\r
-\r
-        this.bodyCfg = {\r
-            tag: 'form',\r
-            cls: this.baseCls + '-body',\r
-            method : this.method || 'POST',\r
-            id : this.formId || Ext.id()\r
-        };\r
-        if(this.fileUpload) {\r
-            this.bodyCfg.enctype = 'multipart/form-data';\r
-        }\r
-\r
-        Ext.FormPanel.superclass.initComponent.call(this);\r
-\r
-        this.initItems();\r
-\r
-        this.addEvents(\r
-            \r
-            'clientvalidation'\r
-        );\r
-\r
-        this.relayEvents(this.form, ['beforeaction', 'actionfailed', 'actioncomplete']);\r
-    },\r
-\r
-    // private\r
-    createForm: function(){\r
-        delete this.initialConfig.listeners;\r
-        return new Ext.form.BasicForm(null, this.initialConfig);\r
-    },\r
-\r
-    // private\r
-    initFields : function(){\r
-        var f = this.form;\r
-        var formPanel = this;\r
-        var fn = function(c){\r
-            if(c.isFormField){\r
-                f.add(c);\r
-            }else if(c.doLayout && c != formPanel){\r
-                Ext.applyIf(c, {\r
-                    labelAlign: c.ownerCt.labelAlign,\r
-                    labelWidth: c.ownerCt.labelWidth,\r
-                    itemCls: c.ownerCt.itemCls\r
-                });\r
-                if(c.items){\r
-                    c.items.each(fn);\r
-                }\r
-            }\r
-        }\r
-        this.items.each(fn);\r
-    },\r
-\r
-    // private\r
-    getLayoutTarget : function(){\r
-        return this.form.el;\r
-    },\r
-\r
-    \r
-    getForm : function(){\r
-        return this.form;\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        this.initFields();\r
-\r
-        Ext.FormPanel.superclass.onRender.call(this, ct, position);\r
-        this.form.initEl(this.body);\r
-    },\r
-    \r
-    // private\r
-    beforeDestroy: function(){\r
-        Ext.FormPanel.superclass.beforeDestroy.call(this);\r
-        this.stopMonitoring();\r
-        Ext.destroy(this.form);\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.FormPanel.superclass.initEvents.call(this);\r
-        this.items.on('remove', this.onRemove, this);\r
-               this.items.on('add', this.onAdd, this);\r
-        if(this.monitorValid){ // initialize after render\r
-            this.startMonitoring();\r
-        }\r
-    },\r
-    \r
-    // private\r
-       onAdd : function(ct, c) {\r
-               if (c.isFormField) {\r
-                       this.form.add(c);\r
-               }\r
-       },\r
-       \r
-       // private\r
-       onRemove : function(c) {\r
-               if (c.isFormField) {\r
-                       Ext.destroy(c.container.up('.x-form-item'));\r
-                       this.form.remove(c);\r
-               }\r
-       },\r
-\r
-    \r
-    startMonitoring : function(){\r
-        if(!this.bound){\r
-            this.bound = true;\r
-            Ext.TaskMgr.start({\r
-                run : this.bindHandler,\r
-                interval : this.monitorPoll || 200,\r
-                scope: this\r
-            });\r
-        }\r
-    },\r
-\r
-    \r
-    stopMonitoring : function(){\r
-        this.bound = false;\r
-    },\r
-\r
-    \r
-    load : function(){\r
-        this.form.load.apply(this.form, arguments);  \r
-    },\r
-\r
-    // private\r
-    onDisable : function(){\r
-        Ext.FormPanel.superclass.onDisable.call(this);\r
-        if(this.form){\r
-            this.form.items.each(function(){\r
-                 this.disable();\r
-            });\r
-        }\r
-    },\r
-\r
-    // private\r
-    onEnable : function(){\r
-        Ext.FormPanel.superclass.onEnable.call(this);\r
-        if(this.form){\r
-            this.form.items.each(function(){\r
-                 this.enable();\r
-            });\r
-        }\r
-    },\r
-\r
-    // private\r
-    bindHandler : function(){\r
-        if(!this.bound){\r
-            return false; // stops binding\r
-        }\r
-        var valid = true;\r
-        this.form.items.each(function(f){\r
-            if(!f.isValid(true)){\r
-                valid = false;\r
-                return false;\r
-            }\r
-        });\r
-        if(this.buttons){\r
-            for(var i = 0, len = this.buttons.length; i < len; i++){\r
-                var btn = this.buttons[i];\r
-                if(btn.formBind === true && btn.disabled === valid){\r
-                    btn.setDisabled(!valid);\r
-                }\r
-            }\r
-        }\r
-        this.fireEvent('clientvalidation', this, valid);\r
-    }\r
-});\r
-Ext.reg('form', Ext.FormPanel);\r
-\r
-Ext.form.FormPanel = Ext.FormPanel;\r
-\r
-\r
-\r
-Ext.form.FieldSet = Ext.extend(Ext.Panel, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    baseCls:'x-fieldset',\r
-    \r
-    layout: 'form',\r
-    \r
-    animCollapse: false,\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        if(!this.el){\r
-            this.el = document.createElement('fieldset');\r
-            this.el.id = this.id;\r
-            if (this.title || this.header || this.checkboxToggle) {\r
-                this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';\r
-            }\r
-        }\r
-\r
-        Ext.form.FieldSet.superclass.onRender.call(this, ct, position);\r
-\r
-        if(this.checkboxToggle){\r
-            var o = typeof this.checkboxToggle == 'object' ?\r
-                    this.checkboxToggle :\r
-                    {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};\r
-            this.checkbox = this.header.insertFirst(o);\r
-            this.checkbox.dom.checked = !this.collapsed;\r
-            this.checkbox.on('click', this.onCheckClick, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onCollapse : function(doAnim, animArg){\r
-        if(this.checkbox){\r
-            this.checkbox.dom.checked = false;\r
-        }\r
-        Ext.form.FieldSet.superclass.onCollapse.call(this, doAnim, animArg);\r
-\r
-    },\r
-\r
-    // private\r
-    onExpand : function(doAnim, animArg){\r
-        if(this.checkbox){\r
-            this.checkbox.dom.checked = true;\r
-        }\r
-        Ext.form.FieldSet.superclass.onExpand.call(this, doAnim, animArg);\r
-    },\r
-\r
-    \r
-    onCheckClick : function(){\r
-        this[this.checkbox.dom.checked ? 'expand' : 'collapse']();\r
-    },\r
-    \r
-    // private\r
-    beforeDestroy : function(){\r
-        if(this.checkbox){\r
-            this.checkbox.un('click', this.onCheckClick, this);\r
-        }\r
-        Ext.form.FieldSet.superclass.beforeDestroy.call(this);\r
-    }\r
-\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-});\r
-Ext.reg('fieldset', Ext.form.FieldSet);\r
-\r
-\r
-\r
-\r
-Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {\r
-    \r
-    enableFormat : true,\r
-    \r
-    enableFontSize : true,\r
-    \r
-    enableColors : true,\r
-    \r
-    enableAlignments : true,\r
-    \r
-    enableLists : true,\r
-    \r
-    enableSourceEdit : true,\r
-    \r
-    enableLinks : true,\r
-    \r
-    enableFont : true,\r
-    \r
-    createLinkText : 'Please enter the URL for the link:',\r
-    \r
-    defaultLinkValue : 'http:/'+'/',\r
-    \r
-    fontFamilies : [\r
-        'Arial',\r
-        'Courier New',\r
-        'Tahoma',\r
-        'Times New Roman',\r
-        'Verdana'\r
-    ],\r
-    defaultFont: 'tahoma',\r
-\r
-    // private properties\r
-    validationEvent : false,\r
-    deferHeight: true,\r
-    initialized : false,\r
-    activated : false,\r
-    sourceEditMode : false,\r
-    onFocus : Ext.emptyFn,\r
-    iframePad:3,\r
-    hideMode:'offsets',\r
-    defaultAutoCreate : {\r
-        tag: "textarea",\r
-        style:"width:500px;height:300px;",\r
-        autocomplete: "off"\r
-    },\r
-\r
-    // private\r
-    initComponent : function(){\r
-        this.addEvents(\r
-            \r
-            'initialize',\r
-            \r
-            'activate',\r
-             \r
-            'beforesync',\r
-             \r
-            'beforepush',\r
-             \r
-            'sync',\r
-             \r
-            'push',\r
-             \r
-            'editmodechange'\r
-        )\r
-    },\r
-\r
-    // private\r
-    createFontOptions : function(){\r
-        var buf = [], fs = this.fontFamilies, ff, lc;\r
-        for(var i = 0, len = fs.length; i< len; i++){\r
-            ff = fs[i];\r
-            lc = ff.toLowerCase();\r
-            buf.push(\r
-                '<option value="',lc,'" style="font-family:',ff,';"',\r
-                    (this.defaultFont == lc ? ' selected="true">' : '>'),\r
-                    ff,\r
-                '</option>'\r
-            );\r
-        }\r
-        return buf.join('');\r
-    },\r
-    \r
-    \r
-    createToolbar : function(editor){\r
-        \r
-        var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled();\r
-        \r
-        function btn(id, toggle, handler){\r
-            return {\r
-                itemId : id,\r
-                cls : 'x-btn-icon x-edit-'+id,\r
-                enableToggle:toggle !== false,\r
-                scope: editor,\r
-                handler:handler||editor.relayBtnCmd,\r
-                clickEvent:'mousedown',\r
-                tooltip: tipsEnabled ? editor.buttonTips[id] || undefined : undefined,\r
-                tabIndex:-1\r
-            };\r
-        }\r
-\r
-        // build the toolbar\r
-        var tb = new Ext.Toolbar({\r
-            renderTo:this.wrap.dom.firstChild\r
-        });\r
-\r
-        // stop form submits\r
-        tb.el.on('click', function(e){\r
-            e.preventDefault();\r
-        });\r
-\r
-        if(this.enableFont && !Ext.isSafari2){\r
-            this.fontSelect = tb.el.createChild({\r
-                tag:'select',\r
-                cls:'x-font-select',\r
-                html: this.createFontOptions()\r
-            });\r
-            this.fontSelect.on('change', function(){\r
-                var font = this.fontSelect.dom.value;\r
-                this.relayCmd('fontname', font);\r
-                this.deferFocus();\r
-            }, this);\r
-            tb.add(\r
-                this.fontSelect.dom,\r
-                '-'\r
-            );\r
-        };\r
-\r
-        if(this.enableFormat){\r
-            tb.add(\r
-                btn('bold'),\r
-                btn('italic'),\r
-                btn('underline')\r
-            );\r
-        };\r
-\r
-        if(this.enableFontSize){\r
-            tb.add(\r
-                '-',\r
-                btn('increasefontsize', false, this.adjustFont),\r
-                btn('decreasefontsize', false, this.adjustFont)\r
-            );\r
-        };\r
-\r
-        if(this.enableColors){\r
-            tb.add(\r
-                '-', {\r
-                    itemId:'forecolor',\r
-                    cls:'x-btn-icon x-edit-forecolor',\r
-                    clickEvent:'mousedown',\r
-                    tooltip: tipsEnabled ? editor.buttonTips['forecolor'] || undefined : undefined,\r
-                    tabIndex:-1,\r
-                    menu : new Ext.menu.ColorMenu({\r
-                        allowReselect: true,\r
-                        focus: Ext.emptyFn,\r
-                        value:'000000',\r
-                        plain:true,\r
-                        selectHandler: function(cp, color){\r
-                            this.execCmd('forecolor', Ext.isSafari || Ext.isIE ? '#'+color : color);\r
-                            this.deferFocus();\r
-                        },\r
-                        scope: this,\r
-                        clickEvent:'mousedown'\r
-                    })\r
-                }, {\r
-                    itemId:'backcolor',\r
-                    cls:'x-btn-icon x-edit-backcolor',\r
-                    clickEvent:'mousedown',\r
-                    tooltip: tipsEnabled ? editor.buttonTips['backcolor'] || undefined : undefined,\r
-                    tabIndex:-1,\r
-                    menu : new Ext.menu.ColorMenu({\r
-                        focus: Ext.emptyFn,\r
-                        value:'FFFFFF',\r
-                        plain:true,\r
-                        allowReselect: true,\r
-                        selectHandler: function(cp, color){\r
-                            if(Ext.isGecko){\r
-                                this.execCmd('useCSS', false);\r
-                                this.execCmd('hilitecolor', color);\r
-                                this.execCmd('useCSS', true);\r
-                                this.deferFocus();\r
-                            }else{\r
-                                this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isSafari || Ext.isIE ? '#'+color : color);\r
-                                this.deferFocus();\r
-                            }\r
-                        },\r
-                        scope:this,\r
-                        clickEvent:'mousedown'\r
-                    })\r
-                }\r
-            );\r
-        };\r
-\r
-        if(this.enableAlignments){\r
-            tb.add(\r
-                '-',\r
-                btn('justifyleft'),\r
-                btn('justifycenter'),\r
-                btn('justifyright')\r
-            );\r
-        };\r
-\r
-        if(!Ext.isSafari2){\r
-            if(this.enableLinks){\r
-                tb.add(\r
-                    '-',\r
-                    btn('createlink', false, this.createLink)\r
-                );\r
-            };\r
-\r
-            if(this.enableLists){\r
-                tb.add(\r
-                    '-',\r
-                    btn('insertorderedlist'),\r
-                    btn('insertunorderedlist')\r
-                );\r
-            }\r
-            if(this.enableSourceEdit){\r
-                tb.add(\r
-                    '-',\r
-                    btn('sourceedit', true, function(btn){\r
-                        this.toggleSourceEdit(btn.pressed);\r
-                    })\r
-                );\r
-            }\r
-        }\r
-\r
-        this.tb = tb;\r
-    },\r
-\r
-    \r
-    getDocMarkup : function(){\r
-        return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';\r
-    },\r
-\r
-    // private\r
-    getEditorBody : function(){\r
-        return this.doc.body || this.doc.documentElement;\r
-    },\r
-\r
-    // private\r
-    getDoc : function(){\r
-        return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);\r
-    },\r
-\r
-    // private\r
-    getWin : function(){\r
-        return Ext.isIE ? this.iframe.contentWindow : window.frames[this.iframe.name];\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);\r
-        this.el.dom.style.border = '0 none';\r
-        this.el.dom.setAttribute('tabIndex', -1);\r
-        this.el.addClass('x-hidden');\r
-        if(Ext.isIE){ // fix IE 1px bogus margin\r
-            this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')\r
-        }\r
-        this.wrap = this.el.wrap({\r
-            cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}\r
-        });\r
-\r
-        this.createToolbar(this);\r
-\r
-        this.tb.items.each(function(item){\r
-           if(item.itemId != 'sourceedit'){\r
-                item.disable();\r
-            }\r
-        });\r
-\r
-        var iframe = document.createElement('iframe');\r
-        iframe.name = Ext.id();\r
-        iframe.frameBorder = '0';\r
-\r
-        iframe.src = Ext.isIE ? Ext.SSL_SECURE_URL : "javascript:;";\r
-\r
-        this.wrap.dom.appendChild(iframe);\r
-\r
-        this.iframe = iframe;\r
-\r
-        this.initFrame();\r
-\r
-        if(this.autoMonitorDesignMode !== false){\r
-            this.monitorTask = Ext.TaskMgr.start({\r
-                run: this.checkDesignMode,\r
-                scope: this,\r
-                interval:100\r
-            });\r
-        }\r
-\r
-        if(!this.width){\r
-            var sz = this.el.getSize();\r
-            this.setSize(sz.width, this.height || sz.height);\r
-        }\r
-    },\r
-\r
-    initFrame : function(){\r
-        this.doc = this.getDoc();\r
-        this.win = this.getWin();\r
-\r
-        this.doc.open();\r
-        this.doc.write(this.getDocMarkup());\r
-        this.doc.close();\r
-\r
-        var task = { // must defer to wait for browser to be ready\r
-            run : function(){\r
-                if(this.doc.body || this.doc.readyState == 'complete'){\r
-                    Ext.TaskMgr.stop(task);\r
-                    this.doc.designMode="on";\r
-                    this.initEditor.defer(10, this);\r
-                }\r
-            },\r
-            interval : 10,\r
-            duration:10000,\r
-            scope: this\r
-        };\r
-        Ext.TaskMgr.start(task);\r
-    },\r
-\r
-\r
-    checkDesignMode : function(){\r
-        if(this.wrap && this.wrap.dom.offsetWidth){\r
-            var doc = this.getDoc();\r
-            if(!doc){\r
-                return;\r
-            }\r
-            if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){\r
-                this.initFrame();\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onResize : function(w, h){\r
-        Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);\r
-        if(this.el && this.iframe){\r
-            if(typeof w == 'number'){\r
-                var aw = w - this.wrap.getFrameWidth('lr');\r
-                this.el.setWidth(this.adjustWidth('textarea', aw));\r
-                this.iframe.style.width = Math.max(aw, 0) + 'px';\r
-            }\r
-            if(typeof h == 'number'){\r
-                var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();\r
-                this.el.setHeight(this.adjustWidth('textarea', ah));\r
-                this.iframe.style.height = Math.max(ah, 0) + 'px';\r
-                if(this.doc){\r
-                    this.getEditorBody().style.height = Math.max((ah - (this.iframePad*2)), 0) + 'px';\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    toggleSourceEdit : function(sourceEditMode){\r
-        if(sourceEditMode === undefined){\r
-            sourceEditMode = !this.sourceEditMode;\r
-        }\r
-        this.sourceEditMode = sourceEditMode === true;\r
-        var btn = this.tb.items.get('sourceedit');\r
-        if(btn.pressed !== this.sourceEditMode){\r
-            btn.toggle(this.sourceEditMode);\r
-            return;\r
-        }\r
-        if(this.sourceEditMode){\r
-            this.tb.items.each(function(item){\r
-                if(item.itemId != 'sourceedit'){\r
-                    item.disable();\r
-                }\r
-            });\r
-            this.syncValue();\r
-            this.iframe.className = 'x-hidden';\r
-            this.el.removeClass('x-hidden');\r
-            this.el.dom.removeAttribute('tabIndex');\r
-            this.el.focus();\r
-        }else{\r
-            if(this.initialized){\r
-                this.tb.items.each(function(item){\r
-                    item.enable();\r
-                });\r
-            }\r
-            this.pushValue();\r
-            this.iframe.className = '';\r
-            this.el.addClass('x-hidden');\r
-            this.el.dom.setAttribute('tabIndex', -1);\r
-            this.deferFocus();\r
-        }\r
-        var lastSize = this.lastSize;\r
-        if(lastSize){\r
-            delete this.lastSize;\r
-            this.setSize(lastSize);\r
-        }\r
-        this.fireEvent('editmodechange', this, this.sourceEditMode);\r
-    },\r
-\r
-    // private used internally\r
-    createLink : function(){\r
-        var url = prompt(this.createLinkText, this.defaultLinkValue);\r
-        if(url && url != 'http:/'+'/'){\r
-            this.relayCmd('createlink', url);\r
-        }\r
-    },\r
-\r
-    // private (for BoxComponent)\r
-    adjustSize : Ext.BoxComponent.prototype.adjustSize,\r
-\r
-    // private (for BoxComponent)\r
-    getResizeEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private (for BoxComponent)\r
-    getPositionEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        this.originalValue = this.getValue();\r
-    },\r
-\r
-    \r
-    markInvalid : Ext.emptyFn,\r
-    \r
-    \r
-    clearInvalid : Ext.emptyFn,\r
-\r
-    // docs inherit from Field\r
-    setValue : function(v){\r
-        Ext.form.HtmlEditor.superclass.setValue.call(this, v);\r
-        this.pushValue();\r
-    },\r
-\r
-    \r
-    cleanHtml : function(html){\r
-        html = String(html);\r
-        if(html.length > 5){\r
-            if(Ext.isSafari){ // strip safari nonsense\r
-                html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');\r
-            }\r
-        }\r
-        if(html == '&nbsp;'){\r
-            html = '';\r
-        }\r
-        return html;\r
-    },\r
-\r
-    \r
-    syncValue : function(){\r
-        if(this.initialized){\r
-            var bd = this.getEditorBody();\r
-            var html = bd.innerHTML;\r
-            if(Ext.isSafari){\r
-                var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!\r
-                var m = bs.match(/text-align:(.*?);/i);\r
-                if(m && m[1]){\r
-                    html = '<div style="'+m[0]+'">' + html + '</div>';\r
-                }\r
-            }\r
-            html = this.cleanHtml(html);\r
-            if(this.fireEvent('beforesync', this, html) !== false){\r
-                this.el.dom.value = html;\r
-                this.fireEvent('sync', this, html);\r
-            }\r
-        }\r
-    },\r
-    \r
-    //docs inherit from Field\r
-    getValue : function() {\r
-        this.syncValue();\r
-        return Ext.form.HtmlEditor.superclass.getValue.call(this);\r
-    },\r
-\r
-\r
-    \r
-    pushValue : function(){\r
-        if(this.initialized){\r
-            var v = this.el.dom.value;\r
-            if(!this.activated && v.length < 1){\r
-                v = '&nbsp;';\r
-            }\r
-            if(this.fireEvent('beforepush', this, v) !== false){\r
-                this.getEditorBody().innerHTML = v;\r
-                this.fireEvent('push', this, v);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    deferFocus : function(){\r
-        this.focus.defer(10, this);\r
-    },\r
-\r
-    // docs inherit from Field\r
-    focus : function(){\r
-        if(this.win && !this.sourceEditMode){\r
-            this.win.focus();\r
-        }else{\r
-            this.el.focus();\r
-        }\r
-    },\r
-\r
-    // private\r
-    initEditor : function(){\r
-        var dbody = this.getEditorBody();\r
-        var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');\r
-        ss['background-attachment'] = 'fixed'; // w3c\r
-        dbody.bgProperties = 'fixed'; // ie\r
-\r
-        Ext.DomHelper.applyStyles(dbody, ss);\r
-\r
-        if(this.doc){\r
-            try{\r
-                Ext.EventManager.removeAll(this.doc);\r
-            }catch(e){}\r
-        }\r
-\r
-        this.doc = this.getDoc();\r
-\r
-        Ext.EventManager.on(this.doc, {\r
-            'mousedown': this.onEditorEvent,\r
-            'dblclick': this.onEditorEvent,\r
-            'click': this.onEditorEvent,\r
-            'keyup': this.onEditorEvent,\r
-            buffer:100,\r
-            scope: this\r
-        });\r
-\r
-        if(Ext.isGecko){\r
-            Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);\r
-        }\r
-        if(Ext.isIE || Ext.isSafari || Ext.isOpera){\r
-            Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);\r
-        }\r
-        this.initialized = true;\r
-\r
-        this.fireEvent('initialize', this);\r
-\r
-        this.doc.editorInitialized = true;\r
-\r
-        this.pushValue();\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.monitorTask){\r
-            Ext.TaskMgr.stop(this.monitorTask);\r
-        }\r
-        if(this.rendered){\r
-            this.tb.items.each(function(item){\r
-                if(item.menu){\r
-                    item.menu.removeAll();\r
-                    if(item.menu.el){\r
-                        item.menu.el.destroy();\r
-                    }\r
-                }\r
-                item.destroy();\r
-            });\r
-            this.wrap.dom.innerHTML = '';\r
-            this.wrap.remove();\r
-        }\r
-    },\r
-\r
-    // private\r
-    onFirstFocus : function(){\r
-        this.activated = true;\r
-        this.tb.items.each(function(item){\r
-           item.enable();\r
-        });\r
-        if(Ext.isGecko){ // prevent silly gecko errors\r
-            this.win.focus();\r
-            var s = this.win.getSelection();\r
-            if(!s.focusNode || s.focusNode.nodeType != 3){\r
-                var r = s.getRangeAt(0);\r
-                r.selectNodeContents(this.getEditorBody());\r
-                r.collapse(true);\r
-                this.deferFocus();\r
-            }\r
-            try{\r
-                this.execCmd('useCSS', true);\r
-                this.execCmd('styleWithCSS', false);\r
-            }catch(e){}\r
-        }\r
-        this.fireEvent('activate', this);\r
-    },\r
-\r
-    // private\r
-    adjustFont: function(btn){\r
-        var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;\r
-\r
-        var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);\r
-        if(Ext.isSafari3 || Ext.isAir){\r
-            // Safari 3 values\r
-            // 1 = 10px, 2 = 13px, 3 = 16px, 4 = 18px, 5 = 24px, 6 = 32px\r
-            if(v <= 10){\r
-                v = 1 + adjust;\r
-            }else if(v <= 13){\r
-                v = 2 + adjust;\r
-            }else if(v <= 16){\r
-                v = 3 + adjust;\r
-            }else if(v <= 18){\r
-                v = 4 + adjust;\r
-            }else if(v <= 24){\r
-                v = 5 + adjust;\r
-            }else {\r
-                v = 6 + adjust;\r
-            }\r
-            v = v.constrain(1, 6);\r
-        }else{\r
-            if(Ext.isSafari){ // safari\r
-                adjust *= 2;\r
-            }\r
-            v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);\r
-        }\r
-        this.execCmd('FontSize', v);\r
-    },\r
-\r
-    // private\r
-    onEditorEvent : function(e){\r
-        this.updateToolbar();\r
-    },\r
-\r
-\r
-    \r
-    updateToolbar: function(){\r
-\r
-        if(!this.activated){\r
-            this.onFirstFocus();\r
-            return;\r
-        }\r
-\r
-        var btns = this.tb.items.map, doc = this.doc;\r
-\r
-        if(this.enableFont && !Ext.isSafari2){\r
-            var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();\r
-            if(name != this.fontSelect.dom.value){\r
-                this.fontSelect.dom.value = name;\r
-            }\r
-        }\r
-        if(this.enableFormat){\r
-            btns.bold.toggle(doc.queryCommandState('bold'));\r
-            btns.italic.toggle(doc.queryCommandState('italic'));\r
-            btns.underline.toggle(doc.queryCommandState('underline'));\r
-        }\r
-        if(this.enableAlignments){\r
-            btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));\r
-            btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));\r
-            btns.justifyright.toggle(doc.queryCommandState('justifyright'));\r
-        }\r
-        if(!Ext.isSafari2 && this.enableLists){\r
-            btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));\r
-            btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));\r
-        }\r
-        \r
-        Ext.menu.MenuMgr.hideAll();\r
-\r
-        this.syncValue();\r
-    },\r
-\r
-    // private\r
-    relayBtnCmd : function(btn){\r
-        this.relayCmd(btn.itemId);\r
-    },\r
-\r
-    \r
-    relayCmd : function(cmd, value){\r
-        (function(){\r
-            this.focus();\r
-            this.execCmd(cmd, value);\r
-            this.updateToolbar();\r
-        }).defer(10, this);\r
-    },\r
-\r
-    \r
-    execCmd : function(cmd, value){\r
-        this.doc.execCommand(cmd, false, value === undefined ? null : value);\r
-        this.syncValue();\r
-    },\r
-\r
-    // private\r
-    applyCommand : function(e){\r
-        if(e.ctrlKey){\r
-            var c = e.getCharCode(), cmd;\r
-            if(c > 0){\r
-                c = String.fromCharCode(c);\r
-                switch(c){\r
-                    case 'b':\r
-                        cmd = 'bold';\r
-                    break;\r
-                    case 'i':\r
-                        cmd = 'italic';\r
-                    break;\r
-                    case 'u':\r
-                        cmd = 'underline';\r
-                    break;\r
-                }\r
-                if(cmd){\r
-                    this.win.focus();\r
-                    this.execCmd(cmd);\r
-                    this.deferFocus();\r
-                    e.preventDefault();\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    \r
-    insertAtCursor : function(text){\r
-        if(!this.activated){\r
-            return;\r
-        }\r
-        if(Ext.isIE){\r
-            this.win.focus();\r
-            var r = this.doc.selection.createRange();\r
-            if(r){\r
-                r.collapse(true);\r
-                r.pasteHTML(text);\r
-                this.syncValue();\r
-                this.deferFocus();\r
-            }\r
-        }else if(Ext.isGecko || Ext.isOpera){\r
-            this.win.focus();\r
-            this.execCmd('InsertHTML', text);\r
-            this.deferFocus();\r
-        }else if(Ext.isSafari){\r
-            this.execCmd('InsertText', text);\r
-            this.deferFocus();\r
-        }\r
-    },\r
-\r
-    // private\r
-    fixKeys : function(){ // load time branching for fastest keydown performance\r
-        if(Ext.isIE){\r
-            return function(e){\r
-                var k = e.getKey(), r;\r
-                if(k == e.TAB){\r
-                    e.stopEvent();\r
-                    r = this.doc.selection.createRange();\r
-                    if(r){\r
-                        r.collapse(true);\r
-                        r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;');\r
-                        this.deferFocus();\r
-                    }\r
-                }else if(k == e.ENTER){\r
-                    r = this.doc.selection.createRange();\r
-                    if(r){\r
-                        var target = r.parentElement();\r
-                        if(!target || target.tagName.toLowerCase() != 'li'){\r
-                            e.stopEvent();\r
-                            r.pasteHTML('<br />');\r
-                            r.collapse(false);\r
-                            r.select();\r
-                        }\r
-                    }\r
-                }\r
-            };\r
-        }else if(Ext.isOpera){\r
-            return function(e){\r
-                var k = e.getKey();\r
-                if(k == e.TAB){\r
-                    e.stopEvent();\r
-                    this.win.focus();\r
-                    this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;');\r
-                    this.deferFocus();\r
-                }\r
-            };\r
-        }else if(Ext.isSafari){\r
-            return function(e){\r
-                var k = e.getKey();\r
-                if(k == e.TAB){\r
-                    e.stopEvent();\r
-                    this.execCmd('InsertText','\t');\r
-                    this.deferFocus();\r
-                }\r
-             };\r
-        }\r
-    }(),\r
-\r
-    \r
-    getToolbar : function(){\r
-        return this.tb;\r
-    },\r
-\r
-    \r
-    buttonTips : {\r
-        bold : {\r
-            title: 'Bold (Ctrl+B)',\r
-            text: 'Make the selected text bold.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        italic : {\r
-            title: 'Italic (Ctrl+I)',\r
-            text: 'Make the selected text italic.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        underline : {\r
-            title: 'Underline (Ctrl+U)',\r
-            text: 'Underline the selected text.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        increasefontsize : {\r
-            title: 'Grow Text',\r
-            text: 'Increase the font size.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        decreasefontsize : {\r
-            title: 'Shrink Text',\r
-            text: 'Decrease the font size.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        backcolor : {\r
-            title: 'Text Highlight Color',\r
-            text: 'Change the background color of the selected text.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        forecolor : {\r
-            title: 'Font Color',\r
-            text: 'Change the color of the selected text.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        justifyleft : {\r
-            title: 'Align Text Left',\r
-            text: 'Align text to the left.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        justifycenter : {\r
-            title: 'Center Text',\r
-            text: 'Center text in the editor.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        justifyright : {\r
-            title: 'Align Text Right',\r
-            text: 'Align text to the right.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        insertunorderedlist : {\r
-            title: 'Bullet List',\r
-            text: 'Start a bulleted list.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        insertorderedlist : {\r
-            title: 'Numbered List',\r
-            text: 'Start a numbered list.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        createlink : {\r
-            title: 'Hyperlink',\r
-            text: 'Make the selected text a hyperlink.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        sourceedit : {\r
-            title: 'Source Edit',\r
-            text: 'Switch to source editing mode.',\r
-            cls: 'x-html-editor-tip'\r
-        }\r
-    }\r
-\r
-    // hide stuff that is not compatible\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-});\r
-Ext.reg('htmleditor', Ext.form.HtmlEditor);\r
-\r
-Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {\r
-    \r
-    minValue : null,\r
-    \r
-    maxValue : null,\r
-    \r
-    minText : "The time in this field must be equal to or after {0}",\r
-    \r
-    maxText : "The time in this field must be equal to or before {0}",\r
-    \r
-    invalidText : "{0} is not a valid time",\r
-    \r
-    format : "g:i A",\r
-    \r
-    altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",\r
-    \r
-    increment: 15,\r
-\r
-    // private override\r
-    mode: 'local',\r
-    // private override\r
-    triggerAction: 'all',\r
-    // private override\r
-    typeAhead: false,\r
-    \r
-    // private - This is the date to use when generating time values in the absence of either minValue\r
-    // or maxValue.  Using the current date causes DST issues on DST boundary dates, so this is an \r
-    // arbitrary "safe" date that can be any date aside from DST boundary dates.\r
-    initDate: '1/1/2008',\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.form.TimeField.superclass.initComponent.call(this);\r
-\r
-        if(typeof this.minValue == "string"){\r
-            this.minValue = this.parseDate(this.minValue);\r
-        }\r
-        if(typeof this.maxValue == "string"){\r
-            this.maxValue = this.parseDate(this.maxValue);\r
-        }\r
-\r
-        if(!this.store){\r
-            var min = this.parseDate(this.minValue);\r
-            if(!min){\r
-                min = new Date(this.initDate).clearTime();\r
-            }\r
-            var max = this.parseDate(this.maxValue);\r
-            if(!max){\r
-                max = new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1);\r
-            }\r
-            var times = [];\r
-            while(min <= max){\r
-                times.push([min.dateFormat(this.format)]);\r
-                min = min.add('mi', this.increment);\r
-            }\r
-            this.store = new Ext.data.SimpleStore({\r
-                fields: ['text'],\r
-                data : times\r
-            });\r
-            this.displayField = 'text';\r
-        }\r
-    },\r
-\r
-    // inherited docs\r
-    getValue : function(){\r
-        var v = Ext.form.TimeField.superclass.getValue.call(this);\r
-        return this.formatDate(this.parseDate(v)) || '';\r
-    },\r
-\r
-    // inherited docs\r
-    setValue : function(value){\r
-        Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));\r
-    },\r
-\r
-    // private overrides\r
-    validateValue : Ext.form.DateField.prototype.validateValue,\r
-    parseDate : Ext.form.DateField.prototype.parseDate,\r
-    formatDate : Ext.form.DateField.prototype.formatDate,\r
-\r
-    // private\r
-    beforeBlur : function(){\r
-        var v = this.parseDate(this.getRawValue());\r
-        if(v){\r
-            this.setValue(v.dateFormat(this.format));\r
-        }\r
-    }\r
-\r
-    \r
-    \r
-    \r
-    \r
-});\r
-Ext.reg('timefield', Ext.form.TimeField);\r
-\r
-Ext.form.Label = Ext.extend(Ext.BoxComponent, {\r
-    \r
-    \r
-    \r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        if(!this.el){\r
-            this.el = document.createElement('label');\r
-            this.el.id = this.getId();\r
-            this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || '');\r
-            if(this.forId){\r
-                this.el.setAttribute('for', this.forId);\r
-            }\r
-        }\r
-        Ext.form.Label.superclass.onRender.call(this, ct, position);\r
-    },\r
-    \r
-    \r
-    setText: function(t, encode){\r
-        this.text = t;\r
-        if(this.rendered){\r
-            this.el.dom.innerHTML = encode !== false ? Ext.util.Format.htmlEncode(t) : t;\r
-        }\r
-        return this;\r
-    }\r
-});\r
-\r
-Ext.reg('label', Ext.form.Label);\r
-\r
-Ext.form.Action = function(form, options){\r
-    this.form = form;\r
-    this.options = options || {};\r
-};\r
-\r
-\r
-Ext.form.Action.CLIENT_INVALID = 'client';\r
-\r
-Ext.form.Action.SERVER_INVALID = 'server';\r
-\r
-Ext.form.Action.CONNECT_FAILURE = 'connect';\r
-\r
-Ext.form.Action.LOAD_FAILURE = 'load';\r
-\r
-Ext.form.Action.prototype = {\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-\r
-    type : 'default',\r
-\r
-\r
-    // interface method\r
-    run : function(options){\r
-\r
-    },\r
-\r
-    // interface method\r
-    success : function(response){\r
-\r
-    },\r
-\r
-    // interface method\r
-    handleResponse : function(response){\r
-\r
-    },\r
-\r
-    // default connection failure\r
-    failure : function(response){\r
-        this.response = response;\r
-        this.failureType = Ext.form.Action.CONNECT_FAILURE;\r
-        this.form.afterAction(this, false);\r
-    },\r
-\r
-    // private\r
-    processResponse : function(response){\r
-        this.response = response;\r
-        if(!response.responseText){\r
-            return true;\r
-        }\r
-        this.result = this.handleResponse(response);\r
-        return this.result;\r
-    },\r
-\r
-    // utility functions used internally\r
-    getUrl : function(appendParams){\r
-        var url = this.options.url || this.form.url || this.form.el.dom.action;\r
-        if(appendParams){\r
-            var p = this.getParams();\r
-            if(p){\r
-                url += (url.indexOf('?') != -1 ? '&' : '?') + p;\r
-            }\r
-        }\r
-        return url;\r
-    },\r
-\r
-    // private\r
-    getMethod : function(){\r
-        return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase();\r
-    },\r
-\r
-    // private\r
-    getParams : function(){\r
-        var bp = this.form.baseParams;\r
-        var p = this.options.params;\r
-        if(p){\r
-            if(typeof p == "object"){\r
-                p = Ext.urlEncode(Ext.applyIf(p, bp));\r
-            }else if(typeof p == 'string' && bp){\r
-                p += '&' + Ext.urlEncode(bp);\r
-            }\r
-        }else if(bp){\r
-            p = Ext.urlEncode(bp);\r
-        }\r
-        return p;\r
-    },\r
-\r
-    // private\r
-    createCallback : function(opts){\r
-               var opts = opts || {};\r
-        return {\r
-            success: this.success,\r
-            failure: this.failure,\r
-            scope: this,\r
-            timeout: (opts.timeout*1000) || (this.form.timeout*1000),\r
-            upload: this.form.fileUpload ? this.success : undefined\r
-        };\r
-    }\r
-};\r
-\r
-\r
-Ext.form.Action.Submit = function(form, options){\r
-    Ext.form.Action.Submit.superclass.constructor.call(this, form, options);\r
-};\r
-\r
-Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {\r
-    \r
-    \r
-    type : 'submit',\r
-\r
-    // private\r
-    run : function(){\r
-        var o = this.options;\r
-        var method = this.getMethod();\r
-        var isGet = method == 'GET';\r
-        if(o.clientValidation === false || this.form.isValid()){\r
-            Ext.Ajax.request(Ext.apply(this.createCallback(o), {\r
-                form:this.form.el.dom,\r
-                url:this.getUrl(isGet),\r
-                method: method,\r
-                headers: o.headers,\r
-                params:!isGet ? this.getParams() : null,\r
-                isUpload: this.form.fileUpload\r
-            }));\r
-        }else if (o.clientValidation !== false){ // client validation failed\r
-            this.failureType = Ext.form.Action.CLIENT_INVALID;\r
-            this.form.afterAction(this, false);\r
-        }\r
-    },\r
-\r
-    // private\r
-    success : function(response){\r
-        var result = this.processResponse(response);\r
-        if(result === true || result.success){\r
-            this.form.afterAction(this, true);\r
-            return;\r
-        }\r
-        if(result.errors){\r
-            this.form.markInvalid(result.errors);\r
-            this.failureType = Ext.form.Action.SERVER_INVALID;\r
-        }\r
-        this.form.afterAction(this, false);\r
-    },\r
-\r
-    // private\r
-    handleResponse : function(response){\r
-        if(this.form.errorReader){\r
-            var rs = this.form.errorReader.read(response);\r
-            var errors = [];\r
-            if(rs.records){\r
-                for(var i = 0, len = rs.records.length; i < len; i++) {\r
-                    var r = rs.records[i];\r
-                    errors[i] = r.data;\r
-                }\r
-            }\r
-            if(errors.length < 1){\r
-                errors = null;\r
-            }\r
-            return {\r
-                success : rs.success,\r
-                errors : errors\r
-            };\r
-        }\r
-        return Ext.decode(response.responseText);\r
-    }\r
-});\r
-\r
-\r
-\r
-Ext.form.Action.Load = function(form, options){\r
-    Ext.form.Action.Load.superclass.constructor.call(this, form, options);\r
-    this.reader = this.form.reader;\r
-};\r
-\r
-Ext.extend(Ext.form.Action.Load, Ext.form.Action, {\r
-    // private\r
-    type : 'load',\r
-\r
-    // private\r
-    run : function(){\r
-        Ext.Ajax.request(Ext.apply(\r
-                this.createCallback(this.options), {\r
-                    method:this.getMethod(),\r
-                    url:this.getUrl(false),\r
-                    headers: this.options.headers,\r
-                    params:this.getParams()\r
-        }));\r
-    },\r
-\r
-    // private\r
-    success : function(response){\r
-        var result = this.processResponse(response);\r
-        if(result === true || !result.success || !result.data){\r
-            this.failureType = Ext.form.Action.LOAD_FAILURE;\r
-            this.form.afterAction(this, false);\r
-            return;\r
-        }\r
-        this.form.clearInvalid();\r
-        this.form.setValues(result.data);\r
-        this.form.afterAction(this, true);\r
-    },\r
-\r
-    // private\r
-    handleResponse : function(response){\r
-        if(this.form.reader){\r
-            var rs = this.form.reader.read(response);\r
-            var data = rs.records && rs.records[0] ? rs.records[0].data : null;\r
-            return {\r
-                success : rs.success,\r
-                data : data\r
-            };\r
-        }\r
-        return Ext.decode(response.responseText);\r
-    }\r
-});\r
-\r
-Ext.form.Action.ACTION_TYPES = {\r
-    'load' : Ext.form.Action.Load,\r
-    'submit' : Ext.form.Action.Submit\r
-};\r
-\r
-\r
-Ext.form.VTypes = function(){\r
-    // closure these in so they are only created once.\r
-    var alpha = /^[a-zA-Z_]+$/;\r
-    var alphanum = /^[a-zA-Z0-9_]+$/;\r
-    var email = /^([\w]+)(\.[\w]+)*@([\w\-]+\.){1,5}([A-Za-z]){2,4}$/;\r
-    var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;\r
-\r
-    // All these messages and functions are configurable\r
-    return {\r
-        \r
-        'email' : function(v){\r
-            return email.test(v);\r
-        },\r
-        \r
-        'emailText' : 'This field should be an e-mail address in the format "user@domain.com"',\r
-        \r
-        'emailMask' : /[a-z0-9_\.\-@]/i,\r
-\r
-        \r
-        'url' : function(v){\r
-            return url.test(v);\r
-        },\r
-        \r
-        'urlText' : 'This field should be a URL in the format "http:/'+'/www.domain.com"',\r
-        \r
-        \r
-        'alpha' : function(v){\r
-            return alpha.test(v);\r
-        },\r
-        \r
-        'alphaText' : 'This field should only contain letters and _',\r
-        \r
-        'alphaMask' : /[a-z_]/i,\r
-\r
-        \r
-        'alphanum' : function(v){\r
-            return alphanum.test(v);\r
-        },\r
-        \r
-        'alphanumText' : 'This field should only contain letters, numbers and _',\r
-        \r
-        'alphanumMask' : /[a-z0-9_]/i\r
-    };\r
-}();\r
-\r
-Ext.grid.GridPanel = Ext.extend(Ext.Panel, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    \r
-    ddText : "{0} selected row{1}",\r
-    \r
-    minColumnWidth : 25,\r
-    \r
-    trackMouseOver : true,\r
-    \r
-    enableDragDrop : false,\r
-    \r
-    enableColumnMove : true,\r
-    \r
-    enableColumnHide : true,\r
-    \r
-    enableHdMenu : true,\r
-    \r
-    stripeRows : false,\r
-    \r
-    autoExpandColumn : false,\r
-    \r
-    autoExpandMin : 50,\r
-    \r
-    autoExpandMax : 1000,\r
-    \r
-    view : null,\r
-    \r
-    loadMask : false,\r
-\r
-    \r
-    deferRowRender : true,\r
-\r
-    // private\r
-    rendered : false,\r
-    // private\r
-    viewReady: false,\r
-    \r
-    stateEvents: ["columnmove", "columnresize", "sortchange"],\r
-\r
-    // private\r
-    initComponent : function(){\r
-        Ext.grid.GridPanel.superclass.initComponent.call(this);\r
-\r
-        // override any provided value since it isn't valid\r
-        this.autoScroll = false;\r
-        this.autoWidth = false;\r
-\r
-        if(Ext.isArray(this.columns)){\r
-            this.colModel = new Ext.grid.ColumnModel(this.columns);\r
-            delete this.columns;\r
-        }\r
-\r
-        // check and correct shorthanded configs\r
-        if(this.ds){\r
-            this.store = this.ds;\r
-            delete this.ds;\r
-        }\r
-        if(this.cm){\r
-            this.colModel = this.cm;\r
-            delete this.cm;\r
-        }\r
-        if(this.sm){\r
-            this.selModel = this.sm;\r
-            delete this.sm;\r
-        }\r
-        this.store = Ext.StoreMgr.lookup(this.store);\r
-\r
-        this.addEvents(\r
-            // raw events\r
-            \r
-            "click",\r
-            \r
-            "dblclick",\r
-            \r
-            "contextmenu",\r
-            \r
-            "mousedown",\r
-            \r
-            "mouseup",\r
-            \r
-            "mouseover",\r
-            \r
-            "mouseout",\r
-            \r
-            "keypress",\r
-            \r
-            "keydown",\r
-\r
-            // custom events\r
-            \r
-            "cellmousedown",\r
-            \r
-            "rowmousedown",\r
-            \r
-            "headermousedown",\r
-\r
-            \r
-            "cellclick",\r
-            \r
-            "celldblclick",\r
-            \r
-            "rowclick",\r
-            \r
-            "rowdblclick",\r
-            \r
-            "headerclick",\r
-            \r
-            "headerdblclick",\r
-            \r
-            "rowcontextmenu",\r
-            \r
-            "cellcontextmenu",\r
-            \r
-            "headercontextmenu",\r
-            \r
-            "bodyscroll",\r
-            \r
-            "columnresize",\r
-            \r
-            "columnmove",\r
-            \r
-            "sortchange"\r
-        );\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);\r
-\r
-        var c = this.body;\r
-\r
-        this.el.addClass('x-grid-panel');\r
-\r
-        var view = this.getView();\r
-        view.init(this);\r
-\r
-        c.on("mousedown", this.onMouseDown, this);\r
-        c.on("click", this.onClick, this);\r
-        c.on("dblclick", this.onDblClick, this);\r
-        c.on("contextmenu", this.onContextMenu, this);\r
-        c.on("keydown", this.onKeyDown, this);\r
-\r
-        this.relayEvents(c, ["mousedown","mouseup","mouseover","mouseout","keypress"]);\r
-\r
-        this.getSelectionModel().init(this);\r
-        this.view.render();\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.grid.GridPanel.superclass.initEvents.call(this);\r
-\r
-        if(this.loadMask){\r
-            this.loadMask = new Ext.LoadMask(this.bwrap,\r
-                    Ext.apply({store:this.store}, this.loadMask));\r
-        }\r
-    },\r
-\r
-    initStateEvents : function(){\r
-        Ext.grid.GridPanel.superclass.initStateEvents.call(this);\r
-        this.colModel.on('hiddenchange', this.saveState, this, {delay: 100});\r
-    },\r
-\r
-    applyState : function(state){\r
-        var cm = this.colModel;\r
-        var cs = state.columns;\r
-        if(cs){\r
-            for(var i = 0, len = cs.length; i < len; i++){\r
-                var s = cs[i];\r
-                var c = cm.getColumnById(s.id);\r
-                if(c){\r
-                    c.hidden = s.hidden;\r
-                    c.width = s.width;\r
-                    var oldIndex = cm.getIndexById(s.id);\r
-                    if(oldIndex != i){\r
-                        cm.moveColumn(oldIndex, i);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-        if(state.sort){\r
-            this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction);\r
-        }\r
-    },\r
-\r
-    getState : function(){\r
-        var o = {columns: []};\r
-        for(var i = 0, c; c = this.colModel.config[i]; i++){\r
-            o.columns[i] = {\r
-                id: c.id,\r
-                width: c.width\r
-            };\r
-            if(c.hidden){\r
-                o.columns[i].hidden = true;\r
-            }\r
-        }\r
-        var ss = this.store.getSortState();\r
-        if(ss){\r
-            o.sort = ss;\r
-        }\r
-        return o;\r
-    },\r
-\r
-    // private\r
-    afterRender : function(){\r
-        Ext.grid.GridPanel.superclass.afterRender.call(this);\r
-        this.view.layout();\r
-        if(this.deferRowRender){\r
-            this.view.afterRender.defer(10, this.view);\r
-        }else{\r
-            this.view.afterRender();\r
-        }\r
-        this.viewReady = true;\r
-    },\r
-\r
-    \r
-    reconfigure : function(store, colModel){\r
-        if(this.loadMask){\r
-            this.loadMask.destroy();\r
-            this.loadMask = new Ext.LoadMask(this.bwrap,\r
-                    Ext.apply({store:store}, this.initialConfig.loadMask));\r
-        }\r
-        this.view.bind(store, colModel);\r
-        this.store = store;\r
-        this.colModel = colModel;\r
-        if(this.rendered){\r
-            this.view.refresh(true);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onKeyDown : function(e){\r
-        this.fireEvent("keydown", e);\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.rendered){\r
-            if(this.loadMask){\r
-                this.loadMask.destroy();\r
-            }\r
-            var c = this.body;\r
-            c.removeAllListeners();\r
-            this.view.destroy();\r
-            c.update("");\r
-        }\r
-        this.colModel.purgeListeners();\r
-        Ext.grid.GridPanel.superclass.onDestroy.call(this);\r
-    },\r
-\r
-    // private\r
-    processEvent : function(name, e){\r
-        this.fireEvent(name, e);\r
-        var t = e.getTarget();\r
-        var v = this.view;\r
-        var header = v.findHeaderIndex(t);\r
-        if(header !== false){\r
-            this.fireEvent("header" + name, this, header, e);\r
-        }else{\r
-            var row = v.findRowIndex(t);\r
-            var cell = v.findCellIndex(t);\r
-            if(row !== false){\r
-                this.fireEvent("row" + name, this, row, e);\r
-                if(cell !== false){\r
-                    this.fireEvent("cell" + name, this, row, cell, e);\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    onClick : function(e){\r
-        this.processEvent("click", e);\r
-    },\r
-\r
-    // private\r
-    onMouseDown : function(e){\r
-        this.processEvent("mousedown", e);\r
-    },\r
-\r
-    // private\r
-    onContextMenu : function(e, t){\r
-        this.processEvent("contextmenu", e);\r
-    },\r
-\r
-    // private\r
-    onDblClick : function(e){\r
-        this.processEvent("dblclick", e);\r
-    },\r
-\r
-    // private\r
-    walkCells : function(row, col, step, fn, scope){\r
-        var cm = this.colModel, clen = cm.getColumnCount();\r
-        var ds = this.store, rlen = ds.getCount(), first = true;\r
-        if(step < 0){\r
-            if(col < 0){\r
-                row--;\r
-                first = false;\r
-            }\r
-            while(row >= 0){\r
-                if(!first){\r
-                    col = clen-1;\r
-                }\r
-                first = false;\r
-                while(col >= 0){\r
-                    if(fn.call(scope || this, row, col, cm) === true){\r
-                        return [row, col];\r
-                    }\r
-                    col--;\r
-                }\r
-                row--;\r
-            }\r
-        } else {\r
-            if(col >= clen){\r
-                row++;\r
-                first = false;\r
-            }\r
-            while(row < rlen){\r
-                if(!first){\r
-                    col = 0;\r
-                }\r
-                first = false;\r
-                while(col < clen){\r
-                    if(fn.call(scope || this, row, col, cm) === true){\r
-                        return [row, col];\r
-                    }\r
-                    col++;\r
-                }\r
-                row++;\r
-            }\r
-        }\r
-        return null;\r
-    },\r
-\r
-    // private\r
-    getSelections : function(){\r
-        return this.selModel.getSelections();\r
-    },\r
-\r
-    // private\r
-    onResize : function(){\r
-        Ext.grid.GridPanel.superclass.onResize.apply(this, arguments);\r
-        if(this.viewReady){\r
-            this.view.layout();\r
-        }\r
-    },\r
-\r
-    \r
-    getGridEl : function(){\r
-        return this.body;\r
-    },\r
-\r
-    // private for compatibility, overridden by editor grid\r
-    stopEditing : Ext.emptyFn,\r
-\r
-    \r
-    getSelectionModel : function(){\r
-        if(!this.selModel){\r
-            this.selModel = new Ext.grid.RowSelectionModel(\r
-                    this.disableSelection ? {selectRow: Ext.emptyFn} : null);\r
-        }\r
-        return this.selModel;\r
-    },\r
-\r
-    \r
-    getStore : function(){\r
-        return this.store;\r
-    },\r
-\r
-    \r
-    getColumnModel : function(){\r
-        return this.colModel;\r
-    },\r
-\r
-    \r
-    getView : function(){\r
-        if(!this.view){\r
-            this.view = new Ext.grid.GridView(this.viewConfig);\r
-        }\r
-        return this.view;\r
-    },\r
-    \r
-    getDragDropText : function(){\r
-        var count = this.selModel.getCount();\r
-        return String.format(this.ddText, count, count == 1 ? '' : 's');\r
-    }\r
-\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-\r
-\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-});\r
-Ext.reg('grid', Ext.grid.GridPanel);\r
-\r
-Ext.grid.GridView = function(config){\r
-    Ext.apply(this, config);\r
-    // These events are only used internally by the grid components\r
-    this.addEvents(\r
-      \r
-      "beforerowremoved",\r
-      \r
-      "beforerowsinserted",\r
-      \r
-      "beforerefresh",\r
-      \r
-      "rowremoved",\r
-      \r
-      "rowsinserted",\r
-      \r
-      "rowupdated",\r
-      \r
-      "refresh"\r
-  );\r
-    Ext.grid.GridView.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.grid.GridView, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    deferEmptyText: true,\r
-    \r
-    scrollOffset: 19,\r
-    \r
-    autoFill: false,\r
-    \r
-    forceFit: false,\r
-    \r
-    sortClasses : ["sort-asc", "sort-desc"],\r
-    \r
-    sortAscText : "Sort Ascending",\r
-    \r
-    sortDescText : "Sort Descending",\r
-    \r
-    columnsText : "Columns",\r
-\r
-    // private\r
-    borderWidth: 2,\r
-    tdClass: 'x-grid3-cell',\r
-    hdCls: 'x-grid3-hd',\r
-\r
-    \r
-    cellSelectorDepth: 4,\r
-    \r
-    rowSelectorDepth: 10,\r
-\r
-    \r
-    cellSelector: 'td.x-grid3-cell',\r
-    \r
-    rowSelector: 'div.x-grid3-row',\r
-\r
-    \r
-\r
-    // private\r
-    initTemplates : function(){\r
-        var ts = this.templates || {};\r
-        if(!ts.master){\r
-            ts.master = new Ext.Template(\r
-                    '<div class="x-grid3" hidefocus="true">',\r
-                        '<div class="x-grid3-viewport">',\r
-                            '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>',\r
-                            '<div class="x-grid3-scroller"><div class="x-grid3-body">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',\r
-                        "</div>",\r
-                        '<div class="x-grid3-resize-marker">&#160;</div>',\r
-                        '<div class="x-grid3-resize-proxy">&#160;</div>',\r
-                    "</div>"\r
-                    );\r
-        }\r
-\r
-        if(!ts.header){\r
-            ts.header = new Ext.Template(\r
-                    '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',\r
-                    '<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',\r
-                    "</table>"\r
-                    );\r
-        }\r
-\r
-        if(!ts.hcell){\r
-            ts.hcell = new Ext.Template(\r
-                    '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id} {css}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',\r
-                    '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',\r
-                    "</div></td>"\r
-                    );\r
-        }\r
-\r
-        if(!ts.body){\r
-            ts.body = new Ext.Template('{rows}');\r
-        }\r
-\r
-        if(!ts.row){\r
-            ts.row = new Ext.Template(\r
-                    '<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',\r
-                    '<tbody><tr>{cells}</tr>',\r
-                    (this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),\r
-                    '</tbody></table></div>'\r
-                    );\r
-        }\r
-\r
-        if(!ts.cell){\r
-            ts.cell = new Ext.Template(\r
-                    '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',\r
-                    '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',\r
-                    "</td>"\r
-                    );\r
-        }\r
-\r
-        for(var k in ts){\r
-            var t = ts[k];\r
-            if(t && typeof t.compile == 'function' && !t.compiled){\r
-                t.disableFormats = true;\r
-                t.compile();\r
-            }\r
-        }\r
-\r
-        this.templates = ts;\r
-        this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");\r
-    },\r
-\r
-    // private\r
-    fly : function(el){\r
-        if(!this._flyweight){\r
-            this._flyweight = new Ext.Element.Flyweight(document.body);\r
-        }\r
-        this._flyweight.dom = el;\r
-        return this._flyweight;\r
-    },\r
-\r
-    // private\r
-    getEditorParent : function(){\r
-        return this.scroller.dom;\r
-    },\r
-\r
-    // private\r
-    initElements : function(){\r
-        var E = Ext.Element;\r
-\r
-        var el = this.grid.getGridEl().dom.firstChild;\r
-        var cs = el.childNodes;\r
-\r
-        this.el = new E(el);\r
-\r
-        this.mainWrap = new E(cs[0]);\r
-        this.mainHd = new E(this.mainWrap.dom.firstChild);\r
-\r
-        if(this.grid.hideHeaders){\r
-            this.mainHd.setDisplayed(false);\r
-        }\r
-\r
-        this.innerHd = this.mainHd.dom.firstChild;\r
-        this.scroller = new E(this.mainWrap.dom.childNodes[1]);\r
-        if(this.forceFit){\r
-            this.scroller.setStyle('overflow-x', 'hidden');\r
-        }\r
-        \r
-        this.mainBody = new E(this.scroller.dom.firstChild);\r
-\r
-        this.focusEl = new E(this.scroller.dom.childNodes[1]);\r
-        this.focusEl.swallowEvent("click", true);\r
-\r
-        this.resizeMarker = new E(cs[1]);\r
-        this.resizeProxy = new E(cs[2]);\r
-    },\r
-\r
-    // private\r
-    getRows : function(){\r
-        return this.hasRows() ? this.mainBody.dom.childNodes : [];\r
-    },\r
-\r
-    // finder methods, used with delegation\r
-\r
-    // private\r
-    findCell : function(el){\r
-        if(!el){\r
-            return false;\r
-        }\r
-        return this.fly(el).findParent(this.cellSelector, this.cellSelectorDepth);\r
-    },\r
-\r
-    // private\r
-    findCellIndex : function(el, requiredCls){\r
-        var cell = this.findCell(el);\r
-        if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){\r
-            return this.getCellIndex(cell);\r
-        }\r
-        return false;\r
-    },\r
-\r
-    // private\r
-    getCellIndex : function(el){\r
-        if(el){\r
-            var m = el.className.match(this.colRe);\r
-            if(m && m[1]){\r
-                return this.cm.getIndexById(m[1]);\r
-            }\r
-        }\r
-        return false;\r
-    },\r
-\r
-    // private\r
-    findHeaderCell : function(el){\r
-        var cell = this.findCell(el);\r
-        return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null;\r
-    },\r
-\r
-    // private\r
-    findHeaderIndex : function(el){\r
-        return this.findCellIndex(el, this.hdCls);\r
-    },\r
-\r
-\r
-    findRow : function(el){\r
-        if(!el){\r
-            return false;\r
-        }\r
-        return this.fly(el).findParent(this.rowSelector, this.rowSelectorDepth);\r
-    },\r
-\r
-\r
-    findRowIndex : function(el){\r
-        var r = this.findRow(el);\r
-        return r ? r.rowIndex : false;\r
-    },\r
-\r
-    // getter methods for fetching elements dynamically in the grid\r
-\r
-\r
-    getRow : function(row){\r
-        return this.getRows()[row];\r
-    },\r
-\r
-\r
-    getCell : function(row, col){\r
-        return this.getRow(row).getElementsByTagName('td')[col];\r
-    },\r
-\r
-\r
-    getHeaderCell : function(index){\r
-      return this.mainHd.dom.getElementsByTagName('td')[index];\r
-    },\r
-\r
-    // manipulating elements\r
-\r
-    // private - use getRowClass to apply custom row classes\r
-    addRowClass : function(row, cls){\r
-        var r = this.getRow(row);\r
-        if(r){\r
-            this.fly(r).addClass(cls);\r
-        }\r
-    },\r
-\r
-    // private\r
-    removeRowClass : function(row, cls){\r
-        var r = this.getRow(row);\r
-        if(r){\r
-            this.fly(r).removeClass(cls);\r
-        }\r
-    },\r
-\r
-    // private\r
-    removeRow : function(row){\r
-        Ext.removeNode(this.getRow(row));\r
-        this.syncFocusEl(row);\r
-    },\r
-    \r
-    // private\r
-    removeRows : function(firstRow, lastRow){\r
-        var bd = this.mainBody.dom;\r
-        for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){\r
-            Ext.removeNode(bd.childNodes[firstRow]);\r
-        }\r
-        this.syncFocusEl(firstRow);\r
-    },\r
-\r
-    // scrolling stuff\r
-\r
-    // private\r
-    getScrollState : function(){\r
-        var sb = this.scroller.dom;\r
-        return {left: sb.scrollLeft, top: sb.scrollTop};\r
-    },\r
-\r
-    // private\r
-    restoreScroll : function(state){\r
-        var sb = this.scroller.dom;\r
-        sb.scrollLeft = state.left;\r
-        sb.scrollTop = state.top;\r
-    },\r
-\r
-    \r
-    scrollToTop : function(){\r
-        this.scroller.dom.scrollTop = 0;\r
-        this.scroller.dom.scrollLeft = 0;\r
-    },\r
-\r
-    // private\r
-    syncScroll : function(){\r
-      this.syncHeaderScroll();\r
-      var mb = this.scroller.dom;\r
-        this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop);\r
-    },\r
-\r
-    // private\r
-    syncHeaderScroll : function(){\r
-        var mb = this.scroller.dom;\r
-        this.innerHd.scrollLeft = mb.scrollLeft;\r
-        this.innerHd.scrollLeft = mb.scrollLeft; // second time for IE (1/2 time first fails, other browsers ignore)\r
-    },\r
-\r
-    // private\r
-    updateSortIcon : function(col, dir){\r
-        var sc = this.sortClasses;\r
-        var hds = this.mainHd.select('td').removeClass(sc);\r
-        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);\r
-    },\r
-\r
-    // private\r
-    updateAllColumnWidths : function(){\r
-        var tw = this.getTotalWidth();\r
-        var clen = this.cm.getColumnCount();\r
-        var ws = [];\r
-        for(var i = 0; i < clen; i++){\r
-            ws[i] = this.getColumnWidth(i);\r
-        }\r
-\r
-        this.innerHd.firstChild.firstChild.style.width = tw;\r
-\r
-        for(var i = 0; i < clen; i++){\r
-            var hd = this.getHeaderCell(i);\r
-            hd.style.width = ws[i];\r
-        }\r
-\r
-        var ns = this.getRows(), row, trow;\r
-        for(var i = 0, len = ns.length; i < len; i++){\r
-            row = ns[i];\r
-            row.style.width = tw;\r
-            if(row.firstChild){\r
-                row.firstChild.style.width = tw;\r
-                trow = row.firstChild.rows[0];\r
-                for (var j = 0; j < clen; j++) {\r
-                   trow.childNodes[j].style.width = ws[j];\r
-                }\r
-            }\r
-        }\r
-\r
-        this.onAllColumnWidthsUpdated(ws, tw);\r
-    },\r
-\r
-    // private\r
-    updateColumnWidth : function(col, width){\r
-        var w = this.getColumnWidth(col);\r
-        var tw = this.getTotalWidth();\r
-\r
-        this.innerHd.firstChild.firstChild.style.width = tw;\r
-        var hd = this.getHeaderCell(col);\r
-        hd.style.width = w;\r
-\r
-        var ns = this.getRows(), row;\r
-        for(var i = 0, len = ns.length; i < len; i++){\r
-            row = ns[i];\r
-            row.style.width = tw;\r
-            if(row.firstChild){\r
-                row.firstChild.style.width = tw;\r
-                row.firstChild.rows[0].childNodes[col].style.width = w;\r
-            }\r
-        }\r
-\r
-        this.onColumnWidthUpdated(col, w, tw);\r
-    },\r
-\r
-    // private\r
-    updateColumnHidden : function(col, hidden){\r
-        var tw = this.getTotalWidth();\r
-\r
-        this.innerHd.firstChild.firstChild.style.width = tw;\r
-\r
-        var display = hidden ? 'none' : '';\r
-\r
-        var hd = this.getHeaderCell(col);\r
-        hd.style.display = display;\r
-\r
-        var ns = this.getRows(), row;\r
-        for(var i = 0, len = ns.length; i < len; i++){\r
-            row = ns[i];\r
-            row.style.width = tw;\r
-            if(row.firstChild){\r
-                row.firstChild.style.width = tw;\r
-                row.firstChild.rows[0].childNodes[col].style.display = display;\r
-            }\r
-        }\r
-\r
-        this.onColumnHiddenUpdated(col, hidden, tw);\r
-\r
-        delete this.lastViewWidth; // force recalc\r
-        this.layout();\r
-    },\r
-\r
-    // private\r
-    doRender : function(cs, rs, ds, startRow, colCount, stripe){\r
-        var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;\r
-        var tstyle = 'width:'+this.getTotalWidth()+';';\r
-        // buffers\r
-        var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;\r
-        for(var j = 0, len = rs.length; j < len; j++){\r
-            r = rs[j]; cb = [];\r
-            var rowIndex = (j+startRow);\r
-            for(var i = 0; i < colCount; i++){\r
-                c = cs[i];\r
-                p.id = c.id;\r
-                p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');\r
-                p.attr = p.cellAttr = "";\r
-                p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);\r
-                p.style = c.style;\r
-                if(p.value == undefined || p.value === "") p.value = "&#160;";\r
-                if(r.dirty && typeof r.modified[c.name] !== 'undefined'){\r
-                    p.css += ' x-grid3-dirty-cell';\r
-                }\r
-                cb[cb.length] = ct.apply(p);\r
-            }\r
-            var alt = [];\r
-            if(stripe && ((rowIndex+1) % 2 == 0)){\r
-                alt[0] = "x-grid3-row-alt";\r
-            }\r
-            if(r.dirty){\r
-                alt[1] = " x-grid3-dirty-row";\r
-            }\r
-            rp.cols = colCount;\r
-            if(this.getRowClass){\r
-                alt[2] = this.getRowClass(r, rowIndex, rp, ds);\r
-            }\r
-            rp.alt = alt.join(" ");\r
-            rp.cells = cb.join("");\r
-            buf[buf.length] =  rt.apply(rp);\r
-        }\r
-        return buf.join("");\r
-    },\r
-\r
-    // private\r
-    processRows : function(startRow, skipStripe){\r
-        if(this.ds.getCount() < 1){\r
-            return;\r
-        }\r
-        skipStripe = skipStripe || !this.grid.stripeRows;\r
-        startRow = startRow || 0;\r
-        var rows = this.getRows();\r
-        var cls = ' x-grid3-row-alt ';\r
-        rows[0].className += ' x-grid3-row-first';\r
-        rows[rows.length - 1].className += ' x-grid3-row-last';\r
-        for(var i = startRow, len = rows.length; i < len; i++){\r
-            var row = rows[i];\r
-            row.rowIndex = i;\r
-            if(!skipStripe){\r
-                var isAlt = ((i+1) % 2 == 0);\r
-                var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1;\r
-                if(isAlt == hasAlt){\r
-                    continue;\r
-                }\r
-                if(isAlt){\r
-                    row.className += " x-grid3-row-alt";\r
-                }else{\r
-                    row.className = row.className.replace("x-grid3-row-alt", "");\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    afterRender: function(){\r
-        this.mainBody.dom.innerHTML = this.renderRows();\r
-        this.processRows(0, true);\r
-\r
-        if(this.deferEmptyText !== true){\r
-            this.applyEmptyText();\r
-        }\r
-    },\r
-\r
-    // private\r
-    renderUI : function(){\r
-\r
-        var header = this.renderHeaders();\r
-        var body = this.templates.body.apply({rows:''});\r
-\r
-\r
-        var html = this.templates.master.apply({\r
-            body: body,\r
-            header: header\r
-        });\r
-\r
-        var g = this.grid;\r
-\r
-        g.getGridEl().dom.innerHTML = html;\r
-\r
-        this.initElements();\r
-\r
-        // get mousedowns early\r
-        Ext.fly(this.innerHd).on("click", this.handleHdDown, this);\r
-        this.mainHd.on("mouseover", this.handleHdOver, this);\r
-        this.mainHd.on("mouseout", this.handleHdOut, this);\r
-        this.mainHd.on("mousemove", this.handleHdMove, this);\r
-\r
-        this.scroller.on('scroll', this.syncScroll,  this);\r
-        if(g.enableColumnResize !== false){\r
-            this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);\r
-        }\r
-\r
-        if(g.enableColumnMove){\r
-            this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);\r
-            this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);\r
-        }\r
-\r
-        if(g.enableHdMenu !== false){\r
-            if(g.enableColumnHide !== false){\r
-                this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});\r
-                this.colMenu.on("beforeshow", this.beforeColMenuShow, this);\r
-                this.colMenu.on("itemclick", this.handleHdMenuClick, this);\r
-            }\r
-            this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});\r
-            this.hmenu.add(\r
-                {id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},\r
-                {id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}\r
-            );\r
-            if(g.enableColumnHide !== false){\r
-                this.hmenu.add('-',\r
-                    {id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'}\r
-                );\r
-            }\r
-            this.hmenu.on("itemclick", this.handleHdMenuClick, this);\r
-\r
-            //g.on("headercontextmenu", this.handleHdCtx, this);\r
-        }\r
-\r
-        if(g.trackMouseOver){\r
-            this.mainBody.on("mouseover", this.onRowOver, this);\r
-            this.mainBody.on("mouseout", this.onRowOut, this);\r
-        }\r
-        if(g.enableDragDrop || g.enableDrag){\r
-            this.dragZone = new Ext.grid.GridDragZone(g, {\r
-                ddGroup : g.ddGroup || 'GridDD'\r
-            });\r
-        }\r
-\r
-        this.updateHeaderSortState();\r
-\r
-    },\r
-\r
-    // private\r
-    layout : function(){\r
-        if(!this.mainBody){\r
-            return; // not rendered\r
-        }\r
-        var g = this.grid;\r
-        var c = g.getGridEl();\r
-        var csize = c.getSize(true);\r
-        var vw = csize.width;\r
-\r
-        if(vw < 20 || csize.height < 20){ // display: none?\r
-            return;\r
-        }\r
-\r
-        if(g.autoHeight){\r
-            this.scroller.dom.style.overflow = 'visible';\r
-            if(Ext.isSafari){\r
-                this.scroller.dom.style.position = 'static';\r
-            }\r
-        }else{\r
-            this.el.setSize(csize.width, csize.height);\r
-\r
-            var hdHeight = this.mainHd.getHeight();\r
-            var vh = csize.height - (hdHeight);\r
-\r
-            this.scroller.setSize(vw, vh);\r
-            if(this.innerHd){\r
-                this.innerHd.style.width = (vw)+'px';\r
-            }\r
-        }\r
-        if(this.forceFit){\r
-            if(this.lastViewWidth != vw){\r
-                this.fitColumns(false, false);\r
-                this.lastViewWidth = vw;\r
-            }\r
-        }else {\r
-            this.autoExpand();\r
-            this.syncHeaderScroll();\r
-        }\r
-        this.onLayout(vw, vh);\r
-    },\r
-\r
-    // template functions for subclasses and plugins\r
-    // these functions include precalculated values\r
-    onLayout : function(vw, vh){\r
-        // do nothing\r
-    },\r
-\r
-    onColumnWidthUpdated : function(col, w, tw){\r
-        //template method\r
-        this.focusEl.setWidth(tw);\r
-    },\r
-\r
-    onAllColumnWidthsUpdated : function(ws, tw){\r
-        //template method\r
-        this.focusEl.setWidth(tw);\r
-    },\r
-\r
-    onColumnHiddenUpdated : function(col, hidden, tw){\r
-        // template method\r
-        this.focusEl.setWidth(tw);\r
-    },\r
-\r
-    updateColumnText : function(col, text){\r
-        // template method\r
-    },\r
-\r
-    afterMove : function(colIndex){\r
-        // template method\r
-    },\r
-\r
-    \r
-    // private\r
-    init: function(grid){\r
-        this.grid = grid;\r
-\r
-        this.initTemplates();\r
-        this.initData(grid.store, grid.colModel);\r
-        this.initUI(grid);\r
-    },\r
-\r
-    // private\r
-    getColumnId : function(index){\r
-      return this.cm.getColumnId(index);\r
-    },\r
-\r
-    // private\r
-    renderHeaders : function(){\r
-        var cm = this.cm, ts = this.templates;\r
-        var ct = ts.hcell;\r
-\r
-        var cb = [], sb = [], p = {};\r
-        var len = cm.getColumnCount();\r
-        var last = len - 1;\r
-        for(var i = 0; i < len; i++){\r
-            p.id = cm.getColumnId(i);\r
-            p.value = cm.getColumnHeader(i) || "";\r
-            p.style = this.getColumnStyle(i, true);\r
-            p.tooltip = this.getColumnTooltip(i);\r
-            p.css = i == 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');\r
-            if(cm.config[i].align == 'right'){\r
-                p.istyle = 'padding-right:16px';\r
-            } else {\r
-                delete p.istyle;\r
-            }\r
-            cb[cb.length] = ct.apply(p);\r
-        }\r
-        return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});\r
-    },\r
-\r
-    // private\r
-    getColumnTooltip : function(i){\r
-        var tt = this.cm.getColumnTooltip(i);\r
-        if(tt){\r
-            if(Ext.QuickTips.isEnabled()){\r
-                return 'ext:qtip="'+tt+'"';\r
-            }else{\r
-                return 'title="'+tt+'"';\r
-            }\r
-        }\r
-        return "";\r
-    },\r
-\r
-    // private\r
-    beforeUpdate : function(){\r
-        this.grid.stopEditing(true);\r
-    },\r
-\r
-    // private\r
-    updateHeaders : function(){\r
-        this.innerHd.firstChild.innerHTML = this.renderHeaders();\r
-    },\r
-\r
-    \r
-    focusRow : function(row){\r
-        this.focusCell(row, 0, false);\r
-    },\r
-\r
-    \r
-    focusCell : function(row, col, hscroll){\r
-               this.syncFocusEl(this.ensureVisible(row, col, hscroll));\r
-        if(Ext.isGecko){\r
-            this.focusEl.focus();\r
-        }else{\r
-            this.focusEl.focus.defer(1, this.focusEl);\r
-        }\r
-    },\r
-\r
-       resolveCell : function(row, col, hscroll){\r
-               if(typeof row != "number"){\r
-            row = row.rowIndex;\r
-        }\r
-        if(!this.ds){\r
-            return null;\r
-        }\r
-        if(row < 0 || row >= this.ds.getCount()){\r
-            return null;\r
-        }\r
-        col = (col !== undefined ? col : 0);\r
-\r
-        var rowEl = this.getRow(row), cellEl;\r
-        if(!(hscroll === false && col === 0)){\r
-            while(this.cm.isHidden(col)){\r
-                col++;\r
-            }\r
-            cellEl = this.getCell(row, col);\r
-        }\r
-\r
-               return {row: rowEl, cell: cellEl};\r
-       },\r
-\r
-       getResolvedXY : function(resolved){\r
-               if(!resolved){\r
-                       return null;\r
-               }\r
-               var s = this.scroller.dom, c = resolved.cell, r = resolved.row;\r
-               return c ? Ext.fly(c).getXY() : [this.el.getX(), Ext.fly(r).getY()];\r
-       },\r
-\r
-       syncFocusEl : function(row, col, hscroll){\r
-               var xy = row;\r
-               if(!Ext.isArray(xy)){\r
-                       row = Math.min(row, Math.max(0, this.getRows().length-1));\r
-               xy = this.getResolvedXY(this.resolveCell(row, col, hscroll));\r
-               }\r
-        this.focusEl.setXY(xy||this.scroller.getXY());\r
-    },\r
-\r
-       ensureVisible : function(row, col, hscroll){\r
-        var resolved = this.resolveCell(row, col, hscroll);\r
-               if(!resolved || !resolved.row){\r
-                       return;\r
-               }\r
-\r
-               var rowEl = resolved.row, cellEl = resolved.cell;\r
-\r
-               var c = this.scroller.dom;\r
-\r
-        var ctop = 0;\r
-        var p = rowEl, stop = this.el.dom;\r
-        while(p && p != stop){\r
-            ctop += p.offsetTop;\r
-            p = p.offsetParent;\r
-        }\r
-        ctop -= this.mainHd.dom.offsetHeight;\r
-\r
-        var cbot = ctop + rowEl.offsetHeight;\r
-\r
-        var ch = c.clientHeight;\r
-        var stop = parseInt(c.scrollTop, 10);\r
-        var sbot = stop + ch;\r
-\r
-               if(ctop < stop){\r
-          c.scrollTop = ctop;\r
-        }else if(cbot > sbot){\r
-            c.scrollTop = cbot-ch;\r
-        }\r
-\r
-        if(hscroll !== false){\r
-            var cleft = parseInt(cellEl.offsetLeft, 10);\r
-            var cright = cleft + cellEl.offsetWidth;\r
-\r
-            var sleft = parseInt(c.scrollLeft, 10);\r
-            var sright = sleft + c.clientWidth;\r
-            if(cleft < sleft){\r
-                c.scrollLeft = cleft;\r
-            }else if(cright > sright){\r
-                c.scrollLeft = cright-c.clientWidth;\r
-            }\r
-        }\r
-        return this.getResolvedXY(resolved);\r
-    },\r
-\r
-    // private\r
-    insertRows : function(dm, firstRow, lastRow, isUpdate){\r
-        if(!isUpdate && firstRow === 0 && lastRow >= dm.getCount()-1){\r
-            this.refresh();\r
-        }else{\r
-            if(!isUpdate){\r
-                this.fireEvent("beforerowsinserted", this, firstRow, lastRow);\r
-            }\r
-            var html = this.renderRows(firstRow, lastRow);\r
-            var before = this.getRow(firstRow);\r
-            if(before){\r
-                Ext.DomHelper.insertHtml('beforeBegin', before, html);\r
-            }else{\r
-                Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);\r
-            }\r
-            if(!isUpdate){\r
-                this.fireEvent("rowsinserted", this, firstRow, lastRow);\r
-                this.processRows(firstRow);\r
-            }\r
-        }\r
-        this.syncFocusEl(firstRow);\r
-    },\r
-\r
-    // private\r
-    deleteRows : function(dm, firstRow, lastRow){\r
-        if(dm.getRowCount()<1){\r
-            this.refresh();\r
-        }else{\r
-            this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);\r
-\r
-            this.removeRows(firstRow, lastRow);\r
-\r
-            this.processRows(firstRow);\r
-            this.fireEvent("rowsdeleted", this, firstRow, lastRow);\r
-        }\r
-    },\r
-\r
-    // private\r
-    getColumnStyle : function(col, isHeader){\r
-        var style = !isHeader ? (this.cm.config[col].css || '') : '';\r
-        style += 'width:'+this.getColumnWidth(col)+';';\r
-        if(this.cm.isHidden(col)){\r
-            style += 'display:none;';\r
-        }\r
-        var align = this.cm.config[col].align;\r
-        if(align){\r
-            style += 'text-align:'+align+';';\r
-        }\r
-        return style;\r
-    },\r
-\r
-    // private\r
-    getColumnWidth : function(col){\r
-        var w = this.cm.getColumnWidth(col);\r
-        if(typeof w == 'number'){\r
-            return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px';\r
-        }\r
-        return w;\r
-    },\r
-\r
-    // private\r
-    getTotalWidth : function(){\r
-        return this.cm.getTotalWidth()+'px';\r
-    },\r
-\r
-    // private\r
-    fitColumns : function(preventRefresh, onlyExpand, omitColumn){\r
-        var cm = this.cm, leftOver, dist, i;\r
-        var tw = cm.getTotalWidth(false);\r
-        var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;\r
-\r
-        if(aw < 20){ // not initialized, so don't screw up the default widths\r
-            return;\r
-        }\r
-        var extra = aw - tw;\r
-\r
-        if(extra === 0){\r
-            return false;\r
-        }\r
-\r
-        var vc = cm.getColumnCount(true);\r
-        var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);\r
-        if(ac === 0){\r
-            ac = 1;\r
-            omitColumn = undefined;\r
-        }\r
-        var colCount = cm.getColumnCount();\r
-        var cols = [];\r
-        var extraCol = 0;\r
-        var width = 0;\r
-        var w;\r
-        for (i = 0; i < colCount; i++){\r
-            if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){\r
-                w = cm.getColumnWidth(i);\r
-                cols.push(i);\r
-                extraCol = i;\r
-                cols.push(w);\r
-                width += w;\r
-            }\r
-        }\r
-        var frac = (aw - cm.getTotalWidth())/width;\r
-        while (cols.length){\r
-            w = cols.pop();\r
-            i = cols.pop();\r
-            cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);\r
-        }\r
-\r
-        if((tw = cm.getTotalWidth(false)) > aw){\r
-            var adjustCol = ac != vc ? omitColumn : extraCol;\r
-             cm.setColumnWidth(adjustCol, Math.max(1,\r
-                     cm.getColumnWidth(adjustCol)- (tw-aw)), true);\r
-        }\r
-\r
-        if(preventRefresh !== true){\r
-            this.updateAllColumnWidths();\r
-        }\r
-\r
-\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    autoExpand : function(preventUpdate){\r
-        var g = this.grid, cm = this.cm;\r
-        if(!this.userResized && g.autoExpandColumn){\r
-            var tw = cm.getTotalWidth(false);\r
-            var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;\r
-            if(tw != aw){\r
-                var ci = cm.getIndexById(g.autoExpandColumn);\r
-                var currentWidth = cm.getColumnWidth(ci);\r
-                var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax);\r
-                if(cw != currentWidth){\r
-                    cm.setColumnWidth(ci, cw, true);\r
-                    if(preventUpdate !== true){\r
-                        this.updateColumnWidth(ci, cw);\r
-                    }\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    getColumnData : function(){\r
-        // build a map for all the columns\r
-        var cs = [], cm = this.cm, colCount = cm.getColumnCount();\r
-        for(var i = 0; i < colCount; i++){\r
-            var name = cm.getDataIndex(i);\r
-            cs[i] = {\r
-                name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),\r
-                renderer : cm.getRenderer(i),\r
-                id : cm.getColumnId(i),\r
-                style : this.getColumnStyle(i)\r
-            };\r
-        }\r
-        return cs;\r
-    },\r
-\r
-    // private\r
-    renderRows : function(startRow, endRow){\r
-        // pull in all the crap needed to render rows\r
-        var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows;\r
-        var colCount = cm.getColumnCount();\r
-\r
-        if(ds.getCount() < 1){\r
-            return "";\r
-        }\r
-\r
-        var cs = this.getColumnData();\r
-\r
-        startRow = startRow || 0;\r
-        endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;\r
-\r
-        // records to render\r
-        var rs = ds.getRange(startRow, endRow);\r
-\r
-        return this.doRender(cs, rs, ds, startRow, colCount, stripe);\r
-    },\r
-\r
-    // private\r
-    renderBody : function(){\r
-        var markup = this.renderRows();\r
-        return this.templates.body.apply({rows: markup});\r
-    },\r
-\r
-    // private\r
-    refreshRow : function(record){\r
-        var ds = this.ds, index;\r
-        if(typeof record == 'number'){\r
-            index = record;\r
-            record = ds.getAt(index);\r
-        }else{\r
-            index = ds.indexOf(record);\r
-        }\r
-        var cls = [];\r
-        this.insertRows(ds, index, index, true);\r
-        this.getRow(index).rowIndex = index;\r
-        this.onRemove(ds, record, index+1, true);\r
-        this.fireEvent("rowupdated", this, index, record);\r
-    },\r
-\r
-    \r
-    refresh : function(headersToo){\r
-        this.fireEvent("beforerefresh", this);\r
-        this.grid.stopEditing(true);\r
-\r
-        var result = this.renderBody();\r
-        this.mainBody.update(result);\r
-\r
-        if(headersToo === true){\r
-            this.updateHeaders();\r
-            this.updateHeaderSortState();\r
-        }\r
-        this.processRows(0, true);\r
-        this.layout();\r
-        this.applyEmptyText();\r
-        this.fireEvent("refresh", this);\r
-    },\r
-\r
-    // private\r
-    applyEmptyText : function(){\r
-        if(this.emptyText && !this.hasRows()){\r
-            this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');\r
-        }\r
-    },\r
-\r
-    // private\r
-    updateHeaderSortState : function(){\r
-        var state = this.ds.getSortState();\r
-        if(!state){\r
-            return;\r
-        }\r
-        if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){\r
-            this.grid.fireEvent('sortchange', this.grid, state);\r
-        }\r
-        this.sortState = state;\r
-        var sortColumn = this.cm.findColumnIndex(state.field);\r
-        if(sortColumn != -1){\r
-            var sortDir = state.direction;\r
-            this.updateSortIcon(sortColumn, sortDir);\r
-        }\r
-    },\r
-\r
-    // private\r
-    destroy : function(){\r
-        if(this.colMenu){\r
-            Ext.menu.MenuMgr.unregister(this.colMenu);\r
-            this.colMenu.destroy();\r
-            delete this.colMenu;\r
-        }\r
-        if(this.hmenu){\r
-            Ext.menu.MenuMgr.unregister(this.hmenu);\r
-            this.hmenu.destroy();\r
-            delete this.hmenu;\r
-        }\r
-        if(this.grid.enableColumnMove){\r
-            var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];\r
-            if(dds){\r
-                for(var dd in dds){\r
-                    if(!dds[dd].config.isTarget && dds[dd].dragElId){\r
-                        var elid = dds[dd].dragElId;\r
-                        dds[dd].unreg();\r
-                        Ext.get(elid).remove();\r
-                    } else if(dds[dd].config.isTarget){\r
-                        dds[dd].proxyTop.remove();\r
-                        dds[dd].proxyBottom.remove();\r
-                        dds[dd].unreg();\r
-                    }\r
-                    if(Ext.dd.DDM.locationCache[dd]){\r
-                        delete Ext.dd.DDM.locationCache[dd];\r
-                    }\r
-                }\r
-                delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];\r
-            }\r
-        }\r
-        \r
-        if(this.dragZone){\r
-            this.dragZone.unreg();\r
-        }\r
-        \r
-        Ext.fly(this.innerHd).removeAllListeners();\r
-        Ext.removeNode(this.innerHd);\r
-        \r
-        Ext.destroy(this.resizeMarker, this.resizeProxy, this.focusEl, this.mainBody, \r
-                    this.scroller, this.mainHd, this.mainWrap, this.dragZone, \r
-                    this.splitZone, this.columnDrag, this.columnDrop);\r
-\r
-        this.initData(null, null);\r
-        Ext.EventManager.removeResizeListener(this.onWindowResize, this);\r
-        this.purgeListeners();\r
-    },\r
-\r
-    // private\r
-    onDenyColumnHide : function(){\r
-\r
-    },\r
-\r
-    // private\r
-    render : function(){\r
-        if(this.autoFill){\r
-            var ct = this.grid.ownerCt;\r
-            if (ct && ct.getLayout()){\r
-                ct.on('afterlayout', function(){ \r
-                    this.fitColumns(true, true);\r
-                    this.updateHeaders(); \r
-                }, this, {single: true}); \r
-            }else{ \r
-                this.fitColumns(true, true); \r
-            }\r
-        }else if(this.forceFit){\r
-            this.fitColumns(true, false);\r
-        }else if(this.grid.autoExpandColumn){\r
-            this.autoExpand(true);\r
-        }\r
-\r
-        this.renderUI();\r
-    },\r
-\r
-    \r
-    // private\r
-    initData : function(ds, cm){\r
-        if(this.ds){\r
-            this.ds.un("load", this.onLoad, this);\r
-            this.ds.un("datachanged", this.onDataChange, this);\r
-            this.ds.un("add", this.onAdd, this);\r
-            this.ds.un("remove", this.onRemove, this);\r
-            this.ds.un("update", this.onUpdate, this);\r
-            this.ds.un("clear", this.onClear, this);\r
-        }\r
-        if(ds){\r
-            ds.on("load", this.onLoad, this);\r
-            ds.on("datachanged", this.onDataChange, this);\r
-            ds.on("add", this.onAdd, this);\r
-            ds.on("remove", this.onRemove, this);\r
-            ds.on("update", this.onUpdate, this);\r
-            ds.on("clear", this.onClear, this);\r
-        }\r
-        this.ds = ds;\r
-\r
-        if(this.cm){\r
-            this.cm.un("configchange", this.onColConfigChange, this);\r
-            this.cm.un("widthchange", this.onColWidthChange, this);\r
-            this.cm.un("headerchange", this.onHeaderChange, this);\r
-            this.cm.un("hiddenchange", this.onHiddenChange, this);\r
-            this.cm.un("columnmoved", this.onColumnMove, this);\r
-            this.cm.un("columnlockchange", this.onColumnLock, this);\r
-        }\r
-        if(cm){\r
-            delete this.lastViewWidth;\r
-            cm.on("configchange", this.onColConfigChange, this);\r
-            cm.on("widthchange", this.onColWidthChange, this);\r
-            cm.on("headerchange", this.onHeaderChange, this);\r
-            cm.on("hiddenchange", this.onHiddenChange, this);\r
-            cm.on("columnmoved", this.onColumnMove, this);\r
-            cm.on("columnlockchange", this.onColumnLock, this);\r
-        }\r
-        this.cm = cm;\r
-    },\r
-\r
-    // private\r
-    onDataChange : function(){\r
-        this.refresh();\r
-        this.updateHeaderSortState();\r
-        this.syncFocusEl(0);\r
-    },\r
-\r
-    // private\r
-    onClear : function(){\r
-        this.refresh();\r
-        this.syncFocusEl(0);\r
-    },\r
-\r
-    // private\r
-    onUpdate : function(ds, record){\r
-        this.refreshRow(record);\r
-    },\r
-\r
-    // private\r
-    onAdd : function(ds, records, index){\r
-        this.insertRows(ds, index, index + (records.length-1));\r
-    },\r
-\r
-    // private\r
-    onRemove : function(ds, record, index, isUpdate){\r
-        if(isUpdate !== true){\r
-            this.fireEvent("beforerowremoved", this, index, record);\r
-        }\r
-        this.removeRow(index);\r
-        if(isUpdate !== true){\r
-            this.processRows(index);\r
-            this.applyEmptyText();\r
-            this.fireEvent("rowremoved", this, index, record);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onLoad : function(){\r
-        this.scrollToTop();\r
-    },\r
-\r
-    // private\r
-    onColWidthChange : function(cm, col, width){\r
-        this.updateColumnWidth(col, width);\r
-    },\r
-\r
-    // private\r
-    onHeaderChange : function(cm, col, text){\r
-        this.updateHeaders();\r
-    },\r
-\r
-    // private\r
-    onHiddenChange : function(cm, col, hidden){\r
-        this.updateColumnHidden(col, hidden);\r
-    },\r
-\r
-    // private\r
-    onColumnMove : function(cm, oldIndex, newIndex){\r
-        this.indexMap = null;\r
-        var s = this.getScrollState();\r
-        this.refresh(true);\r
-        this.restoreScroll(s);\r
-        this.afterMove(newIndex);\r
-    },\r
-\r
-    // private\r
-    onColConfigChange : function(){\r
-        delete this.lastViewWidth;\r
-        this.indexMap = null;\r
-        this.refresh(true);\r
-    },\r
-\r
-    \r
-    // private\r
-    initUI : function(grid){\r
-        grid.on("headerclick", this.onHeaderClick, this);\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-\r
-    },\r
-\r
-    // private\r
-    onHeaderClick : function(g, index){\r
-        if(this.headersDisabled || !this.cm.isSortable(index)){\r
-            return;\r
-        }\r
-        g.stopEditing(true);\r
-        g.store.sort(this.cm.getDataIndex(index));\r
-    },\r
-\r
-    // private\r
-    onRowOver : function(e, t){\r
-        var row;\r
-        if((row = this.findRowIndex(t)) !== false){\r
-            this.addRowClass(row, "x-grid3-row-over");\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRowOut : function(e, t){\r
-        var row;\r
-        if((row = this.findRowIndex(t)) !== false && !e.within(this.getRow(row), true)){\r
-            this.removeRowClass(row, "x-grid3-row-over");\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleWheel : function(e){\r
-        e.stopPropagation();\r
-    },\r
-\r
-    // private\r
-    onRowSelect : function(row){\r
-        this.addRowClass(row, "x-grid3-row-selected");\r
-    },\r
-\r
-    // private\r
-    onRowDeselect : function(row){\r
-        this.removeRowClass(row, "x-grid3-row-selected");\r
-    },\r
-\r
-    // private\r
-    onCellSelect : function(row, col){\r
-        var cell = this.getCell(row, col);\r
-        if(cell){\r
-            this.fly(cell).addClass("x-grid3-cell-selected");\r
-        }\r
-    },\r
-\r
-    // private\r
-    onCellDeselect : function(row, col){\r
-        var cell = this.getCell(row, col);\r
-        if(cell){\r
-            this.fly(cell).removeClass("x-grid3-cell-selected");\r
-        }\r
-    },\r
-\r
-    // private\r
-    onColumnSplitterMoved : function(i, w){\r
-        this.userResized = true;\r
-        var cm = this.grid.colModel;\r
-        cm.setColumnWidth(i, w, true);\r
-\r
-        if(this.forceFit){\r
-            this.fitColumns(true, false, i);\r
-            this.updateAllColumnWidths();\r
-        }else{\r
-            this.updateColumnWidth(i, w);\r
-            this.syncHeaderScroll();\r
-        }\r
-\r
-        this.grid.fireEvent("columnresize", i, w);\r
-    },\r
-\r
-    // private\r
-    handleHdMenuClick : function(item){\r
-        var index = this.hdCtxIndex;\r
-        var cm = this.cm, ds = this.ds;\r
-        switch(item.id){\r
-            case "asc":\r
-                ds.sort(cm.getDataIndex(index), "ASC");\r
-                break;\r
-            case "desc":\r
-                ds.sort(cm.getDataIndex(index), "DESC");\r
-                break;\r
-            default:\r
-                index = cm.getIndexById(item.id.substr(4));\r
-                if(index != -1){\r
-                    if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){\r
-                        this.onDenyColumnHide();\r
-                        return false;\r
-                    }\r
-                    cm.setHidden(index, item.checked);\r
-                }\r
-        }\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    isHideableColumn : function(c){\r
-        return !c.hidden && !c.fixed;\r
-    },\r
-\r
-    // private\r
-    beforeColMenuShow : function(){\r
-        var cm = this.cm,  colCount = cm.getColumnCount();\r
-        this.colMenu.removeAll();\r
-        for(var i = 0; i < colCount; i++){\r
-            if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){\r
-                this.colMenu.add(new Ext.menu.CheckItem({\r
-                    id: "col-"+cm.getColumnId(i),\r
-                    text: cm.getColumnHeader(i),\r
-                    checked: !cm.isHidden(i),\r
-                    hideOnClick:false,\r
-                    disabled: cm.config[i].hideable === false\r
-                }));\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleHdDown : function(e, t){\r
-        if(Ext.fly(t).hasClass('x-grid3-hd-btn')){\r
-            e.stopEvent();\r
-            var hd = this.findHeaderCell(t);\r
-            Ext.fly(hd).addClass('x-grid3-hd-menu-open');\r
-            var index = this.getCellIndex(hd);\r
-            this.hdCtxIndex = index;\r
-            var ms = this.hmenu.items, cm = this.cm;\r
-            ms.get("asc").setDisabled(!cm.isSortable(index));\r
-            ms.get("desc").setDisabled(!cm.isSortable(index));\r
-            this.hmenu.on("hide", function(){\r
-                Ext.fly(hd).removeClass('x-grid3-hd-menu-open');\r
-            }, this, {single:true});\r
-            this.hmenu.show(t, "tl-bl?");\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleHdOver : function(e, t){\r
-        var hd = this.findHeaderCell(t);\r
-        if(hd && !this.headersDisabled){\r
-            this.activeHd = hd;\r
-            this.activeHdIndex = this.getCellIndex(hd);\r
-            var fly = this.fly(hd);\r
-            this.activeHdRegion = fly.getRegion();\r
-            if(!this.cm.isMenuDisabled(this.activeHdIndex)){\r
-                fly.addClass("x-grid3-hd-over");\r
-                this.activeHdBtn = fly.child('.x-grid3-hd-btn');\r
-                if(this.activeHdBtn){\r
-                    this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleHdMove : function(e, t){\r
-        if(this.activeHd && !this.headersDisabled){\r
-            var hw = this.splitHandleWidth || 5;\r
-            var r = this.activeHdRegion;\r
-            var x = e.getPageX();\r
-            var ss = this.activeHd.style;\r
-            if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){\r
-                ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'e-resize' : 'col-resize'; // col-resize not always supported\r
-            }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){\r
-                ss.cursor = Ext.isAir ? 'move' : Ext.isSafari ? 'w-resize' : 'col-resize';\r
-            }else{\r
-                ss.cursor = '';\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    handleHdOut : function(e, t){\r
-        var hd = this.findHeaderCell(t);\r
-        if(hd && (!Ext.isIE || !e.within(hd, true))){\r
-            this.activeHd = null;\r
-            this.fly(hd).removeClass("x-grid3-hd-over");\r
-            hd.style.cursor = '';\r
-        }\r
-    },\r
-\r
-    // private\r
-    hasRows : function(){\r
-        var fc = this.mainBody.dom.firstChild;\r
-        return fc && fc.className != 'x-grid-empty';\r
-    },\r
-\r
-    // back compat\r
-    bind : function(d, c){\r
-        this.initData(d, c);\r
-    }\r
-});\r
-\r
-\r
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.GridView.SplitDragZone = function(grid, hd){\r
-    this.grid = grid;\r
-    this.view = grid.getView();\r
-    this.marker = this.view.resizeMarker;\r
-    this.proxy = this.view.resizeProxy;\r
-    Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,\r
-        "gridSplitters" + this.grid.getGridEl().id, {\r
-        dragElId : Ext.id(this.proxy.dom), resizeFrame:false\r
-    });\r
-    this.scroll = false;\r
-    this.hw = this.view.splitHandleWidth || 5;\r
-};\r
-Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {\r
-\r
-    b4StartDrag : function(x, y){\r
-        this.view.headersDisabled = true;\r
-        var h = this.view.mainWrap.getHeight();\r
-        this.marker.setHeight(h);\r
-        this.marker.show();\r
-        this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]);\r
-        this.proxy.setHeight(h);\r
-        var w = this.cm.getColumnWidth(this.cellIndex);\r
-        var minw = Math.max(w-this.grid.minColumnWidth, 0);\r
-        this.resetConstraints();\r
-        this.setXConstraint(minw, 1000);\r
-        this.setYConstraint(0, 0);\r
-        this.minX = x - minw;\r
-        this.maxX = x + 1000;\r
-        this.startPos = x;\r
-        Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);\r
-    },\r
-\r
-\r
-    handleMouseDown : function(e){\r
-        var t = this.view.findHeaderCell(e.getTarget());\r
-        if(t){\r
-            var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];\r
-            var exy = e.getXY(), ex = exy[0], ey = exy[1];\r
-            var w = t.offsetWidth, adjust = false;\r
-            if((ex - x) <= this.hw){\r
-                adjust = -1;\r
-            }else if((x+w) - ex <= this.hw){\r
-                adjust = 0;\r
-            }\r
-            if(adjust !== false){\r
-                this.cm = this.grid.colModel;\r
-                var ci = this.view.getCellIndex(t);\r
-                if(adjust == -1){\r
-                  if (ci + adjust < 0) {\r
-                    return;\r
-                  }\r
-                    while(this.cm.isHidden(ci+adjust)){\r
-                        --adjust;\r
-                        if(ci+adjust < 0){\r
-                            return;\r
-                        }\r
-                    }\r
-                }\r
-                this.cellIndex = ci+adjust;\r
-                this.split = t.dom;\r
-                if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){\r
-                    Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);\r
-                }\r
-            }else if(this.view.columnDrag){\r
-                this.view.columnDrag.callHandleMouseDown(e);\r
-            }\r
-        }\r
-    },\r
-\r
-    endDrag : function(e){\r
-        this.marker.hide();\r
-        var v = this.view;\r
-        var endX = Math.max(this.minX, e.getPageX());\r
-        var diff = endX - this.startPos;\r
-        v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);\r
-        setTimeout(function(){\r
-            v.headersDisabled = false;\r
-        }, 50);\r
-    },\r
-\r
-    autoOffset : function(){\r
-        this.setDelta(0,0);\r
-    }\r
-});\r
-\r
-\r
-Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {\r
-    \r
-    hideGroupedColumn:false,\r
-    \r
-    showGroupName:true,\r
-    \r
-    startCollapsed:false,\r
-    \r
-    enableGrouping:true,\r
-    \r
-    enableGroupingMenu:true,\r
-    \r
-    enableNoGroups:true,\r
-    \r
-    emptyGroupText : '(None)',\r
-    \r
-    ignoreAdd: false,\r
-    \r
-    groupTextTpl : '{text}',\r
-    \r
-    \r
-\r
-    // private\r
-    gidSeed : 1000,\r
-\r
-    // private\r
-    initTemplates : function(){\r
-        Ext.grid.GroupingView.superclass.initTemplates.call(this);\r
-        this.state = {};\r
-\r
-        var sm = this.grid.getSelectionModel();\r
-        sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',\r
-                this.onBeforeRowSelect, this);\r
-\r
-        if(!this.startGroup){\r
-            this.startGroup = new Ext.XTemplate(\r
-                '<div id="{groupId}" class="x-grid-group {cls}">',\r
-                    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div>', this.groupTextTpl ,'</div></div>',\r
-                    '<div id="{groupId}-bd" class="x-grid-group-body">'\r
-            );\r
-        }\r
-        this.startGroup.compile();\r
-        this.endGroup = '</div></div>';\r
-    },\r
-\r
-    // private\r
-    findGroup : function(el){\r
-        return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);\r
-    },\r
-\r
-    // private\r
-    getGroups : function(){\r
-        return this.hasRows() ? this.mainBody.dom.childNodes : [];\r
-    },\r
-\r
-    // private\r
-    onAdd : function(){\r
-        if(this.enableGrouping && !this.ignoreAdd){\r
-            var ss = this.getScrollState();\r
-            this.refresh();\r
-            this.restoreScroll(ss);\r
-        }else if(!this.enableGrouping){\r
-            Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onRemove : function(ds, record, index, isUpdate){\r
-        Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);\r
-        var g = document.getElementById(record._groupId);\r
-        if(g && g.childNodes[1].childNodes.length < 1){\r
-            Ext.removeNode(g);\r
-        }\r
-        this.applyEmptyText();\r
-    },\r
-\r
-    // private\r
-    refreshRow : function(record){\r
-        if(this.ds.getCount()==1){\r
-            this.refresh();\r
-        }else{\r
-            this.isUpdating = true;\r
-            Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);\r
-            this.isUpdating = false;\r
-        }\r
-    },\r
-\r
-    // private\r
-    beforeMenuShow : function(){\r
-        var field = this.getGroupField();\r
-        var g = this.hmenu.items.get('groupBy');\r
-        if(g){\r
-            g.setDisabled(this.cm.config[this.hdCtxIndex].groupable === false);\r
-        }\r
-        var s = this.hmenu.items.get('showGroups');\r
-        if(s){\r
-           s.setDisabled(!field && this.cm.config[this.hdCtxIndex].groupable === false);\r
-                       s.setChecked(!!field, true);\r
-        }\r
-    },\r
-\r
-    // private\r
-    renderUI : function(){\r
-        Ext.grid.GroupingView.superclass.renderUI.call(this);\r
-        this.mainBody.on('mousedown', this.interceptMouse, this);\r
-\r
-        if(this.enableGroupingMenu && this.hmenu){\r
-            this.hmenu.add('-',{\r
-                id:'groupBy',\r
-                text: this.groupByText,\r
-                handler: this.onGroupByClick,\r
-                scope: this,\r
-                iconCls:'x-group-by-icon'\r
-            });\r
-            if(this.enableNoGroups){\r
-                this.hmenu.add({\r
-                    id:'showGroups',\r
-                    text: this.showGroupsText,\r
-                    checked: true,\r
-                    checkHandler: this.onShowGroupsClick,\r
-                    scope: this\r
-                });\r
-            }\r
-            this.hmenu.on('beforeshow', this.beforeMenuShow, this);\r
-        }\r
-    },\r
-\r
-    // private\r
-    onGroupByClick : function(){\r
-        this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));\r
-        this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups\r
-    },\r
-\r
-    // private\r
-    onShowGroupsClick : function(mi, checked){\r
-        if(checked){\r
-            this.onGroupByClick();\r
-        }else{\r
-            this.grid.store.clearGrouping();\r
-        }\r
-    },\r
-\r
-    \r
-    toggleGroup : function(group, expanded){\r
-        this.grid.stopEditing(true);\r
-        group = Ext.getDom(group);\r
-        var gel = Ext.fly(group);\r
-        expanded = expanded !== undefined ?\r
-                expanded : gel.hasClass('x-grid-group-collapsed');\r
-\r
-        this.state[gel.dom.id] = expanded;\r
-        gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');\r
-    },\r
-\r
-    \r
-    toggleAllGroups : function(expanded){\r
-        var groups = this.getGroups();\r
-        for(var i = 0, len = groups.length; i < len; i++){\r
-            this.toggleGroup(groups[i], expanded);\r
-        }\r
-    },\r
-\r
-    \r
-    expandAllGroups : function(){\r
-        this.toggleAllGroups(true);\r
-    },\r
-\r
-    \r
-    collapseAllGroups : function(){\r
-        this.toggleAllGroups(false);\r
-    },\r
-\r
-    // private\r
-    interceptMouse : function(e){\r
-        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);\r
-        if(hd){\r
-            e.stopEvent();\r
-            this.toggleGroup(hd.parentNode);\r
-        }\r
-    },\r
-\r
-    // private\r
-    getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){\r
-        var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);\r
-        if(g === ''){\r
-            g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;\r
-        }\r
-        return g;\r
-    },\r
-\r
-    // private\r
-    getGroupField : function(){\r
-        return this.grid.store.getGroupState();\r
-    },\r
-\r
-    // private\r
-    renderRows : function(){\r
-        var groupField = this.getGroupField();\r
-        var eg = !!groupField;\r
-        // if they turned off grouping and the last grouped field is hidden\r
-        if(this.hideGroupedColumn) {\r
-            var colIndex = this.cm.findColumnIndex(groupField);\r
-            if(!eg && this.lastGroupField !== undefined) {\r
-                this.mainBody.update('');\r
-                this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);\r
-                delete this.lastGroupField;\r
-            }else if (eg && this.lastGroupField === undefined) {\r
-                this.lastGroupField = groupField;\r
-                this.cm.setHidden(colIndex, true);\r
-            }else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) {\r
-                this.mainBody.update('');\r
-                var oldIndex = this.cm.findColumnIndex(this.lastGroupField);\r
-                this.cm.setHidden(oldIndex, false);\r
-                this.lastGroupField = groupField;\r
-                this.cm.setHidden(colIndex, true);\r
-            }\r
-        }\r
-        return Ext.grid.GroupingView.superclass.renderRows.apply(\r
-                    this, arguments);\r
-    },\r
-\r
-    // private\r
-    doRender : function(cs, rs, ds, startRow, colCount, stripe){\r
-        if(rs.length < 1){\r
-            return '';\r
-        }\r
-        var groupField = this.getGroupField();\r
-        var colIndex = this.cm.findColumnIndex(groupField);\r
-\r
-        this.enableGrouping = !!groupField;\r
-\r
-        if(!this.enableGrouping || this.isUpdating){\r
-            return Ext.grid.GroupingView.superclass.doRender.apply(\r
-                    this, arguments);\r
-        }\r
-        var gstyle = 'width:'+this.getTotalWidth()+';';\r
-\r
-        var gidPrefix = this.grid.getGridEl().id;\r
-        var cfg = this.cm.config[colIndex];\r
-        var groupRenderer = cfg.groupRenderer || cfg.renderer;\r
-        var prefix = this.showGroupName ?\r
-                     (cfg.groupName || cfg.header)+': ' : '';\r
-\r
-        var groups = [], curGroup, i, len, gid;\r
-        for(i = 0, len = rs.length; i < len; i++){\r
-            var rowIndex = startRow + i;\r
-            var r = rs[i],\r
-                gvalue = r.data[groupField],\r
-                g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);\r
-            if(!curGroup || curGroup.group != g){\r
-                gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);\r
-                       // if state is defined use it, however state is in terms of expanded\r
-                               // so negate it, otherwise use the default.\r
-                               var isCollapsed  = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;\r
-                               var gcls = isCollapsed ? 'x-grid-group-collapsed' : ''; \r
-                curGroup = {\r
-                    group: g,\r
-                    gvalue: gvalue,\r
-                    text: prefix + g,\r
-                    groupId: gid,\r
-                    startRow: rowIndex,\r
-                    rs: [r],\r
-                    cls: gcls,\r
-                    style: gstyle\r
-                };\r
-                groups.push(curGroup);\r
-            }else{\r
-                curGroup.rs.push(r);\r
-            }\r
-            r._groupId = gid;\r
-        }\r
-\r
-        var buf = [];\r
-        for(i = 0, len = groups.length; i < len; i++){\r
-            var g = groups[i];\r
-            this.doGroupStart(buf, g, cs, ds, colCount);\r
-            buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(\r
-                    this, cs, g.rs, ds, g.startRow, colCount, stripe);\r
-\r
-            this.doGroupEnd(buf, g, cs, ds, colCount);\r
-        }\r
-        return buf.join('');\r
-    },\r
-\r
-    \r
-    getGroupId : function(value){\r
-        var gidPrefix = this.grid.getGridEl().id;\r
-        var groupField = this.getGroupField();\r
-        var colIndex = this.cm.findColumnIndex(groupField);\r
-        var cfg = this.cm.config[colIndex];\r
-        var groupRenderer = cfg.groupRenderer || cfg.renderer;\r
-        var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds);\r
-        return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value);\r
-    },\r
-\r
-    // private\r
-    doGroupStart : function(buf, g, cs, ds, colCount){\r
-        buf[buf.length] = this.startGroup.apply(g);\r
-    },\r
-\r
-    // private\r
-    doGroupEnd : function(buf, g, cs, ds, colCount){\r
-        buf[buf.length] = this.endGroup;\r
-    },\r
-\r
-    // private\r
-    getRows : function(){\r
-        if(!this.enableGrouping){\r
-            return Ext.grid.GroupingView.superclass.getRows.call(this);\r
-        }\r
-        var r = [];\r
-        var g, gs = this.getGroups();\r
-        for(var i = 0, len = gs.length; i < len; i++){\r
-            g = gs[i].childNodes[1].childNodes;\r
-            for(var j = 0, jlen = g.length; j < jlen; j++){\r
-                r[r.length] = g[j];\r
-            }\r
-        }\r
-        return r;\r
-    },\r
-\r
-    // private\r
-    updateGroupWidths : function(){\r
-        if(!this.enableGrouping || !this.hasRows()){\r
-            return;\r
-        }\r
-        var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px';\r
-        var gs = this.getGroups();\r
-        for(var i = 0, len = gs.length; i < len; i++){\r
-            gs[i].firstChild.style.width = tw;\r
-        }\r
-    },\r
-\r
-    // private\r
-    onColumnWidthUpdated : function(col, w, tw){\r
-        Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this, col, w, tw);\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onAllColumnWidthsUpdated : function(ws, tw){\r
-        Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this, ws, tw);\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onColumnHiddenUpdated : function(col, hidden, tw){\r
-        Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this, col, hidden, tw);\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onLayout : function(){\r
-        this.updateGroupWidths();\r
-    },\r
-\r
-    // private\r
-    onBeforeRowSelect : function(sm, rowIndex){\r
-        if(!this.enableGrouping){\r
-            return;\r
-        }\r
-        var row = this.getRow(rowIndex);\r
-        if(row && !row.offsetParent){\r
-            var g = this.findGroup(row);\r
-            this.toggleGroup(g, true);\r
-        }\r
-    },\r
-\r
-    \r
-    groupByText: 'Group By This Field',\r
-    \r
-    showGroupsText: 'Show in Groups'\r
-});\r
-// private\r
-Ext.grid.GroupingView.GROUP_ID = 1000;\r
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.HeaderDragZone = function(grid, hd, hd2){\r
-    this.grid = grid;\r
-    this.view = grid.getView();\r
-    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
-    Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);\r
-    if(hd2){\r
-        this.setHandleElId(Ext.id(hd));\r
-        this.setOuterHandleElId(Ext.id(hd2));\r
-    }\r
-    this.scroll = false;\r
-};\r
-Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {\r
-    maxDragWidth: 120,\r
-    getDragData : function(e){\r
-        var t = Ext.lib.Event.getTarget(e);\r
-        var h = this.view.findHeaderCell(t);\r
-        if(h){\r
-            return {ddel: h.firstChild, header:h};\r
-        }\r
-        return false;\r
-    },\r
-\r
-    onInitDrag : function(e){\r
-        this.view.headersDisabled = true;\r
-        var clone = this.dragData.ddel.cloneNode(true);\r
-        clone.id = Ext.id();\r
-        clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";\r
-        this.proxy.update(clone);\r
-        return true;\r
-    },\r
-\r
-    afterValidDrop : function(){\r
-        var v = this.view;\r
-        setTimeout(function(){\r
-            v.headersDisabled = false;\r
-        }, 50);\r
-    },\r
-\r
-    afterInvalidDrop : function(){\r
-        var v = this.view;\r
-        setTimeout(function(){\r
-            v.headersDisabled = false;\r
-        }, 50);\r
-    }\r
-});\r
-\r
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.HeaderDropZone = function(grid, hd, hd2){\r
-    this.grid = grid;\r
-    this.view = grid.getView();\r
-    // split the proxies so they don't interfere with mouse events\r
-    this.proxyTop = Ext.DomHelper.append(document.body, {\r
-        cls:"col-move-top", html:"&#160;"\r
-    }, true);\r
-    this.proxyBottom = Ext.DomHelper.append(document.body, {\r
-        cls:"col-move-bottom", html:"&#160;"\r
-    }, true);\r
-    this.proxyTop.hide = this.proxyBottom.hide = function(){\r
-        this.setLeftTop(-100,-100);\r
-        this.setStyle("visibility", "hidden");\r
-    };\r
-    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
-    // temporarily disabled\r
-    //Ext.dd.ScrollManager.register(this.view.scroller.dom);\r
-    Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);\r
-};\r
-Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {\r
-    proxyOffsets : [-4, -9],\r
-    fly: Ext.Element.fly,\r
-\r
-    getTargetFromEvent : function(e){\r
-        var t = Ext.lib.Event.getTarget(e);\r
-        var cindex = this.view.findCellIndex(t);\r
-        if(cindex !== false){\r
-            return this.view.getHeaderCell(cindex);\r
+            return "";\r
+        },\r
+        \r
+        // For internal usage only\r
+        expressInstallCallback: function() {\r
+            if (isExpressInstallActive) {\r
+                var obj = getElementById(EXPRESS_INSTALL_ID);\r
+                if (obj && storedAltContent) {\r
+                    obj.parentNode.replaceChild(storedAltContent, obj);\r
+                    if (storedAltContentId) {\r
+                        setVisibility(storedAltContentId, true);\r
+                        if (ua.ie && ua.win) { storedAltContent.style.display = "block"; }\r
+                    }\r
+                    if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); }\r
+                }\r
+                isExpressInstallActive = false;\r
+            } \r
         }\r
-    },\r
-\r
-    nextVisible : function(h){\r
-        var v = this.view, cm = this.grid.colModel;\r
-        h = h.nextSibling;\r
-        while(h){\r
-            if(!cm.isHidden(v.getCellIndex(h))){\r
-                return h;\r
+    };\r
+}();\r
+/**
+ * @class Ext.FlashComponent
+ * @extends Ext.BoxComponent
+ * @constructor
+ * @xtype flash
+ */
+Ext.FlashComponent = Ext.extend(Ext.BoxComponent, {
+    /**
+     * @cfg {String} flashVersion
+     * Indicates the version the flash content was published for. Defaults to <tt>'9.0.45'</tt>.
+     */
+    flashVersion : '9.0.45',
+
+    /**
+     * @cfg {String} backgroundColor
+     * The background color of the chart. Defaults to <tt>'#ffffff'</tt>.
+     */
+    backgroundColor: '#ffffff',
+
+    /**
+     * @cfg {String} wmode
+     * The wmode of the flash object. This can be used to control layering. Defaults to <tt>'opaque'</tt>.
+     */
+    wmode: 'opaque',
+
+    /**
+     * @cfg {String} url
+     * The URL of the chart to include. Defaults to <tt>undefined</tt>.
+     */
+    url: undefined,
+    swfId : undefined,
+    swfWidth: '100%',
+    swfHeight: '100%',
+
+    /**
+     * @cfg {Boolean} expressInstall
+     * True to prompt the user to install flash if not installed. Note that this uses
+     * Ext.FlashComponent.EXPRESS_INSTALL_URL, which should be set to the local resource. Defaults to <tt>false</tt>.
+     */
+    expressInstall: false,
+
+    initComponent : function(){
+        Ext.FlashComponent.superclass.initComponent.call(this);
+
+        this.addEvents('initialize');
+    },
+
+    onRender : function(){
+        Ext.FlashComponent.superclass.onRender.apply(this, arguments);
+
+        var params = {
+            allowScriptAccess: 'always',
+            bgcolor: this.backgroundColor,
+            wmode: this.wmode
+        }, vars = {
+            allowedDomain: document.location.hostname,
+            elementID: this.getId(),
+            eventHandler: 'Ext.FlashEventProxy.onEvent'
+        };
+
+        new swfobject.embedSWF(this.url, this.id, this.swfWidth, this.swfHeight, this.flashVersion,
+            this.expressInstall ? Ext.FlashComponent.EXPRESS_INSTALL_URL : undefined, vars, params);
+
+        this.swf = Ext.getDom(this.id);
+        this.el = Ext.get(this.swf);
+    },
+
+    getSwfId : function(){
+        return this.swfId || (this.swfId = "extswf" + (++Ext.Component.AUTO_ID));
+    },
+
+    getId : function(){
+        return this.id || (this.id = "extflashcmp" + (++Ext.Component.AUTO_ID));
+    },
+
+    onFlashEvent : function(e){
+        switch(e.type){
+            case "swfReady":
+                this.initSwf();
+                return;
+            case "log":
+                return;
+        }
+        e.component = this;
+        this.fireEvent(e.type.toLowerCase().replace(/event$/, ''), e);
+    },
+
+    initSwf : function(){
+        this.onSwfReady(!!this.isInitialized);
+        this.isInitialized = true;
+        this.fireEvent('initialize', this);
+    },
+
+    beforeDestroy: function(){
+        if(this.rendered){
+            swfobject.removeSWF(this.swf.id);
+        }
+        Ext.FlashComponent.superclass.beforeDestroy.call(this);
+    },
+
+    onSwfReady : Ext.emptyFn
+});
+
+/**
+ * Sets the url for installing flash if it doesn't exist. This should be set to a local resource.
+ * @static
+ * @type String
+ */
+Ext.FlashComponent.EXPRESS_INSTALL_URL = 'http:/' + '/swfobject.googlecode.com/svn/trunk/swfobject/expressInstall.swf';
+
+Ext.reg('flash', Ext.FlashComponent);/**\r
+ * @class Ext.FlashProxy\r
+ * @singleton\r
+ */\r
+Ext.FlashEventProxy = {\r
+    onEvent : function(id, e){\r
+        var fp = Ext.getCmp(id);\r
+        if(fp){\r
+            fp.onFlashEvent(e);\r
+        }else{\r
+            arguments.callee.defer(10, this, [id, e]);\r
+        }\r
+    }\r
+}/**\r
+ * @class Ext.chart.Chart\r
+ * @extends Ext.FlashComponent\r
+ * The Ext.chart package provides the capability to visualize data with flash based charting.\r
+ * Each chart binds directly to an Ext.data.Store enabling automatic updates of the chart.\r
+ * @constructor\r
+ * @xtype chart\r
+ */\r
\r
+ Ext.chart.Chart = Ext.extend(Ext.FlashComponent, {\r
+    refreshBuffer: 100,\r
+\r
+    /**\r
+     * @cfg {Object} chartStyle\r
+     * Sets styles for this chart. Contains a number of default values. Modifying this property will override\r
+     * the base styles on the chart.\r
+     */\r
+    chartStyle: {\r
+        padding: 10,\r
+        animationEnabled: true,\r
+        font: {\r
+            name: 'Tahoma',\r
+            color: 0x444444,\r
+            size: 11\r
+        },\r
+        dataTip: {\r
+            padding: 5,\r
+            border: {\r
+                color: 0x99bbe8,\r
+                size:1\r
+            },\r
+            background: {\r
+                color: 0xDAE7F6,\r
+                alpha: .9\r
+            },\r
+            font: {\r
+                name: 'Tahoma',\r
+                color: 0x15428B,\r
+                size: 10,\r
+                bold: true\r
             }\r
-            h = h.nextSibling;\r
         }\r
-        return null;\r
     },\r
+    \r
+    /**\r
+     * @cfg {String} url\r
+     * The url to load the chart from. This defaults to Ext.chart.Chart.CHART_URL, which should\r
+     * be modified to point to the local charts resource.\r
+     */\r
+    \r
+    /**\r
+     * @cfg {Object} extraStyle\r
+     * Contains extra styles that will be added or overwritten to the default chartStyle. Defaults to <tt>null</tt>.\r
+     */\r
+    extraStyle: null,\r
+    \r
+    /**\r
+     * @cfg {Boolean} disableCaching\r
+     * True to add a "cache buster" to the end of the chart url. Defaults to true for Opera and IE.\r
+     */\r
+    disableCaching: Ext.isIE || Ext.isOpera,\r
+    disableCacheParam: '_dc',\r
 \r
-    prevVisible : function(h){\r
-        var v = this.view, cm = this.grid.colModel;\r
-        h = h.prevSibling;\r
-        while(h){\r
-            if(!cm.isHidden(v.getCellIndex(h))){\r
-                return h;\r
-            }\r
-            h = h.prevSibling;\r
+    initComponent : function(){\r
+        Ext.chart.Chart.superclass.initComponent.call(this);\r
+        if(!this.url){\r
+            this.url = Ext.chart.Chart.CHART_URL;\r
         }\r
-        return null;\r
+        if(this.disableCaching){\r
+            this.url = Ext.urlAppend(this.url, String.format('{0}={1}', this.disableCacheParam, new Date().getTime()));\r
+        }\r
+        this.addEvents(\r
+            'itemmouseover',\r
+            'itemmouseout',\r
+            'itemclick',\r
+            'itemdoubleclick',\r
+            'itemdragstart',\r
+            'itemdrag',\r
+            'itemdragend'\r
+        );\r
+        this.store = Ext.StoreMgr.lookup(this.store);\r
     },\r
 \r
-    positionIndicator : function(h, n, e){\r
-        var x = Ext.lib.Event.getPageX(e);\r
-        var r = Ext.lib.Dom.getRegion(n.firstChild);\r
-        var px, pt, py = r.top + this.proxyOffsets[1];\r
-        if((r.right - x) <= (r.right-r.left)/2){\r
-            px = r.right+this.view.borderWidth;\r
-            pt = "after";\r
-        }else{\r
-            px = r.left;\r
-            pt = "before";\r
-        }\r
-        var oldIndex = this.view.getCellIndex(h);\r
-        var newIndex = this.view.getCellIndex(n);\r
+    /**\r
+     * Sets a single style value on the Chart instance.\r
+     *\r
+     * @param name {String} Name of the Chart style value to change.\r
+     * @param value {Object} New value to pass to the Chart style.\r
+     */\r
+     setStyle: function(name, value){\r
+         this.swf.setStyle(name, Ext.encode(value));\r
+     },\r
+\r
+    /**\r
+     * Resets all styles on the Chart instance.\r
+     *\r
+     * @param styles {Object} Initializer for all Chart styles.\r
+     */\r
+    setStyles: function(styles){\r
+        this.swf.setStyles(Ext.encode(styles));\r
+    },\r
+\r
+    /**\r
+     * Sets the styles on all series in the Chart.\r
+     *\r
+     * @param styles {Array} Initializer for all Chart series styles.\r
+     */\r
+    setSeriesStyles: function(styles){\r
+        var s = [];\r
+        Ext.each(styles, function(style){\r
+            s.push(Ext.encode(style));\r
+        });\r
+        this.swf.setSeriesStyles(s);\r
+    },\r
 \r
-        if(this.grid.colModel.isFixed(newIndex)){\r
-            return false;\r
-        }\r
+    setCategoryNames : function(names){\r
+        this.swf.setCategoryNames(names);\r
+    },\r
+\r
+    setTipRenderer : function(fn){\r
+        var chart = this;\r
+        this.tipFnName = this.createFnProxy(function(item, index, series){\r
+            var record = chart.store.getAt(index);\r
+            return fn(chart, record, index, series);\r
+        }, this.tipFnName);\r
+        this.swf.setDataTipFunction(this.tipFnName);\r
+    },\r
 \r
-        var locked = this.grid.colModel.isLocked(newIndex);\r
+    setSeries : function(series){\r
+        this.series = series;\r
+        this.refresh();\r
+    },\r
 \r
-        if(pt == "after"){\r
-            newIndex++;\r
-        }\r
-        if(oldIndex < newIndex){\r
-            newIndex--;\r
+    /**\r
+     * Changes the data store bound to this chart and refreshes it.\r
+     * @param {Store} store The store to bind to this chart\r
+     */\r
+    bindStore : function(store, initial){\r
+        if(!initial && this.store){\r
+            this.store.un("datachanged", this.refresh, this);\r
+            this.store.un("add", this.delayRefresh, this);\r
+            this.store.un("remove", this.delayRefresh, this);\r
+            this.store.un("update", this.delayRefresh, this);\r
+            this.store.un("clear", this.refresh, this);\r
+            if(store !== this.store && this.store.autoDestroy){\r
+                this.store.destroy();\r
+            }\r
         }\r
-        if(oldIndex == newIndex && (locked == this.grid.colModel.isLocked(oldIndex))){\r
-            return false;\r
+        if(store){\r
+            store = Ext.StoreMgr.lookup(store);\r
+            store.on({\r
+                scope: this,\r
+                datachanged: this.refresh,\r
+                add: this.delayRefresh,\r
+                remove: this.delayRefresh,\r
+                update: this.delayRefresh,\r
+                clear: this.refresh\r
+            });\r
         }\r
-        px +=  this.proxyOffsets[0];\r
-        this.proxyTop.setLeftTop(px, py);\r
-        this.proxyTop.show();\r
-        if(!this.bottomOffset){\r
-            this.bottomOffset = this.view.mainHd.getHeight();\r
+        this.store = store;\r
+        if(store && !initial){\r
+            this.refresh();\r
         }\r
-        this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);\r
-        this.proxyBottom.show();\r
-        return pt;\r
     },\r
 \r
-    onNodeEnter : function(n, dd, e, data){\r
-        if(data.header != n){\r
-            this.positionIndicator(data.header, n, e);\r
+    onSwfReady : function(isReset){\r
+        Ext.chart.Chart.superclass.onSwfReady.call(this, isReset);\r
+        this.swf.setType(this.type);\r
+\r
+        if(this.chartStyle){\r
+            this.setStyles(Ext.apply(this.extraStyle || {}, this.chartStyle));\r
         }\r
-    },\r
 \r
-    onNodeOver : function(n, dd, e, data){\r
-        var result = false;\r
-        if(data.header != n){\r
-            result = this.positionIndicator(data.header, n, e);\r
+        if(this.categoryNames){\r
+            this.setCategoryNames(this.categoryNames);\r
         }\r
-        if(!result){\r
-            this.proxyTop.hide();\r
-            this.proxyBottom.hide();\r
+\r
+        if(this.tipRenderer){\r
+            this.setTipRenderer(this.tipRenderer);\r
         }\r
-        return result ? this.dropAllowed : this.dropNotAllowed;\r
+        if(!isReset){\r
+            this.bindStore(this.store, true);\r
+        }\r
+        this.refresh.defer(10, this);\r
     },\r
 \r
-    onNodeOut : function(n, dd, e, data){\r
-        this.proxyTop.hide();\r
-        this.proxyBottom.hide();\r
+    delayRefresh : function(){\r
+        if(!this.refreshTask){\r
+            this.refreshTask = new Ext.util.DelayedTask(this.refresh, this);\r
+        }\r
+        this.refreshTask.delay(this.refreshBuffer);\r
     },\r
 \r
-    onNodeDrop : function(n, dd, e, data){\r
-        var h = data.header;\r
-        if(h != n){\r
-            var cm = this.grid.colModel;\r
-            var x = Ext.lib.Event.getPageX(e);\r
-            var r = Ext.lib.Dom.getRegion(n.firstChild);\r
-            var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";\r
-            var oldIndex = this.view.getCellIndex(h);\r
-            var newIndex = this.view.getCellIndex(n);\r
-            var locked = cm.isLocked(newIndex);\r
-            if(pt == "after"){\r
-                newIndex++;\r
-            }\r
-            if(oldIndex < newIndex){\r
-                newIndex--;\r
+    refresh : function(){\r
+        var styleChanged = false;\r
+        // convert the store data into something YUI charts can understand\r
+        var data = [], rs = this.store.data.items;\r
+        for(var j = 0, len = rs.length; j < len; j++){\r
+            data[j] = rs[j].data;\r
+        }\r
+        //make a copy of the series definitions so that we aren't\r
+        //editing them directly.\r
+        var dataProvider = [];\r
+        var seriesCount = 0;\r
+        var currentSeries = null;\r
+        var i = 0;\r
+        if(this.series){\r
+            seriesCount = this.series.length;\r
+            for(i = 0; i < seriesCount; i++){\r
+                currentSeries = this.series[i];\r
+                var clonedSeries = {};\r
+                for(var prop in currentSeries){\r
+                    if(prop == "style" && currentSeries.style !== null){\r
+                        clonedSeries.style = Ext.encode(currentSeries.style);\r
+                        styleChanged = true;\r
+                        //we don't want to modify the styles again next time\r
+                        //so null out the style property.\r
+                        // this causes issues\r
+                        // currentSeries.style = null;\r
+                    } else{\r
+                        clonedSeries[prop] = currentSeries[prop];\r
+                    }\r
+                }\r
+                dataProvider.push(clonedSeries);\r
             }\r
-            if(oldIndex == newIndex && (locked == cm.isLocked(oldIndex))){\r
-                return false;\r
+        }\r
+\r
+        if(seriesCount > 0){\r
+            for(i = 0; i < seriesCount; i++){\r
+                currentSeries = dataProvider[i];\r
+                if(!currentSeries.type){\r
+                    currentSeries.type = this.type;\r
+                }\r
+                currentSeries.dataProvider = data;\r
             }\r
-            cm.setLocked(oldIndex, locked, true);\r
-            cm.moveColumn(oldIndex, newIndex);\r
-            this.grid.fireEvent("columnmove", oldIndex, newIndex);\r
-            return true;\r
+        } else{\r
+            dataProvider.push({type: this.type, dataProvider: data});\r
         }\r
-        return false;\r
+        this.swf.setDataProvider(dataProvider);\r
+    },\r
+\r
+    createFnProxy : function(fn, old){\r
+        if(old){\r
+            delete window[old];\r
+        }\r
+        var fnName = "extFnProxy" + (++Ext.chart.Chart.PROXY_FN_ID);\r
+        window[fnName] = fn;\r
+        return fnName;\r
+    },\r
+    \r
+    onDestroy: function(){\r
+        Ext.chart.Chart.superclass.onDestroy.call(this);\r
+        delete window[this.tipFnName];\r
     }\r
 });\r
+Ext.reg('chart', Ext.chart.Chart);\r
+Ext.chart.Chart.PROXY_FN_ID = 0;\r
 \r
+/**\r
+ * Sets the url to load the chart from. This should be set to a local resource.\r
+ * @static\r
+ * @type String\r
+ */\r
+Ext.chart.Chart.CHART_URL = 'http:/' + '/yui.yahooapis.com/2.7.0/build/charts/assets/charts.swf';\r
 \r
-Ext.grid.GridView.ColumnDragZone = function(grid, hd){\r
-    Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);\r
-    this.proxy.el.addClass('x-grid3-col-dd');\r
-};\r
+/**\r
+ * @class Ext.chart.PieChart\r
+ * @extends Ext.chart.Chart\r
+ * @constructor\r
+ * @xtype piechart\r
+ */\r
+Ext.chart.PieChart = Ext.extend(Ext.chart.Chart, {\r
+    type: 'pie',\r
 \r
-Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {\r
-    handleMouseDown : function(e){\r
+    onSwfReady : function(isReset){\r
+        Ext.chart.PieChart.superclass.onSwfReady.call(this, isReset);\r
 \r
+        this.setDataField(this.dataField);\r
+        this.setCategoryField(this.categoryField);\r
     },\r
 \r
-    callHandleMouseDown : function(e){\r
-        Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);\r
+    setDataField : function(field){\r
+        this.dataField = field;\r
+        this.swf.setDataField(field);\r
+    },\r
+\r
+    setCategoryField : function(field){\r
+        this.categoryField = field;\r
+        this.swf.setCategoryField(field);\r
     }\r
 });\r
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.SplitDragZone = function(grid, hd, hd2){\r
-    this.grid = grid;\r
-    this.view = grid.getView();\r
-    this.proxy = this.view.resizeProxy;\r
-    Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,\r
-        "gridSplitters" + this.grid.getGridEl().id, {\r
-        dragElId : Ext.id(this.proxy.dom), resizeFrame:false\r
-    });\r
-    this.setHandleElId(Ext.id(hd));\r
-    this.setOuterHandleElId(Ext.id(hd2));\r
-    this.scroll = false;\r
-};\r
-Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {\r
-    fly: Ext.Element.fly,\r
+Ext.reg('piechart', Ext.chart.PieChart);\r
 \r
-    b4StartDrag : function(x, y){\r
-        this.view.headersDisabled = true;\r
-        this.proxy.setHeight(this.view.mainWrap.getHeight());\r
-        var w = this.cm.getColumnWidth(this.cellIndex);\r
-        var minw = Math.max(w-this.grid.minColumnWidth, 0);\r
-        this.resetConstraints();\r
-        this.setXConstraint(minw, 1000);\r
-        this.setYConstraint(0, 0);\r
-        this.minX = x - minw;\r
-        this.maxX = x + 1000;\r
-        this.startPos = x;\r
-        Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);\r
+/**\r
+ * @class Ext.chart.CartesianChart\r
+ * @extends Ext.chart.Chart\r
+ * @constructor\r
+ * @xtype cartesianchart\r
+ */\r
+Ext.chart.CartesianChart = Ext.extend(Ext.chart.Chart, {\r
+    onSwfReady : function(isReset){\r
+        Ext.chart.CartesianChart.superclass.onSwfReady.call(this, isReset);\r
+\r
+        if(this.xField){\r
+            this.setXField(this.xField);\r
+        }\r
+        if(this.yField){\r
+            this.setYField(this.yField);\r
+        }\r
+        if(this.xAxis){\r
+            this.setXAxis(this.xAxis);\r
+        }\r
+        if(this.yAxis){\r
+            this.setYAxis(this.yAxis);\r
+        }\r
     },\r
 \r
+    setXField : function(value){\r
+        this.xField = value;\r
+        this.swf.setHorizontalField(value);\r
+    },\r
 \r
-    handleMouseDown : function(e){\r
-        ev = Ext.EventObject.setEvent(e);\r
-        var t = this.fly(ev.getTarget());\r
-        if(t.hasClass("x-grid-split")){\r
-            this.cellIndex = this.view.getCellIndex(t.dom);\r
-            this.split = t.dom;\r
-            this.cm = this.grid.colModel;\r
-            if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){\r
-                Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);\r
-            }\r
-        }\r
+    setYField : function(value){\r
+        this.yField = value;\r
+        this.swf.setVerticalField(value);\r
     },\r
 \r
-    endDrag : function(e){\r
-        this.view.headersDisabled = false;\r
-        var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));\r
-        var diff = endX - this.startPos;\r
-        this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);\r
+    setXAxis : function(value){\r
+        this.xAxis = this.createAxis('xAxis', value);\r
+        this.swf.setHorizontalAxis(this.xAxis);\r
+    },\r
+\r
+    setYAxis : function(value){\r
+        this.yAxis = this.createAxis('yAxis', value);\r
+        this.swf.setVerticalAxis(this.yAxis);\r
     },\r
 \r
-    autoOffset : function(){\r
-        this.setDelta(0,0);\r
+    createAxis : function(axis, value){\r
+        var o = Ext.apply({}, value), oldFn = null;\r
+        if(this[axis]){\r
+            oldFn = this[axis].labelFunction;\r
+        }\r
+        if(o.labelRenderer){\r
+            var fn = o.labelRenderer;\r
+            o.labelFunction = this.createFnProxy(function(v){\r
+                return fn(v);\r
+            }, oldFn);\r
+            delete o.labelRenderer;\r
+        }\r
+        return o;\r
     }\r
 });\r
+Ext.reg('cartesianchart', Ext.chart.CartesianChart);\r
 \r
-Ext.grid.GridDragZone = function(grid, config){\r
-    this.view = grid.getView();\r
-    Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);\r
-    if(this.view.lockedBody){\r
-        this.setHandleElId(Ext.id(this.view.mainBody.dom));\r
-        this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom));\r
-    }\r
-    this.scroll = false;\r
-    this.grid = grid;\r
-    this.ddel = document.createElement('div');\r
-    this.ddel.className = 'x-grid-dd-wrap';\r
+/**\r
+ * @class Ext.chart.LineChart\r
+ * @extends Ext.chart.CartesianChart\r
+ * @constructor\r
+ * @xtype linechart\r
+ */\r
+Ext.chart.LineChart = Ext.extend(Ext.chart.CartesianChart, {\r
+    type: 'line'\r
+});\r
+Ext.reg('linechart', Ext.chart.LineChart);\r
+\r
+/**\r
+ * @class Ext.chart.ColumnChart\r
+ * @extends Ext.chart.CartesianChart\r
+ * @constructor\r
+ * @xtype columnchart\r
+ */\r
+Ext.chart.ColumnChart = Ext.extend(Ext.chart.CartesianChart, {\r
+    type: 'column'\r
+});\r
+Ext.reg('columnchart', Ext.chart.ColumnChart);\r
+\r
+/**\r
+ * @class Ext.chart.StackedColumnChart\r
+ * @extends Ext.chart.CartesianChart\r
+ * @constructor\r
+ * @xtype stackedcolumnchart\r
+ */\r
+Ext.chart.StackedColumnChart = Ext.extend(Ext.chart.CartesianChart, {\r
+    type: 'stackcolumn'\r
+});\r
+Ext.reg('stackedcolumnchart', Ext.chart.StackedColumnChart);\r
+\r
+/**\r
+ * @class Ext.chart.BarChart\r
+ * @extends Ext.chart.CartesianChart\r
+ * @constructor\r
+ * @xtype barchart\r
+ */\r
+Ext.chart.BarChart = Ext.extend(Ext.chart.CartesianChart, {\r
+    type: 'bar'\r
+});\r
+Ext.reg('barchart', Ext.chart.BarChart);\r
+\r
+/**\r
+ * @class Ext.chart.StackedBarChart\r
+ * @extends Ext.chart.CartesianChart\r
+ * @constructor\r
+ * @xtype stackedbarchart\r
+ */\r
+Ext.chart.StackedBarChart = Ext.extend(Ext.chart.CartesianChart, {\r
+    type: 'stackbar'\r
+});\r
+Ext.reg('stackedbarchart', Ext.chart.StackedBarChart);\r
+\r
+\r
+\r
+/**\r
+ * @class Ext.chart.Axis\r
+ * Defines a CartesianChart's vertical or horizontal axis.\r
+ * @constructor\r
+ */\r
+Ext.chart.Axis = function(config){\r
+    Ext.apply(this, config);\r
 };\r
 \r
-Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {\r
-    ddGroup : "GridDD",\r
+Ext.chart.Axis.prototype =\r
+{\r
+    /**\r
+     * The type of axis.\r
+     *\r
+     * @property type\r
+     * @type String\r
+     */\r
+    type: null,\r
+\r
+    /**\r
+     * The direction in which the axis is drawn. May be "horizontal" or "vertical".\r
+     *\r
+     * @property orientation\r
+     * @type String\r
+     */\r
+    orientation: "horizontal",\r
+\r
+    /**\r
+     * If true, the items on the axis will be drawn in opposite direction.\r
+     *\r
+     * @property reverse\r
+     * @type Boolean\r
+     */\r
+    reverse: false,\r
+\r
+    /**\r
+     * A string reference to the globally-accessible function that may be called to\r
+     * determine each of the label values for this axis.\r
+     *\r
+     * @property labelFunction\r
+     * @type String\r
+     */\r
+    labelFunction: null,\r
+\r
+    /**\r
+     * If true, labels that overlap previously drawn labels on the axis will be hidden.\r
+     *\r
+     * @property hideOverlappingLabels\r
+     * @type Boolean\r
+     */\r
+    hideOverlappingLabels: true\r
+};\r
 \r
-    \r
-    getDragData : function(e){\r
-        var t = Ext.lib.Event.getTarget(e);\r
-        var rowIndex = this.view.findRowIndex(t);\r
-        if(rowIndex !== false){\r
-            var sm = this.grid.selModel;\r
-            if(!sm.isSelected(rowIndex) || e.hasModifier()){\r
-                sm.handleMouseDown(this.grid, rowIndex, e);\r
-            }\r
-            return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};\r
-        }\r
-        return false;\r
-    },\r
+/**\r
+ * @class Ext.chart.NumericAxis\r
+ * @extends Ext.chart.Axis\r
+ * A type of axis whose units are measured in numeric values.\r
+ * @constructor\r
+ */\r
+Ext.chart.NumericAxis = Ext.extend(Ext.chart.Axis, {\r
+    type: "numeric",\r
+\r
+    /**\r
+     * The minimum value drawn by the axis. If not set explicitly, the axis minimum\r
+     * will be calculated automatically.\r
+     *\r
+     * @property minimum\r
+     * @type Number\r
+     */\r
+    minimum: NaN,\r
+\r
+    /**\r
+     * The maximum value drawn by the axis. If not set explicitly, the axis maximum\r
+     * will be calculated automatically.\r
+     *\r
+     * @property maximum\r
+     * @type Number\r
+     */\r
+    maximum: NaN,\r
+\r
+    /**\r
+     * The spacing between major intervals on this axis.\r
+     *\r
+     * @property majorUnit\r
+     * @type Number\r
+     */\r
+    majorUnit: NaN,\r
+\r
+    /**\r
+     * The spacing between minor intervals on this axis.\r
+     *\r
+     * @property minorUnit\r
+     * @type Number\r
+     */\r
+    minorUnit: NaN,\r
+\r
+    /**\r
+     * If true, the labels, ticks, gridlines, and other objects will snap to\r
+     * the nearest major or minor unit. If false, their position will be based\r
+     * on the minimum value.\r
+     *\r
+     * @property snapToUnits\r
+     * @type Boolean\r
+     */\r
+    snapToUnits: true,\r
+\r
+    /**\r
+     * If true, and the bounds are calculated automatically, either the minimum or\r
+     * maximum will be set to zero.\r
+     *\r
+     * @property alwaysShowZero\r
+     * @type Boolean\r
+     */\r
+    alwaysShowZero: true,\r
+\r
+    /**\r
+     * The scaling algorithm to use on this axis. May be "linear" or "logarithmic".\r
+     *\r
+     * @property scale\r
+     * @type String\r
+     */\r
+    scale: "linear"\r
+});\r
 \r
-    \r
-    onInitDrag : function(e){\r
-        var data = this.dragData;\r
-        this.ddel.innerHTML = this.grid.getDragDropText();\r
-        this.proxy.update(this.ddel);\r
-        // fire start drag?\r
+/**\r
+ * @class Ext.chart.TimeAxis\r
+ * @extends Ext.chart.Axis\r
+ * A type of axis whose units are measured in time-based values.\r
+ * @constructor\r
+ */\r
+Ext.chart.TimeAxis = Ext.extend(Ext.chart.Axis, {\r
+    type: "time",\r
+\r
+    /**\r
+     * The minimum value drawn by the axis. If not set explicitly, the axis minimum\r
+     * will be calculated automatically.\r
+     *\r
+     * @property minimum\r
+     * @type Date\r
+     */\r
+    minimum: null,\r
+\r
+    /**\r
+     * The maximum value drawn by the axis. If not set explicitly, the axis maximum\r
+     * will be calculated automatically.\r
+     *\r
+     * @property maximum\r
+     * @type Number\r
+     */\r
+    maximum: null,\r
+\r
+    /**\r
+     * The spacing between major intervals on this axis.\r
+     *\r
+     * @property majorUnit\r
+     * @type Number\r
+     */\r
+    majorUnit: NaN,\r
+\r
+    /**\r
+     * The time unit used by the majorUnit.\r
+     *\r
+     * @property majorTimeUnit\r
+     * @type String\r
+     */\r
+    majorTimeUnit: null,\r
+\r
+    /**\r
+     * The spacing between minor intervals on this axis.\r
+     *\r
+     * @property majorUnit\r
+     * @type Number\r
+     */\r
+    minorUnit: NaN,\r
+\r
+    /**\r
+     * The time unit used by the minorUnit.\r
+     *\r
+     * @property majorTimeUnit\r
+     * @type String\r
+     */\r
+    minorTimeUnit: null,\r
+\r
+    /**\r
+     * If true, the labels, ticks, gridlines, and other objects will snap to\r
+     * the nearest major or minor unit. If false, their position will be based\r
+     * on the minimum value.\r
+     *\r
+     * @property snapToUnits\r
+     * @type Boolean\r
+     */\r
+    snapToUnits: true\r
+});\r
+\r
+/**\r
+ * @class Ext.chart.CategoryAxis\r
+ * @extends Ext.chart.Axis\r
+ * A type of axis that displays items in categories.\r
+ * @constructor\r
+ */\r
+Ext.chart.CategoryAxis = Ext.extend(Ext.chart.Axis, {\r
+    type: "category",\r
+\r
+    /**\r
+     * A list of category names to display along this axis.\r
+     *\r
+     * @property categoryNames\r
+     * @type Array\r
+     */\r
+    categoryNames: null\r
+});\r
+\r
+/**\r
+ * @class Ext.chart.Series\r
+ * Series class for the charts widget.\r
+ * @constructor\r
+ */\r
+Ext.chart.Series = function(config) { Ext.apply(this, config); };\r
+\r
+Ext.chart.Series.prototype =\r
+{\r
+    /**\r
+     * The type of series.\r
+     *\r
+     * @property type\r
+     * @type String\r
+     */\r
+    type: null,\r
+\r
+    /**\r
+     * The human-readable name of the series.\r
+     *\r
+     * @property displayName\r
+     * @type String\r
+     */\r
+    displayName: null\r
+};\r
+\r
+/**\r
+ * @class Ext.chart.CartesianSeries\r
+ * @extends Ext.chart.Series\r
+ * CartesianSeries class for the charts widget.\r
+ * @constructor\r
+ */\r
+Ext.chart.CartesianSeries = Ext.extend(Ext.chart.Series, {\r
+    /**\r
+     * The field used to access the x-axis value from the items from the data source.\r
+     *\r
+     * @property xField\r
+     * @type String\r
+     */\r
+    xField: null,\r
+\r
+    /**\r
+     * The field used to access the y-axis value from the items from the data source.\r
+     *\r
+     * @property yField\r
+     * @type String\r
+     */\r
+    yField: null\r
+});\r
+\r
+/**\r
+ * @class Ext.chart.ColumnSeries\r
+ * @extends Ext.chart.CartesianSeries\r
+ * ColumnSeries class for the charts widget.\r
+ * @constructor\r
+ */\r
+Ext.chart.ColumnSeries = Ext.extend(Ext.chart.CartesianSeries, {\r
+    type: "column"\r
+});\r
+\r
+/**\r
+ * @class Ext.chart.LineSeries\r
+ * @extends Ext.chart.CartesianSeries\r
+ * LineSeries class for the charts widget.\r
+ * @constructor\r
+ */\r
+Ext.chart.LineSeries = Ext.extend(Ext.chart.CartesianSeries, {\r
+    type: "line"\r
+});\r
+\r
+/**\r
+ * @class Ext.chart.BarSeries\r
+ * @extends Ext.chart.CartesianSeries\r
+ * BarSeries class for the charts widget.\r
+ * @constructor\r
+ */\r
+Ext.chart.BarSeries = Ext.extend(Ext.chart.CartesianSeries, {\r
+    type: "bar"\r
+});\r
+\r
+\r
+/**\r
+ * @class Ext.chart.PieSeries\r
+ * @extends Ext.chart.Series\r
+ * PieSeries class for the charts widget.\r
+ * @constructor\r
+ */\r
+Ext.chart.PieSeries = Ext.extend(Ext.chart.Series, {\r
+    type: "pie",\r
+    dataField: null,\r
+    categoryField: null\r
+});/**\r
+ * @class Ext.layout.MenuLayout\r
+ * @extends Ext.layout.ContainerLayout\r
+ * <p>Layout manager used by {@link Ext.menu.Menu}. Generally this class should not need to be used directly.</p>\r
+ */\r
+ Ext.layout.MenuLayout = Ext.extend(Ext.layout.ContainerLayout, {\r
+    monitorResize: true,\r
+\r
+    setContainer : function(ct){\r
+        this.monitorResize = !ct.floating;\r
+        Ext.layout.MenuLayout.superclass.setContainer.call(this, ct);\r
     },\r
 \r
-    \r
-    afterRepair : function(){\r
-        this.dragging = false;\r
+    renderItem : function(c, position, target){\r
+        if (!this.itemTpl) {\r
+            this.itemTpl = Ext.layout.MenuLayout.prototype.itemTpl = new Ext.XTemplate(\r
+                '<li id="{itemId}" class="{itemCls}">',\r
+                    '<tpl if="needsIcon">',\r
+                        '<img src="{icon}" class="{iconCls}"/>',\r
+                    '</tpl>',\r
+                '</li>'\r
+            );\r
+        }\r
+\r
+        if(c && !c.rendered){\r
+            if(Ext.isNumber(position)){\r
+                position = target.dom.childNodes[position];\r
+            }\r
+            var a = this.getItemArgs(c);\r
+\r
+//          The Component's positionEl is the <li> it is rendered into\r
+            c.render(c.positionEl = position ?\r
+                this.itemTpl.insertBefore(position, a, true) :\r
+                this.itemTpl.append(target, a, true));\r
+\r
+//          Link the containing <li> to the item.\r
+            c.positionEl.menuItemId = c.itemId || c.id;\r
+\r
+//          If rendering a regular Component, and it needs an icon,\r
+//          move the Component rightwards.\r
+            if (!a.isMenuItem && a.needsIcon) {\r
+                c.positionEl.addClass('x-menu-list-item-indent');\r
+            }\r
+        }else if(c && !this.isValidParent(c, target)){\r
+            if(Ext.isNumber(position)){\r
+                position = target.dom.childNodes[position];\r
+            }\r
+            target.dom.insertBefore(c.getActionEl().dom, position || null);\r
+        }\r
     },\r
 \r
-    \r
-    getRepairXY : function(e, data){\r
-        return false;\r
+    getItemArgs: function(c) {\r
+        var isMenuItem = c instanceof Ext.menu.Item;\r
+        return {\r
+            isMenuItem: isMenuItem,\r
+            needsIcon: !isMenuItem && (c.icon || c.iconCls),\r
+            icon: c.icon || Ext.BLANK_IMAGE_URL,\r
+            iconCls: 'x-menu-item-icon ' + (c.iconCls || ''),\r
+            itemId: 'x-menu-el-' + c.id,\r
+            itemCls: 'x-menu-list-item ' + (this.extraCls || '')\r
+        };\r
     },\r
 \r
-    onEndDrag : function(data, e){\r
-        // fire end drag?\r
+//  Valid if the Component is in a <li> which is part of our target <ul>\r
+    isValidParent: function(c, target) {\r
+        return c.el.up('li.x-menu-list-item', 5).dom.parentNode === (target.dom || target);\r
     },\r
 \r
-    onValidDrop : function(dd, e, id){\r
-        // fire drag drop?\r
-        this.hideProxy();\r
+    onLayout : function(ct, target){\r
+        this.renderAll(ct, target);\r
+        this.doAutoSize();\r
     },\r
 \r
-    beforeInvalidDrop : function(e, id){\r
-\r
+    doAutoSize : function(){\r
+        var ct = this.container, w = ct.width;\r
+        if(ct.floating){\r
+            if(w){\r
+                ct.setWidth(w);\r
+            }else if(Ext.isIE){\r
+                ct.setWidth(Ext.isStrict && (Ext.isIE7 || Ext.isIE8) ? 'auto' : ct.minWidth);\r
+                var el = ct.getEl(), t = el.dom.offsetWidth; // force recalc\r
+                ct.setWidth(ct.getLayoutTarget().getWidth() + el.getFrameWidth('lr'));\r
+            }\r
+        }\r
     }\r
 });\r
+Ext.Container.LAYOUTS['menu'] = Ext.layout.MenuLayout;\r
+\r
+/**\r
+ * @class Ext.menu.Menu\r
+ * @extends Ext.Container\r
+ * <p>A menu object.  This is the container to which you may add menu items.  Menu can also serve as a base class\r
+ * when you want a specialized menu based off of another component (like {@link Ext.menu.DateMenu} for example).</p>\r
+ * <p>Menus may contain either {@link Ext.menu.Item menu items}, or general {@link Ext.Component Component}s.</p>\r
+ * <p>To make a contained general {@link Ext.Component Component} line up with other {@link Ext.menu.Item menu items}\r
+ * specify <tt>iconCls: 'no-icon'</tt>.  This reserves a space for an icon, and indents the Component in line\r
+ * with the other menu items.  See {@link Ext.form.ComboBox}.{@link Ext.form.ComboBox#getListParent getListParent}\r
+ * for an example.</p>\r
+ * <p>By default, Menus are absolutely positioned, floating Components. By configuring a Menu with\r
+ * <b><tt>{@link #floating}:false</tt></b>, a Menu may be used as child of a Container.</p>\r
+ *\r
+ * @xtype menu\r
+ */\r
+Ext.menu.Menu = Ext.extend(Ext.Container, {\r
+    /**\r
+     * @cfg {Object} defaults\r
+     * A config object that will be applied to all items added to this container either via the {@link #items}\r
+     * config or via the {@link #add} method.  The defaults config can contain any number of\r
+     * name/value property pairs to be added to each item, and should be valid for the types of items\r
+     * being added to the menu.\r
+     */\r
+    /**\r
+     * @cfg {Mixed} items\r
+     * An array of items to be added to this menu. Menus may contain either {@link Ext.menu.Item menu items},\r
+     * or general {@link Ext.Component Component}s.\r
+     */\r
+    /**\r
+     * @cfg {Number} minWidth The minimum width of the menu in pixels (defaults to 120)\r
+     */\r
+    minWidth : 120,\r
+    /**\r
+     * @cfg {Boolean/String} shadow True or "sides" for the default effect, "frame" for 4-way shadow, and "drop"\r
+     * for bottom-right shadow (defaults to "sides")\r
+     */\r
+    shadow : "sides",\r
+    /**\r
+     * @cfg {String} subMenuAlign The {@link Ext.Element#alignTo} anchor position value to use for submenus of\r
+     * this menu (defaults to "tl-tr?")\r
+     */\r
+    subMenuAlign : "tl-tr?",\r
+    /**\r
+     * @cfg {String} defaultAlign The default {@link Ext.Element#alignTo} anchor position value for this menu\r
+     * relative to its element of origin (defaults to "tl-bl?")\r
+     */\r
+    defaultAlign : "tl-bl?",\r
+    /**\r
+     * @cfg {Boolean} allowOtherMenus True to allow multiple menus to be displayed at the same time (defaults to false)\r
+     */\r
+    allowOtherMenus : false,\r
+    /**\r
+     * @cfg {Boolean} ignoreParentClicks True to ignore clicks on any item in this menu that is a parent item (displays\r
+     * a submenu) so that the submenu is not dismissed when clicking the parent item (defaults to false).\r
+     */\r
+    ignoreParentClicks : false,\r
+    /**\r
+     * @cfg {Boolean} enableScrolling True to allow the menu container to have scroller controls if the menu is too long (defaults to true).\r
+     */\r
+    enableScrolling: true,\r
+    /**\r
+     * @cfg {Number} maxHeight The maximum height of the menu. Only applies when enableScrolling is set to True (defaults to null).\r
+     */\r
+    maxHeight: null,\r
+    /**\r
+     * @cfg {Number} scrollIncrement The amount to scroll the menu. Only applies when enableScrolling is set to True (defaults to 24).\r
+     */\r
+    scrollIncrement: 24,\r
+    /**\r
+     * @cfg {Boolean} showSeparator True to show the icon separator. (defaults to true).\r
+     */\r
+    showSeparator: true,\r
+    /**\r
+     * @cfg {Array} defaultOffsets An array specifying the [x, y] offset in pixels by which to\r
+     * change the default Menu popup position after aligning according to the {@link #defaultAlign}\r
+     * configuration. Defaults to <tt>[0, 0]</tt>.\r
+     */\r
+    defaultOffsets : [0, 0],\r
+\r
+\r
+    /**\r
+     * @cfg {Boolean} floating\r
+     * May be specified as false to create a Menu which may be used as a child item of another Container\r
+     * instead of a free-floating {@link Ext.Layer Layer}. (defaults to true).\r
+     */\r
+    floating: true,         // Render as a Layer by default\r
+\r
+    // private\r
+    hidden: true,\r
+    layout: 'menu',\r
+    hideMode: 'offsets',    // Important for laying out Components\r
+    scrollerHeight: 8,\r
+    autoLayout: true,       // Provided for backwards compat\r
+    defaultType: 'menuitem',\r
 \r
-\r
-Ext.grid.ColumnModel = function(config){\r
-    \r
-    this.defaultWidth = 100;\r
-\r
-    \r
-    this.defaultSortable = false;\r
-\r
-    \r
-    if(config.columns){\r
-        Ext.apply(this, config);\r
-        this.setConfig(config.columns, true);\r
-    }else{\r
-        this.setConfig(config, true);\r
-    }\r
-    this.addEvents(\r
-        \r
-        "widthchange",\r
-        \r
-        "headerchange",\r
-        \r
-        "hiddenchange",\r
-        \r
-        "columnmoved",\r
-        // deprecated - to be removed\r
-        "columnlockchange",\r
-        \r
-        "configchange"\r
-    );\r
-    Ext.grid.ColumnModel.superclass.constructor.call(this);\r
-};\r
-Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-\r
-    \r
-    getColumnId : function(index){\r
-        return this.config[index].id;\r
-    },\r
-\r
-    \r
-    setConfig : function(config, initial){\r
-        if(!initial){ // cleanup\r
-            delete this.totalWidth;\r
-            for(var i = 0, len = this.config.length; i < len; i++){\r
-                var c = this.config[i];\r
-                if(c.editor){\r
-                    c.editor.destroy();\r
-                }\r
-            }\r
+    initComponent: function(){\r
+        if(Ext.isArray(this.initialConfig)){\r
+            Ext.apply(this, {items:this.initialConfig});\r
         }\r
-        this.config = config;\r
-        this.lookup = {};\r
-        // if no id, create one\r
-        for(var i = 0, len = config.length; i < len; i++){\r
-            var c = config[i];\r
-            if(typeof c.renderer == "string"){\r
-                c.renderer = Ext.util.Format[c.renderer];\r
-            }\r
-            if(typeof c.id == "undefined"){\r
-                c.id = i;\r
-            }\r
-            if(c.editor && c.editor.isFormField){\r
-                c.editor = new Ext.grid.GridEditor(c.editor);\r
+        this.addEvents(\r
+            /**\r
+             * @event click\r
+             * Fires when this menu is clicked (or when the enter key is pressed while it is active)\r
+             * @param {Ext.menu.Menu} this\r
+            * @param {Ext.menu.Item} menuItem The menu item that was clicked\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'click',\r
+            /**\r
+             * @event mouseover\r
+             * Fires when the mouse is hovering over this menu\r
+             * @param {Ext.menu.Menu} this\r
+             * @param {Ext.EventObject} e\r
+             * @param {Ext.menu.Item} menuItem The menu item that was clicked\r
+             */\r
+            'mouseover',\r
+            /**\r
+             * @event mouseout\r
+             * Fires when the mouse exits this menu\r
+             * @param {Ext.menu.Menu} this\r
+             * @param {Ext.EventObject} e\r
+             * @param {Ext.menu.Item} menuItem The menu item that was clicked\r
+             */\r
+            'mouseout',\r
+            /**\r
+             * @event itemclick\r
+             * Fires when a menu item contained in this menu is clicked\r
+             * @param {Ext.menu.BaseItem} baseItem The BaseItem that was clicked\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'itemclick'\r
+        );\r
+        Ext.menu.MenuMgr.register(this);\r
+        if(this.floating){\r
+            Ext.EventManager.onWindowResize(this.hide, this);\r
+        }else{\r
+            if(this.initialConfig.hidden !== false){\r
+                this.hidden = false;\r
             }\r
-            this.lookup[c.id] = c;\r
+            this.internalDefaults = {hideOnClick: false};\r
         }\r
-        if(!initial){\r
-            this.fireEvent('configchange', this);\r
+        Ext.menu.Menu.superclass.initComponent.call(this);\r
+        if(this.autoLayout){\r
+            this.on({\r
+                add: this.doLayout,\r
+                remove: this.doLayout,\r
+                scope: this\r
+            });\r
         }\r
     },\r
 \r
-    \r
-    getColumnById : function(id){\r
-        return this.lookup[id];\r
+    //private\r
+    getLayoutTarget : function() {\r
+        return this.ul;\r
     },\r
 \r
-    \r
-    getIndexById : function(id){\r
-        for(var i = 0, len = this.config.length; i < len; i++){\r
-            if(this.config[i].id == id){\r
-                return i;\r
-            }\r
+    // private\r
+    onRender : function(ct, position){\r
+        if(!ct){\r
+            ct = Ext.getBody();\r
         }\r
-        return -1;\r
-    },\r
 \r
-    \r
-    moveColumn : function(oldIndex, newIndex){\r
-        var c = this.config[oldIndex];\r
-        this.config.splice(oldIndex, 1);\r
-        this.config.splice(newIndex, 0, c);\r
-        this.dataMap = null;\r
-        this.fireEvent("columnmoved", this, oldIndex, newIndex);\r
-    },\r
+        var dh = {\r
+            id: this.getId(),\r
+            cls: 'x-menu ' + ((this.floating) ? 'x-menu-floating x-layer ' : '') + (this.cls || '') + (this.plain ? ' x-menu-plain' : '') + (this.showSeparator ? '' : ' x-menu-nosep'),\r
+            style: this.style,\r
+            cn: [\r
+                {tag: 'a', cls: 'x-menu-focus', href: '#', onclick: 'return false;', tabIndex: '-1'},\r
+                {tag: 'ul', cls: 'x-menu-list'}\r
+            ]\r
+        };\r
+        if(this.floating){\r
+            this.el = new Ext.Layer({\r
+                shadow: this.shadow,\r
+                dh: dh,\r
+                constrain: false,\r
+                parentEl: ct,\r
+                zindex:15000\r
+            });\r
+        }else{\r
+            this.el = ct.createChild(dh);\r
+        }\r
+        Ext.menu.Menu.superclass.onRender.call(this, ct, position);\r
 \r
-    // deprecated - to be removed\r
-    isLocked : function(colIndex){\r
-        return this.config[colIndex].locked === true;\r
+        if(!this.keyNav){\r
+            this.keyNav = new Ext.menu.MenuNav(this);\r
+        }\r
+        // generic focus element\r
+        this.focusEl = this.el.child('a.x-menu-focus');\r
+        this.ul = this.el.child('ul.x-menu-list');\r
+        this.mon(this.ul, {\r
+            scope: this,\r
+            click: this.onClick,\r
+            mouseover: this.onMouseOver,\r
+            mouseout: this.onMouseOut\r
+        });\r
+        if(this.enableScrolling){\r
+            this.mon(this.el, {\r
+                scope: this,\r
+                delegate: '.x-menu-scroller',\r
+                click: this.onScroll,\r
+                mouseover: this.deactivateActive\r
+            });\r
+        }\r
     },\r
 \r
-    // deprecated - to be removed\r
-    setLocked : function(colIndex, value, suppressEvent){\r
-        if(this.isLocked(colIndex) == value){\r
-            return;\r
-        }\r
-        this.config[colIndex].locked = value;\r
-        if(!suppressEvent){\r
-            this.fireEvent("columnlockchange", this, colIndex, value);\r
+    // private\r
+    findTargetItem : function(e){\r
+        var t = e.getTarget(".x-menu-list-item", this.ul, true);\r
+        if(t && t.menuItemId){\r
+            return this.items.get(t.menuItemId);\r
         }\r
     },\r
 \r
-    // deprecated - to be removed\r
-    getTotalLockedWidth : function(){\r
-        var totalWidth = 0;\r
-        for(var i = 0; i < this.config.length; i++){\r
-            if(this.isLocked(i) && !this.isHidden(i)){\r
-                this.totalWidth += this.getColumnWidth(i);\r
+    // private\r
+    onClick : function(e){\r
+        var t = this.findTargetItem(e);\r
+        if(t){\r
+            if(t.isFormField){\r
+                this.setActiveItem(t);\r
+            }else{\r
+                if(t.menu && this.ignoreParentClicks){\r
+                    t.expandMenu();\r
+                    e.preventDefault();\r
+                }else if(t.onClick){\r
+                    t.onClick(e);\r
+                    this.fireEvent("click", this, t, e);\r
+                }\r
             }\r
         }\r
-        return totalWidth;\r
     },\r
 \r
-    // deprecated - to be removed\r
-    getLockedCount : function(){\r
-        for(var i = 0, len = this.config.length; i < len; i++){\r
-            if(!this.isLocked(i)){\r
-                return i;\r
+    // private\r
+    setActiveItem : function(item, autoExpand){\r
+        if(item != this.activeItem){\r
+            this.deactivateActive();\r
+            if((this.activeItem = item).isFormField){\r
+                item.focus();\r
+            }else{\r
+                item.activate(autoExpand);\r
             }\r
+        }else if(autoExpand){\r
+            item.expandMenu();\r
         }\r
     },\r
 \r
-    \r
-    getColumnCount : function(visibleOnly){\r
-        if(visibleOnly === true){\r
-            var c = 0;\r
-            for(var i = 0, len = this.config.length; i < len; i++){\r
-                if(!this.isHidden(i)){\r
-                    c++;\r
+    deactivateActive: function(){\r
+        var a = this.activeItem;\r
+        if(a){\r
+            if(a.isFormField){\r
+                //Fields cannot deactivate, but Combos must collapse\r
+                if(a.collapse){\r
+                    a.collapse();\r
                 }\r
+            }else{\r
+                a.deactivate();\r
             }\r
-            return c;\r
+            delete this.activeItem;\r
         }\r
-        return this.config.length;\r
     },\r
 \r
-    \r
-    getColumnsBy : function(fn, scope){\r
-        var r = [];\r
-        for(var i = 0, len = this.config.length; i < len; i++){\r
-            var c = this.config[i];\r
-            if(fn.call(scope||this, c, i) === true){\r
-                r[r.length] = c;\r
+    // private\r
+    tryActivate : function(start, step){\r
+        var items = this.items;\r
+        for(var i = start, len = items.length; i >= 0 && i < len; i+= step){\r
+            var item = items.get(i);\r
+            if(!item.disabled && (item.canActivate || item.isFormField)){\r
+                this.setActiveItem(item, false);\r
+                return item;\r
             }\r
         }\r
-        return r;\r
+        return false;\r
     },\r
 \r
-    \r
-    isSortable : function(col){\r
-        if(typeof this.config[col].sortable == "undefined"){\r
-            return this.defaultSortable;\r
+    // private\r
+    onMouseOver : function(e){\r
+        var t = this.findTargetItem(e);\r
+        if(t){\r
+            if(t.canActivate && !t.disabled){\r
+                this.setActiveItem(t, true);\r
+            }\r
         }\r
-        return this.config[col].sortable;\r
+        this.over = true;\r
+        this.fireEvent("mouseover", this, e, t);\r
     },\r
 \r
-    \r
-    isMenuDisabled : function(col){\r
-        return !!this.config[col].menuDisabled;\r
+    // private\r
+    onMouseOut : function(e){\r
+        var t = this.findTargetItem(e);\r
+        if(t){\r
+            if(t == this.activeItem && t.shouldDeactivate && t.shouldDeactivate(e)){\r
+                this.activeItem.deactivate();\r
+                delete this.activeItem;\r
+            }\r
+        }\r
+        this.over = false;\r
+        this.fireEvent("mouseout", this, e, t);\r
     },\r
 \r
-    \r
-    getRenderer : function(col){\r
-        if(!this.config[col].renderer){\r
-            return Ext.grid.ColumnModel.defaultRenderer;\r
+    // private\r
+    onScroll: function(e, t){\r
+        if(e){\r
+            e.stopEvent();\r
+        }\r
+        var ul = this.ul.dom, top = Ext.fly(t).is('.x-menu-scroller-top');\r
+        ul.scrollTop += this.scrollIncrement * (top ? -1 : 1);\r
+        if(top ? ul.scrollTop <= 0 : ul.scrollTop + this.activeMax >= ul.scrollHeight){\r
+           this.onScrollerOut(null, t);\r
         }\r
-        return this.config[col].renderer;\r
     },\r
 \r
-    \r
-    setRenderer : function(col, fn){\r
-        this.config[col].renderer = fn;\r
+    // private\r
+    onScrollerIn: function(e, t){\r
+        var ul = this.ul.dom, top = Ext.fly(t).is('.x-menu-scroller-top');\r
+        if(top ? ul.scrollTop > 0 : ul.scrollTop + this.activeMax < ul.scrollHeight){\r
+            Ext.fly(t).addClass(['x-menu-item-active', 'x-menu-scroller-active']);\r
+        }\r
     },\r
 \r
-    \r
-    getColumnWidth : function(col){\r
-        return this.config[col].width || this.defaultWidth;\r
+    // private\r
+    onScrollerOut: function(e, t){\r
+        Ext.fly(t).removeClass(['x-menu-item-active', 'x-menu-scroller-active']);\r
     },\r
 \r
-    \r
-    setColumnWidth : function(col, width, suppressEvent){\r
-        this.config[col].width = width;\r
-        this.totalWidth = null;\r
-        if(!suppressEvent){\r
-             this.fireEvent("widthchange", this, col, width);\r
+    /**\r
+     * Displays this menu relative to another element\r
+     * @param {Mixed} element The element to align to\r
+     * @param {String} position (optional) The {@link Ext.Element#alignTo} anchor position to use in aligning to\r
+     * the element (defaults to this.defaultAlign)\r
+     * @param {Ext.menu.Menu} parentMenu (optional) This menu's parent menu, if applicable (defaults to undefined)\r
+     */\r
+    show : function(el, pos, parentMenu){\r
+        if(this.floating){\r
+            this.parentMenu = parentMenu;\r
+            if(!this.el){\r
+                this.render();\r
+                this.doLayout(false, true);\r
+            }\r
+            if(this.fireEvent('beforeshow', this) !== false){\r
+                this.showAt(this.el.getAlignToXY(el, pos || this.defaultAlign, this.defaultOffsets), parentMenu, false);\r
+            }\r
+        }else{\r
+            Ext.menu.Menu.superclass.show.call(this);\r
         }\r
     },\r
 \r
-    \r
-    getTotalWidth : function(includeHidden){\r
-        if(!this.totalWidth){\r
-            this.totalWidth = 0;\r
-            for(var i = 0, len = this.config.length; i < len; i++){\r
-                if(includeHidden || !this.isHidden(i)){\r
-                    this.totalWidth += this.getColumnWidth(i);\r
-                }\r
+    /**\r
+     * Displays this menu at a specific xy position\r
+     * @param {Array} xyPosition Contains X & Y [x, y] values for the position at which to show the menu (coordinates are page-based)\r
+     * @param {Ext.menu.Menu} parentMenu (optional) This menu's parent menu, if applicable (defaults to undefined)\r
+     */\r
+    showAt : function(xy, parentMenu, /* private: */_e){\r
+        this.parentMenu = parentMenu;\r
+        if(!this.el){\r
+            this.render();\r
+        }\r
+        this.el.setXY(xy);\r
+        if(this.enableScrolling){\r
+            this.constrainScroll(xy[1]);\r
+        }\r
+        this.el.show();\r
+        Ext.menu.Menu.superclass.onShow.call(this);\r
+        if(Ext.isIE){\r
+            this.layout.doAutoSize();\r
+            if(!Ext.isIE8){\r
+                this.el.repaint();\r
             }\r
         }\r
-        return this.totalWidth;\r
-    },\r
-\r
-    \r
-    getColumnHeader : function(col){\r
-        return this.config[col].header;\r
-    },\r
-\r
-    \r
-    setColumnHeader : function(col, header){\r
-        this.config[col].header = header;\r
-        this.fireEvent("headerchange", this, col, header);\r
-    },\r
-\r
-    \r
-    getColumnTooltip : function(col){\r
-            return this.config[col].tooltip;\r
-    },\r
-    \r
-    setColumnTooltip : function(col, tooltip){\r
-            this.config[col].tooltip = tooltip;\r
-    },\r
-\r
-    \r
-    getDataIndex : function(col){\r
-        return this.config[col].dataIndex;\r
+        this.hidden = false;\r
+        this.focus();\r
+        this.fireEvent("show", this);\r
     },\r
 \r
-    \r
-    setDataIndex : function(col, dataIndex){\r
-        this.config[col].dataIndex = dataIndex;\r
+    constrainScroll: function(y){\r
+        var max, full = this.ul.setHeight('auto').getHeight();\r
+        if(this.floating){\r
+            max = this.maxHeight ? this.maxHeight : Ext.fly(this.el.dom.parentNode).getViewSize().height - y;\r
+        }else{\r
+            max = this.getHeight();\r
+        }\r
+        if(full > max && max > 0){\r
+            this.activeMax = max - this.scrollerHeight * 2 - this.el.getFrameWidth('tb') - Ext.num(this.el.shadowOffset, 0);\r
+            this.ul.setHeight(this.activeMax);\r
+            this.createScrollers();\r
+            this.el.select('.x-menu-scroller').setDisplayed('');\r
+        }else{\r
+            this.ul.setHeight(full);\r
+            this.el.select('.x-menu-scroller').setDisplayed('none');\r
+        }\r
+        this.ul.dom.scrollTop = 0;\r
+    },\r
+\r
+    createScrollers: function(){\r
+        if(!this.scroller){\r
+            this.scroller = {\r
+                pos: 0,\r
+                top: this.el.insertFirst({\r
+                    tag: 'div',\r
+                    cls: 'x-menu-scroller x-menu-scroller-top',\r
+                    html: '&#160;'\r
+                }),\r
+                bottom: this.el.createChild({\r
+                    tag: 'div',\r
+                    cls: 'x-menu-scroller x-menu-scroller-bottom',\r
+                    html: '&#160;'\r
+                })\r
+            };\r
+            this.scroller.top.hover(this.onScrollerIn, this.onScrollerOut, this);\r
+            this.scroller.topRepeater = new Ext.util.ClickRepeater(this.scroller.top, {\r
+                listeners: {\r
+                    click: this.onScroll.createDelegate(this, [null, this.scroller.top], false)\r
+                }\r
+            });\r
+            this.scroller.bottom.hover(this.onScrollerIn, this.onScrollerOut, this);\r
+            this.scroller.bottomRepeater = new Ext.util.ClickRepeater(this.scroller.bottom, {\r
+                listeners: {\r
+                    click: this.onScroll.createDelegate(this, [null, this.scroller.bottom], false)\r
+                }\r
+            });\r
+        }\r
     },\r
 \r
-    \r
-    findColumnIndex : function(dataIndex){\r
-        var c = this.config;\r
-        for(var i = 0, len = c.length; i < len; i++){\r
-            if(c[i].dataIndex == dataIndex){\r
-                return i;\r
+    onLayout: function(){\r
+        if(this.isVisible()){\r
+            if(this.enableScrolling){\r
+                this.constrainScroll(this.el.getTop());\r
+            }\r
+            if(this.floating){\r
+                this.el.sync();\r
             }\r
         }\r
-        return -1;\r
     },\r
 \r
-    \r
-    isCellEditable : function(colIndex, rowIndex){\r
-        return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;\r
+    focus : function(){\r
+        if(!this.hidden){\r
+            this.doFocus.defer(50, this);\r
+        }\r
     },\r
 \r
-    \r
-    getCellEditor : function(colIndex, rowIndex){\r
-        return this.config[colIndex].editor;\r
+    doFocus : function(){\r
+        if(!this.hidden){\r
+            this.focusEl.focus();\r
+        }\r
     },\r
 \r
-    \r
-    setEditable : function(col, editable){\r
-        this.config[col].editable = editable;\r
+    /**\r
+     * Hides this menu and optionally all parent menus\r
+     * @param {Boolean} deep (optional) True to hide all parent menus recursively, if any (defaults to false)\r
+     */\r
+    hide : function(deep){\r
+        this.deepHide = deep;\r
+        Ext.menu.Menu.superclass.hide.call(this);\r
+        delete this.deepHide;\r
     },\r
 \r
-\r
-    \r
-    isHidden : function(colIndex){\r
-        return this.config[colIndex].hidden;\r
+    // private\r
+    onHide: function(){\r
+        Ext.menu.Menu.superclass.onHide.call(this);\r
+        this.deactivateActive();\r
+        if(this.el && this.floating){\r
+            this.el.hide();\r
+        }\r
+        if(this.deepHide === true && this.parentMenu){\r
+            this.parentMenu.hide(true);\r
+        }\r
     },\r
 \r
-\r
-    \r
-    isFixed : function(colIndex){\r
-        return this.config[colIndex].fixed;\r
+    // private\r
+    lookupComponent: function(c){\r
+         if(Ext.isString(c)){\r
+            c = (c == 'separator' || c == '-') ? new Ext.menu.Separator() : new Ext.menu.TextItem(c);\r
+             this.applyDefaults(c);\r
+         }else{\r
+            if(Ext.isObject(c)){\r
+                c = this.getMenuItem(c);\r
+            }else if(c.tagName || c.el){ // element. Wrap it.\r
+                c = new Ext.BoxComponent({\r
+                    el: c\r
+                });\r
+            }\r
+         }\r
+         return c;\r
     },\r
 \r
-    \r
-    isResizable : function(colIndex){\r
-        return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true;\r
-    },\r
-    \r
-    setHidden : function(colIndex, hidden){\r
-        var c = this.config[colIndex];\r
-        if(c.hidden !== hidden){\r
-            c.hidden = hidden;\r
-            this.totalWidth = null;\r
-            this.fireEvent("hiddenchange", this, colIndex, hidden);\r
+    applyDefaults : function(c){\r
+        if(!Ext.isString(c)){\r
+            c = Ext.menu.Menu.superclass.applyDefaults.call(this, c);\r
+            var d = this.internalDefaults;\r
+            if(d){\r
+                if(c.events){\r
+                    Ext.applyIf(c.initialConfig, d);\r
+                    Ext.apply(c, d);\r
+                }else{\r
+                    Ext.applyIf(c, d);\r
+                }\r
+            }\r
         }\r
+        return c;\r
     },\r
 \r
-    \r
-    setEditor : function(col, editor){\r
-        this.config[col].editor = editor;\r
-    }\r
-});\r
-\r
-// private\r
-Ext.grid.ColumnModel.defaultRenderer = function(value){\r
-    if(typeof value == "string" && value.length < 1){\r
-        return "&#160;";\r
-    }\r
-    return value;\r
-};\r
+    // private\r
+    getMenuItem: function(config){\r
+       if(!config.isXType){\r
+            if(!config.xtype && Ext.isBoolean(config.checked)){\r
+                return new Ext.menu.CheckItem(config)\r
+            }\r
+            return Ext.create(config, this.defaultType);\r
+        }\r
+        return config;\r
+    },\r
 \r
-// Alias for backwards compatibility\r
-Ext.grid.DefaultColumnModel = Ext.grid.ColumnModel;\r
+    /**\r
+     * Adds a separator bar to the menu\r
+     * @return {Ext.menu.Item} The menu item that was added\r
+     */\r
+    addSeparator : function(){\r
+        return this.add(new Ext.menu.Separator());\r
+    },\r
 \r
-Ext.grid.AbstractSelectionModel = function(){\r
-    this.locked = false;\r
-    Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);\r
-};\r
+    /**\r
+     * Adds an {@link Ext.Element} object to the menu\r
+     * @param {Mixed} el The element or DOM node to add, or its id\r
+     * @return {Ext.menu.Item} The menu item that was added\r
+     */\r
+    addElement : function(el){\r
+        return this.add(new Ext.menu.BaseItem(el));\r
+    },\r
 \r
-Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable,  {\r
-    \r
-    init : function(grid){\r
-        this.grid = grid;\r
-        this.initEvents();\r
+    /**\r
+     * Adds an existing object based on {@link Ext.menu.BaseItem} to the menu\r
+     * @param {Ext.menu.Item} item The menu item to add\r
+     * @return {Ext.menu.Item} The menu item that was added\r
+     */\r
+    addItem : function(item){\r
+        return this.add(item);\r
     },\r
 \r
-    \r
-    lock : function(){\r
-        this.locked = true;\r
+    /**\r
+     * Creates a new {@link Ext.menu.Item} based an the supplied config object and adds it to the menu\r
+     * @param {Object} config A MenuItem config object\r
+     * @return {Ext.menu.Item} The menu item that was added\r
+     */\r
+    addMenuItem : function(config){\r
+        return this.add(this.getMenuItem(config));\r
     },\r
 \r
-    \r
-    unlock : function(){\r
-        this.locked = false;\r
+    /**\r
+     * Creates a new {@link Ext.menu.TextItem} with the supplied text and adds it to the menu\r
+     * @param {String} text The text to display in the menu item\r
+     * @return {Ext.menu.Item} The menu item that was added\r
+     */\r
+    addText : function(text){\r
+        return this.add(new Ext.menu.TextItem(text));\r
     },\r
 \r
-    \r
-    isLocked : function(){\r
-        return this.locked;\r
+    //private\r
+    onDestroy : function(){\r
+        Ext.menu.Menu.superclass.onDestroy.call(this);\r
+        Ext.menu.MenuMgr.unregister(this);\r
+        Ext.EventManager.removeResizeListener(this.hide, this);\r
+        if(this.keyNav) {\r
+            this.keyNav.disable();\r
+        }\r
+        var s = this.scroller;\r
+        if(s){\r
+            Ext.destroy(s.topRepeater, s.bottomRepeater, s.top, s.bottom);\r
+        }\r
     }\r
 });\r
 \r
-Ext.grid.RowSelectionModel = function(config){\r
-    Ext.apply(this, config);\r
-    this.selections = new Ext.util.MixedCollection(false, function(o){\r
-        return o.id;\r
-    });\r
+Ext.reg('menu', Ext.menu.Menu);\r
 \r
-    this.last = false;\r
-    this.lastActive = false;\r
+// MenuNav is a private utility class used internally by the Menu\r
+Ext.menu.MenuNav = Ext.extend(Ext.KeyNav, function(){\r
+    function up(e, m){\r
+        if(!m.tryActivate(m.items.indexOf(m.activeItem)-1, -1)){\r
+            m.tryActivate(m.items.length-1, -1);\r
+        }\r
+    }\r
+    function down(e, m){\r
+        if(!m.tryActivate(m.items.indexOf(m.activeItem)+1, 1)){\r
+            m.tryActivate(0, 1);\r
+        }\r
+    }\r
+    return {\r
+        constructor: function(menu){\r
+            Ext.menu.MenuNav.superclass.constructor.call(this, menu.el);\r
+            this.scope = this.menu = menu;\r
+        },\r
 \r
-    this.addEvents(\r
-        \r
-           "selectionchange",\r
-        \r
-           "beforerowselect",\r
-        \r
-           "rowselect",\r
-        \r
-           "rowdeselect"\r
-    );\r
+        doRelay : function(e, h){\r
+            var k = e.getKey();\r
+//          Keystrokes within a form Field (e.g.: down in a Combo) do not navigate. Allow only TAB\r
+            if (this.menu.activeItem && this.menu.activeItem.isFormField && k != e.TAB) {\r
+                return false;\r
+            }\r
+            if(!this.menu.activeItem && e.isNavKeyPress() && k != e.SPACE && k != e.RETURN){\r
+                this.menu.tryActivate(0, 1);\r
+                return false;\r
+            }\r
+            return h.call(this.scope || this, e, this.menu);\r
+        },\r
 \r
-    Ext.grid.RowSelectionModel.superclass.constructor.call(this);\r
-};\r
+        tab: function(e, m) {\r
+            e.stopEvent();\r
+            if (e.shiftKey) {\r
+                up(e, m);\r
+            } else {\r
+                down(e, m);\r
+            }\r
+        },\r
 \r
-Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {\r
-    \r
-    singleSelect : false,\r
+        up : up,\r
 \r
-       \r
-    // private\r
-    initEvents : function(){\r
+        down : down,\r
 \r
-        if(!this.grid.enableDragDrop && !this.grid.enableDrag){\r
-            this.grid.on("rowmousedown", this.handleMouseDown, this);\r
-        }else{ // allow click to work like normal\r
-            this.grid.on("rowclick", function(grid, rowIndex, e) {\r
-                if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {\r
-                    this.selectRow(rowIndex, false);\r
-                    grid.view.focusRow(rowIndex);\r
-                }\r
-            }, this);\r
+        right : function(e, m){\r
+            if(m.activeItem){\r
+                m.activeItem.expandMenu(true);\r
+            }\r
+        },\r
+\r
+        left : function(e, m){\r
+            m.hide();\r
+            if(m.parentMenu && m.parentMenu.activeItem){\r
+                m.parentMenu.activeItem.activate();\r
+            }\r
+        },\r
+\r
+        enter : function(e, m){\r
+            if(m.activeItem){\r
+                e.stopPropagation();\r
+                m.activeItem.onClick(e);\r
+                m.fireEvent("click", this, m.activeItem);\r
+                return true;\r
+            }\r
         }\r
+    };\r
+}());/**
+ * @class Ext.menu.MenuMgr
+ * Provides a common registry of all menu items on a page so that they can be easily accessed by id.
+ * @singleton
+ */
+Ext.menu.MenuMgr = function(){
+   var menus, active, groups = {}, attached = false, lastShow = new Date();
+
+   // private - called when first menu is created
+   function init(){
+       menus = {};
+       active = new Ext.util.MixedCollection();
+       Ext.getDoc().addKeyListener(27, function(){
+           if(active.length > 0){
+               hideAll();
+           }
+       });
+   }
+
+   // private
+   function hideAll(){
+       if(active && active.length > 0){
+           var c = active.clone();
+           c.each(function(m){
+               m.hide();
+           });
+       }
+   }
+
+   // private
+   function onHide(m){
+       active.remove(m);
+       if(active.length < 1){
+           Ext.getDoc().un("mousedown", onMouseDown);
+           attached = false;
+       }
+   }
+
+   // private
+   function onShow(m){
+       var last = active.last();
+       lastShow = new Date();
+       active.add(m);
+       if(!attached){
+           Ext.getDoc().on("mousedown", onMouseDown);
+           attached = true;
+       }
+       if(m.parentMenu){
+          m.getEl().setZIndex(parseInt(m.parentMenu.getEl().getStyle("z-index"), 10) + 3);
+          m.parentMenu.activeChild = m;
+       }else if(last && last.isVisible()){
+          m.getEl().setZIndex(parseInt(last.getEl().getStyle("z-index"), 10) + 3);
+       }
+   }
+
+   // private
+   function onBeforeHide(m){
+       if(m.activeChild){
+           m.activeChild.hide();
+       }
+       if(m.autoHideTimer){
+           clearTimeout(m.autoHideTimer);
+           delete m.autoHideTimer;
+       }
+   }
+
+   // private
+   function onBeforeShow(m){
+       var pm = m.parentMenu;
+       if(!pm && !m.allowOtherMenus){
+           hideAll();
+       }else if(pm && pm.activeChild){
+           pm.activeChild.hide();
+       }
+   }
+
+   // private
+   function onMouseDown(e){
+       if(lastShow.getElapsed() > 50 && active.length > 0 && !e.getTarget(".x-menu")){
+           hideAll();
+       }
+   }
+
+   // private
+   function onBeforeCheck(mi, state){
+       if(state){
+           var g = groups[mi.group];
+           for(var i = 0, l = g.length; i < l; i++){
+               if(g[i] != mi){
+                   g[i].setChecked(false);
+               }
+           }
+       }
+   }
+
+   return {
+
+       /**
+        * Hides all menus that are currently visible
+        */
+       hideAll : function(){
+            hideAll();  
+       },
+
+       // private
+       register : function(menu){
+           if(!menus){
+               init();
+           }
+           menus[menu.id] = menu;
+           menu.on("beforehide", onBeforeHide);
+           menu.on("hide", onHide);
+           menu.on("beforeshow", onBeforeShow);
+           menu.on("show", onShow);
+           var g = menu.group;
+           if(g && menu.events["checkchange"]){
+               if(!groups[g]){
+                   groups[g] = [];
+               }
+               groups[g].push(menu);
+               menu.on("checkchange", onCheck);
+           }
+       },
+
+        /**
+         * Returns a {@link Ext.menu.Menu} object
+         * @param {String/Object} menu The string menu id, an existing menu object reference, or a Menu config that will
+         * be used to generate and return a new Menu instance.
+         * @return {Ext.menu.Menu} The specified menu, or null if none are found
+         */
+       get : function(menu){
+           if(typeof menu == "string"){ // menu id
+               if(!menus){  // not initialized, no menus to return
+                   return null;
+               }
+               return menus[menu];
+           }else if(menu.events){  // menu instance
+               return menu;
+           }else if(typeof menu.length == 'number'){ // array of menu items?
+               return new Ext.menu.Menu({items:menu});
+           }else{ // otherwise, must be a config
+               return Ext.create(menu, 'menu');
+           }
+       },
+
+       // private
+       unregister : function(menu){
+           delete menus[menu.id];
+           menu.un("beforehide", onBeforeHide);
+           menu.un("hide", onHide);
+           menu.un("beforeshow", onBeforeShow);
+           menu.un("show", onShow);
+           var g = menu.group;
+           if(g && menu.events["checkchange"]){
+               groups[g].remove(menu);
+               menu.un("checkchange", onCheck);
+           }
+       },
+
+       // private
+       registerCheckable : function(menuItem){
+           var g = menuItem.group;
+           if(g){
+               if(!groups[g]){
+                   groups[g] = [];
+               }
+               groups[g].push(menuItem);
+               menuItem.on("beforecheckchange", onBeforeCheck);
+           }
+       },
+
+       // private
+       unregisterCheckable : function(menuItem){
+           var g = menuItem.group;
+           if(g){
+               groups[g].remove(menuItem);
+               menuItem.un("beforecheckchange", onBeforeCheck);
+           }
+       },
+
+       getCheckedItem : function(groupId){
+           var g = groups[groupId];
+           if(g){
+               for(var i = 0, l = g.length; i < l; i++){
+                   if(g[i].checked){
+                       return g[i];
+                   }
+               }
+           }
+           return null;
+       },
+
+       setCheckedItem : function(groupId, itemId){
+           var g = groups[groupId];
+           if(g){
+               for(var i = 0, l = g.length; i < l; i++){
+                   if(g[i].id == itemId){
+                       g[i].setChecked(true);
+                   }
+               }
+           }
+           return null;
+       }
+   };
+}();
+/**
+ * @class Ext.menu.BaseItem
+ * @extends Ext.Component
+ * The base class for all items that render into menus.  BaseItem provides default rendering, activated state
+ * management and base configuration options shared by all menu components.
+ * @constructor
+ * Creates a new BaseItem
+ * @param {Object} config Configuration options
+ * @xtype menubaseitem
+ */
+Ext.menu.BaseItem = function(config){
+    Ext.menu.BaseItem.superclass.constructor.call(this, config);
+
+    this.addEvents(
+        /**
+         * @event click
+         * Fires when this item is clicked
+         * @param {Ext.menu.BaseItem} this
+         * @param {Ext.EventObject} e
+         */
+        'click',
+        /**
+         * @event activate
+         * Fires when this item is activated
+         * @param {Ext.menu.BaseItem} this
+         */
+        'activate',
+        /**
+         * @event deactivate
+         * Fires when this item is deactivated
+         * @param {Ext.menu.BaseItem} this
+         */
+        'deactivate'
+    );
+
+    if(this.handler){
+        this.on("click", this.handler, this.scope);
+    }
+};
+
+Ext.extend(Ext.menu.BaseItem, Ext.Component, {
+    /**
+     * @property parentMenu
+     * @type Ext.menu.Menu
+     * The parent Menu of this Item.
+     */
+    /**
+     * @cfg {Function} handler
+     * A function that will handle the click event of this menu item (optional).
+     * The handler is passed the following parameters:<div class="mdetail-params"><ul>
+     * <li><code>b</code> : Item<div class="sub-desc">This menu Item.</div></li>
+     * <li><code>e</code> : EventObject<div class="sub-desc">The click event.</div></li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {Object} scope
+     * The scope (<tt><b>this</b></tt> reference) in which the handler function will be called.
+     */
+    /**
+     * @cfg {Boolean} canActivate True if this item can be visually activated (defaults to false)
+     */
+    canActivate : false,
+    /**
+     * @cfg {String} activeClass The CSS class to use when the item becomes activated (defaults to "x-menu-item-active")
+     */
+    activeClass : "x-menu-item-active",
+    /**
+     * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to true)
+     */
+    hideOnClick : true,
+    /**
+     * @cfg {Number} clickHideDelay Length of time in milliseconds to wait before hiding after a click (defaults to 100)
+     */
+    clickHideDelay : 1,
+
+    // private
+    ctype : "Ext.menu.BaseItem",
+
+    // private
+    actionMode : "container",
+
+    // private
+    onRender : function(container, position){
+        Ext.menu.BaseItem.superclass.onRender.apply(this, arguments);
+        if(this.ownerCt && this.ownerCt instanceof Ext.menu.Menu){
+            this.parentMenu = this.ownerCt;
+        }else{
+            this.container.addClass('x-menu-list-item');
+            this.mon(this.el, 'click', this.onClick, this);
+            this.mon(this.el, 'mouseenter', this.activate, this);
+            this.mon(this.el, 'mouseleave', this.deactivate, this);
+        }
+    },
+
+    /**
+     * Sets the function that will handle click events for this item (equivalent to passing in the {@link #handler}
+     * config property).  If an existing handler is already registered, it will be unregistered for you.
+     * @param {Function} handler The function that should be called on click
+     * @param {Object} scope The scope that should be passed to the handler
+     */
+    setHandler : function(handler, scope){
+        if(this.handler){
+            this.un("click", this.handler, this.scope);
+        }
+        this.on("click", this.handler = handler, this.scope = scope);
+    },
+
+    // private
+    onClick : function(e){
+        if(!this.disabled && this.fireEvent("click", this, e) !== false
+                && (this.parentMenu && this.parentMenu.fireEvent("itemclick", this, e) !== false)){
+            this.handleClick(e);
+        }else{
+            e.stopEvent();
+        }
+    },
+
+    // private
+    activate : function(){
+        if(this.disabled){
+            return false;
+        }
+        var li = this.container;
+        li.addClass(this.activeClass);
+        this.region = li.getRegion().adjust(2, 2, -2, -2);
+        this.fireEvent("activate", this);
+        return true;
+    },
+
+    // private
+    deactivate : function(){
+        this.container.removeClass(this.activeClass);
+        this.fireEvent("deactivate", this);
+    },
+
+    // private
+    shouldDeactivate : function(e){
+        return !this.region || !this.region.contains(e.getPoint());
+    },
+
+    // private
+    handleClick : function(e){
+        if(this.hideOnClick){
+            this.parentMenu.hide.defer(this.clickHideDelay, this.parentMenu, [true]);
+        }
+    },
+
+    // private. Do nothing
+    expandMenu : Ext.emptyFn,
+
+    // private. Do nothing
+    hideMenu : Ext.emptyFn
+});
+Ext.reg('menubaseitem', Ext.menu.BaseItem);/**
+ * @class Ext.menu.TextItem
+ * @extends Ext.menu.BaseItem
+ * Adds a static text string to a menu, usually used as either a heading or group separator.
+ * @constructor
+ * Creates a new TextItem
+ * @param {Object/String} config If config is a string, it is used as the text to display, otherwise it
+ * is applied as a config object (and should contain a <tt>text</tt> property).
+ * @xtype menutextitem
+ */
+Ext.menu.TextItem = function(cfg){
+    if(typeof cfg == 'string'){
+        cfg = {text: cfg}
+    }
+    Ext.menu.TextItem.superclass.constructor.call(this, cfg);
+};
+
+Ext.extend(Ext.menu.TextItem, Ext.menu.BaseItem, {
+    /**
+     * @cfg {String} text The text to display for this item (defaults to '')
+     */
+    /**
+     * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false)
+     */
+    hideOnClick : false,
+    /**
+     * @cfg {String} itemCls The default CSS class to use for text items (defaults to "x-menu-text")
+     */
+    itemCls : "x-menu-text",
+
+    // private
+    onRender : function(){
+        var s = document.createElement("span");
+        s.className = this.itemCls;
+        s.innerHTML = this.text;
+        this.el = s;
+        Ext.menu.TextItem.superclass.onRender.apply(this, arguments);
+    }
+});
+Ext.reg('menutextitem', Ext.menu.TextItem);/**
+ * @class Ext.menu.Separator
+ * @extends Ext.menu.BaseItem
+ * Adds a separator bar to a menu, used to divide logical groups of menu items. Generally you will
+ * add one of these by using "-" in you call to add() or in your items config rather than creating one directly.
+ * @constructor
+ * @param {Object} config Configuration options
+ * @xtype menuseparator
+ */
+Ext.menu.Separator = function(config){
+    Ext.menu.Separator.superclass.constructor.call(this, config);
+};
+
+Ext.extend(Ext.menu.Separator, Ext.menu.BaseItem, {
+    /**
+     * @cfg {String} itemCls The default CSS class to use for separators (defaults to "x-menu-sep")
+     */
+    itemCls : "x-menu-sep",
+    /**
+     * @cfg {Boolean} hideOnClick True to hide the containing menu after this item is clicked (defaults to false)
+     */
+    hideOnClick : false,
+    
+    /** 
+     * @cfg {String} activeClass
+     * @hide 
+     */
+    activeClass: '',
+
+    // private
+    onRender : function(li){
+        var s = document.createElement("span");
+        s.className = this.itemCls;
+        s.innerHTML = "&#160;";
+        this.el = s;
+        li.addClass("x-menu-sep-li");
+        Ext.menu.Separator.superclass.onRender.apply(this, arguments);
+    }
+});
+Ext.reg('menuseparator', Ext.menu.Separator);/**\r
+ * @class Ext.menu.Item\r
+ * @extends Ext.menu.BaseItem\r
+ * A base class for all menu items that require menu-related functionality (like sub-menus) and are not static\r
+ * display items.  Item extends the base functionality of {@link Ext.menu.BaseItem} by adding menu-specific\r
+ * activation and click handling.\r
+ * @constructor\r
+ * Creates a new Item\r
+ * @param {Object} config Configuration options\r
+ * @xtype menuitem\r
+ */\r
+Ext.menu.Item = function(config){\r
+    Ext.menu.Item.superclass.constructor.call(this, config);\r
+    if(this.menu){\r
+        this.menu = Ext.menu.MenuMgr.get(this.menu);\r
+    }\r
+};\r
+Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, {\r
+    /**\r
+     * @property menu\r
+     * @type Ext.menu.Menu\r
+     * The submenu associated with this Item if one was configured.\r
+     */\r
+    /**\r
+     * @cfg {Mixed} menu (optional) Either an instance of {@link Ext.menu.Menu} or the config object for an\r
+     * {@link Ext.menu.Menu} which acts as the submenu when this item is activated.\r
+     */\r
+    /**\r
+     * @cfg {String} icon The path to an icon to display in this item (defaults to Ext.BLANK_IMAGE_URL).  If\r
+     * icon is specified {@link #iconCls} should not be.\r
+     */\r
+    /**\r
+     * @cfg {String} iconCls A CSS class that specifies a background image that will be used as the icon for\r
+     * this item (defaults to '').  If iconCls is specified {@link #icon} should not be.\r
+     */\r
+    /**\r
+     * @cfg {String} text The text to display in this item (defaults to '').\r
+     */\r
+    /**\r
+     * @cfg {String} href The href attribute to use for the underlying anchor link (defaults to '#').\r
+     */\r
+    /**\r
+     * @cfg {String} hrefTarget The target attribute to use for the underlying anchor link (defaults to '').\r
+     */\r
+    /**\r
+     * @cfg {String} itemCls The default CSS class to use for menu items (defaults to 'x-menu-item')\r
+     */\r
+    itemCls : 'x-menu-item',\r
+    /**\r
+     * @cfg {Boolean} canActivate True if this item can be visually activated (defaults to true)\r
+     */\r
+    canActivate : true,\r
+    /**\r
+     * @cfg {Number} showDelay Length of time in milliseconds to wait before showing this item (defaults to 200)\r
+     */\r
+    showDelay: 200,\r
+    // doc'd in BaseItem\r
+    hideDelay: 200,\r
 \r
-        this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {\r
-            "up" : function(e){\r
-                if(!e.shiftKey || this.singleSelect){\r
-                    this.selectPrevious(false);\r
-                }else if(this.last !== false && this.lastActive !== false){\r
-                    var last = this.last;\r
-                    this.selectRange(this.last,  this.lastActive-1);\r
-                    this.grid.getView().focusRow(this.lastActive);\r
-                    if(last !== false){\r
-                        this.last = last;\r
-                    }\r
-                }else{\r
-                    this.selectFirstRow();\r
-                }\r
-            },\r
-            "down" : function(e){\r
-                if(!e.shiftKey || this.singleSelect){\r
-                    this.selectNext(false);\r
-                }else if(this.last !== false && this.lastActive !== false){\r
-                    var last = this.last;\r
-                    this.selectRange(this.last,  this.lastActive+1);\r
-                    this.grid.getView().focusRow(this.lastActive);\r
-                    if(last !== false){\r
-                        this.last = last;\r
-                    }\r
-                }else{\r
-                    this.selectFirstRow();\r
-                }\r
-            },\r
-            scope: this\r
-        });\r
+    // private\r
+    ctype: 'Ext.menu.Item',\r
+\r
+    // private\r
+    onRender : function(container, position){\r
+        if (!this.itemTpl) {\r
+            this.itemTpl = Ext.menu.Item.prototype.itemTpl = new Ext.XTemplate(\r
+                '<a id="{id}" class="{cls}" hidefocus="true" unselectable="on" href="{href}"',\r
+                    '<tpl if="hrefTarget">',\r
+                        ' target="{hrefTarget}"',\r
+                    '</tpl>',\r
+                 '>',\r
+                     '<img src="{icon}" class="x-menu-item-icon {iconCls}"/>',\r
+                     '<span class="x-menu-item-text">{text}</span>',\r
+                 '</a>'\r
+             );\r
+        }\r
+        var a = this.getTemplateArgs();\r
+        this.el = position ? this.itemTpl.insertBefore(position, a, true) : this.itemTpl.append(container, a, true);\r
+        this.iconEl = this.el.child('img.x-menu-item-icon');\r
+        this.textEl = this.el.child('.x-menu-item-text');\r
+        Ext.menu.Item.superclass.onRender.call(this, container, position);\r
+    },\r
 \r
-        var view = this.grid.view;\r
-        view.on("refresh", this.onRefresh, this);\r
-        view.on("rowupdated", this.onRowUpdated, this);\r
-        view.on("rowremoved", this.onRemove, this);\r
+    getTemplateArgs: function() {\r
+        return {\r
+            id: this.id,\r
+            cls: this.itemCls + (this.menu ?  ' x-menu-item-arrow' : '') + (this.cls ?  ' ' + this.cls : ''),\r
+            href: this.href || '#',\r
+            hrefTarget: this.hrefTarget,\r
+            icon: this.icon || Ext.BLANK_IMAGE_URL,\r
+            iconCls: this.iconCls || '',\r
+            text: this.itemText||this.text||'&#160;'\r
+        };\r
     },\r
 \r
-    // private\r
-    onRefresh : function(){\r
-        var ds = this.grid.store, index;\r
-        var s = this.getSelections();\r
-        this.clearSelections(true);\r
-        for(var i = 0, len = s.length; i < len; i++){\r
-            var r = s[i];\r
-            if((index = ds.indexOfId(r.id)) != -1){\r
-                this.selectRow(index, true);\r
-            }\r
+    /**\r
+     * Sets the text to display in this menu item\r
+     * @param {String} text The text to display\r
+     */\r
+    setText : function(text){\r
+        this.text = text||'&#160;';\r
+        if(this.rendered){\r
+            this.textEl.update(this.text);\r
+            this.parentMenu.layout.doAutoSize();\r
+        }\r
+    },\r
+\r
+    /**\r
+     * Sets the CSS class to apply to the item's icon element\r
+     * @param {String} cls The CSS class to apply\r
+     */\r
+    setIconClass : function(cls){\r
+        var oldCls = this.iconCls;\r
+        this.iconCls = cls;\r
+        if(this.rendered){\r
+            this.iconEl.replaceClass(oldCls, this.iconCls);\r
         }\r
-        if(s.length != this.selections.getCount()){\r
-            this.fireEvent("selectionchange", this);\r
+    },\r
+    \r
+    //private\r
+    beforeDestroy: function(){\r
+        if (this.menu){\r
+            this.menu.destroy();\r
         }\r
+        Ext.menu.Item.superclass.beforeDestroy.call(this);\r
     },\r
 \r
     // private\r
-    onRemove : function(v, index, r){\r
-        if(this.selections.remove(r) !== false){\r
-            this.fireEvent('selectionchange', this);\r
+    handleClick : function(e){\r
+        if(!this.href){ // if no link defined, stop the event automatically\r
+            e.stopEvent();\r
         }\r
+        Ext.menu.Item.superclass.handleClick.apply(this, arguments);\r
     },\r
 \r
     // private\r
-    onRowUpdated : function(v, index, r){\r
-        if(this.isSelected(r)){\r
-            v.onRowSelect(index);\r
+    activate : function(autoExpand){\r
+        if(Ext.menu.Item.superclass.activate.apply(this, arguments)){\r
+            this.focus();\r
+            if(autoExpand){\r
+                this.expandMenu();\r
+            }\r
         }\r
+        return true;\r
     },\r
 \r
-    \r
-    selectRecords : function(records, keepExisting){\r
-        if(!keepExisting){\r
-            this.clearSelections();\r
-        }\r
-        var ds = this.grid.store;\r
-        for(var i = 0, len = records.length; i < len; i++){\r
-            this.selectRow(ds.indexOf(records[i]), true);\r
+    // private\r
+    shouldDeactivate : function(e){\r
+        if(Ext.menu.Item.superclass.shouldDeactivate.call(this, e)){\r
+            if(this.menu && this.menu.isVisible()){\r
+                return !this.menu.getEl().getRegion().contains(e.getPoint());\r
+            }\r
+            return true;\r
         }\r
+        return false;\r
     },\r
 \r
-    \r
-    getCount : function(){\r
-        return this.selections.length;\r
+    // private\r
+    deactivate : function(){\r
+        Ext.menu.Item.superclass.deactivate.apply(this, arguments);\r
+        this.hideMenu();\r
     },\r
 \r
-    \r
-    selectFirstRow : function(){\r
-        this.selectRow(0);\r
+    // private\r
+    expandMenu : function(autoActivate){\r
+        if(!this.disabled && this.menu){\r
+            clearTimeout(this.hideTimer);\r
+            delete this.hideTimer;\r
+            if(!this.menu.isVisible() && !this.showTimer){\r
+                this.showTimer = this.deferExpand.defer(this.showDelay, this, [autoActivate]);\r
+            }else if (this.menu.isVisible() && autoActivate){\r
+                this.menu.tryActivate(0, 1);\r
+            }\r
+        }\r
     },\r
 \r
-    \r
-    selectLastRow : function(keepExisting){\r
-        this.selectRow(this.grid.store.getCount() - 1, keepExisting);\r
+    // private\r
+    deferExpand : function(autoActivate){\r
+        delete this.showTimer;\r
+        this.menu.show(this.container, this.parentMenu.subMenuAlign || 'tl-tr?', this.parentMenu);\r
+        if(autoActivate){\r
+            this.menu.tryActivate(0, 1);\r
+        }\r
     },\r
 \r
-    \r
-    selectNext : function(keepExisting){\r
-        if(this.hasNext()){\r
-            this.selectRow(this.last+1, keepExisting);\r
-            this.grid.getView().focusRow(this.last);\r
-                       return true;\r
+    // private\r
+    hideMenu : function(){\r
+        clearTimeout(this.showTimer);\r
+        delete this.showTimer;\r
+        if(!this.hideTimer && this.menu && this.menu.isVisible()){\r
+            this.hideTimer = this.deferHide.defer(this.hideDelay, this);\r
         }\r
-               return false;\r
     },\r
 \r
-    \r
-    selectPrevious : function(keepExisting){\r
-        if(this.hasPrevious()){\r
-            this.selectRow(this.last-1, keepExisting);\r
-            this.grid.getView().focusRow(this.last);\r
-                       return true;\r
+    // private\r
+    deferHide : function(){\r
+        delete this.hideTimer;\r
+        if(this.menu.over){\r
+            this.parentMenu.setActiveItem(this, false);\r
+        }else{\r
+            this.menu.hide();\r
         }\r
-               return false;\r
-    },\r
+    }\r
+});\r
+Ext.reg('menuitem', Ext.menu.Item);/**
+ * @class Ext.menu.CheckItem
+ * @extends Ext.menu.Item
+ * Adds a menu item that contains a checkbox by default, but can also be part of a radio group.
+ * @constructor
+ * Creates a new CheckItem
+ * @param {Object} config Configuration options
+ * @xtype menucheckitem
+ */
+Ext.menu.CheckItem = function(config){
+    Ext.menu.CheckItem.superclass.constructor.call(this, config);
+    this.addEvents(
+        /**
+         * @event beforecheckchange
+         * Fires before the checked value is set, providing an opportunity to cancel if needed
+         * @param {Ext.menu.CheckItem} this
+         * @param {Boolean} checked The new checked value that will be set
+         */
+        "beforecheckchange" ,
+        /**
+         * @event checkchange
+         * Fires after the checked value has been set
+         * @param {Ext.menu.CheckItem} this
+         * @param {Boolean} checked The checked value that was set
+         */
+        "checkchange"
+    );
+    /**
+     * A function that handles the checkchange event.  The function is undefined by default, but if an implementation
+     * is provided, it will be called automatically when the checkchange event fires.
+     * @param {Ext.menu.CheckItem} this
+     * @param {Boolean} checked The checked value that was set
+     * @method checkHandler
+     */
+    if(this.checkHandler){
+        this.on('checkchange', this.checkHandler, this.scope);
+    }
+    Ext.menu.MenuMgr.registerCheckable(this);
+};
+Ext.extend(Ext.menu.CheckItem, Ext.menu.Item, {
+    /**
+     * @cfg {String} group
+     * All check items with the same group name will automatically be grouped into a single-select
+     * radio button group (defaults to '')
+     */
+    /**
+     * @cfg {String} itemCls The default CSS class to use for check items (defaults to "x-menu-item x-menu-check-item")
+     */
+    itemCls : "x-menu-item x-menu-check-item",
+    /**
+     * @cfg {String} groupClass The default CSS class to use for radio group check items (defaults to "x-menu-group-item")
+     */
+    groupClass : "x-menu-group-item",
+
+    /**
+     * @cfg {Boolean} checked True to initialize this checkbox as checked (defaults to false).  Note that
+     * if this checkbox is part of a radio group (group = true) only the last item in the group that is
+     * initialized with checked = true will be rendered as checked.
+     */
+    checked: false,
+
+    // private
+    ctype: "Ext.menu.CheckItem",
+
+    // private
+    onRender : function(c){
+        Ext.menu.CheckItem.superclass.onRender.apply(this, arguments);
+        if(this.group){
+            this.el.addClass(this.groupClass);
+        }
+        if(this.checked){
+            this.checked = false;
+            this.setChecked(true, true);
+        }
+    },
+
+    // private
+    destroy : function(){
+        Ext.menu.MenuMgr.unregisterCheckable(this);
+        Ext.menu.CheckItem.superclass.destroy.apply(this, arguments);
+    },
+
+    /**
+     * Set the checked state of this item
+     * @param {Boolean} checked The new checked value
+     * @param {Boolean} suppressEvent (optional) True to prevent the checkchange event from firing (defaults to false)
+     */
+    setChecked : function(state, suppressEvent){
+        if(this.checked != state && this.fireEvent("beforecheckchange", this, state) !== false){
+            if(this.container){
+                this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
+            }
+            this.checked = state;
+            if(suppressEvent !== true){
+                this.fireEvent("checkchange", this, state);
+            }
+        }
+    },
+
+    // private
+    handleClick : function(e){
+       if(!this.disabled && !(this.checked && this.group)){// disable unselect on radio item
+           this.setChecked(!this.checked);
+       }
+       Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments);
+    }
+});
+Ext.reg('menucheckitem', Ext.menu.CheckItem);/**\r
+ * @class Ext.menu.DateMenu\r
+ * @extends Ext.menu.Menu\r
+ * A menu containing a {@link Ext.DatePicker} Component.\r
+ * @xtype datemenu\r
+ */\r
+ Ext.menu.DateMenu = Ext.extend(Ext.menu.Menu, {\r
+    /** \r
+     * @cfg {Boolean} enableScrolling\r
+     * @hide \r
+     */\r
+    enableScrolling: false,\r
+    \r
+    /** \r
+     * @cfg {Boolean} hideOnClick\r
+     * False to continue showing the menu after a date is selected, defaults to true.\r
+     */\r
+    hideOnClick: true,\r
+    \r
+    /** \r
+     * @cfg {Number} maxHeight\r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Number} scrollIncrement\r
+     * @hide \r
+     */\r
+    /**\r
+     * @property picker\r
+     * @type DatePicker\r
+     * The {@link Ext.DatePicker} instance for this DateMenu\r
+     */\r
+    cls: 'x-date-menu',\r
+    \r
+    /**\r
+     * @event click\r
+     * @hide\r
+     */\r
+    \r
+    /**\r
+     * @event itemclick\r
+     * @hide\r
+     */\r
 \r
-    \r
-    hasNext : function(){\r
-        return this.last !== false && (this.last+1) < this.grid.store.getCount();\r
+    initComponent: function(){\r
+        this.on('beforeshow', this.onBeforeShow, this);\r
+        if(this.strict = (Ext.isIE7 && Ext.isStrict)){\r
+            this.on('show', this.onShow, this, {single: true, delay: 20});\r
+        }\r
+        Ext.apply(this, {\r
+            plain: true,\r
+            showSeparator: false,\r
+            items: this.picker = new Ext.DatePicker(Ext.apply({\r
+                internalRender: this.strict || !Ext.isIE,\r
+                ctCls: 'x-menu-date-item'\r
+            }, this.initialConfig))\r
+        });\r
+        this.picker.purgeListeners();\r
+        Ext.menu.DateMenu.superclass.initComponent.call(this);\r
+        this.relayEvents(this.picker, ["select"]);\r
+        this.on('select', this.menuHide, this);\r
+        if(this.handler){\r
+            this.on('select', this.handler, this.scope || this);\r
+        }\r
     },\r
 \r
-    \r
-    hasPrevious : function(){\r
-        return !!this.last;\r
+    menuHide: function() {\r
+        if(this.hideOnClick){\r
+            this.hide(true);\r
+        }\r
     },\r
 \r
-\r
-    \r
-    getSelections : function(){\r
-        return [].concat(this.selections.items);\r
+    onBeforeShow: function(){\r
+        if(this.picker){\r
+            this.picker.hideMonthPicker(true);\r
+        }\r
     },\r
 \r
+    onShow: function(){\r
+        var el = this.picker.getEl();\r
+        el.setWidth(el.getWidth()); //nasty hack for IE7 strict mode\r
+    }\r
+ });\r
+ Ext.reg('datemenu', Ext.menu.DateMenu);/**\r
+ * @class Ext.menu.ColorMenu\r
+ * @extends Ext.menu.Menu\r
+ * A menu containing a {@link Ext.ColorPalette} Component.\r
+ * @xtype colormenu\r
+ */\r
+ Ext.menu.ColorMenu = Ext.extend(Ext.menu.Menu, {\r
+    /** \r
+     * @cfg {Boolean} enableScrolling\r
+     * @hide \r
+     */\r
+    enableScrolling: false,\r
+    \r
+    /** \r
+     * @cfg {Boolean} hideOnClick\r
+     * False to continue showing the menu after a color is selected, defaults to true.\r
+     */\r
+    hideOnClick: true,\r
+    \r
+    /** \r
+     * @cfg {Number} maxHeight\r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Number} scrollIncrement\r
+     * @hide \r
+     */\r
+    /**\r
+     * @property palette\r
+     * @type ColorPalette\r
+     * The {@link Ext.ColorPalette} instance for this ColorMenu\r
+     */\r
+    \r
+    \r
+    /**\r
+     * @event click\r
+     * @hide\r
+     */\r
+    \r
+    /**\r
+     * @event itemclick\r
+     * @hide\r
+     */\r
     \r
-    getSelected : function(){\r
-        return this.selections.itemAt(0);\r
+    initComponent: function(){\r
+        Ext.apply(this, {\r
+            plain: true,\r
+            showSeparator: false,\r
+            items: this.palette = new Ext.ColorPalette(this.initialConfig)\r
+        });\r
+        this.palette.purgeListeners();\r
+        Ext.menu.ColorMenu.superclass.initComponent.call(this);\r
+        this.relayEvents(this.palette, ['select']);\r
+        this.on('select', this.menuHide, this);\r
+        if(this.handler){\r
+            this.on('select', this.handler, this.scope || this)\r
+        }\r
     },\r
 \r
-    \r
-    each : function(fn, scope){\r
-        var s = this.getSelections();\r
-        for(var i = 0, len = s.length; i < len; i++){\r
-            if(fn.call(scope || this, s[i], i) === false){\r
-                return false;\r
-            }\r
+    menuHide: function(){\r
+        if(this.hideOnClick){\r
+            this.hide(true);\r
         }\r
+    }\r
+});\r
+Ext.reg('colormenu', Ext.menu.ColorMenu);/**
+ * @class Ext.form.Field
+ * @extends Ext.BoxComponent
+ * Base class for form fields that provides default event handling, sizing, value handling and other functionality.
+ * @constructor
+ * Creates a new Field
+ * @param {Object} config Configuration options
+ * @xtype field
+ */
+Ext.form.Field = Ext.extend(Ext.BoxComponent,  {
+    /**
+     * @cfg {String} inputType The type attribute for input fields -- e.g. radio, text, password, file (defaults
+     * to "text"). The types "file" and "password" must be used to render those field types currently -- there are
+     * no separate Ext components for those. Note that if you use <tt>inputType:'file'</tt>, {@link #emptyText}
+     * is not supported and should be avoided.
+     */
+    /**
+     * @cfg {Number} tabIndex The tabIndex for this field. Note this only applies to fields that are rendered,
+     * not those which are built via applyTo (defaults to undefined).
+     */
+    /**
+     * @cfg {Mixed} value A value to initialize this field with (defaults to undefined).
+     */
+    /**
+     * @cfg {String} name The field's HTML name attribute (defaults to "").
+     * <b>Note</b>: this property must be set if this field is to be automatically included with
+     * {@link Ext.form.BasicForm#submit form submit()}.
+     */
+    /**
+     * @cfg {String} cls A custom CSS class to apply to the field's underlying element (defaults to "").
+     */
+
+    /**
+     * @cfg {String} invalidClass The CSS class to use when marking a field invalid (defaults to "x-form-invalid")
+     */
+    invalidClass : "x-form-invalid",
+    /**
+     * @cfg {String} invalidText The error text to use when marking a field invalid and no message is provided
+     * (defaults to "The value in this field is invalid")
+     */
+    invalidText : "The value in this field is invalid",
+    /**
+     * @cfg {String} focusClass The CSS class to use when the field receives focus (defaults to "x-form-focus")
+     */
+    focusClass : "x-form-focus",
+    /**
+     * @cfg {String/Boolean} validationEvent The event that should initiate field validation. Set to false to disable
+      automatic validation (defaults to "keyup").
+     */
+    validationEvent : "keyup",
+    /**
+     * @cfg {Boolean} validateOnBlur Whether the field should validate when it loses focus (defaults to true).
+     */
+    validateOnBlur : true,
+    /**
+     * @cfg {Number} validationDelay The length of time in milliseconds after user input begins until validation
+     * is initiated (defaults to 250)
+     */
+    validationDelay : 250,
+    /**
+     * @cfg {String/Object} autoCreate <p>A {@link Ext.DomHelper DomHelper} element spec, or true for a default
+     * element spec. Used to create the {@link Ext.Component#getEl Element} which will encapsulate this Component.
+     * See <tt>{@link Ext.Component#autoEl autoEl}</tt> for details.  Defaults to:</p>
+     * <pre><code>{tag: "input", type: "text", size: "20", autocomplete: "off"}</code></pre>
+     */
+    defaultAutoCreate : {tag: "input", type: "text", size: "20", autocomplete: "off"},
+    /**
+     * @cfg {String} fieldClass The default CSS class for the field (defaults to "x-form-field")
+     */
+    fieldClass : "x-form-field",
+    /**
+     * @cfg {String} msgTarget The location where error text should display.  Should be one of the following values
+     * (defaults to 'qtip'):
+     *<pre>
+Value         Description
+-----------   ----------------------------------------------------------------------
+qtip          Display a quick tip when the user hovers over the field
+title         Display a default browser title attribute popup
+under         Add a block div beneath the field containing the error text
+side          Add an error icon to the right of the field with a popup on hover
+[element id]  Add the error text directly to the innerHTML of the specified element
+</pre>
+     */
+    msgTarget : 'qtip',
+    /**
+     * @cfg {String} msgFx <b>Experimental</b> The effect used when displaying a validation message under the field
+     * (defaults to 'normal').
+     */
+    msgFx : 'normal',
+    /**
+     * @cfg {Boolean} readOnly <tt>true</tt> to mark the field as readOnly in HTML
+     * (defaults to <tt>false</tt>).
+     * <br><p><b>Note</b>: this only sets the element's readOnly DOM attribute.
+     * Setting <code>readOnly=true</code>, for example, will not disable triggering a
+     * ComboBox or DateField; it gives you the option of forcing the user to choose
+     * via the trigger without typing in the text box. To hide the trigger use
+     * <code>{@link Ext.form.TriggerField#hideTrigger hideTrigger}</code>.</p>
+     */
+    readOnly : false,
+    /**
+     * @cfg {Boolean} disabled True to disable the field (defaults to false).
+     * <p>Be aware that conformant with the <a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.12.1">HTML specification</a>,
+     * disabled Fields will not be {@link Ext.form.BasicForm#submit submitted}.</p>
+     */
+    disabled : false,
+
+    // private
+    isFormField : true,
+
+    // private
+    hasFocus : false,
+
+    // private
+    initComponent : function(){
+        Ext.form.Field.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event focus
+             * Fires when this field receives input focus.
+             * @param {Ext.form.Field} this
+             */
+            'focus',
+            /**
+             * @event blur
+             * Fires when this field loses input focus.
+             * @param {Ext.form.Field} this
+             */
+            'blur',
+            /**
+             * @event specialkey
+             * Fires when any key related to navigation (arrows, tab, enter, esc, etc.) is pressed.
+             * To handle other keys see {@link Ext.Panel#keys} or {@link Ext.KeyMap}.
+             * You can check {@link Ext.EventObject#getKey} to determine which key was pressed.
+             * For example: <pre><code>
+var form = new Ext.form.FormPanel({
+    ...
+    items: [{
+            fieldLabel: 'Field 1',
+            name: 'field1',
+            allowBlank: false
+        },{
+            fieldLabel: 'Field 2',
+            name: 'field2',
+            listeners: {
+                specialkey: function(field, e){
+                    // e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN,
+                    // e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN
+                    if (e.{@link Ext.EventObject#getKey getKey()} == e.ENTER) {
+                        var form = field.ownerCt.getForm();
+                        form.submit();
+                    }
+                }
+            }
+        }
+    ],
+    ...
+});
+             * </code></pre>
+             * @param {Ext.form.Field} this
+             * @param {Ext.EventObject} e The event object
+             */
+            'specialkey',
+            /**
+             * @event change
+             * Fires just before the field blurs if the field value has changed.
+             * @param {Ext.form.Field} this
+             * @param {Mixed} newValue The new value
+             * @param {Mixed} oldValue The original value
+             */
+            'change',
+            /**
+             * @event invalid
+             * Fires after the field has been marked as invalid.
+             * @param {Ext.form.Field} this
+             * @param {String} msg The validation message
+             */
+            'invalid',
+            /**
+             * @event valid
+             * Fires after the field has been validated with no errors.
+             * @param {Ext.form.Field} this
+             */
+            'valid'
+        );
+    },
+
+    /**
+     * Returns the {@link Ext.form.Field#name name} or {@link Ext.form.ComboBox#hiddenName hiddenName}
+     * attribute of the field if available.
+     * @return {String} name The field {@link Ext.form.Field#name name} or {@link Ext.form.ComboBox#hiddenName hiddenName}  
+     */
+    getName: function(){
+        return this.rendered && this.el.dom.name ? this.el.dom.name : this.name || this.id || '';
+    },
+
+    // private
+    onRender : function(ct, position){
+        if(!this.el){
+            var cfg = this.getAutoCreate();
+
+            if(!cfg.name){
+                cfg.name = this.name || this.id;
+            }
+            if(this.inputType){
+                cfg.type = this.inputType;
+            }
+            this.autoEl = cfg;
+        }
+        Ext.form.Field.superclass.onRender.call(this, ct, position);
+        
+        var type = this.el.dom.type;
+        if(type){
+            if(type == 'password'){
+                type = 'text';
+            }
+            this.el.addClass('x-form-'+type);
+        }
+        if(this.readOnly){
+            this.el.dom.readOnly = true;
+        }
+        if(this.tabIndex !== undefined){
+            this.el.dom.setAttribute('tabIndex', this.tabIndex);
+        }
+
+        this.el.addClass([this.fieldClass, this.cls]);
+    },
+
+    // private
+    getItemCt : function(){
+        return this.el.up('.x-form-item', 4);
+    },
+
+    // private
+    initValue : function(){
+        if(this.value !== undefined){
+            this.setValue(this.value);
+        }else if(!Ext.isEmpty(this.el.dom.value) && this.el.dom.value != this.emptyText){
+            this.setValue(this.el.dom.value);
+        }
+        /**
+         * The original value of the field as configured in the {@link #value} configuration, or
+         * as loaded by the last form load operation if the form's {@link Ext.form.BasicForm#trackResetOnLoad trackResetOnLoad}
+         * setting is <code>true</code>.
+         * @type mixed
+         * @property originalValue
+         */
+        this.originalValue = this.getValue();
+    },
+
+    /**
+     * <p>Returns true if the value of this Field has been changed from its original value.
+     * Will return false if the field is disabled or has not been rendered yet.</p>
+     * <p>Note that if the owning {@link Ext.form.BasicForm form} was configured with
+     * {@link Ext.form.BasicForm}.{@link Ext.form.BasicForm#trackResetOnLoad trackResetOnLoad}
+     * then the <i>original value</i> is updated when the values are loaded by
+     * {@link Ext.form.BasicForm}.{@link Ext.form.BasicForm#setValues setValues}.</p>
+     * @return {Boolean} True if this field has been changed from its original value (and
+     * is not disabled), false otherwise.
+     */
+    isDirty : function() {
+        if(this.disabled || !this.rendered) {
+            return false;
+        }
+        return String(this.getValue()) !== String(this.originalValue);
+    },
+
+    // private
+    afterRender : function(){
+        Ext.form.Field.superclass.afterRender.call(this);
+        this.initEvents();
+        this.initValue();
+    },
+
+    // private
+    fireKey : function(e){
+        if(e.isSpecialKey()){
+            this.fireEvent("specialkey", this, e);
+        }
+    },
+
+    /**
+     * Resets the current field value to the originally loaded value and clears any validation messages.
+     * See {@link Ext.form.BasicForm}.{@link Ext.form.BasicForm#trackResetOnLoad trackResetOnLoad}
+     */
+    reset : function(){
+        this.setValue(this.originalValue);
+        this.clearInvalid();
+    },
+
+    // private
+    initEvents : function(){
+        this.mon(this.el, Ext.EventManager.useKeydown ? "keydown" : "keypress", this.fireKey,  this);
+        this.mon(this.el, 'focus', this.onFocus, this);
+
+        // fix weird FF/Win editor issue when changing OS window focus
+        var o = this.inEditor && Ext.isWindows && Ext.isGecko ? {buffer:10} : null;
+        this.mon(this.el, 'blur', this.onBlur, this, o);
+    },
+
+    // private
+    onFocus : function(){
+        if(this.focusClass){
+            this.el.addClass(this.focusClass);
+        }
+        if(!this.hasFocus){
+            this.hasFocus = true;
+            this.startValue = this.getValue();
+            this.fireEvent("focus", this);
+        }
+    },
+
+    // private
+    beforeBlur : Ext.emptyFn,
+
+    // private
+    onBlur : function(){
+        this.beforeBlur();
+        if(this.focusClass){
+            this.el.removeClass(this.focusClass);
+        }
+        this.hasFocus = false;
+        if(this.validationEvent !== false && this.validateOnBlur && this.validationEvent != "blur"){
+            this.validate();
+        }
+        var v = this.getValue();
+        if(String(v) !== String(this.startValue)){
+            this.fireEvent('change', this, v, this.startValue);
+        }
+        this.fireEvent("blur", this);
+    },
+
+    /**
+     * Returns whether or not the field value is currently valid
+     * @param {Boolean} preventMark True to disable marking the field invalid
+     * @return {Boolean} True if the value is valid, else false
+     */
+    isValid : function(preventMark){
+        if(this.disabled){
+            return true;
+        }
+        var restore = this.preventMark;
+        this.preventMark = preventMark === true;
+        var v = this.validateValue(this.processValue(this.getRawValue()));
+        this.preventMark = restore;
+        return v;
+    },
+
+    /**
+     * Validates the field value
+     * @return {Boolean} True if the value is valid, else false
+     */
+    validate : function(){
+        if(this.disabled || this.validateValue(this.processValue(this.getRawValue()))){
+            this.clearInvalid();
+            return true;
+        }
+        return false;
+    },
+
+    // protected - should be overridden by subclasses if necessary to prepare raw values for validation
+    processValue : function(value){
+        return value;
+    },
+
+    // private
+    // Subclasses should provide the validation implementation by overriding this
+    validateValue : function(value){
+        return true;
+    },
+
+    /**
+     * Mark this field as invalid, using {@link #msgTarget} to determine how to display the error and
+     * applying {@link #invalidClass} to the field's element.
+     * @param {String} msg (optional) The validation message (defaults to {@link #invalidText})
+     */
+    markInvalid : function(msg){
+        if(!this.rendered || this.preventMark){ // not rendered
+            return;
+        }
+        msg = msg || this.invalidText;
+
+        var mt = this.getMessageHandler();
+        if(mt){
+            mt.mark(this, msg);
+        }else if(this.msgTarget){
+            this.el.addClass(this.invalidClass);
+            var t = Ext.getDom(this.msgTarget);
+            if(t){
+                t.innerHTML = msg;
+                t.style.display = this.msgDisplay;
+            }
+        }
+        this.fireEvent('invalid', this, msg);
+    },
+
+    /**
+     * Clear any invalid styles/messages for this field
+     */
+    clearInvalid : function(){
+        if(!this.rendered || this.preventMark){ // not rendered
+            return;
+        }
+        this.el.removeClass(this.invalidClass);
+        var mt = this.getMessageHandler();
+        if(mt){
+            mt.clear(this);
+        }else if(this.msgTarget){
+            this.el.removeClass(this.invalidClass);
+            var t = Ext.getDom(this.msgTarget);
+            if(t){
+                t.innerHTML = '';
+                t.style.display = 'none';
+            }
+        }
+        this.fireEvent('valid', this);
+    },
+
+    // private
+    getMessageHandler : function(){
+        return Ext.form.MessageTargets[this.msgTarget];
+    },
+
+    // private
+    getErrorCt : function(){
+        return this.el.findParent('.x-form-element', 5, true) || // use form element wrap if available
+            this.el.findParent('.x-form-field-wrap', 5, true);   // else direct field wrap
+    },
+
+    // private
+    alignErrorIcon : function(){
+        this.errorIcon.alignTo(this.el, 'tl-tr', [2, 0]);
+    },
+
+    /**
+     * Returns the raw data value which may or may not be a valid, defined value.  To return a normalized value see {@link #getValue}.
+     * @return {Mixed} value The field value
+     */
+    getRawValue : function(){
+        var v = this.rendered ? this.el.getValue() : Ext.value(this.value, '');
+        if(v === this.emptyText){
+            v = '';
+        }
+        return v;
+    },
+
+    /**
+     * Returns the normalized data value (undefined or emptyText will be returned as '').  To return the raw value see {@link #getRawValue}.
+     * @return {Mixed} value The field value
+     */
+    getValue : function(){
+        if(!this.rendered) {
+            return this.value;
+        }
+        var v = this.el.getValue();
+        if(v === this.emptyText || v === undefined){
+            v = '';
+        }
+        return v;
+    },
+
+    /**
+     * Sets the underlying DOM field's value directly, bypassing validation.  To set the value with validation see {@link #setValue}.
+     * @param {Mixed} value The value to set
+     * @return {Mixed} value The field value that is set
+     */
+    setRawValue : function(v){
+        return (this.el.dom.value = (Ext.isEmpty(v) ? '' : v));
+    },
+
+    /**
+     * Sets a data value into the field and validates it.  To set the value directly without validation see {@link #setRawValue}.
+     * @param {Mixed} value The value to set
+     * @return {Ext.form.Field} this
+     */
+    setValue : function(v){
+        this.value = v;
+        if(this.rendered){
+            this.el.dom.value = (Ext.isEmpty(v) ? '' : v);
+            this.validate();
+        }
+        return this;
+    },
+
+    // private, does not work for all fields
+    append : function(v){
+         this.setValue([this.getValue(), v].join(''));
+    },
+
+    // private
+    adjustSize : function(w, h){
+        var s = Ext.form.Field.superclass.adjustSize.call(this, w, h);
+        s.width = this.adjustWidth(this.el.dom.tagName, s.width);
+        if(this.offsetCt){
+            var ct = this.getItemCt();
+            s.width -= ct.getFrameWidth('lr');
+            s.height -= ct.getFrameWidth('tb');
+        }
+        return s;
+    },
+
+    // private
+    adjustWidth : function(tag, w){
+        if(typeof w == 'number' && (Ext.isIE && (Ext.isIE6 || !Ext.isStrict)) && /input|textarea/i.test(tag) && !this.inEditor){
+            return w - 3;
+        }
+        return w;
+    }
+
+    /**
+     * @cfg {Boolean} autoWidth @hide
+     */
+    /**
+     * @cfg {Boolean} autoHeight @hide
+     */
+
+    /**
+     * @cfg {String} autoEl @hide
+     */
+});
+
+
+Ext.form.MessageTargets = {
+    'qtip' : {
+        mark: function(field, msg){
+            field.el.addClass(field.invalidClass);
+            field.el.dom.qtip = msg;
+            field.el.dom.qclass = 'x-form-invalid-tip';
+            if(Ext.QuickTips){ // fix for floating editors interacting with DND
+                Ext.QuickTips.enable();
+            }
+        },
+        clear: function(field){
+            field.el.removeClass(field.invalidClass);
+            field.el.dom.qtip = '';
+        }
+    },
+    'title' : {
+        mark: function(field, msg){
+            field.el.addClass(field.invalidClass);
+            field.el.dom.title = msg;
+        },
+        clear: function(field){
+            field.el.dom.title = '';
+        }
+    },
+    'under' : {
+        mark: function(field, msg){
+            field.el.addClass(field.invalidClass);
+            if(!field.errorEl){
+                var elp = field.getErrorCt();
+                if(!elp){ // field has no container el
+                    field.el.dom.title = msg;
+                    return;
+                }
+                field.errorEl = elp.createChild({cls:'x-form-invalid-msg'});
+                field.errorEl.setWidth(elp.getWidth(true)-20);
+            }
+            field.errorEl.update(msg);
+            Ext.form.Field.msgFx[field.msgFx].show(field.errorEl, field);
+        },
+        clear: function(field){
+            field.el.removeClass(field.invalidClass);
+            if(field.errorEl){
+                Ext.form.Field.msgFx[field.msgFx].hide(field.errorEl, field);
+            }else{
+                field.el.dom.title = '';
+            }
+        }
+    },
+    'side' : {
+        mark: function(field, msg){
+            field.el.addClass(field.invalidClass);
+            if(!field.errorIcon){
+                var elp = field.getErrorCt();
+                if(!elp){ // field has no container el
+                    field.el.dom.title = msg;
+                    return;
+                }
+                field.errorIcon = elp.createChild({cls:'x-form-invalid-icon'});
+            }
+            field.alignErrorIcon();
+            field.errorIcon.dom.qtip = msg;
+            field.errorIcon.dom.qclass = 'x-form-invalid-tip';
+            field.errorIcon.show();
+            field.on('resize', field.alignErrorIcon, field);
+        },
+        clear: function(field){
+            field.el.removeClass(field.invalidClass);
+            if(field.errorIcon){
+                field.errorIcon.dom.qtip = '';
+                field.errorIcon.hide();
+                field.un('resize', field.alignErrorIcon, field);
+            }else{
+                field.el.dom.title = '';
+            }
+        }
+    }
+};
+
+// anything other than normal should be considered experimental
+Ext.form.Field.msgFx = {
+    normal : {
+        show: function(msgEl, f){
+            msgEl.setDisplayed('block');
+        },
+
+        hide : function(msgEl, f){
+            msgEl.setDisplayed(false).update('');
+        }
+    },
+
+    slide : {
+        show: function(msgEl, f){
+            msgEl.slideIn('t', {stopFx:true});
+        },
+
+        hide : function(msgEl, f){
+            msgEl.slideOut('t', {stopFx:true,useDisplay:true});
+        }
+    },
+
+    slideRight : {
+        show: function(msgEl, f){
+            msgEl.fixDisplay();
+            msgEl.alignTo(f.el, 'tl-tr');
+            msgEl.slideIn('l', {stopFx:true});
+        },
+
+        hide : function(msgEl, f){
+            msgEl.slideOut('l', {stopFx:true,useDisplay:true});
+        }
+    }
+};
+Ext.reg('field', Ext.form.Field);
+/**
+ * @class Ext.form.TextField
+ * @extends Ext.form.Field
+ * <p>Basic text field.  Can be used as a direct replacement for traditional text inputs,
+ * or as the base class for more sophisticated input controls (like {@link Ext.form.TextArea}
+ * and {@link Ext.form.ComboBox}).</p>
+ * <p><b><u>Validation</u></b></p>
+ * <p>Field validation is processed in a particular order.  If validation fails at any particular
+ * step the validation routine halts.</p>
+ * <div class="mdetail-params"><ul>
+ * <li><b>1. Field specific validator</b>
+ * <div class="sub-desc">
+ * <p>If a field is configured with a <code>{@link Ext.form.TextField#validator validator}</code> function,
+ * it will be passed the current field value.  The <code>{@link Ext.form.TextField#validator validator}</code>
+ * function is expected to return boolean <tt>true</tt> if the value is valid or return a string to
+ * represent the invalid message if invalid.</p>
+ * </div></li>
+ * <li><b>2. Built in Validation</b>
+ * <div class="sub-desc">
+ * <p>Basic validation is affected with the following configuration properties:</p>
+ * <pre>
+ * <u>Validation</u>    <u>Invalid Message</u>
+ * <code>{@link Ext.form.TextField#allowBlank allowBlank}    {@link Ext.form.TextField#emptyText emptyText}</code>
+ * <code>{@link Ext.form.TextField#minLength minLength}     {@link Ext.form.TextField#minLengthText minLengthText}</code>
+ * <code>{@link Ext.form.TextField#maxLength maxLength}     {@link Ext.form.TextField#maxLengthText maxLengthText}</code>
+ * </pre>
+ * </div></li>
+ * <li><b>3. Preconfigured Validation Types (VTypes)</b>
+ * <div class="sub-desc">
+ * <p>Using VTypes offers a convenient way to reuse validation. If a field is configured with a
+ * <code>{@link Ext.form.TextField#vtype vtype}</code>, the corresponding {@link Ext.form.VTypes VTypes}
+ * validation function will be used for validation.  If invalid, either the field's
+ * <code>{@link Ext.form.TextField#vtypeText vtypeText}</code> or the VTypes vtype Text property will be
+ * used for the invalid message.  Keystrokes on the field will be filtered according to the VTypes
+ * vtype Mask property.</p>
+ * </div></li>
+ * <li><b>4. Field specific regex test</b>
+ * <div class="sub-desc">
+ * <p>Each field may also specify a <code>{@link Ext.form.TextField#regex regex}</code> test.
+ * The invalid message for this test is configured with
+ * <code>{@link Ext.form.TextField#regexText regexText}</code>.</p>
+ * </div></li>
+ * <li><b>Alter Validation Behavior</b>
+ * <div class="sub-desc">
+ * <p>Validation behavior for each field can be configured:</p><ul>
+ * <li><code>{@link Ext.form.TextField#invalidText invalidText}</code> : the default validation message to
+ * show if any validation step above does not provide a message when invalid</li>
+ * <li><code>{@link Ext.form.TextField#maskRe maskRe}</code> : filter out keystrokes before any validation occurs</li>
+ * <li><code>{@link Ext.form.TextField#stripCharsRe stripCharsRe}</code> : filter characters after being typed in,
+ * but before being validated</li>
+ * <li><code>{@link Ext.form.Field#invalidClass invalidClass}</code> : alternate style when invalid</li>
+ * <li><code>{@link Ext.form.Field#validateOnBlur validateOnBlur}</code>,
+ * <code>{@link Ext.form.Field#validationDelay validationDelay}</code>, and
+ * <code>{@link Ext.form.Field#validationEvent validationEvent}</code> : modify how/when validation is triggered</li>
+ * </ul>
+ * </div></li>
+ * </ul></div>
+ * @constructor
+ * Creates a new TextField
+ * @param {Object} config Configuration options
+ * @xtype textfield
+ */
+Ext.form.TextField = Ext.extend(Ext.form.Field,  {
+    /**
+     * @cfg {String} vtypeText A custom error message to display in place of the default message provided
+     * for the <b><code>{@link #vtype}</code></b> currently set for this field (defaults to <tt>''</tt>).  <b>Note</b>:
+     * only applies if <b><code>{@link #vtype}</code></b> is set, else ignored.
+     */
+    /**
+     * @cfg {RegExp} stripCharsRe A JavaScript RegExp object used to strip unwanted content from the value
+     * before validation (defaults to <tt>null</tt>).
+     */
+    /**
+     * @cfg {Boolean} grow <tt>true</tt> if this field should automatically grow and shrink to its content
+     * (defaults to <tt>false</tt>)
+     */
+    grow : false,
+    /**
+     * @cfg {Number} growMin The minimum width to allow when <code><b>{@link #grow}</b> = true</code> (defaults
+     * to <tt>30</tt>)
+     */
+    growMin : 30,
+    /**
+     * @cfg {Number} growMax The maximum width to allow when <code><b>{@link #grow}</b> = true</code> (defaults
+     * to <tt>800</tt>)
+     */
+    growMax : 800,
+    /**
+     * @cfg {String} vtype A validation type name as defined in {@link Ext.form.VTypes} (defaults to <tt>null</tt>)
+     */
+    vtype : null,
+    /**
+     * @cfg {RegExp} maskRe An input mask regular expression that will be used to filter keystrokes that do
+     * not match (defaults to <tt>null</tt>)
+     */
+    maskRe : null,
+    /**
+     * @cfg {Boolean} disableKeyFilter Specify <tt>true</tt> to disable input keystroke filtering (defaults
+     * to <tt>false</tt>)
+     */
+    disableKeyFilter : false,
+    /**
+     * @cfg {Boolean} allowBlank Specify <tt>false</tt> to validate that the value's length is > 0 (defaults to
+     * <tt>true</tt>)
+     */
+    allowBlank : true,
+    /**
+     * @cfg {Number} minLength Minimum input field length required (defaults to <tt>0</tt>)
+     */
+    minLength : 0,
+    /**
+     * @cfg {Number} maxLength Maximum input field length allowed by validation (defaults to Number.MAX_VALUE).
+     * This behavior is intended to provide instant feedback to the user by improving usability to allow pasting
+     * and editing or overtyping and back tracking. To restrict the maximum number of characters that can be
+     * entered into the field use <tt><b>{@link Ext.form.Field#autoCreate autoCreate}</b></tt> to add
+     * any attributes you want to a field, for example:<pre><code>
+var myField = new Ext.form.NumberField({
+    id: 'mobile',
+    anchor:'90%',
+    fieldLabel: 'Mobile',
+    maxLength: 16, // for validation
+    autoCreate: {tag: 'input', type: 'text', size: '20', autocomplete: 'off', maxlength: '10'}
+});
+</code></pre>
+     */
+    maxLength : Number.MAX_VALUE,
+    /**
+     * @cfg {String} minLengthText Error text to display if the <b><tt>{@link #minLength minimum length}</tt></b>
+     * validation fails (defaults to <tt>'The minimum length for this field is {minLength}'</tt>)
+     */
+    minLengthText : 'The minimum length for this field is {0}',
+    /**
+     * @cfg {String} maxLengthText Error text to display if the <b><tt>{@link #maxLength maximum length}</tt></b>
+     * validation fails (defaults to <tt>'The maximum length for this field is {maxLength}'</tt>)
+     */
+    maxLengthText : 'The maximum length for this field is {0}',
+    /**
+     * @cfg {Boolean} selectOnFocus <tt>true</tt> to automatically select any existing field text when the field
+     * receives input focus (defaults to <tt>false</tt>)
+     */
+    selectOnFocus : false,
+    /**
+     * @cfg {String} blankText The error text to display if the <b><tt>{@link #allowBlank}</tt></b> validation
+     * fails (defaults to <tt>'This field is required'</tt>)
+     */
+    blankText : 'This field is required',
+    /**
+     * @cfg {Function} validator A custom validation function to be called during field validation
+     * (defaults to <tt>null</tt>). If specified, this function will be called first, allowing the
+     * developer to override the default validation process. This function will be passed the current
+     * field value and expected to return boolean <tt>true</tt> if the value is valid or a string
+     * error message if invalid.
+     */
+    validator : null,
+    /**
+     * @cfg {RegExp} regex A JavaScript RegExp object to be tested against the field value during validation
+     * (defaults to <tt>null</tt>). If the test fails, the field will be marked invalid using
+     * <b><tt>{@link #regexText}</tt></b>.
+     */
+    regex : null,
+    /**
+     * @cfg {String} regexText The error text to display if <b><tt>{@link #regex}</tt></b> is used and the
+     * test fails during validation (defaults to <tt>''</tt>)
+     */
+    regexText : '',
+    /**
+     * @cfg {String} emptyText The default text to place into an empty field (defaults to <tt>null</tt>).
+     * <b>Note</b>: that this value will be submitted to the server if this field is enabled and configured
+     * with a {@link #name}.
+     */
+    emptyText : null,
+    /**
+     * @cfg {String} emptyClass The CSS class to apply to an empty field to style the <b><tt>{@link #emptyText}</tt></b>
+     * (defaults to <tt>'x-form-empty-field'</tt>).  This class is automatically added and removed as needed
+     * depending on the current field value.
+     */
+    emptyClass : 'x-form-empty-field',
+
+    /**
+     * @cfg {Boolean} enableKeyEvents <tt>true</tt> to enable the proxying of key events for the HTML input
+     * field (defaults to <tt>false</tt>)
+     */
+
+    initComponent : function(){
+        Ext.form.TextField.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event autosize
+             * Fires when the <tt><b>{@link #autoSize}</b></tt> function is triggered. The field may or
+             * may not have actually changed size according to the default logic, but this event provides
+             * a hook for the developer to apply additional logic at runtime to resize the field if needed.
+             * @param {Ext.form.Field} this This text field
+             * @param {Number} width The new field width
+             */
+            'autosize',
+
+            /**
+             * @event keydown
+             * Keydown input field event. This event only fires if <tt><b>{@link #enableKeyEvents}</b></tt>
+             * is set to true.
+             * @param {Ext.form.TextField} this This text field
+             * @param {Ext.EventObject} e
+             */
+            'keydown',
+            /**
+             * @event keyup
+             * Keyup input field event. This event only fires if <tt><b>{@link #enableKeyEvents}</b></tt>
+             * is set to true.
+             * @param {Ext.form.TextField} this This text field
+             * @param {Ext.EventObject} e
+             */
+            'keyup',
+            /**
+             * @event keypress
+             * Keypress input field event. This event only fires if <tt><b>{@link #enableKeyEvents}</b></tt>
+             * is set to true.
+             * @param {Ext.form.TextField} this This text field
+             * @param {Ext.EventObject} e
+             */
+            'keypress'
+        );
+    },
+
+    // private
+    initEvents : function(){
+        Ext.form.TextField.superclass.initEvents.call(this);
+        if(this.validationEvent == 'keyup'){
+            this.validationTask = new Ext.util.DelayedTask(this.validate, this);
+            this.mon(this.el, 'keyup', this.filterValidation, this);
+        }
+        else if(this.validationEvent !== false){
+               this.mon(this.el, this.validationEvent, this.validate, this, {buffer: this.validationDelay});
+        }
+        if(this.selectOnFocus || this.emptyText){
+            this.on('focus', this.preFocus, this);
+            
+            this.mon(this.el, 'mousedown', function(){
+                if(!this.hasFocus){
+                    this.el.on('mouseup', function(e){
+                        e.preventDefault();
+                    }, this, {single:true});
+                }
+            }, this);
+            
+            if(this.emptyText){
+                this.on('blur', this.postBlur, this);
+                this.applyEmptyText();
+            }
+        }
+        if(this.maskRe || (this.vtype && this.disableKeyFilter !== true && (this.maskRe = Ext.form.VTypes[this.vtype+'Mask']))){
+               this.mon(this.el, 'keypress', this.filterKeys, this);
+        }
+        if(this.grow){
+               this.mon(this.el, 'keyup', this.onKeyUpBuffered, this, {buffer: 50});
+                       this.mon(this.el, 'click', this.autoSize, this);
+        }
+        if(this.enableKeyEvents){
+               this.mon(this.el, 'keyup', this.onKeyUp, this);
+               this.mon(this.el, 'keydown', this.onKeyDown, this);
+               this.mon(this.el, 'keypress', this.onKeyPress, this);
+        }
+    },
+
+    processValue : function(value){
+        if(this.stripCharsRe){
+            var newValue = value.replace(this.stripCharsRe, '');
+            if(newValue !== value){
+                this.setRawValue(newValue);
+                return newValue;
+            }
+        }
+        return value;
+    },
+
+    filterValidation : function(e){
+        if(!e.isNavKeyPress()){
+            this.validationTask.delay(this.validationDelay);
+        }
+    },
+    
+    //private
+    onDisable: function(){
+        Ext.form.TextField.superclass.onDisable.call(this);
+        if(Ext.isIE){
+            this.el.dom.unselectable = 'on';
+        }
+    },
+    
+    //private
+    onEnable: function(){
+        Ext.form.TextField.superclass.onEnable.call(this);
+        if(Ext.isIE){
+            this.el.dom.unselectable = '';
+        }
+    },
+
+    // private
+    onKeyUpBuffered : function(e){
+        if(!e.isNavKeyPress()){
+            this.autoSize();
+        }
+    },
+
+    // private
+    onKeyUp : function(e){
+        this.fireEvent('keyup', this, e);
+    },
+
+    // private
+    onKeyDown : function(e){
+        this.fireEvent('keydown', this, e);
+    },
+
+    // private
+    onKeyPress : function(e){
+        this.fireEvent('keypress', this, e);
+    },
+
+    /**
+     * Resets the current field value to the originally-loaded value and clears any validation messages.
+     * Also adds <tt><b>{@link #emptyText}</b></tt> and <tt><b>{@link #emptyClass}</b></tt> if the
+     * original value was blank.
+     */
+    reset : function(){
+        Ext.form.TextField.superclass.reset.call(this);
+        this.applyEmptyText();
+    },
+
+    applyEmptyText : function(){
+        if(this.rendered && this.emptyText && this.getRawValue().length < 1 && !this.hasFocus){
+            this.setRawValue(this.emptyText);
+            this.el.addClass(this.emptyClass);
+        }
+    },
+
+    // private
+    preFocus : function(){
+        var el = this.el;
+        if(this.emptyText){
+            if(el.dom.value == this.emptyText){
+                this.setRawValue('');
+            }
+            el.removeClass(this.emptyClass);
+        }
+        if(this.selectOnFocus){
+            (function(){
+                el.dom.select();
+            }).defer(this.inEditor && Ext.isIE ? 50 : 0);    
+        }
+    },
+
+    // private
+    postBlur : function(){
+        this.applyEmptyText();
+    },
+
+    // private
+    filterKeys : function(e){
+        // special keys don't generate charCodes, so leave them alone
+        if(e.ctrlKey || e.isSpecialKey()){
+            return;
+        }
+        
+        if(!this.maskRe.test(String.fromCharCode(e.getCharCode()))){
+            e.stopEvent();
+        }
+    },
+
+    setValue : function(v){
+        if(this.emptyText && this.el && !Ext.isEmpty(v)){
+            this.el.removeClass(this.emptyClass);
+        }
+        Ext.form.TextField.superclass.setValue.apply(this, arguments);
+        this.applyEmptyText();
+        this.autoSize();
+        return this;
+    },
+
+    /**
+     * Validates a value according to the field's validation rules and marks the field as invalid
+     * if the validation fails
+     * @param {Mixed} value The value to validate
+     * @return {Boolean} True if the value is valid, else false
+     */
+    validateValue : function(value){
+        if(Ext.isFunction(this.validator)){
+            var msg = this.validator(value);
+            if(msg !== true){
+                this.markInvalid(msg);
+                return false;
+            }
+        }
+        if(value.length < 1 || value === this.emptyText){ // if it's blank
+             if(this.allowBlank){
+                 this.clearInvalid();
+                 return true;
+             }else{
+                 this.markInvalid(this.blankText);
+                 return false;
+             }
+        }
+        if(value.length < this.minLength){
+            this.markInvalid(String.format(this.minLengthText, this.minLength));
+            return false;
+        }
+        if(value.length > this.maxLength){
+            this.markInvalid(String.format(this.maxLengthText, this.maxLength));
+            return false;
+        }      
+        if(this.vtype){
+            var vt = Ext.form.VTypes;
+            if(!vt[this.vtype](value, this)){
+                this.markInvalid(this.vtypeText || vt[this.vtype +'Text']);
+                return false;
+            }
+        }
+        if(this.regex && !this.regex.test(value)){
+            this.markInvalid(this.regexText);
+            return false;
+        }
+        return true;
+    },
+
+    /**
+     * Selects text in this field
+     * @param {Number} start (optional) The index where the selection should start (defaults to 0)
+     * @param {Number} end (optional) The index where the selection should end (defaults to the text length)
+     */
+    selectText : function(start, end){
+        var v = this.getRawValue();
+        var doFocus = false;
+        if(v.length > 0){
+            start = start === undefined ? 0 : start;
+            end = end === undefined ? v.length : end;
+            var d = this.el.dom;
+            if(d.setSelectionRange){
+                d.setSelectionRange(start, end);
+            }else if(d.createTextRange){
+                var range = d.createTextRange();
+                range.moveStart('character', start);
+                range.moveEnd('character', end-v.length);
+                range.select();
+            }
+            doFocus = Ext.isGecko || Ext.isOpera;
+        }else{
+            doFocus = true;
+        }
+        if(doFocus){
+            this.focus();
+        }
+    },
+
+    /**
+     * Automatically grows the field to accomodate the width of the text up to the maximum field width allowed.
+     * This only takes effect if <tt><b>{@link #grow}</b> = true</tt>, and fires the {@link #autosize} event.
+     */
+    autoSize : function(){
+        if(!this.grow || !this.rendered){
+            return;
+        }
+        if(!this.metrics){
+            this.metrics = Ext.util.TextMetrics.createInstance(this.el);
+        }
+        var el = this.el;
+        var v = el.dom.value;
+        var d = document.createElement('div');
+        d.appendChild(document.createTextNode(v));
+        v = d.innerHTML;
+        d = null;
+        Ext.removeNode(d);
+        v += '&#160;';
+        var w = Math.min(this.growMax, Math.max(this.metrics.getWidth(v) + /* add extra padding */ 10, this.growMin));
+        this.el.setWidth(w);
+        this.fireEvent('autosize', this, w);
+    },
+       
+       onDestroy: function(){
+               if(this.validationTask){
+                       this.validationTask.cancel();
+                       this.validationTask = null;
+               }
+               Ext.form.TextField.superclass.onDestroy.call(this);
+       }
+});
+Ext.reg('textfield', Ext.form.TextField);
+/**
+ * @class Ext.form.TriggerField
+ * @extends Ext.form.TextField
+ * Provides a convenient wrapper for TextFields that adds a clickable trigger button (looks like a combobox by default).
+ * The trigger has no default action, so you must assign a function to implement the trigger click handler by
+ * overriding {@link #onTriggerClick}. You can create a TriggerField directly, as it renders exactly like a combobox
+ * for which you can provide a custom implementation.  For example:
+ * <pre><code>
+var trigger = new Ext.form.TriggerField();
+trigger.onTriggerClick = myTriggerFn;
+trigger.applyToMarkup('my-field');
+</code></pre>
+ *
+ * However, in general you will most likely want to use TriggerField as the base class for a reusable component.
+ * {@link Ext.form.DateField} and {@link Ext.form.ComboBox} are perfect examples of this.
+ * 
+ * @constructor
+ * Create a new TriggerField.
+ * @param {Object} config Configuration options (valid {@Ext.form.TextField} config options will also be applied
+ * to the base TextField)
+ * @xtype trigger
+ */
+Ext.form.TriggerField = Ext.extend(Ext.form.TextField,  {
+    /**
+     * @cfg {String} triggerClass
+     * An additional CSS class used to style the trigger button.  The trigger will always get the
+     * class <tt>'x-form-trigger'</tt> by default and <tt>triggerClass</tt> will be <b>appended</b> if specified.
+     */
+    /**
+     * @cfg {Mixed} triggerConfig
+     * <p>A {@link Ext.DomHelper DomHelper} config object specifying the structure of the
+     * trigger element for this Field. (Optional).</p>
+     * <p>Specify this when you need a customized element to act as the trigger button for a TriggerField.</p>
+     * <p>Note that when using this option, it is the developer's responsibility to ensure correct sizing, positioning
+     * and appearance of the trigger.  Defaults to:</p>
+     * <pre><code>{tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass}</code></pre>
+     */
+    /**
+     * @cfg {String/Object} autoCreate <p>A {@link Ext.DomHelper DomHelper} element spec, or true for a default
+     * element spec. Used to create the {@link Ext.Component#getEl Element} which will encapsulate this Component.
+     * See <tt>{@link Ext.Component#autoEl autoEl}</tt> for details.  Defaults to:</p>
+     * <pre><code>{tag: "input", type: "text", size: "16", autocomplete: "off"}</code></pre>
+     */
+    defaultAutoCreate : {tag: "input", type: "text", size: "16", autocomplete: "off"},
+    /**
+     * @cfg {Boolean} hideTrigger <tt>true</tt> to hide the trigger element and display only the base
+     * text field (defaults to <tt>false</tt>)
+     */
+    hideTrigger:false,
+    /**
+     * @cfg {Boolean} editable <tt>false</tt> to prevent the user from typing text directly into the field,
+     * the field will only respond to a click on the trigger to set the value. (defaults to <tt>true</tt>)
+     */
+    editable: true,
+    /**
+     * @cfg {String} wrapFocusClass The class added to the to the wrap of the trigger element. Defaults to
+     * <tt>x-trigger-wrap-focus</tt>.
+     */
+    wrapFocusClass: 'x-trigger-wrap-focus',
+    /**
+     * @hide 
+     * @method autoSize
+     */
+    autoSize: Ext.emptyFn,
+    // private
+    monitorTab : true,
+    // private
+    deferHeight : true,
+    // private
+    mimicing : false,
+    
+    actionMode: 'wrap',
+
+    // private
+    onResize : function(w, h){
+        Ext.form.TriggerField.superclass.onResize.call(this, w, h);
+        if(typeof w == 'number'){
+            this.el.setWidth(this.adjustWidth('input', w - this.trigger.getWidth()));
+        }
+        this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
+    },
+
+    // private
+    adjustSize : Ext.BoxComponent.prototype.adjustSize,
+
+    // private
+    getResizeEl : function(){
+        return this.wrap;
+    },
+
+    // private
+    getPositionEl : function(){
+        return this.wrap;
+    },
+
+    // private
+    alignErrorIcon : function(){
+        if(this.wrap){
+            this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]);
+        }
+    },
+
+    // private
+    onRender : function(ct, position){
+        Ext.form.TriggerField.superclass.onRender.call(this, ct, position);
+
+        this.wrap = this.el.wrap({cls: 'x-form-field-wrap x-form-field-trigger-wrap'});
+        this.trigger = this.wrap.createChild(this.triggerConfig ||
+                {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.triggerClass});
+        if(this.hideTrigger){
+            this.trigger.setDisplayed(false);
+        }
+        this.initTrigger();
+        if(!this.width){
+            this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth());
+        }
+        if(!this.editable){
+            this.editable = true;
+            this.setEditable(false);
+        }
+    },
+
+    afterRender : function(){
+        Ext.form.TriggerField.superclass.afterRender.call(this);
+    },
+
+    // private
+    initTrigger : function(){
+       this.mon(this.trigger, 'click', this.onTriggerClick, this, {preventDefault:true});
+        this.trigger.addClassOnOver('x-form-trigger-over');
+        this.trigger.addClassOnClick('x-form-trigger-click');
+    },
+
+    // private
+    onDestroy : function(){
+               Ext.destroy(this.trigger, this.wrap);
+        if (this.mimicing){
+            Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this);
+        }
+        Ext.form.TriggerField.superclass.onDestroy.call(this);
+    },
+
+    // private
+    onFocus : function(){
+        Ext.form.TriggerField.superclass.onFocus.call(this);
+        if(!this.mimicing){
+            this.wrap.addClass(this.wrapFocusClass);
+            this.mimicing = true;
+            Ext.get(Ext.isIE ? document.body : document).on("mousedown", this.mimicBlur, this, {delay: 10});
+            if(this.monitorTab){
+               this.el.on('keydown', this.checkTab, this);
+            }
+        }
+    },
+
+    // private
+    checkTab : function(e){
+        if(e.getKey() == e.TAB){
+            this.triggerBlur();
+        }
+    },
+
+    // private
+    onBlur : function(){
+        // do nothing
+    },
+
+    // private
+    mimicBlur : function(e){
+        if(!this.wrap.contains(e.target) && this.validateBlur(e)){
+            this.triggerBlur();
+        }
+    },
+
+    // private
+    triggerBlur : function(){
+        this.mimicing = false;
+        Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this);
+        if(this.monitorTab && this.el){
+            this.el.un("keydown", this.checkTab, this);
+        }
+        Ext.form.TriggerField.superclass.onBlur.call(this);
+        if(this.wrap){
+            this.wrap.removeClass(this.wrapFocusClass);
+        }
+    },
+
+    beforeBlur : Ext.emptyFn, 
+    
+    /**
+     * Allow or prevent the user from directly editing the field text.  If false is passed,
+     * the user will only be able to modify the field using the trigger.  This method
+     * is the runtime equivalent of setting the 'editable' config option at config time.
+     * @param {Boolean} value True to allow the user to directly edit the field text
+     */
+    setEditable : function(value){
+        if(value == this.editable){
+            return;
+        }
+        this.editable = value;
+        if(!value){
+            this.el.addClass('x-trigger-noedit').on('click', this.onTriggerClick, this).dom.setAttribute('readOnly', true);
+        }else{
+            this.el.removeClass('x-trigger-noedit').un('click', this.onTriggerClick,  this).dom.removeAttribute('readOnly');
+        }
+    },
+
+    // private
+    // This should be overriden by any subclass that needs to check whether or not the field can be blurred.
+    validateBlur : function(e){
+        return true;
+    },
+
+    /**
+     * The function that should handle the trigger's click event.  This method does nothing by default
+     * until overridden by an implementing function.  See Ext.form.ComboBox and Ext.form.DateField for
+     * sample implementations.
+     * @method
+     * @param {EventObject} e
+     */
+    onTriggerClick : Ext.emptyFn
+
+    /**
+     * @cfg {Boolean} grow @hide
+     */
+    /**
+     * @cfg {Number} growMin @hide
+     */
+    /**
+     * @cfg {Number} growMax @hide
+     */
+});
+
+/**
+ * @class Ext.form.TwinTriggerField
+ * @extends Ext.form.TriggerField
+ * TwinTriggerField is not a public class to be used directly.  It is meant as an abstract base class
+ * to be extended by an implementing class.  For an example of implementing this class, see the custom
+ * SearchField implementation here:
+ * <a href="http://extjs.com/deploy/ext/examples/form/custom.html">http://extjs.com/deploy/ext/examples/form/custom.html</a>
+ */
+Ext.form.TwinTriggerField = Ext.extend(Ext.form.TriggerField, {
+    /**
+     * @cfg {Mixed} triggerConfig
+     * <p>A {@link Ext.DomHelper DomHelper} config object specifying the structure of the trigger elements
+     * for this Field. (Optional).</p>
+     * <p>Specify this when you need a customized element to contain the two trigger elements for this Field.
+     * Each trigger element must be marked by the CSS class <tt>x-form-trigger</tt> (also see
+     * <tt>{@link #trigger1Class}</tt> and <tt>{@link #trigger2Class}</tt>).</p>
+     * <p>Note that when using this option, it is the developer's responsibility to ensure correct sizing,
+     * positioning and appearance of the triggers.</p>
+     */
+    /**
+     * @cfg {String} trigger1Class
+     * An additional CSS class used to style the trigger button.  The trigger will always get the
+     * class <tt>'x-form-trigger'</tt> by default and <tt>triggerClass</tt> will be <b>appended</b> if specified.
+     */
+    /**
+     * @cfg {String} trigger2Class
+     * An additional CSS class used to style the trigger button.  The trigger will always get the
+     * class <tt>'x-form-trigger'</tt> by default and <tt>triggerClass</tt> will be <b>appended</b> if specified.
+     */
+
+    initComponent : function(){
+        Ext.form.TwinTriggerField.superclass.initComponent.call(this);
+
+        this.triggerConfig = {
+            tag:'span', cls:'x-form-twin-triggers', cn:[
+            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger1Class},
+            {tag: "img", src: Ext.BLANK_IMAGE_URL, cls: "x-form-trigger " + this.trigger2Class}
+        ]};
+    },
+
+    getTrigger : function(index){
+        return this.triggers[index];
+    },
+
+    initTrigger : function(){
+        var ts = this.trigger.select('.x-form-trigger', true);
+        this.wrap.setStyle('overflow', 'hidden');
+        var triggerField = this;
+        ts.each(function(t, all, index){
+            t.hide = function(){
+                var w = triggerField.wrap.getWidth();
+                this.dom.style.display = 'none';
+                triggerField.el.setWidth(w-triggerField.trigger.getWidth());
+            };
+            t.show = function(){
+                var w = triggerField.wrap.getWidth();
+                this.dom.style.display = '';
+                triggerField.el.setWidth(w-triggerField.trigger.getWidth());
+            };
+            var triggerIndex = 'Trigger'+(index+1);
+
+            if(this['hide'+triggerIndex]){
+                t.dom.style.display = 'none';
+            }
+            this.mon(t, 'click', this['on'+triggerIndex+'Click'], this, {preventDefault:true});
+            t.addClassOnOver('x-form-trigger-over');
+            t.addClassOnClick('x-form-trigger-click');
+        }, this);
+        this.triggers = ts.elements;
+    },
+
+    /**
+     * The function that should handle the trigger's click event.  This method does nothing by default
+     * until overridden by an implementing function. See {@link Ext.form.TriggerField#onTriggerClick}
+     * for additional information.  
+     * @method
+     * @param {EventObject} e
+     */
+    onTrigger1Click : Ext.emptyFn,
+    /**
+     * The function that should handle the trigger's click event.  This method does nothing by default
+     * until overridden by an implementing function. See {@link Ext.form.TriggerField#onTriggerClick}
+     * for additional information.  
+     * @method
+     * @param {EventObject} e
+     */
+    onTrigger2Click : Ext.emptyFn
+});
+Ext.reg('trigger', Ext.form.TriggerField);/**
+ * @class Ext.form.TextArea
+ * @extends Ext.form.TextField
+ * Multiline text field.  Can be used as a direct replacement for traditional textarea fields, plus adds
+ * support for auto-sizing.
+ * @constructor
+ * Creates a new TextArea
+ * @param {Object} config Configuration options
+ * @xtype textarea
+ */
+Ext.form.TextArea = Ext.extend(Ext.form.TextField,  {
+    /**
+     * @cfg {Number} growMin The minimum height to allow when <tt>{@link Ext.form.TextField#grow grow}=true</tt>
+     * (defaults to <tt>60</tt>)
+     */
+    growMin : 60,
+    /**
+     * @cfg {Number} growMax The maximum height to allow when <tt>{@link Ext.form.TextField#grow grow}=true</tt>
+     * (defaults to <tt>1000</tt>)
+     */
+    growMax: 1000,
+    growAppend : '&#160;\n&#160;',
+    growPad : Ext.isWebKit ? -6 : 0,
+
+    enterIsSpecial : false,
+
+    /**
+     * @cfg {Boolean} preventScrollbars <tt>true</tt> to prevent scrollbars from appearing regardless of how much text is
+     * in the field (equivalent to setting overflow: hidden, defaults to <tt>false</tt>)
+     */
+    preventScrollbars: false,
+    /**
+     * @cfg {String/Object} autoCreate <p>A {@link Ext.DomHelper DomHelper} element spec, or true for a default
+     * element spec. Used to create the {@link Ext.Component#getEl Element} which will encapsulate this Component.
+     * See <tt>{@link Ext.Component#autoEl autoEl}</tt> for details.  Defaults to:</p>
+     * <pre><code>{tag: "textarea", style: "width:100px;height:60px;", autocomplete: "off"}</code></pre>
+     */
+
+    // private
+    onRender : function(ct, position){
+        if(!this.el){
+            this.defaultAutoCreate = {
+                tag: "textarea",
+                style:"width:100px;height:60px;",
+                autocomplete: "off"
+            };
+        }
+        Ext.form.TextArea.superclass.onRender.call(this, ct, position);
+        if(this.grow){
+            this.textSizeEl = Ext.DomHelper.append(document.body, {
+                tag: "pre", cls: "x-form-grow-sizer"
+            });
+            if(this.preventScrollbars){
+                this.el.setStyle("overflow", "hidden");
+            }
+            this.el.setHeight(this.growMin);
+        }
+    },
+
+    onDestroy : function(){
+        Ext.destroy(this.textSizeEl);
+        Ext.form.TextArea.superclass.onDestroy.call(this);
+    },
+
+    fireKey : function(e){
+        if(e.isSpecialKey() && (this.enterIsSpecial || (e.getKey() != e.ENTER || e.hasModifier()))){
+            this.fireEvent("specialkey", this, e);
+        }
+    },
+
+    // private
+    onKeyUp : function(e){
+        if(!e.isNavKeyPress() || e.getKey() == e.ENTER){
+            this.autoSize();
+        }
+        Ext.form.TextArea.superclass.onKeyUp.call(this, e);
+    },
+
+    /**
+     * Automatically grows the field to accomodate the height of the text up to the maximum field height allowed.
+     * This only takes effect if grow = true, and fires the {@link #autosize} event if the height changes.
+     */
+    autoSize: function(){
+        if(!this.grow || !this.textSizeEl){
+            return;
+        }
+        var el = this.el;
+        var v = el.dom.value;
+        var ts = this.textSizeEl;
+        ts.innerHTML = '';
+        ts.appendChild(document.createTextNode(v));
+        v = ts.innerHTML;
+        Ext.fly(ts).setWidth(this.el.getWidth());
+        if(v.length < 1){
+            v = "&#160;&#160;";
+        }else{
+            v += this.growAppend;
+            if(Ext.isIE){
+                v = v.replace(/\n/g, '<br />');
+            }
+        }
+        ts.innerHTML = v;
+        var h = Math.min(this.growMax, Math.max(ts.offsetHeight, this.growMin) + this.growPad);
+        if(h != this.lastHeight){
+            this.lastHeight = h;
+            this.el.setHeight(h);
+            this.fireEvent("autosize", this, h);
+        }
+    }
+});
+Ext.reg('textarea', Ext.form.TextArea);/**
+ * @class Ext.form.NumberField
+ * @extends Ext.form.TextField
+ * Numeric text field that provides automatic keystroke filtering and numeric validation.
+ * @constructor
+ * Creates a new NumberField
+ * @param {Object} config Configuration options
+ * @xtype numberfield
+ */
+Ext.form.NumberField = Ext.extend(Ext.form.TextField,  {
+    /**
+     * @cfg {RegExp} stripCharsRe @hide
+     */
+    /**
+     * @cfg {RegExp} maskRe @hide
+     */
+    /**
+     * @cfg {String} fieldClass The default CSS class for the field (defaults to "x-form-field x-form-num-field")
+     */
+    fieldClass: "x-form-field x-form-num-field",
+    /**
+     * @cfg {Boolean} allowDecimals False to disallow decimal values (defaults to true)
+     */
+    allowDecimals : true,
+    /**
+     * @cfg {String} decimalSeparator Character(s) to allow as the decimal separator (defaults to '.')
+     */
+    decimalSeparator : ".",
+    /**
+     * @cfg {Number} decimalPrecision The maximum precision to display after the decimal separator (defaults to 2)
+     */
+    decimalPrecision : 2,
+    /**
+     * @cfg {Boolean} allowNegative False to prevent entering a negative sign (defaults to true)
+     */
+    allowNegative : true,
+    /**
+     * @cfg {Number} minValue The minimum allowed value (defaults to Number.NEGATIVE_INFINITY)
+     */
+    minValue : Number.NEGATIVE_INFINITY,
+    /**
+     * @cfg {Number} maxValue The maximum allowed value (defaults to Number.MAX_VALUE)
+     */
+    maxValue : Number.MAX_VALUE,
+    /**
+     * @cfg {String} minText Error text to display if the minimum value validation fails (defaults to "The minimum value for this field is {minValue}")
+     */
+    minText : "The minimum value for this field is {0}",
+    /**
+     * @cfg {String} maxText Error text to display if the maximum value validation fails (defaults to "The maximum value for this field is {maxValue}")
+     */
+    maxText : "The maximum value for this field is {0}",
+    /**
+     * @cfg {String} nanText Error text to display if the value is not a valid number.  For example, this can happen
+     * if a valid character like '.' or '-' is left in the field with no number (defaults to "{value} is not a valid number")
+     */
+    nanText : "{0} is not a valid number",
+    /**
+     * @cfg {String} baseChars The base set of characters to evaluate as valid numbers (defaults to '0123456789').
+     */
+    baseChars : "0123456789",
+
+    // private
+    initEvents : function(){
+        var allowed = this.baseChars + '';
+        if (this.allowDecimals) {
+            allowed += this.decimalSeparator;
+        }
+        if (this.allowNegative) {
+            allowed += '-';
+        }
+        this.maskRe = new RegExp('[' + Ext.escapeRe(allowed) + ']');
+        Ext.form.NumberField.superclass.initEvents.call(this);
+    },
+
+    // private
+    validateValue : function(value){
+        if(!Ext.form.NumberField.superclass.validateValue.call(this, value)){
+            return false;
+        }
+        if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
+             return true;
+        }
+        value = String(value).replace(this.decimalSeparator, ".");
+        if(isNaN(value)){
+            this.markInvalid(String.format(this.nanText, value));
+            return false;
+        }
+        var num = this.parseValue(value);
+        if(num < this.minValue){
+            this.markInvalid(String.format(this.minText, this.minValue));
+            return false;
+        }
+        if(num > this.maxValue){
+            this.markInvalid(String.format(this.maxText, this.maxValue));
+            return false;
+        }
+        return true;
+    },
+
+    getValue : function(){
+        return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)));
+    },
+
+    setValue : function(v){
+       v = typeof v == 'number' ? v : parseFloat(String(v).replace(this.decimalSeparator, "."));
+        v = isNaN(v) ? '' : String(v).replace(".", this.decimalSeparator);
+        return Ext.form.NumberField.superclass.setValue.call(this, v);
+    },
+
+    // private
+    parseValue : function(value){
+        value = parseFloat(String(value).replace(this.decimalSeparator, "."));
+        return isNaN(value) ? '' : value;
+    },
+
+    // private
+    fixPrecision : function(value){
+        var nan = isNaN(value);
+        if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
+           return nan ? '' : value;
+        }
+        return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));
+    },
+
+    beforeBlur : function(){
+        var v = this.parseValue(this.getRawValue());
+        if(!Ext.isEmpty(v)){
+            this.setValue(this.fixPrecision(v));
+        }
+    }
+});
+Ext.reg('numberfield', Ext.form.NumberField);/**
+ * @class Ext.form.DateField
+ * @extends Ext.form.TriggerField
+ * Provides a date input field with a {@link Ext.DatePicker} dropdown and automatic date validation.
+ * @constructor
+ * Create a new DateField
+ * @param {Object} config
+ * @xtype datefield
+ */
+Ext.form.DateField = Ext.extend(Ext.form.TriggerField,  {
+    /**
+     * @cfg {String} format
+     * The default date format string which can be overriden for localization support.  The format must be
+     * valid according to {@link Date#parseDate} (defaults to <tt>'m/d/Y'</tt>).
+     */
+    format : "m/d/Y",
+    /**
+     * @cfg {String} altFormats
+     * Multiple date formats separated by "<tt>|</tt>" to try when parsing a user input value and it
+     * does not match the defined format (defaults to
+     * <tt>'m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d'</tt>).
+     */
+    altFormats : "m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",
+    /**
+     * @cfg {String} disabledDaysText
+     * The tooltip to display when the date falls on a disabled day (defaults to <tt>'Disabled'</tt>)
+     */
+    disabledDaysText : "Disabled",
+    /**
+     * @cfg {String} disabledDatesText
+     * The tooltip text to display when the date falls on a disabled date (defaults to <tt>'Disabled'</tt>)
+     */
+    disabledDatesText : "Disabled",
+    /**
+     * @cfg {String} minText
+     * The error text to display when the date in the cell is before <tt>{@link #minValue}</tt> (defaults to
+     * <tt>'The date in this field must be after {minValue}'</tt>).
+     */
+    minText : "The date in this field must be equal to or after {0}",
+    /**
+     * @cfg {String} maxText
+     * The error text to display when the date in the cell is after <tt>{@link #maxValue}</tt> (defaults to
+     * <tt>'The date in this field must be before {maxValue}'</tt>).
+     */
+    maxText : "The date in this field must be equal to or before {0}",
+    /**
+     * @cfg {String} invalidText
+     * The error text to display when the date in the field is invalid (defaults to
+     * <tt>'{value} is not a valid date - it must be in the format {format}'</tt>).
+     */
+    invalidText : "{0} is not a valid date - it must be in the format {1}",
+    /**
+     * @cfg {String} triggerClass
+     * An additional CSS class used to style the trigger button.  The trigger will always get the
+     * class <tt>'x-form-trigger'</tt> and <tt>triggerClass</tt> will be <b>appended</b> if specified
+     * (defaults to <tt>'x-form-date-trigger'</tt> which displays a calendar icon).
+     */
+    triggerClass : 'x-form-date-trigger',
+    /**
+     * @cfg {Boolean} showToday
+     * <tt>false</tt> to hide the footer area of the DatePicker containing the Today button and disable
+     * the keyboard handler for spacebar that selects the current date (defaults to <tt>true</tt>).
+     */
+    showToday : true,
+    /**
+     * @cfg {Date/String} minValue
+     * The minimum allowed date. Can be either a Javascript date object or a string date in a
+     * valid format (defaults to null).
+     */
+    /**
+     * @cfg {Date/String} maxValue
+     * The maximum allowed date. Can be either a Javascript date object or a string date in a
+     * valid format (defaults to null).
+     */
+    /**
+     * @cfg {Array} disabledDays
+     * An array of days to disable, 0 based (defaults to null). Some examples:<pre><code>
+// disable Sunday and Saturday:
+disabledDays:  [0, 6]
+// disable weekdays:
+disabledDays: [1,2,3,4,5]
+     * </code></pre>
+     */
+    /**
+     * @cfg {Array} disabledDates
+     * An array of "dates" to disable, as strings. These strings will be used to build a dynamic regular
+     * expression so they are very powerful. Some examples:<pre><code>
+// disable these exact dates:
+disabledDates: ["03/08/2003", "09/16/2003"]
+// disable these days for every year:
+disabledDates: ["03/08", "09/16"]
+// only match the beginning (useful if you are using short years):
+disabledDates: ["^03/08"]
+// disable every day in March 2006:
+disabledDates: ["03/../2006"]
+// disable every day in every March:
+disabledDates: ["^03"]
+     * </code></pre>
+     * Note that the format of the dates included in the array should exactly match the {@link #format} config.
+     * In order to support regular expressions, if you are using a {@link #format date format} that has "." in
+     * it, you will have to escape the dot when restricting dates. For example: <tt>["03\\.08\\.03"]</tt>.
+     */
+    /**
+     * @cfg {String/Object} autoCreate
+     * A {@link Ext.DomHelper DomHelper element specification object}, or <tt>true</tt> for the default element
+     * specification object:<pre><code>
+     * autoCreate: {tag: "input", type: "text", size: "10", autocomplete: "off"}
+     * </code></pre>
+     */
+
+    // private
+    defaultAutoCreate : {tag: "input", type: "text", size: "10", autocomplete: "off"},
+
+    initComponent : function(){
+        Ext.form.DateField.superclass.initComponent.call(this);
+
+        this.addEvents(
+            /**
+             * @event select
+             * Fires when a date is selected via the date picker.
+             * @param {Ext.form.DateField} this
+             * @param {Date} date The date that was selected
+             */
+            'select'
+        );
+
+        if(Ext.isString(this.minValue)){
+            this.minValue = this.parseDate(this.minValue);
+        }
+        if(Ext.isString(this.maxValue)){
+            this.maxValue = this.parseDate(this.maxValue);
+        }
+        this.disabledDatesRE = null;
+        this.initDisabledDays();
+    },
+
+    // private
+    initDisabledDays : function(){
+        if(this.disabledDates){
+            var dd = this.disabledDates,
+                len = dd.length - 1, 
+                re = "(?:";
+                
+            Ext.each(dd, function(d, i){
+                re += Ext.isDate(d) ? '^' + Ext.escapeRe(d.dateFormat(this.format)) + '$' : dd[i];
+                if(i != len){
+                    re += '|';
+                }
+            }, this);
+            this.disabledDatesRE = new RegExp(re + ')');
+        }
+    },
+
+    /**
+     * Replaces any existing disabled dates with new values and refreshes the DatePicker.
+     * @param {Array} disabledDates An array of date strings (see the <tt>{@link #disabledDates}</tt> config
+     * for details on supported values) used to disable a pattern of dates.
+     */
+    setDisabledDates : function(dd){
+        this.disabledDates = dd;
+        this.initDisabledDays();
+        if(this.menu){
+            this.menu.picker.setDisabledDates(this.disabledDatesRE);
+        }
+    },
+
+    /**
+     * Replaces any existing disabled days (by index, 0-6) with new values and refreshes the DatePicker.
+     * @param {Array} disabledDays An array of disabled day indexes. See the <tt>{@link #disabledDays}</tt>
+     * config for details on supported values.
+     */
+    setDisabledDays : function(dd){
+        this.disabledDays = dd;
+        if(this.menu){
+            this.menu.picker.setDisabledDays(dd);
+        }
+    },
+
+    /**
+     * Replaces any existing <tt>{@link #minValue}</tt> with the new value and refreshes the DatePicker.
+     * @param {Date} value The minimum date that can be selected
+     */
+    setMinValue : function(dt){
+        this.minValue = (Ext.isString(dt) ? this.parseDate(dt) : dt);
+        if(this.menu){
+            this.menu.picker.setMinDate(this.minValue);
+        }
+    },
+
+    /**
+     * Replaces any existing <tt>{@link #maxValue}</tt> with the new value and refreshes the DatePicker.
+     * @param {Date} value The maximum date that can be selected
+     */
+    setMaxValue : function(dt){
+        this.maxValue = (Ext.isString(dt) ? this.parseDate(dt) : dt);
+        if(this.menu){
+            this.menu.picker.setMaxDate(this.maxValue);
+        }
+    },
+
+    // private
+    validateValue : function(value){
+        value = this.formatDate(value);
+        if(!Ext.form.DateField.superclass.validateValue.call(this, value)){
+            return false;
+        }
+        if(value.length < 1){ // if it's blank and textfield didn't flag it then it's valid
+             return true;
+        }
+        var svalue = value;
+        value = this.parseDate(value);
+        if(!value){
+            this.markInvalid(String.format(this.invalidText, svalue, this.format));
+            return false;
+        }
+        var time = value.getTime();
+        if(this.minValue && time < this.minValue.getTime()){
+            this.markInvalid(String.format(this.minText, this.formatDate(this.minValue)));
+            return false;
+        }
+        if(this.maxValue && time > this.maxValue.getTime()){
+            this.markInvalid(String.format(this.maxText, this.formatDate(this.maxValue)));
+            return false;
+        }
+        if(this.disabledDays){
+            var day = value.getDay();
+            for(var i = 0; i < this.disabledDays.length; i++) {
+                if(day === this.disabledDays[i]){
+                    this.markInvalid(this.disabledDaysText);
+                    return false;
+                }
+            }
+        }
+        var fvalue = this.formatDate(value);
+        if(this.disabledDatesRE && this.disabledDatesRE.test(fvalue)){
+            this.markInvalid(String.format(this.disabledDatesText, fvalue));
+            return false;
+        }
+        return true;
+    },
+
+    // private
+    // Provides logic to override the default TriggerField.validateBlur which just returns true
+    validateBlur : function(){
+        return !this.menu || !this.menu.isVisible();
+    },
+
+    /**
+     * Returns the current date value of the date field.
+     * @return {Date} The date value
+     */
+    getValue : function(){
+        return this.parseDate(Ext.form.DateField.superclass.getValue.call(this)) || "";
+    },
+
+    /**
+     * Sets the value of the date field.  You can pass a date object or any string that can be
+     * parsed into a valid date, using <tt>{@link #format}</tt> as the date format, according
+     * to the same rules as {@link Date#parseDate} (the default format used is <tt>"m/d/Y"</tt>).
+     * <br />Usage:
+     * <pre><code>
+//All of these calls set the same date value (May 4, 2006)
+
+//Pass a date object:
+var dt = new Date('5/4/2006');
+dateField.setValue(dt);
+
+//Pass a date string (default format):
+dateField.setValue('05/04/2006');
+
+//Pass a date string (custom format):
+dateField.format = 'Y-m-d';
+dateField.setValue('2006-05-04');
+</code></pre>
+     * @param {String/Date} date The date or valid date string
+     * @return {Ext.form.Field} this
+     */
+    setValue : function(date){
+        return Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
+    },
+
+    // private
+    parseDate : function(value){
+        if(!value || Ext.isDate(value)){
+            return value;
+        }
+        var v = Date.parseDate(value, this.format);
+        if(!v && this.altFormats){
+            if(!this.altFormatsArray){
+                this.altFormatsArray = this.altFormats.split("|");
+            }
+            for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++){
+                v = Date.parseDate(value, this.altFormatsArray[i]);
+            }
+        }
+        return v;
+    },
+
+    // private
+    onDestroy : function(){
+               Ext.destroy(this.menu);
+        Ext.form.DateField.superclass.onDestroy.call(this);
+    },
+
+    // private
+    formatDate : function(date){
+        return Ext.isDate(date) ? date.dateFormat(this.format) : date;
+    },
+
+    /**
+     * @method onTriggerClick
+     * @hide
+     */
+    // private
+    // Implements the default empty TriggerField.onTriggerClick function to display the DatePicker
+    onTriggerClick : function(){
+        if(this.disabled){
+            return;
+        }
+        if(this.menu == null){
+            this.menu = new Ext.menu.DateMenu({
+                hideOnClick: false
+            });
+        }
+        this.onFocus();
+        Ext.apply(this.menu.picker,  {
+            minDate : this.minValue,
+            maxDate : this.maxValue,
+            disabledDatesRE : this.disabledDatesRE,
+            disabledDatesText : this.disabledDatesText,
+            disabledDays : this.disabledDays,
+            disabledDaysText : this.disabledDaysText,
+            format : this.format,
+            showToday : this.showToday,
+            minText : String.format(this.minText, this.formatDate(this.minValue)),
+            maxText : String.format(this.maxText, this.formatDate(this.maxValue))
+        });
+        this.menu.picker.setValue(this.getValue() || new Date());
+        this.menu.show(this.el, "tl-bl?");
+        this.menuEvents('on');
+    },
+    
+    //private
+    menuEvents: function(method){
+        this.menu[method]('select', this.onSelect, this);
+        this.menu[method]('hide', this.onMenuHide, this);
+        this.menu[method]('show', this.onFocus, this);
+    },
+    
+    onSelect: function(m, d){
+        this.setValue(d);
+        this.fireEvent('select', this, d);
+        this.menu.hide();
+    },
+    
+    onMenuHide: function(){
+        this.focus(false, 60);
+        this.menuEvents('un');
+    },
+
+    // private
+    beforeBlur : function(){
+        var v = this.parseDate(this.getRawValue());
+        if(v){
+            this.setValue(v);
+        }
+    }
+
+    /**
+     * @cfg {Boolean} grow @hide
+     */
+    /**
+     * @cfg {Number} growMin @hide
+     */
+    /**
+     * @cfg {Number} growMax @hide
+     */
+    /**
+     * @hide
+     * @method autoSize
+     */
+});
+Ext.reg('datefield', Ext.form.DateField);/**\r
+ * @class Ext.form.DisplayField\r
+ * @extends Ext.form.Field\r
+ * A display-only text field which is not validated and not submitted.\r
+ * @constructor\r
+ * Creates a new DisplayField.\r
+ * @param {Object} config Configuration options\r
+ * @xtype displayfield\r
+ */\r
+Ext.form.DisplayField = Ext.extend(Ext.form.Field,  {\r
+    validationEvent : false,\r
+    validateOnBlur : false,\r
+    defaultAutoCreate : {tag: "div"},\r
+    /**\r
+     * @cfg {String} fieldClass The default CSS class for the field (defaults to <tt>"x-form-display-field"</tt>)\r
+     */\r
+    fieldClass : "x-form-display-field",\r
+    /**\r
+     * @cfg {Boolean} htmlEncode <tt>false</tt> to skip HTML-encoding the text when rendering it (defaults to\r
+     * <tt>false</tt>). This might be useful if you want to include tags in the field's innerHTML rather than\r
+     * rendering them as string literals per the default logic.\r
+     */\r
+    htmlEncode: false,\r
+\r
+    // private\r
+    initEvents : Ext.emptyFn,\r
+\r
+    isValid : function(){\r
         return true;\r
     },\r
 \r
-    \r
-    clearSelections : function(fast){\r
-        if(this.isLocked()) return;\r
-        if(fast !== true){\r
-            var ds = this.grid.store;\r
-            var s = this.selections;\r
-            s.each(function(r){\r
-                this.deselectRow(ds.indexOfId(r.id));\r
-            }, this);\r
-            s.clear();\r
-        }else{\r
-            this.selections.clear();\r
-        }\r
-        this.last = false;\r
+    validate : function(){\r
+        return true;\r
     },\r
 \r
-\r
-    \r
-    selectAll : function(){\r
-        if(this.isLocked()) return;\r
-        this.selections.clear();\r
-        for(var i = 0, len = this.grid.store.getCount(); i < len; i++){\r
-            this.selectRow(i, true);\r
+    getRawValue : function(){\r
+        var v = this.rendered ? this.el.dom.innerHTML : Ext.value(this.value, '');\r
+        if(v === this.emptyText){\r
+            v = '';\r
         }\r
+        if(this.htmlEncode){\r
+            v = Ext.util.Format.htmlDecode(v);\r
+        }\r
+        return v;\r
     },\r
 \r
+    getValue : function(){\r
+        return this.getRawValue();\r
+    },\r
     \r
-    hasSelection : function(){\r
-        return this.selections.length > 0;\r
+    getName: function() {\r
+        return this.name;\r
     },\r
 \r
-    \r
-    isSelected : function(index){\r
-        var r = typeof index == "number" ? this.grid.store.getAt(index) : index;\r
-        return (r && this.selections.key(r.id) ? true : false);\r
+    setRawValue : function(v){\r
+        if(this.htmlEncode){\r
+            v = Ext.util.Format.htmlEncode(v);\r
+        }\r
+        return this.rendered ? (this.el.dom.innerHTML = (Ext.isEmpty(v) ? '' : v)) : (this.value = v);\r
     },\r
 \r
-    \r
-    isIdSelected : function(id){\r
-        return (this.selections.key(id) ? true : false);\r
+    setValue : function(v){\r
+        this.setRawValue(v);\r
+        return this;\r
+    }\r
+    /** \r
+     * @cfg {String} inputType \r
+     * @hide\r
+     */\r
+    /** \r
+     * @cfg {Boolean} disabled \r
+     * @hide\r
+     */\r
+    /** \r
+     * @cfg {Boolean} readOnly \r
+     * @hide\r
+     */\r
+    /** \r
+     * @cfg {Boolean} validateOnBlur \r
+     * @hide\r
+     */\r
+    /** \r
+     * @cfg {Number} validationDelay \r
+     * @hide\r
+     */\r
+    /** \r
+     * @cfg {String/Boolean} validationEvent \r
+     * @hide\r
+     */\r
+});\r
+\r
+Ext.reg('displayfield', Ext.form.DisplayField);\r
+/**
+ * @class Ext.form.ComboBox
+ * @extends Ext.form.TriggerField
+ * <p>A combobox control with support for autocomplete, remote-loading, paging and many other features.</p>
+ * <p>A ComboBox works in a similar manner to a traditional HTML &lt;select> field. The difference is
+ * that to submit the {@link #valueField}, you must specify a {@link #hiddenName} to create a hidden input
+ * field to hold the value of the valueField. The <i>{@link #displayField}</i> is shown in the text field
+ * which is named according to the {@link #name}.</p>
+ * <p><b><u>Events</u></b></p>
+ * <p>To do something when something in ComboBox is selected, configure the select event:<pre><code>
+var cb = new Ext.form.ComboBox({
+    // all of your config options
+    listeners:{
+         scope: yourScope,
+         'select': yourFunction
+    }
+});
+
+// Alternatively, you can assign events after the object is created:
+var cb = new Ext.form.ComboBox(yourOptions);
+cb.on('select', yourFunction, yourScope);
+ * </code></pre></p>
+ *
+ * <p><b><u>ComboBox in Grid</u></b></p>
+ * <p>If using a ComboBox in an {@link Ext.grid.EditorGridPanel Editor Grid} a {@link Ext.grid.Column#renderer renderer}
+ * will be needed to show the displayField when the editor is not active.  Set up the renderer manually, or implement
+ * a reusable render, for example:<pre><code>
+// create reusable renderer
+Ext.util.Format.comboRenderer = function(combo){
+    return function(value){
+        var record = combo.findRecord(combo.{@link #valueField}, value);
+        return record ? record.get(combo.{@link #displayField}) : combo.{@link #valueNotFoundText};
+    }
+}
+
+// create the combo instance
+var combo = new Ext.form.ComboBox({
+    {@link #typeAhead}: true,
+    {@link #triggerAction}: 'all',
+    {@link #lazyRender}:true,
+    {@link #mode}: 'local',
+    {@link #store}: new Ext.data.ArrayStore({
+        id: 0,
+        fields: [
+            'myId',
+            'displayText'
+        ],
+        data: [[1, 'item1'], [2, 'item2']]
+    }),
+    {@link #valueField}: 'myId',
+    {@link #displayField}: 'displayText'
+});
+
+// snippet of column model used within grid
+var cm = new Ext.grid.ColumnModel([{
+       ...
+    },{
+       header: "Some Header",
+       dataIndex: 'whatever',
+       width: 130,
+       editor: combo, // specify reference to combo instance
+       renderer: Ext.util.Format.comboRenderer(combo) // pass combo instance to reusable renderer
+    },
+    ...
+]);
+ * </code></pre></p>
+ *
+ * <p><b><u>Filtering</u></b></p>
+ * <p>A ComboBox {@link #doQuery uses filtering itself}, for information about filtering the ComboBox
+ * store manually see <tt>{@link #lastQuery}</tt>.</p>
+ * @constructor
+ * Create a new ComboBox.
+ * @param {Object} config Configuration options
+ * @xtype combo
+ */
+Ext.form.ComboBox = Ext.extend(Ext.form.TriggerField, {
+    /**
+     * @cfg {Mixed} transform The id, DOM node or element of an existing HTML SELECT to convert to a ComboBox.
+     * Note that if you specify this and the combo is going to be in an {@link Ext.form.BasicForm} or
+     * {@link Ext.form.FormPanel}, you must also set <tt>{@link #lazyRender} = true</tt>.
+     */
+    /**
+     * @cfg {Boolean} lazyRender <tt>true</tt> to prevent the ComboBox from rendering until requested
+     * (should always be used when rendering into an {@link Ext.Editor} (e.g. {@link Ext.grid.EditorGridPanel Grids}),
+     * defaults to <tt>false</tt>).
+     */
+    /**
+     * @cfg {String/Object} autoCreate <p>A {@link Ext.DomHelper DomHelper} element spec, or <tt>true</tt> for a default
+     * element spec. Used to create the {@link Ext.Component#getEl Element} which will encapsulate this Component.
+     * See <tt>{@link Ext.Component#autoEl autoEl}</tt> for details.  Defaults to:</p>
+     * <pre><code>{tag: "input", type: "text", size: "24", autocomplete: "off"}</code></pre>
+     */
+    /**
+     * @cfg {Ext.data.Store/Array} store The data source to which this combo is bound (defaults to <tt>undefined</tt>).
+     * Acceptable values for this property are:
+     * <div class="mdetail-params"><ul>
+     * <li><b>any {@link Ext.data.Store Store} subclass</b></li>
+     * <li><b>an Array</b> : Arrays will be converted to a {@link Ext.data.ArrayStore} internally.
+     * <div class="mdetail-params"><ul>
+     * <li><b>1-dimensional array</b> : (e.g., <tt>['Foo','Bar']</tt>)<div class="sub-desc">
+     * A 1-dimensional array will automatically be expanded (each array item will be the combo
+     * {@link #valueField value} and {@link #displayField text})</div></li>
+     * <li><b>2-dimensional array</b> : (e.g., <tt>[['f','Foo'],['b','Bar']]</tt>)<div class="sub-desc">
+     * For a multi-dimensional array, the value in index 0 of each item will be assumed to be the combo
+     * {@link #valueField value}, while the value at index 1 is assumed to be the combo {@link #displayField text}.
+     * </div></li></ul></div></li></ul></div>
+     * <p>See also <tt>{@link #mode}</tt>.</p>
+     */
+    /**
+     * @cfg {String} title If supplied, a header element is created containing this text and added into the top of
+     * the dropdown list (defaults to undefined, with no header element)
+     */
+
+    // private
+    defaultAutoCreate : {tag: "input", type: "text", size: "24", autocomplete: "off"},
+    /**
+     * @cfg {Number} listWidth The width (used as a parameter to {@link Ext.Element#setWidth}) of the dropdown
+     * list (defaults to the width of the ComboBox field).  See also <tt>{@link #minListWidth}
+     */
+    /**
+     * @cfg {String} displayField The underlying {@link Ext.data.Field#name data field name} to bind to this
+     * ComboBox (defaults to undefined if <tt>{@link #mode} = 'remote'</tt> or <tt>'text'</tt> if
+     * {@link #transform transforming a select} a select).
+     * <p>See also <tt>{@link #valueField}</tt>.</p>
+     * <p><b>Note</b>: if using a ComboBox in an {@link Ext.grid.EditorGridPanel Editor Grid} a
+     * {@link Ext.grid.Column#renderer renderer} will be needed to show the displayField when the editor is not
+     * active.</p>
+     */
+    /**
+     * @cfg {String} valueField The underlying {@link Ext.data.Field#name data value name} to bind to this
+     * ComboBox (defaults to undefined if <tt>{@link #mode} = 'remote'</tt> or <tt>'value'</tt> if
+     * {@link #transform transforming a select}).
+     * <p><b>Note</b>: use of a <tt>valueField</tt> requires the user to make a selection in order for a value to be
+     * mapped.  See also <tt>{@link #hiddenName}</tt>, <tt>{@link #hiddenValue}</tt>, and <tt>{@link #displayField}</tt>.</p>
+     */
+    /**
+     * @cfg {String} hiddenName If specified, a hidden form field with this name is dynamically generated to store the
+     * field's data value (defaults to the underlying DOM element's name). Required for the combo's value to automatically
+     * post during a form submission.  See also {@link #valueField}.
+     * <p><b>Note</b>: the hidden field's id will also default to this name if {@link #hiddenId} is not specified.
+     * The ComboBox {@link Ext.Component#id id} and the <tt>{@link #hiddenId}</tt> <b>should be different</b>, since
+     * no two DOM nodes should share the same id.  So, if the ComboBox <tt>{@link Ext.form.Field#name name}</tt> and
+     * <tt>hiddenName</tt> are the same, you should specify a unique <tt>{@link #hiddenId}</tt>.</p>
+     */
+    /**
+     * @cfg {String} hiddenId If <tt>{@link #hiddenName}</tt> is specified, <tt>hiddenId</tt> can also be provided
+     * to give the hidden field a unique id (defaults to the <tt>{@link #hiddenName}</tt>).  The <tt>hiddenId</tt>
+     * and combo {@link Ext.Component#id id} should be different, since no two DOM
+     * nodes should share the same id.
+     */
+    /**
+     * @cfg {String} hiddenValue Sets the initial value of the hidden field if {@link #hiddenName} is
+     * specified to contain the selected {@link #valueField}, from the Store. Defaults to the configured
+     * <tt>{@link Ext.form.Field#value value}</tt>.
+     */
+    /**
+     * @cfg {String} listClass The CSS class to add to the predefined <tt>'x-combo-list'</tt> class
+     * applied the dropdown list element (defaults to '').
+     */
+    listClass : '',
+    /**
+     * @cfg {String} selectedClass CSS class to apply to the selected item in the dropdown list
+     * (defaults to <tt>'x-combo-selected'</tt>)
+     */
+    selectedClass : 'x-combo-selected',
+    /**
+     * @cfg {String} listEmptyText The empty text to display in the data view if no items are found.
+     * (defaults to '')
+     */
+    listEmptyText: '',
+    /**
+     * @cfg {String} triggerClass An additional CSS class used to style the trigger button.  The trigger will always
+     * get the class <tt>'x-form-trigger'</tt> and <tt>triggerClass</tt> will be <b>appended</b> if specified
+     * (defaults to <tt>'x-form-arrow-trigger'</tt> which displays a downward arrow icon).
+     */
+    triggerClass : 'x-form-arrow-trigger',
+    /**
+     * @cfg {Boolean/String} shadow <tt>true</tt> or <tt>"sides"</tt> for the default effect, <tt>"frame"</tt> for
+     * 4-way shadow, and <tt>"drop"</tt> for bottom-right
+     */
+    shadow : 'sides',
+    /**
+     * @cfg {String} listAlign A valid anchor position value. See <tt>{@link Ext.Element#alignTo}</tt> for details
+     * on supported anchor positions (defaults to <tt>'tl-bl?'</tt>)
+     */
+    listAlign : 'tl-bl?',
+    /**
+     * @cfg {Number} maxHeight The maximum height in pixels of the dropdown list before scrollbars are shown
+     * (defaults to <tt>300</tt>)
+     */
+    maxHeight : 300,
+    /**
+     * @cfg {Number} minHeight The minimum height in pixels of the dropdown list when the list is constrained by its
+     * distance to the viewport edges (defaults to <tt>90</tt>)
+     */
+    minHeight : 90,
+    /**
+     * @cfg {String} triggerAction The action to execute when the trigger is clicked.
+     * <div class="mdetail-params"><ul>
+     * <li><b><tt>'query'</tt></b> : <b>Default</b>
+     * <p class="sub-desc">{@link #doQuery run the query} using the {@link Ext.form.Field#getRawValue raw value}.</p></li>
+     * <li><b><tt>'all'</tt></b> :
+     * <p class="sub-desc">{@link #doQuery run the query} specified by the <tt>{@link #allQuery}</tt> config option</p></li>
+     * </ul></div>
+     * <p>See also <code>{@link #queryParam}</code>.</p>
+     */
+    triggerAction : 'query',
+    /**
+     * @cfg {Number} minChars The minimum number of characters the user must type before autocomplete and
+     * {@link #typeAhead} activate (defaults to <tt>4</tt> if <tt>{@link #mode} = 'remote'</tt> or <tt>0</tt> if
+     * <tt>{@link #mode} = 'local'</tt>, does not apply if
+     * <tt>{@link Ext.form.TriggerField#editable editable} = false</tt>).
+     */
+    minChars : 4,
+    /**
+     * @cfg {Boolean} typeAhead <tt>true</tt> to populate and autoselect the remainder of the text being
+     * typed after a configurable delay ({@link #typeAheadDelay}) if it matches a known value (defaults
+     * to <tt>false</tt>)
+     */
+    typeAhead : false,
+    /**
+     * @cfg {Number} queryDelay The length of time in milliseconds to delay between the start of typing and
+     * sending the query to filter the dropdown list (defaults to <tt>500</tt> if <tt>{@link #mode} = 'remote'</tt>
+     * or <tt>10</tt> if <tt>{@link #mode} = 'local'</tt>)
+     */
+    queryDelay : 500,
+    /**
+     * @cfg {Number} pageSize If greater than <tt>0</tt>, a {@link Ext.PagingToolbar} is displayed in the
+     * footer of the dropdown list and the {@link #doQuery filter queries} will execute with page start and
+     * {@link Ext.PagingToolbar#pageSize limit} parameters. Only applies when <tt>{@link #mode} = 'remote'</tt>
+     * (defaults to <tt>0</tt>).
+     */
+    pageSize : 0,
+    /**
+     * @cfg {Boolean} selectOnFocus <tt>true</tt> to select any existing text in the field immediately on focus.
+     * Only applies when <tt>{@link Ext.form.TriggerField#editable editable} = true</tt> (defaults to
+     * <tt>false</tt>).
+     */
+    selectOnFocus : false,
+    /**
+     * @cfg {String} queryParam Name of the query ({@link Ext.data.Store#baseParam baseParam} name for the store)
+     * as it will be passed on the querystring (defaults to <tt>'query'</tt>)
+     */
+    queryParam : 'query',
+    /**
+     * @cfg {String} loadingText The text to display in the dropdown list while data is loading.  Only applies
+     * when <tt>{@link #mode} = 'remote'</tt> (defaults to <tt>'Loading...'</tt>)
+     */
+    loadingText : 'Loading...',
+    /**
+     * @cfg {Boolean} resizable <tt>true</tt> to add a resize handle to the bottom of the dropdown list
+     * (creates an {@link Ext.Resizable} with 'se' {@link Ext.Resizable#pinned pinned} handles).
+     * Defaults to <tt>false</tt>.
+     */
+    resizable : false,
+    /**
+     * @cfg {Number} handleHeight The height in pixels of the dropdown list resize handle if
+     * <tt>{@link #resizable} = true</tt> (defaults to <tt>8</tt>)
+     */
+    handleHeight : 8,
+    /**
+     * @cfg {String} allQuery The text query to send to the server to return all records for the list
+     * with no filtering (defaults to '')
+     */
+    allQuery: '',
+    /**
+     * @cfg {String} mode Acceptable values are:
+     * <div class="mdetail-params"><ul>
+     * <li><b><tt>'remote'</tt></b> : <b>Default</b>
+     * <p class="sub-desc">Automatically loads the <tt>{@link #store}</tt> the <b>first</b> time the trigger
+     * is clicked. If you do not want the store to be automatically loaded the first time the trigger is
+     * clicked, set to <tt>'local'</tt> and manually load the store.  To force a requery of the store
+     * <b>every</b> time the trigger is clicked see <tt>{@link #lastQuery}</tt>.</p></li>
+     * <li><b><tt>'local'</tt></b> :
+     * <p class="sub-desc">ComboBox loads local data</p>
+     * <pre><code>
+var combo = new Ext.form.ComboBox({
+    renderTo: document.body,
+    mode: 'local',
+    store: new Ext.data.ArrayStore({
+        id: 0,
+        fields: [
+            'myId',  // numeric value is the key
+            'displayText'
+        ],
+        data: [[1, 'item1'], [2, 'item2']]  // data is local
+    }),
+    valueField: 'myId',
+    displayField: 'displayText',
+    triggerAction: 'all'
+});
+     * </code></pre></li>
+     * </ul></div>
+     */
+    mode: 'remote',
+    /**
+     * @cfg {Number} minListWidth The minimum width of the dropdown list in pixels (defaults to <tt>70</tt>, will
+     * be ignored if <tt>{@link #listWidth}</tt> has a higher value)
+     */
+    minListWidth : 70,
+    /**
+     * @cfg {Boolean} forceSelection <tt>true</tt> to restrict the selected value to one of the values in the list,
+     * <tt>false</tt> to allow the user to set arbitrary text into the field (defaults to <tt>false</tt>)
+     */
+    forceSelection : false,
+    /**
+     * @cfg {Number} typeAheadDelay The length of time in milliseconds to wait until the typeahead text is displayed
+     * if <tt>{@link #typeAhead} = true</tt> (defaults to <tt>250</tt>)
+     */
+    typeAheadDelay : 250,
+    /**
+     * @cfg {String} valueNotFoundText When using a name/value combo, if the value passed to setValue is not found in
+     * the store, valueNotFoundText will be displayed as the field text if defined (defaults to undefined). If this
+     * default text is used, it means there is no value set and no validation will occur on this field.
+     */
+
+    /**
+     * @cfg {Boolean} lazyInit <tt>true</tt> to not initialize the list for this combo until the field is focused
+     * (defaults to <tt>true</tt>)
+     */
+    lazyInit : true,
+
+    /**
+     * The value of the match string used to filter the store. Delete this property to force a requery.
+     * Example use:
+     * <pre><code>
+var combo = new Ext.form.ComboBox({
+    ...
+    mode: 'remote',
+    ...
+    listeners: {
+        // delete the previous query in the beforequery event or set
+        // combo.lastQuery = null (this will reload the store the next time it expands)
+        beforequery: function(qe){
+            delete qe.combo.lastQuery;
+        }
+    }
+});
+     * </code></pre>
+     * To make sure the filter in the store is not cleared the first time the ComboBox trigger is used
+     * configure the combo with <tt>lastQuery=''</tt>. Example use:
+     * <pre><code>
+var combo = new Ext.form.ComboBox({
+    ...
+    mode: 'local',
+    triggerAction: 'all',
+    lastQuery: ''
+});
+     * </code></pre>
+     * @property lastQuery
+     * @type String
+     */
+
+    // private
+    initComponent : function(){
+        Ext.form.ComboBox.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event expand
+             * Fires when the dropdown list is expanded
+             * @param {Ext.form.ComboBox} combo This combo box
+             */
+            'expand',
+            /**
+             * @event collapse
+             * Fires when the dropdown list is collapsed
+             * @param {Ext.form.ComboBox} combo This combo box
+             */
+            'collapse',
+            /**
+             * @event beforeselect
+             * Fires before a list item is selected. Return false to cancel the selection.
+             * @param {Ext.form.ComboBox} combo This combo box
+             * @param {Ext.data.Record} record The data record returned from the underlying store
+             * @param {Number} index The index of the selected item in the dropdown list
+             */
+            'beforeselect',
+            /**
+             * @event select
+             * Fires when a list item is selected
+             * @param {Ext.form.ComboBox} combo This combo box
+             * @param {Ext.data.Record} record The data record returned from the underlying store
+             * @param {Number} index The index of the selected item in the dropdown list
+             */
+            'select',
+            /**
+             * @event beforequery
+             * Fires before all queries are processed. Return false to cancel the query or set the queryEvent's
+             * cancel property to true.
+             * @param {Object} queryEvent An object that has these properties:<ul>
+             * <li><code>combo</code> : Ext.form.ComboBox <div class="sub-desc">This combo box</div></li>
+             * <li><code>query</code> : String <div class="sub-desc">The query</div></li>
+             * <li><code>forceAll</code> : Boolean <div class="sub-desc">True to force "all" query</div></li>
+             * <li><code>cancel</code> : Boolean <div class="sub-desc">Set to true to cancel the query</div></li>
+             * </ul>
+             */
+            'beforequery'
+        );
+        if(this.transform){
+            var s = Ext.getDom(this.transform);
+            if(!this.hiddenName){
+                this.hiddenName = s.name;
+            }
+            if(!this.store){
+                this.mode = 'local';
+                var d = [], opts = s.options;
+                for(var i = 0, len = opts.length;i < len; i++){
+                    var o = opts[i],
+                        value = (o.hasAttribute ? o.hasAttribute('value') : o.getAttributeNode('value').specified) ? o.value : o.text;
+                    if(o.selected && Ext.isEmpty(this.value, true)) {
+                        this.value = value;
+                    }
+                    d.push([value, o.text]);
+                }
+                this.store = new Ext.data.ArrayStore({
+                    'id': 0,
+                    fields: ['value', 'text'],
+                    data : d,
+                    autoDestroy: true
+                });
+                this.valueField = 'value';
+                this.displayField = 'text';
+            }
+            s.name = Ext.id(); // wipe out the name in case somewhere else they have a reference
+            if(!this.lazyRender){
+                this.target = true;
+                this.el = Ext.DomHelper.insertBefore(s, this.autoCreate || this.defaultAutoCreate);
+                this.render(this.el.parentNode, s);
+                Ext.removeNode(s); // remove it
+            }else{
+                Ext.removeNode(s); // remove it
+            }
+        }
+        //auto-configure store from local array data
+        else if(this.store){
+            this.store = Ext.StoreMgr.lookup(this.store);
+            if(this.store.autoCreated){
+                this.displayField = this.valueField = 'field1';
+                if(!this.store.expandData){
+                    this.displayField = 'field2';
+                }
+                this.mode = 'local';
+            }
+        }
+
+        this.selectedIndex = -1;
+        if(this.mode == 'local'){
+            if(!Ext.isDefined(this.initialConfig.queryDelay)){
+                this.queryDelay = 10;
+            }
+            if(!Ext.isDefined(this.initialConfig.minChars)){
+                this.minChars = 0;
+            }
+        }
+    },
+
+    // private
+    onRender : function(ct, position){
+        Ext.form.ComboBox.superclass.onRender.call(this, ct, position);
+        if(this.hiddenName){
+            this.hiddenField = this.el.insertSibling({tag:'input', type:'hidden', name: this.hiddenName,
+                    id: (this.hiddenId||this.hiddenName)}, 'before', true);
+
+            // prevent input submission
+            this.el.dom.removeAttribute('name');
+        }
+        if(Ext.isGecko){
+            this.el.dom.setAttribute('autocomplete', 'off');
+        }
+
+        if(!this.lazyInit){
+            this.initList();
+        }else{
+            this.on('focus', this.initList, this, {single: true});
+        }
+    },
+
+    // private
+    initValue : function(){
+        Ext.form.ComboBox.superclass.initValue.call(this);
+        if(this.hiddenField){
+            this.hiddenField.value =
+                Ext.isDefined(this.hiddenValue) ? this.hiddenValue :
+                Ext.isDefined(this.value) ? this.value : '';
+        }
+    },
+
+    // private
+    initList : function(){
+        if(!this.list){
+            var cls = 'x-combo-list';
+
+            this.list = new Ext.Layer({
+                parentEl: this.getListParent(),
+                shadow: this.shadow,
+                cls: [cls, this.listClass].join(' '),
+                constrain:false
+            });
+
+            var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth);
+            this.list.setSize(lw, 0);
+            this.list.swallowEvent('mousewheel');
+            this.assetHeight = 0;
+            if(this.syncFont !== false){
+                this.list.setStyle('font-size', this.el.getStyle('font-size'));
+            }
+            if(this.title){
+                this.header = this.list.createChild({cls:cls+'-hd', html: this.title});
+                this.assetHeight += this.header.getHeight();
+            }
+
+            this.innerList = this.list.createChild({cls:cls+'-inner'});
+            this.mon(this.innerList, 'mouseover', this.onViewOver, this);
+            this.mon(this.innerList, 'mousemove', this.onViewMove, this);
+            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
+
+            if(this.pageSize){
+                this.footer = this.list.createChild({cls:cls+'-ft'});
+                this.pageTb = new Ext.PagingToolbar({
+                    store: this.store,
+                    pageSize: this.pageSize,
+                    renderTo:this.footer
+                });
+                this.assetHeight += this.footer.getHeight();
+            }
+
+            if(!this.tpl){
+                /**
+                * @cfg {String/Ext.XTemplate} tpl <p>The template string, or {@link Ext.XTemplate} instance to
+                * use to display each item in the dropdown list. The dropdown list is displayed in a
+                * DataView. See {@link #view}.</p>
+                * <p>The default template string is:</p><pre><code>
+                  '&lt;tpl for=".">&lt;div class="x-combo-list-item">{' + this.displayField + '}&lt;/div>&lt;/tpl>'
+                * </code></pre>
+                * <p>Override the default value to create custom UI layouts for items in the list.
+                * For example:</p><pre><code>
+                  '&lt;tpl for=".">&lt;div ext:qtip="{state}. {nick}" class="x-combo-list-item">{state}&lt;/div>&lt;/tpl>'
+                * </code></pre>
+                * <p>The template <b>must</b> contain one or more substitution parameters using field
+                * names from the Combo's</b> {@link #store Store}. In the example above an
+                * <pre>ext:qtip</pre> attribute is added to display other fields from the Store.</p>
+                * <p>To preserve the default visual look of list items, add the CSS class name
+                * <pre>x-combo-list-item</pre> to the template's container element.</p>
+                * <p>Also see {@link #itemSelector} for additional details.</p>
+                */
+                this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>';
+                /**
+                 * @cfg {String} itemSelector
+                 * <p>A simple CSS selector (e.g. div.some-class or span:first-child) that will be
+                 * used to determine what nodes the {@link #view Ext.DataView} which handles the dropdown
+                 * display will be working with.</p>
+                 * <p><b>Note</b>: this setting is <b>required</b> if a custom XTemplate has been
+                 * specified in {@link #tpl} which assigns a class other than <pre>'x-combo-list-item'</pre>
+                 * to dropdown list items</b>
+                 */
+            }
+
+            /**
+            * The {@link Ext.DataView DataView} used to display the ComboBox's options.
+            * @type Ext.DataView
+            */
+            this.view = new Ext.DataView({
+                applyTo: this.innerList,
+                tpl: this.tpl,
+                singleSelect: true,
+                selectedClass: this.selectedClass,
+                itemSelector: this.itemSelector || '.' + cls + '-item',
+                emptyText: this.listEmptyText
+            });
+
+            this.mon(this.view, 'click', this.onViewClick, this);
+
+            this.bindStore(this.store, true);
+
+            if(this.resizable){
+                this.resizer = new Ext.Resizable(this.list,  {
+                   pinned:true, handles:'se'
+                });
+                this.mon(this.resizer, 'resize', function(r, w, h){
+                    this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight;
+                    this.listWidth = w;
+                    this.innerList.setWidth(w - this.list.getFrameWidth('lr'));
+                    this.restrictHeight();
+                }, this);
+
+                this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px');
+            }
+        }
+    },
+
+    /**
+     * <p>Returns the element used to house this ComboBox's pop-up list. Defaults to the document body.</p>
+     * A custom implementation may be provided as a configuration option if the floating list needs to be rendered
+     * to a different Element. An example might be rendering the list inside a Menu so that clicking
+     * the list does not hide the Menu:<pre><code>
+var store = new Ext.data.ArrayStore({
+    autoDestroy: true,
+    fields: ['initials', 'fullname'],
+    data : [
+        ['FF', 'Fred Flintstone'],
+        ['BR', 'Barney Rubble']
+    ]
+});
+
+var combo = new Ext.form.ComboBox({
+    store: store,
+    displayField: 'fullname',
+    emptyText: 'Select a name...',
+    forceSelection: true,
+    getListParent: function() {
+        return this.el.up('.x-menu');
+    },
+    iconCls: 'no-icon', //use iconCls if placing within menu to shift to right side of menu
+    mode: 'local',
+    selectOnFocus: true,
+    triggerAction: 'all',
+    typeAhead: true,
+    width: 135
+});
+
+var menu = new Ext.menu.Menu({
+    id: 'mainMenu',
+    items: [
+        combo // A Field in a Menu
+    ]
+});
+</code></pre>
+     */
+    getListParent : function() {
+        return document.body;
+    },
+
+    /**
+     * Returns the store associated with this combo.
+     * @return {Ext.data.Store} The store
+     */
+    getStore : function(){
+        return this.store;
+    },
+
+    // private
+    bindStore : function(store, initial){
+        if(this.store && !initial){
+            this.store.un('beforeload', this.onBeforeLoad, this);
+            this.store.un('load', this.onLoad, this);
+            this.store.un('exception', this.collapse, this);
+            if(this.store !== store && this.store.autoDestroy){
+                this.store.destroy();
+            }
+            if(!store){
+                this.store = null;
+                if(this.view){
+                    this.view.bindStore(null);
+                }
+            }
+        }
+        if(store){
+            if(!initial) {
+                this.lastQuery = null;
+                if(this.pageTb) {
+                    this.pageTb.bindStore(store);
+                }
+            }
+
+            this.store = Ext.StoreMgr.lookup(store);
+            this.store.on({
+                scope: this,
+                beforeload: this.onBeforeLoad,
+                load: this.onLoad,
+                exception: this.collapse
+            });
+
+            if(this.view){
+                this.view.bindStore(store);
+            }
+        }
+    },
+
+    // private
+    initEvents : function(){
+        Ext.form.ComboBox.superclass.initEvents.call(this);
+
+        this.keyNav = new Ext.KeyNav(this.el, {
+            "up" : function(e){
+                this.inKeyMode = true;
+                this.selectPrev();
+            },
+
+            "down" : function(e){
+                if(!this.isExpanded()){
+                    this.onTriggerClick();
+                }else{
+                    this.inKeyMode = true;
+                    this.selectNext();
+                }
+            },
+
+            "enter" : function(e){
+                this.onViewClick();
+                this.delayedCheck = true;
+                this.unsetDelayCheck.defer(10, this);
+            },
+
+            "esc" : function(e){
+                this.collapse();
+            },
+
+            "tab" : function(e){
+                this.onViewClick(false);
+                return true;
+            },
+
+            scope : this,
+
+            doRelay : function(foo, bar, hname){
+                if(hname == 'down' || this.scope.isExpanded()){
+                   return Ext.KeyNav.prototype.doRelay.apply(this, arguments);
+                }
+                return true;
+            },
+
+            forceKeyDown : true
+        });
+        this.queryDelay = Math.max(this.queryDelay || 10,
+                this.mode == 'local' ? 10 : 250);
+        this.dqTask = new Ext.util.DelayedTask(this.initQuery, this);
+        if(this.typeAhead){
+            this.taTask = new Ext.util.DelayedTask(this.onTypeAhead, this);
+        }
+        if(this.editable !== false && !this.enableKeyEvents){
+            this.mon(this.el, 'keyup', this.onKeyUp, this);
+        }
+    },
+
+    // private
+    onDestroy : function(){
+        if (this.dqTask){
+            this.dqTask.cancel();
+            this.dqTask = null;
+        }
+        this.bindStore(null);
+        Ext.destroy(
+            this.resizer,
+            this.view,
+            this.pageTb,
+            this.list
+        );
+        Ext.form.ComboBox.superclass.onDestroy.call(this);
+    },
+
+    // private
+    unsetDelayCheck : function(){
+        delete this.delayedCheck;
+    },
+
+    // private
+    fireKey : function(e){
+        var fn = function(ev){
+            if (ev.isNavKeyPress() && !this.isExpanded() && !this.delayedCheck) {
+                this.fireEvent("specialkey", this, ev);
+            }
+        };
+        //For some reason I can't track down, the events fire in a different order in webkit.
+        //Need a slight delay here
+        if(this.inEditor && Ext.isWebKit && e.getKey() == e.TAB){
+            fn.defer(10, this, [new Ext.EventObjectImpl(e)]);
+        }else{
+            fn.call(this, e);
+        }
+    },
+
+    // private
+    onResize : function(w, h){
+        Ext.form.ComboBox.superclass.onResize.apply(this, arguments);
+        if(this.list && !Ext.isDefined(this.listWidth)){
+            var lw = Math.max(w, this.minListWidth);
+            this.list.setWidth(lw);
+            this.innerList.setWidth(lw - this.list.getFrameWidth('lr'));
+        }
+    },
+
+    // private
+    onEnable : function(){
+        Ext.form.ComboBox.superclass.onEnable.apply(this, arguments);
+        if(this.hiddenField){
+            this.hiddenField.disabled = false;
+        }
+    },
+
+    // private
+    onDisable : function(){
+        Ext.form.ComboBox.superclass.onDisable.apply(this, arguments);
+        if(this.hiddenField){
+            this.hiddenField.disabled = true;
+        }
+    },
+
+    // private
+    onBeforeLoad : function(){
+        if(!this.hasFocus){
+            return;
+        }
+        this.innerList.update(this.loadingText ?
+               '<div class="loading-indicator">'+this.loadingText+'</div>' : '');
+        this.restrictHeight();
+        this.selectedIndex = -1;
+    },
+
+    // private
+    onLoad : function(){
+        if(!this.hasFocus){
+            return;
+        }
+        if(this.store.getCount() > 0){
+            this.expand();
+            this.restrictHeight();
+            if(this.lastQuery == this.allQuery){
+                if(this.editable){
+                    this.el.dom.select();
+                }
+                if(!this.selectByValue(this.value, true)){
+                    this.select(0, true);
+                }
+            }else{
+                this.selectNext();
+                if(this.typeAhead && this.lastKey != Ext.EventObject.BACKSPACE && this.lastKey != Ext.EventObject.DELETE){
+                    this.taTask.delay(this.typeAheadDelay);
+                }
+            }
+        }else{
+            this.onEmptyResults();
+        }
+        //this.el.focus();
+    },
+
+    // private
+    onTypeAhead : function(){
+        if(this.store.getCount() > 0){
+            var r = this.store.getAt(0);
+            var newValue = r.data[this.displayField];
+            var len = newValue.length;
+            var selStart = this.getRawValue().length;
+            if(selStart != len){
+                this.setRawValue(newValue);
+                this.selectText(selStart, newValue.length);
+            }
+        }
+    },
+
+    // private
+    onSelect : function(record, index){
+        if(this.fireEvent('beforeselect', this, record, index) !== false){
+            this.setValue(record.data[this.valueField || this.displayField]);
+            this.collapse();
+            this.fireEvent('select', this, record, index);
+        }
+    },
+
+    // inherit docs
+    getName: function(){
+        var hf = this.hiddenField;
+        return hf && hf.name ? hf.name : this.hiddenName || Ext.form.ComboBox.superclass.getName.call(this);
+    },
+
+    /**
+     * Returns the currently selected field value or empty string if no value is set.
+     * @return {String} value The selected value
+     */
+    getValue : function(){
+        if(this.valueField){
+            return Ext.isDefined(this.value) ? this.value : '';
+        }else{
+            return Ext.form.ComboBox.superclass.getValue.call(this);
+        }
+    },
+
+    /**
+     * Clears any text/value currently set in the field
+     */
+    clearValue : function(){
+        if(this.hiddenField){
+            this.hiddenField.value = '';
+        }
+        this.setRawValue('');
+        this.lastSelectionText = '';
+        this.applyEmptyText();
+        this.value = '';
+    },
+
+    /**
+     * Sets the specified value into the field.  If the value finds a match, the corresponding record text
+     * will be displayed in the field.  If the value does not match the data value of an existing item,
+     * and the valueNotFoundText config option is defined, it will be displayed as the default field text.
+     * Otherwise the field will be blank (although the value will still be set).
+     * @param {String} value The value to match
+     * @return {Ext.form.Field} this
+     */
+    setValue : function(v){
+        var text = v;
+        if(this.valueField){
+            var r = this.findRecord(this.valueField, v);
+            if(r){
+                text = r.data[this.displayField];
+            }else if(Ext.isDefined(this.valueNotFoundText)){
+                text = this.valueNotFoundText;
+            }
+        }
+        this.lastSelectionText = text;
+        if(this.hiddenField){
+            this.hiddenField.value = v;
+        }
+        Ext.form.ComboBox.superclass.setValue.call(this, text);
+        this.value = v;
+        return this;
+    },
+
+    // private
+    findRecord : function(prop, value){
+        var record;
+        if(this.store.getCount() > 0){
+            this.store.each(function(r){
+                if(r.data[prop] == value){
+                    record = r;
+                    return false;
+                }
+            });
+        }
+        return record;
+    },
+
+    // private
+    onViewMove : function(e, t){
+        this.inKeyMode = false;
+    },
+
+    // private
+    onViewOver : function(e, t){
+        if(this.inKeyMode){ // prevent key nav and mouse over conflicts
+            return;
+        }
+        var item = this.view.findItemFromChild(t);
+        if(item){
+            var index = this.view.indexOf(item);
+            this.select(index, false);
+        }
+    },
+
+    // private
+    onViewClick : function(doFocus){
+        var index = this.view.getSelectedIndexes()[0];
+        var r = this.store.getAt(index);
+        if(r){
+            this.onSelect(r, index);
+        }
+        if(doFocus !== false){
+            this.el.focus();
+        }
+    },
+
+    // private
+    restrictHeight : function(){
+        this.innerList.dom.style.height = '';
+        var inner = this.innerList.dom;
+        var pad = this.list.getFrameWidth('tb')+(this.resizable?this.handleHeight:0)+this.assetHeight;
+        var h = Math.max(inner.clientHeight, inner.offsetHeight, inner.scrollHeight);
+        var ha = this.getPosition()[1]-Ext.getBody().getScroll().top;
+        var hb = Ext.lib.Dom.getViewHeight()-ha-this.getSize().height;
+        var space = Math.max(ha, hb, this.minHeight || 0)-this.list.shadowOffset-pad-5;
+        h = Math.min(h, space, this.maxHeight);
+
+        this.innerList.setHeight(h);
+        this.list.beginUpdate();
+        this.list.setHeight(h+pad);
+        this.list.alignTo(this.wrap, this.listAlign);
+        this.list.endUpdate();
+    },
+
+    // private
+    onEmptyResults : function(){
+        this.collapse();
+    },
+
+    /**
+     * Returns true if the dropdown list is expanded, else false.
+     */
+    isExpanded : function(){
+        return this.list && this.list.isVisible();
+    },
+
+    /**
+     * Select an item in the dropdown list by its data value. This function does NOT cause the select event to fire.
+     * The store must be loaded and the list expanded for this function to work, otherwise use setValue.
+     * @param {String} value The data value of the item to select
+     * @param {Boolean} scrollIntoView False to prevent the dropdown list from autoscrolling to display the
+     * selected item if it is not currently in view (defaults to true)
+     * @return {Boolean} True if the value matched an item in the list, else false
+     */
+    selectByValue : function(v, scrollIntoView){
+        if(!Ext.isEmpty(v, true)){
+            var r = this.findRecord(this.valueField || this.displayField, v);
+            if(r){
+                this.select(this.store.indexOf(r), scrollIntoView);
+                return true;
+            }
+        }
+        return false;
+    },
+
+    /**
+     * Select an item in the dropdown list by its numeric index in the list. This function does NOT cause the select event to fire.
+     * The store must be loaded and the list expanded for this function to work, otherwise use setValue.
+     * @param {Number} index The zero-based index of the list item to select
+     * @param {Boolean} scrollIntoView False to prevent the dropdown list from autoscrolling to display the
+     * selected item if it is not currently in view (defaults to true)
+     */
+    select : function(index, scrollIntoView){
+        this.selectedIndex = index;
+        this.view.select(index);
+        if(scrollIntoView !== false){
+            var el = this.view.getNode(index);
+            if(el){
+                this.innerList.scrollChildIntoView(el, false);
+            }
+        }
+    },
+
+    // private
+    selectNext : function(){
+        var ct = this.store.getCount();
+        if(ct > 0){
+            if(this.selectedIndex == -1){
+                this.select(0);
+            }else if(this.selectedIndex < ct-1){
+                this.select(this.selectedIndex+1);
+            }
+        }
+    },
+
+    // private
+    selectPrev : function(){
+        var ct = this.store.getCount();
+        if(ct > 0){
+            if(this.selectedIndex == -1){
+                this.select(0);
+            }else if(this.selectedIndex !== 0){
+                this.select(this.selectedIndex-1);
+            }
+        }
+    },
+
+    // private
+    onKeyUp : function(e){
+        var k = e.getKey();
+        if(this.editable !== false && (k == e.BACKSPACE || !e.isSpecialKey())){
+            this.lastKey = k;
+            this.dqTask.delay(this.queryDelay);
+        }
+        Ext.form.ComboBox.superclass.onKeyUp.call(this, e);
+    },
+
+    // private
+    validateBlur : function(){
+        return !this.list || !this.list.isVisible();
+    },
+
+    // private
+    initQuery : function(){
+        this.doQuery(this.getRawValue());
+    },
+
+    // private
+    beforeBlur : function(){
+        var val = this.getRawValue();
+        if(this.forceSelection){
+            if(val.length > 0 && val != this.emptyText){
+               this.el.dom.value = Ext.isDefined(this.lastSelectionText) ? this.lastSelectionText : '';
+                this.applyEmptyText();
+            }else{
+                this.clearValue();
+            }
+        }else{
+            var rec = this.findRecord(this.displayField, val);
+            if(rec){
+                val = rec.get(this.valueField || this.displayField);
+            }
+            this.setValue(val);
+        }
+    },
+
+    /**
+     * Execute a query to filter the dropdown list.  Fires the {@link #beforequery} event prior to performing the
+     * query allowing the query action to be canceled if needed.
+     * @param {String} query The SQL query to execute
+     * @param {Boolean} forceAll <tt>true</tt> to force the query to execute even if there are currently fewer
+     * characters in the field than the minimum specified by the <tt>{@link #minChars}</tt> config option.  It
+     * also clears any filter previously saved in the current store (defaults to <tt>false</tt>)
+     */
+    doQuery : function(q, forceAll){
+        q = Ext.isEmpty(q) ? '' : q;
+        var qe = {
+            query: q,
+            forceAll: forceAll,
+            combo: this,
+            cancel:false
+        };
+        if(this.fireEvent('beforequery', qe)===false || qe.cancel){
+            return false;
+        }
+        q = qe.query;
+        forceAll = qe.forceAll;
+        if(forceAll === true || (q.length >= this.minChars)){
+            if(this.lastQuery !== q){
+                this.lastQuery = q;
+                if(this.mode == 'local'){
+                    this.selectedIndex = -1;
+                    if(forceAll){
+                        this.store.clearFilter();
+                    }else{
+                        this.store.filter(this.displayField, q);
+                    }
+                    this.onLoad();
+                }else{
+                    this.store.baseParams[this.queryParam] = q;
+                    this.store.load({
+                        params: this.getParams(q)
+                    });
+                    this.expand();
+                }
+            }else{
+                this.selectedIndex = -1;
+                this.onLoad();
+            }
+        }
+    },
+
+    // private
+    getParams : function(q){
+        var p = {};
+        //p[this.queryParam] = q;
+        if(this.pageSize){
+            p.start = 0;
+            p.limit = this.pageSize;
+        }
+        return p;
+    },
+
+    /**
+     * Hides the dropdown list if it is currently expanded. Fires the {@link #collapse} event on completion.
+     */
+    collapse : function(){
+        if(!this.isExpanded()){
+            return;
+        }
+        this.list.hide();
+        Ext.getDoc().un('mousewheel', this.collapseIf, this);
+        Ext.getDoc().un('mousedown', this.collapseIf, this);
+        this.fireEvent('collapse', this);
+    },
+
+    // private
+    collapseIf : function(e){
+        if(!e.within(this.wrap) && !e.within(this.list)){
+            this.collapse();
+        }
+    },
+
+    /**
+     * Expands the dropdown list if it is currently hidden. Fires the {@link #expand} event on completion.
+     */
+    expand : function(){
+        if(this.isExpanded() || !this.hasFocus){
+            return;
+        }
+        this.list.alignTo(this.wrap, this.listAlign);
+        this.list.show();
+        if(Ext.isGecko2){
+            this.innerList.setOverflow('auto'); // necessary for FF 2.0/Mac
+        }
+        Ext.getDoc().on({
+            scope: this,
+            mousewheel: this.collapseIf,
+            mousedown: this.collapseIf
+        });
+        this.fireEvent('expand', this);
+    },
+
+    /**
+     * @method onTriggerClick
+     * @hide
+     */
+    // private
+    // Implements the default empty TriggerField.onTriggerClick function
+    onTriggerClick : function(){
+        if(this.disabled){
+            return;
+        }
+        if(this.isExpanded()){
+            this.collapse();
+            this.el.focus();
+        }else {
+            this.onFocus({});
+            if(this.triggerAction == 'all') {
+                this.doQuery(this.allQuery, true);
+            } else {
+                this.doQuery(this.getRawValue());
+            }
+            this.el.focus();
+        }
+    }
+
+    /**
+     * @hide
+     * @method autoSize
+     */
+    /**
+     * @cfg {Boolean} grow @hide
+     */
+    /**
+     * @cfg {Number} growMin @hide
+     */
+    /**
+     * @cfg {Number} growMax @hide
+     */
+
+});
+Ext.reg('combo', Ext.form.ComboBox);/**
+ * @class Ext.form.Checkbox
+ * @extends Ext.form.Field
+ * Single checkbox field.  Can be used as a direct replacement for traditional checkbox fields.
+ * @constructor
+ * Creates a new Checkbox
+ * @param {Object} config Configuration options
+ * @xtype checkbox
+ */
+Ext.form.Checkbox = Ext.extend(Ext.form.Field,  {
+    /**
+     * @cfg {String} focusClass The CSS class to use when the checkbox receives focus (defaults to undefined)
+     */
+    focusClass : undefined,
+    /**
+     * @cfg {String} fieldClass The default CSS class for the checkbox (defaults to 'x-form-field')
+     */
+    fieldClass : 'x-form-field',
+    /**
+     * @cfg {Boolean} checked <tt>true</tt> if the checkbox should render initially checked (defaults to <tt>false</tt>)
+     */
+    checked : false,
+    /**
+     * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
+     * {tag: 'input', type: 'checkbox', autocomplete: 'off'})
+     */
+    defaultAutoCreate : { tag: 'input', type: 'checkbox', autocomplete: 'off'},
+    /**
+     * @cfg {String} boxLabel The text that appears beside the checkbox
+     */
+    /**
+     * @cfg {String} inputValue The value that should go into the generated input element's value attribute
+     */
+    /**
+     * @cfg {Function} handler A function called when the {@link #checked} value changes (can be used instead of 
+     * handling the check event). The handler is passed the following parameters:
+     * <div class="mdetail-params"><ul>
+     * <li><b>checkbox</b> : Ext.form.Checkbox<div class="sub-desc">The Checkbox being toggled.</div></li>
+     * <li><b>checked</b> : Boolean<div class="sub-desc">The new checked state of the checkbox.</div></li>
+     * </ul></div>
+     */
+    /**
+     * @cfg {Object} scope An object to use as the scope ('this' reference) of the {@link #handler} function
+     * (defaults to this Checkbox).
+     */
+
+    // private
+    actionMode : 'wrap',
+    
+       // private
+    initComponent : function(){
+        Ext.form.Checkbox.superclass.initComponent.call(this);
+        this.addEvents(
+            /**
+             * @event check
+             * Fires when the checkbox is checked or unchecked.
+             * @param {Ext.form.Checkbox} this This checkbox
+             * @param {Boolean} checked The new checked value
+             */
+            'check'
+        );
+    },
+
+    // private
+    onResize : function(){
+        Ext.form.Checkbox.superclass.onResize.apply(this, arguments);
+        if(!this.boxLabel && !this.fieldLabel){
+            this.el.alignTo(this.wrap, 'c-c');
+        }
+    },
+
+    // private
+    initEvents : function(){
+        Ext.form.Checkbox.superclass.initEvents.call(this);
+        this.mon(this.el, 'click', this.onClick, this);
+        this.mon(this.el, 'change', this.onClick, this);
+    },
+
+       // private
+    getResizeEl : function(){
+        return this.wrap;
+    },
+
+    // private
+    getPositionEl : function(){
+        return this.wrap;
+    },
+
+    /**
+     * @hide
+     * Overridden and disabled. The editor element does not support standard valid/invalid marking.
+     * @method
+     */
+    markInvalid : Ext.emptyFn,
+    /**
+     * @hide
+     * Overridden and disabled. The editor element does not support standard valid/invalid marking.
+     * @method
+     */
+    clearInvalid : Ext.emptyFn,
+
+    // private
+    onRender : function(ct, position){
+        Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
+        if(this.inputValue !== undefined){
+            this.el.dom.value = this.inputValue;
+        }
+        this.wrap = this.el.wrap({cls: 'x-form-check-wrap'});
+        if(this.boxLabel){
+            this.wrap.createChild({tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel});
+        }
+        if(this.checked){
+            this.setValue(true);
+        }else{
+            this.checked = this.el.dom.checked;
+        }
+    },
+
+    // private
+    onDestroy : function(){
+        Ext.destroy(this.wrap);
+        Ext.form.Checkbox.superclass.onDestroy.call(this);
+    },
+
+    // private
+    initValue : function() {
+        this.originalValue = this.getValue();
+    },
+
+    /**
+     * Returns the checked state of the checkbox.
+     * @return {Boolean} True if checked, else false
+     */
+    getValue : function(){
+        if(this.rendered){
+            return this.el.dom.checked;
+        }
+        return false;
+    },
+
+       // private
+    onClick : function(){
+        if(this.el.dom.checked != this.checked){
+            this.setValue(this.el.dom.checked);
+        }
+    },
+
+    /**
+     * Sets the checked state of the checkbox, fires the 'check' event, and calls a
+     * <code>{@link #handler}</code> (if configured).
+     * @param {Boolean/String} checked The following values will check the checkbox:
+     * <code>true, 'true', '1', or 'on'</code>. Any other value will uncheck the checkbox.
+     * @return {Ext.form.Field} this
+     */
+    setValue : function(v){
+        var checked = this.checked ;
+        this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+        if(this.rendered){
+            this.el.dom.checked = this.checked;
+            this.el.dom.defaultChecked = this.checked;
+        }
+        if(checked != this.checked){
+            this.fireEvent('check', this, this.checked);
+            if(this.handler){
+                this.handler.call(this.scope || this, this, this.checked);
+            }
+        }
+        return this;
+    }
+});
+Ext.reg('checkbox', Ext.form.Checkbox);
+/**
+ * @class Ext.form.CheckboxGroup
+ * @extends Ext.form.Field
+ * <p>A grouping container for {@link Ext.form.Checkbox} controls.</p>
+ * <p>Sample usage:</p>
+ * <pre><code>
+var myCheckboxGroup = new Ext.form.CheckboxGroup({
+    id:'myGroup',
+    xtype: 'checkboxgroup',
+    fieldLabel: 'Single Column',
+    itemCls: 'x-check-group-alt',
+    // Put all controls in a single column with width 100%
+    columns: 1,
+    items: [
+        {boxLabel: 'Item 1', name: 'cb-col-1'},
+        {boxLabel: 'Item 2', name: 'cb-col-2', checked: true},
+        {boxLabel: 'Item 3', name: 'cb-col-3'}
+    ]
+});
+ * </code></pre>
+ * @constructor
+ * Creates a new CheckboxGroup
+ * @param {Object} config Configuration options
+ * @xtype checkboxgroup
+ */
+Ext.form.CheckboxGroup = Ext.extend(Ext.form.Field, {
+    /**
+     * @cfg {Array} items An Array of {@link Ext.form.Checkbox Checkbox}es or Checkbox config objects
+     * to arrange in the group.
+     */
+    /**
+     * @cfg {String/Number/Array} columns Specifies the number of columns to use when displaying grouped
+     * checkbox/radio controls using automatic layout.  This config can take several types of values:
+     * <ul><li><b>'auto'</b> : <p class="sub-desc">The controls will be rendered one per column on one row and the width
+     * of each column will be evenly distributed based on the width of the overall field container. This is the default.</p></li>
+     * <li><b>Number</b> : <p class="sub-desc">If you specific a number (e.g., 3) that number of columns will be 
+     * created and the contained controls will be automatically distributed based on the value of {@link #vertical}.</p></li>
+     * <li><b>Array</b> : Object<p class="sub-desc">You can also specify an array of column widths, mixing integer
+     * (fixed width) and float (percentage width) values as needed (e.g., [100, .25, .75]). Any integer values will
+     * be rendered first, then any float values will be calculated as a percentage of the remaining space. Float
+     * values do not have to add up to 1 (100%) although if you want the controls to take up the entire field
+     * container you should do so.</p></li></ul>
+     */
+    columns : 'auto',
+    /**
+     * @cfg {Boolean} vertical True to distribute contained controls across columns, completely filling each column 
+     * top to bottom before starting on the next column.  The number of controls in each column will be automatically
+     * calculated to keep columns as even as possible.  The default value is false, so that controls will be added
+     * to columns one at a time, completely filling each row left to right before starting on the next row.
+     */
+    vertical : false,
+    /**
+     * @cfg {Boolean} allowBlank False to validate that at least one item in the group is checked (defaults to true).
+     * If no items are selected at validation time, {@link @blankText} will be used as the error text.
+     */
+    allowBlank : true,
+    /**
+     * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails (defaults to "You must 
+     * select at least one item in this group")
+     */
+    blankText : "You must select at least one item in this group",
+    
+    // private
+    defaultType : 'checkbox',
+    
+    // private
+    groupCls : 'x-form-check-group',
+    
+    // private
+    initComponent: function(){
+        this.addEvents(
+            /**
+             * @event change
+             * Fires when the state of a child checkbox changes.
+             * @param {Ext.form.CheckboxGroup} this
+             * @param {Array} checked An array containing the checked boxes.
+             */
+            'change'
+        );   
+        Ext.form.CheckboxGroup.superclass.initComponent.call(this);
+    },
+    
+    // private
+    onRender : function(ct, position){
+        if(!this.el){
+            var panelCfg = {
+                cls: this.groupCls,
+                layout: 'column',
+                border: false,
+                renderTo: ct
+            };
+            var colCfg = {
+                defaultType: this.defaultType,
+                layout: 'form',
+                border: false,
+                defaults: {
+                    hideLabel: true,
+                    anchor: '100%'
+                }
+            };
+            
+            if(this.items[0].items){
+                
+                // The container has standard ColumnLayout configs, so pass them in directly
+                
+                Ext.apply(panelCfg, {
+                    layoutConfig: {columns: this.items.length},
+                    defaults: this.defaults,
+                    items: this.items
+                });
+                for(var i=0, len=this.items.length; i<len; i++){
+                    Ext.applyIf(this.items[i], colCfg);
+                }
+                
+            }else{
+                
+                // The container has field item configs, so we have to generate the column
+                // panels first then move the items into the columns as needed.
+                
+                var numCols, cols = [];
+                
+                if(typeof this.columns == 'string'){ // 'auto' so create a col per item
+                    this.columns = this.items.length;
+                }
+                if(!Ext.isArray(this.columns)){
+                    var cs = [];
+                    for(var i=0; i<this.columns; i++){
+                        cs.push((100/this.columns)*.01); // distribute by even %
+                    }
+                    this.columns = cs;
+                }
+                
+                numCols = this.columns.length;
+                
+                // Generate the column configs with the correct width setting
+                for(var i=0; i<numCols; i++){
+                    var cc = Ext.apply({items:[]}, colCfg);
+                    cc[this.columns[i] <= 1 ? 'columnWidth' : 'width'] = this.columns[i];
+                    if(this.defaults){
+                        cc.defaults = Ext.apply(cc.defaults || {}, this.defaults)
+                    }
+                    cols.push(cc);
+                };
+                
+                // Distribute the original items into the columns
+                if(this.vertical){
+                    var rows = Math.ceil(this.items.length / numCols), ri = 0;
+                    for(var i=0, len=this.items.length; i<len; i++){
+                        if(i>0 && i%rows==0){
+                            ri++;
+                        }
+                        if(this.items[i].fieldLabel){
+                            this.items[i].hideLabel = false;
+                        }
+                        cols[ri].items.push(this.items[i]);
+                    };
+                }else{
+                    for(var i=0, len=this.items.length; i<len; i++){
+                        var ci = i % numCols;
+                        if(this.items[i].fieldLabel){
+                            this.items[i].hideLabel = false;
+                        }
+                        cols[ci].items.push(this.items[i]);
+                    };
+                }
+                
+                Ext.apply(panelCfg, {
+                    layoutConfig: {columns: numCols},
+                    items: cols
+                });
+            }
+            
+            this.panel = new Ext.Panel(panelCfg);
+            this.panel.ownerCt = this;
+            this.el = this.panel.getEl();
+            
+            if(this.forId && this.itemCls){
+                var l = this.el.up(this.itemCls).child('label', true);
+                if(l){
+                    l.setAttribute('htmlFor', this.forId);
+                }
+            }
+            
+            var fields = this.panel.findBy(function(c){
+                return c.isFormField;
+            }, this);
+            
+            this.items = new Ext.util.MixedCollection();
+            this.items.addAll(fields);
+        }
+        Ext.form.CheckboxGroup.superclass.onRender.call(this, ct, position);
+    },
+    
+    afterRender : function(){
+        Ext.form.CheckboxGroup.superclass.afterRender.call(this);
+        if(this.values){
+            this.setValue.apply(this, this.values);
+            delete this.values;
+        }
+        this.eachItem(function(item){
+            item.on('check', this.fireChecked, this);
+            item.inGroup = true;
+        });
+    },
+    
+    // private
+    doLayout: function(){
+        //ugly method required to layout hidden items
+        if(this.rendered){
+            this.panel.forceLayout = this.ownerCt.forceLayout;
+            this.panel.doLayout();
+        }
+    },
+    
+    // private
+    fireChecked: function(){
+        var arr = [];
+        this.eachItem(function(item){
+            if(item.checked){
+                arr.push(item);
+            }
+        });
+        this.fireEvent('change', this, arr);
+    },
+    
+    // private
+    validateValue : function(value){
+        if(!this.allowBlank){
+            var blank = true;
+            this.eachItem(function(f){
+                if(f.checked){
+                    return (blank = false);
+                }
+            });
+            if(blank){
+                this.markInvalid(this.blankText);
+                return false;
+            }
+        }
+        return true;
+    },
+    
+    // private
+    onDisable : function(){
+        this.eachItem(function(item){
+            item.disable();
+        });
+    },
+
+    // private
+    onEnable : function(){
+        this.eachItem(function(item){
+            item.enable();
+        });
+    },
+    
+    // private
+    doLayout: function(){
+        if(this.rendered){
+            this.panel.forceLayout = this.ownerCt.forceLayout;
+            this.panel.doLayout();
+        }
+    },
+    
+    // private
+    onResize : function(w, h){
+        this.panel.setSize(w, h);
+        this.panel.doLayout();
+    },
+    
+    // inherit docs from Field
+    reset : function(){
+        Ext.form.CheckboxGroup.superclass.reset.call(this);
+        this.eachItem(function(c){
+            if(c.reset){
+                c.reset();
+            }
+        });
+    },
+    
+    /**
+     * {@link Ext.form.Checkbox#setValue Set the value(s)} of an item or items
+     * in the group. Examples illustrating how this method may be called:
+     * <pre><code>
+// call with name and value
+myCheckboxGroup.setValue('cb-col-1', true);
+// call with an array of boolean values 
+myCheckboxGroup.setValue([true, false, false]);
+// call with an object literal specifying item:value pairs
+myCheckboxGroup.setValue({
+    'cb-col-2': false,
+    'cb-col-3': true
+});
+// use comma separated string to set items with name to true (checked)
+myCheckboxGroup.setValue('cb-col-1,cb-col-3');
+     * </code></pre>
+     * See {@link Ext.form.Checkbox#setValue} for additional information.
+     * @param {Mixed} id The checkbox to check, or as described by example shown.
+     * @param {Boolean} value (optional) The value to set the item.
+     * @return {Ext.form.CheckboxGroup} this
+     */
+    setValue : function(id, value){
+        if(this.rendered){
+            if(arguments.length == 1){
+                if(Ext.isArray(id)){
+                    //an array of boolean values
+                    Ext.each(id, function(val, idx){
+                        var item = this.items.itemAt(idx);
+                        if(item){
+                            item.setValue(val);
+                        }
+                    }, this);
+                }else if(Ext.isObject(id)){
+                    //set of name/value pairs
+                    for(var i in id){
+                        var f = this.getBox(i);
+                        if(f){
+                            f.setValue(id[i]);
+                        }
+                    }
+                }else{
+                    this.setValueForItem(id);
+                }
+            }else{
+                var f = this.getBox(id);
+                if(f){
+                    f.setValue(value);
+                }
+            }
+        }else{
+            this.values = arguments;
+        }
+        return this;
+    },
+    
+    // private
+    onDestroy: function(){
+        Ext.destroy(this.panel);
+        Ext.form.CheckboxGroup.superclass.onDestroy.call(this);
+
+    },
+    
+    setValueForItem : function(val){
+        val = String(val).split(',');
+        this.eachItem(function(item){
+            if(val.indexOf(item.inputValue)> -1){
+                item.setValue(true);
+            }
+        });
+    },
+    
+    // private
+    getBox : function(id){
+        var box = null;
+        this.eachItem(function(f){
+            if(id == f || f.dataIndex == id || f.id == id || f.getName() == id){
+                box = f;
+                return false;
+            }
+        });
+        return box;
+    },
+    
+    /**
+     * Gets an array of the selected {@link Ext.form.Checkbox} in the group.
+     * @return {Array} An array of the selected checkboxes.
+     */
+    getValue : function(){
+        var out = [];
+        this.eachItem(function(item){
+            if(item.checked){
+                out.push(item);
+            }
+        });
+        return out;
+    },
+    
+    // private
+    eachItem: function(fn){
+        if(this.items && this.items.each){
+            this.items.each(fn, this);
+        }
+    },
+    
+    /**
+     * @cfg {String} name
+     * @hide
+     */
+    /**
+     * @method initValue
+     * @hide
+     */
+    initValue : Ext.emptyFn,
+    /**
+     * @method getValue
+     * @hide
+     */
+    getValue : Ext.emptyFn,
+    /**
+     * @method getRawValue
+     * @hide
+     */
+    getRawValue : Ext.emptyFn,
+    
+    /**
+     * @method setRawValue
+     * @hide
+     */
+    setRawValue : Ext.emptyFn
+    
+});
+
+Ext.reg('checkboxgroup', Ext.form.CheckboxGroup);
+/**
+ * @class Ext.form.Radio
+ * @extends Ext.form.Checkbox
+ * Single radio field.  Same as Checkbox, but provided as a convenience for automatically setting the input type.
+ * Radio grouping is handled automatically by the browser if you give each radio in a group the same name.
+ * @constructor
+ * Creates a new Radio
+ * @param {Object} config Configuration options
+ * @xtype radio
+ */
+Ext.form.Radio = Ext.extend(Ext.form.Checkbox, {
+    inputType: 'radio',
+
+    /**
+     * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
+     * @method
+     */
+    markInvalid : Ext.emptyFn,
+    /**
+     * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide
+     * @method
+     */
+    clearInvalid : Ext.emptyFn,
+
+    /**
+     * If this radio is part of a group, it will return the selected value
+     * @return {String}
+     */
+    getGroupValue : function(){
+       var p = this.el.up('form') || Ext.getBody();
+        var c = p.child('input[name='+this.el.dom.name+']:checked', true);
+        return c ? c.value : null;
+    },
+
+    // private
+    onClick : function(){
+       if(this.el.dom.checked != this.checked){
+                       var els = this.getCheckEl().select('input[name=' + this.el.dom.name + ']');
+                       els.each(function(el){
+                               if(el.dom.id == this.id){
+                                       this.setValue(true);
+                               }else{
+                                       Ext.getCmp(el.dom.id).setValue(false);
+                               }
+                       }, this);
+               }
+    },
+
+    /**
+     * Sets either the checked/unchecked status of this Radio, or, if a string value
+     * is passed, checks a sibling Radio of the same name whose value is the value specified.
+     * @param value {String/Boolean} Checked value, or the value of the sibling radio button to check.
+     * @return {Ext.form.Field} this
+     */
+    setValue : function(v){
+       if (typeof v == 'boolean') {
+            Ext.form.Radio.superclass.setValue.call(this, v);
+        } else {
+            var r = this.getCheckEl().child('input[name=' + this.el.dom.name + '][value=' + v + ']', true);
+            if(r){
+                Ext.getCmp(r.id).setValue(true);
+            }
+        }
+        return this;
+    },
+    
+    // private
+    getCheckEl: function(){
+        if(this.inGroup){
+            return this.el.up('.x-form-radio-group')
+        }
+        return this.el.up('form') || Ext.getBody();
+    }
+});
+Ext.reg('radio', Ext.form.Radio);
+/**
+ * @class Ext.form.RadioGroup
+ * @extends Ext.form.CheckboxGroup
+ * A grouping container for {@link Ext.form.Radio} controls.
+ * @constructor
+ * Creates a new RadioGroup
+ * @param {Object} config Configuration options
+ * @xtype radiogroup
+ */
+Ext.form.RadioGroup = Ext.extend(Ext.form.CheckboxGroup, {
+    /**
+     * @cfg {Boolean} allowBlank True to allow every item in the group to be blank (defaults to true).
+     * If allowBlank = false and no items are selected at validation time, {@link @blankText} will
+     * be used as the error text.
+     */
+    allowBlank : true,
+    /**
+     * @cfg {String} blankText Error text to display if the {@link #allowBlank} validation fails
+     * (defaults to 'You must select one item in this group')
+     */
+    blankText : 'You must select one item in this group',
+    
+    // private
+    defaultType : 'radio',
+    
+    // private
+    groupCls : 'x-form-radio-group',
+    
+    /**
+     * @event change
+     * Fires when the state of a child radio changes.
+     * @param {Ext.form.RadioGroup} this
+     * @param {Ext.form.Radio} checked The checked radio
+     */
+    
+    /**
+     * Gets the selected {@link Ext.form.Radio} in the group, if it exists.
+     * @return {Ext.form.Radio} The selected radio.
+     */
+    getValue : function(){
+        var out = null;
+        this.eachItem(function(item){
+            if(item.checked){
+                out = item;
+                return false;
+            }
+        });
+        return out;
+    },
+    
+    /**
+     * Sets the checked radio in the group.
+     * @param {String/Ext.form.Radio} id The radio to check.
+     * @param {Boolean} value The value to set the radio.
+     * @return {Ext.form.RadioGroup} this
+     */
+    setValue : function(id, value){
+        if(this.rendered){
+            if(arguments.length > 1){
+                var f = this.getBox(id);
+                if(f){
+                    f.setValue(value);
+                    if(f.checked){
+                        this.eachItem(function(item){
+                            if (item !== f){
+                                item.setValue(false);
+                            }
+                        });
+                    }
+                }
+            }else{
+                this.setValueForItem(id);
+            }
+        }else{
+            this.values = arguments;
+        }
+        return this;
+    },
+    
+    // private
+    fireChecked : function(){
+        if(!this.checkTask){
+            this.checkTask = new Ext.util.DelayedTask(this.bufferChecked, this);
+        }
+        this.checkTask.delay(10);
+    },
+    
+    // private
+    bufferChecked : function(){
+        var out = null;
+        this.eachItem(function(item){
+            if(item.checked){
+                out = item;
+                return false;
+            }
+        });
+        this.fireEvent('change', this, out);
+    },
+    
+    onDestroy : function(){
+        if(this.checkTask){
+            this.checkTask.cancel();
+            this.checkTask = null;
+        }
+        Ext.form.RadioGroup.superclass.onDestroy.call(this);
+    }
+
+});
+
+Ext.reg('radiogroup', Ext.form.RadioGroup);
+/**\r
+ * @class Ext.form.Hidden\r
+ * @extends Ext.form.Field\r
+ * A basic hidden field for storing hidden values in forms that need to be passed in the form submit.\r
+ * @constructor\r
+ * Create a new Hidden field.\r
+ * @param {Object} config Configuration options\r
+ * @xtype hidden\r
+ */\r
+Ext.form.Hidden = Ext.extend(Ext.form.Field, {\r
+    // private\r
+    inputType : 'hidden',\r
+\r
+    // private\r
+    onRender : function(){\r
+        Ext.form.Hidden.superclass.onRender.apply(this, arguments);\r
     },\r
 \r
     // private\r
-    handleMouseDown : function(g, rowIndex, e){\r
-        if(e.button !== 0 || this.isLocked()){\r
-            return;\r
-        };\r
-        var view = this.grid.getView();\r
-        if(e.shiftKey && !this.singleSelect && this.last !== false){\r
-            var last = this.last;\r
-            this.selectRange(last, rowIndex, e.ctrlKey);\r
-            this.last = last; // reset the last\r
-            view.focusRow(rowIndex);\r
-        }else{\r
-            var isSelected = this.isSelected(rowIndex);\r
-            if(e.ctrlKey && isSelected){\r
-                this.deselectRow(rowIndex);\r
-            }else if(!isSelected || this.getCount() > 1){\r
-                this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);\r
-                view.focusRow(rowIndex);\r
-            }\r
-        }\r
+    initEvents : function(){\r
+        this.originalValue = this.getValue();\r
     },\r
 \r
-    \r
-    selectRows : function(rows, keepExisting){\r
-        if(!keepExisting){\r
-            this.clearSelections();\r
-        }\r
-        for(var i = 0, len = rows.length; i < len; i++){\r
-            this.selectRow(rows[i], true);\r
-        }\r
+    // These are all private overrides\r
+    setSize : Ext.emptyFn,\r
+    setWidth : Ext.emptyFn,\r
+    setHeight : Ext.emptyFn,\r
+    setPosition : Ext.emptyFn,\r
+    setPagePosition : Ext.emptyFn,\r
+    markInvalid : Ext.emptyFn,\r
+    clearInvalid : Ext.emptyFn\r
+});\r
+Ext.reg('hidden', Ext.form.Hidden);/**
+ * @class Ext.form.BasicForm
+ * @extends Ext.util.Observable
+ * <p>Encapsulates the DOM &lt;form> element at the heart of the {@link Ext.form.FormPanel FormPanel} class, and provides
+ * input field management, validation, submission, and form loading services.</p>
+ * <p>By default, Ext Forms are submitted through Ajax, using an instance of {@link Ext.form.Action.Submit}.
+ * To enable normal browser submission of an Ext Form, use the {@link #standardSubmit} config option.</p>
+ * <p><b><u>File Uploads</u></b></p>
+ * <p>{@link #fileUpload File uploads} are not performed using Ajax submission, 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
+ * <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
+ * but removed after the return data has been gathered.</p>
+ * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
+ * server is using JSON to send the return object, then the
+ * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
+ * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
+ * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
+ * "&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>
+ * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
+ * is created containing a <tt>responseText</tt> property in order to conform to the
+ * requirements of event handlers and callbacks.</p>
+ * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
+ * and some server technologies (notably JEE) may require some custom processing in order to
+ * retrieve parameter names and parameter values from the packet content.</p>
+ * @constructor
+ * @param {Mixed} el The form element or its id
+ * @param {Object} config Configuration options
+ */
+Ext.form.BasicForm = function(el, config){
+    Ext.apply(this, config);
+    if(Ext.isString(this.paramOrder)){
+        this.paramOrder = this.paramOrder.split(/[\s,|]/);
+    }
+    /*
+     * @property items
+     * A {@link Ext.util.MixedCollection MixedCollection) containing all the Ext.form.Fields in this form.
+     * @type MixedCollection
+     */
+    this.items = new Ext.util.MixedCollection(false, function(o){
+        return o.itemId || o.id || (o.id = Ext.id());
+    });
+    this.addEvents(
+        /**
+         * @event beforeaction
+         * Fires before any action is performed. Return false to cancel the action.
+         * @param {Form} this
+         * @param {Action} action The {@link Ext.form.Action} to be performed
+         */
+        'beforeaction',
+        /**
+         * @event actionfailed
+         * Fires when an action fails.
+         * @param {Form} this
+         * @param {Action} action The {@link Ext.form.Action} that failed
+         */
+        'actionfailed',
+        /**
+         * @event actioncomplete
+         * Fires when an action is completed.
+         * @param {Form} this
+         * @param {Action} action The {@link Ext.form.Action} that completed
+         */
+        'actioncomplete'
+    );
+
+    if(el){
+        this.initEl(el);
+    }
+    Ext.form.BasicForm.superclass.constructor.call(this);
+};
+
+Ext.extend(Ext.form.BasicForm, Ext.util.Observable, {
+    /**
+     * @cfg {String} method
+     * The request method to use (GET or POST) for form actions if one isn't supplied in the action options.
+     */
+    /**
+     * @cfg {DataReader} reader
+     * An Ext.data.DataReader (e.g. {@link Ext.data.XmlReader}) to be used to read
+     * data when executing 'load' actions. This is optional as there is built-in
+     * support for processing JSON.  For additional information on using an XMLReader
+     * see the example provided in examples/form/xml-form.html.
+     */
+    /**
+     * @cfg {DataReader} errorReader
+     * <p>An Ext.data.DataReader (e.g. {@link Ext.data.XmlReader}) to be used to
+     * read field error messages returned from 'submit' actions. This is optional
+     * as there is built-in support for processing JSON.</p>
+     * <p>The Records which provide messages for the invalid Fields must use the
+     * Field name (or id) as the Record ID, and must contain a field called 'msg'
+     * which contains the error message.</p>
+     * <p>The errorReader does not have to be a full-blown implementation of a
+     * DataReader. It simply needs to implement a <tt>read(xhr)</tt> function
+     * which returns an Array of Records in an object with the following
+     * structure:</p><pre><code>
+{
+    records: recordArray
+}
+</code></pre>
+     */
+    /**
+     * @cfg {String} url
+     * The URL to use for form actions if one isn't supplied in the
+     * <code>{@link #doAction doAction} options</code>.
+     */
+    /**
+     * @cfg {Boolean} fileUpload
+     * Set to true if this form is a file upload.
+     * <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
+     * <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
+     * but removed after the return data has been gathered.</p>
+     * <p>The server response is parsed by the browser to create the document for the IFRAME. If the
+     * server is using JSON to send the return object, then the
+     * <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17">Content-Type</a> header
+     * must be set to "text/html" in order to tell the browser to insert the text unchanged into the document body.</p>
+     * <p>Characters which are significant to an HTML parser must be sent as HTML entities, so encode
+     * "&lt;" as "&amp;lt;", "&amp;" as "&amp;amp;" etc.</p>
+     * <p>The response text is retrieved from the document, and a fake XMLHttpRequest object
+     * is created containing a <tt>responseText</tt> property in order to conform to the
+     * requirements of event handlers and callbacks.</p>
+     * <p>Be aware that file upload packets are sent with the content type <a href="http://www.faqs.org/rfcs/rfc2388.html">multipart/form</a>
+     * and some server technologies (notably JEE) may require some custom processing in order to
+     * retrieve parameter names and parameter values from the packet content.</p>
+     */
+    /**
+     * @cfg {Object} baseParams
+     * <p>Parameters to pass with all requests. e.g. baseParams: {id: '123', foo: 'bar'}.</p>
+     * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p>
+     */
+    /**
+     * @cfg {Number} timeout Timeout for form actions in seconds (default is 30 seconds).
+     */
+    timeout: 30,
+
+    /**
+     * @cfg {Object} api (Optional) If specified load and submit actions will be handled
+     * with {@link Ext.form.Action.DirectLoad} and {@link Ext.form.Action.DirectSubmit}.
+     * Methods which have been imported by Ext.Direct can be specified here to load and submit
+     * forms.
+     * Such as the following:<pre><code>
+api: {
+    load: App.ss.MyProfile.load,
+    submit: App.ss.MyProfile.submit
+}
+</code></pre>
+     * <p>Load actions can use <code>{@link #paramOrder}</code> or <code>{@link #paramsAsHash}</code>
+     * to customize how the load method is invoked.
+     * Submit actions will always use a standard form submit. The formHandler configuration must
+     * be set on the associated server-side method which has been imported by Ext.Direct</p>
+     */
+
+    /**
+     * @cfg {Array/String} paramOrder <p>A list of params to be executed server side.
+     * Defaults to <tt>undefined</tt>. Only used for the <code>{@link #api}</code>
+     * <code>load</code> configuration.</p>
+     * <br><p>Specify the params in the order in which they must be executed on the
+     * server-side as either (1) an Array of String values, or (2) a String of params
+     * delimited by either whitespace, comma, or pipe. For example,
+     * any of the following would be acceptable:</p><pre><code>
+paramOrder: ['param1','param2','param3']
+paramOrder: 'param1 param2 param3'
+paramOrder: 'param1,param2,param3'
+paramOrder: 'param1|param2|param'
+     </code></pre>
+     */
+    paramOrder: undefined,
+
+    /**
+     * @cfg {Boolean} paramsAsHash Only used for the <code>{@link #api}</code>
+     * <code>load</code> configuration. Send parameters as a collection of named
+     * arguments (defaults to <tt>false</tt>). Providing a
+     * <tt>{@link #paramOrder}</tt> nullifies this configuration.
+     */
+    paramsAsHash: false,
+
+
+    // private
+    activeAction : null,
+
+    /**
+     * @cfg {Boolean} trackResetOnLoad If set to <tt>true</tt>, {@link #reset}() resets to the last loaded
+     * or {@link #setValues}() data instead of when the form was first created.  Defaults to <tt>false</tt>.
+     */
+    trackResetOnLoad : false,
+
+    /**
+     * @cfg {Boolean} standardSubmit If set to true, standard HTML form submits are used instead of XHR (Ajax) style
+     * form submissions. (defaults to false)<br>
+     * <p><b>Note:</b> When using standardSubmit, the options to {@link #submit} are ignored because Ext's
+     * Ajax infrastracture is bypassed. To pass extra parameters (baseParams and params), you will need to
+     * create hidden fields within the form.</p>
+     * <p>The url config option is also bypassed, so set the action as well:</p>
+     * <pre><code>
+PANEL.getForm().getEl().dom.action = 'URL'
+     * </code></pre>
+     * An example encapsulating the above:
+     * <pre><code>
+new Ext.FormPanel({
+    standardSubmit: true,
+    baseParams: {
+        foo: 'bar'
+    },
+    url: 'myProcess.php',
+    items: [{
+        xtype: 'textfield',
+        name: 'userName'
+    }],
+    buttons: [{
+        text: 'Save',
+        handler: function(){
+            var O = this.ownerCt;
+            if (O.getForm().isValid()) {
+                if (O.url)
+                    O.getForm().getEl().dom.action = O.url;
+                if (O.baseParams) {
+                    for (i in O.baseParams) {
+                        O.add({
+                            xtype: 'hidden',
+                            name: i,
+                            value: O.baseParams[i]
+                        })
+                    }
+                    O.doLayout();
+                }
+                O.getForm().submit();
+            }
+        }
+    }]
+});
+     * </code></pre>
+     */
+    /**
+     * By default wait messages are displayed with Ext.MessageBox.wait. You can target a specific
+     * element by passing it or its id or mask the form itself by passing in true.
+     * @type Mixed
+     * @property waitMsgTarget
+     */
+
+    // private
+    initEl : function(el){
+        this.el = Ext.get(el);
+        this.id = this.el.id || Ext.id();
+        if(!this.standardSubmit){
+            this.el.on('submit', this.onSubmit, this);
+        }
+        this.el.addClass('x-form');
+    },
+
+    /**
+     * Get the HTML form Element
+     * @return Ext.Element
+     */
+    getEl: function(){
+        return this.el;
+    },
+
+    // private
+    onSubmit : function(e){
+        e.stopEvent();
+    },
+
+    // private
+    destroy: function() {
+        this.items.each(function(f){
+            Ext.destroy(f);
+        });
+        if(this.el){
+            this.el.removeAllListeners();
+            this.el.remove();
+        }
+        this.purgeListeners();
+    },
+
+    /**
+     * Returns true if client-side validation on the form is successful.
+     * @return Boolean
+     */
+    isValid : function(){
+        var valid = true;
+        this.items.each(function(f){
+           if(!f.validate()){
+               valid = false;
+           }
+        });
+        return valid;
+    },
+
+    /**
+     * <p>Returns true if any fields in this form have changed from their original values.</p>
+     * <p>Note that if this BasicForm was configured with {@link #trackResetOnLoad} then the
+     * Fields' <i>original values</i> are updated when the values are loaded by {@link #setValues}
+     * or {@link #loadRecord}.</p>
+     * @return Boolean
+     */
+    isDirty : function(){
+        var dirty = false;
+        this.items.each(function(f){
+           if(f.isDirty()){
+               dirty = true;
+               return false;
+           }
+        });
+        return dirty;
+    },
+
+    /**
+     * Performs a predefined action ({@link Ext.form.Action.Submit} or
+     * {@link Ext.form.Action.Load}) or a custom extension of {@link Ext.form.Action}
+     * to perform application-specific processing.
+     * @param {String/Object} actionName The name of the predefined action type,
+     * or instance of {@link Ext.form.Action} to perform.
+     * @param {Object} options (optional) The options to pass to the {@link Ext.form.Action}.
+     * All of the config options listed below are supported by both the
+     * {@link Ext.form.Action.Submit submit} and {@link Ext.form.Action.Load load}
+     * actions unless otherwise noted (custom actions could also accept
+     * other config options):<ul>
+     *
+     * <li><b>url</b> : String<div class="sub-desc">The url for the action (defaults
+     * to the form's {@link #url}.)</div></li>
+     *
+     * <li><b>method</b> : String<div class="sub-desc">The form method to use (defaults
+     * to the form's method, or POST if not defined)</div></li>
+     *
+     * <li><b>params</b> : String/Object<div class="sub-desc"><p>The params to pass
+     * (defaults to the form's baseParams, or none if not defined)</p>
+     * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p></div></li>
+     *
+     * <li><b>headers</b> : Object<div class="sub-desc">Request headers to set for the action
+     * (defaults to the form's default headers)</div></li>
+     *
+     * <li><b>success</b> : Function<div class="sub-desc">The callback that will
+     * be invoked after a successful response (see top of
+     * {@link Ext.form.Action.Submit submit} and {@link Ext.form.Action.Load load}
+     * for a description of what constitutes a successful response).
+     * The function is passed the following parameters:<ul>
+     * <li><tt>form</tt> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
+     * <li><tt>action</tt> : The {@link Ext.form.Action Action} object which performed the operation.
+     * <div class="sub-desc">The action object contains these properties of interest:<ul>
+     * <li><tt>{@link Ext.form.Action#response response}</tt></li>
+     * <li><tt>{@link Ext.form.Action#result result}</tt> : interrogate for custom postprocessing</li>
+     * <li><tt>{@link Ext.form.Action#type type}</tt></li>
+     * </ul></div></li></ul></div></li>
+     *
+     * <li><b>failure</b> : Function<div class="sub-desc">The callback that will be invoked after a
+     * failed transaction attempt. The function is passed the following parameters:<ul>
+     * <li><tt>form</tt> : The {@link Ext.form.BasicForm} that requested the action.</li>
+     * <li><tt>action</tt> : The {@link Ext.form.Action Action} object which performed the operation.
+     * <div class="sub-desc">The action object contains these properties of interest:<ul>
+     * <li><tt>{@link Ext.form.Action#failureType failureType}</tt></li>
+     * <li><tt>{@link Ext.form.Action#response response}</tt></li>
+     * <li><tt>{@link Ext.form.Action#result result}</tt> : interrogate for custom postprocessing</li>
+     * <li><tt>{@link Ext.form.Action#type type}</tt></li>
+     * </ul></div></li></ul></div></li>
+     *
+     * <li><b>scope</b> : Object<div class="sub-desc">The scope in which to call the
+     * callback functions (The <tt>this</tt> reference for the callback functions).</div></li>
+     *
+     * <li><b>clientValidation</b> : Boolean<div class="sub-desc">Submit Action only.
+     * Determines whether a Form's fields are validated in a final call to
+     * {@link Ext.form.BasicForm#isValid isValid} prior to submission. Set to <tt>false</tt>
+     * to prevent this. If undefined, pre-submission field validation is performed.</div></li></ul>
+     *
+     * @return {BasicForm} this
+     */
+    doAction : function(action, options){
+        if(Ext.isString(action)){
+            action = new Ext.form.Action.ACTION_TYPES[action](this, options);
+        }
+        if(this.fireEvent('beforeaction', this, action) !== false){
+            this.beforeAction(action);
+            action.run.defer(100, action);
+        }
+        return this;
+    },
+
+    /**
+     * Shortcut to {@link #doAction do} a {@link Ext.form.Action.Submit submit action}.
+     * @param {Object} options The options to pass to the action (see {@link #doAction} for details).<br>
+     * <p><b>Note:</b> this is ignored when using the {@link #standardSubmit} option.</p>
+     * <p>The following code:</p><pre><code>
+myFormPanel.getForm().submit({
+    clientValidation: true,
+    url: 'updateConsignment.php',
+    params: {
+        newStatus: 'delivered'
+    },
+    success: function(form, action) {
+       Ext.Msg.alert('Success', action.result.msg);
+    },
+    failure: function(form, action) {
+        switch (action.failureType) {
+            case Ext.form.Action.CLIENT_INVALID:
+                Ext.Msg.alert('Failure', 'Form fields may not be submitted with invalid values');
+                break;
+            case Ext.form.Action.CONNECT_FAILURE:
+                Ext.Msg.alert('Failure', 'Ajax communication failed');
+                break;
+            case Ext.form.Action.SERVER_INVALID:
+               Ext.Msg.alert('Failure', action.result.msg);
+       }
+    }
+});
+</code></pre>
+     * would process the following server response for a successful submission:<pre><code>
+{
+    "success":true, // note this is Boolean, not string
+    "msg":"Consignment updated"
+}
+</code></pre>
+     * and the following server response for a failed submission:<pre><code>
+{
+    "success":false, // note this is Boolean, not string
+    "msg":"You do not have permission to perform this operation"
+}
+</code></pre>
+     * @return {BasicForm} this
+     */
+    submit : function(options){
+        if(this.standardSubmit){
+            var v = this.isValid();
+            if(v){
+                this.el.dom.submit();
+            }
+            return v;
+        }
+        var submitAction = String.format('{0}submit', this.api ? 'direct' : '');
+        this.doAction(submitAction, options);
+        return this;
+    },
+
+    /**
+     * Shortcut to {@link #doAction do} a {@link Ext.form.Action.Load load action}.
+     * @param {Object} options The options to pass to the action (see {@link #doAction} for details)
+     * @return {BasicForm} this
+     */
+    load : function(options){
+        var loadAction = String.format('{0}load', this.api ? 'direct' : '');
+        this.doAction(loadAction, options);
+        return this;
+    },
+
+    /**
+     * Persists the values in this form into the passed {@link Ext.data.Record} object in a beginEdit/endEdit block.
+     * @param {Record} record The record to edit
+     * @return {BasicForm} this
+     */
+    updateRecord : function(record){
+        record.beginEdit();
+        var fs = record.fields;
+        fs.each(function(f){
+            var field = this.findField(f.name);
+            if(field){
+                record.set(f.name, field.getValue());
+            }
+        }, this);
+        record.endEdit();
+        return this;
+    },
+
+    /**
+     * Loads an {@link Ext.data.Record} into this form by calling {@link #setValues} with the
+     * {@link Ext.data.Record#data record data}.
+     * See also {@link #trackResetOnLoad}.
+     * @param {Record} record The record to load
+     * @return {BasicForm} this
+     */
+    loadRecord : function(record){
+        this.setValues(record.data);
+        return this;
+    },
+
+    // private
+    beforeAction : function(action){
+        var o = action.options;
+        if(o.waitMsg){
+            if(this.waitMsgTarget === true){
+                this.el.mask(o.waitMsg, 'x-mask-loading');
+            }else if(this.waitMsgTarget){
+                this.waitMsgTarget = Ext.get(this.waitMsgTarget);
+                this.waitMsgTarget.mask(o.waitMsg, 'x-mask-loading');
+            }else{
+                Ext.MessageBox.wait(o.waitMsg, o.waitTitle || this.waitTitle || 'Please Wait...');
+            }
+        }
+    },
+
+    // private
+    afterAction : function(action, success){
+        this.activeAction = null;
+        var o = action.options;
+        if(o.waitMsg){
+            if(this.waitMsgTarget === true){
+                this.el.unmask();
+            }else if(this.waitMsgTarget){
+                this.waitMsgTarget.unmask();
+            }else{
+                Ext.MessageBox.updateProgress(1);
+                Ext.MessageBox.hide();
+            }
+        }
+        if(success){
+            if(o.reset){
+                this.reset();
+            }
+            Ext.callback(o.success, o.scope, [this, action]);
+            this.fireEvent('actioncomplete', this, action);
+        }else{
+            Ext.callback(o.failure, o.scope, [this, action]);
+            this.fireEvent('actionfailed', this, action);
+        }
+    },
+
+    /**
+     * Find a {@link Ext.form.Field} in this form.
+     * @param {String} id The value to search for (specify either a {@link Ext.Component#id id},
+     * {@link Ext.grid.Column#dataIndex dataIndex}, {@link Ext.form.Field#getName name or hiddenName}).
+     * @return Field
+     */
+    findField : function(id){
+        var field = this.items.get(id);
+        if(!Ext.isObject(field)){
+            this.items.each(function(f){
+                if(f.isFormField && (f.dataIndex == id || f.id == id || f.getName() == id)){
+                    field = f;
+                    return false;
+                }
+            });
+        }
+        return field || null;
+    },
+
+
+    /**
+     * Mark fields in this form invalid in bulk.
+     * @param {Array/Object} errors Either an array in the form [{id:'fieldId', msg:'The message'},...] or an object hash of {id: msg, id2: msg2}
+     * @return {BasicForm} this
+     */
+    markInvalid : function(errors){
+        if(Ext.isArray(errors)){
+            for(var i = 0, len = errors.length; i < len; i++){
+                var fieldError = errors[i];
+                var f = this.findField(fieldError.id);
+                if(f){
+                    f.markInvalid(fieldError.msg);
+                }
+            }
+        }else{
+            var field, id;
+            for(id in errors){
+                if(!Ext.isFunction(errors[id]) && (field = this.findField(id))){
+                    field.markInvalid(errors[id]);
+                }
+            }
+        }
+        return this;
+    },
+
+    /**
+     * Set values for fields in this form in bulk.
+     * @param {Array/Object} values Either an array in the form:<pre><code>
+[{id:'clientName', value:'Fred. Olsen Lines'},
+ {id:'portOfLoading', value:'FXT'},
+ {id:'portOfDischarge', value:'OSL'} ]</code></pre>
+     * or an object hash of the form:<pre><code>
+{
+    clientName: 'Fred. Olsen Lines',
+    portOfLoading: 'FXT',
+    portOfDischarge: 'OSL'
+}</code></pre>
+     * @return {BasicForm} this
+     */
+    setValues : function(values){
+        if(Ext.isArray(values)){ // array of objects
+            for(var i = 0, len = values.length; i < len; i++){
+                var v = values[i];
+                var f = this.findField(v.id);
+                if(f){
+                    f.setValue(v.value);
+                    if(this.trackResetOnLoad){
+                        f.originalValue = f.getValue();
+                    }
+                }
+            }
+        }else{ // object hash
+            var field, id;
+            for(id in values){
+                if(!Ext.isFunction(values[id]) && (field = this.findField(id))){
+                    field.setValue(values[id]);
+                    if(this.trackResetOnLoad){
+                        field.originalValue = field.getValue();
+                    }
+                }
+            }
+        }
+        return this;
+    },
+
+    /**
+     * <p>Returns the fields in this form as an object with key/value pairs as they would be submitted using a standard form submit.
+     * If multiple fields exist with the same name they are returned as an array.</p>
+     * <p><b>Note:</b> The values are collected from all enabled HTML input elements within the form, <u>not</u> from
+     * the Ext Field objects. This means that all returned values are Strings (or Arrays of Strings) and that the
+     * value can potentially be the emptyText of a field.</p>
+     * @param {Boolean} asString (optional) Pass true to return the values as a string. (defaults to false, returning an Object)
+     * @return {String/Object}
+     */
+    getValues : function(asString){
+        var fs = Ext.lib.Ajax.serializeForm(this.el.dom);
+        if(asString === true){
+            return fs;
+        }
+        return Ext.urlDecode(fs);
+    },
+
+    getFieldValues : function(){
+        var o = {};
+        this.items.each(function(f){
+           o[f.getName()] = f.getValue();
+        });
+        return o;
+    },
+
+    /**
+     * Clears all invalid messages in this form.
+     * @return {BasicForm} this
+     */
+    clearInvalid : function(){
+        this.items.each(function(f){
+           f.clearInvalid();
+        });
+        return this;
+    },
+
+    /**
+     * Resets this form.
+     * @return {BasicForm} this
+     */
+    reset : function(){
+        this.items.each(function(f){
+            f.reset();
+        });
+        return this;
+    },
+
+    /**
+     * Add Ext.form Components to this form's Collection. This does not result in rendering of
+     * the passed Component, it just enables the form to validate Fields, and distribute values to
+     * Fields.
+     * <p><b>You will not usually call this function. In order to be rendered, a Field must be added
+     * to a {@link Ext.Container Container}, usually an {@link Ext.form.FormPanel FormPanel}.
+     * The FormPanel to which the field is added takes care of adding the Field to the BasicForm's
+     * collection.</b></p>
+     * @param {Field} field1
+     * @param {Field} field2 (optional)
+     * @param {Field} etc (optional)
+     * @return {BasicForm} this
+     */
+    add : function(){
+        this.items.addAll(Array.prototype.slice.call(arguments, 0));
+        return this;
+    },
+
+
+    /**
+     * Removes a field from the items collection (does NOT remove its markup).
+     * @param {Field} field
+     * @return {BasicForm} this
+     */
+    remove : function(field){
+        this.items.remove(field);
+        return this;
+    },
+
+    /**
+     * Iterates through the {@link Ext.form.Field Field}s which have been {@link #add add}ed to this BasicForm,
+     * checks them for an id attribute, and calls {@link Ext.form.Field#applyToMarkup} on the existing dom element with that id.
+     * @return {BasicForm} this
+     */
+    render : function(){
+        this.items.each(function(f){
+            if(f.isFormField && !f.rendered && document.getElementById(f.id)){ // if the element exists
+                f.applyToMarkup(f.id);
+            }
+        });
+        return this;
+    },
+
+    /**
+     * Calls {@link Ext#apply} for all fields in this form with the passed object.
+     * @param {Object} values
+     * @return {BasicForm} this
+     */
+    applyToFields : function(o){
+        this.items.each(function(f){
+           Ext.apply(f, o);
+        });
+        return this;
+    },
+
+    /**
+     * Calls {@link Ext#applyIf} for all field in this form with the passed object.
+     * @param {Object} values
+     * @return {BasicForm} this
+     */
+    applyIfToFields : function(o){
+        this.items.each(function(f){
+           Ext.applyIf(f, o);
+        });
+        return this;
+    },
+
+    callFieldMethod : function(fnName, args){
+        args = args || [];
+        this.items.each(function(f){
+            if(Ext.isFunction(f[fnName])){
+                f[fnName].apply(f, args);
+            }
+        });
+        return this;
+    }
+});
+
+// back compat
+Ext.BasicForm = Ext.form.BasicForm;/**
+ * @class Ext.form.FormPanel
+ * @extends Ext.Panel
+ * <p>Standard form container.</p>
+ * 
+ * <p><b><u>Layout</u></b></p>
+ * <p>By default, FormPanel is configured with <tt>layout:'form'</tt> to use an {@link Ext.layout.FormLayout}
+ * layout manager, which styles and renders fields and labels correctly. When nesting additional Containers
+ * within a FormPanel, you should ensure that any descendant Containers which host input Fields use the
+ * {@link Ext.layout.FormLayout} layout manager.</p>
+ * 
+ * <p><b><u>BasicForm</u></b></p>
+ * <p>Although <b>not listed</b> as configuration options of FormPanel, the FormPanel class accepts all
+ * of the config options required to configure its internal {@link Ext.form.BasicForm} for:
+ * <div class="mdetail-params"><ul>
+ * <li>{@link Ext.form.BasicForm#fileUpload file uploads}</li>
+ * <li>functionality for {@link Ext.form.BasicForm#doAction loading, validating and submitting} the form</li>
+ * </ul></div>
+ *  
+ * <p><b>Note</b>: If subclassing FormPanel, any configuration options for the BasicForm must be applied to
+ * the <tt><b>initialConfig</b></tt> property of the FormPanel. Applying {@link Ext.form.BasicForm BasicForm}
+ * configuration settings to <b><tt>this</tt></b> will <b>not</b> affect the BasicForm's configuration.</p>
+ * 
+ * <p><b><u>Form Validation</u></b></p>
+ * <p>For information on form validation see the following:</p>
+ * <div class="mdetail-params"><ul>
+ * <li>{@link Ext.form.TextField}</li>
+ * <li>{@link Ext.form.VTypes}</li>
+ * <li>{@link Ext.form.BasicForm#doAction BasicForm.doAction <b>clientValidation</b> notes}</li>
+ * <li><tt>{@link Ext.form.FormPanel#monitorValid monitorValid}</tt></li>
+ * </ul></div>
+ * 
+ * <p><b><u>Form Submission</u></b></p>
+ * <p>By default, Ext Forms are submitted through Ajax, using {@link Ext.form.Action}. To enable normal browser
+ * submission of the {@link Ext.form.BasicForm BasicForm} contained in this FormPanel, see the
+ * <tt><b>{@link Ext.form.BasicForm#standardSubmit standardSubmit}</b></tt> option.</p>
+ * 
+ * @constructor
+ * @param {Object} config Configuration options
+ * @xtype form
+ */
+Ext.FormPanel = Ext.extend(Ext.Panel, {
+       /**
+        * @cfg {String} formId (optional) The id of the FORM tag (defaults to an auto-generated id).
+        */
+    /**
+     * @cfg {Boolean} hideLabels
+     * <p><tt>true</tt> to hide field labels by default (sets <tt>display:none</tt>). Defaults to
+     * <tt>false</tt>.</p>
+     * <p>Also see {@link Ext.Component}.<tt>{@link Ext.Component#hideLabel hideLabel}</tt>.
+     */
+    /**
+     * @cfg {Number} labelPad
+     * The default padding in pixels for field labels (defaults to <tt>5</tt>). <tt>labelPad</tt> only
+     * applies if <tt>{@link #labelWidth}</tt> is also specified, otherwise it will be ignored.
+     */
+    /**
+     * @cfg {String} labelSeparator
+     * See {@link Ext.Component}.<tt>{@link Ext.Component#labelSeparator labelSeparator}</tt>
+     */
+    /**
+     * @cfg {Number} labelWidth The width of labels in pixels. This property cascades to child containers
+     * and can be overridden on any child container (e.g., a fieldset can specify a different <tt>labelWidth</tt>
+     * for its fields) (defaults to <tt>100</tt>).
+     */
+    /**
+     * @cfg {String} itemCls A css class to apply to the x-form-item of fields. This property cascades to child containers.
+     */
+    /**
+     * @cfg {Array} buttons
+     * An array of {@link Ext.Button}s or {@link Ext.Button} configs used to add buttons to the footer of this FormPanel.<br>
+     * <p>Buttons in the footer of a FormPanel may be configured with the option <tt>formBind: true</tt>. This causes
+     * the form's {@link #monitorValid valid state monitor task} to enable/disable those Buttons depending on
+     * the form's valid/invalid state.</p>
+     */
+
+
+    /**
+     * @cfg {Number} minButtonWidth Minimum width of all buttons in pixels (defaults to <tt>75</tt>).
+     */
+    minButtonWidth : 75,
+
+    /**
+     * @cfg {String} labelAlign The label alignment value used for the <tt>text-align</tt> specification
+     * for the <b>container</b>. Valid values are <tt>"left</tt>", <tt>"top"</tt> or <tt>"right"</tt>
+     * (defaults to <tt>"left"</tt>). This property cascades to child <b>containers</b> and can be
+     * overridden on any child <b>container</b> (e.g., a fieldset can specify a different <tt>labelAlign</tt>
+     * for its fields).
+     */
+    labelAlign : 'left',
+
+    /**
+     * @cfg {Boolean} monitorValid If <tt>true</tt>, the form monitors its valid state <b>client-side</b> and
+     * regularly fires the {@link #clientvalidation} event passing that state.<br>
+     * <p>When monitoring valid state, the FormPanel enables/disables any of its configured
+     * {@link #buttons} which have been configured with <code>formBind: true</code> depending
+     * on whether the {@link Ext.form.BasicForm#isValid form is valid} or not. Defaults to <tt>false</tt></p>
+     */
+    monitorValid : false,
+
+    /**
+     * @cfg {Number} monitorPoll The milliseconds to poll valid state, ignored if monitorValid is not true (defaults to 200)
+     */
+    monitorPoll : 200,
+
+    /**
+     * @cfg {String} layout Defaults to <tt>'form'</tt>.  Normally this configuration property should not be altered. 
+     * For additional details see {@link Ext.layout.FormLayout} and {@link Ext.Container#layout Ext.Container.layout}.
+     */
+    layout : 'form',
+
+    // private
+    initComponent : function(){
+        this.form = this.createForm();
+        Ext.FormPanel.superclass.initComponent.call(this);
+
+        this.bodyCfg = {
+            tag: 'form',
+            cls: this.baseCls + '-body',
+            method : this.method || 'POST',
+            id : this.formId || Ext.id()
+        };
+        if(this.fileUpload) {
+            this.bodyCfg.enctype = 'multipart/form-data';
+        }
+        this.initItems();
+        
+        this.addEvents(
+            /**
+             * @event clientvalidation
+             * If the monitorValid config option is true, this event fires repetitively to notify of valid state
+             * @param {Ext.form.FormPanel} this
+             * @param {Boolean} valid true if the form has passed client-side validation
+             */
+            'clientvalidation'
+        );
+
+        this.relayEvents(this.form, ['beforeaction', 'actionfailed', 'actioncomplete']);
+    },
+
+    // private
+    createForm : function(){
+        var config = Ext.applyIf({listeners: {}}, this.initialConfig);
+        return new Ext.form.BasicForm(null, config);
+    },
+
+    // private
+    initFields : function(){
+        var f = this.form;
+        var formPanel = this;
+        var fn = function(c){
+            if(formPanel.isField(c)){
+                f.add(c);
+            }if(c.isFieldWrap){
+                Ext.applyIf(c, {
+                    labelAlign: c.ownerCt.labelAlign,
+                    labelWidth: c.ownerCt.labelWidth,
+                    itemCls: c.ownerCt.itemCls
+                });
+                f.add(c.field);
+            }else if(c.doLayout && c != formPanel){
+                Ext.applyIf(c, {
+                    labelAlign: c.ownerCt.labelAlign,
+                    labelWidth: c.ownerCt.labelWidth,
+                    itemCls: c.ownerCt.itemCls
+                });
+                //each check required for check/radio groups.
+                if(c.items && c.items.each){
+                    c.items.each(fn, this);
+                }
+            }
+        };
+        this.items.each(fn, this);
+    },
+
+    // private
+    getLayoutTarget : function(){
+        return this.form.el;
+    },
+
+    /**
+     * Provides access to the {@link Ext.form.BasicForm Form} which this Panel contains.
+     * @return {Ext.form.BasicForm} The {@link Ext.form.BasicForm Form} which this Panel contains.
+     */
+    getForm : function(){
+        return this.form;
+    },
+
+    // private
+    onRender : function(ct, position){
+        this.initFields();
+        Ext.FormPanel.superclass.onRender.call(this, ct, position);
+        this.form.initEl(this.body);
+    },
+    
+    // private
+    beforeDestroy : function(){
+        this.stopMonitoring();
+        Ext.FormPanel.superclass.beforeDestroy.call(this);
+        /*
+         * Clear the items here to prevent them being destroyed again.
+         * Don't move this behaviour to BasicForm because it can be used
+         * on it's own.
+         */
+        this.form.items.clear();
+        Ext.destroy(this.form);
+    },
+
+       // Determine if a Component is usable as a form Field.
+    isField : function(c) {
+        return !!c.setValue && !!c.getValue && !!c.markInvalid && !!c.clearInvalid;
+    },
+
+    // private
+    initEvents : function(){
+        Ext.FormPanel.superclass.initEvents.call(this);
+        this.on('remove', this.onRemove, this);
+        this.on('add', this.onAdd, this);
+        if(this.monitorValid){ // initialize after render
+            this.startMonitoring();
+        }
+    },
+    
+    // private
+    onAdd : function(ct, c) {
+               // If a single form Field, add it
+        if (this.isField(c)) {
+            this.form.add(c);
+               // If a Container, add any Fields it might contain
+        } else if (c.findBy) {
+            Ext.applyIf(c, {
+                labelAlign: c.ownerCt.labelAlign,
+                labelWidth: c.ownerCt.labelWidth,
+                itemCls: c.ownerCt.itemCls
+            });
+            this.form.add.apply(this.form, c.findBy(this.isField));
+        }
+    },
+       
+    // private
+    onRemove : function(ct, c) {
+               // If a single form Field, remove it
+        if (this.isField(c)) {
+            Ext.destroy(c.container.up('.x-form-item'));
+               this.form.remove(c);
+               // If a Container, remove any Fields it might contain
+        } else if (c.findByType) {
+            Ext.each(c.findBy(this.isField), this.form.remove, this.form);
+        }
+    },
+
+    /**
+     * Starts monitoring of the valid state of this form. Usually this is done by passing the config
+     * option "monitorValid"
+     */
+    startMonitoring : function(){
+        if(!this.validTask){
+            this.validTask = new Ext.util.TaskRunner();
+            this.validTask.start({
+                run : this.bindHandler,
+                interval : this.monitorPoll || 200,
+                scope: this
+            });
+        }
+    },
+
+    /**
+     * Stops monitoring of the valid state of this form
+     */
+    stopMonitoring : function(){
+        if(this.validTask){
+            this.validTask.stopAll();
+            this.validTask = null;
+        }
+    },
+
+    /**
+     * This is a proxy for the underlying BasicForm's {@link Ext.form.BasicForm#load} call.
+     * @param {Object} options The options to pass to the action (see {@link Ext.form.BasicForm#doAction} for details)
+     */
+    load : function(){
+        this.form.load.apply(this.form, arguments);  
+    },
+
+    // private
+    onDisable : function(){
+        Ext.FormPanel.superclass.onDisable.call(this);
+        if(this.form){
+            this.form.items.each(function(){
+                 this.disable();
+            });
+        }
+    },
+
+    // private
+    onEnable : function(){
+        Ext.FormPanel.superclass.onEnable.call(this);
+        if(this.form){
+            this.form.items.each(function(){
+                 this.enable();
+            });
+        }
+    },
+
+    // private
+    bindHandler : function(){
+        var valid = true;
+        this.form.items.each(function(f){
+            if(!f.isValid(true)){
+                valid = false;
+                return false;
+            }
+        });
+        if(this.fbar){
+            var fitems = this.fbar.items.items;
+            for(var i = 0, len = fitems.length; i < len; i++){
+                var btn = fitems[i];
+                if(btn.formBind === true && btn.disabled === valid){
+                    btn.setDisabled(!valid);
+                }
+            }
+        }
+        this.fireEvent('clientvalidation', this, valid);
+    }
+});
+Ext.reg('form', Ext.FormPanel);
+
+Ext.form.FormPanel = Ext.FormPanel;
+
+/**\r
+ * @class Ext.form.FieldSet\r
+ * @extends Ext.Panel\r
+ * Standard container used for grouping items within a {@link Ext.form.FormPanel form}.\r
+ * <pre><code>\r
+var form = new Ext.FormPanel({\r
+    title: 'Simple Form with FieldSets',\r
+    labelWidth: 75, // label settings here cascade unless overridden\r
+    url: 'save-form.php',\r
+    frame:true,\r
+    bodyStyle:'padding:5px 5px 0',\r
+    width: 700,\r
+    renderTo: document.body,\r
+    layout:'column', // arrange items in columns\r
+    defaults: {      // defaults applied to items\r
+        layout: 'form',\r
+        border: false,\r
+        bodyStyle: 'padding:4px'\r
     },\r
-\r
-    \r
-    selectRange : function(startRow, endRow, keepExisting){\r
-        if(this.isLocked()) return;\r
-        if(!keepExisting){\r
-            this.clearSelections();\r
-        }\r
-        if(startRow <= endRow){\r
-            for(var i = startRow; i <= endRow; i++){\r
-                this.selectRow(i, true);\r
+    items: [{\r
+        // Fieldset in Column 1\r
+        xtype:'fieldset',\r
+        columnWidth: 0.5,\r
+        title: 'Fieldset 1',\r
+        collapsible: true,\r
+        autoHeight:true,\r
+        defaults: {\r
+            anchor: '-20' // leave room for error icon\r
+        },\r
+        defaultType: 'textfield',\r
+        items :[{\r
+                fieldLabel: 'Field 1'\r
+            }, {\r
+                fieldLabel: 'Field 2'\r
+            }, {\r
+                fieldLabel: 'Field 3'\r
             }\r
-        }else{\r
-            for(var i = startRow; i >= endRow; i--){\r
-                this.selectRow(i, true);\r
+        ]\r
+    },{\r
+        // Fieldset in Column 2 - Panel inside\r
+        xtype:'fieldset',\r
+        title: 'Show Panel', // title, header, or checkboxToggle creates fieldset header\r
+        autoHeight:true,\r
+        columnWidth: 0.5,\r
+        checkboxToggle: true,\r
+        collapsed: true, // fieldset initially collapsed\r
+        layout:'anchor',\r
+        items :[{\r
+            xtype: 'panel',\r
+            anchor: '100%',\r
+            title: 'Panel inside a fieldset',\r
+            frame: true,\r
+            height: 100\r
+        }]\r
+    }]\r
+});\r
+ * </code></pre>\r
+ * @constructor\r
+ * @param {Object} config Configuration options\r
+ * @xtype fieldset\r
+ */\r
+Ext.form.FieldSet = Ext.extend(Ext.Panel, {\r
+    /**\r
+     * @cfg {Mixed} checkboxToggle <tt>true</tt> to render a checkbox into the fieldset frame just\r
+     * in front of the legend to expand/collapse the fieldset when the checkbox is toggled. (defaults\r
+     * to <tt>false</tt>).\r
+     * <p>A {@link Ext.DomHelper DomHelper} element spec may also be specified to create the checkbox.\r
+     * If <tt>true</tt> is specified, the default DomHelper config object used to create the element\r
+     * is:</p><pre><code>\r
+     * {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'}\r
+     * </code></pre>   \r
+     */\r
+    /**\r
+     * @cfg {String} checkboxName The name to assign to the fieldset's checkbox if <tt>{@link #checkboxToggle} = true</tt>\r
+     * (defaults to <tt>'[checkbox id]-checkbox'</tt>).\r
+     */\r
+    /**\r
+     * @cfg {Boolean} collapsible\r
+     * <tt>true</tt> to make the fieldset collapsible and have the expand/collapse toggle button automatically\r
+     * rendered into the legend element, <tt>false</tt> to keep the fieldset statically sized with no collapse\r
+     * button (defaults to <tt>false</tt>). Another option is to configure <tt>{@link #checkboxToggle}</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Number} labelWidth The width of labels. This property cascades to child containers.\r
+     */\r
+    /**\r
+     * @cfg {String} itemCls A css class to apply to the <tt>x-form-item</tt> of fields (see \r
+     * {@link Ext.layout.FormLayout}.{@link Ext.layout.FormLayout#fieldTpl fieldTpl} for details).\r
+     * This property cascades to child containers.\r
+     */\r
+    /**\r
+     * @cfg {String} baseCls The base CSS class applied to the fieldset (defaults to <tt>'x-fieldset'</tt>).\r
+     */\r
+    baseCls : 'x-fieldset',\r
+    /**\r
+     * @cfg {String} layout The {@link Ext.Container#layout} to use inside the fieldset (defaults to <tt>'form'</tt>).\r
+     */\r
+    layout : 'form',\r
+    /**\r
+     * @cfg {Boolean} animCollapse\r
+     * <tt>true</tt> to animate the transition when the panel is collapsed, <tt>false</tt> to skip the\r
+     * animation (defaults to <tt>false</tt>).\r
+     */\r
+    animCollapse : false,\r
+\r
+    // private\r
+    onRender : function(ct, position){\r
+        if(!this.el){\r
+            this.el = document.createElement('fieldset');\r
+            this.el.id = this.id;\r
+            if (this.title || this.header || this.checkboxToggle) {\r
+                this.el.appendChild(document.createElement('legend')).className = 'x-fieldset-header';\r
             }\r
         }\r
-    },\r
 \r
-    \r
-    deselectRange : function(startRow, endRow, preventViewNotify){\r
-        if(this.isLocked()) return;\r
-        for(var i = startRow; i <= endRow; i++){\r
-            this.deselectRow(i, preventViewNotify);\r
-        }\r
-    },\r
+        Ext.form.FieldSet.superclass.onRender.call(this, ct, position);\r
 \r
-    \r
-    selectRow : function(index, keepExisting, preventViewNotify){\r
-        if(this.isLocked() || (index < 0 || index >= this.grid.store.getCount()) || this.isSelected(index)) return;\r
-        var r = this.grid.store.getAt(index);\r
-        if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){\r
-            if(!keepExisting || this.singleSelect){\r
-                this.clearSelections();\r
-            }\r
-            this.selections.add(r);\r
-            this.last = this.lastActive = index;\r
-            if(!preventViewNotify){\r
-                this.grid.getView().onRowSelect(index);\r
-            }\r
-            this.fireEvent("rowselect", this, index, r);\r
-            this.fireEvent("selectionchange", this);\r
+        if(this.checkboxToggle){\r
+            var o = typeof this.checkboxToggle == 'object' ?\r
+                    this.checkboxToggle :\r
+                    {tag: 'input', type: 'checkbox', name: this.checkboxName || this.id+'-checkbox'};\r
+            this.checkbox = this.header.insertFirst(o);\r
+            this.checkbox.dom.checked = !this.collapsed;\r
+            this.mon(this.checkbox, 'click', this.onCheckClick, this);\r
         }\r
     },\r
 \r
-    \r
-    deselectRow : function(index, preventViewNotify){\r
-        if(this.isLocked()) return;\r
-        if(this.last == index){\r
-            this.last = false;\r
-        }\r
-        if(this.lastActive == index){\r
-            this.lastActive = false;\r
-        }\r
-        var r = this.grid.store.getAt(index);\r
-        if(r){\r
-            this.selections.remove(r);\r
-            if(!preventViewNotify){\r
-                this.grid.getView().onRowDeselect(index);\r
-            }\r
-            this.fireEvent("rowdeselect", this, index, r);\r
-            this.fireEvent("selectionchange", this);\r
+    // private\r
+    onCollapse : function(doAnim, animArg){\r
+        if(this.checkbox){\r
+            this.checkbox.dom.checked = false;\r
         }\r
+        Ext.form.FieldSet.superclass.onCollapse.call(this, doAnim, animArg);\r
+\r
     },\r
 \r
     // private\r
-    restoreLast : function(){\r
-        if(this._last){\r
-            this.last = this._last;\r
+    onExpand : function(doAnim, animArg){\r
+        if(this.checkbox){\r
+            this.checkbox.dom.checked = true;\r
         }\r
+        Ext.form.FieldSet.superclass.onExpand.call(this, doAnim, animArg);\r
     },\r
 \r
-    // private\r
-    acceptsNav : function(row, col, cm){\r
-        return !cm.isHidden(col) && cm.isCellEditable(col, row);\r
-    },\r
+    /**\r
+     * This function is called by the fieldset's checkbox when it is toggled (only applies when\r
+     * checkboxToggle = true).  This method should never be called externally, but can be\r
+     * overridden to provide custom behavior when the checkbox is toggled if needed.\r
+     */\r
+    onCheckClick : function(){\r
+        this[this.checkbox.dom.checked ? 'expand' : 'collapse']();\r
+    }\r
 \r
-    // private\r
-    onEditorKey : function(field, e){\r
-        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;\r
-        var shift = e.shiftKey;\r
-        if(k == e.TAB){\r
-            e.stopEvent();\r
-            ed.completeEdit();\r
-            if(shift){\r
-                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);\r
-            }else{\r
-                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);\r
-            }\r
-        }else if(k == e.ENTER){\r
-            e.stopEvent();\r
-            ed.completeEdit();\r
-                       if(this.moveEditorOnEnter !== false){\r
-                               if(shift){\r
-                                       newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this);\r
-                               }else{\r
-                                       newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this);\r
-                               }\r
-                       }\r
-        }else if(k == e.ESC){\r
-            ed.cancelEdit();\r
-        }\r
-        if(newCell){\r
-            g.startEditing(newCell[0], newCell[1]);\r
-        }\r
+    /**\r
+     * @cfg {String/Number} activeItem\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Mixed} applyTo\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} bodyBorder\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} border\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean/Number} bufferResize\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} collapseFirst\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} defaultType\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} disabledClass\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} elements\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} floating\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} footer\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} frame\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} header\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} headerAsText\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} hideCollapseTool\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} iconCls\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean/String} shadow\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Number} shadowOffset\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} shim\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Object/Array} tbar\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} tabTip\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} titleCollapse\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Array} tools\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {Ext.Template/Ext.XTemplate} toolTemplate\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} xtype\r
+     * @hide\r
+     */\r
+    /**\r
+     * @property header\r
+     * @hide\r
+     */\r
+    /**\r
+     * @property footer\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method focus\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method getBottomToolbar\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method getTopToolbar\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method setIconClass\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event activate\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event beforeclose\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event bodyresize\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event close\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event deactivate\r
+     * @hide\r
+     */\r
+});\r
+Ext.reg('fieldset', Ext.form.FieldSet);\r
+/**\r
+ * @class Ext.form.HtmlEditor\r
+ * @extends Ext.form.Field\r
+ * Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be \r
+ * automatically hidden when needed.  These are noted in the config options where appropriate.\r
+ * <br><br>The editor's toolbar buttons have tooltips defined in the {@link #buttonTips} property, but they are not \r
+ * enabled by default unless the global {@link Ext.QuickTips} singleton is {@link Ext.QuickTips#init initialized}.\r
+ * <br><br><b>Note: The focus/blur and validation marking functionality inherited from Ext.form.Field is NOT\r
+ * supported by this editor.</b>\r
+ * <br><br>An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within\r
+ * any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.\r
+ * <br><br>Example usage:\r
+ * <pre><code>\r
+// Simple example rendered with default options:\r
+Ext.QuickTips.init();  // enable tooltips\r
+new Ext.form.HtmlEditor({\r
+    renderTo: Ext.getBody(),\r
+    width: 800,\r
+    height: 300\r
+});\r
+\r
+// Passed via xtype into a container and with custom options:\r
+Ext.QuickTips.init();  // enable tooltips\r
+new Ext.Panel({\r
+    title: 'HTML Editor',\r
+    renderTo: Ext.getBody(),\r
+    width: 600,\r
+    height: 300,\r
+    frame: true,\r
+    layout: 'fit',\r
+    items: {\r
+        xtype: 'htmleditor',\r
+        enableColors: false,\r
+        enableAlignments: false\r
     }\r
 });\r
+</code></pre>\r
+ * @constructor\r
+ * Create a new HtmlEditor\r
+ * @param {Object} config\r
+ * @xtype htmleditor\r
+ */\r
 \r
-Ext.grid.CellSelectionModel = function(config){\r
-    Ext.apply(this, config);\r
+Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {\r
+    /**\r
+     * @cfg {Boolean} enableFormat Enable the bold, italic and underline buttons (defaults to true)\r
+     */\r
+    enableFormat : true,\r
+    /**\r
+     * @cfg {Boolean} enableFontSize Enable the increase/decrease font size buttons (defaults to true)\r
+     */\r
+    enableFontSize : true,\r
+    /**\r
+     * @cfg {Boolean} enableColors Enable the fore/highlight color buttons (defaults to true)\r
+     */\r
+    enableColors : true,\r
+    /**\r
+     * @cfg {Boolean} enableAlignments Enable the left, center, right alignment buttons (defaults to true)\r
+     */\r
+    enableAlignments : true,\r
+    /**\r
+     * @cfg {Boolean} enableLists Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true)\r
+     */\r
+    enableLists : true,\r
+    /**\r
+     * @cfg {Boolean} enableSourceEdit Enable the switch to source edit button. Not available in Safari. (defaults to true)\r
+     */\r
+    enableSourceEdit : true,\r
+    /**\r
+     * @cfg {Boolean} enableLinks Enable the create link button. Not available in Safari. (defaults to true)\r
+     */\r
+    enableLinks : true,\r
+    /**\r
+     * @cfg {Boolean} enableFont Enable font selection. Not available in Safari. (defaults to true)\r
+     */\r
+    enableFont : true,\r
+    /**\r
+     * @cfg {String} createLinkText The default text for the create link prompt\r
+     */\r
+    createLinkText : 'Please enter the URL for the link:',\r
+    /**\r
+     * @cfg {String} defaultLinkValue The default value for the create link prompt (defaults to http:/ /)\r
+     */\r
+    defaultLinkValue : 'http:/'+'/',\r
+    /**\r
+     * @cfg {Array} fontFamilies An array of available font families\r
+     */\r
+    fontFamilies : [\r
+        'Arial',\r
+        'Courier New',\r
+        'Tahoma',\r
+        'Times New Roman',\r
+        'Verdana'\r
+    ],\r
+    defaultFont: 'tahoma',\r
+    /**\r
+     * @cfg {String} defaultValue A default value to be put into the editor to resolve focus issues (defaults to &#8203; (Zero-width space), &nbsp; (Non-breaking space) in Opera and IE6).\r
+     */\r
+    defaultValue: (Ext.isOpera || Ext.isIE6) ? '&nbsp;' : '&#8203;',\r
 \r
-    this.selection = null;\r
+    // private properties\r
+    actionMode: 'wrap',\r
+    validationEvent : false,\r
+    deferHeight: true,\r
+    initialized : false,\r
+    activated : false,\r
+    sourceEditMode : false,\r
+    onFocus : Ext.emptyFn,\r
+    iframePad:3,\r
+    hideMode:'offsets',\r
+    defaultAutoCreate : {\r
+        tag: "textarea",\r
+        style:"width:500px;height:300px;",\r
+        autocomplete: "off"\r
+    },\r
 \r
-    this.addEvents(\r
-        \r
-           "beforecellselect",\r
+    // private\r
+    initComponent : function(){\r
+        this.addEvents(\r
+            /**\r
+             * @event initialize\r
+             * Fires when the editor is fully initialized (including the iframe)\r
+             * @param {HtmlEditor} this\r
+             */\r
+            'initialize',\r
+            /**\r
+             * @event activate\r
+             * Fires when the editor is first receives the focus. Any insertion must wait\r
+             * until after this event.\r
+             * @param {HtmlEditor} this\r
+             */\r
+            'activate',\r
+             /**\r
+             * @event beforesync\r
+             * Fires before the textarea is updated with content from the editor iframe. Return false\r
+             * to cancel the sync.\r
+             * @param {HtmlEditor} this\r
+             * @param {String} html\r
+             */\r
+            'beforesync',\r
+             /**\r
+             * @event beforepush\r
+             * Fires before the iframe editor is updated with content from the textarea. Return false\r
+             * to cancel the push.\r
+             * @param {HtmlEditor} this\r
+             * @param {String} html\r
+             */\r
+            'beforepush',\r
+             /**\r
+             * @event sync\r
+             * Fires when the textarea is updated with content from the editor iframe.\r
+             * @param {HtmlEditor} this\r
+             * @param {String} html\r
+             */\r
+            'sync',\r
+             /**\r
+             * @event push\r
+             * Fires when the iframe editor is updated with content from the textarea.\r
+             * @param {HtmlEditor} this\r
+             * @param {String} html\r
+             */\r
+            'push',\r
+             /**\r
+             * @event editmodechange\r
+             * Fires when the editor switches edit modes\r
+             * @param {HtmlEditor} this\r
+             * @param {Boolean} sourceEdit True if source edit, false if standard editing.\r
+             */\r
+            'editmodechange'\r
+        )\r
+    },\r
+\r
+    // private\r
+    createFontOptions : function(){\r
+        var buf = [], fs = this.fontFamilies, ff, lc;\r
+        for(var i = 0, len = fs.length; i< len; i++){\r
+            ff = fs[i];\r
+            lc = ff.toLowerCase();\r
+            buf.push(\r
+                '<option value="',lc,'" style="font-family:',ff,';"',\r
+                    (this.defaultFont == lc ? ' selected="true">' : '>'),\r
+                    ff,\r
+                '</option>'\r
+            );\r
+        }\r
+        return buf.join('');\r
+    },\r
+    \r
+    /*\r
+     * Protected method that will not generally be called directly. It\r
+     * is called when the editor creates its toolbar. Override this method if you need to\r
+     * add custom toolbar buttons.\r
+     * @param {HtmlEditor} editor\r
+     */\r
+    createToolbar : function(editor){\r
         \r
-           "cellselect",\r
+        var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled();\r
         \r
-           "selectionchange"\r
-    );\r
+        function btn(id, toggle, handler){\r
+            return {\r
+                itemId : id,\r
+                cls : 'x-btn-icon',\r
+                iconCls: 'x-edit-'+id,\r
+                enableToggle:toggle !== false,\r
+                scope: editor,\r
+                handler:handler||editor.relayBtnCmd,\r
+                clickEvent:'mousedown',\r
+                tooltip: tipsEnabled ? editor.buttonTips[id] || undefined : undefined,\r
+                overflowText: editor.buttonTips[id].title || undefined,\r
+                tabIndex:-1\r
+            };\r
+        }\r
 \r
-    Ext.grid.CellSelectionModel.superclass.constructor.call(this);\r
-};\r
+        // build the toolbar\r
+        var tb = new Ext.Toolbar({\r
+            renderTo:this.wrap.dom.firstChild\r
+        });\r
 \r
-Ext.extend(Ext.grid.CellSelectionModel, Ext.grid.AbstractSelectionModel,  {\r
+        // stop form submits\r
+        this.mon(tb.el, 'click', function(e){\r
+            e.preventDefault();\r
+        });\r
 \r
-    \r
-    initEvents : function(){\r
-        this.grid.on("cellmousedown", this.handleMouseDown, this);\r
-        this.grid.getGridEl().on(Ext.isIE || Ext.isSafari3 ? "keydown" : "keypress", this.handleKeyDown, this);\r
-        var view = this.grid.view;\r
-        view.on("refresh", this.onViewChange, this);\r
-        view.on("rowupdated", this.onRowUpdated, this);\r
-        view.on("beforerowremoved", this.clearSelections, this);\r
-        view.on("beforerowsinserted", this.clearSelections, this);\r
-        if(this.grid.isEditor){\r
-            this.grid.on("beforeedit", this.beforeEdit,  this);\r
+        if(this.enableFont && !Ext.isSafari2){\r
+            this.fontSelect = tb.el.createChild({\r
+                tag:'select',\r
+                cls:'x-font-select',\r
+                html: this.createFontOptions()\r
+            });\r
+            this.mon(this.fontSelect, 'change', function(){\r
+                var font = this.fontSelect.dom.value;\r
+                this.relayCmd('fontname', font);\r
+                this.deferFocus();\r
+            }, this);\r
+\r
+            tb.add(\r
+                this.fontSelect.dom,\r
+                '-'\r
+            );\r
         }\r
-    },\r
 \r
-       //private\r
-    beforeEdit : function(e){\r
-        this.select(e.row, e.column, false, true, e.record);\r
-    },\r
+        if(this.enableFormat){\r
+            tb.add(\r
+                btn('bold'),\r
+                btn('italic'),\r
+                btn('underline')\r
+            );\r
+        }\r
 \r
-       //private\r
-    onRowUpdated : function(v, index, r){\r
-        if(this.selection && this.selection.record == r){\r
-            v.onCellSelect(index, this.selection.cell[1]);\r
+        if(this.enableFontSize){\r
+            tb.add(\r
+                '-',\r
+                btn('increasefontsize', false, this.adjustFont),\r
+                btn('decreasefontsize', false, this.adjustFont)\r
+            );\r
         }\r
-    },\r
 \r
-       //private\r
-    onViewChange : function(){\r
-        this.clearSelections(true);\r
-    },\r
+        if(this.enableColors){\r
+            tb.add(\r
+                '-', {\r
+                    itemId:'forecolor',\r
+                    cls:'x-btn-icon',\r
+                    iconCls: 'x-edit-forecolor',\r
+                    clickEvent:'mousedown',\r
+                    tooltip: tipsEnabled ? editor.buttonTips.forecolor || undefined : undefined,\r
+                    tabIndex:-1,\r
+                    menu : new Ext.menu.ColorMenu({\r
+                        allowReselect: true,\r
+                        focus: Ext.emptyFn,\r
+                        value:'000000',\r
+                        plain:true,\r
+                        listeners: {\r
+                            scope: this,\r
+                            select: function(cp, color){\r
+                                this.execCmd('forecolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);\r
+                                this.deferFocus();\r
+                            }\r
+                        },\r
+                        clickEvent:'mousedown'\r
+                    })\r
+                }, {\r
+                    itemId:'backcolor',\r
+                    cls:'x-btn-icon',\r
+                    iconCls: 'x-edit-backcolor',\r
+                    clickEvent:'mousedown',\r
+                    tooltip: tipsEnabled ? editor.buttonTips.backcolor || undefined : undefined,\r
+                    tabIndex:-1,\r
+                    menu : new Ext.menu.ColorMenu({\r
+                        focus: Ext.emptyFn,\r
+                        value:'FFFFFF',\r
+                        plain:true,\r
+                        allowReselect: true,\r
+                        listeners: {\r
+                            scope: this,\r
+                            select: function(cp, color){\r
+                                if(Ext.isGecko){\r
+                                    this.execCmd('useCSS', false);\r
+                                    this.execCmd('hilitecolor', color);\r
+                                    this.execCmd('useCSS', true);\r
+                                    this.deferFocus();\r
+                                }else{\r
+                                    this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);\r
+                                    this.deferFocus();\r
+                                }\r
+                            }\r
+                        },\r
+                        clickEvent:'mousedown'\r
+                    })\r
+                }\r
+            );\r
+        }\r
+\r
+        if(this.enableAlignments){\r
+            tb.add(\r
+                '-',\r
+                btn('justifyleft'),\r
+                btn('justifycenter'),\r
+                btn('justifyright')\r
+            );\r
+        }\r
 \r
-       \r
-    getSelectedCell : function(){\r
-        return this.selection ? this.selection.cell : null;\r
-    },\r
+        if(!Ext.isSafari2){\r
+            if(this.enableLinks){\r
+                tb.add(\r
+                    '-',\r
+                    btn('createlink', false, this.createLink)\r
+                );\r
+            }\r
 \r
-    \r
-    clearSelections : function(preventNotify){\r
-        var s = this.selection;\r
-        if(s){\r
-            if(preventNotify !== true){\r
-                this.grid.view.onCellDeselect(s.cell[0], s.cell[1]);\r
+            if(this.enableLists){\r
+                tb.add(\r
+                    '-',\r
+                    btn('insertorderedlist'),\r
+                    btn('insertunorderedlist')\r
+                );\r
+            }\r
+            if(this.enableSourceEdit){\r
+                tb.add(\r
+                    '-',\r
+                    btn('sourceedit', true, function(btn){\r
+                        this.toggleSourceEdit(!this.sourceEditMode);\r
+                    })\r
+                );\r
             }\r
-            this.selection = null;\r
-            this.fireEvent("selectionchange", this, null);\r
         }\r
-    },\r
-\r
-    \r
-    hasSelection : function(){\r
-        return this.selection ? true : false;\r
-    },\r
 \r
-    \r
-    handleMouseDown : function(g, row, cell, e){\r
-        if(e.button !== 0 || this.isLocked()){\r
-            return;\r
-        };\r
-        this.select(row, cell);\r
+        this.tb = tb;\r
     },\r
 \r
-    \r
-    select : function(rowIndex, colIndex, preventViewNotify, preventFocus,  r){\r
-        if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){\r
-            this.clearSelections();\r
-            r = r || this.grid.store.getAt(rowIndex);\r
-            this.selection = {\r
-                record : r,\r
-                cell : [rowIndex, colIndex]\r
-            };\r
-            if(!preventViewNotify){\r
-                var v = this.grid.getView();\r
-                v.onCellSelect(rowIndex, colIndex);\r
-                if(preventFocus !== true){\r
-                    v.focusCell(rowIndex, colIndex);\r
-                }\r
-            }\r
-            this.fireEvent("cellselect", this, rowIndex, colIndex);\r
-            this.fireEvent("selectionchange", this, this.selection);\r
-        }\r
+    /**\r
+     * Protected method that will not generally be called directly. It\r
+     * is called when the editor initializes the iframe with HTML contents. Override this method if you\r
+     * want to change the initialization markup of the iframe (e.g. to add stylesheets).\r
+     */\r
+    getDocMarkup : function(){\r
+        return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';\r
     },\r
 \r
-       //private\r
-    isSelectable : function(rowIndex, colIndex, cm){\r
-        return !cm.isHidden(colIndex);\r
+    // private\r
+    getEditorBody : function(){\r
+        return this.doc.body || this.doc.documentElement;\r
     },\r
 \r
-    \r
-    handleKeyDown : function(e){\r
-        if(!e.isNavKeyPress()){\r
-            return;\r
-        }\r
-        var g = this.grid, s = this.selection;\r
-        if(!s){\r
-            e.stopEvent();\r
-            var cell = g.walkCells(0, 0, 1, this.isSelectable,  this);\r
-            if(cell){\r
-                this.select(cell[0], cell[1]);\r
-            }\r
-            return;\r
-        }\r
-        var sm = this;\r
-        var walk = function(row, col, step){\r
-            return g.walkCells(row, col, step, sm.isSelectable,  sm);\r
-        };\r
-        var k = e.getKey(), r = s.cell[0], c = s.cell[1];\r
-        var newCell;\r
-\r
-        switch(k){\r
-             case e.TAB:\r
-                 if(e.shiftKey){\r
-                     newCell = walk(r, c-1, -1);\r
-                 }else{\r
-                     newCell = walk(r, c+1, 1);\r
-                 }\r
-             break;\r
-             case e.DOWN:\r
-                 newCell = walk(r+1, c, 1);\r
-             break;\r
-             case e.UP:\r
-                 newCell = walk(r-1, c, -1);\r
-             break;\r
-             case e.RIGHT:\r
-                 newCell = walk(r, c+1, 1);\r
-             break;\r
-             case e.LEFT:\r
-                 newCell = walk(r, c-1, -1);\r
-             break;\r
-             case e.ENTER:\r
-                 if(g.isEditor && !g.editing){\r
-                    g.startEditing(r, c);\r
-                    e.stopEvent();\r
-                    return;\r
-                }\r
-             break;\r
-        };\r
-        if(newCell){\r
-            this.select(newCell[0], newCell[1]);\r
-            e.stopEvent();\r
-        }\r
+    // private\r
+    getDoc : function(){\r
+        return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);\r
     },\r
 \r
-    acceptsNav : function(row, col, cm){\r
-        return !cm.isHidden(col) && cm.isCellEditable(col, row);\r
+    // private\r
+    getWin : function(){\r
+        return Ext.isIE ? this.iframe.contentWindow : window.frames[this.iframe.name];\r
     },\r
 \r
-    onEditorKey : function(field, e){\r
-        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;\r
-        if(k == e.TAB){\r
-            if(e.shiftKey){\r
-                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);\r
-            }else{\r
-                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);\r
-            }\r
-            e.stopEvent();\r
-        }else if(k == e.ENTER){\r
-            ed.completeEdit();\r
-            e.stopEvent();\r
-        }else if(k == e.ESC){\r
-               e.stopEvent();\r
-            ed.cancelEdit();\r
-        }\r
-        if(newCell){\r
-            g.startEditing(newCell[0], newCell[1]);\r
-        }\r
-    }\r
-});\r
-\r
-Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, {\r
-    \r
-    clicksToEdit: 2,\r
-\r
-    // private\r
-    isEditor : true,\r
     // private\r
-    detectEdit: false,\r
+    onRender : function(ct, position){\r
+        Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);\r
+        this.el.dom.style.border = '0 none';\r
+        this.el.dom.setAttribute('tabIndex', -1);\r
+        this.el.addClass('x-hidden');\r
+        if(Ext.isIE){ // fix IE 1px bogus margin\r
+            this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')\r
+        }\r
+        this.wrap = this.el.wrap({\r
+            cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}\r
+        });\r
 \r
-       \r
-       autoEncode : false,\r
+        this.createToolbar(this);\r
 \r
-       \r
-    // private\r
-    trackMouseOver: false, // causes very odd FF errors\r
+        this.disableItems(true);\r
+        // is this needed?\r
+        // this.tb.doLayout();\r
 \r
-    // private\r
-    initComponent : function(){\r
-        Ext.grid.EditorGridPanel.superclass.initComponent.call(this);\r
+        this.createIFrame();\r
 \r
-        if(!this.selModel){\r
-            \r
-            this.selModel = new Ext.grid.CellSelectionModel();\r
+        if(!this.width){\r
+            var sz = this.el.getSize();\r
+            this.setSize(sz.width, this.height || sz.height);\r
         }\r
-\r
-        this.activeEditor = null;\r
-\r
-           this.addEvents(\r
-            \r
-            "beforeedit",\r
-            \r
-            "afteredit",\r
-            \r
-            "validateedit"\r
-        );\r
     },\r
 \r
-    // private\r
-    initEvents : function(){\r
-        Ext.grid.EditorGridPanel.superclass.initEvents.call(this);\r
+    createIFrame: function(){\r
+        var iframe = document.createElement('iframe');\r
+        iframe.name = Ext.id();\r
+        iframe.frameBorder = '0';\r
+        iframe.src = Ext.isIE ? Ext.SSL_SECURE_URL : "javascript:;";\r
+        this.wrap.dom.appendChild(iframe);\r
 \r
-        this.on("bodyscroll", this.stopEditing, this, [true]);\r
-        this.on("columnresize", this.stopEditing, this, [true]);\r
+        this.iframe = iframe;\r
 \r
-        if(this.clicksToEdit == 1){\r
-            this.on("cellclick", this.onCellDblClick, this);\r
-        }else {\r
-            if(this.clicksToEdit == 'auto' && this.view.mainBody){\r
-                this.view.mainBody.on("mousedown", this.onAutoEditClick, this);\r
-            }\r
-            this.on("celldblclick", this.onCellDblClick, this);\r
-        }\r
+        this.monitorTask = Ext.TaskMgr.start({\r
+            run: this.checkDesignMode,\r
+            scope: this,\r
+            interval:100\r
+        });\r
     },\r
 \r
-    // private\r
-    onCellDblClick : function(g, row, col){\r
-        this.startEditing(row, col);\r
-    },\r
+    initFrame : function(){\r
+        Ext.TaskMgr.stop(this.monitorTask);\r
+        this.doc = this.getDoc();\r
+        this.win = this.getWin();\r
 \r
-    // private\r
-    onAutoEditClick : function(e, t){\r
-        if(e.button !== 0){\r
-            return;\r
-        }\r
-        var row = this.view.findRowIndex(t);\r
-        var col = this.view.findCellIndex(t);\r
-        if(row !== false && col !== false){\r
-            this.stopEditing();\r
-            if(this.selModel.getSelectedCell){ // cell sm\r
-                var sc = this.selModel.getSelectedCell();\r
-                if(sc && sc.cell[0] === row && sc.cell[1] === col){\r
-                    this.startEditing(row, col);\r
-                }\r
-            }else{\r
-                if(this.selModel.isSelected(row)){\r
-                    this.startEditing(row, col);\r
+        this.doc.open();\r
+        this.doc.write(this.getDocMarkup());\r
+        this.doc.close();\r
+\r
+        var task = { // must defer to wait for browser to be ready\r
+            run : function(){\r
+                if(this.doc.body || this.doc.readyState == 'complete'){\r
+                    Ext.TaskMgr.stop(task);\r
+                    this.doc.designMode="on";\r
+                    this.initEditor.defer(10, this);\r
                 }\r
-            }\r
-        }\r
+            },\r
+            interval : 10,\r
+            duration:10000,\r
+            scope: this\r
+        };\r
+        Ext.TaskMgr.start(task);\r
     },\r
 \r
-    // private\r
-    onEditComplete : function(ed, value, startValue){\r
-        this.editing = false;\r
-        this.activeEditor = null;\r
-        ed.un("specialkey", this.selModel.onEditorKey, this.selModel);\r
-               var r = ed.record;\r
-        var field = this.colModel.getDataIndex(ed.col);\r
-        value = this.postEditValue(value, startValue, r, field);\r
-        if(String(value) !== String(startValue)){\r
-            var e = {\r
-                grid: this,\r
-                record: r,\r
-                field: field,\r
-                originalValue: startValue,\r
-                value: value,\r
-                row: ed.row,\r
-                column: ed.col,\r
-                cancel:false\r
-            };\r
-            if(this.fireEvent("validateedit", e) !== false && !e.cancel){\r
-                r.set(field, e.value);\r
-                delete e.cancel;\r
-                this.fireEvent("afteredit", e);\r
-            }\r
-        }\r
-        this.view.focusCell(ed.row, ed.col);\r
-    },\r
 \r
-    \r
-    startEditing : function(row, col){\r
-        this.stopEditing();\r
-        if(this.colModel.isCellEditable(col, row)){\r
-            this.view.ensureVisible(row, col, true);\r
-            var r = this.store.getAt(row);\r
-            var field = this.colModel.getDataIndex(col);\r
-            var e = {\r
-                grid: this,\r
-                record: r,\r
-                field: field,\r
-                value: r.data[field],\r
-                row: row,\r
-                column: col,\r
-                cancel:false\r
-            };\r
-            if(this.fireEvent("beforeedit", e) !== false && !e.cancel){\r
-                this.editing = true;\r
-                var ed = this.colModel.getCellEditor(col, row);\r
-                if(!ed.rendered){\r
-                    ed.render(this.view.getEditorParent(ed));\r
-                }\r
-                (function(){ // complex but required for focus issues in safari, ie and opera\r
-                    ed.row = row;\r
-                    ed.col = col;\r
-                    ed.record = r;\r
-                    ed.on("complete", this.onEditComplete, this, {single: true});\r
-                    ed.on("specialkey", this.selModel.onEditorKey, this.selModel);\r
-                    \r
-                    this.activeEditor = ed;\r
-                    var v = this.preEditValue(r, field);\r
-                    ed.startEdit(this.view.getCell(row, col).firstChild, v === undefined ? '' : v);\r
-                }).defer(50, this);\r
+    checkDesignMode : function(){\r
+        if(this.wrap && this.wrap.dom.offsetWidth){\r
+            var doc = this.getDoc();\r
+            if(!doc){\r
+                return;\r
+            }\r
+            if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){\r
+                this.initFrame();\r
             }\r
         }\r
     },\r
-\r
-    // private\r
-       preEditValue : function(r, field){\r
-        var value = r.data[field];\r
-               return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlDecode(value) : value;\r
-       },\r
-\r
-    // private\r
-       postEditValue : function(value, originalValue, r, field){\r
-               return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlEncode(value) : value;\r
-       },\r
-\r
     \r
-    stopEditing : function(cancel){\r
-        if(this.activeEditor){\r
-            this.activeEditor[cancel === true ? 'cancelEdit' : 'completeEdit']();\r
+    disableItems: function(disabled){\r
+        if(this.fontSelect){\r
+            this.fontSelect.dom.disabled = disabled;\r
         }\r
-        this.activeEditor = null;\r
+        this.tb.items.each(function(item){\r
+            if(item.itemId != 'sourceedit'){\r
+                item.setDisabled(disabled);\r
+            }\r
+        });\r
     },\r
 \r
     // private\r
-    onDestroy: function() {\r
-        if(this.rendered){\r
-            var cols = this.colModel.config;\r
-            for(var i = 0, len = cols.length; i < len; i++){\r
-                var c = cols[i];\r
-                Ext.destroy(c.editor);\r
+    onResize : function(w, h){\r
+        Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);\r
+        if(this.el && this.iframe){\r
+            if(typeof w == 'number'){\r
+                var aw = w - this.wrap.getFrameWidth('lr');\r
+                this.el.setWidth(this.adjustWidth('textarea', aw));\r
+                this.tb.setWidth(aw);\r
+                this.iframe.style.width = Math.max(aw, 0) + 'px';\r
             }\r
-        }\r
-        Ext.grid.EditorGridPanel.superclass.onDestroy.call(this);\r
-    }\r
-});\r
-Ext.reg('editorgrid', Ext.grid.EditorGridPanel);\r
-// private\r
-// This is a support class used internally by the Grid components\r
-Ext.grid.GridEditor = function(field, config){\r
-    Ext.grid.GridEditor.superclass.constructor.call(this, field, config);\r
-    field.monitorTab = false;\r
-};\r
-\r
-Ext.extend(Ext.grid.GridEditor, Ext.Editor, {\r
-    alignment: "tl-tl",\r
-    autoSize: "width",\r
-    hideEl : false,\r
-    cls: "x-small-editor x-grid-editor",\r
-    shim:false,\r
-    shadow:false\r
-});\r
-\r
-Ext.grid.PropertyRecord = Ext.data.Record.create([\r
-    {name:'name',type:'string'}, 'value'\r
-]);\r
-\r
-\r
-Ext.grid.PropertyStore = function(grid, source){\r
-    this.grid = grid;\r
-    this.store = new Ext.data.Store({\r
-        recordType : Ext.grid.PropertyRecord\r
-    });\r
-    this.store.on('update', this.onUpdate,  this);\r
-    if(source){\r
-        this.setSource(source);\r
-    }\r
-    Ext.grid.PropertyStore.superclass.constructor.call(this);\r
-};\r
-Ext.extend(Ext.grid.PropertyStore, Ext.util.Observable, {\r
-    // protected - should only be called by the grid.  Use grid.setSource instead.\r
-    setSource : function(o){\r
-        this.source = o;\r
-        this.store.removeAll();\r
-        var data = [];\r
-        for(var k in o){\r
-            if(this.isEditableValue(o[k])){\r
-                data.push(new Ext.grid.PropertyRecord({name: k, value: o[k]}, k));\r
+            if(typeof h == 'number'){\r
+                var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();\r
+                this.el.setHeight(this.adjustWidth('textarea', ah));\r
+                this.iframe.style.height = Math.max(ah, 0) + 'px';\r
+                if(this.doc){\r
+                    this.getEditorBody().style.height = Math.max((ah - (this.iframePad*2)), 0) + 'px';\r
+                }\r
             }\r
         }\r
-        this.store.loadRecords({records: data}, {}, true);\r
     },\r
 \r
-    // private\r
-    onUpdate : function(ds, record, type){\r
-        if(type == Ext.data.Record.EDIT){\r
-            var v = record.data['value'];\r
-            var oldValue = record.modified['value'];\r
-            if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){\r
-                this.source[record.id] = v;\r
-                record.commit();\r
-                this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);\r
-            }else{\r
-                record.reject();\r
+    /**\r
+     * Toggles the editor between standard and source edit mode.\r
+     * @param {Boolean} sourceEdit (optional) True for source edit, false for standard\r
+     */\r
+    toggleSourceEdit : function(sourceEditMode){\r
+        if(sourceEditMode === undefined){\r
+            sourceEditMode = !this.sourceEditMode;\r
+        }\r
+        this.sourceEditMode = sourceEditMode === true;\r
+        var btn = this.tb.items.get('sourceedit');\r
+        if(btn.pressed !== this.sourceEditMode){\r
+            btn.toggle(this.sourceEditMode);\r
+            if(!btn.xtbHidden){\r
+                return;\r
             }\r
         }\r
-    },\r
-\r
-    // private\r
-    getProperty : function(row){\r
-       return this.store.getAt(row);\r
-    },\r
-\r
-    // private\r
-    isEditableValue: function(val){\r
-        if(Ext.isDate(val)){\r
-            return true;\r
-        }else if(typeof val == 'object' || typeof val == 'function'){\r
-            return false;\r
+        if(this.sourceEditMode){\r
+            this.disableItems(true);\r
+            this.syncValue();\r
+            this.iframe.className = 'x-hidden';\r
+            this.el.removeClass('x-hidden');\r
+            this.el.dom.removeAttribute('tabIndex');\r
+            this.el.focus();\r
+        }else{\r
+            if(this.initialized){\r
+                this.disableItems(false);\r
+            }\r
+            this.pushValue();\r
+            this.iframe.className = '';\r
+            this.el.addClass('x-hidden');\r
+            this.el.dom.setAttribute('tabIndex', -1);\r
+            this.deferFocus();\r
+        }\r
+        var lastSize = this.lastSize;\r
+        if(lastSize){\r
+            delete this.lastSize;\r
+            this.setSize(lastSize);\r
         }\r
-        return true;\r
-    },\r
-\r
-    // private\r
-    setValue : function(prop, value){\r
-        this.source[prop] = value;\r
-        this.store.getById(prop).set('value', value);\r
+        this.fireEvent('editmodechange', this, this.sourceEditMode);\r
     },\r
 \r
-    // protected - should only be called by the grid.  Use grid.getSource instead.\r
-    getSource : function(){\r
-        return this.source;\r
-    }\r
-});\r
-\r
-\r
-Ext.grid.PropertyColumnModel = function(grid, store){\r
-    this.grid = grid;\r
-    var g = Ext.grid;\r
-    g.PropertyColumnModel.superclass.constructor.call(this, [\r
-        {header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},\r
-        {header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}\r
-    ]);\r
-    this.store = store;\r
-    this.bselect = Ext.DomHelper.append(document.body, {\r
-        tag: 'select', cls: 'x-grid-editor x-hide-display', children: [\r
-            {tag: 'option', value: 'true', html: 'true'},\r
-            {tag: 'option', value: 'false', html: 'false'}\r
-        ]\r
-    });\r
-    var f = Ext.form;\r
-\r
-    var bfield = new f.Field({\r
-        el:this.bselect,\r
-        bselect : this.bselect,\r
-        autoShow: true,\r
-        getValue : function(){\r
-            return this.bselect.value == 'true';\r
+    // private used internally\r
+    createLink : function(){\r
+        var url = prompt(this.createLinkText, this.defaultLinkValue);\r
+        if(url && url != 'http:/'+'/'){\r
+            this.relayCmd('createlink', url);\r
         }\r
-    });\r
-    this.editors = {\r
-        'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),\r
-        'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),\r
-        'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),\r
-        'boolean' : new g.GridEditor(bfield)\r
-    };\r
-    this.renderCellDelegate = this.renderCell.createDelegate(this);\r
-    this.renderPropDelegate = this.renderProp.createDelegate(this);\r
-};\r
-\r
-Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, {\r
-    // private - strings used for locale support\r
-    nameText : 'Name',\r
-    valueText : 'Value',\r
-    dateFormat : 'm/j/Y',\r
-\r
-    // private\r
-    renderDate : function(dateVal){\r
-        return dateVal.dateFormat(this.dateFormat);\r
     },\r
 \r
-    // private\r
-    renderBool : function(bVal){\r
-        return bVal ? 'true' : 'false';\r
-    },\r
+    // private (for BoxComponent)\r
+    adjustSize : Ext.BoxComponent.prototype.adjustSize,\r
 \r
-    // private\r
-    isCellEditable : function(colIndex, rowIndex){\r
-        return colIndex == 1;\r
+    // private (for BoxComponent)\r
+    getResizeEl : function(){\r
+        return this.wrap;\r
     },\r
 \r
-    // private\r
-    getRenderer : function(col){\r
-        return col == 1 ?\r
-            this.renderCellDelegate : this.renderPropDelegate;\r
+    // private (for BoxComponent)\r
+    getPositionEl : function(){\r
+        return this.wrap;\r
     },\r
 \r
     // private\r
-    renderProp : function(v){\r
-        return this.getPropertyName(v);\r
+    initEvents : function(){\r
+        this.originalValue = this.getValue();\r
     },\r
 \r
-    // private\r
-    renderCell : function(val){\r
-        var rv = val;\r
-        if(Ext.isDate(val)){\r
-            rv = this.renderDate(val);\r
-        }else if(typeof val == 'boolean'){\r
-            rv = this.renderBool(val);\r
-        }\r
-        return Ext.util.Format.htmlEncode(rv);\r
-    },\r
+    /**\r
+     * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide\r
+     * @method\r
+     */\r
+    markInvalid : Ext.emptyFn,\r
+    \r
+    /**\r
+     * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide\r
+     * @method\r
+     */\r
+    clearInvalid : Ext.emptyFn,\r
 \r
-    // private\r
-    getPropertyName : function(name){\r
-        var pn = this.grid.propertyNames;\r
-        return pn && pn[name] ? pn[name] : name;\r
+    // docs inherit from Field\r
+    setValue : function(v){\r
+        Ext.form.HtmlEditor.superclass.setValue.call(this, v);\r
+        this.pushValue();\r
+        return this;\r
     },\r
 \r
-    // private\r
-    getCellEditor : function(colIndex, rowIndex){\r
-        var p = this.store.getProperty(rowIndex);\r
-        var n = p.data['name'], val = p.data['value'];\r
-        if(this.grid.customEditors[n]){\r
-            return this.grid.customEditors[n];\r
+    /**\r
+     * Protected method that will not generally be called directly. If you need/want\r
+     * custom HTML cleanup, this is the method you should override.\r
+     * @param {String} html The HTML to be cleaned\r
+     * @return {String} The cleaned HTML\r
+     */\r
+    cleanHtml : function(html){\r
+        html = String(html);\r
+        if(html.length > 5){\r
+            if(Ext.isWebKit){ // strip safari nonsense\r
+                html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');\r
+            }\r
         }\r
-        if(Ext.isDate(val)){\r
-            return this.editors['date'];\r
-        }else if(typeof val == 'number'){\r
-            return this.editors['number'];\r
-        }else if(typeof val == 'boolean'){\r
-            return this.editors['boolean'];\r
-        }else{\r
-            return this.editors['string'];\r
+        if(html == this.defaultValue){\r
+            html = '';\r
         }\r
-    }\r
-});\r
-\r
+        return html;\r
+    },\r
 \r
-Ext.grid.PropertyGrid = Ext.extend(Ext.grid.EditorGridPanel, {\r
-    \r
-    \r
+    /**\r
+     * Protected method that will not generally be called directly. Syncs the contents\r
+     * of the editor iframe with the textarea.\r
+     */\r
+    syncValue : function(){\r
+        if(this.initialized){\r
+            var bd = this.getEditorBody();\r
+            var html = bd.innerHTML;\r
+            if(Ext.isWebKit){\r
+                var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!\r
+                var m = bs.match(/text-align:(.*?);/i);\r
+                if(m && m[1]){\r
+                    html = '<div style="'+m[0]+'">' + html + '</div>';\r
+                }\r
+            }\r
+            html = this.cleanHtml(html);\r
+            if(this.fireEvent('beforesync', this, html) !== false){\r
+                this.el.dom.value = html;\r
+                this.fireEvent('sync', this, html);\r
+            }\r
+        }\r
+    },\r
     \r
-\r
-    // private config overrides\r
-    enableColumnMove:false,\r
-    stripeRows:false,\r
-    trackMouseOver: false,\r
-    clicksToEdit:1,\r
-    enableHdMenu : false,\r
-    viewConfig : {\r
-        forceFit:true\r
+    //docs inherit from Field\r
+    getValue : function() {\r
+        this[this.sourceEditMode ? 'pushValue' : 'syncValue']();\r
+        return Ext.form.HtmlEditor.superclass.getValue.call(this);\r
     },\r
 \r
-    // private\r
-    initComponent : function(){\r
-        this.customEditors = this.customEditors || {};\r
-        this.lastEditRow = null;\r
-        var store = new Ext.grid.PropertyStore(this);\r
-        this.propStore = store;\r
-        var cm = new Ext.grid.PropertyColumnModel(this, store);\r
-        store.store.sort('name', 'ASC');\r
-        this.addEvents(\r
-            \r
-            'beforepropertychange',\r
-            \r
-            'propertychange'\r
-        );\r
-        this.cm = cm;\r
-        this.ds = store.store;\r
-        Ext.grid.PropertyGrid.superclass.initComponent.call(this);\r
-\r
-        this.selModel.on('beforecellselect', function(sm, rowIndex, colIndex){\r
-            if(colIndex === 0){\r
-                this.startEditing.defer(200, this, [rowIndex, 1]);\r
-                return false;\r
+    /**\r
+     * Protected method that will not generally be called directly. Pushes the value of the textarea\r
+     * into the iframe editor.\r
+     */\r
+    pushValue : function(){\r
+        if(this.initialized){\r
+            var v = this.el.dom.value;\r
+            if(!this.activated && v.length < 1){\r
+                v = this.defaultValue;\r
             }\r
-        }, this);\r
+            if(this.fireEvent('beforepush', this, v) !== false){\r
+                this.getEditorBody().innerHTML = v;\r
+                if(Ext.isGecko){\r
+                    // Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8\r
+                    var d = this.doc,\r
+                        mode = d.designMode.toLowerCase();\r
+                    \r
+                    d.designMode = mode.toggle('on', 'off');\r
+                    d.designMode = mode;\r
+                }\r
+                this.fireEvent('push', this, v);\r
+            }\r
+        }\r
     },\r
 \r
     // private\r
-    onRender : function(){\r
-        Ext.grid.PropertyGrid.superclass.onRender.apply(this, arguments);\r
-\r
-        this.getGridEl().addClass('x-props-grid');\r
+    deferFocus : function(){\r
+        this.focus.defer(10, this);\r
     },\r
 \r
-    // private\r
-    afterRender: function(){\r
-        Ext.grid.PropertyGrid.superclass.afterRender.apply(this, arguments);\r
-        if(this.source){\r
-            this.setSource(this.source);\r
+    // docs inherit from Field\r
+    focus : function(){\r
+        if(this.win && !this.sourceEditMode){\r
+            this.win.focus();\r
+        }else{\r
+            this.el.focus();\r
         }\r
     },\r
 \r
-    \r
-    setSource : function(source){\r
-        this.propStore.setSource(source);\r
-    },\r
+    // private\r
+    initEditor : function(){\r
+        //Destroying the component during/before initEditor can cause issues.\r
+        try{\r
+            var dbody = this.getEditorBody();\r
+            var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');\r
+            ss['background-attachment'] = 'fixed'; // w3c\r
+            dbody.bgProperties = 'fixed'; // ie\r
 \r
-    \r
-    getSource : function(){\r
-        return this.propStore.getSource();\r
-    }\r
-});\r
-Ext.reg("propertygrid", Ext.grid.PropertyGrid);\r
+            Ext.DomHelper.applyStyles(dbody, ss);\r
 \r
+            if(this.doc){\r
+                try{\r
+                    Ext.EventManager.removeAll(this.doc);\r
+                }catch(e){}\r
+            }\r
 \r
-Ext.grid.RowNumberer = function(config){\r
-    Ext.apply(this, config);\r
-    if(this.rowspan){\r
-        this.renderer = this.renderer.createDelegate(this);\r
-    }\r
-};\r
+            this.doc = this.getDoc();\r
 \r
-Ext.grid.RowNumberer.prototype = {\r
-    \r
-    header: "",\r
-    \r
-    width: 23,\r
-    \r
-    sortable: false,\r
+            Ext.EventManager.on(this.doc, {\r
+                'mousedown': this.onEditorEvent,\r
+                'dblclick': this.onEditorEvent,\r
+                'click': this.onEditorEvent,\r
+                'keyup': this.onEditorEvent,\r
+                buffer:100,\r
+                scope: this\r
+            });\r
 \r
-    // private\r
-    fixed:true,\r
-    menuDisabled:true,\r
-    dataIndex: '',\r
-    id: 'numberer',\r
-    rowspan: undefined,\r
+            if(Ext.isGecko){\r
+                Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);\r
+            }\r
+            if(Ext.isIE || Ext.isWebKit || Ext.isOpera){\r
+                Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);\r
+            }\r
+            this.initialized = true;\r
+            this.fireEvent('initialize', this);\r
+            this.doc.editorInitialized = true;\r
+            this.pushValue();\r
+        }catch(e){}\r
+    },\r
 \r
     // private\r
-    renderer : function(v, p, record, rowIndex){\r
-        if(this.rowspan){\r
-            p.cellAttr = 'rowspan="'+this.rowspan+'"';\r
+    onDestroy : function(){\r
+        if(this.monitorTask){\r
+            Ext.TaskMgr.stop(this.monitorTask);\r
         }\r
-        return rowIndex+1;\r
-    }\r
-};\r
-\r
-Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {\r
-    \r
-    header: '<div class="x-grid3-hd-checker">&#160;</div>',\r
-    \r
-    width: 20,\r
-    \r
-    sortable: false,\r
-\r
-    // private\r
-    menuDisabled:true,\r
-    fixed:true,\r
-    dataIndex: '',\r
-    id: 'checker',\r
-\r
-    // private\r
-    initEvents : function(){\r
-        Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);\r
-        this.grid.on('render', function(){\r
-            var view = this.grid.getView();\r
-            view.mainBody.on('mousedown', this.onMouseDown, this);\r
-            Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);\r
-\r
-        }, this);\r
+        if(this.rendered){\r
+            Ext.destroy(this.tb);\r
+            if(this.wrap){\r
+                this.wrap.dom.innerHTML = '';\r
+                this.wrap.remove();\r
+            }\r
+        }\r
+        if(this.el){\r
+            this.el.removeAllListeners();\r
+            this.el.remove();\r
+        }\r
\r
+        if(this.doc){\r
+            try{\r
+                Ext.EventManager.removeAll(this.doc);\r
+                for (var prop in this.doc){\r
+                   delete this.doc[prop];\r
+                }\r
+            }catch(e){}\r
+        }\r
+        this.purgeListeners();\r
     },\r
 \r
     // private\r
-    onMouseDown : function(e, t){\r
-        if(e.button === 0 && t.className == 'x-grid3-row-checker'){ // Only fire if left-click\r
-            e.stopEvent();\r
-            var row = e.getTarget('.x-grid3-row');\r
-            if(row){\r
-                var index = row.rowIndex;\r
-                if(this.isSelected(index)){\r
-                    this.deselectRow(index);\r
-                }else{\r
-                    this.selectRow(index, true);\r
-                }\r
+    onFirstFocus : function(){\r
+        this.activated = true;\r
+        this.disableItems(false);\r
+        if(Ext.isGecko){ // prevent silly gecko errors\r
+            this.win.focus();\r
+            var s = this.win.getSelection();\r
+            if(!s.focusNode || s.focusNode.nodeType != 3){\r
+                var r = s.getRangeAt(0);\r
+                r.selectNodeContents(this.getEditorBody());\r
+                r.collapse(true);\r
+                this.deferFocus();\r
             }\r
+            try{\r
+                this.execCmd('useCSS', true);\r
+                this.execCmd('styleWithCSS', false);\r
+            }catch(e){}\r
         }\r
+        this.fireEvent('activate', this);\r
     },\r
 \r
     // private\r
-    onHdMouseDown : function(e, t){\r
-        if(t.className == 'x-grid3-hd-checker'){\r
-            e.stopEvent();\r
-            var hd = Ext.fly(t.parentNode);\r
-            var isChecked = hd.hasClass('x-grid3-hd-checker-on');\r
-            if(isChecked){\r
-                hd.removeClass('x-grid3-hd-checker-on');\r
-                this.clearSelections();\r
-            }else{\r
-                hd.addClass('x-grid3-hd-checker-on');\r
-                this.selectAll();\r
+    adjustFont: function(btn){\r
+        var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;\r
+\r
+        var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);\r
+        if((Ext.isSafari && !Ext.isSafari2) || Ext.isChrome || Ext.isAir){\r
+            // Safari 3 values\r
+            // 1 = 10px, 2 = 13px, 3 = 16px, 4 = 18px, 5 = 24px, 6 = 32px\r
+            if(v <= 10){\r
+                v = 1 + adjust;\r
+            }else if(v <= 13){\r
+                v = 2 + adjust;\r
+            }else if(v <= 16){\r
+                v = 3 + adjust;\r
+            }else if(v <= 18){\r
+                v = 4 + adjust;\r
+            }else if(v <= 24){\r
+                v = 5 + adjust;\r
+            }else {\r
+                v = 6 + adjust;\r
+            }\r
+            v = v.constrain(1, 6);\r
+        }else{\r
+            if(Ext.isSafari){ // safari\r
+                adjust *= 2;\r
             }\r
+            v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);\r
         }\r
+        this.execCmd('FontSize', v);\r
+    },\r
+\r
+    // private\r
+    onEditorEvent : function(e){\r
+        this.updateToolbar();\r
     },\r
 \r
-    // private\r
-    renderer : function(v, p, record){\r
-        return '<div class="x-grid3-row-checker">&#160;</div>';\r
-    }\r
-});\r
 \r
-Ext.LoadMask = function(el, config){\r
-    this.el = Ext.get(el);\r
-    Ext.apply(this, config);\r
-    if(this.store){\r
-        this.store.on('beforeload', this.onBeforeLoad, this);\r
-        this.store.on('load', this.onLoad, this);\r
-        this.store.on('loadexception', this.onLoad, this);\r
-        this.removeMask = Ext.value(this.removeMask, false);\r
-    }else{\r
-        var um = this.el.getUpdater();\r
-        um.showLoadIndicator = false; // disable the default indicator\r
-        um.on('beforeupdate', this.onBeforeLoad, this);\r
-        um.on('update', this.onLoad, this);\r
-        um.on('failure', this.onLoad, this);\r
-        this.removeMask = Ext.value(this.removeMask, true);\r
-    }\r
-};\r
+    /**\r
+     * Protected method that will not generally be called directly. It triggers\r
+     * a toolbar update by reading the markup state of the current selection in the editor.\r
+     */\r
+    updateToolbar: function(){\r
 \r
-Ext.LoadMask.prototype = {\r
-    \r
-    \r
-    \r
-    msg : 'Loading...',\r
-    \r
-    msgCls : 'x-mask-loading',\r
+        if(!this.activated){\r
+            this.onFirstFocus();\r
+            return;\r
+        }\r
 \r
-    \r
-    disabled: false,\r
+        var btns = this.tb.items.map, doc = this.doc;\r
 \r
-    \r
-    disable : function(){\r
-       this.disabled = true;\r
-    },\r
+        if(this.enableFont && !Ext.isSafari2){\r
+            var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();\r
+            if(name != this.fontSelect.dom.value){\r
+                this.fontSelect.dom.value = name;\r
+            }\r
+        }\r
+        if(this.enableFormat){\r
+            btns.bold.toggle(doc.queryCommandState('bold'));\r
+            btns.italic.toggle(doc.queryCommandState('italic'));\r
+            btns.underline.toggle(doc.queryCommandState('underline'));\r
+        }\r
+        if(this.enableAlignments){\r
+            btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));\r
+            btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));\r
+            btns.justifyright.toggle(doc.queryCommandState('justifyright'));\r
+        }\r
+        if(!Ext.isSafari2 && this.enableLists){\r
+            btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));\r
+            btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));\r
+        }\r
+        \r
+        Ext.menu.MenuMgr.hideAll();\r
 \r
-    \r
-    enable : function(){\r
-        this.disabled = false;\r
+        this.syncValue();\r
     },\r
 \r
     // private\r
-    onLoad : function(){\r
-        this.el.unmask(this.removeMask);\r
+    relayBtnCmd : function(btn){\r
+        this.relayCmd(btn.itemId);\r
+    },\r
+\r
+    /**\r
+     * Executes a Midas editor command on the editor document and performs necessary focus and\r
+     * toolbar updates. <b>This should only be called after the editor is initialized.</b>\r
+     * @param {String} cmd The Midas command\r
+     * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)\r
+     */\r
+    relayCmd : function(cmd, value){\r
+        (function(){\r
+            this.focus();\r
+            this.execCmd(cmd, value);\r
+            this.updateToolbar();\r
+        }).defer(10, this);\r
+    },\r
+\r
+    /**\r
+     * Executes a Midas editor command directly on the editor document.\r
+     * For visual commands, you should use {@link #relayCmd} instead.\r
+     * <b>This should only be called after the editor is initialized.</b>\r
+     * @param {String} cmd The Midas command\r
+     * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)\r
+     */\r
+    execCmd : function(cmd, value){\r
+        this.doc.execCommand(cmd, false, value === undefined ? null : value);\r
+        this.syncValue();\r
     },\r
 \r
     // private\r
-    onBeforeLoad : function(){\r
-        if(!this.disabled){\r
-            this.el.mask(this.msg, this.msgCls);\r
+    applyCommand : function(e){\r
+        if(e.ctrlKey){\r
+            var c = e.getCharCode(), cmd;\r
+            if(c > 0){\r
+                c = String.fromCharCode(c);\r
+                switch(c){\r
+                    case 'b':\r
+                        cmd = 'bold';\r
+                    break;\r
+                    case 'i':\r
+                        cmd = 'italic';\r
+                    break;\r
+                    case 'u':\r
+                        cmd = 'underline';\r
+                    break;\r
+                }\r
+                if(cmd){\r
+                    this.win.focus();\r
+                    this.execCmd(cmd);\r
+                    this.deferFocus();\r
+                    e.preventDefault();\r
+                }\r
+            }\r
         }\r
     },\r
 \r
-    \r
-    show: function(){\r
-        this.onBeforeLoad();\r
+    /**\r
+     * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated\r
+     * to insert text.\r
+     * @param {String} text\r
+     */\r
+    insertAtCursor : function(text){\r
+        if(!this.activated){\r
+            return;\r
+        }\r
+        if(Ext.isIE){\r
+            this.win.focus();\r
+            var r = this.doc.selection.createRange();\r
+            if(r){\r
+                r.collapse(true);\r
+                r.pasteHTML(text);\r
+                this.syncValue();\r
+                this.deferFocus();\r
+            }\r
+        }else if(Ext.isGecko || Ext.isOpera){\r
+            this.win.focus();\r
+            this.execCmd('InsertHTML', text);\r
+            this.deferFocus();\r
+        }else if(Ext.isWebKit){\r
+            this.execCmd('InsertText', text);\r
+            this.deferFocus();\r
+        }\r
     },\r
 \r
-    \r
-    hide: function(){\r
-        this.onLoad();    \r
+    // private\r
+    fixKeys : function(){ // load time branching for fastest keydown performance\r
+        if(Ext.isIE){\r
+            return function(e){\r
+                var k = e.getKey(), r;\r
+                if(k == e.TAB){\r
+                    e.stopEvent();\r
+                    r = this.doc.selection.createRange();\r
+                    if(r){\r
+                        r.collapse(true);\r
+                        r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;');\r
+                        this.deferFocus();\r
+                    }\r
+                }else if(k == e.ENTER){\r
+                    r = this.doc.selection.createRange();\r
+                    if(r){\r
+                        var target = r.parentElement();\r
+                        if(!target || target.tagName.toLowerCase() != 'li'){\r
+                            e.stopEvent();\r
+                            r.pasteHTML('<br />');\r
+                            r.collapse(false);\r
+                            r.select();\r
+                        }\r
+                    }\r
+                }\r
+            };\r
+        }else if(Ext.isOpera){\r
+            return function(e){\r
+                var k = e.getKey();\r
+                if(k == e.TAB){\r
+                    e.stopEvent();\r
+                    this.win.focus();\r
+                    this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;');\r
+                    this.deferFocus();\r
+                }\r
+            };\r
+        }else if(Ext.isWebKit){\r
+            return function(e){\r
+                var k = e.getKey();\r
+                if(k == e.TAB){\r
+                    e.stopEvent();\r
+                    this.execCmd('InsertText','\t');\r
+                    this.deferFocus();\r
+                }\r
+             };\r
+        }\r
+    }(),\r
+\r
+    /**\r
+     * Returns the editor's toolbar. <b>This is only available after the editor has been rendered.</b>\r
+     * @return {Ext.Toolbar}\r
+     */\r
+    getToolbar : function(){\r
+        return this.tb;\r
     },\r
 \r
-    // private\r
-    destroy : function(){\r
-        if(this.store){\r
-            this.store.un('beforeload', this.onBeforeLoad, this);\r
-            this.store.un('load', this.onLoad, this);\r
-            this.store.un('loadexception', this.onLoad, this);\r
-        }else{\r
-            var um = this.el.getUpdater();\r
-            um.un('beforeupdate', this.onBeforeLoad, this);\r
-            um.un('update', this.onLoad, this);\r
-            um.un('failure', this.onLoad, this);\r
+    /**\r
+     * Object collection of toolbar tooltips for the buttons in the editor. The key\r
+     * is the command id associated with that button and the value is a valid QuickTips object.\r
+     * For example:\r
+<pre><code>\r
+{\r
+    bold : {\r
+        title: 'Bold (Ctrl+B)',\r
+        text: 'Make the selected text bold.',\r
+        cls: 'x-html-editor-tip'\r
+    },\r
+    italic : {\r
+        title: 'Italic (Ctrl+I)',\r
+        text: 'Make the selected text italic.',\r
+        cls: 'x-html-editor-tip'\r
+    },\r
+    ...\r
+</code></pre>\r
+    * @type Object\r
+     */\r
+    buttonTips : {\r
+        bold : {\r
+            title: 'Bold (Ctrl+B)',\r
+            text: 'Make the selected text bold.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        italic : {\r
+            title: 'Italic (Ctrl+I)',\r
+            text: 'Make the selected text italic.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        underline : {\r
+            title: 'Underline (Ctrl+U)',\r
+            text: 'Underline the selected text.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        increasefontsize : {\r
+            title: 'Grow Text',\r
+            text: 'Increase the font size.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        decreasefontsize : {\r
+            title: 'Shrink Text',\r
+            text: 'Decrease the font size.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        backcolor : {\r
+            title: 'Text Highlight Color',\r
+            text: 'Change the background color of the selected text.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        forecolor : {\r
+            title: 'Font Color',\r
+            text: 'Change the color of the selected text.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        justifyleft : {\r
+            title: 'Align Text Left',\r
+            text: 'Align text to the left.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        justifycenter : {\r
+            title: 'Center Text',\r
+            text: 'Center text in the editor.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        justifyright : {\r
+            title: 'Align Text Right',\r
+            text: 'Align text to the right.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        insertunorderedlist : {\r
+            title: 'Bullet List',\r
+            text: 'Start a bulleted list.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        insertorderedlist : {\r
+            title: 'Numbered List',\r
+            text: 'Start a numbered list.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        createlink : {\r
+            title: 'Hyperlink',\r
+            text: 'Make the selected text a hyperlink.',\r
+            cls: 'x-html-editor-tip'\r
+        },\r
+        sourceedit : {\r
+            title: 'Source Edit',\r
+            text: 'Switch to source editing mode.',\r
+            cls: 'x-html-editor-tip'\r
         }\r
     }\r
-};\r
 \r
-Ext.ProgressBar = Ext.extend(Ext.BoxComponent, {\r
-   \r
-    baseCls : 'x-progress',\r
-    \r
-    \r
-    animate : false,\r
+    // hide stuff that is not compatible\r
+    /**\r
+     * @event blur\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event change\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event focus\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event specialkey\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg {String} fieldClass @hide\r
+     */\r
+    /**\r
+     * @cfg {String} focusClass @hide\r
+     */\r
+    /**\r
+     * @cfg {String} autoCreate @hide\r
+     */\r
+    /**\r
+     * @cfg {String} inputType @hide\r
+     */\r
+    /**\r
+     * @cfg {String} invalidClass @hide\r
+     */\r
+    /**\r
+     * @cfg {String} invalidText @hide\r
+     */\r
+    /**\r
+     * @cfg {String} msgFx @hide\r
+     */\r
+    /**\r
+     * @cfg {String} validateOnBlur @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} allowDomMove  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} applyTo @hide\r
+     */\r
+    /**\r
+     * @cfg {String} autoHeight  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} autoWidth  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} cls  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} disabled  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} disabledClass  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} msgTarget  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} readOnly  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} style  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} validationDelay  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} validationEvent  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} tabIndex  @hide\r
+     */\r
+    /**\r
+     * @property disabled\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method applyToMarkup\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method disable\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method enable\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method validate\r
+     * @hide\r
+     */\r
+    /**\r
+     * @event valid\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method setDisabled\r
+     * @hide\r
+     */\r
+    /**\r
+     * @cfg keys\r
+     * @hide\r
+     */\r
+});\r
+Ext.reg('htmleditor', Ext.form.HtmlEditor);/**\r
+ * @class Ext.form.TimeField\r
+ * @extends Ext.form.ComboBox\r
+ * Provides a time input field with a time dropdown and automatic time validation.  Example usage:\r
+ * <pre><code>\r
+new Ext.form.TimeField({\r
+    minValue: '9:00 AM',\r
+    maxValue: '6:00 PM',\r
+    increment: 30\r
+});\r
+</code></pre>\r
+ * @constructor\r
+ * Create a new TimeField\r
+ * @param {Object} config\r
+ * @xtype timefield\r
+ */\r
+Ext.form.TimeField = Ext.extend(Ext.form.ComboBox, {\r
+    /**\r
+     * @cfg {Date/String} minValue\r
+     * The minimum allowed time. Can be either a Javascript date object with a valid time value or a string \r
+     * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).\r
+     */\r
+    minValue : null,\r
+    /**\r
+     * @cfg {Date/String} maxValue\r
+     * The maximum allowed time. Can be either a Javascript date object with a valid time value or a string \r
+     * time in a valid format -- see {@link #format} and {@link #altFormats} (defaults to null).\r
+     */\r
+    maxValue : null,\r
+    /**\r
+     * @cfg {String} minText\r
+     * The error text to display when the date in the cell is before minValue (defaults to\r
+     * 'The time in this field must be equal to or after {0}').\r
+     */\r
+    minText : "The time in this field must be equal to or after {0}",\r
+    /**\r
+     * @cfg {String} maxText\r
+     * The error text to display when the time is after maxValue (defaults to\r
+     * 'The time in this field must be equal to or before {0}').\r
+     */\r
+    maxText : "The time in this field must be equal to or before {0}",\r
+    /**\r
+     * @cfg {String} invalidText\r
+     * The error text to display when the time in the field is invalid (defaults to\r
+     * '{value} is not a valid time').\r
+     */\r
+    invalidText : "{0} is not a valid time",\r
+    /**\r
+     * @cfg {String} format\r
+     * The default time format string which can be overriden for localization support.  The format must be\r
+     * valid according to {@link Date#parseDate} (defaults to 'g:i A', e.g., '3:15 PM').  For 24-hour time\r
+     * format try 'H:i' instead.\r
+     */\r
+    format : "g:i A",\r
+    /**\r
+     * @cfg {String} altFormats\r
+     * Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined\r
+     * format (defaults to 'g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H').\r
+     */\r
+    altFormats : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",\r
+    /**\r
+     * @cfg {Number} increment\r
+     * The number of minutes between each time value in the list (defaults to 15).\r
+     */\r
+    increment: 15,\r
 \r
-    // private\r
-    waitTimer : null,\r
+    // private override\r
+    mode: 'local',\r
+    // private override\r
+    triggerAction: 'all',\r
+    // private override\r
+    typeAhead: false,\r
+    \r
+    // private - This is the date to use when generating time values in the absence of either minValue\r
+    // or maxValue.  Using the current date causes DST issues on DST boundary dates, so this is an \r
+    // arbitrary "safe" date that can be any date aside from DST boundary dates.\r
+    initDate: '1/1/2008',\r
 \r
     // private\r
     initComponent : function(){\r
-        Ext.ProgressBar.superclass.initComponent.call(this);\r
-        this.addEvents(\r
-            \r
-            "update"\r
-        );\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.ProgressBar.superclass.onRender.call(this, ct, position);\r
-\r
-        var tpl = new Ext.Template(\r
-            '<div class="{cls}-wrap">',\r
-                '<div class="{cls}-inner">',\r
-                    '<div class="{cls}-bar">',\r
-                        '<div class="{cls}-text">',\r
-                            '<div>&#160;</div>',\r
-                        '</div>',\r
-                    '</div>',\r
-                    '<div class="{cls}-text {cls}-text-back">',\r
-                        '<div>&#160;</div>',\r
-                    '</div>',\r
-                '</div>',\r
-            '</div>'\r
-        );\r
-\r
-        if(position){\r
-            this.el = tpl.insertBefore(position, {cls: this.baseCls}, true);\r
-        }else{\r
-            this.el = tpl.append(ct, {cls: this.baseCls}, true);\r
+        if(typeof this.minValue == "string"){\r
+            this.minValue = this.parseDate(this.minValue);\r
         }\r
-        if(this.id){\r
-            this.el.dom.id = this.id;\r
+        if(typeof this.maxValue == "string"){\r
+            this.maxValue = this.parseDate(this.maxValue);\r
         }\r
-        var inner = this.el.dom.firstChild;\r
-        this.progressBar = Ext.get(inner.firstChild);\r
 \r
-        if(this.textEl){\r
-            //use an external text el\r
-            this.textEl = Ext.get(this.textEl);\r
-            delete this.textTopEl;\r
-        }else{\r
-            //setup our internal layered text els\r
-            this.textTopEl = Ext.get(this.progressBar.dom.firstChild);\r
-            var textBackEl = Ext.get(inner.childNodes[1]);\r
-            this.textTopEl.setStyle("z-index", 99).addClass('x-hidden');\r
-            this.textEl = new Ext.CompositeElement([this.textTopEl.dom.firstChild, textBackEl.dom.firstChild]);\r
-            this.textEl.setWidth(inner.offsetWidth);\r
+        if(!this.store){\r
+            var min = this.parseDate(this.minValue) || new Date(this.initDate).clearTime();\r
+            var max = this.parseDate(this.maxValue) || new Date(this.initDate).clearTime().add('mi', (24 * 60) - 1);\r
+            var times = [];\r
+            while(min <= max){\r
+                times.push(min.dateFormat(this.format));\r
+                min = min.add('mi', this.increment);\r
+            }\r
+            this.store = times;\r
         }\r
-        this.progressBar.setHeight(inner.offsetHeight);\r
+        Ext.form.TimeField.superclass.initComponent.call(this);\r
     },\r
-    \r
-    // private\r
-       afterRender : function(){\r
-               Ext.ProgressBar.superclass.afterRender.call(this);\r
-               if(this.value){\r
-                       this.updateProgress(this.value, this.text);\r
-               }else{\r
-                       this.updateText(this.text);\r
-               }\r
-       },\r
 \r
-    \r
-    updateProgress : function(value, text, animate){\r
-        this.value = value || 0;\r
-        if(text){\r
-            this.updateText(text);\r
-        }\r
-        if(this.rendered){\r
-               var w = Math.floor(value*this.el.dom.firstChild.offsetWidth);\r
-               this.progressBar.setWidth(w, animate === true || (animate !== false && this.animate));\r
-               if(this.textTopEl){\r
-                   //textTopEl should be the same width as the bar so overflow will clip as the bar moves\r
-                   this.textTopEl.removeClass('x-hidden').setWidth(w);\r
-               }\r
-        }\r
-        this.fireEvent('update', this, value, text);\r
-        return this;\r
+    // inherited docs\r
+    getValue : function(){\r
+        var v = Ext.form.TimeField.superclass.getValue.call(this);\r
+        return this.formatDate(this.parseDate(v)) || '';\r
     },\r
 \r
-    \r
-    wait : function(o){\r
-        if(!this.waitTimer){\r
-            var scope = this;\r
-            o = o || {};\r
-            this.updateText(o.text);\r
-            this.waitTimer = Ext.TaskMgr.start({\r
-                run: function(i){\r
-                    var inc = o.increment || 10;\r
-                    this.updateProgress(((((i+inc)%inc)+1)*(100/inc))*.01, null, o.animate);\r
-                },\r
-                interval: o.interval || 1000,\r
-                duration: o.duration,\r
-                onStop: function(){\r
-                    if(o.fn){\r
-                        o.fn.apply(o.scope || this);\r
-                    }\r
-                    this.reset();\r
-                },\r
-                scope: scope\r
-            });\r
-        }\r
-        return this;\r
+    // inherited docs\r
+    setValue : function(value){\r
+        return Ext.form.TimeField.superclass.setValue.call(this, this.formatDate(this.parseDate(value)));\r
     },\r
 \r
-    \r
-    isWaiting : function(){\r
-        return this.waitTimer != null;\r
-    },\r
+    // private overrides\r
+    validateValue : Ext.form.DateField.prototype.validateValue,\r
+    parseDate : Ext.form.DateField.prototype.parseDate,\r
+    formatDate : Ext.form.DateField.prototype.formatDate,\r
 \r
-    \r
-    updateText : function(text){\r
-        this.text = text || '&#160;';\r
-        if(this.rendered){\r
-            this.textEl.update(this.text);\r
-        }\r
-        return this;\r
-    },\r
-    \r
-    \r
-    syncProgressBar : function(){\r
-        if(this.value){\r
-            this.updateProgress(this.value, this.text);\r
+    // private\r
+    beforeBlur : function(){\r
+        var v = this.parseDate(this.getRawValue());\r
+        if(v){\r
+            this.setValue(v.dateFormat(this.format));\r
         }\r
-        return this;\r
-    },\r
+        Ext.form.TimeField.superclass.beforeBlur.call(this);\r
+    }\r
 \r
-    \r
-    setSize : function(w, h){\r
-        Ext.ProgressBar.superclass.setSize.call(this, w, h);\r
-        if(this.textTopEl){\r
-            var inner = this.el.dom.firstChild;\r
-            this.textEl.setSize(inner.offsetWidth, inner.offsetHeight);\r
-        }\r
-        this.syncProgressBar();\r
-        return this;\r
-    },\r
+    /**\r
+     * @cfg {Boolean} grow @hide\r
+     */\r
+    /**\r
+     * @cfg {Number} growMin @hide\r
+     */\r
+    /**\r
+     * @cfg {Number} growMax @hide\r
+     */\r
+    /**\r
+     * @hide\r
+     * @method autoSize\r
+     */\r
+});\r
+Ext.reg('timefield', Ext.form.TimeField);/**
+ * @class Ext.form.Label
+ * @extends Ext.BoxComponent
+ * Basic Label field.
+ * @constructor
+ * Creates a new Label
+ * @param {Ext.Element/String/Object} config The configuration options.  If an element is passed, it is set as the internal
+ * element and its id used as the component id.  If a string is passed, it is assumed to be the id of an existing element
+ * and is used as the component id.  Otherwise, it is assumed to be a standard config object and is applied to the component.
+ * @xtype label
+ */
+Ext.form.Label = Ext.extend(Ext.BoxComponent, {
+    /**
+     * @cfg {String} text The plain text to display within the label (defaults to ''). If you need to include HTML
+     * tags within the label's innerHTML, use the {@link #html} config instead.
+     */
+    /**
+     * @cfg {String} forId The id of the input element to which this label will be bound via the standard HTML 'for'
+     * attribute. If not specified, the attribute will not be added to the label.
+     */
+    /**
+     * @cfg {String} html An HTML fragment that will be used as the label's innerHTML (defaults to '').
+     * Note that if {@link #text} is specified it will take precedence and this value will be ignored.
+     */
+
+    // private
+    onRender : function(ct, position){
+        if(!this.el){
+            this.el = document.createElement('label');
+            this.el.id = this.getId();
+            this.el.innerHTML = this.text ? Ext.util.Format.htmlEncode(this.text) : (this.html || '');
+            if(this.forId){
+                this.el.setAttribute('for', this.forId);
+            }
+        }
+        Ext.form.Label.superclass.onRender.call(this, ct, position);
+    },
+
+    /**
+     * Updates the label's innerHTML with the specified string.
+     * @param {String} text The new label text
+     * @param {Boolean} encode (optional) False to skip HTML-encoding the text when rendering it
+     * to the label (defaults to true which encodes the value). This might be useful if you want to include
+     * tags in the label's innerHTML rather than rendering them as string literals per the default logic.
+     * @return {Label} this
+     */
+    setText : function(t, encode){
+        var e = encode === false;
+        this[!e ? 'text' : 'html'] = t;
+        delete this[e ? 'text' : 'html'];
+        if(this.rendered){
+            this.el.dom.innerHTML = encode !== false ? Ext.util.Format.htmlEncode(t) : t;
+        }
+        return this;
+    }
+});
+
+Ext.reg('label', Ext.form.Label);/**
+ * @class Ext.form.Action
+ * <p>The subclasses of this class provide actions to perform upon {@link Ext.form.BasicForm Form}s.</p>
+ * <p>Instances of this class are only created by a {@link Ext.form.BasicForm Form} when
+ * the Form needs to perform an action such as submit or load. The Configuration options
+ * listed for this class are set through the Form's action methods: {@link Ext.form.BasicForm#submit submit},
+ * {@link Ext.form.BasicForm#load load} and {@link Ext.form.BasicForm#doAction doAction}</p>
+ * <p>The instance of Action which performed the action is passed to the success
+ * and failure callbacks of the Form's action methods ({@link Ext.form.BasicForm#submit submit},
+ * {@link Ext.form.BasicForm#load load} and {@link Ext.form.BasicForm#doAction doAction}),
+ * and to the {@link Ext.form.BasicForm#actioncomplete actioncomplete} and
+ * {@link Ext.form.BasicForm#actionfailed actionfailed} event handlers.</p>
+ */
+Ext.form.Action = function(form, options){
+    this.form = form;
+    this.options = options || {};
+};
+
+/**
+ * Failure type returned when client side validation of the Form fails
+ * thus aborting a submit action. Client side validation is performed unless
+ * {@link #clientValidation} is explicitly set to <tt>false</tt>.
+ * @type {String}
+ * @static
+ */
+Ext.form.Action.CLIENT_INVALID = 'client';
+/**
+ * <p>Failure type returned when server side processing fails and the {@link #result}'s
+ * <tt style="font-weight:bold">success</tt> property is set to <tt>false</tt>.</p>
+ * <p>In the case of a form submission, field-specific error messages may be returned in the
+ * {@link #result}'s <tt style="font-weight:bold">errors</tt> property.</p>
+ * @type {String}
+ * @static
+ */
+Ext.form.Action.SERVER_INVALID = 'server';
+/**
+ * Failure type returned when a communication error happens when attempting
+ * to send a request to the remote server. The {@link #response} may be examined to
+ * provide further information.
+ * @type {String}
+ * @static
+ */
+Ext.form.Action.CONNECT_FAILURE = 'connect';
+/**
+ * Failure type returned when the response's <tt style="font-weight:bold">success</tt>
+ * property is set to <tt>false</tt>, or no field values are returned in the response's
+ * <tt style="font-weight:bold">data</tt> property.
+ * @type {String}
+ * @static
+ */
+Ext.form.Action.LOAD_FAILURE = 'load';
+
+Ext.form.Action.prototype = {
+/**
+ * @cfg {String} url The URL that the Action is to invoke.
+ */
+/**
+ * @cfg {Boolean} reset When set to <tt><b>true</b></tt>, causes the Form to be
+ * {@link Ext.form.BasicForm.reset reset} on Action success. If specified, this happens
+ * <b>before</b> the {@link #success} callback is called and before the Form's
+ * {@link Ext.form.BasicForm.actioncomplete actioncomplete} event fires.
+ */
+/**
+ * @cfg {String} method The HTTP method to use to access the requested URL. Defaults to the
+ * {@link Ext.form.BasicForm}'s method, or if that is not specified, the underlying DOM form's method.
+ */
+/**
+ * @cfg {Mixed} params <p>Extra parameter values to pass. These are added to the Form's
+ * {@link Ext.form.BasicForm#baseParams} and passed to the specified URL along with the Form's
+ * input fields.</p>
+ * <p>Parameters are encoded as standard HTTP parameters using {@link Ext#urlEncode}.</p>
+ */
+/**
+ * @cfg {Number} timeout The number of seconds to wait for a server response before
+ * failing with the {@link #failureType} as {@link #Action.CONNECT_FAILURE}. If not specified,
+ * defaults to the configured <tt>{@link Ext.form.BasicForm#timeout timeout}</tt> of the
+ * {@link Ext.form.BasicForm form}.
+ */
+/**
+ * @cfg {Function} success The function to call when a valid success return packet is recieved.
+ * The function is passed the following parameters:<ul class="mdetail-params">
+ * <li><b>form</b> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
+ * <li><b>action</b> : Ext.form.Action<div class="sub-desc">The Action class. The {@link #result}
+ * property of this object may be examined to perform custom postprocessing.</div></li>
+ * </ul>
+ */
+/**
+ * @cfg {Function} failure The function to call when a failure packet was recieved, or when an
+ * error ocurred in the Ajax communication.
+ * The function is passed the following parameters:<ul class="mdetail-params">
+ * <li><b>form</b> : Ext.form.BasicForm<div class="sub-desc">The form that requested the action</div></li>
+ * <li><b>action</b> : Ext.form.Action<div class="sub-desc">The Action class. If an Ajax
+ * error ocurred, the failure type will be in {@link #failureType}. The {@link #result}
+ * property of this object may be examined to perform custom postprocessing.</div></li>
+ * </ul>
+ */
+/**
+ * @cfg {Object} scope The scope in which to call the callback functions (The <tt>this</tt> reference
+ * for the callback functions).
+ */
+/**
+ * @cfg {String} waitMsg The message to be displayed by a call to {@link Ext.MessageBox#wait}
+ * during the time the action is being processed.
+ */
+/**
+ * @cfg {String} waitTitle The title to be displayed by a call to {@link Ext.MessageBox#wait}
+ * during the time the action is being processed.
+ */
+
+/**
+ * The type of action this Action instance performs.
+ * Currently only "submit" and "load" are supported.
+ * @type {String}
+ */
+    type : 'default',
+/**
+ * The type of failure detected will be one of these: {@link #CLIENT_INVALID},
+ * {@link #SERVER_INVALID}, {@link #CONNECT_FAILURE}, or {@link #LOAD_FAILURE}.  Usage:
+ * <pre><code>
+var fp = new Ext.form.FormPanel({
+...
+buttons: [{
+    text: 'Save',
+    formBind: true,
+    handler: function(){
+        if(fp.getForm().isValid()){
+            fp.getForm().submit({
+                url: 'form-submit.php',
+                waitMsg: 'Submitting your data...',
+                success: function(form, action){
+                    // server responded with success = true
+                    var result = action.{@link #result};
+                },
+                failure: function(form, action){
+                    if (action.{@link #failureType} === Ext.form.Action.{@link #CONNECT_FAILURE}) {
+                        Ext.Msg.alert('Error',
+                            'Status:'+action.{@link #response}.status+': '+
+                            action.{@link #response}.statusText);
+                    }
+                    if (action.failureType === Ext.form.Action.{@link #SERVER_INVALID}){
+                        // server responded with success = false
+                        Ext.Msg.alert('Invalid', action.{@link #result}.errormsg);
+                    }
+                }
+            });
+        }
+    }
+},{
+    text: 'Reset',
+    handler: function(){
+        fp.getForm().reset();
+    }
+}]
+ * </code></pre>
+ * @property failureType
+ * @type {String}
+ */
+ /**
+ * The XMLHttpRequest object used to perform the action.
+ * @property response
+ * @type {Object}
+ */
+ /**
+ * The decoded response object containing a boolean <tt style="font-weight:bold">success</tt> property and
+ * other, action-specific properties.
+ * @property result
+ * @type {Object}
+ */
+
+    // interface method
+    run : function(options){
+
+    },
+
+    // interface method
+    success : function(response){
+
+    },
+
+    // interface method
+    handleResponse : function(response){
+
+    },
+
+    // default connection failure
+    failure : function(response){
+        this.response = response;
+        this.failureType = Ext.form.Action.CONNECT_FAILURE;
+        this.form.afterAction(this, false);
+    },
+
+    // private
+    // shared code among all Actions to validate that there was a response
+    // with either responseText or responseXml
+    processResponse : function(response){
+        this.response = response;
+        if(!response.responseText && !response.responseXML){
+            return true;
+        }
+        this.result = this.handleResponse(response);
+        return this.result;
+    },
+
+    // utility functions used internally
+    getUrl : function(appendParams){
+        var url = this.options.url || this.form.url || this.form.el.dom.action;
+        if(appendParams){
+            var p = this.getParams();
+            if(p){
+                url = Ext.urlAppend(url, p);
+            }
+        }
+        return url;
+    },
+
+    // private
+    getMethod : function(){
+        return (this.options.method || this.form.method || this.form.el.dom.method || 'POST').toUpperCase();
+    },
+
+    // private
+    getParams : function(){
+        var bp = this.form.baseParams;
+        var p = this.options.params;
+        if(p){
+            if(typeof p == "object"){
+                p = Ext.urlEncode(Ext.applyIf(p, bp));
+            }else if(typeof p == 'string' && bp){
+                p += '&' + Ext.urlEncode(bp);
+            }
+        }else if(bp){
+            p = Ext.urlEncode(bp);
+        }
+        return p;
+    },
+
+    // private
+    createCallback : function(opts){
+        var opts = opts || {};
+        return {
+            success: this.success,
+            failure: this.failure,
+            scope: this,
+            timeout: (opts.timeout*1000) || (this.form.timeout*1000),
+            upload: this.form.fileUpload ? this.success : undefined
+        };
+    }
+};
+
+/**
+ * @class Ext.form.Action.Submit
+ * @extends Ext.form.Action
+ * <p>A class which handles submission of data from {@link Ext.form.BasicForm Form}s
+ * and processes the returned response.</p>
+ * <p>Instances of this class are only created by a {@link Ext.form.BasicForm Form} when
+ * {@link Ext.form.BasicForm#submit submit}ting.</p>
+ * <p><u><b>Response Packet Criteria</b></u></p>
+ * <p>A response packet may contain:
+ * <div class="mdetail-params"><ul>
+ * <li><b><code>success</code></b> property : Boolean
+ * <div class="sub-desc">The <code>success</code> property is required.</div></li>
+ * <li><b><code>errors</code></b> property : Object
+ * <div class="sub-desc"><div class="sub-desc">The <code>errors</code> property,
+ * which is optional, contains error messages for invalid fields.</div></li>
+ * </ul></div>
+ * <p><u><b>JSON Packets</b></u></p>
+ * <p>By default, response packets are assumed to be JSON, so a typical response
+ * packet may look like this:</p><pre><code>
+{
+    success: false,
+    errors: {
+        clientCode: "Client not found",
+        portOfLoading: "This field must not be null"
+    }
+}</code></pre>
+ * <p>Other data may be placed into the response for processing by the {@link Ext.form.BasicForm}'s callback
+ * or event handler methods. The object decoded from this JSON is available in the
+ * {@link Ext.form.Action#result result} property.</p>
+ * <p>Alternatively, if an {@link #errorReader} is specified as an {@link Ext.data.XmlReader XmlReader}:</p><pre><code>
+    errorReader: new Ext.data.XmlReader({
+            record : 'field',
+            success: '@success'
+        }, [
+            'id', 'msg'
+        ]
+    )
+</code></pre>
+ * <p>then the results may be sent back in XML format:</p><pre><code>
+&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+&lt;message success="false"&gt;
+&lt;errors&gt;
+    &lt;field&gt;
+        &lt;id&gt;clientCode&lt;/id&gt;
+        &lt;msg&gt;&lt;![CDATA[Code not found. &lt;br /&gt;&lt;i&gt;This is a test validation message from the server &lt;/i&gt;]]&gt;&lt;/msg&gt;
+    &lt;/field&gt;
+    &lt;field&gt;
+        &lt;id&gt;portOfLoading&lt;/id&gt;
+        &lt;msg&gt;&lt;![CDATA[Port not found. &lt;br /&gt;&lt;i&gt;This is a test validation message from the server &lt;/i&gt;]]&gt;&lt;/msg&gt;
+    &lt;/field&gt;
+&lt;/errors&gt;
+&lt;/message&gt;
+</code></pre>
+ * <p>Other elements may be placed into the response XML for processing by the {@link Ext.form.BasicForm}'s callback
+ * or event handler methods. The XML document is available in the {@link #errorReader}'s {@link Ext.data.XmlReader#xmlData xmlData} property.</p>
+ */
+Ext.form.Action.Submit = function(form, options){
+    Ext.form.Action.Submit.superclass.constructor.call(this, form, options);
+};
+
+Ext.extend(Ext.form.Action.Submit, Ext.form.Action, {
+    /**
+     * @cfg {Ext.data.DataReader} errorReader <p><b>Optional. JSON is interpreted with
+     * no need for an errorReader.</b></p>
+     * <p>A Reader which reads a single record from the returned data. The DataReader's
+     * <b>success</b> property specifies how submission success is determined. The Record's
+     * data provides the error messages to apply to any invalid form Fields.</p>
+     */
+    /**
+     * @cfg {boolean} clientValidation Determines whether a Form's fields are validated
+     * in a final call to {@link Ext.form.BasicForm#isValid isValid} prior to submission.
+     * Pass <tt>false</tt> in the Form's submit options to prevent this. If not defined, pre-submission field validation
+     * is performed.
+     */
+    type : 'submit',
+
+    // private
+    run : function(){
+        var o = this.options;
+        var method = this.getMethod();
+        var isGet = method == 'GET';
+        if(o.clientValidation === false || this.form.isValid()){
+            Ext.Ajax.request(Ext.apply(this.createCallback(o), {
+                form:this.form.el.dom,
+                url:this.getUrl(isGet),
+                method: method,
+                headers: o.headers,
+                params:!isGet ? this.getParams() : null,
+                isUpload: this.form.fileUpload
+            }));
+        }else if (o.clientValidation !== false){ // client validation failed
+            this.failureType = Ext.form.Action.CLIENT_INVALID;
+            this.form.afterAction(this, false);
+        }
+    },
+
+    // private
+    success : function(response){
+        var result = this.processResponse(response);
+        if(result === true || result.success){
+            this.form.afterAction(this, true);
+            return;
+        }
+        if(result.errors){
+            this.form.markInvalid(result.errors);
+            this.failureType = Ext.form.Action.SERVER_INVALID;
+        }
+        this.form.afterAction(this, false);
+    },
+
+    // private
+    handleResponse : function(response){
+        if(this.form.errorReader){
+            var rs = this.form.errorReader.read(response);
+            var errors = [];
+            if(rs.records){
+                for(var i = 0, len = rs.records.length; i < len; i++) {
+                    var r = rs.records[i];
+                    errors[i] = r.data;
+                }
+            }
+            if(errors.length < 1){
+                errors = null;
+            }
+            return {
+                success : rs.success,
+                errors : errors
+            };
+        }
+        return Ext.decode(response.responseText);
+    }
+});
+
+
+/**
+ * @class Ext.form.Action.Load
+ * @extends Ext.form.Action
+ * <p>A class which handles loading of data from a server into the Fields of an {@link Ext.form.BasicForm}.</p>
+ * <p>Instances of this class are only created by a {@link Ext.form.BasicForm Form} when
+ * {@link Ext.form.BasicForm#load load}ing.</p>
+ * <p><u><b>Response Packet Criteria</b></u></p>
+ * <p>A response packet <b>must</b> contain:
+ * <div class="mdetail-params"><ul>
+ * <li><b><code>success</code></b> property : Boolean</li>
+ * <li><b><code>data</code></b> property : Object</li>
+ * <div class="sub-desc">The <code>data</code> property contains the values of Fields to load.
+ * The individual value object for each Field is passed to the Field's
+ * {@link Ext.form.Field#setValue setValue} method.</div></li>
+ * </ul></div>
+ * <p><u><b>JSON Packets</b></u></p>
+ * <p>By default, response packets are assumed to be JSON, so for the following form load call:<pre><code>
+var myFormPanel = new Ext.form.FormPanel({
+    title: 'Client and routing info',
+    items: [{
+        fieldLabel: 'Client',
+        name: 'clientName'
+    }, {
+        fieldLabel: 'Port of loading',
+        name: 'portOfLoading'
+    }, {
+        fieldLabel: 'Port of discharge',
+        name: 'portOfDischarge'
+    }]
+});
+myFormPanel.{@link Ext.form.FormPanel#getForm getForm}().{@link Ext.form.BasicForm#load load}({
+    url: '/getRoutingInfo.php',
+    params: {
+        consignmentRef: myConsignmentRef
+    },
+    failure: function(form, action() {
+        Ext.Msg.alert("Load failed", action.result.errorMessage);
+    }
+});
+</code></pre>
+ * a <b>success response</b> packet may look like this:</p><pre><code>
+{
+    success: true,
+    data: {
+        clientName: "Fred. Olsen Lines",
+        portOfLoading: "FXT",
+        portOfDischarge: "OSL"
+    }
+}</code></pre>
+ * while a <b>failure response</b> packet may look like this:</p><pre><code>
+{
+    success: false,
+    errorMessage: "Consignment reference not found"
+}</code></pre>
+ * <p>Other data may be placed into the response for processing the {@link Ext.form.BasicForm Form}'s
+ * callback or event handler methods. The object decoded from this JSON is available in the
+ * {@link Ext.form.Action#result result} property.</p>
+ */
+Ext.form.Action.Load = function(form, options){
+    Ext.form.Action.Load.superclass.constructor.call(this, form, options);
+    this.reader = this.form.reader;
+};
+
+Ext.extend(Ext.form.Action.Load, Ext.form.Action, {
+    // private
+    type : 'load',
+
+    // private
+    run : function(){
+        Ext.Ajax.request(Ext.apply(
+                this.createCallback(this.options), {
+                    method:this.getMethod(),
+                    url:this.getUrl(false),
+                    headers: this.options.headers,
+                    params:this.getParams()
+        }));
+    },
+
+    // private
+    success : function(response){
+        var result = this.processResponse(response);
+        if(result === true || !result.success || !result.data){
+            this.failureType = Ext.form.Action.LOAD_FAILURE;
+            this.form.afterAction(this, false);
+            return;
+        }
+        this.form.clearInvalid();
+        this.form.setValues(result.data);
+        this.form.afterAction(this, true);
+    },
+
+    // private
+    handleResponse : function(response){
+        if(this.form.reader){
+            var rs = this.form.reader.read(response);
+            var data = rs.records && rs.records[0] ? rs.records[0].data : null;
+            return {
+                success : rs.success,
+                data : data
+            };
+        }
+        return Ext.decode(response.responseText);
+    }
+});
+
+
+
+/**
+ * @class Ext.form.Action.DirectLoad
+ * @extends Ext.form.Action.Load
+ * Provides Ext.direct support for loading form data. This example illustrates usage
+ * of Ext.Direct to load a submit a form through Ext.Direct.
+ * <pre><code>
+var myFormPanel = new Ext.form.FormPanel({
+    // configs for FormPanel
+    title: 'Basic Information',
+    border: false,
+    padding: 10,
+    buttons:[{
+        text: 'Submit',
+        handler: function(){
+            basicInfo.getForm().submit({
+                params: {
+                    uid: 5
+                }
+            });
+        }
+    }],
+    
+    // configs apply to child items
+    defaults: {anchor: '100%'},
+    defaultType: 'textfield',
+    items: [
+        // form fields go here
+    ],
+    
+    // configs for BasicForm
+    api: {
+        load: Profile.getBasicInfo,
+        // The server-side must mark the submit handler as a 'formHandler'
+        submit: Profile.updateBasicInfo
+    },    
+    paramOrder: ['uid']
+});
+
+// load the form
+myFormPanel.getForm().load({
+    params: {
+        uid: 5
+    }
+});
+ * </code></pre>
+ */
+Ext.form.Action.DirectLoad = Ext.extend(Ext.form.Action.Load, {
+    constructor: function(form, opts) {        
+        Ext.form.Action.DirectLoad.superclass.constructor.call(this, form, opts);
+    },
+    type: 'directload',
+    
+    run : function(){
+        var args = this.getParams();
+        args.push(this.success, this);                
+        this.form.api.load.apply(window, args);
+    },
+    
+    getParams: function() {
+        var buf = [], o = {};
+        var bp = this.form.baseParams;
+        var p = this.options.params;
+        Ext.apply(o, p, bp);
+        var paramOrder = this.form.paramOrder;
+        if(paramOrder){
+            for(var i = 0, len = paramOrder.length; i < len; i++){
+                buf.push(o[paramOrder[i]]);
+            }
+        }else if(this.form.paramsAsHash){
+            buf.push(o);
+        }
+        return buf;
+    },
+    // Direct actions have already been processed and therefore
+    // we can directly set the result; Direct Actions do not have
+    // a this.response property.
+    processResponse: function(result) {
+        this.result = result;
+        return result;          
+    }
+});
+
+/**
+ * @class Ext.form.Action.DirectSubmit
+ * @extends Ext.form.Action.Submit
+ * Provides Ext.direct support for submitting form data.
+ * See {@link Ext.form.Action.DirectLoad}.
+ */
+Ext.form.Action.DirectSubmit = Ext.extend(Ext.form.Action.Submit, {
+    constructor: function(form, opts) {
+        Ext.form.Action.DirectSubmit.superclass.constructor.call(this, form, opts);
+    },
+    type: 'directsubmit',
+    // override of Submit
+    run : function(){
+        var o = this.options;
+        if(o.clientValidation === false || this.form.isValid()){
+            // tag on any additional params to be posted in the
+            // form scope
+            this.success.params = this.getParams();
+            this.form.api.submit(this.form.el.dom, this.success, this);
+        }else if (o.clientValidation !== false){ // client validation failed
+            this.failureType = Ext.form.Action.CLIENT_INVALID;
+            this.form.afterAction(this, false);
+        }
+    },
+    
+    getParams: function() {
+        var o = {};
+        var bp = this.form.baseParams;
+        var p = this.options.params;
+        Ext.apply(o, p, bp);
+        return o;
+    },    
+    // Direct actions have already been processed and therefore
+    // we can directly set the result; Direct Actions do not have
+    // a this.response property.
+    processResponse: function(result) {
+        this.result = result;
+        return result;          
+    }
+});
+
+
+Ext.form.Action.ACTION_TYPES = {
+    'load' : Ext.form.Action.Load,
+    'submit' : Ext.form.Action.Submit,
+    'directload': Ext.form.Action.DirectLoad,
+    'directsubmit': Ext.form.Action.DirectSubmit
+};
+/**
+ * @class Ext.form.VTypes
+ * <p>This is a singleton object which contains a set of commonly used field validation functions.
+ * The validations provided are basic and intended to be easily customizable and extended.</p>
+ * <p>To add custom VTypes specify the <code>{@link Ext.form.TextField#vtype vtype}</code> validation
+ * test function, and optionally specify any corresponding error text to display and any keystroke
+ * filtering mask to apply. For example:</p>
+ * <pre><code>
+// custom Vtype for vtype:'time'
+var timeTest = /^([1-9]|1[0-9]):([0-5][0-9])(\s[a|p]m)$/i;
+Ext.apply(Ext.form.VTypes, {
+    //  vtype validation function
+    time: function(val, field) {
+        return timeTest.test(val);
+    },
+    // vtype Text property: The error text to display when the validation function returns false
+    timeText: 'Not a valid time.  Must be in the format "12:34 PM".',
+    // vtype Mask property: The keystroke filter mask
+    timeMask: /[\d\s:amp]/i
+});
+ * </code></pre>
+ * Another example: 
+ * <pre><code>
+// custom Vtype for vtype:'IPAddress'
+Ext.apply(Ext.form.VTypes, {
+    IPAddress:  function(v) {
+        return /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(v);
+    },
+    IPAddressText: 'Must be a numeric IP address',
+    IPAddressMask: /[\d\.]/i
+});
+ * </code></pre>
+ * @singleton
+ */
+Ext.form.VTypes = function(){
+    // closure these in so they are only created once.
+    var alpha = /^[a-zA-Z_]+$/;
+    var alphanum = /^[a-zA-Z0-9_]+$/;
+    var email = /^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,4}$/;
+    var url = /(((https?)|(ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
+
+    // All these messages and functions are configurable
+    return {
+        /**
+         * The function used to validate email addresses.  Note that this is a very basic validation -- complete
+         * validation per the email RFC specifications is very complex and beyond the scope of this class, although
+         * this function can be overridden if a more comprehensive validation scheme is desired.  See the validation
+         * section of the <a href="http://en.wikipedia.org/wiki/E-mail_address">Wikipedia article on email addresses</a> 
+         * for additional information.  This implementation is intended to validate the following emails:<tt>
+         * 'barney@example.de', 'barney.rubble@example.com', 'barney-rubble@example.coop', 'barney+rubble@example.com'
+         * </tt>.
+         * @param {String} value The email address
+         * @return {Boolean} true if the RegExp test passed, and false if not.
+         */
+        'email' : function(v){
+            return email.test(v);
+        },
+        /**
+         * The error text to display when the email validation function returns false.  Defaults to:
+         * <tt>'This field should be an e-mail address in the format "user@example.com"'</tt>
+         * @type String
+         */
+        'emailText' : 'This field should be an e-mail address in the format "user@example.com"',
+        /**
+         * The keystroke filter mask to be applied on email input.  See the {@link #email} method for 
+         * information about more complex email validation. Defaults to:
+         * <tt>/[a-z0-9_\.\-@]/i</tt>
+         * @type RegExp
+         */
+        'emailMask' : /[a-z0-9_\.\-@]/i,
+
+        /**
+         * The function used to validate URLs
+         * @param {String} value The URL
+         * @return {Boolean} true if the RegExp test passed, and false if not.
+         */
+        'url' : function(v){
+            return url.test(v);
+        },
+        /**
+         * The error text to display when the url validation function returns false.  Defaults to:
+         * <tt>'This field should be a URL in the format "http:/'+'/www.example.com"'</tt>
+         * @type String
+         */
+        'urlText' : 'This field should be a URL in the format "http:/'+'/www.example.com"',
+        
+        /**
+         * The function used to validate alpha values
+         * @param {String} value The value
+         * @return {Boolean} true if the RegExp test passed, and false if not.
+         */
+        'alpha' : function(v){
+            return alpha.test(v);
+        },
+        /**
+         * The error text to display when the alpha validation function returns false.  Defaults to:
+         * <tt>'This field should only contain letters and _'</tt>
+         * @type String
+         */
+        'alphaText' : 'This field should only contain letters and _',
+        /**
+         * The keystroke filter mask to be applied on alpha input.  Defaults to:
+         * <tt>/[a-z_]/i</tt>
+         * @type RegExp
+         */
+        'alphaMask' : /[a-z_]/i,
+
+        /**
+         * The function used to validate alphanumeric values
+         * @param {String} value The value
+         * @return {Boolean} true if the RegExp test passed, and false if not.
+         */
+        'alphanum' : function(v){
+            return alphanum.test(v);
+        },
+        /**
+         * The error text to display when the alphanumeric validation function returns false.  Defaults to:
+         * <tt>'This field should only contain letters, numbers and _'</tt>
+         * @type String
+         */
+        'alphanumText' : 'This field should only contain letters, numbers and _',
+        /**
+         * The keystroke filter mask to be applied on alphanumeric input.  Defaults to:
+         * <tt>/[a-z0-9_]/i</tt>
+         * @type RegExp
+         */
+        'alphanumMask' : /[a-z0-9_]/i
+    };
+}();/**\r
+ * @class Ext.grid.GridPanel\r
+ * @extends Ext.Panel\r
+ * <p>This class represents the primary interface of a component based grid control to represent data\r
+ * in a tabular format of rows and columns. The GridPanel is composed of the following:</p>\r
+ * <div class="mdetail-params"><ul>\r
+ * <li><b>{@link Ext.data.Store Store}</b> : The Model holding the data records (rows)\r
+ * <div class="sub-desc"></div></li>\r
+ * <li><b>{@link Ext.grid.ColumnModel Column model}</b> : Column makeup\r
+ * <div class="sub-desc"></div></li>\r
+ * <li><b>{@link Ext.grid.GridView View}</b> : Encapsulates the user interface \r
+ * <div class="sub-desc"></div></li>\r
+ * <li><b>{@link Ext.grid.AbstractSelectionModel selection model}</b> : Selection behavior \r
+ * <div class="sub-desc"></div></li>\r
+ * </ul></div>\r
+ * <p>Example usage:</p>\r
+ * <pre><code>\r
+var grid = new Ext.grid.GridPanel({\r
+    {@link #store}: new (@link Ext.data.Store}({\r
+        {@link Ext.data.Store#autoDestroy autoDestroy}: true,\r
+        {@link Ext.data.Store#reader reader}: reader,\r
+        {@link Ext.data.Store#data data}: xg.dummyData\r
+    }),\r
+    {@link #columns}: [\r
+        {id: 'company', header: 'Company', width: 200, sortable: true, dataIndex: 'company'},\r
+        {header: 'Price', width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},\r
+        {header: 'Change', width: 120, sortable: true, dataIndex: 'change'},\r
+        {header: '% Change', width: 120, sortable: true, dataIndex: 'pctChange'},\r
+        // instead of specifying renderer: Ext.util.Format.dateRenderer('m/d/Y') use xtype\r
+        {header: 'Last Updated', width: 135, sortable: true, dataIndex: 'lastChange', xtype: 'datecolumn', format: 'M d, Y'}\r
+    ],\r
+    {@link #viewConfig}: {\r
+        {@link Ext.grid.GridView#forceFit forceFit}: true,\r
 \r
-    \r
-    reset : function(hide){\r
-        this.updateProgress(0);\r
-        if(this.textTopEl){\r
-            this.textTopEl.addClass('x-hidden');\r
-        }\r
-        if(this.waitTimer){\r
-            this.waitTimer.onStop = null; //prevent recursion\r
-            Ext.TaskMgr.stop(this.waitTimer);\r
-            this.waitTimer = null;\r
-        }\r
-        if(hide === true){\r
-            this.hide();\r
+//      Return CSS class to apply to rows depending upon data values\r
+        {@link Ext.grid.GridView#getRowClass getRowClass}: function(record, index) {\r
+            var c = record.{@link Ext.data.Record#get get}('change');\r
+            if (c < 0) {\r
+                return 'price-fall';\r
+            } else if (c > 0) {\r
+                return 'price-rise';\r
+            }\r
         }\r
-        return this;\r
-    }\r
+    },\r
+    {@link #sm}: new Ext.grid.RowSelectionModel({singleSelect:true}),\r
+    width: 600,\r
+    height: 300,\r
+    frame: true,\r
+    title: 'Framed with Row Selection and Horizontal Scrolling',\r
+    iconCls: 'icon-grid'\r
 });\r
-Ext.reg('progress', Ext.ProgressBar);\r
-\r
-Ext.Slider = Ext.extend(Ext.BoxComponent, {\r
-       \r
-       \r
-    vertical: false,\r
-       \r
-    minValue: 0,\r
-               \r
-    maxValue: 100,\r
-       \r
-    keyIncrement: 1,\r
-       \r
-    increment: 0,\r
-       // private\r
-    clickRange: [5,15],\r
-       \r
-    clickToChange : true,\r
-       \r
-    animate: true,\r
+ * </code></pre>\r
+ * <p><b><u>Notes:</u></b></p>\r
+ * <div class="mdetail-params"><ul>\r
+ * <li>Although this class inherits many configuration options from base classes, some of them\r
+ * (such as autoScroll, autoWidth, layout, items, etc) are not used by this class, and will\r
+ * have no effect.</li>\r
+ * <li>A grid <b>requires</b> a width in which to scroll its columns, and a height in which to\r
+ * scroll its rows. These dimensions can either be set explicitly through the\r
+ * <tt>{@link Ext.BoxComponent#height height}</tt> and <tt>{@link Ext.BoxComponent#width width}</tt>\r
+ * configuration options or implicitly set by using the grid as a child item of a\r
+ * {@link Ext.Container Container} which will have a {@link Ext.Container#layout layout manager}\r
+ * provide the sizing of its child items (for example the Container of the Grid may specify\r
+ * <tt>{@link Ext.Container#layout layout}:'fit'</tt>).</li>\r
+ * <li>To access the data in a Grid, it is necessary to use the data model encapsulated\r
+ * by the {@link #store Store}. See the {@link #cellclick} event for more details.</li>\r
+ * </ul></div>\r
+ * @constructor\r
+ * @param {Object} config The config object\r
+ * @xtype grid\r
+ */\r
+Ext.grid.GridPanel = Ext.extend(Ext.Panel, {\r
+    /**\r
+     * @cfg {String} autoExpandColumn\r
+     * <p>The <tt>{@link Ext.grid.Column#id id}</tt> of a {@link Ext.grid.Column column} in\r
+     * this grid that should expand to fill unused space. This value specified here can not\r
+     * be <tt>0</tt>.</p>\r
+     * <br><p><b>Note</b>: If the Grid's {@link Ext.grid.GridView view} is configured with\r
+     * <tt>{@link Ext.grid.GridView#forceFit forceFit}=true</tt> the <tt>autoExpandColumn</tt>\r
+     * is ignored. See {@link Ext.grid.Column}.<tt>{@link Ext.grid.Column#width width}</tt>\r
+     * for additional details.</p>\r
+     * <p>See <tt>{@link #autoExpandMax}</tt> and <tt>{@link #autoExpandMin}</tt> also.</p>\r
+     */\r
+    autoExpandColumn : false,\r
+    /**\r
+     * @cfg {Number} autoExpandMax The maximum width the <tt>{@link #autoExpandColumn}</tt>\r
+     * can have (if enabled). Defaults to <tt>1000</tt>.\r
+     */\r
+    autoExpandMax : 1000,\r
+    /**\r
+     * @cfg {Number} autoExpandMin The minimum width the <tt>{@link #autoExpandColumn}</tt>\r
+     * can have (if enabled). Defaults to <tt>50</tt>.\r
+     */\r
+    autoExpandMin : 50,\r
+    /**\r
+     * @cfg {Boolean} columnLines <tt>true</tt> to add css for column separation lines.\r
+     * Default is <tt>false</tt>.\r
+     */\r
+    columnLines : false,\r
+    /**\r
+     * @cfg {Object} cm Shorthand for <tt>{@link #colModel}</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Object} colModel The {@link Ext.grid.ColumnModel} to use when rendering the grid (required).\r
+     */\r
+    /**\r
+     * @cfg {Array} columns An array of {@link Ext.grid.Column columns} to auto create a\r
+     * {@link Ext.grid.ColumnModel}.  The ColumnModel may be explicitly created via the\r
+     * <tt>{@link #colModel}</tt> configuration property.\r
+     */\r
+    /**\r
+     * @cfg {String} ddGroup The DD group this GridPanel belongs to. Defaults to <tt>'GridDD'</tt> if not specified.\r
+     */\r
+    /**\r
+     * @cfg {String} ddText\r
+     * Configures the text in the drag proxy.  Defaults to:\r
+     * <pre><code>\r
+     * ddText : '{0} selected row{1}'\r
+     * </code></pre>\r
+     * <tt>{0}</tt> is replaced with the number of selected rows.\r
+     */\r
+    ddText : '{0} selected row{1}',\r
+    /**\r
+     * @cfg {Boolean} deferRowRender <P>Defaults to <tt>true</tt> to enable deferred row rendering.</p>\r
+     * <p>This allows the GridPanel to be initially rendered empty, with the expensive update of the row\r
+     * structure deferred so that layouts with GridPanels appear more quickly.</p>\r
+     */\r
+    deferRowRender : true,\r
+    /**\r
+     * @cfg {Boolean} disableSelection <p><tt>true</tt> to disable selections in the grid. Defaults to <tt>false</tt>.</p>\r
+     * <p>Ignored if a {@link #selModel SelectionModel} is specified.</p>\r
+     */\r
+    /**\r
+     * @cfg {Boolean} enableColumnResize <tt>false</tt> to turn off column resizing for the whole grid. Defaults to <tt>true</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} enableColumnHide Defaults to <tt>true</tt> to enable hiding of columns with the header context menu.\r
+     */\r
+    enableColumnHide : true,\r
+    /**\r
+     * @cfg {Boolean} enableColumnMove Defaults to <tt>true</tt> to enable drag and drop reorder of columns. <tt>false</tt>\r
+     * to turn off column reordering via drag drop.\r
+     */\r
+    enableColumnMove : true,\r
+    /**\r
+     * @cfg {Boolean} enableDragDrop <p>Enables dragging of the selected rows of the GridPanel. Defaults to <tt>false</tt>.</p>\r
+     * <p>Setting this to <b><tt>true</tt></b> causes this GridPanel's {@link #getView GridView} to\r
+     * create an instance of {@link Ext.grid.GridDragZone}. <b>Note</b>: this is available only <b>after</b>\r
+     * the Grid has been rendered as the GridView's <tt>{@link Ext.grid.GridView#dragZone dragZone}</tt>\r
+     * property.</p>\r
+     * <p>A cooperating {@link Ext.dd.DropZone DropZone} must be created who's implementations of\r
+     * {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver},\r
+     * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop} are able\r
+     * to process the {@link Ext.grid.GridDragZone#getDragData data} which is provided.</p>\r
+     */\r
+    enableDragDrop : false,\r
+    /**\r
+     * @cfg {Boolean} enableHdMenu Defaults to <tt>true</tt> to enable the drop down button for menu in the headers.\r
+     */\r
+    enableHdMenu : true,\r
+    /**\r
+     * @cfg {Boolean} hideHeaders True to hide the grid's header. Defaults to <code>false</code>.\r
+     */\r
+    /**\r
+     * @cfg {Object} loadMask An {@link Ext.LoadMask} config or true to mask the grid while\r
+     * loading. Defaults to <code>false</code>.\r
+     */\r
+    loadMask : false,\r
+    /**\r
+     * @cfg {Number} maxHeight Sets the maximum height of the grid - ignored if <tt>autoHeight</tt> is not on.\r
+     */\r
+    /**\r
+     * @cfg {Number} minColumnWidth The minimum width a column can be resized to. Defaults to <tt>25</tt>.\r
+     */\r
+    minColumnWidth : 25,\r
+    /**\r
+     * @cfg {Object} sm Shorthand for <tt>{@link #selModel}</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Object} selModel Any subclass of {@link Ext.grid.AbstractSelectionModel} that will provide\r
+     * the selection model for the grid (defaults to {@link Ext.grid.RowSelectionModel} if not specified).\r
+     */\r
+    /**\r
+     * @cfg {Ext.data.Store} store The {@link Ext.data.Store} the grid should use as its data source (required).\r
+     */\r
+    /**\r
+     * @cfg {Boolean} stripeRows <tt>true</tt> to stripe the rows. Default is <tt>false</tt>.\r
+     * <p>This causes the CSS class <tt><b>x-grid3-row-alt</b></tt> to be added to alternate rows of\r
+     * the grid. A default CSS rule is provided which sets a background colour, but you can override this\r
+     * with a rule which either overrides the <b>background-color</b> style using the '!important'\r
+     * modifier, or which uses a CSS selector of higher specificity.</p>\r
+     */\r
+    stripeRows : false,\r
+    /**\r
+     * @cfg {Boolean} trackMouseOver True to highlight rows when the mouse is over. Default is <tt>true</tt>\r
+     * for GridPanel, but <tt>false</tt> for EditorGridPanel.\r
+     */\r
+    trackMouseOver : true,\r
+    /**\r
+     * @cfg {Array} stateEvents\r
+     * An array of events that, when fired, should trigger this component to save its state.\r
+     * Defaults to:<pre><code>\r
+     * stateEvents: ['columnmove', 'columnresize', 'sortchange']\r
+     * </code></pre>\r
+     * <p>These can be any types of events supported by this component, including browser or\r
+     * custom events (e.g., <tt>['click', 'customerchange']</tt>).</p>\r
+     * <p>See {@link Ext.Component#stateful} for an explanation of saving and restoring\r
+     * Component state.</p>\r
+     */\r
+    stateEvents : ['columnmove', 'columnresize', 'sortchange'],\r
+    /**\r
+     * @cfg {Object} view The {@link Ext.grid.GridView} used by the grid. This can be set\r
+     * before a call to {@link Ext.Component#render render()}.\r
+     */\r
+    view : null,\r
+    /**\r
+     * @cfg {Object} viewConfig A config object that will be applied to the grid's UI view.  Any of\r
+     * the config options available for {@link Ext.grid.GridView} can be specified here. This option\r
+     * is ignored if <tt>{@link #view}</tt> is specified.\r
+     */\r
 \r
-    \r
-    dragging: false,\r
+    // private\r
+    rendered : false,\r
+    // private\r
+    viewReady : false,\r
 \r
-    // private override\r
+    // private\r
     initComponent : function(){\r
-        if(this.value === undefined){\r
-            this.value = this.minValue;\r
+        Ext.grid.GridPanel.superclass.initComponent.call(this);\r
+\r
+        if(this.columnLines){\r
+            this.cls = (this.cls || '') + ' x-grid-with-col-lines';\r
         }\r
-        Ext.Slider.superclass.initComponent.call(this);\r
-        this.keyIncrement = Math.max(this.increment, this.keyIncrement); \r
-        this.addEvents(\r
-                       \r
-                       'beforechange', \r
-                       \r
-                       'change',\r
-                       \r
-                       'changecomplete',\r
-                       \r
-                       'dragstart', \r
-                       \r
-                       'drag', \r
-                       \r
-                       'dragend'\r
-               );\r
+        // override any provided value since it isn't valid\r
+        // and is causing too many bug reports ;)\r
+        this.autoScroll = false;\r
+        this.autoWidth = false;\r
 \r
-        if(this.vertical){\r
-            Ext.apply(this, Ext.Slider.Vertical);\r
+        if(Ext.isArray(this.columns)){\r
+            this.colModel = new Ext.grid.ColumnModel(this.columns);\r
+            delete this.columns;\r
         }\r
-    },\r
 \r
-       // private override\r
-    onRender : function(){\r
-        this.autoEl = {\r
-            cls: 'x-slider ' + (this.vertical ? 'x-slider-vert' : 'x-slider-horz'),\r
-            cn:{cls:'x-slider-end',cn:{cls:'x-slider-inner',cn:[{cls:'x-slider-thumb'},{tag:'a', cls:'x-slider-focus', href:"#", tabIndex: '-1', hidefocus:'on'}]}}\r
-        };\r
-        Ext.Slider.superclass.onRender.apply(this, arguments);\r
-        this.endEl = this.el.first();\r
-        this.innerEl = this.endEl.first();\r
-        this.thumb = this.innerEl.first();\r
-        this.halfThumb = (this.vertical ? this.thumb.getHeight() : this.thumb.getWidth())/2;\r
-        this.focusEl = this.thumb.next();\r
-        this.initEvents();\r
+        // check and correct shorthanded configs\r
+        if(this.ds){\r
+            this.store = this.ds;\r
+            delete this.ds;\r
+        }\r
+        if(this.cm){\r
+            this.colModel = this.cm;\r
+            delete this.cm;\r
+        }\r
+        if(this.sm){\r
+            this.selModel = this.sm;\r
+            delete this.sm;\r
+        }\r
+        this.store = Ext.StoreMgr.lookup(this.store);\r
+\r
+        this.addEvents(\r
+            // raw events\r
+            /**\r
+             * @event click\r
+             * The raw click event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'click',\r
+            /**\r
+             * @event dblclick\r
+             * The raw dblclick event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'dblclick',\r
+            /**\r
+             * @event contextmenu\r
+             * The raw contextmenu event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'contextmenu',\r
+            /**\r
+             * @event mousedown\r
+             * The raw mousedown event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'mousedown',\r
+            /**\r
+             * @event mouseup\r
+             * The raw mouseup event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'mouseup',\r
+            /**\r
+             * @event mouseover\r
+             * The raw mouseover event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'mouseover',\r
+            /**\r
+             * @event mouseout\r
+             * The raw mouseout event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'mouseout',\r
+            /**\r
+             * @event keypress\r
+             * The raw keypress event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'keypress',\r
+            /**\r
+             * @event keydown\r
+             * The raw keydown event for the entire grid.\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'keydown',\r
+\r
+            // custom events\r
+            /**\r
+             * @event cellmousedown\r
+             * Fires before a cell is clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'cellmousedown',\r
+            /**\r
+             * @event rowmousedown\r
+             * Fires before a row is clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowmousedown',\r
+            /**\r
+             * @event headermousedown\r
+             * Fires before a header is clicked\r
+             * @param {Grid} this\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'headermousedown',\r
+\r
+            /**\r
+             * @event cellclick\r
+             * Fires when a cell is clicked.\r
+             * The data for the cell is drawn from the {@link Ext.data.Record Record}\r
+             * for this row. To access the data in the listener function use the\r
+             * following technique:\r
+             * <pre><code>\r
+function(grid, rowIndex, columnIndex, e) {\r
+    var record = grid.getStore().getAt(rowIndex);  // Get the Record\r
+    var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name\r
+    var data = record.get(fieldName);\r
+}\r
+</code></pre>\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'cellclick',\r
+            /**\r
+             * @event celldblclick\r
+             * Fires when a cell is double clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'celldblclick',\r
+            /**\r
+             * @event rowclick\r
+             * Fires when a row is clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowclick',\r
+            /**\r
+             * @event rowdblclick\r
+             * Fires when a row is double clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowdblclick',\r
+            /**\r
+             * @event headerclick\r
+             * Fires when a header is clicked\r
+             * @param {Grid} this\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'headerclick',\r
+            /**\r
+             * @event headerdblclick\r
+             * Fires when a header cell is double clicked\r
+             * @param {Grid} this\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'headerdblclick',\r
+            /**\r
+             * @event rowcontextmenu\r
+             * Fires when a row is right clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowcontextmenu',\r
+            /**\r
+             * @event cellcontextmenu\r
+             * Fires when a cell is right clicked\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Number} cellIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'cellcontextmenu',\r
+            /**\r
+             * @event headercontextmenu\r
+             * Fires when a header is right clicked\r
+             * @param {Grid} this\r
+             * @param {Number} columnIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'headercontextmenu',\r
+            /**\r
+             * @event bodyscroll\r
+             * Fires when the body element is scrolled\r
+             * @param {Number} scrollLeft\r
+             * @param {Number} scrollTop\r
+             */\r
+            'bodyscroll',\r
+            /**\r
+             * @event columnresize\r
+             * Fires when the user resizes a column\r
+             * @param {Number} columnIndex\r
+             * @param {Number} newSize\r
+             */\r
+            'columnresize',\r
+            /**\r
+             * @event columnmove\r
+             * Fires when the user moves a column\r
+             * @param {Number} oldIndex\r
+             * @param {Number} newIndex\r
+             */\r
+            'columnmove',\r
+            /**\r
+             * @event sortchange\r
+             * Fires when the grid's store sort changes\r
+             * @param {Grid} this\r
+             * @param {Object} sortInfo An object with the keys field and direction\r
+             */\r
+            'sortchange',\r
+            /**\r
+             * @event reconfigure\r
+             * Fires when the grid is reconfigured with a new store and/or column model.\r
+             * @param {Grid} this\r
+             * @param {Ext.data.Store} store The new store\r
+             * @param {Ext.grid.ColumnModel} colModel The new column model\r
+             */\r
+            'reconfigure'\r
+        );\r
     },\r
 \r
-       // private override\r
-    initEvents : function(){\r
-        this.thumb.addClassOnOver('x-slider-thumb-over');\r
-        this.mon(this.el, 'mousedown', this.onMouseDown, this);\r
-        this.mon(this.el, 'keydown', this.onKeyDown, this);\r
+    // private\r
+    onRender : function(ct, position){\r
+        Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);\r
 \r
-        this.focusEl.swallowEvent("click", true);\r
+        var c = this.body;\r
 \r
-        this.tracker = new Ext.dd.DragTracker({\r
-            onBeforeStart: this.onBeforeDragStart.createDelegate(this),\r
-            onStart: this.onDragStart.createDelegate(this),\r
-            onDrag: this.onDrag.createDelegate(this),\r
-            onEnd: this.onDragEnd.createDelegate(this),\r
-            tolerance: 3,\r
-            autoStart: 300\r
+        this.el.addClass('x-grid-panel');\r
+\r
+        var view = this.getView();\r
+        view.init(this);\r
+\r
+        this.mon(c, {\r
+            mousedown: this.onMouseDown,\r
+            click: this.onClick,\r
+            dblclick: this.onDblClick,\r
+            contextmenu: this.onContextMenu,\r
+            keydown: this.onKeyDown,\r
+            scope: this\r
         });\r
-        this.tracker.initEl(this.thumb);\r
-        this.on('beforedestroy', this.tracker.destroy, this.tracker);\r
+\r
+        this.relayEvents(c, ['mousedown','mouseup','mouseover','mouseout','keypress']);\r
+\r
+        this.getSelectionModel().init(this);\r
+        this.view.render();\r
     },\r
 \r
-       // private override\r
-    onMouseDown : function(e){\r
-        if(this.disabled) {return;}\r
-        if(this.clickToChange && e.target != this.thumb.dom){\r
-            var local = this.innerEl.translatePoints(e.getXY());\r
-            this.onClickChange(local);\r
+    // private\r
+    initEvents : function(){\r
+        Ext.grid.GridPanel.superclass.initEvents.call(this);\r
+\r
+        if(this.loadMask){\r
+            this.loadMask = new Ext.LoadMask(this.bwrap,\r
+                    Ext.apply({store:this.store}, this.loadMask));\r
         }\r
-        this.focus();\r
     },\r
 \r
-       // private\r
-    onClickChange : function(local){\r
-        if(local.top > this.clickRange[0] && local.top < this.clickRange[1]){\r
-            this.setValue(Math.round(this.reverseValue(local.left)), undefined, true);\r
-        }\r
+    initStateEvents : function(){\r
+        Ext.grid.GridPanel.superclass.initStateEvents.call(this);\r
+        this.mon(this.colModel, 'hiddenchange', this.saveState, this, {delay: 100});\r
     },\r
-       \r
-       // private\r
-    onKeyDown : function(e){\r
-        if(this.disabled){e.preventDefault();return;}\r
-        var k = e.getKey();\r
-        switch(k){\r
-            case e.UP:\r
-            case e.RIGHT:\r
-                e.stopEvent();\r
-                if(e.ctrlKey){\r
-                    this.setValue(this.maxValue, undefined, true);\r
-                }else{\r
-                    this.setValue(this.value+this.keyIncrement, undefined, true);\r
-                }\r
-            break;\r
-            case e.DOWN:\r
-            case e.LEFT:\r
-                e.stopEvent();\r
-                if(e.ctrlKey){\r
-                    this.setValue(this.minValue, undefined, true);\r
-                }else{\r
-                    this.setValue(this.value-this.keyIncrement, undefined, true);\r
+\r
+    applyState : function(state){\r
+        var cm = this.colModel;\r
+        var cs = state.columns;\r
+        if(cs){\r
+            for(var i = 0, len = cs.length; i < len; i++){\r
+                var s = cs[i];\r
+                var c = cm.getColumnById(s.id);\r
+                if(c){\r
+                    c.hidden = s.hidden;\r
+                    c.width = s.width;\r
+                    var oldIndex = cm.getIndexById(s.id);\r
+                    if(oldIndex != i){\r
+                        cm.moveColumn(oldIndex, i);\r
+                    }\r
                 }\r
-            break;\r
-            default:\r
-                e.preventDefault();\r
-        }\r
-    },\r
-       \r
-       // private\r
-    doSnap : function(value){\r
-        if(!this.increment || this.increment == 1 || !value) {\r
-            return value;\r
-        }\r
-        var newValue = value, inc = this.increment;\r
-        var m = value % inc;\r
-        if(m > 0){\r
-            if(m > (inc/2)){\r
-                newValue = value + (inc-m);\r
-            }else{\r
-                newValue = value - m;\r
             }\r
         }\r
-        return newValue.constrain(this.minValue,  this.maxValue);\r
-    },\r
-       \r
-       // private\r
-    afterRender : function(){\r
-        Ext.Slider.superclass.afterRender.apply(this, arguments);\r
-        if(this.value !== undefined){\r
-            var v = this.normalizeValue(this.value);\r
-            if(v !== this.value){\r
-                delete this.value;\r
-                this.setValue(v, false);\r
-            }else{\r
-                this.moveThumb(this.translateValue(v), false);\r
-            }\r
+        if(state.sort && this.store){\r
+            this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction);\r
         }\r
+        delete state.columns;\r
+        delete state.sort;\r
+        Ext.grid.GridPanel.superclass.applyState.call(this, state);\r
     },\r
 \r
-       // private\r
-    getRatio : function(){\r
-        var w = this.innerEl.getWidth();\r
-        var v = this.maxValue - this.minValue;\r
-        return v == 0 ? w : (w/v);\r
-    },\r
-\r
-       // private\r
-    normalizeValue : function(v){\r
-       if(typeof v != 'number'){\r
-            v = parseInt(v);\r
+    getState : function(){\r
+        var o = {columns: []};\r
+        for(var i = 0, c; (c = this.colModel.config[i]); i++){\r
+            o.columns[i] = {\r
+                id: c.id,\r
+                width: c.width\r
+            };\r
+            if(c.hidden){\r
+                o.columns[i].hidden = true;\r
+            }\r
         }\r
-        v = Math.round(v);\r
-        v = this.doSnap(v);\r
-        v = v.constrain(this.minValue, this.maxValue);\r
-        return v;\r
-    },\r
-\r
-       \r
-    setValue : function(v, animate, changeComplete){\r
-        v = this.normalizeValue(v);\r
-        if(v !== this.value && this.fireEvent('beforechange', this, v, this.value) !== false){\r
-            this.value = v;\r
-            this.moveThumb(this.translateValue(v), animate !== false);\r
-            this.fireEvent('change', this, v);\r
-            if(changeComplete){\r
-                this.fireEvent('changecomplete', this, v);\r
+        if(this.store){\r
+            var ss = this.store.getSortState();\r
+            if(ss){\r
+                o.sort = ss;\r
             }\r
         }\r
+        return o;\r
     },\r
 \r
-       // private\r
-    translateValue : function(v){\r
-        var ratio = this.getRatio();\r
-        return (v * ratio)-(this.minValue * ratio)-this.halfThumb;\r
-    },\r
-\r
-       reverseValue : function(pos){\r
-        var ratio = this.getRatio();\r
-        return (pos+this.halfThumb+(this.minValue * ratio))/ratio;\r
-    },\r
-\r
-       // private\r
-    moveThumb: function(v, animate){\r
-        if(!animate || this.animate === false){\r
-            this.thumb.setLeft(v);\r
+    // private\r
+    afterRender : function(){\r
+        Ext.grid.GridPanel.superclass.afterRender.call(this);\r
+        this.view.layout();\r
+        if(this.deferRowRender){\r
+            this.view.afterRender.defer(10, this.view);\r
         }else{\r
-            this.thumb.shift({left: v, stopFx: true, duration:.35});\r
+            this.view.afterRender();\r
         }\r
+        this.viewReady = true;\r
     },\r
 \r
-       // private\r
-    focus : function(){\r
-        this.focusEl.focus(10);\r
-    },\r
-\r
-       // private\r
-    onBeforeDragStart : function(e){\r
-        return !this.disabled;\r
+    /**\r
+     * <p>Reconfigures the grid to use a different Store and Column Model\r
+     * and fires the 'reconfigure' event. The View will be bound to the new\r
+     * objects and refreshed.</p>\r
+     * <p>Be aware that upon reconfiguring a GridPanel, certain existing settings <i>may</i> become\r
+     * invalidated. For example the configured {@link #autoExpandColumn} may no longer exist in the\r
+     * new ColumnModel. Also, an existing {@link Ext.PagingToolbar PagingToolbar} will still be bound\r
+     * to the old Store, and will need rebinding. Any {@link #plugins} might also need reconfiguring\r
+     * with the new data.</p>\r
+     * @param {Ext.data.Store} store The new {@link Ext.data.Store} object\r
+     * @param {Ext.grid.ColumnModel} colModel The new {@link Ext.grid.ColumnModel} object\r
+     */\r
+    reconfigure : function(store, colModel){\r
+        if(this.loadMask){\r
+            this.loadMask.destroy();\r
+            this.loadMask = new Ext.LoadMask(this.bwrap,\r
+                    Ext.apply({}, {store:store}, this.initialConfig.loadMask));\r
+        }\r
+        this.view.initData(store, colModel);\r
+        this.store = store;\r
+        this.colModel = colModel;\r
+        if(this.rendered){\r
+            this.view.refresh(true);\r
+        }\r
+        this.fireEvent('reconfigure', this, store, colModel);\r
     },\r
 \r
-       // private\r
-    onDragStart: function(e){\r
-        this.thumb.addClass('x-slider-thumb-drag');\r
-        this.dragging = true;\r
-        this.dragStartValue = this.value;\r
-        this.fireEvent('dragstart', this, e);\r
+    // private\r
+    onKeyDown : function(e){\r
+        this.fireEvent('keydown', e);\r
     },\r
 \r
-       // private\r
-    onDrag: function(e){\r
-        var pos = this.innerEl.translatePoints(this.tracker.getXY());\r
-        this.setValue(Math.round(this.reverseValue(pos.left)), false);\r
-        this.fireEvent('drag', this, e);\r
-    },\r
-       \r
-       // private\r
-    onDragEnd: function(e){\r
-        this.thumb.removeClass('x-slider-thumb-drag');\r
-        this.dragging = false;\r
-        this.fireEvent('dragend', this, e);\r
-        if(this.dragStartValue != this.value){\r
-            this.fireEvent('changecomplete', this, this.value);\r
+    // private\r
+    onDestroy : function(){\r
+        if(this.rendered){\r
+            var c = this.body;\r
+            c.removeAllListeners();\r
+            c.update('');\r
+            Ext.destroy(this.view, this.loadMask);\r
+        }else if(this.store && this.store.autoDestroy){\r
+            this.store.destroy();\r
         }\r
+        Ext.destroy(this.colModel, this.selModel);\r
+        this.store = this.selModel = this.colModel = this.view = this.loadMask = null;\r
+        Ext.grid.GridPanel.superclass.onDestroy.call(this);\r
     },\r
-    \r
-    //private\r
-    onDisable: function(){\r
-        Ext.Slider.superclass.onDisable.call(this);\r
-        this.thumb.addClass(this.disabledClass);\r
-        if(Ext.isIE){\r
-            //IE breaks when using overflow visible and opacity other than 1.\r
-            //Create a place holder for the thumb and display it.\r
-            var xy = this.thumb.getXY();\r
-            this.thumb.hide();\r
-            this.innerEl.addClass(this.disabledClass).dom.disabled = true;\r
-            if (!this.thumbHolder){\r
-                this.thumbHolder = this.endEl.createChild({cls: 'x-slider-thumb ' + this.disabledClass});    \r
+\r
+    // private\r
+    processEvent : function(name, e){\r
+        this.fireEvent(name, e);\r
+        var t = e.getTarget();\r
+        var v = this.view;\r
+        var header = v.findHeaderIndex(t);\r
+        if(header !== false){\r
+            this.fireEvent('header' + name, this, header, e);\r
+        }else{\r
+            var row = v.findRowIndex(t);\r
+            var cell = v.findCellIndex(t);\r
+            if(row !== false){\r
+                this.fireEvent('row' + name, this, row, e);\r
+                if(cell !== false){\r
+                    this.fireEvent('cell' + name, this, row, cell, e);\r
+                }\r
             }\r
-            this.thumbHolder.show().setXY(xy);\r
         }\r
     },\r
-    \r
-    //private\r
-    onEnable: function(){\r
-        Ext.Slider.superclass.onEnable.call(this);\r
-        this.thumb.removeClass(this.disabledClass);\r
-        if(Ext.isIE){\r
-            this.innerEl.removeClass(this.disabledClass).dom.disabled = false;\r
-            if (this.thumbHolder){\r
-                this.thumbHolder.hide();\r
-            }\r
-            this.thumb.show();\r
-            this.syncThumb();\r
-        }\r
+\r
+    // private\r
+    onClick : function(e){\r
+        this.processEvent('click', e);\r
     },\r
 \r
     // private\r
-    onResize : function(w, h){\r
-        this.innerEl.setWidth(w - (this.el.getPadding('l') + this.endEl.getPadding('r')));\r
-        this.syncThumb();\r
+    onMouseDown : function(e){\r
+        this.processEvent('mousedown', e);\r
     },\r
-    \r
-    \r
-    syncThumb : function(){\r
-        if(this.rendered){\r
-            this.moveThumb(this.translateValue(this.value));\r
+\r
+    // private\r
+    onContextMenu : function(e, t){\r
+        this.processEvent('contextmenu', e);\r
+    },\r
+\r
+    // private\r
+    onDblClick : function(e){\r
+        this.processEvent('dblclick', e);\r
+    },\r
+\r
+    // private\r
+    walkCells : function(row, col, step, fn, scope){\r
+        var cm = this.colModel, clen = cm.getColumnCount();\r
+        var ds = this.store, rlen = ds.getCount(), first = true;\r
+        if(step < 0){\r
+            if(col < 0){\r
+                row--;\r
+                first = false;\r
+            }\r
+            while(row >= 0){\r
+                if(!first){\r
+                    col = clen-1;\r
+                }\r
+                first = false;\r
+                while(col >= 0){\r
+                    if(fn.call(scope || this, row, col, cm) === true){\r
+                        return [row, col];\r
+                    }\r
+                    col--;\r
+                }\r
+                row--;\r
+            }\r
+        } else {\r
+            if(col >= clen){\r
+                row++;\r
+                first = false;\r
+            }\r
+            while(row < rlen){\r
+                if(!first){\r
+                    col = 0;\r
+                }\r
+                first = false;\r
+                while(col < clen){\r
+                    if(fn.call(scope || this, row, col, cm) === true){\r
+                        return [row, col];\r
+                    }\r
+                    col++;\r
+                }\r
+                row++;\r
+            }\r
         }\r
+        return null;\r
     },\r
-       \r
-       \r
-    getValue : function(){\r
-        return this.value;\r
-    }\r
-});\r
-Ext.reg('slider', Ext.Slider);\r
 \r
-// private class to support vertical sliders\r
-Ext.Slider.Vertical = {\r
-    onResize : function(w, h){\r
-        this.innerEl.setHeight(h - (this.el.getPadding('t') + this.endEl.getPadding('b')));\r
-        this.syncThumb();\r
+    // private\r
+    onResize : function(){\r
+        Ext.grid.GridPanel.superclass.onResize.apply(this, arguments);\r
+        if(this.viewReady){\r
+            this.view.layout();\r
+        }\r
     },\r
 \r
-    getRatio : function(){\r
-        var h = this.innerEl.getHeight();\r
-        var v = this.maxValue - this.minValue;\r
-        return h/v;\r
+    /**\r
+     * Returns the grid's underlying element.\r
+     * @return {Element} The element\r
+     */\r
+    getGridEl : function(){\r
+        return this.body;\r
     },\r
 \r
-    moveThumb: function(v, animate){\r
-        if(!animate || this.animate === false){\r
-            this.thumb.setBottom(v);\r
-        }else{\r
-            this.thumb.shift({bottom: v, stopFx: true, duration:.35});\r
+    // private for compatibility, overridden by editor grid\r
+    stopEditing : Ext.emptyFn,\r
+\r
+    /**\r
+     * Returns the grid's selection model configured by the <code>{@link #selModel}</code>\r
+     * configuration option. If no selection model was configured, this will create\r
+     * and return a {@link Ext.grid.RowSelectionModel RowSelectionModel}.\r
+     * @return {SelectionModel}\r
+     */\r
+    getSelectionModel : function(){\r
+        if(!this.selModel){\r
+            this.selModel = new Ext.grid.RowSelectionModel(\r
+                    this.disableSelection ? {selectRow: Ext.emptyFn} : null);\r
         }\r
+        return this.selModel;\r
     },\r
 \r
-    onDrag: function(e){\r
-        var pos = this.innerEl.translatePoints(this.tracker.getXY());\r
-        var bottom = this.innerEl.getHeight()-pos.top;\r
-        this.setValue(this.minValue + Math.round(bottom/this.getRatio()), false);\r
-        this.fireEvent('drag', this, e);\r
+    /**\r
+     * Returns the grid's data store.\r
+     * @return {Ext.data.Store} The store\r
+     */\r
+    getStore : function(){\r
+        return this.store;\r
     },\r
 \r
-    onClickChange : function(local){\r
-        if(local.left > this.clickRange[0] && local.left < this.clickRange[1]){\r
-            var bottom = this.innerEl.getHeight()-local.top;\r
-            this.setValue(this.minValue + Math.round(bottom/this.getRatio()), undefined, true);\r
+    /**\r
+     * Returns the grid's ColumnModel.\r
+     * @return {Ext.grid.ColumnModel} The column model\r
+     */\r
+    getColumnModel : function(){\r
+        return this.colModel;\r
+    },\r
+\r
+    /**\r
+     * Returns the grid's GridView object.\r
+     * @return {Ext.grid.GridView} The grid view\r
+     */\r
+    getView : function(){\r
+        if(!this.view){\r
+            this.view = new Ext.grid.GridView(this.viewConfig);\r
         }\r
+        return this.view;\r
+    },\r
+    /**\r
+     * Called to get grid's drag proxy text, by default returns this.ddText.\r
+     * @return {String} The text\r
+     */\r
+    getDragDropText : function(){\r
+        var count = this.selModel.getCount();\r
+        return String.format(this.ddText, count, count == 1 ? '' : 's');\r
     }\r
-};\r
 \r
-Ext.StatusBar = Ext.extend(Ext.Toolbar, {\r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    \r
-    cls : 'x-statusbar',\r
-    \r
-    busyIconCls : 'x-status-busy',\r
-    \r
-    busyText : 'Loading...',\r
-    \r
-    autoClear : 5000,\r
-    \r
-    // private\r
-    activeThreadId : 0,\r
-    \r
-    // private\r
-    initComponent : function(){\r
-        if(this.statusAlign=='right'){\r
-            this.cls += ' x-status-right';\r
+    /** \r
+     * @cfg {String/Number} activeItem \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Boolean} autoDestroy \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Object/String/Function} autoLoad \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Boolean} autoWidth \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Boolean/Number} bufferResize \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {String} defaultType \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Object} defaults \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Boolean} hideBorders \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Mixed} items \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {String} layout \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Object} layoutConfig \r
+     * @hide \r
+     */\r
+    /** \r
+     * @cfg {Boolean} monitorResize \r
+     * @hide \r
+     */\r
+    /** \r
+     * @property items \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method add \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method cascade \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method doLayout \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method find \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method findBy \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method findById \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method findByType \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method getComponent \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method getLayout \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method getUpdater \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method insert \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method load \r
+     * @hide \r
+     */\r
+    /** \r
+     * @method remove \r
+     * @hide \r
+     */\r
+    /** \r
+     * @event add \r
+     * @hide \r
+     */\r
+    /** \r
+     * @event afterLayout \r
+     * @hide \r
+     */\r
+    /** \r
+     * @event beforeadd \r
+     * @hide \r
+     */\r
+    /** \r
+     * @event beforeremove \r
+     * @hide \r
+     */\r
+    /** \r
+     * @event remove \r
+     * @hide \r
+     */\r
+\r
+\r
+\r
+    /**\r
+     * @cfg {String} allowDomMove  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} autoEl @hide\r
+     */\r
+    /**\r
+     * @cfg {String} applyTo  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} autoScroll  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} bodyBorder  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} bodyStyle  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} contentEl  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} disabledClass  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} elements  @hide\r
+     */\r
+    /**\r
+     * @cfg {String} html  @hide\r
+     */\r
+    /**\r
+     * @cfg {Boolean} preventBodyReset\r
+     * @hide\r
+     */\r
+    /**\r
+     * @property disabled\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method applyToMarkup\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method enable\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method disable\r
+     * @hide\r
+     */\r
+    /**\r
+     * @method setDisabled\r
+     * @hide\r
+     */\r
+});\r
+Ext.reg('grid', Ext.grid.GridPanel);/**
+ * @class Ext.grid.GridView
+ * @extends Ext.util.Observable
+ * <p>This class encapsulates the user interface of an {@link Ext.grid.GridPanel}.
+ * Methods of this class may be used to access user interface elements to enable
+ * special display effects. Do not change the DOM structure of the user interface.</p>
+ * <p>This class does not provide ways to manipulate the underlying data. The data
+ * model of a Grid is held in an {@link Ext.data.Store}.</p>
+ * @constructor
+ * @param {Object} config
+ */
+Ext.grid.GridView = function(config){
+    Ext.apply(this, config);
+    // These events are only used internally by the grid components
+    this.addEvents(
+        /**
+         * @event beforerowremoved
+         * Internal UI Event. Fired before a row is removed.
+         * @param {Ext.grid.GridView} view
+         * @param {Number} rowIndex The index of the row to be removed.
+         * @param {Ext.data.Record} record The Record to be removed
+         */
+        "beforerowremoved",
+        /**
+         * @event beforerowsinserted
+         * Internal UI Event. Fired before rows are inserted.
+         * @param {Ext.grid.GridView} view
+         * @param {Number} firstRow The index of the first row to be inserted.
+         * @param {Number} lastRow The index of the last row to be inserted.
+         */
+        "beforerowsinserted",
+        /**
+         * @event beforerefresh
+         * Internal UI Event. Fired before the view is refreshed.
+         * @param {Ext.grid.GridView} view
+         */
+        "beforerefresh",
+        /**
+         * @event rowremoved
+         * Internal UI Event. Fired after a row is removed.
+         * @param {Ext.grid.GridView} view
+         * @param {Number} rowIndex The index of the row that was removed.
+         * @param {Ext.data.Record} record The Record that was removed
+         */
+        "rowremoved",
+        /**
+         * @event rowsinserted
+         * Internal UI Event. Fired after rows are inserted.
+         * @param {Ext.grid.GridView} view
+         * @param {Number} firstRow The index of the first inserted.
+         * @param {Number} lastRow The index of the last row inserted.
+         */
+        "rowsinserted",
+        /**
+         * @event rowupdated
+         * Internal UI Event. Fired after a row has been updated.
+         * @param {Ext.grid.GridView} view
+         * @param {Number} firstRow The index of the row updated.
+         * @param {Ext.data.record} record The Record backing the row updated.
+         */
+        "rowupdated",
+        /**
+         * @event refresh
+         * Internal UI Event. Fired after the GridView's body has been refreshed.
+         * @param {Ext.grid.GridView} view
+         */
+        "refresh"
+    );
+    Ext.grid.GridView.superclass.constructor.call(this);
+};
+
+Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
+    /**
+     * Override this function to apply custom CSS classes to rows during rendering.  You can also supply custom
+     * parameters to the row template for the current row to customize how it is rendered using the <b>rowParams</b>
+     * parameter.  This function should return the CSS class name (or empty string '' for none) that will be added
+     * to the row's wrapping div.  To apply multiple class names, simply return them space-delimited within the string
+     * (e.g., 'my-class another-class'). Example usage:
+    <pre><code>
+viewConfig: {
+    forceFit: true,
+    showPreview: true, // custom property
+    enableRowBody: true, // required to create a second, full-width row to show expanded Record data
+    getRowClass: function(record, rowIndex, rp, ds){ // rp = rowParams
+        if(this.showPreview){
+            rp.body = '&lt;p>'+record.data.excerpt+'&lt;/p>';
+            return 'x-grid3-row-expanded';
+        }
+        return 'x-grid3-row-collapsed';
+    }
+},     
+    </code></pre>
+     * @param {Record} record The {@link Ext.data.Record} corresponding to the current row.
+     * @param {Number} index The row index.
+     * @param {Object} rowParams A config object that is passed to the row template during rendering that allows
+     * customization of various aspects of a grid row.
+     * <p>If {@link #enableRowBody} is configured <b><tt></tt>true</b>, then the following properties may be set
+     * by this function, and will be used to render a full-width expansion row below each grid row:</p>
+     * <ul>
+     * <li><code>body</code> : String <div class="sub-desc">An HTML fragment to be used as the expansion row's body content (defaults to '').</div></li>
+     * <li><code>bodyStyle</code> : String <div class="sub-desc">A CSS style specification that will be applied to the expansion row's &lt;tr> element. (defaults to '').</div></li>
+     * </ul>
+     * The following property will be passed in, and may be appended to:
+     * <ul>
+     * <li><code>tstyle</code> : String <div class="sub-desc">A CSS style specification that willl be applied to the &lt;table> element which encapsulates
+     * both the standard grid row, and any expansion row.</div></li>
+     * </ul>
+     * @param {Store} store The {@link Ext.data.Store} this grid is bound to
+     * @method getRowClass
+     * @return {String} a CSS class name to add to the row.
+     */
+    /**
+     * @cfg {Boolean} enableRowBody True to add a second TR element per row that can be used to provide a row body
+     * that spans beneath the data row.  Use the {@link #getRowClass} method's rowParams config to customize the row body.
+     */
+    /**
+     * @cfg {String} emptyText Default text (html tags are accepted) to display in the grid body when no rows
+     * are available (defaults to ''). This value will be used to update the <tt>{@link #mainBody}</tt>:
+    <pre><code>
+    this.mainBody.update('&lt;div class="x-grid-empty">' + this.emptyText + '&lt;/div>');
+    </code></pre>
+     */
+    /**
+     * @cfg {Boolean} headersDisabled True to disable the grid column headers (defaults to <tt>false</tt>). 
+     * Use the {@link Ext.grid.ColumnModel ColumnModel} <tt>{@link Ext.grid.ColumnModel#menuDisabled menuDisabled}</tt>
+     * config to disable the <i>menu</i> for individual columns.  While this config is true the
+     * following will be disabled:<div class="mdetail-params"><ul>
+     * <li>clicking on header to sort</li>
+     * <li>the trigger to reveal the menu.</li>
+     * </ul></div>
+     */
+    /**
+     * <p>A customized implementation of a {@link Ext.dd.DragZone DragZone} which provides default implementations
+     * of the template methods of DragZone to enable dragging of the selected rows of a GridPanel.
+     * See {@link Ext.grid.GridDragZone} for details.</p>
+     * <p>This will <b>only</b> be present:<div class="mdetail-params"><ul>
+     * <li><i>if</i> the owning GridPanel was configured with {@link Ext.grid.GridPanel#enableDragDrop enableDragDrop}: <tt>true</tt>.</li>
+     * <li><i>after</i> the owning GridPanel has been rendered.</li>
+     * </ul></div>
+     * @property dragZone
+     * @type {Ext.grid.GridDragZone}
+     */
+    /**
+     * @cfg {Boolean} deferEmptyText True to defer <tt>{@link #emptyText}</tt> being applied until the store's
+     * first load (defaults to <tt>true</tt>).
+     */
+    deferEmptyText : true,
+    /**
+     * @cfg {Number} scrollOffset The amount of space to reserve for the vertical scrollbar
+     * (defaults to <tt>19</tt> pixels).
+     */
+    scrollOffset : 19,
+    /**
+     * @cfg {Boolean} autoFill
+     * Defaults to <tt>false</tt>.  Specify <tt>true</tt> to have the column widths re-proportioned
+     * when the grid is <b>initially rendered</b>.  The 
+     * {@link Ext.grid.Column#width initially configured width}</tt> of each column will be adjusted
+     * to fit the grid width and prevent horizontal scrolling. If columns are later resized (manually
+     * or programmatically), the other columns in the grid will <b>not</b> be resized to fit the grid width.
+     * See <tt>{@link #forceFit}</tt> also.
+     */
+    autoFill : false,
+    /**
+     * @cfg {Boolean} forceFit
+     * Defaults to <tt>false</tt>.  Specify <tt>true</tt> to have the column widths re-proportioned
+     * at <b>all times</b>.  The {@link Ext.grid.Column#width initially configured width}</tt> of each
+     * column will be adjusted to fit the grid width and prevent horizontal scrolling. If columns are
+     * later resized (manually or programmatically), the other columns in the grid <b>will</b> be resized
+     * to fit the grid width. See <tt>{@link #autoFill}</tt> also.
+     */
+    forceFit : false,
+    /**
+     * @cfg {Array} sortClasses The CSS classes applied to a header when it is sorted. (defaults to <tt>["sort-asc", "sort-desc"]</tt>)
+     */
+    sortClasses : ["sort-asc", "sort-desc"],
+    /**
+     * @cfg {String} sortAscText The text displayed in the "Sort Ascending" menu item (defaults to <tt>"Sort Ascending"</tt>)
+     */
+    sortAscText : "Sort Ascending",
+    /**
+     * @cfg {String} sortDescText The text displayed in the "Sort Descending" menu item (defaults to <tt>"Sort Descending"</tt>)
+     */
+    sortDescText : "Sort Descending",
+    /**
+     * @cfg {String} columnsText The text displayed in the "Columns" menu item (defaults to <tt>"Columns"</tt>)
+     */
+    columnsText : "Columns",
+
+    /**
+     * @cfg {String} selectedRowClass The CSS class applied to a selected row (defaults to <tt>"x-grid3-row-selected"</tt>). An
+     * example overriding the default styling:
+    <pre><code>
+    .x-grid3-row-selected {background-color: yellow;}
+    </code></pre>
+     * Note that this only controls the row, and will not do anything for the text inside it.  To style inner
+     * facets (like text) use something like:
+    <pre><code>
+    .x-grid3-row-selected .x-grid3-cell-inner {
+        color: #FFCC00;
+    }
+    </code></pre>
+     * @type String
+     */
+    selectedRowClass : "x-grid3-row-selected",
+
+    // private
+    borderWidth : 2,
+    tdClass : 'x-grid3-cell',
+    hdCls : 'x-grid3-hd',
+    markDirty : true,
+
+    /**
+     * @cfg {Number} cellSelectorDepth The number of levels to search for cells in event delegation (defaults to <tt>4</tt>)
+     */
+    cellSelectorDepth : 4,
+    /**
+     * @cfg {Number} rowSelectorDepth The number of levels to search for rows in event delegation (defaults to <tt>10</tt>)
+     */
+    rowSelectorDepth : 10,
+
+    /**
+     * @cfg {String} cellSelector The selector used to find cells internally (defaults to <tt>'td.x-grid3-cell'</tt>)
+     */
+    cellSelector : 'td.x-grid3-cell',
+    /**
+     * @cfg {String} rowSelector The selector used to find rows internally (defaults to <tt>'div.x-grid3-row'</tt>)
+     */
+    rowSelector : 'div.x-grid3-row',
+    
+    // private
+    firstRowCls: 'x-grid3-row-first',
+    lastRowCls: 'x-grid3-row-last',
+    rowClsRe: /(?:^|\s+)x-grid3-row-(first|last|alt)(?:\s+|$)/g,
+
+    /* -------------------------------- UI Specific ----------------------------- */
+
+    // private
+    initTemplates : function(){
+        var ts = this.templates || {};
+        if(!ts.master){
+            ts.master = new Ext.Template(
+                    '<div class="x-grid3" hidefocus="true">',
+                        '<div class="x-grid3-viewport">',
+                            '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>',
+                            '<div class="x-grid3-scroller"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
+                        '</div>',
+                        '<div class="x-grid3-resize-marker">&#160;</div>',
+                        '<div class="x-grid3-resize-proxy">&#160;</div>',
+                    '</div>'
+                    );
+        }
+
+        if(!ts.header){
+            ts.header = new Ext.Template(
+                    '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
+                    '<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',
+                    '</table>'
+                    );
+        }
+
+        if(!ts.hcell){
+            ts.hcell = new Ext.Template(
+                    '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id} {css}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
+                    '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
+                    '</div></td>'
+                    );
+        }
+
+        if(!ts.body){
+            ts.body = new Ext.Template('{rows}');
+        }
+
+        if(!ts.row){
+            ts.row = new Ext.Template(
+                    '<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
+                    '<tbody><tr>{cells}</tr>',
+                    (this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),
+                    '</tbody></table></div>'
+                    );
+        }
+
+        if(!ts.cell){
+            ts.cell = new Ext.Template(
+                    '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',
+                    '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
+                    '</td>'
+                    );
+        }
+
+        for(var k in ts){
+            var t = ts[k];
+            if(t && typeof t.compile == 'function' && !t.compiled){
+                t.disableFormats = true;
+                t.compile();
+            }
+        }
+
+        this.templates = ts;
+        this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");
+    },
+
+    // private
+    fly : function(el){
+        if(!this._flyweight){
+            this._flyweight = new Ext.Element.Flyweight(document.body);
+        }
+        this._flyweight.dom = el;
+        return this._flyweight;
+    },
+
+    // private
+    getEditorParent : function(){
+        return this.scroller.dom;
+    },
+
+    // private
+    initElements : function(){
+        var E = Ext.Element;
+
+        var el = this.grid.getGridEl().dom.firstChild;
+        var cs = el.childNodes;
+
+        this.el = new E(el);
+
+        this.mainWrap = new E(cs[0]);
+        this.mainHd = new E(this.mainWrap.dom.firstChild);
+
+        if(this.grid.hideHeaders){
+            this.mainHd.setDisplayed(false);
+        }
+
+        this.innerHd = this.mainHd.dom.firstChild;
+        this.scroller = new E(this.mainWrap.dom.childNodes[1]);
+        if(this.forceFit){
+            this.scroller.setStyle('overflow-x', 'hidden');
+        }
+        /**
+         * <i>Read-only</i>. The GridView's body Element which encapsulates all rows in the Grid.
+         * This {@link Ext.Element Element} is only available after the GridPanel has been rendered.
+         * @type Ext.Element
+         * @property mainBody
+         */
+        this.mainBody = new E(this.scroller.dom.firstChild);
+
+        this.focusEl = new E(this.scroller.dom.childNodes[1]);
+        this.focusEl.swallowEvent("click", true);
+
+        this.resizeMarker = new E(cs[1]);
+        this.resizeProxy = new E(cs[2]);
+    },
+
+    // private
+    getRows : function(){
+        return this.hasRows() ? this.mainBody.dom.childNodes : [];
+    },
+
+    // finder methods, used with delegation
+
+    // private
+    findCell : function(el){
+        if(!el){
+            return false;
+        }
+        return this.fly(el).findParent(this.cellSelector, this.cellSelectorDepth);
+    },
+
+/**
+ * <p>Return the index of the grid column which contains the passed element.</p>
+ * See also {@link #findRowIndex}
+ * @param {Element} el The target element
+ * @return The column index, or <b>false</b> if the target element is not within a row of this GridView.
+ */
+    findCellIndex : function(el, requiredCls){
+        var cell = this.findCell(el);
+        if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){
+            return this.getCellIndex(cell);
+        }
+        return false;
+    },
+
+    // private
+    getCellIndex : function(el){
+        if(el){
+            var m = el.className.match(this.colRe);
+            if(m && m[1]){
+                return this.cm.getIndexById(m[1]);
+            }
+        }
+        return false;
+    },
+
+    // private
+    findHeaderCell : function(el){
+        var cell = this.findCell(el);
+        return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null;
+    },
+
+    // private
+    findHeaderIndex : function(el){
+        return this.findCellIndex(el, this.hdCls);
+    },
+
+/**
+ * Return the HtmlElement representing the grid row which contains the passed element.
+ * @param {Element} el The target element
+ * @return The row element, or null if the target element is not within a row of this GridView.
+ */
+    findRow : function(el){
+        if(!el){
+            return false;
+        }
+        return this.fly(el).findParent(this.rowSelector, this.rowSelectorDepth);
+    },
+
+/**
+ * <p>Return the index of the grid row which contains the passed element.</p>
+ * See also {@link #findCellIndex}
+ * @param {Element} el The target element
+ * @return The row index, or <b>false</b> if the target element is not within a row of this GridView.
+ */
+    findRowIndex : function(el){
+        var r = this.findRow(el);
+        return r ? r.rowIndex : false;
+    },
+
+    // getter methods for fetching elements dynamically in the grid
+
+/**
+ * Return the <tt>&lt;div></tt> HtmlElement which represents a Grid row for the specified index.
+ * @param {Number} index The row index
+ * @return {HtmlElement} The div element.
+ */
+    getRow : function(row){
+        return this.getRows()[row];
+    },
+
+/**
+ * Returns the grid's <tt>&lt;td></tt> HtmlElement at the specified coordinates.
+ * @param {Number} row The row index in which to find the cell.
+ * @param {Number} col The column index of the cell.
+ * @return {HtmlElement} The td at the specified coordinates.
+ */
+    getCell : function(row, col){
+        return this.getRow(row).getElementsByTagName('td')[col];
+    },
+
+/**
+ * Return the <tt>&lt;td></tt> HtmlElement which represents the Grid's header cell for the specified column index.
+ * @param {Number} index The column index
+ * @return {HtmlElement} The td element.
+ */
+    getHeaderCell : function(index){
+      return this.mainHd.dom.getElementsByTagName('td')[index];
+    },
+
+    // manipulating elements
+
+    // private - use getRowClass to apply custom row classes
+    addRowClass : function(row, cls){
+        var r = this.getRow(row);
+        if(r){
+            this.fly(r).addClass(cls);
+        }
+    },
+
+    // private
+    removeRowClass : function(row, cls){
+        var r = this.getRow(row);
+        if(r){
+            this.fly(r).removeClass(cls);
+        }
+    },
+
+    // private
+    removeRow : function(row){
+        Ext.removeNode(this.getRow(row));
+        this.syncFocusEl(row);
+    },
+    
+    // private
+    removeRows : function(firstRow, lastRow){
+        var bd = this.mainBody.dom;
+        for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
+            Ext.removeNode(bd.childNodes[firstRow]);
+        }
+        this.syncFocusEl(firstRow);
+    },
+
+    // scrolling stuff
+
+    // private
+    getScrollState : function(){
+        var sb = this.scroller.dom;
+        return {left: sb.scrollLeft, top: sb.scrollTop};
+    },
+
+    // private
+    restoreScroll : function(state){
+        var sb = this.scroller.dom;
+        sb.scrollLeft = state.left;
+        sb.scrollTop = state.top;
+    },
+
+    /**
+     * Scrolls the grid to the top
+     */
+    scrollToTop : function(){
+        this.scroller.dom.scrollTop = 0;
+        this.scroller.dom.scrollLeft = 0;
+    },
+
+    // private
+    syncScroll : function(){
+      this.syncHeaderScroll();
+      var mb = this.scroller.dom;
+        this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop);
+    },
+
+    // private
+    syncHeaderScroll : function(){
+        var mb = this.scroller.dom;
+        this.innerHd.scrollLeft = mb.scrollLeft;
+        this.innerHd.scrollLeft = mb.scrollLeft; // second time for IE (1/2 time first fails, other browsers ignore)
+    },
+
+    // private
+    updateSortIcon : function(col, dir){
+        var sc = this.sortClasses;
+        var hds = this.mainHd.select('td').removeClass(sc);
+        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
+    },
+
+    // private
+    updateAllColumnWidths : function(){
+        var tw = this.getTotalWidth(),
+            clen = this.cm.getColumnCount(),
+            ws = [],
+            len,
+            i;
+        for(i = 0; i < clen; i++){
+            ws[i] = this.getColumnWidth(i);
+        }
+        this.innerHd.firstChild.style.width = this.getOffsetWidth();
+        this.innerHd.firstChild.firstChild.style.width = tw;
+        this.mainBody.dom.style.width = tw;
+        for(i = 0; i < clen; i++){
+            var hd = this.getHeaderCell(i);
+            hd.style.width = ws[i];
+        }
+
+        var ns = this.getRows(), row, trow;
+        for(i = 0, len = ns.length; i < len; i++){
+            row = ns[i];
+            row.style.width = tw;
+            if(row.firstChild){
+                row.firstChild.style.width = tw;
+                trow = row.firstChild.rows[0];
+                for (var j = 0; j < clen; j++) {
+                   trow.childNodes[j].style.width = ws[j];
+                }
+            }
+        }
+
+        this.onAllColumnWidthsUpdated(ws, tw);
+    },
+
+    // private
+    updateColumnWidth : function(col, width){
+        var w = this.getColumnWidth(col);
+        var tw = this.getTotalWidth();
+        this.innerHd.firstChild.style.width = this.getOffsetWidth();
+        this.innerHd.firstChild.firstChild.style.width = tw;
+        this.mainBody.dom.style.width = tw;
+        var hd = this.getHeaderCell(col);
+        hd.style.width = w;
+
+        var ns = this.getRows(), row;
+        for(var i = 0, len = ns.length; i < len; i++){
+            row = ns[i];
+            row.style.width = tw;
+            if(row.firstChild){
+                row.firstChild.style.width = tw;
+                row.firstChild.rows[0].childNodes[col].style.width = w;
+            }
+        }
+
+        this.onColumnWidthUpdated(col, w, tw);
+    },
+
+    // private
+    updateColumnHidden : function(col, hidden){
+        var tw = this.getTotalWidth();
+        this.innerHd.firstChild.style.width = this.getOffsetWidth();
+        this.innerHd.firstChild.firstChild.style.width = tw;
+        this.mainBody.dom.style.width = tw;
+        var display = hidden ? 'none' : '';
+
+        var hd = this.getHeaderCell(col);
+        hd.style.display = display;
+
+        var ns = this.getRows(), row;
+        for(var i = 0, len = ns.length; i < len; i++){
+            row = ns[i];
+            row.style.width = tw;
+            if(row.firstChild){
+                row.firstChild.style.width = tw;
+                row.firstChild.rows[0].childNodes[col].style.display = display;
+            }
+        }
+
+        this.onColumnHiddenUpdated(col, hidden, tw);
+        delete this.lastViewWidth; // force recalc
+        this.layout();
+    },
+
+    // private
+    doRender : function(cs, rs, ds, startRow, colCount, stripe){
+        var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
+        var tstyle = 'width:'+this.getTotalWidth()+';';
+        // buffers
+        var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;
+        for(var j = 0, len = rs.length; j < len; j++){
+            r = rs[j]; cb = [];
+            var rowIndex = (j+startRow);
+            for(var i = 0; i < colCount; i++){
+                c = cs[i];
+                p.id = c.id;
+                p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
+                p.attr = p.cellAttr = "";
+                p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
+                p.style = c.style;
+                if(Ext.isEmpty(p.value)){
+                    p.value = "&#160;";
+                }
+                if(this.markDirty && r.dirty && typeof r.modified[c.name] !== 'undefined'){
+                    p.css += ' x-grid3-dirty-cell';
+                }
+                cb[cb.length] = ct.apply(p);
+            }
+            var alt = [];
+            if(stripe && ((rowIndex+1) % 2 === 0)){
+                alt[0] = "x-grid3-row-alt";
+            }
+            if(r.dirty){
+                alt[1] = " x-grid3-dirty-row";
+            }
+            rp.cols = colCount;
+            if(this.getRowClass){
+                alt[2] = this.getRowClass(r, rowIndex, rp, ds);
+            }
+            rp.alt = alt.join(" ");
+            rp.cells = cb.join("");
+            buf[buf.length] =  rt.apply(rp);
+        }
+        return buf.join("");
+    },
+
+    // private
+    processRows : function(startRow, skipStripe){
+        if(!this.ds || this.ds.getCount() < 1){
+            return;
+        }
+        var rows = this.getRows();
+        skipStripe = skipStripe || !this.grid.stripeRows;
+        startRow = startRow || 0;
+        Ext.each(rows, function(row, idx){
+            row.rowIndex = idx;
+            row.className = row.className.replace(this.rowClsRe, ' ');
+            if (!skipStripe && (idx + 1) % 2 === 0) {
+                row.className += ' x-grid3-row-alt';
+            }
+        });
+        // add first/last-row classes
+        if(startRow === 0){
+            Ext.fly(rows[0]).addClass(this.firstRowCls);
+        }
+        Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls);
+    },
+
+    afterRender : function(){
+        if(!this.ds || !this.cm){
+            return;
+        }
+        this.mainBody.dom.innerHTML = this.renderRows() || '&#160;';
+        this.processRows(0, true);
+
+        if(this.deferEmptyText !== true){
+            this.applyEmptyText();
+        }
+    },
+
+    // private
+    renderUI : function(){
+
+        var header = this.renderHeaders();
+        var body = this.templates.body.apply({rows:'&#160;'});
+
+
+        var html = this.templates.master.apply({
+            body: body,
+            header: header,
+            ostyle: 'width:'+this.getOffsetWidth()+';',
+            bstyle: 'width:'+this.getTotalWidth()+';'
+        });
+
+        var g = this.grid;
+
+        g.getGridEl().dom.innerHTML = html;
+
+        this.initElements();
+
+        // get mousedowns early
+        Ext.fly(this.innerHd).on("click", this.handleHdDown, this);
+        this.mainHd.on({
+            scope: this,
+            mouseover: this.handleHdOver,
+            mouseout: this.handleHdOut,
+            mousemove: this.handleHdMove
+        });
+
+        this.scroller.on('scroll', this.syncScroll,  this);
+        if(g.enableColumnResize !== false){
+            this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
+        }
+
+        if(g.enableColumnMove){
+            this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
+            this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
+        }
+
+        if(g.enableHdMenu !== false){
+            this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});
+            this.hmenu.add(
+                {itemId:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
+                {itemId:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}
+            );
+            if(g.enableColumnHide !== false){
+                this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});
+                this.colMenu.on({
+                    scope: this,
+                    beforeshow: this.beforeColMenuShow,
+                    itemclick: this.handleHdMenuClick
+                });
+                this.hmenu.add('-', {
+                    itemId:"columns",
+                    hideOnClick: false,
+                    text: this.columnsText,
+                    menu: this.colMenu,
+                    iconCls: 'x-cols-icon'
+                });
+            }
+            this.hmenu.on("itemclick", this.handleHdMenuClick, this);
+        }
+
+        if(g.trackMouseOver){
+            this.mainBody.on({
+                scope: this,
+                mouseover: this.onRowOver,
+                mouseout: this.onRowOut
+            });
+        }
+
+        if(g.enableDragDrop || g.enableDrag){
+            this.dragZone = new Ext.grid.GridDragZone(g, {
+                ddGroup : g.ddGroup || 'GridDD'
+            });
+        }
+
+        this.updateHeaderSortState();
+
+    },
+
+    // private
+    layout : function(){
+        if(!this.mainBody){
+            return; // not rendered
+        }
+        var g = this.grid;
+        var c = g.getGridEl();
+        var csize = c.getSize(true);
+        var vw = csize.width;
+
+        if(!g.hideHeaders && (vw < 20 || csize.height < 20)){ // display: none?
+            return;
+        }
+        
+        if(g.autoHeight){
+            this.scroller.dom.style.overflow = 'visible';
+            if(Ext.isWebKit){
+                this.scroller.dom.style.position = 'static';
+            }
+        }else{
+            this.el.setSize(csize.width, csize.height);
+
+            var hdHeight = this.mainHd.getHeight();
+            var vh = csize.height - (hdHeight);
+
+            this.scroller.setSize(vw, vh);
+            if(this.innerHd){
+                this.innerHd.style.width = (vw)+'px';
+            }
+        }
+        if(this.forceFit){
+            if(this.lastViewWidth != vw){
+                this.fitColumns(false, false);
+                this.lastViewWidth = vw;
+            }
+        }else {
+            this.autoExpand();
+            this.syncHeaderScroll();
+        }
+        this.onLayout(vw, vh);
+    },
+
+    // template functions for subclasses and plugins
+    // these functions include precalculated values
+    onLayout : function(vw, vh){
+        // do nothing
+    },
+
+    onColumnWidthUpdated : function(col, w, tw){
+        //template method
+    },
+
+    onAllColumnWidthsUpdated : function(ws, tw){
+        //template method
+    },
+
+    onColumnHiddenUpdated : function(col, hidden, tw){
+        // template method
+    },
+
+    updateColumnText : function(col, text){
+        // template method
+    },
+
+    afterMove : function(colIndex){
+        // template method
+    },
+
+    /* ----------------------------------- Core Specific -------------------------------------------*/
+    // private
+    init : function(grid){
+        this.grid = grid;
+
+        this.initTemplates();
+        this.initData(grid.store, grid.colModel);
+        this.initUI(grid);
+    },
+
+    // private
+    getColumnId : function(index){
+      return this.cm.getColumnId(index);
+    },
+    
+    // private 
+    getOffsetWidth : function() {
+        return (this.cm.getTotalWidth() + this.scrollOffset) + 'px';
+    },
+
+    // private
+    renderHeaders : function(){
+        var cm = this.cm, 
+            ts = this.templates,
+            ct = ts.hcell,
+            cb = [], 
+            p = {},
+            len = cm.getColumnCount(),
+            last = len - 1;
+            
+        for(var i = 0; i < len; i++){
+            p.id = cm.getColumnId(i);
+            p.value = cm.getColumnHeader(i) || "";
+            p.style = this.getColumnStyle(i, true);
+            p.tooltip = this.getColumnTooltip(i);
+            p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
+            if(cm.config[i].align == 'right'){
+                p.istyle = 'padding-right:16px';
+            } else {
+                delete p.istyle;
+            }
+            cb[cb.length] = ct.apply(p);
+        }
+        return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});
+    },
+
+    // private
+    getColumnTooltip : function(i){
+        var tt = this.cm.getColumnTooltip(i);
+        if(tt){
+            if(Ext.QuickTips.isEnabled()){
+                return 'ext:qtip="'+tt+'"';
+            }else{
+                return 'title="'+tt+'"';
+            }
+        }
+        return "";
+    },
+
+    // private
+    beforeUpdate : function(){
+        this.grid.stopEditing(true);
+    },
+
+    // private
+    updateHeaders : function(){
+        this.innerHd.firstChild.innerHTML = this.renderHeaders();
+        this.innerHd.firstChild.style.width = this.getOffsetWidth();
+        this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth();
+    },
+
+    /**
+     * Focuses the specified row.
+     * @param {Number} row The row index
+     */
+    focusRow : function(row){
+        this.focusCell(row, 0, false);
+    },
+
+    /**
+     * Focuses the specified cell.
+     * @param {Number} row The row index
+     * @param {Number} col The column index
+     */
+    focusCell : function(row, col, hscroll){
+        this.syncFocusEl(this.ensureVisible(row, col, hscroll));
+        if(Ext.isGecko){
+            this.focusEl.focus();
+        }else{
+            this.focusEl.focus.defer(1, this.focusEl);
+        }
+    },
+
+    resolveCell : function(row, col, hscroll){
+        if(typeof row != "number"){
+            row = row.rowIndex;
+        }
+        if(!this.ds){
+            return null;
+        }
+        if(row < 0 || row >= this.ds.getCount()){
+            return null;
+        }
+        col = (col !== undefined ? col : 0);
+
+        var rowEl = this.getRow(row),
+            cm = this.cm,
+            colCount = cm.getColumnCount(),
+            cellEl;
+        if(!(hscroll === false && col === 0)){
+            while(col < colCount && cm.isHidden(col)){
+                col++;
+            }
+            cellEl = this.getCell(row, col);
+        }
+
+        return {row: rowEl, cell: cellEl};
+    },
+
+    getResolvedXY : function(resolved){
+        if(!resolved){
+            return null;
+        }
+        var s = this.scroller.dom, c = resolved.cell, r = resolved.row;
+        return c ? Ext.fly(c).getXY() : [this.el.getX(), Ext.fly(r).getY()];
+    },
+
+    syncFocusEl : function(row, col, hscroll){
+        var xy = row;
+        if(!Ext.isArray(xy)){
+            row = Math.min(row, Math.max(0, this.getRows().length-1));
+            xy = this.getResolvedXY(this.resolveCell(row, col, hscroll));
+        }
+        this.focusEl.setXY(xy||this.scroller.getXY());
+    },
+
+    ensureVisible : function(row, col, hscroll){
+        var resolved = this.resolveCell(row, col, hscroll);
+        if(!resolved || !resolved.row){
+            return;
+        }
+
+        var rowEl = resolved.row, 
+            cellEl = resolved.cell,
+            c = this.scroller.dom,
+            ctop = 0,
+            p = rowEl, 
+            stop = this.el.dom;
+            
+        while(p && p != stop){
+            ctop += p.offsetTop;
+            p = p.offsetParent;
+        }
+        ctop -= this.mainHd.dom.offsetHeight;
+
+        var cbot = ctop + rowEl.offsetHeight,
+            ch = c.clientHeight,
+            sbot = stop + ch;
+            
+        stop = parseInt(c.scrollTop, 10);
+        
+
+        if(ctop < stop){
+          c.scrollTop = ctop;
+        }else if(cbot > sbot){
+            c.scrollTop = cbot-ch;
+        }
+
+        if(hscroll !== false){
+            var cleft = parseInt(cellEl.offsetLeft, 10);
+            var cright = cleft + cellEl.offsetWidth;
+
+            var sleft = parseInt(c.scrollLeft, 10);
+            var sright = sleft + c.clientWidth;
+            if(cleft < sleft){
+                c.scrollLeft = cleft;
+            }else if(cright > sright){
+                c.scrollLeft = cright-c.clientWidth;
+            }
+        }
+        return this.getResolvedXY(resolved);
+    },
+
+    // private
+    insertRows : function(dm, firstRow, lastRow, isUpdate){
+        var last = dm.getCount() - 1;
+        if(!isUpdate && firstRow === 0 && lastRow >= last){
+            this.refresh();
+        }else{
+            if(!isUpdate){
+                this.fireEvent("beforerowsinserted", this, firstRow, lastRow);
+            }
+            var html = this.renderRows(firstRow, lastRow),
+                before = this.getRow(firstRow);
+            if(before){
+                if(firstRow === 0){
+                    Ext.fly(this.getRow(0)).removeClass(this.firstRowCls);
+                }
+                Ext.DomHelper.insertHtml('beforeBegin', before, html);
+            }else{
+                var r = this.getRow(last - 1);
+                if(r){
+                    Ext.fly(r).removeClass(this.lastRowCls);
+                }
+                Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);
+            }
+            if(!isUpdate){
+                this.fireEvent("rowsinserted", this, firstRow, lastRow);
+                this.processRows(firstRow);
+            }else if(firstRow === 0 || firstRow >= last){
+                //ensure first/last row is kept after an update.
+                Ext.fly(this.getRow(firstRow)).addClass(firstRow === 0 ? this.firstRowCls : this.lastRowCls);
+            }
+        }
+        this.syncFocusEl(firstRow);
+    },
+
+    // private
+    deleteRows : function(dm, firstRow, lastRow){
+        if(dm.getRowCount()<1){
+            this.refresh();
+        }else{
+            this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);
+
+            this.removeRows(firstRow, lastRow);
+
+            this.processRows(firstRow);
+            this.fireEvent("rowsdeleted", this, firstRow, lastRow);
+        }
+    },
+
+    // private
+    getColumnStyle : function(col, isHeader){
+        var style = !isHeader ? (this.cm.config[col].css || '') : '';
+        style += 'width:'+this.getColumnWidth(col)+';';
+        if(this.cm.isHidden(col)){
+            style += 'display:none;';
+        }
+        var align = this.cm.config[col].align;
+        if(align){
+            style += 'text-align:'+align+';';
+        }
+        return style;
+    },
+
+    // private
+    getColumnWidth : function(col){
+        var w = this.cm.getColumnWidth(col);
+        if(typeof w == 'number'){
+            return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px';
+        }
+        return w;
+    },
+
+    // private
+    getTotalWidth : function(){
+        return this.cm.getTotalWidth()+'px';
+    },
+
+    // private
+    fitColumns : function(preventRefresh, onlyExpand, omitColumn){
+        var cm = this.cm, i;
+        var tw = cm.getTotalWidth(false);
+        var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
+
+        if(aw < 20){ // not initialized, so don't screw up the default widths
+            return;
+        }
+        var extra = aw - tw;
+
+        if(extra === 0){
+            return false;
+        }
+
+        var vc = cm.getColumnCount(true);
+        var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
+        if(ac === 0){
+            ac = 1;
+            omitColumn = undefined;
+        }
+        var colCount = cm.getColumnCount();
+        var cols = [];
+        var extraCol = 0;
+        var width = 0;
+        var w;
+        for (i = 0; i < colCount; i++){
+            if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){
+                w = cm.getColumnWidth(i);
+                cols.push(i);
+                extraCol = i;
+                cols.push(w);
+                width += w;
+            }
+        }
+        var frac = (aw - cm.getTotalWidth())/width;
+        while (cols.length){
+            w = cols.pop();
+            i = cols.pop();
+            cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);
+        }
+
+        if((tw = cm.getTotalWidth(false)) > aw){
+            var adjustCol = ac != vc ? omitColumn : extraCol;
+             cm.setColumnWidth(adjustCol, Math.max(1,
+                     cm.getColumnWidth(adjustCol)- (tw-aw)), true);
+        }
+
+        if(preventRefresh !== true){
+            this.updateAllColumnWidths();
+        }
+
+
+        return true;
+    },
+
+    // private
+    autoExpand : function(preventUpdate){
+        var g = this.grid, cm = this.cm;
+        if(!this.userResized && g.autoExpandColumn){
+            var tw = cm.getTotalWidth(false);
+            var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
+            if(tw != aw){
+                var ci = cm.getIndexById(g.autoExpandColumn);
+                var currentWidth = cm.getColumnWidth(ci);
+                var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax);
+                if(cw != currentWidth){
+                    cm.setColumnWidth(ci, cw, true);
+                    if(preventUpdate !== true){
+                        this.updateColumnWidth(ci, cw);
+                    }
+                }
+            }
+        }
+    },
+
+    // private
+    getColumnData : function(){
+        // build a map for all the columns
+        var cs = [], cm = this.cm, colCount = cm.getColumnCount();
+        for(var i = 0; i < colCount; i++){
+            var name = cm.getDataIndex(i);
+            cs[i] = {
+                name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),
+                renderer : cm.getRenderer(i),
+                id : cm.getColumnId(i),
+                style : this.getColumnStyle(i)
+            };
+        }
+        return cs;
+    },
+
+    // private
+    renderRows : function(startRow, endRow){
+        // pull in all the crap needed to render rows
+        var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows;
+        var colCount = cm.getColumnCount();
+
+        if(ds.getCount() < 1){
+            return "";
+        }
+
+        var cs = this.getColumnData();
+
+        startRow = startRow || 0;
+        endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
+
+        // records to render
+        var rs = ds.getRange(startRow, endRow);
+
+        return this.doRender(cs, rs, ds, startRow, colCount, stripe);
+    },
+
+    // private
+    renderBody : function(){
+        var markup = this.renderRows() || '&#160;';
+        return this.templates.body.apply({rows: markup});
+    },
+
+    // private
+    refreshRow : function(record){
+        var ds = this.ds, index;
+        if(typeof record == 'number'){
+            index = record;
+            record = ds.getAt(index);
+            if(!record){
+                return;
+            }
+        }else{
+            index = ds.indexOf(record);
+            if(index < 0){
+                return;
+            }
+        }
+        this.insertRows(ds, index, index, true);
+        this.getRow(index).rowIndex = index;
+        this.onRemove(ds, record, index+1, true);
+        this.fireEvent("rowupdated", this, index, record);
+    },
+
+    /**
+     * Refreshs the grid UI
+     * @param {Boolean} headersToo (optional) True to also refresh the headers
+     */
+    refresh : function(headersToo){
+        this.fireEvent("beforerefresh", this);
+        this.grid.stopEditing(true);
+
+        var result = this.renderBody();
+        this.mainBody.update(result).setWidth(this.getTotalWidth());
+        if(headersToo === true){
+            this.updateHeaders();
+            this.updateHeaderSortState();
+        }
+        this.processRows(0, true);
+        this.layout();
+        this.applyEmptyText();
+        this.fireEvent("refresh", this);
+    },
+
+    // private
+    applyEmptyText : function(){
+        if(this.emptyText && !this.hasRows()){
+            this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
+        }
+    },
+
+    // private
+    updateHeaderSortState : function(){
+        var state = this.ds.getSortState();
+        if(!state){
+            return;
+        }
+        if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){
+            this.grid.fireEvent('sortchange', this.grid, state);
+        }
+        this.sortState = state;
+        var sortColumn = this.cm.findColumnIndex(state.field);
+        if(sortColumn != -1){
+            var sortDir = state.direction;
+            this.updateSortIcon(sortColumn, sortDir);
+        }
+    },
+
+    // private
+    destroy : function(){
+        if(this.colMenu){
+            Ext.menu.MenuMgr.unregister(this.colMenu);
+            this.colMenu.destroy();
+            delete this.colMenu;
+        }
+        if(this.hmenu){
+            Ext.menu.MenuMgr.unregister(this.hmenu);
+            this.hmenu.destroy();
+            delete this.hmenu;
+        }
+        if(this.grid.enableColumnMove){
+            var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
+            if(dds){
+                for(var dd in dds){
+                    if(!dds[dd].config.isTarget && dds[dd].dragElId){
+                        var elid = dds[dd].dragElId;
+                        dds[dd].unreg();
+                        Ext.get(elid).remove();
+                    } else if(dds[dd].config.isTarget){
+                        dds[dd].proxyTop.remove();
+                        dds[dd].proxyBottom.remove();
+                        dds[dd].unreg();
+                    }
+                    if(Ext.dd.DDM.locationCache[dd]){
+                        delete Ext.dd.DDM.locationCache[dd];
+                    }
+                }
+                delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
+            }
+        }
+
+        if(this.dragZone){
+            this.dragZone.unreg();
+        }
+        
+        Ext.fly(this.innerHd).removeAllListeners();
+        Ext.removeNode(this.innerHd);
+        
+        Ext.destroy(this.resizeMarker, this.resizeProxy, this.focusEl, this.mainBody, 
+                    this.scroller, this.mainHd, this.mainWrap, this.dragZone, 
+                    this.splitZone, this.columnDrag, this.columnDrop);
+
+        this.initData(null, null);
+        Ext.EventManager.removeResizeListener(this.onWindowResize, this);
+        this.purgeListeners();
+    },
+
+    // private
+    onDenyColumnHide : function(){
+
+    },
+
+    // private
+    render : function(){
+        if(this.autoFill){
+            var ct = this.grid.ownerCt;
+            if (ct && ct.getLayout()){
+                ct.on('afterlayout', function(){ 
+                    this.fitColumns(true, true);
+                    this.updateHeaders(); 
+                }, this, {single: true}); 
+            }else{ 
+                this.fitColumns(true, true); 
+            }
+        }else if(this.forceFit){
+            this.fitColumns(true, false);
+        }else if(this.grid.autoExpandColumn){
+            this.autoExpand(true);
+        }
+
+        this.renderUI();
+    },
+
+    /* --------------------------------- Model Events and Handlers --------------------------------*/
+    // private
+    initData : function(ds, cm){
+        if(this.ds){
+            this.ds.un("load", this.onLoad, this);
+            this.ds.un("datachanged", this.onDataChange, this);
+            this.ds.un("add", this.onAdd, this);
+            this.ds.un("remove", this.onRemove, this);
+            this.ds.un("update", this.onUpdate, this);
+            this.ds.un("clear", this.onClear, this);
+            if(this.ds !== ds && this.ds.autoDestroy){
+                this.ds.destroy();
+            }
+        }
+        if(ds){
+            ds.on({
+                scope: this,
+                load: this.onLoad,
+                datachanged: this.onDataChange,
+                add: this.onAdd,
+                remove: this.onRemove,
+                update: this.onUpdate,
+                clear: this.onClear
+            });
+        }
+        this.ds = ds;
+
+        if(this.cm){
+            this.cm.un("configchange", this.onColConfigChange, this);
+            this.cm.un("widthchange", this.onColWidthChange, this);
+            this.cm.un("headerchange", this.onHeaderChange, this);
+            this.cm.un("hiddenchange", this.onHiddenChange, this);
+            this.cm.un("columnmoved", this.onColumnMove, this);
+        }
+        if(cm){
+            delete this.lastViewWidth;
+            cm.on({
+                scope: this,
+                configchange: this.onColConfigChange,
+                widthchange: this.onColWidthChange,
+                headerchange: this.onHeaderChange,
+                hiddenchange: this.onHiddenChange,
+                columnmoved: this.onColumnMove
+            });
+        }
+        this.cm = cm;
+    },
+
+    // private
+    onDataChange : function(){
+        this.refresh();
+        this.updateHeaderSortState();
+        this.syncFocusEl(0);
+    },
+
+    // private
+    onClear : function(){
+        this.refresh();
+        this.syncFocusEl(0);
+    },
+
+    // private
+    onUpdate : function(ds, record){
+        this.refreshRow(record);
+    },
+
+    // private
+    onAdd : function(ds, records, index){
+        this.insertRows(ds, index, index + (records.length-1));
+    },
+
+    // private
+    onRemove : function(ds, record, index, isUpdate){
+        if(isUpdate !== true){
+            this.fireEvent("beforerowremoved", this, index, record);
+        }
+        this.removeRow(index);
+        if(isUpdate !== true){
+            this.processRows(index);
+            this.applyEmptyText();
+            this.fireEvent("rowremoved", this, index, record);
+        }
+    },
+
+    // private
+    onLoad : function(){
+        this.scrollToTop();
+    },
+
+    // private
+    onColWidthChange : function(cm, col, width){
+        this.updateColumnWidth(col, width);
+    },
+
+    // private
+    onHeaderChange : function(cm, col, text){
+        this.updateHeaders();
+    },
+
+    // private
+    onHiddenChange : function(cm, col, hidden){
+        this.updateColumnHidden(col, hidden);
+    },
+
+    // private
+    onColumnMove : function(cm, oldIndex, newIndex){
+        this.indexMap = null;
+        var s = this.getScrollState();
+        this.refresh(true);
+        this.restoreScroll(s);
+        this.afterMove(newIndex);
+        this.grid.fireEvent('columnmove', oldIndex, newIndex);
+    },
+
+    // private
+    onColConfigChange : function(){
+        delete this.lastViewWidth;
+        this.indexMap = null;
+        this.refresh(true);
+    },
+
+    /* -------------------- UI Events and Handlers ------------------------------ */
+    // private
+    initUI : function(grid){
+        grid.on("headerclick", this.onHeaderClick, this);
+    },
+
+    // private
+    initEvents : function(){
+    },
+
+    // private
+    onHeaderClick : function(g, index){
+        if(this.headersDisabled || !this.cm.isSortable(index)){
+            return;
+        }
+        g.stopEditing(true);
+        g.store.sort(this.cm.getDataIndex(index));
+    },
+
+    // private
+    onRowOver : function(e, t){
+        var row;
+        if((row = this.findRowIndex(t)) !== false){
+            this.addRowClass(row, "x-grid3-row-over");
+        }
+    },
+
+    // private
+    onRowOut : function(e, t){
+        var row;
+        if((row = this.findRowIndex(t)) !== false && !e.within(this.getRow(row), true)){
+            this.removeRowClass(row, "x-grid3-row-over");
+        }
+    },
+
+    // private
+    handleWheel : function(e){
+        e.stopPropagation();
+    },
+
+    // private
+    onRowSelect : function(row){
+        this.addRowClass(row, this.selectedRowClass);
+    },
+
+    // private
+    onRowDeselect : function(row){
+        this.removeRowClass(row, this.selectedRowClass);
+    },
+
+    // private
+    onCellSelect : function(row, col){
+        var cell = this.getCell(row, col);
+        if(cell){
+            this.fly(cell).addClass("x-grid3-cell-selected");
+        }
+    },
+
+    // private
+    onCellDeselect : function(row, col){
+        var cell = this.getCell(row, col);
+        if(cell){
+            this.fly(cell).removeClass("x-grid3-cell-selected");
+        }
+    },
+
+    // private
+    onColumnSplitterMoved : function(i, w){
+        this.userResized = true;
+        var cm = this.grid.colModel;
+        cm.setColumnWidth(i, w, true);
+
+        if(this.forceFit){
+            this.fitColumns(true, false, i);
+            this.updateAllColumnWidths();
+        }else{
+            this.updateColumnWidth(i, w);
+            this.syncHeaderScroll();
+        }
+
+        this.grid.fireEvent("columnresize", i, w);
+    },
+
+    // private
+    handleHdMenuClick : function(item){
+        var index = this.hdCtxIndex;
+        var cm = this.cm, ds = this.ds;
+        switch(item.itemId){
+            case "asc":
+                ds.sort(cm.getDataIndex(index), "ASC");
+                break;
+            case "desc":
+                ds.sort(cm.getDataIndex(index), "DESC");
+                break;
+            default:
+                index = cm.getIndexById(item.itemId.substr(4));
+                if(index != -1){
+                    if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
+                        this.onDenyColumnHide();
+                        return false;
+                    }
+                    cm.setHidden(index, item.checked);
+                }
+        }
+        return true;
+    },
+
+    // private
+    isHideableColumn : function(c){
+        return !c.hidden && !c.fixed;
+    },
+
+    // private
+    beforeColMenuShow : function(){
+        var cm = this.cm,  colCount = cm.getColumnCount();
+        this.colMenu.removeAll();
+        for(var i = 0; i < colCount; i++){
+            if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){
+                this.colMenu.add(new Ext.menu.CheckItem({
+                    itemId: "col-"+cm.getColumnId(i),
+                    text: cm.getColumnHeader(i),
+                    checked: !cm.isHidden(i),
+                    hideOnClick:false,
+                    disabled: cm.config[i].hideable === false
+                }));
+            }
+        }
+    },
+
+    // private
+    handleHdDown : function(e, t){
+        if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
+            e.stopEvent();
+            var hd = this.findHeaderCell(t);
+            Ext.fly(hd).addClass('x-grid3-hd-menu-open');
+            var index = this.getCellIndex(hd);
+            this.hdCtxIndex = index;
+            var ms = this.hmenu.items, cm = this.cm;
+            ms.get("asc").setDisabled(!cm.isSortable(index));
+            ms.get("desc").setDisabled(!cm.isSortable(index));
+            this.hmenu.on("hide", function(){
+                Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
+            }, this, {single:true});
+            this.hmenu.show(t, "tl-bl?");
+        }
+    },
+
+    // private
+    handleHdOver : function(e, t){
+        var hd = this.findHeaderCell(t);
+        if(hd && !this.headersDisabled){
+            this.activeHd = hd;
+            this.activeHdIndex = this.getCellIndex(hd);
+            var fly = this.fly(hd);
+            this.activeHdRegion = fly.getRegion();
+            if(!this.cm.isMenuDisabled(this.activeHdIndex)){
+                fly.addClass("x-grid3-hd-over");
+                this.activeHdBtn = fly.child('.x-grid3-hd-btn');
+                if(this.activeHdBtn){
+                    this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
+                }
+            }
+        }
+    },
+
+    // private
+    handleHdMove : function(e, t){
+        if(this.activeHd && !this.headersDisabled){
+            var hw = this.splitHandleWidth || 5;
+            var r = this.activeHdRegion;
+            var x = e.getPageX();
+            var ss = this.activeHd.style;
+            if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
+                ss.cursor = Ext.isAir ? 'move' : Ext.isWebKit ? 'e-resize' : 'col-resize'; // col-resize not always supported
+            }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
+                ss.cursor = Ext.isAir ? 'move' : Ext.isWebKit ? 'w-resize' : 'col-resize';
+            }else{
+                ss.cursor = '';
+            }
+        }
+    },
+
+    // private
+    handleHdOut : function(e, t){
+        var hd = this.findHeaderCell(t);
+        if(hd && (!Ext.isIE || !e.within(hd, true))){
+            this.activeHd = null;
+            this.fly(hd).removeClass("x-grid3-hd-over");
+            hd.style.cursor = '';
+        }
+    },
+
+    // private
+    hasRows : function(){
+        var fc = this.mainBody.dom.firstChild;
+        return fc && fc.nodeType == 1 && fc.className != 'x-grid-empty';
+    },
+
+    // back compat
+    bind : function(d, c){
+        this.initData(d, c);
+    }
+});
+
+
+// private
+// This is a support class used internally by the Grid components
+Ext.grid.GridView.SplitDragZone = function(grid, hd){
+    this.grid = grid;
+    this.view = grid.getView();
+    this.marker = this.view.resizeMarker;
+    this.proxy = this.view.resizeProxy;
+    Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
+        "gridSplitters" + this.grid.getGridEl().id, {
+        dragElId : Ext.id(this.proxy.dom), resizeFrame:false
+    });
+    this.scroll = false;
+    this.hw = this.view.splitHandleWidth || 5;
+};
+Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
+
+    b4StartDrag : function(x, y){
+        this.view.headersDisabled = true;
+        var h = this.view.mainWrap.getHeight();
+        this.marker.setHeight(h);
+        this.marker.show();
+        this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]);
+        this.proxy.setHeight(h);
+        var w = this.cm.getColumnWidth(this.cellIndex);
+        var minw = Math.max(w-this.grid.minColumnWidth, 0);
+        this.resetConstraints();
+        this.setXConstraint(minw, 1000);
+        this.setYConstraint(0, 0);
+        this.minX = x - minw;
+        this.maxX = x + 1000;
+        this.startPos = x;
+        Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
+    },
+
+
+    handleMouseDown : function(e){
+        var t = this.view.findHeaderCell(e.getTarget());
+        if(t){
+            var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];
+            var exy = e.getXY(), ex = exy[0];
+            var w = t.offsetWidth, adjust = false;
+            if((ex - x) <= this.hw){
+                adjust = -1;
+            }else if((x+w) - ex <= this.hw){
+                adjust = 0;
+            }
+            if(adjust !== false){
+                this.cm = this.grid.colModel;
+                var ci = this.view.getCellIndex(t);
+                if(adjust == -1){
+                  if (ci + adjust < 0) {
+                    return;
+                  }
+                    while(this.cm.isHidden(ci+adjust)){
+                        --adjust;
+                        if(ci+adjust < 0){
+                            return;
+                        }
+                    }
+                }
+                this.cellIndex = ci+adjust;
+                this.split = t.dom;
+                if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
+                    Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
+                }
+            }else if(this.view.columnDrag){
+                this.view.columnDrag.callHandleMouseDown(e);
+            }
+        }
+    },
+
+    endDrag : function(e){
+        this.marker.hide();
+        var v = this.view;
+        var endX = Math.max(this.minX, e.getPageX());
+        var diff = endX - this.startPos;
+        v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
+        setTimeout(function(){
+            v.headersDisabled = false;
+        }, 50);
+    },
+
+    autoOffset : function(){
+        this.setDelta(0,0);
+    }
+});
+// private\r
+// This is a support class used internally by the Grid components\r
+Ext.grid.HeaderDragZone = function(grid, hd, hd2){\r
+    this.grid = grid;\r
+    this.view = grid.getView();\r
+    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
+    Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);\r
+    if(hd2){\r
+        this.setHandleElId(Ext.id(hd));\r
+        this.setOuterHandleElId(Ext.id(hd2));\r
+    }\r
+    this.scroll = false;\r
+};\r
+Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {\r
+    maxDragWidth: 120,\r
+    getDragData : function(e){\r
+        var t = Ext.lib.Event.getTarget(e);\r
+        var h = this.view.findHeaderCell(t);\r
+        if(h){\r
+            return {ddel: h.firstChild, header:h};\r
         }\r
-        Ext.StatusBar.superclass.initComponent.call(this);\r
+        return false;\r
     },\r
-    \r
-    // private\r
-    afterRender : function(){\r
-        Ext.StatusBar.superclass.afterRender.call(this);\r
-        \r
-        var right = this.statusAlign=='right',\r
-            td = Ext.get(this.nextBlock());\r
-        \r
-        if(right){\r
-            this.tr.appendChild(td.dom);\r
-        }else{\r
-            td.insertBefore(this.tr.firstChild);\r
-        }\r
-        \r
-        this.statusEl = td.createChild({\r
-            cls: 'x-status-text ' + (this.iconCls || this.defaultIconCls || ''),\r
-            html: this.text || this.defaultText || ''\r
-        });\r
-        this.statusEl.unselectable();\r
-        \r
-        this.spacerEl = td.insertSibling({\r
-            tag: 'td',\r
-            style: 'width:100%',\r
-            cn: [{cls:'ytb-spacer'}]\r
-        }, right ? 'before' : 'after');\r
+\r
+    onInitDrag : function(e){\r
+        this.view.headersDisabled = true;\r
+        var clone = this.dragData.ddel.cloneNode(true);\r
+        clone.id = Ext.id();\r
+        clone.style.width = Math.min(this.dragData.header.offsetWidth,this.maxDragWidth) + "px";\r
+        this.proxy.update(clone);\r
+        return true;\r
     },\r
 \r
-    \r
-    setStatus : function(o){\r
-        o = o || {};\r
-        \r
-        if(typeof o == 'string'){\r
-            o = {text:o};\r
-        }\r
-        if(o.text !== undefined){\r
-            this.setText(o.text);\r
-        }\r
-        if(o.iconCls !== undefined){\r
-            this.setIcon(o.iconCls);\r
-        }\r
-        \r
-        if(o.clear){\r
-            var c = o.clear,\r
-                wait = this.autoClear,\r
-                defaults = {useDefaults: true, anim: true};\r
-            \r
-            if(typeof c == 'object'){\r
-                c = Ext.applyIf(c, defaults);\r
-                if(c.wait){\r
-                    wait = c.wait;\r
-                }\r
-            }else if(typeof c == 'number'){\r
-                wait = c;\r
-                c = defaults;\r
-            }else if(typeof c == 'boolean'){\r
-                c = defaults;\r
-            }\r
-            \r
-            c.threadId = this.activeThreadId;\r
-            this.clearStatus.defer(wait, this, [c]);\r
-        }\r
-        return this;\r
+    afterValidDrop : function(){\r
+        var v = this.view;\r
+        setTimeout(function(){\r
+            v.headersDisabled = false;\r
+        }, 50);\r
     },\r
-     \r
-    \r
-    clearStatus : function(o){\r
-        o = o || {};\r
-        \r
-        if(o.threadId && o.threadId !== this.activeThreadId){\r
-            // this means the current call was made internally, but a newer\r
-            // thread has set a message since this call was deferred.  Since\r
-            // we don't want to overwrite a newer message just ignore.\r
-            return this;\r
-        }\r
-        \r
-        var text = o.useDefaults ? this.defaultText : '',\r
-            iconCls = o.useDefaults ? (this.defaultIconCls ? this.defaultIconCls : '') : '';\r
-            \r
-        if(o.anim){\r
-            this.statusEl.fadeOut({\r
-                remove: false,\r
-                useDisplay: true,\r
-                scope: this,\r
-                callback: function(){\r
-                    this.setStatus({\r
-                           text: text, \r
-                           iconCls: iconCls\r
-                       });\r
-                    this.statusEl.show();\r
-                }\r
-            });\r
-        }else{\r
-            // hide/show the el to avoid jumpy text or icon\r
-            this.statusEl.hide();\r
-               this.setStatus({\r
-                   text: text,\r
-                   iconCls: iconCls\r
-               });\r
-            this.statusEl.show();\r
+\r
+    afterInvalidDrop : function(){\r
+        var v = this.view;\r
+        setTimeout(function(){\r
+            v.headersDisabled = false;\r
+        }, 50);\r
+    }\r
+});\r
+\r
+// private\r
+// This is a support class used internally by the Grid components\r
+Ext.grid.HeaderDropZone = function(grid, hd, hd2){\r
+    this.grid = grid;\r
+    this.view = grid.getView();\r
+    // split the proxies so they don't interfere with mouse events\r
+    this.proxyTop = Ext.DomHelper.append(document.body, {\r
+        cls:"col-move-top", html:"&#160;"\r
+    }, true);\r
+    this.proxyBottom = Ext.DomHelper.append(document.body, {\r
+        cls:"col-move-bottom", html:"&#160;"\r
+    }, true);\r
+    this.proxyTop.hide = this.proxyBottom.hide = function(){\r
+        this.setLeftTop(-100,-100);\r
+        this.setStyle("visibility", "hidden");\r
+    };\r
+    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
+    // temporarily disabled\r
+    //Ext.dd.ScrollManager.register(this.view.scroller.dom);\r
+    Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);\r
+};\r
+Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {\r
+    proxyOffsets : [-4, -9],\r
+    fly: Ext.Element.fly,\r
+\r
+    getTargetFromEvent : function(e){\r
+        var t = Ext.lib.Event.getTarget(e);\r
+        var cindex = this.view.findCellIndex(t);\r
+        if(cindex !== false){\r
+            return this.view.getHeaderCell(cindex);\r
         }\r
-        return this;\r
     },\r
-    \r
-    \r
-    setText : function(text){\r
-        this.activeThreadId++;\r
-        this.text = text || '';\r
-        if(this.rendered){\r
-            this.statusEl.update(this.text);\r
+\r
+    nextVisible : function(h){\r
+        var v = this.view, cm = this.grid.colModel;\r
+        h = h.nextSibling;\r
+        while(h){\r
+            if(!cm.isHidden(v.getCellIndex(h))){\r
+                return h;\r
+            }\r
+            h = h.nextSibling;\r
         }\r
-        return this;\r
-    },\r
-    \r
-    \r
-    getText : function(){\r
-        return this.text;\r
+        return null;\r
     },\r
 \r
-    \r
-    setIcon : function(cls){\r
-        this.activeThreadId++;\r
-        cls = cls || '';\r
-        \r
-        if(this.rendered){\r
-               if(this.currIconCls){\r
-                   this.statusEl.removeClass(this.currIconCls);\r
-                   this.currIconCls = null;\r
-               }\r
-               if(cls.length > 0){\r
-                   this.statusEl.addClass(cls);\r
-                   this.currIconCls = cls;\r
-               }\r
-        }else{\r
-            this.currIconCls = cls;\r
+    prevVisible : function(h){\r
+        var v = this.view, cm = this.grid.colModel;\r
+        h = h.prevSibling;\r
+        while(h){\r
+            if(!cm.isHidden(v.getCellIndex(h))){\r
+                return h;\r
+            }\r
+            h = h.prevSibling;\r
         }\r
-        return this;\r
+        return null;\r
     },\r
-    \r
-    \r
-    showBusy : function(o){\r
-        if(typeof o == 'string'){\r
-            o = {text:o};\r
-        }\r
-        o = Ext.applyIf(o || {}, {\r
-            text: this.busyText,\r
-            iconCls: this.busyIconCls\r
-        });\r
-        return this.setStatus(o);\r
-    }\r
-});\r
-Ext.reg('statusbar', Ext.StatusBar);\r
-\r
 \r
-Ext.History = (function () {\r
-    var iframe, hiddenField;\r
-    var ready = false;\r
-    var currentToken;\r
-\r
-    function getHash() {\r
-        var href = top.location.href, i = href.indexOf("#");\r
-        return i >= 0 ? href.substr(i + 1) : null;\r
-    }\r
-\r
-    function doSave() {\r
-        hiddenField.value = currentToken;\r
-    }\r
-\r
-    function handleStateChange(token) {\r
-        currentToken = token;\r
-        Ext.History.fireEvent('change', token);\r
-    }\r
+    positionIndicator : function(h, n, e){\r
+        var x = Ext.lib.Event.getPageX(e);\r
+        var r = Ext.lib.Dom.getRegion(n.firstChild);\r
+        var px, pt, py = r.top + this.proxyOffsets[1];\r
+        if((r.right - x) <= (r.right-r.left)/2){\r
+            px = r.right+this.view.borderWidth;\r
+            pt = "after";\r
+        }else{\r
+            px = r.left;\r
+            pt = "before";\r
+        }\r
 \r
-    function updateIFrame (token) {\r
-        var html = ['<html><body><div id="state">',token,'</div></body></html>'].join('');\r
-        try {\r
-            var doc = iframe.contentWindow.document;\r
-            doc.open();\r
-            doc.write(html);\r
-            doc.close();\r
-            return true;\r
-        } catch (e) {\r
+        if(this.grid.colModel.isFixed(this.view.getCellIndex(n))){\r
             return false;\r
         }\r
-    }\r
 \r
-    function checkIFrame() {\r
-        if (!iframe.contentWindow || !iframe.contentWindow.document) {\r
-            setTimeout(checkIFrame, 10);\r
-            return;\r
+        px +=  this.proxyOffsets[0];\r
+        this.proxyTop.setLeftTop(px, py);\r
+        this.proxyTop.show();\r
+        if(!this.bottomOffset){\r
+            this.bottomOffset = this.view.mainHd.getHeight();\r
         }\r
+        this.proxyBottom.setLeftTop(px, py+this.proxyTop.dom.offsetHeight+this.bottomOffset);\r
+        this.proxyBottom.show();\r
+        return pt;\r
+    },\r
 \r
-        var doc = iframe.contentWindow.document;\r
-        var elem = doc.getElementById("state");\r
-        var token = elem ? elem.innerText : null;\r
-\r
-        var hash = getHash();\r
-\r
-        setInterval(function () {\r
-\r
-            doc = iframe.contentWindow.document;\r
-            elem = doc.getElementById("state");\r
+    onNodeEnter : function(n, dd, e, data){\r
+        if(data.header != n){\r
+            this.positionIndicator(data.header, n, e);\r
+        }\r
+    },\r
 \r
-            var newtoken = elem ? elem.innerText : null;\r
+    onNodeOver : function(n, dd, e, data){\r
+        var result = false;\r
+        if(data.header != n){\r
+            result = this.positionIndicator(data.header, n, e);\r
+        }\r
+        if(!result){\r
+            this.proxyTop.hide();\r
+            this.proxyBottom.hide();\r
+        }\r
+        return result ? this.dropAllowed : this.dropNotAllowed;\r
+    },\r
 \r
-            var newHash = getHash();\r
+    onNodeOut : function(n, dd, e, data){\r
+        this.proxyTop.hide();\r
+        this.proxyBottom.hide();\r
+    },\r
 \r
-            if (newtoken !== token) {\r
-                token = newtoken;\r
-                handleStateChange(token);\r
-                top.location.hash = token;\r
-                hash = token;\r
-                doSave();\r
-            } else if (newHash !== hash) {\r
-                hash = newHash;\r
-                updateIFrame(newHash);\r
+    onNodeDrop : function(n, dd, e, data){\r
+        var h = data.header;\r
+        if(h != n){\r
+            var cm = this.grid.colModel;\r
+            var x = Ext.lib.Event.getPageX(e);\r
+            var r = Ext.lib.Dom.getRegion(n.firstChild);\r
+            var pt = (r.right - x) <= ((r.right-r.left)/2) ? "after" : "before";\r
+            var oldIndex = this.view.getCellIndex(h);\r
+            var newIndex = this.view.getCellIndex(n);\r
+            if(pt == "after"){\r
+                newIndex++;\r
             }\r
-\r
-        }, 50);\r
-\r
-        ready = true;\r
-\r
-        Ext.History.fireEvent('ready', Ext.History);\r
-    }\r
-\r
-    function startUp() {\r
-        currentToken = hiddenField.value ? hiddenField.value : getHash();\r
-        \r
-        if (Ext.isIE) {\r
-            checkIFrame();\r
-        } else {\r
-            var hash = getHash();\r
-            setInterval(function () {\r
-                var newHash = getHash();\r
-                if (newHash !== hash) {\r
-                    hash = newHash;\r
-                    handleStateChange(hash);\r
-                    doSave();\r
-                }\r
-            }, 50);\r
-            ready = true;\r
-            Ext.History.fireEvent('ready', Ext.History);\r
+            if(oldIndex < newIndex){\r
+                newIndex--;\r
+            }\r
+            cm.moveColumn(oldIndex, newIndex);\r
+            this.grid.fireEvent("columnmove", oldIndex, newIndex);\r
+            return true;\r
         }\r
+        return false;\r
     }\r
+});\r
 \r
-    return {\r
-        \r
-        fieldId: 'x-history-field',\r
-        \r
-        iframeId: 'x-history-frame',\r
-        \r
-        events:{},\r
 \r
-        \r
-        init: function (onReady, scope) {\r
-            if(ready) {\r
-                Ext.callback(onReady, scope, [this]);\r
-                return;\r
-            }\r
-            if(!Ext.isReady){\r
-                Ext.onReady(function(){\r
-                    Ext.History.init(onReady, scope);\r
-                });\r
-                return;\r
-            }\r
-            hiddenField = Ext.getDom(Ext.History.fieldId);\r
-                       if (Ext.isIE) {\r
-                iframe = Ext.getDom(Ext.History.iframeId);\r
-            }\r
-            this.addEvents('ready', 'change');\r
-            if(onReady){\r
-                this.on('ready', onReady, scope, {single:true});\r
-            }\r
-            startUp();\r
-        },\r
+Ext.grid.GridView.ColumnDragZone = function(grid, hd){\r
+    Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);\r
+    this.proxy.el.addClass('x-grid3-col-dd');\r
+};\r
 \r
-        \r
-        add: function (token, preventDup) {\r
-            if(preventDup !== false){\r
-                if(this.getToken() == token){\r
-                    return true;\r
-                }\r
-            }\r
-            if (Ext.isIE) {\r
-                return updateIFrame(token);\r
-            } else {\r
-                top.location.hash = token;\r
-                return true;\r
-            }\r
-        },\r
+Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {\r
+    handleMouseDown : function(e){\r
 \r
-        \r
-        back: function(){\r
-            history.go(-1);\r
-        },\r
+    },\r
 \r
-        \r
-        forward: function(){\r
-            history.go(1);\r
-        },\r
+    callHandleMouseDown : function(e){\r
+        Ext.grid.GridView.ColumnDragZone.superclass.handleMouseDown.call(this, e);\r
+    }\r
+});// private
+// This is a support class used internally by the Grid components
+Ext.grid.SplitDragZone = function(grid, hd, hd2){
+    this.grid = grid;
+    this.view = grid.getView();
+    this.proxy = this.view.resizeProxy;
+    Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
+        "gridSplitters" + this.grid.getGridEl().id, {
+        dragElId : Ext.id(this.proxy.dom), resizeFrame:false
+    });
+    this.setHandleElId(Ext.id(hd));
+    this.setOuterHandleElId(Ext.id(hd2));
+    this.scroll = false;
+};
+Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
+    fly: Ext.Element.fly,
+
+    b4StartDrag : function(x, y){
+        this.view.headersDisabled = true;
+        this.proxy.setHeight(this.view.mainWrap.getHeight());
+        var w = this.cm.getColumnWidth(this.cellIndex);
+        var minw = Math.max(w-this.grid.minColumnWidth, 0);
+        this.resetConstraints();
+        this.setXConstraint(minw, 1000);
+        this.setYConstraint(0, 0);
+        this.minX = x - minw;
+        this.maxX = x + 1000;
+        this.startPos = x;
+        Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
+    },
+
+
+    handleMouseDown : function(e){
+        var ev = Ext.EventObject.setEvent(e);
+        var t = this.fly(ev.getTarget());
+        if(t.hasClass("x-grid-split")){
+            this.cellIndex = this.view.getCellIndex(t.dom);
+            this.split = t.dom;
+            this.cm = this.grid.colModel;
+            if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
+                Ext.grid.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
+            }
+        }
+    },
+
+    endDrag : function(e){
+        this.view.headersDisabled = false;
+        var endX = Math.max(this.minX, Ext.lib.Event.getPageX(e));
+        var diff = endX - this.startPos;
+        this.view.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
+    },
+
+    autoOffset : function(){
+        this.setDelta(0,0);
+    }
+});/**
+ * @class Ext.grid.GridDragZone
+ * @extends Ext.dd.DragZone
+ * <p>A customized implementation of a {@link Ext.dd.DragZone DragZone} which provides default implementations of two of the
+ * template methods of DragZone to enable dragging of the selected rows of a GridPanel.</p>
+ * <p>A cooperating {@link Ext.dd.DropZone DropZone} must be created who's template method implementations of
+ * {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver},
+ * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop}</p> are able
+ * to process the {@link #getDragData data} which is provided.
+ */
+Ext.grid.GridDragZone = function(grid, config){
+    this.view = grid.getView();
+    Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
+    this.scroll = false;
+    this.grid = grid;
+    this.ddel = document.createElement('div');
+    this.ddel.className = 'x-grid-dd-wrap';
+};
+
+Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
+    ddGroup : "GridDD",
+
+    /**
+     * <p>The provided implementation of the getDragData method which collects the data to be dragged from the GridPanel on mousedown.</p>
+     * <p>This data is available for processing in the {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver},
+     * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop} methods of a cooperating {@link Ext.dd.DropZone DropZone}.</p>
+     * <p>The data object contains the following properties:<ul>
+     * <li><b>grid</b> : Ext.Grid.GridPanel<div class="sub-desc">The GridPanel from which the data is being dragged.</div></li>
+     * <li><b>ddel</b> : htmlElement<div class="sub-desc">An htmlElement which provides the "picture" of the data being dragged.</div></li>
+     * <li><b>rowIndex</b> : Number<div class="sub-desc">The index of the row which receieved the mousedown gesture which triggered the drag.</div></li>
+     * <li><b>selections</b> : Array<div class="sub-desc">An Array of the selected Records which are being dragged from the GridPanel.</div></li>
+     * </ul></p>
+     */
+    getDragData : function(e){
+        var t = Ext.lib.Event.getTarget(e);
+        var rowIndex = this.view.findRowIndex(t);
+        if(rowIndex !== false){
+            var sm = this.grid.selModel;
+            if(!sm.isSelected(rowIndex) || e.hasModifier()){
+                sm.handleMouseDown(this.grid, rowIndex, e);
+            }
+            return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};
+        }
+        return false;
+    },
+
+    /**
+     * <p>The provided implementation of the onInitDrag method. Sets the <tt>innerHTML</tt> of the drag proxy which provides the "picture"
+     * of the data being dragged.</p>
+     * <p>The <tt>innerHTML</tt> data is found by calling the owning GridPanel's {@link Ext.grid.GridPanel#getDragDropText getDragDropText}.</p>
+     */
+    onInitDrag : function(e){
+        var data = this.dragData;
+        this.ddel.innerHTML = this.grid.getDragDropText();
+        this.proxy.update(this.ddel);
+        // fire start drag?
+    },
+
+    /**
+     * An empty immplementation. Implement this to provide behaviour after a repair of an invalid drop. An implementation might highlight
+     * the selected rows to show that they have not been dragged.
+     */
+    afterRepair : function(){
+        this.dragging = false;
+    },
+
+    /**
+     * <p>An empty implementation. Implement this to provide coordinates for the drag proxy to slide back to after an invalid drop.</p>
+     * <p>Called before a repair of an invalid drop to get the XY to animate to.</p>
+     * @param {EventObject} e The mouse up event
+     * @return {Array} The xy location (e.g. [100, 200])
+     */
+    getRepairXY : function(e, data){
+        return false;
+    },
+
+    onEndDrag : function(data, e){
+        // fire end drag?
+    },
+
+    onValidDrop : function(dd, e, id){
+        // fire drag drop?
+        this.hideProxy();
+    },
+
+    beforeInvalidDrop : function(e, id){
+
+    }
+});
+/**
+ * @class Ext.grid.ColumnModel
+ * @extends Ext.util.Observable
+ * <p>After the data has been read into the client side cache (<b>{@link Ext.data.Store Store}</b>),
+ * the ColumnModel is used to configure how and what parts of that data will be displayed in the
+ * vertical slices (columns) of the grid. The Ext.grid.ColumnModel Class is the default implementation
+ * of a ColumnModel used by implentations of {@link Ext.grid.GridPanel GridPanel}.</p>
+ * <p>Data is mapped into the store's records and then indexed into the ColumnModel using the
+ * <tt>{@link Ext.grid.Column#dataIndex dataIndex}</tt>:</p>
+ * <pre><code>
+{data source} == mapping ==> {data store} == <b><tt>{@link Ext.grid.Column#dataIndex dataIndex}</tt></b> ==> {ColumnModel}
+ * </code></pre>
+ * <p>Each {@link Ext.grid.Column Column} in the grid's ColumnModel is configured with a
+ * <tt>{@link Ext.grid.Column#dataIndex dataIndex}</tt> to specify how the data within
+ * each record in the store is indexed into the ColumnModel.</p>
+ * <p>There are two ways to initialize the ColumnModel class:</p>
+ * <p><u>Initialization Method 1: an Array</u></p>
+<pre><code>
+ var colModel = new Ext.grid.ColumnModel([
+    { header: "Ticker", width: 60, sortable: true},
+    { header: "Company Name", width: 150, sortable: true, id: 'company'},
+    { header: "Market Cap.", width: 100, sortable: true},
+    { header: "$ Sales", width: 100, sortable: true, renderer: money},
+    { header: "Employees", width: 100, sortable: true, resizable: false}
+ ]);
+ </code></pre>
+ * <p>The ColumnModel may be initialized with an Array of {@link Ext.grid.Column} column configuration
+ * objects to define the initial layout / display of the columns in the Grid. The order of each
+ * {@link Ext.grid.Column} column configuration object within the specified Array defines the initial
+ * order of the column display.  A Column's display may be initially hidden using the
+ * <tt>{@link Ext.grid.Column#hidden hidden}</tt></b> config property (and then shown using the column
+ * header menu).  Field's that are not included in the ColumnModel will not be displayable at all.</p>
+ * <p>How each column in the grid correlates (maps) to the {@link Ext.data.Record} field in the
+ * {@link Ext.data.Store Store} the column draws its data from is configured through the
+ * <b><tt>{@link Ext.grid.Column#dataIndex dataIndex}</tt></b>.  If the
+ * <b><tt>{@link Ext.grid.Column#dataIndex dataIndex}</tt></b> is not explicitly defined (as shown in the
+ * example above) it will use the column configuration's index in the Array as the index.</p>
+ * <p>See <b><tt>{@link Ext.grid.Column}</tt></b> for additional configuration options for each column.</p>
+ * <p><u>Initialization Method 2: an Object</u></p>
+ * <p>In order to use configuration options from <tt>Ext.grid.ColumnModel</tt>, an Object may be used to
+ * initialize the ColumnModel.  The column configuration Array will be specified in the <tt><b>{@link #columns}</b></tt>
+ * config property. The <tt><b>{@link #defaults}</b></tt> config property can be used to apply defaults
+ * for all columns, e.g.:</p><pre><code>
+ var colModel = new Ext.grid.ColumnModel({
+    columns: [
+        { header: "Ticker", width: 60, menuDisabled: false},
+        { header: "Company Name", width: 150, id: 'company'},
+        { header: "Market Cap."},
+        { header: "$ Sales", renderer: money},
+        { header: "Employees", resizable: false}
+    ],
+    defaults: {
+        sortable: true,
+        menuDisabled: true,
+        width: 100
+    },
+    listeners: {
+        {@link #hiddenchange}: function(cm, colIndex, hidden) {
+            saveConfig(colIndex, hidden);
+        }
+    }
+});
+ </code></pre>
+ * <p>In both examples above, the ability to apply a CSS class to all cells in a column (including the
+ * header) is demonstrated through the use of the <b><tt>{@link Ext.grid.Column#id id}</tt></b> config
+ * option. This column could be styled by including the following css:</p><pre><code>
+ //add this css *after* the core css is loaded
+.x-grid3-td-company {
+    color: red; // entire column will have red font
+}
+// modify the header row only, adding an icon to the column header
+.x-grid3-hd-company {
+    background: transparent
+        url(../../resources/images/icons/silk/building.png)
+        no-repeat 3px 3px ! important;
+        padding-left:20px;
+}
+ </code></pre>
+ * Note that the "Company Name" column could be specified as the
+ * <b><tt>{@link Ext.grid.GridPanel}.{@link Ext.grid.GridPanel#autoExpandColumn autoExpandColumn}</tt></b>.
+ * @constructor
+ * @param {Mixed} config Specify either an Array of {@link Ext.grid.Column} configuration objects or specify
+ * a configuration Object (see introductory section discussion utilizing Initialization Method 2 above).
+ */
+Ext.grid.ColumnModel = function(config){
+    /**
+     * An Array of {@link Ext.grid.Column Column definition} objects representing the configuration
+     * of this ColumnModel.  See {@link Ext.grid.Column} for the configuration properties that may
+     * be specified.
+     * @property config
+     * @type Array
+     */
+    if(config.columns){
+        Ext.apply(this, config);
+        this.setConfig(config.columns, true);
+    }else{
+        this.setConfig(config, true);
+    }
+    this.addEvents(
+        /**
+         * @event widthchange
+         * Fires when the width of a column is programmaticially changed using
+         * <code>{@link #setColumnWidth}</code>.
+         * Note internal resizing suppresses the event from firing. See also
+         * {@link Ext.grid.GridPanel}.<code>{@link #columnresize}</code>.
+         * @param {ColumnModel} this
+         * @param {Number} columnIndex The column index
+         * @param {Number} newWidth The new width
+         */
+        "widthchange",
+        /**
+         * @event headerchange
+         * Fires when the text of a header changes.
+         * @param {ColumnModel} this
+         * @param {Number} columnIndex The column index
+         * @param {String} newText The new header text
+         */
+        "headerchange",
+        /**
+         * @event hiddenchange
+         * Fires when a column is hidden or "unhidden".
+         * @param {ColumnModel} this
+         * @param {Number} columnIndex The column index
+         * @param {Boolean} hidden true if hidden, false otherwise
+         */
+        "hiddenchange",
+        /**
+         * @event columnmoved
+         * Fires when a column is moved.
+         * @param {ColumnModel} this
+         * @param {Number} oldIndex
+         * @param {Number} newIndex
+         */
+        "columnmoved",
+        /**
+         * @event configchange
+         * Fires when the configuration is changed
+         * @param {ColumnModel} this
+         */
+        "configchange"
+    );
+    Ext.grid.ColumnModel.superclass.constructor.call(this);
+};
+Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
+    /**
+     * @cfg {Number} defaultWidth (optional) The width of columns which have no <tt>{@link #width}</tt>
+     * specified (defaults to <tt>100</tt>).  This property shall preferably be configured through the
+     * <tt><b>{@link #defaults}</b></tt> config property.
+     */
+    defaultWidth: 100,
+    /**
+     * @cfg {Boolean} defaultSortable (optional) Default sortable of columns which have no
+     * sortable specified (defaults to <tt>false</tt>).  This property shall preferably be configured
+     * through the <tt><b>{@link #defaults}</b></tt> config property.
+     */
+    defaultSortable: false,
+    /**
+     * @cfg {Array} columns An Array of object literals.  The config options defined by
+     * <b>{@link Ext.grid.Column}</b> are the options which may appear in the object literal for each
+     * individual column definition.
+     */
+    /**
+     * @cfg {Object} defaults Object literal which will be used to apply {@link Ext.grid.Column}
+     * configuration options to all <tt><b>{@link #columns}</b></tt>.  Configuration options specified with
+     * individual {@link Ext.grid.Column column} configs will supersede these <tt><b>{@link #defaults}</b></tt>.
+     */
+
+    /**
+     * Returns the id of the column at the specified index.
+     * @param {Number} index The column index
+     * @return {String} the id
+     */
+    getColumnId : function(index){
+        return this.config[index].id;
+    },
+
+    getColumnAt : function(index){
+        return this.config[index];
+    },
+
+    /**
+     * <p>Reconfigures this column model according to the passed Array of column definition objects.
+     * For a description of the individual properties of a column definition object, see the
+     * <a href="#Ext.grid.ColumnModel-configs">Config Options</a>.</p>
+     * <p>Causes the {@link #configchange} event to be fired. A {@link Ext.grid.GridPanel GridPanel}
+     * using this ColumnModel will listen for this event and refresh its UI automatically.</p>
+     * @param {Array} config Array of Column definition objects.
+     * @param {Boolean} initial Specify <tt>true</tt> to bypass cleanup which deletes the <tt>totalWidth</tt>
+     * and destroys existing editors.
+     */
+    setConfig : function(config, initial){
+        var i, c, len;
+        if(!initial){ // cleanup
+            delete this.totalWidth;
+            for(i = 0, len = this.config.length; i < len; i++){
+                c = this.config[i];
+                if(c.editor){
+                    c.editor.destroy();
+                }
+            }
+        }
+
+        // backward compatibility
+        this.defaults = Ext.apply({
+            width: this.defaultWidth,
+            sortable: this.defaultSortable
+        }, this.defaults);
+
+        this.config = config;
+        this.lookup = {};
+        // if no id, create one
+        for(i = 0, len = config.length; i < len; i++){
+            c = Ext.applyIf(config[i], this.defaults);
+            if(!c.isColumn){
+                var cls = Ext.grid.Column.types[c.xtype || 'gridcolumn'];
+                c = new cls(c);
+                config[i] = c;
+            }
+            this.lookup[c.id] = c;
+        }
+        if(!initial){
+            this.fireEvent('configchange', this);
+        }
+    },
+
+    /**
+     * Returns the column for a specified id.
+     * @param {String} id The column id
+     * @return {Object} the column
+     */
+    getColumnById : function(id){
+        return this.lookup[id];
+    },
+
+    /**
+     * Returns the index for a specified column id.
+     * @param {String} id The column id
+     * @return {Number} the index, or -1 if not found
+     */
+    getIndexById : function(id){
+        for(var i = 0, len = this.config.length; i < len; i++){
+            if(this.config[i].id == id){
+                return i;
+            }
+        }
+        return -1;
+    },
+
+    /**
+     * Moves a column from one position to another.
+     * @param {Number} oldIndex The index of the column to move.
+     * @param {Number} newIndex The position at which to reinsert the coolumn.
+     */
+    moveColumn : function(oldIndex, newIndex){
+        var c = this.config[oldIndex];
+        this.config.splice(oldIndex, 1);
+        this.config.splice(newIndex, 0, c);
+        this.dataMap = null;
+        this.fireEvent("columnmoved", this, oldIndex, newIndex);
+    },
+
+    /**
+     * Returns the number of columns.
+     * @param {Boolean} visibleOnly Optional. Pass as true to only include visible columns.
+     * @return {Number}
+     */
+    getColumnCount : function(visibleOnly){
+        if(visibleOnly === true){
+            var c = 0;
+            for(var i = 0, len = this.config.length; i < len; i++){
+                if(!this.isHidden(i)){
+                    c++;
+                }
+            }
+            return c;
+        }
+        return this.config.length;
+    },
+
+    /**
+     * Returns the column configs that return true by the passed function that is called
+     * with (columnConfig, index)
+<pre><code>
+// returns an array of column config objects for all hidden columns
+var columns = grid.getColumnModel().getColumnsBy(function(c){
+  return c.hidden;
+});
+</code></pre>
+     * @param {Function} fn
+     * @param {Object} scope (optional)
+     * @return {Array} result
+     */
+    getColumnsBy : function(fn, scope){
+        var r = [];
+        for(var i = 0, len = this.config.length; i < len; i++){
+            var c = this.config[i];
+            if(fn.call(scope||this, c, i) === true){
+                r[r.length] = c;
+            }
+        }
+        return r;
+    },
+
+    /**
+     * Returns true if the specified column is sortable.
+     * @param {Number} col The column index
+     * @return {Boolean}
+     */
+    isSortable : function(col){
+        return this.config[col].sortable;
+    },
+
+    /**
+     * Returns true if the specified column menu is disabled.
+     * @param {Number} col The column index
+     * @return {Boolean}
+     */
+    isMenuDisabled : function(col){
+        return !!this.config[col].menuDisabled;
+    },
+
+    /**
+     * Returns the rendering (formatting) function defined for the column.
+     * @param {Number} col The column index.
+     * @return {Function} The function used to render the cell. See {@link #setRenderer}.
+     */
+    getRenderer : function(col){
+        if(!this.config[col].renderer){
+            return Ext.grid.ColumnModel.defaultRenderer;
+        }
+        return this.config[col].renderer;
+    },
+
+    /**
+     * Sets the rendering (formatting) function for a column.  See {@link Ext.util.Format} for some
+     * default formatting functions.
+     * @param {Number} col The column index
+     * @param {Function} fn The function to use to process the cell's raw data
+     * to return HTML markup for the grid view. The render function is called with
+     * the following parameters:<ul>
+     * <li><b>value</b> : Object<p class="sub-desc">The data value for the cell.</p></li>
+     * <li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul>
+     * <li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li>
+     * <li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container element <i>within</i> the table cell
+     * (e.g. 'style="color:red;"').</p></li></ul></p></li>
+     * <li><b>record</b> : Ext.data.record<p class="sub-desc">The {@link Ext.data.Record} from which the data was extracted.</p></li>
+     * <li><b>rowIndex</b> : Number<p class="sub-desc">Row index</p></li>
+     * <li><b>colIndex</b> : Number<p class="sub-desc">Column index</p></li>
+     * <li><b>store</b> : Ext.data.Store<p class="sub-desc">The {@link Ext.data.Store} object from which the Record was extracted.</p></li></ul>
+     */
+    setRenderer : function(col, fn){
+        this.config[col].renderer = fn;
+    },
+
+    /**
+     * Returns the width for the specified column.
+     * @param {Number} col The column index
+     * @return {Number}
+     */
+    getColumnWidth : function(col){
+        return this.config[col].width;
+    },
+
+    /**
+     * Sets the width for a column.
+     * @param {Number} col The column index
+     * @param {Number} width The new width
+     * @param {Boolean} suppressEvent True to suppress firing the <code>{@link #widthchange}</code>
+     * event. Defaults to false.
+     */
+    setColumnWidth : function(col, width, suppressEvent){
+        this.config[col].width = width;
+        this.totalWidth = null;
+        if(!suppressEvent){
+             this.fireEvent("widthchange", this, col, width);
+        }
+    },
+
+    /**
+     * Returns the total width of all columns.
+     * @param {Boolean} includeHidden True to include hidden column widths
+     * @return {Number}
+     */
+    getTotalWidth : function(includeHidden){
+        if(!this.totalWidth){
+            this.totalWidth = 0;
+            for(var i = 0, len = this.config.length; i < len; i++){
+                if(includeHidden || !this.isHidden(i)){
+                    this.totalWidth += this.getColumnWidth(i);
+                }
+            }
+        }
+        return this.totalWidth;
+    },
+
+    /**
+     * Returns the header for the specified column.
+     * @param {Number} col The column index
+     * @return {String}
+     */
+    getColumnHeader : function(col){
+        return this.config[col].header;
+    },
+
+    /**
+     * Sets the header for a column.
+     * @param {Number} col The column index
+     * @param {String} header The new header
+     */
+    setColumnHeader : function(col, header){
+        this.config[col].header = header;
+        this.fireEvent("headerchange", this, col, header);
+    },
+
+    /**
+     * Returns the tooltip for the specified column.
+     * @param {Number} col The column index
+     * @return {String}
+     */
+    getColumnTooltip : function(col){
+            return this.config[col].tooltip;
+    },
+    /**
+     * Sets the tooltip for a column.
+     * @param {Number} col The column index
+     * @param {String} tooltip The new tooltip
+     */
+    setColumnTooltip : function(col, tooltip){
+            this.config[col].tooltip = tooltip;
+    },
+
+    /**
+     * Returns the dataIndex for the specified column.
+<pre><code>
+// Get field name for the column
+var fieldName = grid.getColumnModel().getDataIndex(columnIndex);
+</code></pre>
+     * @param {Number} col The column index
+     * @return {String} The column's dataIndex
+     */
+    getDataIndex : function(col){
+        return this.config[col].dataIndex;
+    },
+
+    /**
+     * Sets the dataIndex for a column.
+     * @param {Number} col The column index
+     * @param {String} dataIndex The new dataIndex
+     */
+    setDataIndex : function(col, dataIndex){
+        this.config[col].dataIndex = dataIndex;
+    },
+
+    /**
+     * Finds the index of the first matching column for the given dataIndex.
+     * @param {String} col The dataIndex to find
+     * @return {Number} The column index, or -1 if no match was found
+     */
+    findColumnIndex : function(dataIndex){
+        var c = this.config;
+        for(var i = 0, len = c.length; i < len; i++){
+            if(c[i].dataIndex == dataIndex){
+                return i;
+            }
+        }
+        return -1;
+    },
+
+    /**
+     * Returns true if the cell is editable.
+<pre><code>
+var store = new Ext.data.Store({...});
+var colModel = new Ext.grid.ColumnModel({
+  columns: [...],
+  isCellEditable: function(col, row) {
+    var record = store.getAt(row);
+    if (record.get('readonly')) { // replace with your condition
+      return false;
+    }
+    return Ext.grid.ColumnModel.prototype.isCellEditable.call(this, col, row);
+  }
+});
+var grid = new Ext.grid.GridPanel({
+  store: store,
+  colModel: colModel,
+  ...
+});
+</code></pre>
+     * @param {Number} colIndex The column index
+     * @param {Number} rowIndex The row index
+     * @return {Boolean}
+     */
+    isCellEditable : function(colIndex, rowIndex){
+        return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
+    },
+
+    /**
+     * Returns the editor defined for the cell/column.
+     * @param {Number} colIndex The column index
+     * @param {Number} rowIndex The row index
+     * @return {Ext.Editor} The {@link Ext.Editor Editor} that was created to wrap
+     * the {@link Ext.form.Field Field} used to edit the cell.
+     */
+    getCellEditor : function(colIndex, rowIndex){
+        return this.config[colIndex].getCellEditor(rowIndex);
+    },
+
+    /**
+     * Sets if a column is editable.
+     * @param {Number} col The column index
+     * @param {Boolean} editable True if the column is editable
+     */
+    setEditable : function(col, editable){
+        this.config[col].editable = editable;
+    },
+
+
+    /**
+     * Returns true if the column is hidden.
+     * @param {Number} colIndex The column index
+     * @return {Boolean}
+     */
+    isHidden : function(colIndex){
+        return this.config[colIndex].hidden;
+    },
+
+
+    /**
+     * Returns true if the column width cannot be changed
+     */
+    isFixed : function(colIndex){
+        return this.config[colIndex].fixed;
+    },
+
+    /**
+     * Returns true if the column can be resized
+     * @return {Boolean}
+     */
+    isResizable : function(colIndex){
+        return colIndex >= 0 && this.config[colIndex].resizable !== false && this.config[colIndex].fixed !== true;
+    },
+    /**
+     * Sets if a column is hidden.
+<pre><code>
+myGrid.getColumnModel().setHidden(0, true); // hide column 0 (0 = the first column).
+</code></pre>
+     * @param {Number} colIndex The column index
+     * @param {Boolean} hidden True if the column is hidden
+     */
+    setHidden : function(colIndex, hidden){
+        var c = this.config[colIndex];
+        if(c.hidden !== hidden){
+            c.hidden = hidden;
+            this.totalWidth = null;
+            this.fireEvent("hiddenchange", this, colIndex, hidden);
+        }
+    },
+
+    /**
+     * Sets the editor for a column and destroys the prior editor.
+     * @param {Number} col The column index
+     * @param {Object} editor The editor object
+     */
+    setEditor : function(col, editor){
+        Ext.destroy(this.config[col].editor);
+        this.config[col].editor = editor;
+    },
+
+    /**
+     * Destroys this column model by purging any event listeners, and removing any editors.
+     */
+    destroy : function(){
+        for(var i = 0, c = this.config, len = c.length; i < len; i++){
+            Ext.destroy(c[i].editor);
+        }
+        this.purgeListeners();
+    }
+});
+
+// private
+Ext.grid.ColumnModel.defaultRenderer = function(value){
+    if(typeof value == "string" && value.length < 1){
+        return "&#160;";
+    }
+    return value;
+};/**\r
+ * @class Ext.grid.AbstractSelectionModel\r
+ * @extends Ext.util.Observable\r
+ * Abstract base class for grid SelectionModels.  It provides the interface that should be\r
+ * implemented by descendant classes.  This class should not be directly instantiated.\r
+ * @constructor\r
+ */\r
+Ext.grid.AbstractSelectionModel = function(){\r
+    this.locked = false;\r
+    Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);\r
+};\r
+\r
+Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable,  {\r
+    /**\r
+     * The GridPanel for which this SelectionModel is handling selection. Read-only.\r
+     * @type Object\r
+     * @property grid\r
+     */\r
+\r
+    /** @ignore Called by the grid automatically. Do not call directly. */\r
+    init : function(grid){\r
+        this.grid = grid;\r
+        this.initEvents();\r
+    },\r
 \r
-        \r
-        getToken: function() {\r
-            return ready ? currentToken : getHash();\r
-        }\r
-    };\r
-})();\r
-Ext.apply(Ext.History, new Ext.util.Observable());\r
-Ext.debug = {};\r
+    /**\r
+     * Locks the selections.\r
+     */\r
+    lock : function(){\r
+        this.locked = true;\r
+    },\r
 \r
-(function(){\r
+    /**\r
+     * Unlocks the selections.\r
+     */\r
+    unlock : function(){\r
+        this.locked = false;\r
+    },\r
 \r
-var cp;\r
+    /**\r
+     * Returns true if the selections are locked.\r
+     * @return {Boolean}\r
+     */\r
+    isLocked : function(){\r
+        return this.locked;\r
+    },\r
+    \r
+    destroy: function(){\r
+        this.purgeListeners();\r
+    }\r
+});/**
+ * @class Ext.grid.RowSelectionModel
+ * @extends Ext.grid.AbstractSelectionModel
+ * The default SelectionModel used by {@link Ext.grid.GridPanel}.
+ * It supports multiple selections and keyboard selection/navigation. The objects stored
+ * as selections and returned by {@link #getSelected}, and {@link #getSelections} are
+ * the {@link Ext.data.Record Record}s which provide the data for the selected rows.
+ * @constructor
+ * @param {Object} config
+ */
+Ext.grid.RowSelectionModel = function(config){
+    Ext.apply(this, config);
+    this.selections = new Ext.util.MixedCollection(false, function(o){
+        return o.id;
+    });
+
+    this.last = false;
+    this.lastActive = false;
+
+    this.addEvents(
+        /**
+         * @event selectionchange
+         * Fires when the selection changes
+         * @param {SelectionModel} this
+         */
+        "selectionchange",
+        /**
+         * @event beforerowselect
+         * Fires before a row is selected, return false to cancel the selection.
+         * @param {SelectionModel} this
+         * @param {Number} rowIndex The index to be selected
+         * @param {Boolean} keepExisting False if other selections will be cleared
+         * @param {Record} record The record to be selected
+         */
+        "beforerowselect",
+        /**
+         * @event rowselect
+         * Fires when a row is selected.
+         * @param {SelectionModel} this
+         * @param {Number} rowIndex The selected index
+         * @param {Ext.data.Record} r The selected record
+         */
+        "rowselect",
+        /**
+         * @event rowdeselect
+         * Fires when a row is deselected.  To prevent deselection
+         * {@link Ext.grid.AbstractSelectionModel#lock lock the selections}. 
+         * @param {SelectionModel} this
+         * @param {Number} rowIndex
+         * @param {Record} record
+         */
+        "rowdeselect"
+    );
+
+    Ext.grid.RowSelectionModel.superclass.constructor.call(this);
+};
+
+Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
+    /**
+     * @cfg {Boolean} singleSelect
+     * <tt>true</tt> to allow selection of only one row at a time (defaults to <tt>false</tt>
+     * allowing multiple selections)
+     */
+    singleSelect : false,
+
+    /**
+     * @cfg {Boolean} moveEditorOnEnter
+     * <tt>false</tt> to turn off moving the editor to the next row down when the enter key is pressed
+     * or the next row up when shift + enter keys are pressed.
+     */
+    // private
+    initEvents : function(){
+
+        if(!this.grid.enableDragDrop && !this.grid.enableDrag){
+            this.grid.on("rowmousedown", this.handleMouseDown, this);
+        }else{ // allow click to work like normal
+            this.grid.on("rowclick", function(grid, rowIndex, e) {
+                if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
+                    this.selectRow(rowIndex, false);
+                    grid.view.focusRow(rowIndex);
+                }
+            }, this);
+        }
+
+        this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {
+            "up" : function(e){
+                if(!e.shiftKey || this.singleSelect){
+                    this.selectPrevious(false);
+                }else if(this.last !== false && this.lastActive !== false){
+                    var last = this.last;
+                    this.selectRange(this.last,  this.lastActive-1);
+                    this.grid.getView().focusRow(this.lastActive);
+                    if(last !== false){
+                        this.last = last;
+                    }
+                }else{
+                    this.selectFirstRow();
+                }
+            },
+            "down" : function(e){
+                if(!e.shiftKey || this.singleSelect){
+                    this.selectNext(false);
+                }else if(this.last !== false && this.lastActive !== false){
+                    var last = this.last;
+                    this.selectRange(this.last,  this.lastActive+1);
+                    this.grid.getView().focusRow(this.lastActive);
+                    if(last !== false){
+                        this.last = last;
+                    }
+                }else{
+                    this.selectFirstRow();
+                }
+            },
+            scope: this
+        });
+
+        var view = this.grid.view;
+        view.on("refresh", this.onRefresh, this);
+        view.on("rowupdated", this.onRowUpdated, this);
+        view.on("rowremoved", this.onRemove, this);
+    },
+
+    // private
+    onRefresh : function(){
+        var ds = this.grid.store, index;
+        var s = this.getSelections();
+        this.clearSelections(true);
+        for(var i = 0, len = s.length; i < len; i++){
+            var r = s[i];
+            if((index = ds.indexOfId(r.id)) != -1){
+                this.selectRow(index, true);
+            }
+        }
+        if(s.length != this.selections.getCount()){
+            this.fireEvent("selectionchange", this);
+        }
+    },
+
+    // private
+    onRemove : function(v, index, r){
+        if(this.selections.remove(r) !== false){
+            this.fireEvent('selectionchange', this);
+        }
+    },
+
+    // private
+    onRowUpdated : function(v, index, r){
+        if(this.isSelected(r)){
+            v.onRowSelect(index);
+        }
+    },
+
+    /**
+     * Select records.
+     * @param {Array} records The records to select
+     * @param {Boolean} keepExisting (optional) <tt>true</tt> to keep existing selections
+     */
+    selectRecords : function(records, keepExisting){
+        if(!keepExisting){
+            this.clearSelections();
+        }
+        var ds = this.grid.store;
+        for(var i = 0, len = records.length; i < len; i++){
+            this.selectRow(ds.indexOf(records[i]), true);
+        }
+    },
+
+    /**
+     * Gets the number of selected rows.
+     * @return {Number}
+     */
+    getCount : function(){
+        return this.selections.length;
+    },
+
+    /**
+     * Selects the first row in the grid.
+     */
+    selectFirstRow : function(){
+        this.selectRow(0);
+    },
+
+    /**
+     * Select the last row.
+     * @param {Boolean} keepExisting (optional) <tt>true</tt> to keep existing selections
+     */
+    selectLastRow : function(keepExisting){
+        this.selectRow(this.grid.store.getCount() - 1, keepExisting);
+    },
+
+    /**
+     * Selects the row immediately following the last selected row.
+     * @param {Boolean} keepExisting (optional) <tt>true</tt> to keep existing selections
+     * @return {Boolean} <tt>true</tt> if there is a next row, else <tt>false</tt>
+     */
+    selectNext : function(keepExisting){
+        if(this.hasNext()){
+            this.selectRow(this.last+1, keepExisting);
+            this.grid.getView().focusRow(this.last);
+            return true;
+        }
+        return false;
+    },
+
+    /**
+     * Selects the row that precedes the last selected row.
+     * @param {Boolean} keepExisting (optional) <tt>true</tt> to keep existing selections
+     * @return {Boolean} <tt>true</tt> if there is a previous row, else <tt>false</tt>
+     */
+    selectPrevious : function(keepExisting){
+        if(this.hasPrevious()){
+            this.selectRow(this.last-1, keepExisting);
+            this.grid.getView().focusRow(this.last);
+            return true;
+        }
+        return false;
+    },
+
+    /**
+     * Returns true if there is a next record to select
+     * @return {Boolean}
+     */
+    hasNext : function(){
+        return this.last !== false && (this.last+1) < this.grid.store.getCount();
+    },
+
+    /**
+     * Returns true if there is a previous record to select
+     * @return {Boolean}
+     */
+    hasPrevious : function(){
+        return !!this.last;
+    },
+
+
+    /**
+     * Returns the selected records
+     * @return {Array} Array of selected records
+     */
+    getSelections : function(){
+        return [].concat(this.selections.items);
+    },
+
+    /**
+     * Returns the first selected record.
+     * @return {Record}
+     */
+    getSelected : function(){
+        return this.selections.itemAt(0);
+    },
+
+    /**
+     * Calls the passed function with each selection. If the function returns
+     * <tt>false</tt>, iteration is stopped and this function returns
+     * <tt>false</tt>. Otherwise it returns <tt>true</tt>.
+     * @param {Function} fn
+     * @param {Object} scope (optional)
+     * @return {Boolean} true if all selections were iterated
+     */
+    each : function(fn, scope){
+        var s = this.getSelections();
+        for(var i = 0, len = s.length; i < len; i++){
+            if(fn.call(scope || this, s[i], i) === false){
+                return false;
+            }
+        }
+        return true;
+    },
+
+    /**
+     * Clears all selections if the selection model
+     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}.
+     * @param {Boolean} fast (optional) <tt>true</tt> to bypass the
+     * conditional checks and events described in {@link #deselectRow}.
+     */
+    clearSelections : function(fast){
+        if(this.isLocked()){
+            return;
+        }
+        if(fast !== true){
+            var ds = this.grid.store;
+            var s = this.selections;
+            s.each(function(r){
+                this.deselectRow(ds.indexOfId(r.id));
+            }, this);
+            s.clear();
+        }else{
+            this.selections.clear();
+        }
+        this.last = false;
+    },
+
+
+    /**
+     * Selects all rows if the selection model
+     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}. 
+     */
+    selectAll : function(){
+        if(this.isLocked()){
+            return;
+        }
+        this.selections.clear();
+        for(var i = 0, len = this.grid.store.getCount(); i < len; i++){
+            this.selectRow(i, true);
+        }
+    },
+
+    /**
+     * Returns <tt>true</tt> if there is a selection.
+     * @return {Boolean}
+     */
+    hasSelection : function(){
+        return this.selections.length > 0;
+    },
+
+    /**
+     * Returns <tt>true</tt> if the specified row is selected.
+     * @param {Number/Record} index The record or index of the record to check
+     * @return {Boolean}
+     */
+    isSelected : function(index){
+        var r = typeof index == "number" ? this.grid.store.getAt(index) : index;
+        return (r && this.selections.key(r.id) ? true : false);
+    },
+
+    /**
+     * Returns <tt>true</tt> if the specified record id is selected.
+     * @param {String} id The id of record to check
+     * @return {Boolean}
+     */
+    isIdSelected : function(id){
+        return (this.selections.key(id) ? true : false);
+    },
+
+    // private
+    handleMouseDown : function(g, rowIndex, e){
+        if(e.button !== 0 || this.isLocked()){
+            return;
+        }
+        var view = this.grid.getView();
+        if(e.shiftKey && !this.singleSelect && this.last !== false){
+            var last = this.last;
+            this.selectRange(last, rowIndex, e.ctrlKey);
+            this.last = last; // reset the last
+            view.focusRow(rowIndex);
+        }else{
+            var isSelected = this.isSelected(rowIndex);
+            if(e.ctrlKey && isSelected){
+                this.deselectRow(rowIndex);
+            }else if(!isSelected || this.getCount() > 1){
+                this.selectRow(rowIndex, e.ctrlKey || e.shiftKey);
+                view.focusRow(rowIndex);
+            }
+        }
+    },
+
+    /**
+     * Selects multiple rows.
+     * @param {Array} rows Array of the indexes of the row to select
+     * @param {Boolean} keepExisting (optional) <tt>true</tt> to keep
+     * existing selections (defaults to <tt>false</tt>)
+     */
+    selectRows : function(rows, keepExisting){
+        if(!keepExisting){
+            this.clearSelections();
+        }
+        for(var i = 0, len = rows.length; i < len; i++){
+            this.selectRow(rows[i], true);
+        }
+    },
+
+    /**
+     * Selects a range of rows if the selection model
+     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}.
+     * All rows in between startRow and endRow are also selected.
+     * @param {Number} startRow The index of the first row in the range
+     * @param {Number} endRow The index of the last row in the range
+     * @param {Boolean} keepExisting (optional) True to retain existing selections
+     */
+    selectRange : function(startRow, endRow, keepExisting){
+        var i;
+        if(this.isLocked()){
+            return;
+        }
+        if(!keepExisting){
+            this.clearSelections();
+        }
+        if(startRow <= endRow){
+            for(i = startRow; i <= endRow; i++){
+                this.selectRow(i, true);
+            }
+        }else{
+            for(i = startRow; i >= endRow; i--){
+                this.selectRow(i, true);
+            }
+        }
+    },
+
+    /**
+     * Deselects a range of rows if the selection model
+     * {@link Ext.grid.AbstractSelectionModel#isLocked is not locked}.  
+     * All rows in between startRow and endRow are also deselected.
+     * @param {Number} startRow The index of the first row in the range
+     * @param {Number} endRow The index of the last row in the range
+     */
+    deselectRange : function(startRow, endRow, preventViewNotify){
+        if(this.isLocked()){
+            return;
+        }
+        for(var i = startRow; i <= endRow; i++){
+            this.deselectRow(i, preventViewNotify);
+        }
+    },
+
+    /**
+     * Selects a row.  Before selecting a row, checks if the selection model
+     * {@link Ext.grid.AbstractSelectionModel#isLocked is locked} and fires the
+     * {@link #beforerowselect} event.  If these checks are satisfied the row
+     * will be selected and followed up by  firing the {@link #rowselect} and
+     * {@link #selectionchange} events.
+     * @param {Number} row The index of the row to select
+     * @param {Boolean} keepExisting (optional) <tt>true</tt> to keep existing selections
+     * @param {Boolean} preventViewNotify (optional) Specify <tt>true</tt> to
+     * prevent notifying the view (disables updating the selected appearance)
+     */
+    selectRow : function(index, keepExisting, preventViewNotify){
+        if(this.isLocked() || (index < 0 || index >= this.grid.store.getCount()) || (keepExisting && this.isSelected(index))){
+            return;
+        }
+        var r = this.grid.store.getAt(index);
+        if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){
+            if(!keepExisting || this.singleSelect){
+                this.clearSelections();
+            }
+            this.selections.add(r);
+            this.last = this.lastActive = index;
+            if(!preventViewNotify){
+                this.grid.getView().onRowSelect(index);
+            }
+            this.fireEvent("rowselect", this, index, r);
+            this.fireEvent("selectionchange", this);
+        }
+    },
+
+    /**
+     * Deselects a row.  Before deselecting a row, checks if the selection model
+     * {@link Ext.grid.AbstractSelectionModel#isLocked is locked}.
+     * If this check is satisfied the row will be deselected and followed up by
+     * firing the {@link #rowdeselect} and {@link #selectionchange} events.
+     * @param {Number} row The index of the row to deselect
+     * @param {Boolean} preventViewNotify (optional) Specify <tt>true</tt> to
+     * prevent notifying the view (disables updating the selected appearance)
+     */
+    deselectRow : function(index, preventViewNotify){
+        if(this.isLocked()){
+            return;
+        }
+        if(this.last == index){
+            this.last = false;
+        }
+        if(this.lastActive == index){
+            this.lastActive = false;
+        }
+        var r = this.grid.store.getAt(index);
+        if(r){
+            this.selections.remove(r);
+            if(!preventViewNotify){
+                this.grid.getView().onRowDeselect(index);
+            }
+            this.fireEvent("rowdeselect", this, index, r);
+            this.fireEvent("selectionchange", this);
+        }
+    },
+
+    // private
+    restoreLast : function(){
+        if(this._last){
+            this.last = this._last;
+        }
+    },
+
+    // private
+    acceptsNav : function(row, col, cm){
+        return !cm.isHidden(col) && cm.isCellEditable(col, row);
+    },
+
+    // private
+    onEditorKey : function(field, e){
+        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
+        var shift = e.shiftKey;
+        if(k == e.TAB){
+            e.stopEvent();
+            ed.completeEdit();
+            if(shift){
+                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
+            }else{
+                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
+            }
+        }else if(k == e.ENTER){
+            e.stopEvent();
+            ed.completeEdit();
+            if(this.moveEditorOnEnter !== false){
+                if(shift){
+                    newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this);
+                }else{
+                    newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this);
+                }
+            }
+        }else if(k == e.ESC){
+            ed.cancelEdit();
+        }
+        if(newCell){
+            g.startEditing(newCell[0], newCell[1]);
+        }
+    },
+    
+    destroy: function(){
+        if(this.rowNav){
+            this.rowNav.disable();
+            this.rowNav = null;
+        }
+        Ext.grid.RowSelectionModel.superclass.destroy.call(this);
+    }
+});/**\r
+ * @class Ext.grid.Column\r
+ * <p>This class encapsulates column configuration data to be used in the initialization of a\r
+ * {@link Ext.grid.ColumnModel ColumnModel}.</p>\r
+ * <p>While subclasses are provided to render data in different ways, this class renders a passed\r
+ * data field unchanged and is usually used for textual columns.</p>\r
+ */\r
+Ext.grid.Column = function(config){\r
+    Ext.apply(this, config);\r
 \r
-function createConsole(){\r
+    if(typeof this.renderer == 'string'){\r
+        this.renderer = Ext.util.Format[this.renderer];\r
+    } else if(Ext.isObject(this.renderer)){\r
+        this.scope = this.renderer.scope;\r
+        this.renderer = this.renderer.fn;\r
+    }\r
+    this.renderer = this.renderer.createDelegate(this.scope || config);\r
 \r
-    var scriptPanel = new Ext.debug.ScriptsPanel();\r
-    var logView = new Ext.debug.LogPanel();\r
-    var tree = new Ext.debug.DomTree();\r
+    if(this.id === undefined){\r
+        this.id = ++Ext.grid.Column.AUTO_ID;\r
+    }\r
+    if(this.editor){\r
+        this.editor = Ext.create(this.editor, 'textfield');\r
+    }\r
+};\r
 \r
-    var tabs = new Ext.TabPanel({\r
-        activeTab: 0,\r
-        border: false,\r
-        tabPosition: 'bottom',\r
-        items: [{\r
-            title: 'Debug Console',\r
-            layout:'border',\r
-            items: [logView, scriptPanel]\r
-        },{\r
-            title: 'DOM Inspector',\r
-            layout:'border',\r
-            items: [tree]\r
-        }]\r
-    });\r
+Ext.grid.Column.AUTO_ID = 0;\r
+\r
+Ext.grid.Column.prototype = {\r
+    /**\r
+     * @cfg {Boolean} editable Optional. Defaults to <tt>true</tt>, enabling the configured\r
+     * <tt>{@link #editor}</tt>.  Set to <tt>false</tt> to initially disable editing on this column.\r
+     * The initial configuration may be dynamically altered using\r
+     * {@link Ext.grid.ColumnModel}.{@link Ext.grid.ColumnModel#setEditable setEditable()}.\r
+     */\r
+    /**\r
+     * @cfg {String} id Optional. A name which identifies this column (defaults to the column's initial\r
+     * ordinal position.) The <tt>id</tt> is used to create a CSS <b>class</b> name which is applied to all\r
+     * table cells (including headers) in that column (in this context the <tt>id</tt> does not need to be\r
+     * unique). The class name takes the form of <pre>x-grid3-td-<b>id</b></pre>\r
+     * Header cells will also receive this class name, but will also have the class <pre>x-grid3-hd</pre>\r
+     * So, to target header cells, use CSS selectors such as:<pre>.x-grid3-hd-row .x-grid3-td-<b>id</b></pre>\r
+     * The {@link Ext.grid.GridPanel#autoExpandColumn} grid config option references the column via this\r
+     * unique identifier.\r
+     */\r
+    /**\r
+     * @cfg {String} header Optional. The header text to be used as innerHTML\r
+     * (html tags are accepted) to display in the Grid view.  <b>Note</b>: to\r
+     * have a clickable header with no text displayed use <tt>'&#160;'</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} groupable Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option\r
+     * may be used to disable the header menu item to group by the column selected. Defaults to <tt>true</tt>,\r
+     * which enables the header menu group option.  Set to <tt>false</tt> to disable (but still show) the\r
+     * group option in the header menu for the column. See also <code>{@link #groupName}</code>.\r
+     */\r
+    /**\r
+     * @cfg {String} groupName Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option\r
+     * may be used to specify the text with which to prefix the group field value in the group header line.\r
+     * See also {@link #groupRenderer} and\r
+     * {@link Ext.grid.GroupingView}.{@link Ext.grid.GroupingView#showGroupName showGroupName}.\r
+     */\r
+    /**\r
+     * @cfg {Function} groupRenderer <p>Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option\r
+     * may be used to specify the function used to format the grouping field value for display in the group\r
+     * {@link #groupName header}.  If a <tt><b>groupRenderer</b></tt> is not specified, the configured\r
+     * <tt><b>{@link #renderer}</b></tt> will be called; if a <tt><b>{@link #renderer}</b></tt> is also not specified\r
+     * the new value of the group field will be used.</p>\r
+     * <p>The called function (either the <tt><b>groupRenderer</b></tt> or <tt><b>{@link #renderer}</b></tt>) will be\r
+     * passed the following parameters:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b>v</b> : Object<p class="sub-desc">The new value of the group field.</p></li>\r
+     * <li><b>unused</b> : undefined<p class="sub-desc">Unused parameter.</p></li>\r
+     * <li><b>r</b> : Ext.data.Record<p class="sub-desc">The Record providing the data\r
+     * for the row which caused group change.</p></li>\r
+     * <li><b>rowIndex</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li>\r
+     * <li><b>colIndex</b> : Number<p class="sub-desc">The column index of the group field.</p></li>\r
+     * <li><b>ds</b> : Ext.data.Store<p class="sub-desc">The Store which is providing the data Model.</p></li>\r
+     * </ul></div></p>\r
+     * <p>The function should return a string value.</p>\r
+     */\r
+    /**\r
+     * @cfg {String} emptyGroupText Optional. If the grid is being rendered by an {@link Ext.grid.GroupingView}, this option\r
+     * may be used to specify the text to display when there is an empty group value. Defaults to the\r
+     * {@link Ext.grid.GroupingView}.{@link Ext.grid.GroupingView#emptyGroupText emptyGroupText}.\r
+     */\r
+    /**\r
+     * @cfg {String} dataIndex <p><b>Required</b>. The name of the field in the\r
+     * grid's {@link Ext.data.Store}'s {@link Ext.data.Record} definition from\r
+     * which to draw the column's value.</p>\r
+     */\r
+    /**\r
+     * @cfg {Number} width\r
+     * Optional. The initial width in pixels of the column.\r
+     * The width of each column can also be affected if any of the following are configured:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li>{@link Ext.grid.GridPanel}.<tt>{@link Ext.grid.GridPanel#autoExpandColumn autoExpandColumn}</tt></li>\r
+     * <li>{@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#forceFit forceFit}</tt>\r
+     * <div class="sub-desc">\r
+     * <p>By specifying <tt>forceFit:true</tt>, {@link #fixed non-fixed width} columns will be\r
+     * re-proportioned (based on the relative initial widths) to fill the width of the grid so\r
+     * that no horizontal scrollbar is shown.</p>\r
+     * </div></li>\r
+     * <li>{@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#autoFill autoFill}</tt></li>\r
+     * <li>{@link Ext.grid.GridPanel}.<tt>{@link Ext.grid.GridPanel#minColumnWidth minColumnWidth}</tt></li>\r
+     * <br><p><b>Note</b>: when the width of each column is determined, a space on the right side\r
+     * is reserved for the vertical scrollbar.  The\r
+     * {@link Ext.grid.GridView}.<tt>{@link Ext.grid.GridView#scrollOffset scrollOffset}</tt>\r
+     * can be modified to reduce or eliminate the reserved offset.</p>\r
+     */\r
+    /**\r
+     * @cfg {Boolean} sortable Optional. <tt>true</tt> if sorting is to be allowed on this column.\r
+     * Defaults to the value of the {@link #defaultSortable} property.\r
+     * Whether local/remote sorting is used is specified in {@link Ext.data.Store#remoteSort}.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} fixed Optional. <tt>true</tt> if the column width cannot be changed.  Defaults to <tt>false</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} resizable Optional. <tt>false</tt> to disable column resizing. Defaults to <tt>true</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} menuDisabled Optional. <tt>true</tt> to disable the column menu. Defaults to <tt>false</tt>.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} hidden Optional. <tt>true</tt> to hide the column. Defaults to <tt>false</tt>.\r
+     */\r
+    /**\r
+     * @cfg {String} tooltip Optional. A text string to use as the column header's tooltip.  If Quicktips\r
+     * are enabled, this value will be used as the text of the quick tip, otherwise it will be set as the\r
+     * header's HTML title attribute. Defaults to ''.\r
+     */\r
+    /**\r
+     * @cfg {Mixed} renderer\r
+     * <p>For an alternative to specifying a renderer see <code>{@link #xtype}</code></p>\r
+     * <p>Optional. A renderer is an 'interceptor' method which can be used transform data (value,\r
+     * appearance, etc.) before it is rendered). This may be specified in either of three ways:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li>A renderer function used to return HTML markup for a cell given the cell's data value.</li>\r
+     * <li>A string which references a property name of the {@link Ext.util.Format} class which\r
+     * provides a renderer function.</li>\r
+     * <li>An object specifying both the renderer function, and its execution scope (<tt><b>this</b></tt>\r
+     * reference) e.g.:<pre style="margin-left:1.2em"><code>\r
+{\r
+    fn: this.gridRenderer,\r
+    scope: this\r
+}\r
+</code></pre></li></ul></div>\r
+     * If not specified, the default renderer uses the raw data value.</p>\r
+     * <p>For information about the renderer function (passed parameters, etc.), see\r
+     * {@link Ext.grid.ColumnModel#setRenderer}. An example of specifying renderer function inline:</p><pre><code>\r
+var companyColumn = {\r
+   header: 'Company Name',\r
+   dataIndex: 'company',\r
+   renderer: function(value, metaData, record, rowIndex, colIndex, store) {\r
+      // provide the logic depending on business rules\r
+      // name of your own choosing to manipulate the cell depending upon\r
+      // the data in the underlying Record object.\r
+      if (value == 'whatever') {\r
+          //metaData.css : String : A CSS class name to add to the TD element of the cell.\r
+          //metaData.attr : String : An html attribute definition string to apply to\r
+          //                         the data container element within the table\r
+          //                         cell (e.g. 'style="color:red;"').\r
+          metaData.css = 'name-of-css-class-you-will-define';\r
+      }\r
+      return value;\r
+   }\r
+}\r
+     * </code></pre>\r
+     * See also {@link #scope}.\r
+     */\r
+    /**\r
+     * @cfg {String} xtype Optional. A String which references a predefined {@link Ext.grid.Column} subclass\r
+     * type which is preconfigured with an appropriate <code>{@link #renderer}</code> to be easily\r
+     * configured into a ColumnModel. The predefined {@link Ext.grid.Column} subclass types are:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b><tt>gridcolumn</tt></b> : {@link Ext.grid.Column} (<b>Default</b>)<p class="sub-desc"></p></li>\r
+     * <li><b><tt>booleancolumn</tt></b> : {@link Ext.grid.BooleanColumn}<p class="sub-desc"></p></li>\r
+     * <li><b><tt>numbercolumn</tt></b> : {@link Ext.grid.NumberColumn}<p class="sub-desc"></p></li>\r
+     * <li><b><tt>datecolumn</tt></b> : {@link Ext.grid.DateColumn}<p class="sub-desc"></p></li>\r
+     * <li><b><tt>templatecolumn</tt></b> : {@link Ext.grid.TemplateColumn}<p class="sub-desc"></p></li>\r
+     * </ul></div>\r
+     * <p>Configuration properties for the specified <code>xtype</code> may be specified with\r
+     * the Column configuration properties, for example:</p>\r
+     * <pre><code>\r
+var grid = new Ext.grid.GridPanel({\r
+    ...\r
+    columns: [{\r
+        header: 'Last Updated',\r
+        dataIndex: 'lastChange',\r
+        width: 85,\r
+        sortable: true,\r
+        //renderer: Ext.util.Format.dateRenderer('m/d/Y'),\r
+        xtype: 'datecolumn', // use xtype instead of renderer\r
+        format: 'M/d/Y' // configuration property for {@link Ext.grid.DateColumn}\r
+    }, {\r
+        ...\r
+    }]\r
+});\r
+     * </code></pre>\r
+     */\r
+    /**\r
+     * @cfg {Object} scope Optional. The scope (<tt><b>this</b></tt> reference) in which to execute the\r
+     * renderer.  Defaults to the Column configuration object.\r
+     */\r
+    /**\r
+     * @cfg {String} align Optional. Set the CSS text-align property of the column.  Defaults to undefined.\r
+     */\r
+    /**\r
+     * @cfg {String} css Optional. An inline style definition string which is applied to all table cells in the column\r
+     * (excluding headers). Defaults to undefined.\r
+     */\r
+    /**\r
+     * @cfg {Boolean} hideable Optional. Specify as <tt>false</tt> to prevent the user from hiding this column\r
+     * (defaults to true).  To disallow column hiding globally for all columns in the grid, use\r
+     * {@link Ext.grid.GridPanel#enableColumnHide} instead.\r
+     */\r
+    /**\r
+     * @cfg {Ext.form.Field} editor Optional. The {@link Ext.form.Field} to use when editing values in this column\r
+     * if editing is supported by the grid. See <tt>{@link #editable}</tt> also.\r
+     */\r
+\r
+    // private. Used by ColumnModel to avoid reprocessing\r
+    isColumn : true,\r
+    /**\r
+     * Optional. A function which returns displayable data when passed the following parameters:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b>value</b> : Object<p class="sub-desc">The data value for the cell.</p></li>\r
+     * <li><b>metadata</b> : Object<p class="sub-desc">An object in which you may set the following attributes:<ul>\r
+     * <li><b>css</b> : String<p class="sub-desc">A CSS class name to add to the cell's TD element.</p></li>\r
+     * <li><b>attr</b> : String<p class="sub-desc">An HTML attribute definition string to apply to the data container\r
+     * element <i>within</i> the table cell (e.g. 'style="color:red;"').</p></li></ul></p></li>\r
+     * <li><b>record</b> : Ext.data.record<p class="sub-desc">The {@link Ext.data.Record} from which the data was\r
+     * extracted.</p></li>\r
+     * <li><b>rowIndex</b> : Number<p class="sub-desc">Row index</p></li>\r
+     * <li><b>colIndex</b> : Number<p class="sub-desc">Column index</p></li>\r
+     * <li><b>store</b> : Ext.data.Store<p class="sub-desc">The {@link Ext.data.Store} object from which the Record\r
+     * was extracted.</p></li>\r
+     * </ul></div>\r
+     * @property renderer\r
+     * @type Function\r
+     */\r
+    renderer : function(value){\r
+        if(typeof value == 'string' && value.length < 1){\r
+            return '&#160;';\r
+        }\r
+        return value;\r
+    },\r
 \r
-    cp = new Ext.Panel({\r
-        id: 'x-debug-browser',\r
-        title: 'Console',\r
-        collapsible: true,\r
-        animCollapse: false,\r
-        style: 'position:absolute;left:0;bottom:0;',\r
-        height:200,\r
-        logView: logView,\r
-        layout: 'fit',\r
-        \r
-        tools:[{\r
-            id: 'close',\r
-            handler: function(){\r
-                cp.destroy();\r
-                cp = null;\r
-                Ext.EventManager.removeResizeListener(handleResize);\r
+    // private\r
+    getEditor: function(rowIndex){\r
+        return this.editable !== false ? this.editor : null;\r
+    },\r
+\r
+    /**\r
+     * Returns the {@link Ext.Editor editor} defined for this column that was created to wrap the {@link Ext.form.Field Field}\r
+     * used to edit the cell.\r
+     * @param {Number} rowIndex The row index\r
+     * @return {Ext.Editor}\r
+     */\r
+    getCellEditor: function(rowIndex){\r
+        var editor = this.getEditor(rowIndex);\r
+        if(editor){\r
+            if(!editor.startEdit){\r
+                if(!editor.gridEditor){\r
+                    editor.gridEditor = new Ext.grid.GridEditor(editor);\r
+                }\r
+                return editor.gridEditor;\r
+            }else if(editor.startEdit){\r
+                return editor;\r
             }\r
-        }],\r
+        }\r
+        return null;\r
+    }\r
+};\r
 \r
-        items: tabs\r
-    });\r
+/**\r
+ * @class Ext.grid.BooleanColumn\r
+ * @extends Ext.grid.Column\r
+ * <p>A Column definition class which renders boolean data fields.  See the {@link Ext.grid.ColumnModel#xtype xtype}\r
+ * config option of {@link Ext.grid.ColumnModel} for more details.</p>\r
+ */\r
+Ext.grid.BooleanColumn = Ext.extend(Ext.grid.Column, {\r
+    /**\r
+     * @cfg {String} trueText\r
+     * The string returned by the renderer when the column value is not falsey (defaults to <tt>'true'</tt>).\r
+     */\r
+    trueText: 'true',\r
+    /**\r
+     * @cfg {String} falseText\r
+     * The string returned by the renderer when the column value is falsey (but not undefined) (defaults to\r
+     * <tt>'false'</tt>).\r
+     */\r
+    falseText: 'false',\r
+    /**\r
+     * @cfg {String} undefinedText\r
+     * The string returned by the renderer when the column value is undefined (defaults to <tt>'&#160;'</tt>).\r
+     */\r
+    undefinedText: '&#160;',\r
+\r
+    constructor: function(cfg){\r
+        Ext.grid.BooleanColumn.superclass.constructor.call(this, cfg);\r
+        var t = this.trueText, f = this.falseText, u = this.undefinedText;\r
+        this.renderer = function(v){\r
+            if(v === undefined){\r
+                return u;\r
+            }\r
+            if(!v || v === 'false'){\r
+                return f;\r
+            }\r
+            return t;\r
+        };\r
+    }\r
+});\r
 \r
-    cp.render(document.body);\r
+/**\r
+ * @class Ext.grid.NumberColumn\r
+ * @extends Ext.grid.Column\r
+ * <p>A Column definition class which renders a numeric data field according to a {@link #format} string.  See the\r
+ * {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} for more details.</p>\r
+ */\r
+Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, {\r
+    /**\r
+     * @cfg {String} format\r
+     * A formatting string as used by {@link Ext.util.Format#number} to format a numeric value for this Column\r
+     * (defaults to <tt>'0,000.00'</tt>).\r
+     */\r
+    format : '0,000.00',\r
+    constructor: function(cfg){\r
+        Ext.grid.NumberColumn.superclass.constructor.call(this, cfg);\r
+        this.renderer = Ext.util.Format.numberRenderer(this.format);\r
+    }\r
+});\r
 \r
-    cp.resizer = new Ext.Resizable(cp.el, {\r
-        minHeight:50,\r
-        handles: "n",\r
-        pinned: true,\r
-        transparent:true,\r
-        resizeElement : function(){\r
-            var box = this.proxy.getBox();\r
-            this.proxy.hide();\r
-            cp.setHeight(box.height);\r
-            return box;\r
-        }\r
-    });\r
+/**\r
+ * @class Ext.grid.DateColumn\r
+ * @extends Ext.grid.Column\r
+ * <p>A Column definition class which renders a passed date according to the default locale, or a configured\r
+ * {@link #format}. See the {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel}\r
+ * for more details.</p>\r
+ */\r
+Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, {\r
+    /**\r
+     * @cfg {String} format\r
+     * A formatting string as used by {@link Date#format} to format a Date for this Column\r
+     * (defaults to <tt>'m/d/Y'</tt>).\r
+     */\r
+    format : 'm/d/Y',\r
+    constructor: function(cfg){\r
+        Ext.grid.DateColumn.superclass.constructor.call(this, cfg);\r
+        this.renderer = Ext.util.Format.dateRenderer(this.format);\r
+    }\r
+});\r
 \r
-    function handleResize(){\r
-        cp.setWidth(Ext.getBody().getViewSize().width);\r
+/**\r
+ * @class Ext.grid.TemplateColumn\r
+ * @extends Ext.grid.Column\r
+ * <p>A Column definition class which renders a value by processing a {@link Ext.data.Record Record}'s\r
+ * {@link Ext.data.Record#data data} using a {@link #tpl configured} {@link Ext.XTemplate XTemplate}.\r
+ * See the {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} for more\r
+ * details.</p>\r
+ */\r
+Ext.grid.TemplateColumn = Ext.extend(Ext.grid.Column, {\r
+    /**\r
+     * @cfg {String/XTemplate} tpl\r
+     * An {@link Ext.XTemplate XTemplate}, or an XTemplate <i>definition string</i> to use to process a\r
+     * {@link Ext.data.Record Record}'s {@link Ext.data.Record#data data} to produce a column's rendered value.\r
+     */\r
+    constructor: function(cfg){\r
+        Ext.grid.TemplateColumn.superclass.constructor.call(this, cfg);\r
+        var tpl = typeof Ext.isObject(this.tpl) ? this.tpl : new Ext.XTemplate(this.tpl);\r
+        this.renderer = function(value, p, r){\r
+            return tpl.apply(r.data);\r
+        };\r
+        this.tpl = tpl;\r
     }\r
-    Ext.EventManager.onWindowResize(handleResize);\r
+});\r
 \r
-    handleResize();\r
-}\r
+/*\r
+ * @property types\r
+ * @type Object\r
+ * @member Ext.grid.Column\r
+ * @static\r
+ * <p>An object containing predefined Column classes keyed by a mnemonic code which may be referenced\r
+ * by the {@link Ext.grid.ColumnModel#xtype xtype} config option of ColumnModel.</p>\r
+ * <p>This contains the following properties</p><div class="mdesc-details"><ul>\r
+ * <li>gridcolumn : <b>{@link Ext.grid.Column Column constructor}</b></li>\r
+ * <li>booleancolumn : <b>{@link Ext.grid.BooleanColumn BooleanColumn constructor}</b></li>\r
+ * <li>numbercolumn : <b>{@link Ext.grid.NumberColumn NumberColumn constructor}</b></li>\r
+ * <li>datecolumn : <b>{@link Ext.grid.DateColumn DateColumn constructor}</b></li>\r
+ * <li>templatecolumn : <b>{@link Ext.grid.TemplateColumn TemplateColumn constructor}</b></li>\r
+ * </ul></div>\r
+ */\r
+Ext.grid.Column.types = {\r
+    gridcolumn : Ext.grid.Column,\r
+    booleancolumn: Ext.grid.BooleanColumn,\r
+    numbercolumn: Ext.grid.NumberColumn,\r
+    datecolumn: Ext.grid.DateColumn,\r
+    templatecolumn: Ext.grid.TemplateColumn\r
+};/**
+ * @class Ext.grid.RowNumberer
+ * This is a utility class that can be passed into a {@link Ext.grid.ColumnModel} as a column config that provides
+ * an automatic row numbering column.
+ * <br>Usage:<br>
+ <pre><code>
+ // This is a typical column config with the first column providing row numbers
+ var colModel = new Ext.grid.ColumnModel([
+    new Ext.grid.RowNumberer(),
+    {header: "Name", width: 80, sortable: true},
+    {header: "Code", width: 50, sortable: true},
+    {header: "Description", width: 200, sortable: true}
+ ]);
+ </code></pre>
+ * @constructor
+ * @param {Object} config The configuration options
+ */
+Ext.grid.RowNumberer = function(config){
+    Ext.apply(this, config);
+    if(this.rowspan){
+        this.renderer = this.renderer.createDelegate(this);
+    }
+};
+
+Ext.grid.RowNumberer.prototype = {
+    /**
+     * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
+     * number column (defaults to '').
+     */
+    header: "",
+    /**
+     * @cfg {Number} width The default width in pixels of the row number column (defaults to 23).
+     */
+    width: 23,
+    /**
+     * @cfg {Boolean} sortable True if the row number column is sortable (defaults to false).
+     * @hide
+     */
+    sortable: false,
+
+    // private
+    fixed:true,
+    menuDisabled:true,
+    dataIndex: '',
+    id: 'numberer',
+    rowspan: undefined,
+
+    // private
+    renderer : function(v, p, record, rowIndex){
+        if(this.rowspan){
+            p.cellAttr = 'rowspan="'+this.rowspan+'"';
+        }
+        return rowIndex+1;
+    }
+};/**\r
+ * @class Ext.grid.CheckboxSelectionModel\r
+ * @extends Ext.grid.RowSelectionModel\r
+ * A custom selection model that renders a column of checkboxes that can be toggled to select or deselect rows.\r
+ * @constructor\r
+ * @param {Object} config The configuration options\r
+ */\r
+Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {\r
+\r
+    /**\r
+     * @cfg {Boolean} checkOnly <tt>true</tt> if rows can only be selected by clicking on the\r
+     * checkbox column (defaults to <tt>false</tt>).\r
+     */\r
+    /**\r
+     * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the\r
+     * checkbox column.  Defaults to:<pre><code>\r
+     * '&lt;div class="x-grid3-hd-checker">&#38;#160;&lt;/div>'</tt>\r
+     * </code></pre>\r
+     * The default CSS class of <tt>'x-grid3-hd-checker'</tt> displays a checkbox in the header\r
+     * and provides support for automatic check all/none behavior on header click. This string\r
+     * can be replaced by any valid HTML fragment, including a simple text string (e.g.,\r
+     * <tt>'Select Rows'</tt>), but the automatic check all/none behavior will only work if the\r
+     * <tt>'x-grid3-hd-checker'</tt> class is supplied.\r
+     */\r
+    header: '<div class="x-grid3-hd-checker">&#160;</div>',\r
+    /**\r
+     * @cfg {Number} width The default width in pixels of the checkbox column (defaults to <tt>20</tt>).\r
+     */\r
+    width: 20,\r
+    /**\r
+     * @cfg {Boolean} sortable <tt>true</tt> if the checkbox column is sortable (defaults to\r
+     * <tt>false</tt>).\r
+     */\r
+    sortable: false,\r
+\r
+    // private\r
+    menuDisabled:true,\r
+    fixed:true,\r
+    dataIndex: '',\r
+    id: 'checker',\r
 \r
+    constructor: function(){\r
+        Ext.grid.CheckboxSelectionModel.superclass.constructor.apply(this, arguments);\r
 \r
-Ext.apply(Ext, {\r
-    log : function(){\r
-        if(!cp){\r
-            createConsole();\r
+        if(this.checkOnly){\r
+            this.handleMouseDown = Ext.emptyFn;\r
         }\r
-        cp.logView.log.apply(cp.logView, arguments);\r
     },\r
 \r
-    logf : function(format, arg1, arg2, etc){\r
-        Ext.log(String.format.apply(String, arguments));\r
+    // private\r
+    initEvents : function(){\r
+        Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);\r
+        this.grid.on('render', function(){\r
+            var view = this.grid.getView();\r
+            view.mainBody.on('mousedown', this.onMouseDown, this);\r
+            Ext.fly(view.innerHd).on('mousedown', this.onHdMouseDown, this);\r
+\r
+        }, this);\r
     },\r
 \r
-    dump : function(o){\r
-        if(typeof o == 'string' || typeof o == 'number' || typeof o == 'undefined' || Ext.isDate(o)){\r
-            Ext.log(o);\r
-        }else if(!o){\r
-            Ext.log("null");\r
-        }else if(typeof o != "object"){\r
-            Ext.log('Unknown return type');\r
-        }else if(Ext.isArray(o)){\r
-            Ext.log('['+o.join(',')+']');\r
-        }else{\r
-            var b = ["{\n"];\r
-            for(var key in o){\r
-                var to = typeof o[key];\r
-                if(to != "function" && to != "object"){\r
-                    b.push(String.format("  {0}: {1},\n", key, o[key]));\r
+    // private\r
+    onMouseDown : function(e, t){\r
+        if(e.button === 0 && t.className == 'x-grid3-row-checker'){ // Only fire if left-click\r
+            e.stopEvent();\r
+            var row = e.getTarget('.x-grid3-row');\r
+            if(row){\r
+                var index = row.rowIndex;\r
+                if(this.isSelected(index)){\r
+                    this.deselectRow(index);\r
+                }else{\r
+                    this.selectRow(index, true);\r
                 }\r
             }\r
-            var s = b.join("");\r
-            if(s.length > 3){\r
-                s = s.substr(0, s.length-2);\r
-            }\r
-            Ext.log(s + "\n}");\r
         }\r
     },\r
 \r
-    _timers : {},\r
-\r
-    time : function(name){\r
-        name = name || "def";\r
-        Ext._timers[name] = new Date().getTime();\r
+    // private\r
+    onHdMouseDown : function(e, t){\r
+        if(t.className == 'x-grid3-hd-checker'){\r
+            e.stopEvent();\r
+            var hd = Ext.fly(t.parentNode);\r
+            var isChecked = hd.hasClass('x-grid3-hd-checker-on');\r
+            if(isChecked){\r
+                hd.removeClass('x-grid3-hd-checker-on');\r
+                this.clearSelections();\r
+            }else{\r
+                hd.addClass('x-grid3-hd-checker-on');\r
+                this.selectAll();\r
+            }\r
+        }\r
     },\r
 \r
-    timeEnd : function(name, printResults){\r
-        var t = new Date().getTime();\r
-        name = name || "def";\r
-        var v = String.format("{0} ms", t-Ext._timers[name]);\r
-        Ext._timers[name] = new Date().getTime();\r
-        if(printResults !== false){\r
-            Ext.log('Timer ' + (name == "def" ? v : name + ": " + v));\r
-        }\r
-        return v;\r
+    // private\r
+    renderer : function(v, p, record){\r
+        return '<div class="x-grid3-row-checker">&#160;</div>';\r
     }\r
+});/**
+ * @class Ext.grid.CellSelectionModel
+ * @extends Ext.grid.AbstractSelectionModel
+ * This class provides the basic implementation for <i>single</i> <b>cell</b> selection in a grid.
+ * The object stored as the selection contains the following properties:
+ * <div class="mdetail-params"><ul>
+ * <li><b>cell</b> : see {@link #getSelectedCell} 
+ * <li><b>record</b> : Ext.data.record The {@link Ext.data.Record Record}
+ * which provides the data for the row containing the selection</li>
+ * </ul></div>
+ * @constructor
+ * @param {Object} config The object containing the configuration of this model.
+ */
+Ext.grid.CellSelectionModel = function(config){
+    Ext.apply(this, config);
+
+    this.selection = null;
+
+    this.addEvents(
+        /**
+            * @event beforecellselect
+            * Fires before a cell is selected, return false to cancel the selection.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected row index
+            * @param {Number} colIndex The selected cell index
+            */
+           "beforecellselect",
+        /**
+            * @event cellselect
+            * Fires when a cell is selected.
+            * @param {SelectionModel} this
+            * @param {Number} rowIndex The selected row index
+            * @param {Number} colIndex The selected cell index
+            */
+           "cellselect",
+        /**
+            * @event selectionchange
+            * Fires when the active selection changes.
+            * @param {SelectionModel} this
+            * @param {Object} selection null for no selection or an object with two properties
+         * <div class="mdetail-params"><ul>
+         * <li><b>cell</b> : see {@link #getSelectedCell} 
+         * <li><b>record</b> : Ext.data.record<p class="sub-desc">The {@link Ext.data.Record Record}
+         * which provides the data for the row containing the selection</p></li>
+         * </ul></div>
+            */
+           "selectionchange"
+    );
+
+    Ext.grid.CellSelectionModel.superclass.constructor.call(this);
+};
+
+Ext.extend(Ext.grid.CellSelectionModel, Ext.grid.AbstractSelectionModel,  {
+
+    /** @ignore */
+    initEvents : function(){
+        this.grid.on("cellmousedown", this.handleMouseDown, this);
+        this.grid.getGridEl().on(Ext.EventManager.useKeydown ? "keydown" : "keypress", this.handleKeyDown, this);
+        var view = this.grid.view;
+        view.on("refresh", this.onViewChange, this);
+        view.on("rowupdated", this.onRowUpdated, this);
+        view.on("beforerowremoved", this.clearSelections, this);
+        view.on("beforerowsinserted", this.clearSelections, this);
+        if(this.grid.isEditor){
+            this.grid.on("beforeedit", this.beforeEdit,  this);
+        }
+    },
+
+       //private
+    beforeEdit : function(e){
+        this.select(e.row, e.column, false, true, e.record);
+    },
+
+       //private
+    onRowUpdated : function(v, index, r){
+        if(this.selection && this.selection.record == r){
+            v.onCellSelect(index, this.selection.cell[1]);
+        }
+    },
+
+       //private
+    onViewChange : function(){
+        this.clearSelections(true);
+    },
+
+       /**
+     * Returns an array containing the row and column indexes of the currently selected cell
+     * (e.g., [0, 0]), or null if none selected. The array has elements:
+     * <div class="mdetail-params"><ul>
+     * <li><b>rowIndex</b> : Number<p class="sub-desc">The index of the selected row</p></li>
+     * <li><b>cellIndex</b> : Number<p class="sub-desc">The index of the selected cell. 
+     * Due to possible column reordering, the cellIndex should <b>not</b> be used as an
+     * index into the Record's data. Instead, use the cellIndex to determine the <i>name</i>
+     * of the selected cell and use the field name to retrieve the data value from the record:<pre><code>
+// get name
+var fieldName = grid.getColumnModel().getDataIndex(cellIndex);
+// get data value based on name
+var data = record.get(fieldName);
+     * </code></pre></p></li>
+     * </ul></div>
+     * @return {Array} An array containing the row and column indexes of the selected cell, or null if none selected.
+        */
+    getSelectedCell : function(){
+        return this.selection ? this.selection.cell : null;
+    },
+
+    /**
+     * If anything is selected, clears all selections and fires the selectionchange event.
+     * @param {Boolean} preventNotify <tt>true</tt> to prevent the gridview from
+     * being notified about the change.
+     */
+    clearSelections : function(preventNotify){
+        var s = this.selection;
+        if(s){
+            if(preventNotify !== true){
+                this.grid.view.onCellDeselect(s.cell[0], s.cell[1]);
+            }
+            this.selection = null;
+            this.fireEvent("selectionchange", this, null);
+        }
+    },
+
+    /**
+     * Returns <tt>true</tt> if there is a selection.
+     * @return {Boolean}
+     */
+    hasSelection : function(){
+        return this.selection ? true : false;
+    },
+
+    /** @ignore */
+    handleMouseDown : function(g, row, cell, e){
+        if(e.button !== 0 || this.isLocked()){
+            return;
+        }
+        this.select(row, cell);
+    },
+
+    /**
+     * Selects a cell.  Before selecting a cell, fires the
+     * {@link #beforecellselect} event.  If this check is satisfied the cell
+     * will be selected and followed up by  firing the {@link #cellselect} and
+     * {@link #selectionchange} events.
+     * @param {Number} rowIndex The index of the row to select
+     * @param {Number} colIndex The index of the column to select
+     * @param {Boolean} preventViewNotify (optional) Specify <tt>true</tt> to
+     * prevent notifying the view (disables updating the selected appearance)
+     * @param {Boolean} preventFocus (optional) Whether to prevent the cell at
+     * the specified rowIndex / colIndex from being focused.
+     * @param {Ext.data.Record} r (optional) The record to select
+     */
+    select : function(rowIndex, colIndex, preventViewNotify, preventFocus, /*internal*/ r){
+        if(this.fireEvent("beforecellselect", this, rowIndex, colIndex) !== false){
+            this.clearSelections();
+            r = r || this.grid.store.getAt(rowIndex);
+            this.selection = {
+                record : r,
+                cell : [rowIndex, colIndex]
+            };
+            if(!preventViewNotify){
+                var v = this.grid.getView();
+                v.onCellSelect(rowIndex, colIndex);
+                if(preventFocus !== true){
+                    v.focusCell(rowIndex, colIndex);
+                }
+            }
+            this.fireEvent("cellselect", this, rowIndex, colIndex);
+            this.fireEvent("selectionchange", this, this.selection);
+        }
+    },
+
+       //private
+    isSelectable : function(rowIndex, colIndex, cm){
+        return !cm.isHidden(colIndex);
+    },
+
+    /** @ignore */
+    handleKeyDown : function(e){
+        if(!e.isNavKeyPress()){
+            return;
+        }
+        var g = this.grid, s = this.selection;
+        if(!s){
+            e.stopEvent();
+            var cell = g.walkCells(0, 0, 1, this.isSelectable,  this);
+            if(cell){
+                this.select(cell[0], cell[1]);
+            }
+            return;
+        }
+        var sm = this;
+        var walk = function(row, col, step){
+            return g.walkCells(row, col, step, sm.isSelectable,  sm);
+        };
+        var k = e.getKey(), r = s.cell[0], c = s.cell[1];
+        var newCell;
+
+        switch(k){
+             case e.TAB:
+                 if(e.shiftKey){
+                     newCell = walk(r, c-1, -1);
+                 }else{
+                     newCell = walk(r, c+1, 1);
+                 }
+             break;
+             case e.DOWN:
+                 newCell = walk(r+1, c, 1);
+             break;
+             case e.UP:
+                 newCell = walk(r-1, c, -1);
+             break;
+             case e.RIGHT:
+                 newCell = walk(r, c+1, 1);
+             break;
+             case e.LEFT:
+                 newCell = walk(r, c-1, -1);
+             break;
+             case e.ENTER:
+                 if(g.isEditor && !g.editing){
+                    g.startEditing(r, c);
+                    e.stopEvent();
+                    return;
+                }
+             break;
+        }
+        if(newCell){
+            this.select(newCell[0], newCell[1]);
+            e.stopEvent();
+        }
+    },
+
+    acceptsNav : function(row, col, cm){
+        return !cm.isHidden(col) && cm.isCellEditable(col, row);
+    },
+
+    onEditorKey : function(field, e){
+        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
+        if(k == e.TAB){
+            if(e.shiftKey){
+                newCell = g.walkCells(ed.row, ed.col-1, -1, this.acceptsNav, this);
+            }else{
+                newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
+            }
+            e.stopEvent();
+        }else if(k == e.ENTER){
+            ed.completeEdit();
+            e.stopEvent();
+        }else if(k == e.ESC){
+               e.stopEvent();
+            ed.cancelEdit();
+        }
+        if(newCell){
+            g.startEditing(newCell[0], newCell[1]);
+        }
+    }
+});/**
+ * @class Ext.grid.EditorGridPanel
+ * @extends Ext.grid.GridPanel
+ * <p>This class extends the {@link Ext.grid.GridPanel GridPanel Class} to provide cell editing
+ * on selected {@link Ext.grid.Column columns}. The editable columns are specified by providing
+ * an {@link Ext.grid.ColumnModel#editor editor} in the {@link Ext.grid.Column column configuration}.</p>
+ * <p>Editability of columns may be controlled programatically by inserting an implementation
+ * of {@link Ext.grid.ColumnModel#isCellEditable isCellEditable} into the
+ * {@link Ext.grid.ColumnModel ColumnModel}.</p>
+ * <p>Editing is performed on the value of the <i>field</i> specified by the column's
+ * <tt>{@link Ext.grid.ColumnModel#dataIndex dataIndex}</tt> in the backing {@link Ext.data.Store Store}
+ * (so if you are using a {@link Ext.grid.ColumnModel#setRenderer renderer} in order to display
+ * transformed data, this must be accounted for).</p>
+ * <p>If a value-to-description mapping is used to render a column, then a {@link Ext.form.Field#ComboBox ComboBox}
+ * which uses the same {@link Ext.form.Field#valueField value}-to-{@link Ext.form.Field#displayFieldField description}
+ * mapping would be an appropriate editor.</p>
+ * If there is a more complex mismatch between the visible data in the grid, and the editable data in
+ * the {@link Edt.data.Store Store}, then code to transform the data both before and after editing can be
+ * injected using the {@link #beforeedit} and {@link #afteredit} events.
+ * @constructor
+ * @param {Object} config The config object
+ * @xtype editorgrid
+ */
+Ext.grid.EditorGridPanel = Ext.extend(Ext.grid.GridPanel, {
+    /**
+     * @cfg {Number} clicksToEdit
+     * <p>The number of clicks on a cell required to display the cell's editor (defaults to 2).</p>
+     * <p>Setting this option to 'auto' means that mousedown <i>on the selected cell</i> starts
+     * editing that cell.</p>
+     */
+    clicksToEdit: 2,
+    
+    /**
+    * @cfg {Boolean} forceValidation
+    * True to force validation even if the value is unmodified (defaults to false)
+    */
+    forceValidation: false,
+
+    // private
+    isEditor : true,
+    // private
+    detectEdit: false,
+
+       /**
+        * @cfg {Boolean} autoEncode
+        * True to automatically HTML encode and decode values pre and post edit (defaults to false)
+        */
+       autoEncode : false,
+
+       /**
+        * @cfg {Boolean} trackMouseOver @hide
+        */
+    // private
+    trackMouseOver: false, // causes very odd FF errors
+
+    // private
+    initComponent : function(){
+        Ext.grid.EditorGridPanel.superclass.initComponent.call(this);
+
+        if(!this.selModel){
+            /**
+             * @cfg {Object} selModel Any subclass of AbstractSelectionModel that will provide the selection model for
+             * the grid (defaults to {@link Ext.grid.CellSelectionModel} if not specified).
+             */
+            this.selModel = new Ext.grid.CellSelectionModel();
+        }
+
+        this.activeEditor = null;
+
+           this.addEvents(
+            /**
+             * @event beforeedit
+             * Fires before cell editing is triggered. The edit event object has the following properties <br />
+             * <ul style="padding:5px;padding-left:16px;">
+             * <li>grid - This grid</li>
+             * <li>record - The record being edited</li>
+             * <li>field - The field name being edited</li>
+             * <li>value - The value for the field being edited.</li>
+             * <li>row - The grid row index</li>
+             * <li>column - The grid column index</li>
+             * <li>cancel - Set this to true to cancel the edit or return false from your handler.</li>
+             * </ul>
+             * @param {Object} e An edit event (see above for description)
+             */
+            "beforeedit",
+            /**
+             * @event afteredit
+             * Fires after a cell is edited. The edit event object has the following properties <br />
+             * <ul style="padding:5px;padding-left:16px;">
+             * <li>grid - This grid</li>
+             * <li>record - The record being edited</li>
+             * <li>field - The field name being edited</li>
+             * <li>value - The value being set</li>
+             * <li>originalValue - The original value for the field, before the edit.</li>
+             * <li>row - The grid row index</li>
+             * <li>column - The grid column index</li>
+             * </ul>
+             *
+             * <pre><code> 
+grid.on('afteredit', afterEdit, this );
+
+function afterEdit(e) {
+    // execute an XHR to send/commit data to the server, in callback do (if successful):
+    e.record.commit();
+}; 
+             * </code></pre>
+             * @param {Object} e An edit event (see above for description)
+             */
+            "afteredit",
+            /**
+             * @event validateedit
+             * Fires after a cell is edited, but before the value is set in the record. Return false
+             * to cancel the change. The edit event object has the following properties <br />
+             * <ul style="padding:5px;padding-left:16px;">
+             * <li>grid - This grid</li>
+             * <li>record - The record being edited</li>
+             * <li>field - The field name being edited</li>
+             * <li>value - The value being set</li>
+             * <li>originalValue - The original value for the field, before the edit.</li>
+             * <li>row - The grid row index</li>
+             * <li>column - The grid column index</li>
+             * <li>cancel - Set this to true to cancel the edit or return false from your handler.</li>
+             * </ul>
+             * Usage example showing how to remove the red triangle (dirty record indicator) from some
+             * records (not all).  By observing the grid's validateedit event, it can be cancelled if
+             * the edit occurs on a targeted row (for example) and then setting the field's new value
+             * in the Record directly:
+             * <pre><code> 
+grid.on('validateedit', function(e) {
+  var myTargetRow = 6;
+  if (e.row == myTargetRow) {
+    e.cancel = true;
+    e.record.data[e.field] = e.value;
+  }
+});
+             * </code></pre>
+             * @param {Object} e An edit event (see above for description)
+             */
+            "validateedit"
+        );
+    },
+
+    // private
+    initEvents : function(){
+        Ext.grid.EditorGridPanel.superclass.initEvents.call(this);
+
+        this.on("bodyscroll", this.stopEditing, this, [true]);
+        this.on("columnresize", this.stopEditing, this, [true]);
+
+        if(this.clicksToEdit == 1){
+            this.on("cellclick", this.onCellDblClick, this);
+        }else {
+            if(this.clicksToEdit == 'auto' && this.view.mainBody){
+                this.view.mainBody.on("mousedown", this.onAutoEditClick, this);
+            }
+            this.on("celldblclick", this.onCellDblClick, this);
+        }
+    },
+
+    // private
+    onCellDblClick : function(g, row, col){
+        this.startEditing(row, col);
+    },
+
+    // private
+    onAutoEditClick : function(e, t){
+        if(e.button !== 0){
+            return;
+        }
+        var row = this.view.findRowIndex(t);
+        var col = this.view.findCellIndex(t);
+        if(row !== false && col !== false){
+            this.stopEditing();
+            if(this.selModel.getSelectedCell){ // cell sm
+                var sc = this.selModel.getSelectedCell();
+                if(sc && sc[0] === row && sc[1] === col){
+                    this.startEditing(row, col);
+                }
+            }else{
+                if(this.selModel.isSelected(row)){
+                    this.startEditing(row, col);
+                }
+            }
+        }
+    },
+
+    // private
+    onEditComplete : function(ed, value, startValue){
+        this.editing = false;
+        this.activeEditor = null;
+        ed.un("specialkey", this.selModel.onEditorKey, this.selModel);
+               var r = ed.record;
+        var field = this.colModel.getDataIndex(ed.col);
+        value = this.postEditValue(value, startValue, r, field);
+        if(this.forceValidation === true || String(value) !== String(startValue)){
+            var e = {
+                grid: this,
+                record: r,
+                field: field,
+                originalValue: startValue,
+                value: value,
+                row: ed.row,
+                column: ed.col,
+                cancel:false
+            };
+            if(this.fireEvent("validateedit", e) !== false && !e.cancel && String(value) !== String(startValue)){
+                r.set(field, e.value);
+                delete e.cancel;
+                this.fireEvent("afteredit", e);
+            }
+        }
+        this.view.focusCell(ed.row, ed.col);
+    },
+
+    /**
+     * Starts editing the specified for the specified row/column
+     * @param {Number} rowIndex
+     * @param {Number} colIndex
+     */
+    startEditing : function(row, col){
+        this.stopEditing();
+        if(this.colModel.isCellEditable(col, row)){
+            this.view.ensureVisible(row, col, true);
+            var r = this.store.getAt(row);
+            var field = this.colModel.getDataIndex(col);
+            var e = {
+                grid: this,
+                record: r,
+                field: field,
+                value: r.data[field],
+                row: row,
+                column: col,
+                cancel:false
+            };
+            if(this.fireEvent("beforeedit", e) !== false && !e.cancel){
+                this.editing = true;
+                var ed = this.colModel.getCellEditor(col, row);
+                if(!ed){
+                    return;
+                }
+                if(!ed.rendered){
+                    ed.render(this.view.getEditorParent(ed));
+                }
+                (function(){ // complex but required for focus issues in safari, ie and opera
+                    ed.row = row;
+                    ed.col = col;
+                    ed.record = r;
+                    ed.on("complete", this.onEditComplete, this, {single: true});
+                    ed.on("specialkey", this.selModel.onEditorKey, this.selModel);
+                    /**
+                     * The currently active editor or null
+                      * @type Ext.Editor
+                     */
+                    this.activeEditor = ed;
+                    var v = this.preEditValue(r, field);
+                    ed.startEdit(this.view.getCell(row, col).firstChild, v === undefined ? '' : v);
+                }).defer(50, this);
+            }
+        }
+    },
+
+    // private
+    preEditValue : function(r, field){
+        var value = r.data[field];
+        return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlDecode(value) : value;
+    },
+
+    // private
+       postEditValue : function(value, originalValue, r, field){
+               return this.autoEncode && typeof value == 'string' ? Ext.util.Format.htmlEncode(value) : value;
+       },
+
+    /**
+     * Stops any active editing
+     * @param {Boolean} cancel (optional) True to cancel any changes
+     */
+    stopEditing : function(cancel){
+        if(this.activeEditor){
+            this.activeEditor[cancel === true ? 'cancelEdit' : 'completeEdit']();
+        }
+        this.activeEditor = null;
+    }
+});
+Ext.reg('editorgrid', Ext.grid.EditorGridPanel);// private
+// This is a support class used internally by the Grid components
+Ext.grid.GridEditor = function(field, config){
+    Ext.grid.GridEditor.superclass.constructor.call(this, field, config);
+    field.monitorTab = false;
+};
+
+Ext.extend(Ext.grid.GridEditor, Ext.Editor, {
+    alignment: "tl-tl",
+    autoSize: "width",
+    hideEl : false,
+    cls: "x-small-editor x-grid-editor",
+    shim:false,
+    shadow:false
+});/**
+ * @class Ext.grid.PropertyRecord
+ * A specific {@link Ext.data.Record} type that represents a name/value pair and is made to work with the
+ * {@link Ext.grid.PropertyGrid}.  Typically, PropertyRecords do not need to be created directly as they can be
+ * created implicitly by simply using the appropriate data configs either via the {@link Ext.grid.PropertyGrid#source}
+ * config property or by calling {@link Ext.grid.PropertyGrid#setSource}.  However, if the need arises, these records
+ * can also be created explicitly as shwon below.  Example usage:
+ * <pre><code>
+var rec = new Ext.grid.PropertyRecord({
+    name: 'Birthday',
+    value: new Date(Date.parse('05/26/1972'))
+});
+// Add record to an already populated grid
+grid.store.addSorted(rec);
+</code></pre>
+ * @constructor
+ * @param {Object} config A data object in the format: {name: [name], value: [value]}.  The specified value's type
+ * will be read automatically by the grid to determine the type of editor to use when displaying it.
+ */
+Ext.grid.PropertyRecord = Ext.data.Record.create([
+    {name:'name',type:'string'}, 'value'
+]);
+
+/**
+ * @class Ext.grid.PropertyStore
+ * @extends Ext.util.Observable
+ * A custom wrapper for the {@link Ext.grid.PropertyGrid}'s {@link Ext.data.Store}. This class handles the mapping
+ * between the custom data source objects supported by the grid and the {@link Ext.grid.PropertyRecord} format
+ * required for compatibility with the underlying store. Generally this class should not need to be used directly --
+ * the grid's data should be accessed from the underlying store via the {@link #store} property.
+ * @constructor
+ * @param {Ext.grid.Grid} grid The grid this store will be bound to
+ * @param {Object} source The source data config object
+ */
+Ext.grid.PropertyStore = function(grid, source){
+    this.grid = grid;
+    this.store = new Ext.data.Store({
+        recordType : Ext.grid.PropertyRecord
+    });
+    this.store.on('update', this.onUpdate,  this);
+    if(source){
+        this.setSource(source);
+    }
+    Ext.grid.PropertyStore.superclass.constructor.call(this);
+};
+Ext.extend(Ext.grid.PropertyStore, Ext.util.Observable, {
+    // protected - should only be called by the grid.  Use grid.setSource instead.
+    setSource : function(o){
+        this.source = o;
+        this.store.removeAll();
+        var data = [];
+        for(var k in o){
+            if(this.isEditableValue(o[k])){
+                data.push(new Ext.grid.PropertyRecord({name: k, value: o[k]}, k));
+            }
+        }
+        this.store.loadRecords({records: data}, {}, true);
+    },
+
+    // private
+    onUpdate : function(ds, record, type){
+        if(type == Ext.data.Record.EDIT){
+            var v = record.data.value;
+            var oldValue = record.modified.value;
+            if(this.grid.fireEvent('beforepropertychange', this.source, record.id, v, oldValue) !== false){
+                this.source[record.id] = v;
+                record.commit();
+                this.grid.fireEvent('propertychange', this.source, record.id, v, oldValue);
+            }else{
+                record.reject();
+            }
+        }
+    },
+
+    // private
+    getProperty : function(row){
+       return this.store.getAt(row);
+    },
+
+    // private
+    isEditableValue: function(val){
+        if(Ext.isDate(val)){
+            return true;
+        }
+        return !(Ext.isObject(val) || Ext.isFunction(val));
+    },
+
+    // private
+    setValue : function(prop, value){
+        this.source[prop] = value;
+        this.store.getById(prop).set('value', value);
+    },
+
+    // protected - should only be called by the grid.  Use grid.getSource instead.
+    getSource : function(){
+        return this.source;
+    }
+});
+
+/**
+ * @class Ext.grid.PropertyColumnModel
+ * @extends Ext.grid.ColumnModel
+ * A custom column model for the {@link Ext.grid.PropertyGrid}.  Generally it should not need to be used directly.
+ * @constructor
+ * @param {Ext.grid.Grid} grid The grid this store will be bound to
+ * @param {Object} source The source data config object
+ */
+Ext.grid.PropertyColumnModel = function(grid, store){
+    var g = Ext.grid,
+        f = Ext.form;
+        
+    this.grid = grid;
+    g.PropertyColumnModel.superclass.constructor.call(this, [
+        {header: this.nameText, width:50, sortable: true, dataIndex:'name', id: 'name', menuDisabled:true},
+        {header: this.valueText, width:50, resizable:false, dataIndex: 'value', id: 'value', menuDisabled:true}
+    ]);
+    this.store = store;
+
+    var bfield = new f.Field({
+        autoCreate: {tag: 'select', children: [
+            {tag: 'option', value: 'true', html: 'true'},
+            {tag: 'option', value: 'false', html: 'false'}
+        ]},
+        getValue : function(){
+            return this.el.value == 'true';
+        }
+    });
+    this.editors = {
+        'date' : new g.GridEditor(new f.DateField({selectOnFocus:true})),
+        'string' : new g.GridEditor(new f.TextField({selectOnFocus:true})),
+        'number' : new g.GridEditor(new f.NumberField({selectOnFocus:true, style:'text-align:left;'})),
+        'boolean' : new g.GridEditor(bfield)
+    };
+    this.renderCellDelegate = this.renderCell.createDelegate(this);
+    this.renderPropDelegate = this.renderProp.createDelegate(this);
+};
+
+Ext.extend(Ext.grid.PropertyColumnModel, Ext.grid.ColumnModel, {
+    // private - strings used for locale support
+    nameText : 'Name',
+    valueText : 'Value',
+    dateFormat : 'm/j/Y',
+
+    // private
+    renderDate : function(dateVal){
+        return dateVal.dateFormat(this.dateFormat);
+    },
+
+    // private
+    renderBool : function(bVal){
+        return bVal ? 'true' : 'false';
+    },
+
+    // private
+    isCellEditable : function(colIndex, rowIndex){
+        return colIndex == 1;
+    },
+
+    // private
+    getRenderer : function(col){
+        return col == 1 ?
+            this.renderCellDelegate : this.renderPropDelegate;
+    },
+
+    // private
+    renderProp : function(v){
+        return this.getPropertyName(v);
+    },
+
+    // private
+    renderCell : function(val){
+        var rv = val;
+        if(Ext.isDate(val)){
+            rv = this.renderDate(val);
+        }else if(typeof val == 'boolean'){
+            rv = this.renderBool(val);
+        }
+        return Ext.util.Format.htmlEncode(rv);
+    },
+
+    // private
+    getPropertyName : function(name){
+        var pn = this.grid.propertyNames;
+        return pn && pn[name] ? pn[name] : name;
+    },
+
+    // private
+    getCellEditor : function(colIndex, rowIndex){
+        var p = this.store.getProperty(rowIndex),
+            n = p.data.name, 
+            val = p.data.value;
+        if(this.grid.customEditors[n]){
+            return this.grid.customEditors[n];
+        }
+        if(Ext.isDate(val)){
+            return this.editors.date;
+        }else if(typeof val == 'number'){
+            return this.editors.number;
+        }else if(typeof val == 'boolean'){
+            return this.editors['boolean'];
+        }else{
+            return this.editors.string;
+        }
+    },
+
+    // inherit docs
+    destroy : function(){
+        Ext.grid.PropertyColumnModel.superclass.destroy.call(this);
+        for(var ed in this.editors){
+            Ext.destroy(ed);
+        }
+    }
+});
+
+/**
+ * @class Ext.grid.PropertyGrid
+ * @extends Ext.grid.EditorGridPanel
+ * A specialized grid implementation intended to mimic the traditional property grid as typically seen in
+ * development IDEs.  Each row in the grid represents a property of some object, and the data is stored
+ * as a set of name/value pairs in {@link Ext.grid.PropertyRecord}s.  Example usage:
+ * <pre><code>
+var grid = new Ext.grid.PropertyGrid({
+    title: 'Properties Grid',
+    autoHeight: true,
+    width: 300,
+    renderTo: 'grid-ct',
+    source: {
+        "(name)": "My Object",
+        "Created": new Date(Date.parse('10/15/2006')),
+        "Available": false,
+        "Version": .01,
+        "Description": "A test object"
+    }
+});
+</code></pre>
+ * @constructor
+ * @param {Object} config The grid config object
+ */
+Ext.grid.PropertyGrid = Ext.extend(Ext.grid.EditorGridPanel, {
+    /**
+    * @cfg {Object} propertyNames An object containing property name/display name pairs.
+    * If specified, the display name will be shown in the name column instead of the property name.
+    */
+    /**
+    * @cfg {Object} source A data object to use as the data source of the grid (see {@link #setSource} for details).
+    */
+    /**
+    * @cfg {Object} customEditors An object containing name/value pairs of custom editor type definitions that allow
+    * the grid to support additional types of editable fields.  By default, the grid supports strongly-typed editing
+    * of strings, dates, numbers and booleans using built-in form editors, but any custom type can be supported and
+    * associated with a custom input control by specifying a custom editor.  The name of the editor
+    * type should correspond with the name of the property that will use the editor.  Example usage:
+    * <pre><code>
+var grid = new Ext.grid.PropertyGrid({
+    ...
+    customEditors: {
+        'Start Time': new Ext.grid.GridEditor(new Ext.form.TimeField({selectOnFocus:true}))
+    },
+    source: {
+        'Start Time': '10:00 AM'
+    }
+});
+</code></pre>
+    */
+
+    // private config overrides
+    enableColumnMove:false,
+    stripeRows:false,
+    trackMouseOver: false,
+    clicksToEdit:1,
+    enableHdMenu : false,
+    viewConfig : {
+        forceFit:true
+    },
+
+    // private
+    initComponent : function(){
+        this.customEditors = this.customEditors || {};
+        this.lastEditRow = null;
+        var store = new Ext.grid.PropertyStore(this);
+        this.propStore = store;
+        var cm = new Ext.grid.PropertyColumnModel(this, store);
+        store.store.sort('name', 'ASC');
+        this.addEvents(
+            /**
+             * @event beforepropertychange
+             * Fires before a property value changes.  Handlers can return false to cancel the property change
+             * (this will internally call {@link Ext.data.Record#reject} on the property's record).
+             * @param {Object} source The source data object for the grid (corresponds to the same object passed in
+             * as the {@link #source} config property).
+             * @param {String} recordId The record's id in the data store
+             * @param {Mixed} value The current edited property value
+             * @param {Mixed} oldValue The original property value prior to editing
+             */
+            'beforepropertychange',
+            /**
+             * @event propertychange
+             * Fires after a property value has changed.
+             * @param {Object} source The source data object for the grid (corresponds to the same object passed in
+             * as the {@link #source} config property).
+             * @param {String} recordId The record's id in the data store
+             * @param {Mixed} value The current edited property value
+             * @param {Mixed} oldValue The original property value prior to editing
+             */
+            'propertychange'
+        );
+        this.cm = cm;
+        this.ds = store.store;
+        Ext.grid.PropertyGrid.superclass.initComponent.call(this);
+
+               this.mon(this.selModel, 'beforecellselect', function(sm, rowIndex, colIndex){
+            if(colIndex === 0){
+                this.startEditing.defer(200, this, [rowIndex, 1]);
+                return false;
+            }
+        }, this);
+    },
+
+    // private
+    onRender : function(){
+        Ext.grid.PropertyGrid.superclass.onRender.apply(this, arguments);
+
+        this.getGridEl().addClass('x-props-grid');
+    },
+
+    // private
+    afterRender: function(){
+        Ext.grid.PropertyGrid.superclass.afterRender.apply(this, arguments);
+        if(this.source){
+            this.setSource(this.source);
+        }
+    },
+
+    /**
+     * Sets the source data object containing the property data.  The data object can contain one or more name/value
+     * pairs representing all of the properties of an object to display in the grid, and this data will automatically
+     * be loaded into the grid's {@link #store}.  The values should be supplied in the proper data type if needed,
+     * otherwise string type will be assumed.  If the grid already contains data, this method will replace any
+     * existing data.  See also the {@link #source} config value.  Example usage:
+     * <pre><code>
+grid.setSource({
+    "(name)": "My Object",
+    "Created": new Date(Date.parse('10/15/2006')),  // date type
+    "Available": false,  // boolean type
+    "Version": .01,      // decimal type
+    "Description": "A test object"
+});
+</code></pre>
+     * @param {Object} source The data object
+     */
+    setSource : function(source){
+        this.propStore.setSource(source);
+    },
+
+    /**
+     * Gets the source data object containing the property data.  See {@link #setSource} for details regarding the
+     * format of the data object.
+     * @return {Object} The data object
+     */
+    getSource : function(){
+        return this.propStore.getSource();
+    }
+});
+Ext.reg("propertygrid", Ext.grid.PropertyGrid);
+/**\r
+ * @class Ext.grid.GroupingView\r
+ * @extends Ext.grid.GridView\r
+ * Adds the ability for single level grouping to the grid. A {@link Ext.data.GroupingStore GroupingStore}\r
+ * must be used to enable grouping.  Some grouping characteristics may also be configured at the\r
+ * {@link Ext.grid.Column Column level}<div class="mdetail-params"><ul>\r
+ * <li><code>{@link Ext.grid.Column#emptyGroupText emptyGroupText}</li>\r
+ * <li><code>{@link Ext.grid.Column#groupable groupable}</li>\r
+ * <li><code>{@link Ext.grid.Column#groupName groupName}</li>\r
+ * <li><code>{@link Ext.grid.Column#groupRender groupRender}</li>\r
+ * </ul></div>\r
+ * <p>Sample usage:</p>\r
+ * <pre><code>\r
+var grid = new Ext.grid.GridPanel({\r
+    // A groupingStore is required for a GroupingView\r
+    store: new {@link Ext.data.GroupingStore}({\r
+        autoDestroy: true,\r
+        reader: reader,\r
+        data: xg.dummyData,\r
+        sortInfo: {field: 'company', direction: 'ASC'},\r
+        {@link Ext.data.GroupingStore#groupOnSort groupOnSort}: true,\r
+        {@link Ext.data.GroupingStore#remoteGroup remoteGroup}: true,\r
+        {@link Ext.data.GroupingStore#groupField groupField}: 'industry'\r
+    }),\r
+    colModel: new {@link Ext.grid.ColumnModel}({\r
+        columns:[\r
+            {id:'company',header: 'Company', width: 60, dataIndex: 'company'},\r
+            // {@link Ext.grid.Column#groupable groupable}, {@link Ext.grid.Column#groupName groupName}, {@link Ext.grid.Column#groupRender groupRender} are also configurable at column level\r
+            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price', {@link Ext.grid.Column#groupable groupable}: false},\r
+            {header: 'Change', dataIndex: 'change', renderer: Ext.util.Format.usMoney},\r
+            {header: 'Industry', dataIndex: 'industry'},\r
+            {header: 'Last Updated', renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}\r
+        ],\r
+        defaults: {\r
+            sortable: true,\r
+            menuDisabled: false,\r
+            width: 20\r
+        }\r
+    }),\r
+\r
+    view: new Ext.grid.GroupingView({\r
+        {@link Ext.grid.GridView#forceFit forceFit}: true,\r
+        // custom grouping text template to display the number of items per group\r
+        {@link #groupTextTpl}: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'\r
+    }),\r
+\r
+    frame:true,\r
+    width: 700,\r
+    height: 450,\r
+    collapsible: true,\r
+    animCollapse: false,\r
+    title: 'Grouping Example',\r
+    iconCls: 'icon-grid',\r
+    renderTo: document.body\r
 });\r
+ * </code></pre>\r
+ * @constructor\r
+ * @param {Object} config\r
+ */\r
+Ext.grid.GroupingView = Ext.extend(Ext.grid.GridView, {\r
 \r
-})();\r
+    /**\r
+     * @cfg {String} groupByText Text displayed in the grid header menu for grouping by a column\r
+     * (defaults to 'Group By This Field').\r
+     */\r
+    groupByText : 'Group By This Field',\r
+    /**\r
+     * @cfg {String} showGroupsText Text displayed in the grid header for enabling/disabling grouping\r
+     * (defaults to 'Show in Groups').\r
+     */\r
+    showGroupsText : 'Show in Groups',\r
+    /**\r
+     * @cfg {Boolean} hideGroupedColumn <tt>true</tt> to hide the column that is currently grouped (defaults to <tt>false</tt>)\r
+     */\r
+    hideGroupedColumn : false,\r
+    /**\r
+     * @cfg {Boolean} showGroupName If <tt>true</tt> will display a prefix plus a ': ' before the group field value\r
+     * in the group header line.  The prefix will consist of the <tt><b>{@link Ext.grid.Column#groupName groupName}</b></tt>\r
+     * (or the configured <tt><b>{@link Ext.grid.Column#header header}</b></tt> if not provided) configured in the\r
+     * {@link Ext.grid.Column} for each set of grouped rows (defaults to <tt>true</tt>).\r
+     */\r
+    showGroupName : true,\r
+    /**\r
+     * @cfg {Boolean} startCollapsed <tt>true</tt> to start all groups collapsed (defaults to <tt>false</tt>)\r
+     */\r
+    startCollapsed : false,\r
+    /**\r
+     * @cfg {Boolean} enableGrouping <tt>false</tt> to disable grouping functionality (defaults to <tt>true</tt>)\r
+     */\r
+    enableGrouping : true,\r
+    /**\r
+     * @cfg {Boolean} enableGroupingMenu <tt>true</tt> to enable the grouping control in the column menu (defaults to <tt>true</tt>)\r
+     */\r
+    enableGroupingMenu : true,\r
+    /**\r
+     * @cfg {Boolean} enableNoGroups <tt>true</tt> to allow the user to turn off grouping (defaults to <tt>true</tt>)\r
+     */\r
+    enableNoGroups : true,\r
+    /**\r
+     * @cfg {String} emptyGroupText The text to display when there is an empty group value (defaults to <tt>'(None)'</tt>).\r
+     * May also be specified per column, see {@link Ext.grid.Column}.{@link Ext.grid.Column#emptyGroupText emptyGroupText}.\r
+     */\r
+    emptyGroupText : '(None)',\r
+    /**\r
+     * @cfg {Boolean} ignoreAdd <tt>true</tt> to skip refreshing the view when new rows are added (defaults to <tt>false</tt>)\r
+     */\r
+    ignoreAdd : false,\r
+    /**\r
+     * @cfg {String} groupTextTpl The template used to render the group header (defaults to <tt>'{text}'</tt>).\r
+     * This is used to format an object which contains the following properties:\r
+     * <div class="mdetail-params"><ul>\r
+     * <li><b>group</b> : String<p class="sub-desc">The <i>rendered</i> value of the group field.\r
+     * By default this is the unchanged value of the group field. If a <tt><b>{@link Ext.grid.Column#groupRenderer groupRenderer}</b></tt>\r
+     * is specified, it is the result of a call to that function.</p></li>\r
+     * <li><b>gvalue</b> : Object<p class="sub-desc">The <i>raw</i> value of the group field.</p></li>\r
+     * <li><b>text</b> : String<p class="sub-desc">The configured header (as described in <tt>{@link #showGroupName})</tt>\r
+     * if <tt>{@link #showGroupName}</tt> is <tt>true</tt>) plus the <i>rendered</i> group field value.</p></li>\r
+     * <li><b>groupId</b> : String<p class="sub-desc">A unique, generated ID which is applied to the\r
+     * View Element which contains the group.</p></li>\r
+     * <li><b>startRow</b> : Number<p class="sub-desc">The row index of the Record which caused group change.</p></li>\r
+     * <li><b>rs</b> : Array<p class="sub-desc">Contains a single element: The Record providing the data\r
+     * for the row which caused group change.</p></li>\r
+     * <li><b>cls</b> : String<p class="sub-desc">The generated class name string to apply to the group header Element.</p></li>\r
+     * <li><b>style</b> : String<p class="sub-desc">The inline style rules to apply to the group header Element.</p></li>\r
+     * </ul></div></p>\r
+     * See {@link Ext.XTemplate} for information on how to format data using a template. Possible usage:<pre><code>\r
+var grid = new Ext.grid.GridPanel({\r
+    ...\r
+    view: new Ext.grid.GroupingView({\r
+        groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'\r
+    }),\r
+});\r
+     * </code></pre>\r
+     */\r
+    groupTextTpl : '{text}',\r
+    /**\r
+     * @cfg {Function} groupRenderer This property must be configured in the {@link Ext.grid.Column} for\r
+     * each column.\r
+     */\r
 \r
+    // private\r
+    gidSeed : 1000,\r
 \r
-Ext.debug.ScriptsPanel = Ext.extend(Ext.Panel, {\r
-    id:'x-debug-scripts',\r
-    region: 'east',\r
-    minWidth: 200,\r
-    split: true,\r
-    width: 350,\r
-    border: false,\r
-    layout:'anchor',\r
-    style:'border-width:0 0 0 1px;',\r
+    // private\r
+    initTemplates : function(){\r
+        Ext.grid.GroupingView.superclass.initTemplates.call(this);\r
+        this.state = {};\r
 \r
-    initComponent : function(){\r
+        var sm = this.grid.getSelectionModel();\r
+        sm.on(sm.selectRow ? 'beforerowselect' : 'beforecellselect',\r
+                this.onBeforeRowSelect, this);\r
 \r
-        this.scriptField = new Ext.form.TextArea({\r
-            anchor: '100% -26',\r
-            style:'border-width:0;'\r
-        });\r
+        if(!this.startGroup){\r
+            this.startGroup = new Ext.XTemplate(\r
+                '<div id="{groupId}" class="x-grid-group {cls}">',\r
+                    '<div id="{groupId}-hd" class="x-grid-group-hd" style="{style}"><div class="x-grid-group-title">', this.groupTextTpl ,'</div></div>',\r
+                    '<div id="{groupId}-bd" class="x-grid-group-body">'\r
+            );\r
+        }\r
+        this.startGroup.compile();\r
+        this.endGroup = '</div></div>';\r
+    },\r
 \r
-        this.trapBox = new Ext.form.Checkbox({\r
-            id: 'console-trap',\r
-            boxLabel: 'Trap Errors',\r
-            checked: true\r
-        });\r
+    // private\r
+    findGroup : function(el){\r
+        return Ext.fly(el).up('.x-grid-group', this.mainBody.dom);\r
+    },\r
 \r
-        this.toolbar = new Ext.Toolbar([{\r
-                text: 'Run',\r
-                scope: this,\r
-                handler: this.evalScript\r
-            },{\r
-                text: 'Clear',\r
+    // private\r
+    getGroups : function(){\r
+        return this.hasRows() ? this.mainBody.dom.childNodes : [];\r
+    },\r
+\r
+    // private\r
+    onAdd : function(){\r
+        if(this.enableGrouping && !this.ignoreAdd){\r
+            var ss = this.getScrollState();\r
+            this.refresh();\r
+            this.restoreScroll(ss);\r
+        }else if(!this.enableGrouping){\r
+            Ext.grid.GroupingView.superclass.onAdd.apply(this, arguments);\r
+        }\r
+    },\r
+\r
+    // private\r
+    onRemove : function(ds, record, index, isUpdate){\r
+        Ext.grid.GroupingView.superclass.onRemove.apply(this, arguments);\r
+        var g = document.getElementById(record._groupId);\r
+        if(g && g.childNodes[1].childNodes.length < 1){\r
+            Ext.removeNode(g);\r
+        }\r
+        this.applyEmptyText();\r
+    },\r
+\r
+    // private\r
+    refreshRow : function(record){\r
+        if(this.ds.getCount()==1){\r
+            this.refresh();\r
+        }else{\r
+            this.isUpdating = true;\r
+            Ext.grid.GroupingView.superclass.refreshRow.apply(this, arguments);\r
+            this.isUpdating = false;\r
+        }\r
+    },\r
+\r
+    // private\r
+    beforeMenuShow : function(){\r
+        var item, items = this.hmenu.items, disabled = this.cm.config[this.hdCtxIndex].groupable === false;\r
+        if((item = items.get('groupBy'))){\r
+            item.setDisabled(disabled);\r
+        }\r
+        if((item = items.get('showGroups'))){\r
+            item.setDisabled(disabled);\r
+                   item.setChecked(!!this.getGroupField(), true);\r
+        }\r
+    },\r
+\r
+    // private\r
+    renderUI : function(){\r
+        Ext.grid.GroupingView.superclass.renderUI.call(this);\r
+        this.mainBody.on('mousedown', this.interceptMouse, this);\r
+\r
+        if(this.enableGroupingMenu && this.hmenu){\r
+            this.hmenu.add('-',{\r
+                itemId:'groupBy',\r
+                text: this.groupByText,\r
+                handler: this.onGroupByClick,\r
                 scope: this,\r
-                handler: this.clear\r
-            },\r
-            '->',\r
-            this.trapBox,\r
-            ' ', ' '\r
-        ]);\r
+                iconCls:'x-group-by-icon'\r
+            });\r
+            if(this.enableNoGroups){\r
+                this.hmenu.add({\r
+                    itemId:'showGroups',\r
+                    text: this.showGroupsText,\r
+                    checked: true,\r
+                    checkHandler: this.onShowGroupsClick,\r
+                    scope: this\r
+                });\r
+            }\r
+            this.hmenu.on('beforeshow', this.beforeMenuShow, this);\r
+        }\r
+    },\r
+\r
+    // private\r
+    onGroupByClick : function(){\r
+        this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));\r
+        this.beforeMenuShow(); // Make sure the checkboxes get properly set when changing groups\r
+    },\r
 \r
-        this.items = [this.toolbar, this.scriptField];\r
+    // private\r
+    onShowGroupsClick : function(mi, checked){\r
+        if(checked){\r
+            this.onGroupByClick();\r
+        }else{\r
+            this.grid.store.clearGrouping();\r
+        }\r
+    },\r
 \r
-        Ext.debug.ScriptsPanel.superclass.initComponent.call(this);\r
+    /**\r
+     * Toggles the specified group if no value is passed, otherwise sets the expanded state of the group to the value passed.\r
+     * @param {String} groupId The groupId assigned to the group (see getGroupId)\r
+     * @param {Boolean} expanded (optional)\r
+     */\r
+    toggleGroup : function(group, expanded){\r
+        this.grid.stopEditing(true);\r
+        group = Ext.getDom(group);\r
+        var gel = Ext.fly(group);\r
+        expanded = expanded !== undefined ?\r
+                expanded : gel.hasClass('x-grid-group-collapsed');\r
+\r
+        this.state[gel.dom.id] = expanded;\r
+        gel[expanded ? 'removeClass' : 'addClass']('x-grid-group-collapsed');\r
     },\r
 \r
-    evalScript : function(){\r
-        var s = this.scriptField.getValue();\r
-        if(this.trapBox.getValue()){\r
-            try{\r
-                var rt = eval(s);\r
-                Ext.dump(rt === undefined? '(no return)' : rt);\r
-            }catch(e){\r
-                Ext.log(e.message || e.descript);\r
-            }\r
-        }else{\r
-            var rt = eval(s);\r
-            Ext.dump(rt === undefined? '(no return)' : rt);\r
+    /**\r
+     * Toggles all groups if no value is passed, otherwise sets the expanded state of all groups to the value passed.\r
+     * @param {Boolean} expanded (optional)\r
+     */\r
+    toggleAllGroups : function(expanded){\r
+        var groups = this.getGroups();\r
+        for(var i = 0, len = groups.length; i < len; i++){\r
+            this.toggleGroup(groups[i], expanded);\r
         }\r
     },\r
 \r
-    clear : function(){\r
-        this.scriptField.setValue('');\r
-        this.scriptField.focus();\r
-    }\r
-\r
-});\r
+    /**\r
+     * Expands all grouped rows.\r
+     */\r
+    expandAllGroups : function(){\r
+        this.toggleAllGroups(true);\r
+    },\r
 \r
-Ext.debug.LogPanel = Ext.extend(Ext.Panel, {\r
-    autoScroll: true,\r
-    region: 'center',\r
-    border: false,\r
-    style:'border-width:0 1px 0 0',\r
+    /**\r
+     * Collapses all grouped rows.\r
+     */\r
+    collapseAllGroups : function(){\r
+        this.toggleAllGroups(false);\r
+    },\r
 \r
-    log : function(){\r
-        var markup = [  '<div style="padding:5px !important;border-bottom:1px solid #ccc;">',\r
-                    Ext.util.Format.htmlEncode(Array.prototype.join.call(arguments, ', ')).replace(/\n/g, '<br />').replace(/\s/g, '&#160;'),\r
-                    '</div>'].join('');\r
+    // private\r
+    interceptMouse : function(e){\r
+        var hd = e.getTarget('.x-grid-group-hd', this.mainBody);\r
+        if(hd){\r
+            e.stopEvent();\r
+            this.toggleGroup(hd.parentNode);\r
+        }\r
+    },\r
 \r
-        this.body.insertHtml('beforeend', markup);\r
-        this.body.scrollTo('top', 100000);\r
+    // private\r
+    getGroup : function(v, r, groupRenderer, rowIndex, colIndex, ds){\r
+        var g = groupRenderer ? groupRenderer(v, {}, r, rowIndex, colIndex, ds) : String(v);\r
+        if(g === ''){\r
+            g = this.cm.config[colIndex].emptyGroupText || this.emptyGroupText;\r
+        }\r
+        return g;\r
     },\r
 \r
-    clear : function(){\r
-        this.body.update('');\r
-        this.body.dom.scrollTop = 0;\r
-    }\r
-});\r
+    // private\r
+    getGroupField : function(){\r
+        return this.grid.store.getGroupState();\r
+    },\r
+    \r
+    // private\r
+    afterRender : function(){\r
+        Ext.grid.GroupingView.superclass.afterRender.call(this);\r
+        if(this.grid.deferRowRender){\r
+            this.updateGroupWidths();\r
+        }\r
+    },\r
 \r
-Ext.debug.DomTree = Ext.extend(Ext.tree.TreePanel, {\r
-    enableDD:false ,\r
-    lines:false,\r
-    rootVisible:false,\r
-    animate:false,\r
-    hlColor:'ffff9c',\r
-    autoScroll: true,\r
-    region:'center',\r
-    border:false,\r
+    // private\r
+    renderRows : function(){\r
+        var groupField = this.getGroupField();\r
+        var eg = !!groupField;\r
+        // if they turned off grouping and the last grouped field is hidden\r
+        if(this.hideGroupedColumn) {\r
+            var colIndex = this.cm.findColumnIndex(groupField);\r
+            if(!eg && this.lastGroupField !== undefined) {\r
+                this.mainBody.update('');\r
+                this.cm.setHidden(this.cm.findColumnIndex(this.lastGroupField), false);\r
+                delete this.lastGroupField;\r
+            }else if (eg && this.lastGroupField === undefined) {\r
+                this.lastGroupField = groupField;\r
+                this.cm.setHidden(colIndex, true);\r
+            }else if (eg && this.lastGroupField !== undefined && groupField !== this.lastGroupField) {\r
+                this.mainBody.update('');\r
+                var oldIndex = this.cm.findColumnIndex(this.lastGroupField);\r
+                this.cm.setHidden(oldIndex, false);\r
+                this.lastGroupField = groupField;\r
+                this.cm.setHidden(colIndex, true);\r
+            }\r
+        }\r
+        return Ext.grid.GroupingView.superclass.renderRows.apply(\r
+                    this, arguments);\r
+    },\r
 \r
-    initComponent : function(){\r
+    // private\r
+    doRender : function(cs, rs, ds, startRow, colCount, stripe){\r
+        if(rs.length < 1){\r
+            return '';\r
+        }\r
+        var groupField = this.getGroupField(),\r
+            colIndex = this.cm.findColumnIndex(groupField),\r
+            g;\r
 \r
+        this.enableGrouping = !!groupField;\r
 \r
-        Ext.debug.DomTree.superclass.initComponent.call(this);\r
-        \r
-        // tree related stuff\r
-        var styles = false, hnode;\r
-        var nonSpace = /^\s*$/;\r
-        var html = Ext.util.Format.htmlEncode;\r
-        var ellipsis = Ext.util.Format.ellipsis;\r
-        var styleRe = /\s?([a-z\-]*)\:([^;]*)(?:[;\s\n\r]*)/gi;\r
-\r
-        function findNode(n){\r
-            if(!n || n.nodeType != 1 || n == document.body || n == document){\r
-                return false;\r
-            }\r
-            var pn = [n], p = n;\r
-            while((p = p.parentNode) && p.nodeType == 1 && p.tagName.toUpperCase() != 'HTML'){\r
-                pn.unshift(p);\r
-            }\r
-            var cn = hnode;\r
-            for(var i = 0, len = pn.length; i < len; i++){\r
-                cn.expand();\r
-                cn = cn.findChild('htmlNode', pn[i]);\r
-                if(!cn){ // in this dialog?\r
-                    return false;\r
-                }\r
-            }\r
-            cn.select();\r
-            var a = cn.ui.anchor;\r
-            treeEl.dom.scrollTop = Math.max(0 ,a.offsetTop-10);\r
-            //treeEl.dom.scrollLeft = Math.max(0 ,a.offsetLeft-10); no likey\r
-            cn.highlight();\r
-            return true;\r
+        if(!this.enableGrouping || this.isUpdating){\r
+            return Ext.grid.GroupingView.superclass.doRender.apply(\r
+                    this, arguments);\r
         }\r
+        var gstyle = 'width:'+this.getTotalWidth()+';';\r
 \r
-        function nodeTitle(n){\r
-            var s = n.tagName;\r
-            if(n.id){\r
-                s += '#'+n.id;\r
-            }else if(n.className){\r
-                s += '.'+n.className;\r
-            }\r
-            return s;\r
-        }\r
+        var gidPrefix = this.grid.getGridEl().id;\r
+        var cfg = this.cm.config[colIndex];\r
+        var groupRenderer = cfg.groupRenderer || cfg.renderer;\r
+        var prefix = this.showGroupName ?\r
+                     (cfg.groupName || cfg.header)+': ' : '';\r
 \r
-        function onNodeSelect(t, n, last){\r
-            return;\r
-            if(last && last.unframe){\r
-                last.unframe();\r
-            }\r
-            var props = {};\r
-            if(n && n.htmlNode){\r
-                if(frameEl.pressed){\r
-                    n.frame();\r
-                }\r
-                if(inspecting){\r
-                    return;\r
-                }\r
-                addStyle.enable();\r
-                reload.setDisabled(n.leaf);\r
-                var dom = n.htmlNode;\r
-                stylePanel.setTitle(nodeTitle(dom));\r
-                if(styles && !showAll.pressed){\r
-                    var s = dom.style ? dom.style.cssText : '';\r
-                    if(s){\r
-                        var m;\r
-                        while ((m = styleRe.exec(s)) != null){\r
-                            props[m[1].toLowerCase()] = m[2];\r
-                        }\r
-                    }\r
-                }else if(styles){\r
-                    var cl = Ext.debug.cssList;\r
-                    var s = dom.style, fly = Ext.fly(dom);\r
-                    if(s){\r
-                        for(var i = 0, len = cl.length; i<len; i++){\r
-                            var st = cl[i];\r
-                            var v = s[st] || fly.getStyle(st);\r
-                            if(v != undefined && v !== null && v !== ''){\r
-                                props[st] = v;\r
-                            }\r
-                        }\r
-                    }\r
-                }else{\r
-                    for(var a in dom){\r
-                        var v = dom[a];\r
-                        if((isNaN(a+10)) && v != undefined && v !== null && v !== '' && !(Ext.isGecko && a[0] == a[0].toUpperCase())){\r
-                            props[a] = v;\r
-                        }\r
-                    }\r
-                }\r
+        var groups = [], curGroup, i, len, gid;\r
+        for(i = 0, len = rs.length; i < len; i++){\r
+            var rowIndex = startRow + i,\r
+                r = rs[i],\r
+                gvalue = r.data[groupField];\r
+                \r
+                g = this.getGroup(gvalue, r, groupRenderer, rowIndex, colIndex, ds);\r
+            if(!curGroup || curGroup.group != g){\r
+                gid = gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(g);\r
+                       // if state is defined use it, however state is in terms of expanded\r
+                               // so negate it, otherwise use the default.\r
+                               var isCollapsed  = typeof this.state[gid] !== 'undefined' ? !this.state[gid] : this.startCollapsed;\r
+                               var gcls = isCollapsed ? 'x-grid-group-collapsed' : ''; \r
+                curGroup = {\r
+                    group: g,\r
+                    gvalue: gvalue,\r
+                    text: prefix + g,\r
+                    groupId: gid,\r
+                    startRow: rowIndex,\r
+                    rs: [r],\r
+                    cls: gcls,\r
+                    style: gstyle\r
+                };\r
+                groups.push(curGroup);\r
             }else{\r
-                if(inspecting){\r
-                    return;\r
-                }\r
-                addStyle.disable();\r
-                reload.disabled();\r
+                curGroup.rs.push(r);\r
             }\r
-            stylesGrid.setSource(props);\r
-            stylesGrid.treeNode = n;\r
-            stylesGrid.view.fitColumns();\r
+            r._groupId = gid;\r
         }\r
 \r
-        this.loader = new Ext.tree.TreeLoader();\r
-        this.loader.load = function(n, cb){\r
-            var isBody = n.htmlNode == document.body;\r
-            var cn = n.htmlNode.childNodes;\r
-            for(var i = 0, c; c = cn[i]; i++){\r
-                if(isBody && c.id == 'x-debug-browser'){\r
-                    continue;\r
-                }\r
-                if(c.nodeType == 1){\r
-                    n.appendChild(new Ext.debug.HtmlNode(c));\r
-                }else if(c.nodeType == 3 && !nonSpace.test(c.nodeValue)){\r
-                    n.appendChild(new Ext.tree.TreeNode({\r
-                        text:'<em>' + ellipsis(html(String(c.nodeValue)), 35) + '</em>',\r
-                        cls: 'x-tree-noicon'\r
-                    }));\r
-                }\r
-            }\r
-            cb();\r
-        };\r
-\r
-        //tree.getSelectionModel().on('selectionchange', onNodeSelect, null, {buffer:250});\r
+        var buf = [];\r
+        for(i = 0, len = groups.length; i < len; i++){\r
+            g = groups[i];\r
+            this.doGroupStart(buf, g, cs, ds, colCount);\r
+            buf[buf.length] = Ext.grid.GroupingView.superclass.doRender.call(\r
+                    this, cs, g.rs, ds, g.startRow, colCount, stripe);\r
 \r
-        this.root = this.setRootNode(new Ext.tree.TreeNode('Ext'));\r
+            this.doGroupEnd(buf, g, cs, ds, colCount);\r
+        }\r
+        return buf.join('');\r
+    },\r
 \r
-        hnode = this.root.appendChild(new Ext.debug.HtmlNode(\r
-                document.getElementsByTagName('html')[0]\r
-        ));\r
+    /**\r
+     * Dynamically tries to determine the groupId of a specific value\r
+     * @param {String} value\r
+     * @return {String} The group id\r
+     */\r
+    getGroupId : function(value){\r
+        var gidPrefix = this.grid.getGridEl().id;\r
+        var groupField = this.getGroupField();\r
+        var colIndex = this.cm.findColumnIndex(groupField);\r
+        var cfg = this.cm.config[colIndex];\r
+        var groupRenderer = cfg.groupRenderer || cfg.renderer;\r
+        var gtext = this.getGroup(value, {data:{}}, groupRenderer, 0, colIndex, this.ds);\r
+        return gidPrefix + '-gp-' + groupField + '-' + Ext.util.Format.htmlEncode(value);\r
+    },\r
 \r
-    }\r
-});\r
+    // private\r
+    doGroupStart : function(buf, g, cs, ds, colCount){\r
+        buf[buf.length] = this.startGroup.apply(g);\r
+    },\r
 \r
+    // private\r
+    doGroupEnd : function(buf, g, cs, ds, colCount){\r
+        buf[buf.length] = this.endGroup;\r
+    },\r
 \r
-// highly unusual class declaration\r
-Ext.debug.HtmlNode = function(){\r
-    var html = Ext.util.Format.htmlEncode;\r
-    var ellipsis = Ext.util.Format.ellipsis;\r
-    var nonSpace = /^\s*$/;\r
-\r
-    var attrs = [\r
-        {n: 'id', v: 'id'},\r
-        {n: 'className', v: 'class'},\r
-        {n: 'name', v: 'name'},\r
-        {n: 'type', v: 'type'},\r
-        {n: 'src', v: 'src'},\r
-        {n: 'href', v: 'href'}\r
-    ];\r
-\r
-    function hasChild(n){\r
-        for(var i = 0, c; c = n.childNodes[i]; i++){\r
-            if(c.nodeType == 1){\r
-                return true;\r
-            }\r
+    // private\r
+    getRows : function(){\r
+        if(!this.enableGrouping){\r
+            return Ext.grid.GroupingView.superclass.getRows.call(this);\r
         }\r
-        return false;\r
-    }\r
-\r
-    function renderNode(n, leaf){\r
-        var tag = n.tagName.toLowerCase();\r
-        var s = '&lt;' + tag;\r
-        for(var i = 0, len = attrs.length; i < len; i++){\r
-            var a = attrs[i];\r
-            var v = n[a.n];\r
-            if(v && !nonSpace.test(v)){\r
-                s += ' ' + a.v + '=&quot;<i>' + html(v) +'</i>&quot;';\r
+        var r = [];\r
+        var g, gs = this.getGroups();\r
+        for(var i = 0, len = gs.length; i < len; i++){\r
+            g = gs[i].childNodes[1].childNodes;\r
+            for(var j = 0, jlen = g.length; j < jlen; j++){\r
+                r[r.length] = g[j];\r
             }\r
         }\r
-        var style = n.style ? n.style.cssText : '';\r
-        if(style){\r
-            s += ' style=&quot;<i>' + html(style.toLowerCase()) +'</i>&quot;';\r
-        }\r
-        if(leaf && n.childNodes.length > 0){\r
-            s+='&gt;<em>' + ellipsis(html(String(n.innerHTML)), 35) + '</em>&lt;/'+tag+'&gt;';\r
-        }else if(leaf){\r
-            s += ' /&gt;';\r
-        }else{\r
-            s += '&gt;';\r
-        }\r
-        return s;\r
-    }\r
+        return r;\r
+    },\r
 \r
-    var HtmlNode = function(n){\r
-        var leaf = !hasChild(n);\r
-        this.htmlNode = n;\r
-        this.tagName = n.tagName.toLowerCase();\r
-        var attr = {\r
-            text : renderNode(n, leaf),\r
-            leaf : leaf,\r
-            cls: 'x-tree-noicon'\r
-        };\r
-        HtmlNode.superclass.constructor.call(this, attr);\r
-        this.attributes.htmlNode = n; // for searching\r
-        if(!leaf){\r
-            this.on('expand', this.onExpand,  this);\r
-            this.on('collapse', this.onCollapse,  this);\r
+    // private\r
+    updateGroupWidths : function(){\r
+        if(!this.enableGrouping || !this.hasRows()){\r
+            return;\r
         }\r
-    };\r
-\r
-\r
-    Ext.extend(HtmlNode, Ext.tree.AsyncTreeNode, {\r
-        cls: 'x-tree-noicon',\r
-        preventHScroll: true,\r
-        refresh : function(highlight){\r
-            var leaf = !hasChild(this.htmlNode);\r
-            this.setText(renderNode(this.htmlNode, leaf));\r
-            if(highlight){\r
-                Ext.fly(this.ui.textNode).highlight();\r
-            }\r
-        },\r
-\r
-        onExpand : function(){\r
-            if(!this.closeNode && this.parentNode){\r
-                this.closeNode = this.parentNode.insertBefore(new Ext.tree.TreeNode({\r
-                    text:'&lt;/' + this.tagName + '&gt;',\r
-                    cls: 'x-tree-noicon'\r
-                }), this.nextSibling);\r
-            }else if(this.closeNode){\r
-                this.closeNode.ui.show();\r
-            }\r
-        },\r
-\r
-        onCollapse : function(){\r
-            if(this.closeNode){\r
-                this.closeNode.ui.hide();\r
-            }\r
-        },\r
+        var tw = Math.max(this.cm.getTotalWidth(), this.el.dom.offsetWidth-this.scrollOffset) +'px';\r
+        var gs = this.getGroups();\r
+        for(var i = 0, len = gs.length; i < len; i++){\r
+            gs[i].firstChild.style.width = tw;\r
+        }\r
+    },\r
 \r
-        render : function(bulkRender){\r
-            HtmlNode.superclass.render.call(this, bulkRender);\r
-        },\r
+    // private\r
+    onColumnWidthUpdated : function(col, w, tw){\r
+        Ext.grid.GroupingView.superclass.onColumnWidthUpdated.call(this, col, w, tw);\r
+        this.updateGroupWidths();\r
+    },\r
 \r
-        highlightNode : function(){\r
-            //Ext.fly(this.htmlNode).highlight();\r
-        },\r
+    // private\r
+    onAllColumnWidthsUpdated : function(ws, tw){\r
+        Ext.grid.GroupingView.superclass.onAllColumnWidthsUpdated.call(this, ws, tw);\r
+        this.updateGroupWidths();\r
+    },\r
 \r
-        highlight : function(){\r
-            //Ext.fly(this.ui.textNode).highlight();\r
-        },\r
+    // private\r
+    onColumnHiddenUpdated : function(col, hidden, tw){\r
+        Ext.grid.GroupingView.superclass.onColumnHiddenUpdated.call(this, col, hidden, tw);\r
+        this.updateGroupWidths();\r
+    },\r
 \r
-        frame : function(){\r
-            this.htmlNode.style.border = '1px solid #0000ff';\r
-            //this.highlightNode();\r
-        },\r
+    // private\r
+    onLayout : function(){\r
+        this.updateGroupWidths();\r
+    },\r
 \r
-        unframe : function(){\r
-            //Ext.fly(this.htmlNode).removeClass('x-debug-frame');\r
-            this.htmlNode.style.border = '';\r
+    // private\r
+    onBeforeRowSelect : function(sm, rowIndex){\r
+        if(!this.enableGrouping){\r
+            return;\r
         }\r
-    });\r
-\r
-    return HtmlNode;\r
-}();\r
-\r
-\r
-\r
+        var row = this.getRow(rowIndex);\r
+        if(row && !row.offsetParent){\r
+            var g = this.findGroup(row);\r
+            this.toggleGroup(g, true);\r
+        }\r
+    }\r
+});\r
+// private\r
+Ext.grid.GroupingView.GROUP_ID = 1000;
\ No newline at end of file