roojs-core-debug.js
authorAlan Knowles <alan@akbkhome.com>
Wed, 9 Feb 2011 07:59:30 +0000 (15:59 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 9 Feb 2011 07:59:30 +0000 (15:59 +0800)
roojs-core-debug.js

index 7baf63c..648d7b5 100644 (file)
@@ -6684,4 +6684,6723 @@ Roo.EventObject = function(){
     return new Roo.EventObjectImpl();
 }();
             
-    
\ No newline at end of file
+    /*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+// was in Composite Element!??!?!
+(function(){
+    var D = Roo.lib.Dom;
+    var E = Roo.lib.Event;
+    var A = Roo.lib.Anim;
+
+    // local style camelizing for speed
+    var propCache = {};
+    var camelRe = /(-[a-z])/gi;
+    var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
+    var view = document.defaultView;
+
+/**
+ * @class Roo.Element
+ * Represents an Element in the DOM.<br><br>
+ * Usage:<br>
+<pre><code>
+var el = Roo.get("my-div");
+
+// or with getEl
+var el = getEl("my-div");
+
+// or with a DOM element
+var el = Roo.get(myDivElement);
+</code></pre>
+ * Using Roo.get() or getEl() instead of calling the constructor directly ensures you get the same object
+ * each call instead of constructing a new one.<br><br>
+ * <b>Animations</b><br />
+ * Many of the functions for manipulating an element have an optional "animate" parameter. The animate parameter
+ * should either be a boolean (true) or an object literal with animation options. The animation options are:
+<pre>
+Option    Default   Description
+--------- --------  ---------------------------------------------
+duration  .35       The duration of the animation in seconds
+easing    easeOut   The YUI easing method
+callback  none      A function to execute when the anim completes
+scope     this      The scope (this) of the callback function
+</pre>
+* Also, the Anim object being used for the animation will be set on your options object as "anim", which allows you to stop or
+* manipulate the animation. Here's an example:
+<pre><code>
+var el = Roo.get("my-div");
+
+// no animation
+el.setWidth(100);
+
+// default animation
+el.setWidth(100, true);
+
+// animation with some options set
+el.setWidth(100, {
+    duration: 1,
+    callback: this.foo,
+    scope: this
+});
+
+// using the "anim" property to get the Anim object
+var opt = {
+    duration: 1,
+    callback: this.foo,
+    scope: this
+};
+el.setWidth(100, opt);
+...
+if(opt.anim.isAnimated()){
+    opt.anim.stop();
+}
+</code></pre>
+* <b> Composite (Collections of) Elements</b><br />
+ * For working with collections of Elements, see <a href="Roo.CompositeElement.html">Roo.CompositeElement</a>
+ * @constructor Create a new Element directly.
+ * @param {String/HTMLElement} element
+ * @param {Boolean} forceNew (optional) By default the constructor checks to see if there is already an instance of this element in the cache and if there is it returns the same instance. This will skip that check (useful for extending this class).
+ */
+    Roo.Element = function(element, forceNew){
+        var dom = typeof element == "string" ?
+                document.getElementById(element) : element;
+        if(!dom){ // invalid id/element
+            return null;
+        }
+        var id = dom.id;
+        if(forceNew !== true && id && Roo.Element.cache[id]){ // element object already exists
+            return Roo.Element.cache[id];
+        }
+
+        /**
+         * The DOM element
+         * @type HTMLElement
+         */
+        this.dom = dom;
+
+        /**
+         * The DOM element ID
+         * @type String
+         */
+        this.id = id || Roo.id(dom);
+    };
+
+    var El = Roo.Element;
+
+    El.prototype = {
+        /**
+         * The element's default display mode  (defaults to "")
+         * @type String
+         */
+        originalDisplay : "",
+
+        visibilityMode : 1,
+        /**
+         * The default unit to append to CSS values where a unit isn't provided (defaults to px).
+         * @type String
+         */
+        defaultUnit : "px",
+        /**
+         * Sets the element's visibility mode. When setVisible() is called it
+         * will use this to determine whether to set the visibility or the display property.
+         * @param visMode Element.VISIBILITY or Element.DISPLAY
+         * @return {Roo.Element} this
+         */
+        setVisibilityMode : function(visMode){
+            this.visibilityMode = visMode;
+            return this;
+        },
+        /**
+         * Convenience method for setVisibilityMode(Element.DISPLAY)
+         * @param {String} display (optional) What to set display to when visible
+         * @return {Roo.Element} this
+         */
+        enableDisplayMode : function(display){
+            this.setVisibilityMode(El.DISPLAY);
+            if(typeof display != "undefined") this.originalDisplay = display;
+            return this;
+        },
+
+        /**
+         * 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)
+         * @param {String} selector The simple selector to test
+         * @param {Number/String/HTMLElement/Element} 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 Roo.Element object instead of DOM node
+         * @return {HTMLElement} The matching DOM node (or null if no match was found)
+         */
+        findParent : function(simpleSelector, maxDepth, returnEl){
+            var p = this.dom, b = document.body, depth = 0, dq = Roo.DomQuery, stopEl;
+            maxDepth = maxDepth || 50;
+            if(typeof maxDepth != "number"){
+                stopEl = Roo.getDom(maxDepth);
+                maxDepth = 10;
+            }
+            while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){
+                if(dq.is(p, simpleSelector)){
+                    return returnEl ? Roo.get(p) : p;
+                }
+                depth++;
+                p = p.parentNode;
+            }
+            return null;
+        },
+
+
+        /**
+         * Looks at parent nodes for a match of the passed simple selector (e.g. div.some-class or span:first-child)
+         * @param {String} selector The simple selector to test
+         * @param {Number/String/HTMLElement/Element} 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 Roo.Element object instead of DOM node
+         * @return {HTMLElement} The matching DOM node (or null if no match was found)
+         */
+        findParentNode : function(simpleSelector, maxDepth, returnEl){
+            var p = Roo.fly(this.dom.parentNode, '_internal');
+            return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null;
+        },
+
+        /**
+         * Walks up the dom looking for a parent node that matches the passed simple selector (e.g. div.some-class or span:first-child).
+         * This is a shortcut for findParentNode() that always returns an Roo.Element.
+         * @param {String} selector The simple selector to test
+         * @param {Number/String/HTMLElement/Element} maxDepth (optional) The max depth to
+                search as a number or element (defaults to 10 || document.body)
+         * @return {Roo.Element} The matching DOM node (or null if no match was found)
+         */
+        up : function(simpleSelector, maxDepth){
+            return this.findParentNode(simpleSelector, maxDepth, true);
+        },
+
+
+
+        /**
+         * Returns true if this element matches the passed simple selector (e.g. div.some-class or span:first-child)
+         * @param {String} selector The simple selector to test
+         * @return {Boolean} True if this element matches the selector, else false
+         */
+        is : function(simpleSelector){
+            return Roo.DomQuery.is(this.dom, simpleSelector);
+        },
+
+        /**
+         * Perform animation on this element.
+         * @param {Object} args The YUI animation control args
+         * @param {Float} duration (optional) How long the animation lasts in seconds (defaults to .35)
+         * @param {Function} onComplete (optional) Function to call when animation completes
+         * @param {String} easing (optional) Easing method to use (defaults to 'easeOut')
+         * @param {String} animType (optional) 'run' is the default. Can also be 'color', 'motion', or 'scroll'
+         * @return {Roo.Element} this
+         */
+        animate : function(args, duration, onComplete, easing, animType){
+            this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType);
+            return this;
+        },
+
+        /*
+         * @private Internal animation call
+         */
+        anim : function(args, opt, animType, defaultDur, defaultEase, cb){
+            animType = animType || 'run';
+            opt = opt || {};
+            var anim = Roo.lib.Anim[animType](
+                this.dom, args,
+                (opt.duration || defaultDur) || .35,
+                (opt.easing || defaultEase) || 'easeOut',
+                function(){
+                    Roo.callback(cb, this);
+                    Roo.callback(opt.callback, opt.scope || this, [this, opt]);
+                },
+                this
+            );
+            opt.anim = anim;
+            return anim;
+        },
+
+        // private legacy anim prep
+        preanim : function(a, i){
+            return !a[i] ? false : (typeof a[i] == "object" ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]});
+        },
+
+        /**
+         * Removes worthless text nodes
+         * @param {Boolean} forceReclean (optional) By default the element
+         * keeps track if it has been cleaned already so
+         * you can call this over and over. However, if you update the element and
+         * need to force a reclean, you can pass true.
+         */
+        clean : function(forceReclean){
+            if(this.isCleaned && forceReclean !== true){
+                return this;
+            }
+            var ns = /\S/;
+            var d = this.dom, n = d.firstChild, ni = -1;
+            while(n){
+                var nx = n.nextSibling;
+                if(n.nodeType == 3 && !ns.test(n.nodeValue)){
+                    d.removeChild(n);
+                }else{
+                    n.nodeIndex = ++ni;
+                }
+                n = nx;
+            }
+            this.isCleaned = true;
+            return this;
+        },
+
+        // private
+        calcOffsetsTo : function(el){
+            el = Roo.get(el);
+            var d = el.dom;
+            var restorePos = false;
+            if(el.getStyle('position') == 'static'){
+                el.position('relative');
+                restorePos = true;
+            }
+            var x = 0, y =0;
+            var op = this.dom;
+            while(op && op != d && op.tagName != 'HTML'){
+                x+= op.offsetLeft;
+                y+= op.offsetTop;
+                op = op.offsetParent;
+            }
+            if(restorePos){
+                el.position('static');
+            }
+            return [x, y];
+        },
+
+        /**
+         * Scrolls this element into view within the passed container.
+         * @param {String/HTMLElement/Element} container (optional) The container element to scroll (defaults to document.body)
+         * @param {Boolean} hscroll (optional) False to disable horizontal scroll (defaults to true)
+         * @return {Roo.Element} this
+         */
+        scrollIntoView : function(container, hscroll){
+            var c = Roo.getDom(container) || document.body;
+            var el = this.dom;
+
+            var o = this.calcOffsetsTo(c),
+                l = o[0],
+                t = o[1],
+                b = t+el.offsetHeight,
+                r = l+el.offsetWidth;
+
+            var ch = c.clientHeight;
+            var ct = parseInt(c.scrollTop, 10);
+            var cl = parseInt(c.scrollLeft, 10);
+            var cb = ct + ch;
+            var cr = cl + c.clientWidth;
+
+            if(t < ct){
+                c.scrollTop = t;
+            }else if(b > cb){
+                c.scrollTop = b-ch;
+            }
+
+            if(hscroll !== false){
+                if(l < cl){
+                    c.scrollLeft = l;
+                }else if(r > cr){
+                    c.scrollLeft = r-c.clientWidth;
+                }
+            }
+            return this;
+        },
+
+        // private
+        scrollChildIntoView : function(child, hscroll){
+            Roo.fly(child, '_scrollChildIntoView').scrollIntoView(this, hscroll);
+        },
+
+        /**
+         * Measures the element's content height and updates height to match. Note: this function uses setTimeout so
+         * the new height may not be available immediately.
+         * @param {Boolean} animate (optional) Animate the transition (defaults to false)
+         * @param {Float} duration (optional) Length of the animation in seconds (defaults to .35)
+         * @param {Function} onComplete (optional) Function to call when animation completes
+         * @param {String} easing (optional) Easing method to use (defaults to easeOut)
+         * @return {Roo.Element} this
+         */
+        autoHeight : function(animate, duration, onComplete, easing){
+            var oldHeight = this.getHeight();
+            this.clip();
+            this.setHeight(1); // force clipping
+            setTimeout(function(){
+                var height = parseInt(this.dom.scrollHeight, 10); // parseInt for Safari
+                if(!animate){
+                    this.setHeight(height);
+                    this.unclip();
+                    if(typeof onComplete == "function"){
+                        onComplete();
+                    }
+                }else{
+                    this.setHeight(oldHeight); // restore original height
+                    this.setHeight(height, animate, duration, function(){
+                        this.unclip();
+                        if(typeof onComplete == "function") onComplete();
+                    }.createDelegate(this), easing);
+                }
+            }.createDelegate(this), 0);
+            return this;
+        },
+
+        /**
+         * Returns true if this element is an ancestor of the passed element
+         * @param {HTMLElement/String} el The element to check
+         * @return {Boolean} True if this element is an ancestor of el, else false
+         */
+        contains : function(el){
+            if(!el){return false;}
+            return D.isAncestor(this.dom, el.dom ? el.dom : el);
+        },
+
+        /**
+         * Checks whether the element is currently visible using both visibility and display properties.
+         * @param {Boolean} deep (optional) True to walk the dom and see if parent elements are hidden (defaults to false)
+         * @return {Boolean} True if the element is currently visible, else false
+         */
+        isVisible : function(deep) {
+            var vis = !(this.getStyle("visibility") == "hidden" || this.getStyle("display") == "none");
+            if(deep !== true || !vis){
+                return vis;
+            }
+            var p = this.dom.parentNode;
+            while(p && p.tagName.toLowerCase() != "body"){
+                if(!Roo.fly(p, '_isVisible').isVisible()){
+                    return false;
+                }
+                p = p.parentNode;
+            }
+            return true;
+        },
+
+        /**
+         * Creates a {@link Roo.CompositeElement} for child nodes based on the passed CSS selector (the selector should not contain an id).
+         * @param {String} selector The CSS selector
+         * @param {Boolean} unique (optional) True to create a unique Roo.Element for each child (defaults to false, which creates a single shared flyweight object)
+         * @return {CompositeElement/CompositeElementLite} The composite element
+         */
+        select : function(selector, unique){
+            return El.select(selector, unique, this.dom);
+        },
+
+        /**
+         * Selects child nodes based on the passed CSS selector (the selector should not contain an id).
+         * @param {String} selector The CSS selector
+         * @return {Array} An array of the matched nodes
+         */
+        query : function(selector, unique){
+            return Roo.DomQuery.select(selector, this.dom);
+        },
+
+        /**
+         * Selects a single child at any depth below this element based on the passed CSS selector (the selector should not contain an id).
+         * @param {String} selector The CSS selector
+         * @param {Boolean} returnDom (optional) True to return the DOM node instead of Roo.Element (defaults to false)
+         * @return {HTMLElement/Roo.Element} The child Roo.Element (or DOM node if returnDom = true)
+         */
+        child : function(selector, returnDom){
+            var n = Roo.DomQuery.selectNode(selector, this.dom);
+            return returnDom ? n : Roo.get(n);
+        },
+
+        /**
+         * Selects a single *direct* child based on the passed CSS selector (the selector should not contain an id).
+         * @param {String} selector The CSS selector
+         * @param {Boolean} returnDom (optional) True to return the DOM node instead of Roo.Element (defaults to false)
+         * @return {HTMLElement/Roo.Element} The child Roo.Element (or DOM node if returnDom = true)
+         */
+        down : function(selector, returnDom){
+            var n = Roo.DomQuery.selectNode(" > " + selector, this.dom);
+            return returnDom ? n : Roo.get(n);
+        },
+
+        /**
+         * Initializes a {@link Roo.dd.DD} drag drop object for this element.
+         * @param {String} group The group the DD object is member of
+         * @param {Object} config The DD config object
+         * @param {Object} overrides An object containing methods to override/implement on the DD object
+         * @return {Roo.dd.DD} The DD object
+         */
+        initDD : function(group, config, overrides){
+            var dd = new Roo.dd.DD(Roo.id(this.dom), group, config);
+            return Roo.apply(dd, overrides);
+        },
+
+        /**
+         * Initializes a {@link Roo.dd.DDProxy} object for this element.
+         * @param {String} group The group the DDProxy object is member of
+         * @param {Object} config The DDProxy config object
+         * @param {Object} overrides An object containing methods to override/implement on the DDProxy object
+         * @return {Roo.dd.DDProxy} The DDProxy object
+         */
+        initDDProxy : function(group, config, overrides){
+            var dd = new Roo.dd.DDProxy(Roo.id(this.dom), group, config);
+            return Roo.apply(dd, overrides);
+        },
+
+        /**
+         * Initializes a {@link Roo.dd.DDTarget} object for this element.
+         * @param {String} group The group the DDTarget object is member of
+         * @param {Object} config The DDTarget config object
+         * @param {Object} overrides An object containing methods to override/implement on the DDTarget object
+         * @return {Roo.dd.DDTarget} The DDTarget object
+         */
+        initDDTarget : function(group, config, overrides){
+            var dd = new Roo.dd.DDTarget(Roo.id(this.dom), group, config);
+            return Roo.apply(dd, overrides);
+        },
+
+        /**
+         * Sets the visibility of the element (see details). If the visibilityMode is set to Element.DISPLAY, it will use
+         * the display property to hide the element, otherwise it uses visibility. The default is to hide and show using the visibility property.
+         * @param {Boolean} visible Whether the element is visible
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+         setVisible : function(visible, animate){
+            if(!animate || !A){
+                if(this.visibilityMode == El.DISPLAY){
+                    this.setDisplayed(visible);
+                }else{
+                    this.fixDisplay();
+                    this.dom.style.visibility = visible ? "visible" : "hidden";
+                }
+            }else{
+                // closure for composites
+                var dom = this.dom;
+                var visMode = this.visibilityMode;
+                if(visible){
+                    this.setOpacity(.01);
+                    this.setVisible(true);
+                }
+                this.anim({opacity: { to: (visible?1:0) }},
+                      this.preanim(arguments, 1),
+                      null, .35, 'easeIn', function(){
+                         if(!visible){
+                             if(visMode == El.DISPLAY){
+                                 dom.style.display = "none";
+                             }else{
+                                 dom.style.visibility = "hidden";
+                             }
+                             Roo.get(dom).setOpacity(1);
+                         }
+                     });
+            }
+            return this;
+        },
+
+        /**
+         * Returns true if display is not "none"
+         * @return {Boolean}
+         */
+        isDisplayed : function() {
+            return this.getStyle("display") != "none";
+        },
+
+        /**
+         * Toggles the element's visibility or display, depending on visibility mode.
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        toggle : function(animate){
+            this.setVisible(!this.isVisible(), this.preanim(arguments, 0));
+            return this;
+        },
+
+        /**
+         * Sets the CSS display property. Uses originalDisplay if the specified value is a boolean true.
+         * @param {Boolean} value Boolean value to display the element using its default display, or a string to set the display directly
+         * @return {Roo.Element} this
+         */
+        setDisplayed : function(value) {
+            if(typeof value == "boolean"){
+               value = value ? this.originalDisplay : "none";
+            }
+            this.setStyle("display", value);
+            return this;
+        },
+
+        /**
+         * Tries to focus the element. Any exceptions are caught and ignored.
+         * @return {Roo.Element} this
+         */
+        focus : function() {
+            try{
+                this.dom.focus();
+            }catch(e){}
+            return this;
+        },
+
+        /**
+         * Tries to blur the element. Any exceptions are caught and ignored.
+         * @return {Roo.Element} this
+         */
+        blur : function() {
+            try{
+                this.dom.blur();
+            }catch(e){}
+            return this;
+        },
+
+        /**
+         * Adds one or more CSS classes to the element. Duplicate classes are automatically filtered out.
+         * @param {String/Array} className The CSS class to add, or an array of classes
+         * @return {Roo.Element} this
+         */
+        addClass : function(className){
+            if(className instanceof Array){
+                for(var i = 0, len = className.length; i < len; i++) {
+                    this.addClass(className[i]);
+                }
+            }else{
+                if(className && !this.hasClass(className)){
+                    this.dom.className = this.dom.className + " " + className;
+                }
+            }
+            return this;
+        },
+
+        /**
+         * Adds one or more CSS classes to this element and removes the same class(es) from all siblings.
+         * @param {String/Array} className The CSS class to add, or an array of classes
+         * @return {Roo.Element} this
+         */
+        radioClass : function(className){
+            var siblings = this.dom.parentNode.childNodes;
+            for(var i = 0; i < siblings.length; i++) {
+                var s = siblings[i];
+                if(s.nodeType == 1){
+                    Roo.get(s).removeClass(className);
+                }
+            }
+            this.addClass(className);
+            return this;
+        },
+
+        /**
+         * Removes one or more CSS classes from the element.
+         * @param {String/Array} className The CSS class to remove, or an array of classes
+         * @return {Roo.Element} this
+         */
+        removeClass : function(className){
+            if(!className || !this.dom.className){
+                return this;
+            }
+            if(className instanceof Array){
+                for(var i = 0, len = className.length; i < len; i++) {
+                    this.removeClass(className[i]);
+                }
+            }else{
+                if(this.hasClass(className)){
+                    var re = this.classReCache[className];
+                    if (!re) {
+                       re = new RegExp('(?:^|\\s+)' + className + '(?:\\s+|$)', "g");
+                       this.classReCache[className] = re;
+                    }
+                    this.dom.className =
+                        this.dom.className.replace(re, " ");
+                }
+            }
+            return this;
+        },
+
+        // private
+        classReCache: {},
+
+        /**
+         * Toggles the specified CSS class on this element (removes it if it already exists, otherwise adds it).
+         * @param {String} className The CSS class to toggle
+         * @return {Roo.Element} this
+         */
+        toggleClass : function(className){
+            if(this.hasClass(className)){
+                this.removeClass(className);
+            }else{
+                this.addClass(className);
+            }
+            return this;
+        },
+
+        /**
+         * Checks if the specified CSS class exists on this element's DOM node.
+         * @param {String} className The CSS class to check for
+         * @return {Boolean} True if the class exists, else false
+         */
+        hasClass : function(className){
+            return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1;
+        },
+
+        /**
+         * Replaces a CSS class on the element with another.  If the old name does not exist, the new name will simply be added.
+         * @param {String} oldClassName The CSS class to replace
+         * @param {String} newClassName The replacement CSS class
+         * @return {Roo.Element} this
+         */
+        replaceClass : function(oldClassName, newClassName){
+            this.removeClass(oldClassName);
+            this.addClass(newClassName);
+            return this;
+        },
+
+        /**
+         * Returns an object with properties matching the styles requested.
+         * For example, el.getStyles('color', 'font-size', 'width') might return
+         * {'color': '#FFFFFF', 'font-size': '13px', 'width': '100px'}.
+         * @param {String} style1 A style name
+         * @param {String} style2 A style name
+         * @param {String} etc.
+         * @return {Object} The style object
+         */
+        getStyles : function(){
+            var a = arguments, len = a.length, r = {};
+            for(var i = 0; i < len; i++){
+                r[a[i]] = this.getStyle(a[i]);
+            }
+            return r;
+        },
+
+        /**
+         * Normalizes currentStyle and computedStyle. This is not YUI getStyle, it is an optimised version.
+         * @param {String} property The style property whose value is returned.
+         * @return {String} The current value of the style property for this element.
+         */
+        getStyle : function(){
+            return view && view.getComputedStyle ?
+                function(prop){
+                    var el = this.dom, v, cs, camel;
+                    if(prop == 'float'){
+                        prop = "cssFloat";
+                    }
+                    if(el.style && (v = el.style[prop])){
+                        return v;
+                    }
+                    if(cs = view.getComputedStyle(el, "")){
+                        if(!(camel = propCache[prop])){
+                            camel = propCache[prop] = prop.replace(camelRe, camelFn);
+                        }
+                        return cs[camel];
+                    }
+                    return null;
+                } :
+                function(prop){
+                    var el = this.dom, v, cs, camel;
+                    if(prop == 'opacity'){
+                        if(typeof el.style.filter == 'string'){
+                            var m = el.style.filter.match(/alpha\(opacity=(.*)\)/i);
+                            if(m){
+                                var fv = parseFloat(m[1]);
+                                if(!isNaN(fv)){
+                                    return fv ? fv / 100 : 0;
+                                }
+                            }
+                        }
+                        return 1;
+                    }else if(prop == 'float'){
+                        prop = "styleFloat";
+                    }
+                    if(!(camel = propCache[prop])){
+                        camel = propCache[prop] = prop.replace(camelRe, camelFn);
+                    }
+                    if(v = el.style[camel]){
+                        return v;
+                    }
+                    if(cs = el.currentStyle){
+                        return cs[camel];
+                    }
+                    return null;
+                };
+        }(),
+
+        /**
+         * Wrapper for setting style properties, also takes single object parameter of multiple styles.
+         * @param {String/Object} property The style property to be set, or an object of multiple styles.
+         * @param {String} value (optional) The value to apply to the given property, or null if an object was passed.
+         * @return {Roo.Element} this
+         */
+        setStyle : function(prop, value){
+            if(typeof prop == "string"){
+                
+                if (prop == 'float') {
+                    this.setStyle(Roo.isIE ? 'styleFloat'  : 'cssFloat', value);
+                    return this;
+                }
+                
+                var camel;
+                if(!(camel = propCache[prop])){
+                    camel = propCache[prop] = prop.replace(camelRe, camelFn);
+                }
+                
+                if(camel == 'opacity') {
+                    this.setOpacity(value);
+                }else{
+                    this.dom.style[camel] = value;
+                }
+            }else{
+                for(var style in prop){
+                    if(typeof prop[style] != "function"){
+                       this.setStyle(style, prop[style]);
+                    }
+                }
+            }
+            return this;
+        },
+
+        /**
+         * More flexible version of {@link #setStyle} for setting style properties.
+         * @param {String/Object/Function} styles A style specification string, e.g. "width:100px", or object in the form {width:"100px"}, or
+         * a function which returns such a specification.
+         * @return {Roo.Element} this
+         */
+        applyStyles : function(style){
+            Roo.DomHelper.applyStyles(this.dom, style);
+            return this;
+        },
+
+        /**
+          * 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).
+          * @return {Number} The X position of the element
+          */
+        getX : function(){
+            return D.getX(this.dom);
+        },
+
+        /**
+          * 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).
+          * @return {Number} The Y position of the element
+          */
+        getY : function(){
+            return D.getY(this.dom);
+        },
+
+        /**
+          * 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).
+          * @return {Array} The XY position of the element
+          */
+        getXY : function(){
+            return D.getXY(this.dom);
+        },
+
+        /**
+         * 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).
+         * @param {Number} The X position of the element
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setX : function(x, animate){
+            if(!animate || !A){
+                D.setX(this.dom, x);
+            }else{
+                this.setXY([x, this.getY()], this.preanim(arguments, 1));
+            }
+            return this;
+        },
+
+        /**
+         * 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).
+         * @param {Number} The Y position of the element
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setY : function(y, animate){
+            if(!animate || !A){
+                D.setY(this.dom, y);
+            }else{
+                this.setXY([this.getX(), y], this.preanim(arguments, 1));
+            }
+            return this;
+        },
+
+        /**
+         * Sets the element's left position directly using CSS style (instead of {@link #setX}).
+         * @param {String} left The left CSS property value
+         * @return {Roo.Element} this
+         */
+        setLeft : function(left){
+            this.setStyle("left", this.addUnits(left));
+            return this;
+        },
+
+        /**
+         * Sets the element's top position directly using CSS style (instead of {@link #setY}).
+         * @param {String} top The top CSS property value
+         * @return {Roo.Element} this
+         */
+        setTop : function(top){
+            this.setStyle("top", this.addUnits(top));
+            return this;
+        },
+
+        /**
+         * Sets the element's CSS right style.
+         * @param {String} right The right CSS property value
+         * @return {Roo.Element} this
+         */
+        setRight : function(right){
+            this.setStyle("right", this.addUnits(right));
+            return this;
+        },
+
+        /**
+         * Sets the element's CSS bottom style.
+         * @param {String} bottom The bottom CSS property value
+         * @return {Roo.Element} this
+         */
+        setBottom : function(bottom){
+            this.setStyle("bottom", this.addUnits(bottom));
+            return this;
+        },
+
+        /**
+         * Sets the position of the element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @param {Array} pos Contains X & Y [x, y] values for new position (coordinates are page-based)
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setXY : function(pos, animate){
+            if(!animate || !A){
+                D.setXY(this.dom, pos);
+            }else{
+                this.anim({points: {to: pos}}, this.preanim(arguments, 1), 'motion');
+            }
+            return this;
+        },
+
+        /**
+         * Sets the position of the element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @param {Number} x X value for new position (coordinates are page-based)
+         * @param {Number} y Y value for new position (coordinates are page-based)
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setLocation : function(x, y, animate){
+            this.setXY([x, y], this.preanim(arguments, 2));
+            return this;
+        },
+
+        /**
+         * Sets the position of the element in page coordinates, regardless of how the element is positioned.
+         * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
+         * @param {Number} x X value for new position (coordinates are page-based)
+         * @param {Number} y Y value for new position (coordinates are page-based)
+         * @param {Boolean/Object} animate (optional) True for the default animation, or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        moveTo : function(x, y, animate){
+            this.setXY([x, y], this.preanim(arguments, 2));
+            return this;
+        },
+
+        /**
+         * Returns the region of the given element.
+         * The element must be part of the DOM tree to have a region (display:none or elements not appended return false).
+         * @return {Region} A Roo.lib.Region containing "top, left, bottom, right" member data.
+         */
+        getRegion : function(){
+            return D.getRegion(this.dom);
+        },
+
+        /**
+         * Returns the offset height of the element
+         * @param {Boolean} contentHeight (optional) true to get the height minus borders and padding
+         * @return {Number} The element's height
+         */
+        getHeight : function(contentHeight){
+            var h = this.dom.offsetHeight || 0;
+            return contentHeight !== true ? h : h-this.getBorderWidth("tb")-this.getPadding("tb");
+        },
+
+        /**
+         * Returns the offset width of the element
+         * @param {Boolean} contentWidth (optional) true to get the width minus borders and padding
+         * @return {Number} The element's width
+         */
+        getWidth : function(contentWidth){
+            var w = this.dom.offsetWidth || 0;
+            return contentWidth !== true ? w : w-this.getBorderWidth("lr")-this.getPadding("lr");
+        },
+
+        /**
+         * Returns either the offsetHeight or the height of this element based on CSS height adjusted by padding or borders
+         * when needed to simulate offsetHeight when offsets aren't available. This may not work on display:none elements
+         * if a height has not been set using CSS.
+         * @return {Number}
+         */
+        getComputedHeight : function(){
+            var h = Math.max(this.dom.offsetHeight, this.dom.clientHeight);
+            if(!h){
+                h = parseInt(this.getStyle('height'), 10) || 0;
+                if(!this.isBorderBox()){
+                    h += this.getFrameWidth('tb');
+                }
+            }
+            return h;
+        },
+
+        /**
+         * Returns either the offsetWidth or the width of this element based on CSS width adjusted by padding or borders
+         * when needed to simulate offsetWidth when offsets aren't available. This may not work on display:none elements
+         * if a width has not been set using CSS.
+         * @return {Number}
+         */
+        getComputedWidth : function(){
+            var w = Math.max(this.dom.offsetWidth, this.dom.clientWidth);
+            if(!w){
+                w = parseInt(this.getStyle('width'), 10) || 0;
+                if(!this.isBorderBox()){
+                    w += this.getFrameWidth('lr');
+                }
+            }
+            return w;
+        },
+
+        /**
+         * Returns the size of the element.
+         * @param {Boolean} contentSize (optional) true to get the width/size minus borders and padding
+         * @return {Object} An object containing the element's size {width: (element width), height: (element height)}
+         */
+        getSize : function(contentSize){
+            return {width: this.getWidth(contentSize), height: this.getHeight(contentSize)};
+        },
+
+        /**
+         * Returns the width and height of the viewport.
+         * @return {Object} An object containing the viewport's size {width: (viewport width), height: (viewport height)}
+         */
+        getViewSize : function(){
+            var d = this.dom, doc = document, aw = 0, ah = 0;
+            if(d == doc || d == doc.body){
+                return {width : D.getViewWidth(), height: D.getViewHeight()};
+            }else{
+                return {
+                    width : d.clientWidth,
+                    height: d.clientHeight
+                };
+            }
+        },
+
+        /**
+         * Returns the value of the "value" attribute
+         * @param {Boolean} asNumber true to parse the value as a number
+         * @return {String/Number}
+         */
+        getValue : function(asNumber){
+            return asNumber ? parseInt(this.dom.value, 10) : this.dom.value;
+        },
+
+        // private
+        adjustWidth : function(width){
+            if(typeof width == "number"){
+                if(this.autoBoxAdjust && !this.isBorderBox()){
+                   width -= (this.getBorderWidth("lr") + this.getPadding("lr"));
+                }
+                if(width < 0){
+                    width = 0;
+                }
+            }
+            return width;
+        },
+
+        // private
+        adjustHeight : function(height){
+            if(typeof height == "number"){
+               if(this.autoBoxAdjust && !this.isBorderBox()){
+                   height -= (this.getBorderWidth("tb") + this.getPadding("tb"));
+               }
+               if(height < 0){
+                   height = 0;
+               }
+            }
+            return height;
+        },
+
+        /**
+         * Set the width of the element
+         * @param {Number} width The new width
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setWidth : function(width, animate){
+            width = this.adjustWidth(width);
+            if(!animate || !A){
+                this.dom.style.width = this.addUnits(width);
+            }else{
+                this.anim({width: {to: width}}, this.preanim(arguments, 1));
+            }
+            return this;
+        },
+
+        /**
+         * Set the height of the element
+         * @param {Number} height The new height
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+         setHeight : function(height, animate){
+            height = this.adjustHeight(height);
+            if(!animate || !A){
+                this.dom.style.height = this.addUnits(height);
+            }else{
+                this.anim({height: {to: height}}, this.preanim(arguments, 1));
+            }
+            return this;
+        },
+
+        /**
+         * Set the size of the element. If animation is true, both width an height will be animated concurrently.
+         * @param {Number} width The new width
+         * @param {Number} height The new height
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+         setSize : function(width, height, animate){
+            if(typeof width == "object"){ // in case of object from getSize()
+                height = width.height; width = width.width;
+            }
+            width = this.adjustWidth(width); height = this.adjustHeight(height);
+            if(!animate || !A){
+                this.dom.style.width = this.addUnits(width);
+                this.dom.style.height = this.addUnits(height);
+            }else{
+                this.anim({width: {to: width}, height: {to: height}}, this.preanim(arguments, 2));
+            }
+            return this;
+        },
+
+        /**
+         * Sets the element's position and size in one shot. If animation is true then width, height, x and y will be animated concurrently.
+         * @param {Number} x X value for new position (coordinates are page-based)
+         * @param {Number} y Y value for new position (coordinates are page-based)
+         * @param {Number} width The new width
+         * @param {Number} height The new height
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setBounds : function(x, y, width, height, animate){
+            if(!animate || !A){
+                this.setSize(width, height);
+                this.setLocation(x, y);
+            }else{
+                width = this.adjustWidth(width); height = this.adjustHeight(height);
+                this.anim({points: {to: [x, y]}, width: {to: width}, height: {to: height}},
+                              this.preanim(arguments, 4), 'motion');
+            }
+            return this;
+        },
+
+        /**
+         * Sets the element's position and size the the specified region. If animation is true then width, height, x and y will be animated concurrently.
+         * @param {Roo.lib.Region} region The region to fill
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setRegion : function(region, animate){
+            this.setBounds(region.left, region.top, region.right-region.left, region.bottom-region.top, this.preanim(arguments, 1));
+            return this;
+        },
+
+        /**
+         * Appends an event handler
+         *
+         * @param {String}   eventName     The type of event to append
+         * @param {Function} fn        The method the event invokes
+         * @param {Object} scope       (optional) The scope (this object) of the fn
+         * @param {Object}   options   (optional)An object with standard {@link Roo.EventManager#addListener} options
+         */
+        addListener : function(eventName, fn, scope, options){
+            if (this.dom) {
+                Roo.EventManager.on(this.dom,  eventName, fn, scope || this, options);
+            }
+        },
+
+        /**
+         * Removes an event handler from this element
+         * @param {String} eventName the type of event to remove
+         * @param {Function} fn the method the event invokes
+         * @return {Roo.Element} this
+         */
+        removeListener : function(eventName, fn){
+            Roo.EventManager.removeListener(this.dom,  eventName, fn);
+            return this;
+        },
+
+        /**
+         * Removes all previous added listeners from this element
+         * @return {Roo.Element} this
+         */
+        removeAllListeners : function(){
+            E.purgeElement(this.dom);
+            return this;
+        },
+
+        relayEvent : function(eventName, observable){
+            this.on(eventName, function(e){
+                observable.fireEvent(eventName, e);
+            });
+        },
+
+        /**
+         * Set the opacity of the element
+         * @param {Float} opacity The new opacity. 0 = transparent, .5 = 50% visibile, 1 = fully visible, etc
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+         setOpacity : function(opacity, animate){
+            if(!animate || !A){
+                var s = this.dom.style;
+                if(Roo.isIE){
+                    s.zoom = 1;
+                    s.filter = (s.filter || '').replace(/alpha\([^\)]*\)/gi,"") +
+                               (opacity == 1 ? "" : "alpha(opacity=" + opacity * 100 + ")");
+                }else{
+                    s.opacity = opacity;
+                }
+            }else{
+                this.anim({opacity: {to: opacity}}, this.preanim(arguments, 1), null, .35, 'easeIn');
+            }
+            return this;
+        },
+
+        /**
+         * Gets the left X coordinate
+         * @param {Boolean} local True to get the local css position instead of page coordinate
+         * @return {Number}
+         */
+        getLeft : function(local){
+            if(!local){
+                return this.getX();
+            }else{
+                return parseInt(this.getStyle("left"), 10) || 0;
+            }
+        },
+
+        /**
+         * Gets the right X coordinate of the element (element X position + element width)
+         * @param {Boolean} local True to get the local css position instead of page coordinate
+         * @return {Number}
+         */
+        getRight : function(local){
+            if(!local){
+                return this.getX() + this.getWidth();
+            }else{
+                return (this.getLeft(true) + this.getWidth()) || 0;
+            }
+        },
+
+        /**
+         * Gets the top Y coordinate
+         * @param {Boolean} local True to get the local css position instead of page coordinate
+         * @return {Number}
+         */
+        getTop : function(local) {
+            if(!local){
+                return this.getY();
+            }else{
+                return parseInt(this.getStyle("top"), 10) || 0;
+            }
+        },
+
+        /**
+         * Gets the bottom Y coordinate of the element (element Y position + element height)
+         * @param {Boolean} local True to get the local css position instead of page coordinate
+         * @return {Number}
+         */
+        getBottom : function(local){
+            if(!local){
+                return this.getY() + this.getHeight();
+            }else{
+                return (this.getTop(true) + this.getHeight()) || 0;
+            }
+        },
+
+        /**
+        * Initializes positioning on this element. If a desired position is not passed, it will make the
+        * the element positioned relative IF it is not already positioned.
+        * @param {String} pos (optional) Positioning to use "relative", "absolute" or "fixed"
+        * @param {Number} zIndex (optional) The zIndex to apply
+        * @param {Number} x (optional) Set the page X position
+        * @param {Number} y (optional) Set the page Y position
+        */
+        position : function(pos, zIndex, x, y){
+            if(!pos){
+               if(this.getStyle('position') == 'static'){
+                   this.setStyle('position', 'relative');
+               }
+            }else{
+                this.setStyle("position", pos);
+            }
+            if(zIndex){
+                this.setStyle("z-index", zIndex);
+            }
+            if(x !== undefined && y !== undefined){
+                this.setXY([x, y]);
+            }else if(x !== undefined){
+                this.setX(x);
+            }else if(y !== undefined){
+                this.setY(y);
+            }
+        },
+
+        /**
+        * Clear positioning back to the default when the document was loaded
+        * @param {String} value (optional) The value to use for the left,right,top,bottom, defaults to '' (empty string). You could use 'auto'.
+        * @return {Roo.Element} this
+         */
+        clearPositioning : function(value){
+            value = value ||'';
+            this.setStyle({
+                "left": value,
+                "right": value,
+                "top": value,
+                "bottom": value,
+                "z-index": "",
+                "position" : "static"
+            });
+            return this;
+        },
+
+        /**
+        * Gets an object with all CSS positioning properties. Useful along with setPostioning to get
+        * snapshot before performing an update and then restoring the element.
+        * @return {Object}
+        */
+        getPositioning : function(){
+            var l = this.getStyle("left");
+            var t = this.getStyle("top");
+            return {
+                "position" : this.getStyle("position"),
+                "left" : l,
+                "right" : l ? "" : this.getStyle("right"),
+                "top" : t,
+                "bottom" : t ? "" : this.getStyle("bottom"),
+                "z-index" : this.getStyle("z-index")
+            };
+        },
+
+        /**
+         * Gets the width of the border(s) for the specified side(s)
+         * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,
+         * passing lr would get the border (l)eft width + the border (r)ight width.
+         * @return {Number} The width of the sides passed added together
+         */
+        getBorderWidth : function(side){
+            return this.addStyles(side, El.borders);
+        },
+
+        /**
+         * Gets the width of the padding(s) for the specified side(s)
+         * @param {String} side Can be t, l, r, b or any combination of those to add multiple values. For example,
+         * passing lr would get the padding (l)eft + the padding (r)ight.
+         * @return {Number} The padding of the sides passed added together
+         */
+        getPadding : function(side){
+            return this.addStyles(side, El.paddings);
+        },
+
+        /**
+        * Set positioning with an object returned by getPositioning().
+        * @param {Object} posCfg
+        * @return {Roo.Element} this
+         */
+        setPositioning : function(pc){
+            this.applyStyles(pc);
+            if(pc.right == "auto"){
+                this.dom.style.right = "";
+            }
+            if(pc.bottom == "auto"){
+                this.dom.style.bottom = "";
+            }
+            return this;
+        },
+
+        // private
+        fixDisplay : function(){
+            if(this.getStyle("display") == "none"){
+                this.setStyle("visibility", "hidden");
+                this.setStyle("display", this.originalDisplay); // first try reverting to default
+                if(this.getStyle("display") == "none"){ // if that fails, default to block
+                    this.setStyle("display", "block");
+                }
+            }
+        },
+
+        /**
+         * Quick set left and top adding default units
+         * @param {String} left The left CSS property value
+         * @param {String} top The top CSS property value
+         * @return {Roo.Element} this
+         */
+         setLeftTop : function(left, top){
+            this.dom.style.left = this.addUnits(left);
+            this.dom.style.top = this.addUnits(top);
+            return this;
+        },
+
+        /**
+         * Move this element relative to its current position.
+         * @param {String} direction Possible values are: "l","left" - "r","right" - "t","top","up" - "b","bottom","down".
+         * @param {Number} distance How far to move the element in pixels
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+         move : function(direction, distance, animate){
+            var xy = this.getXY();
+            direction = direction.toLowerCase();
+            switch(direction){
+                case "l":
+                case "left":
+                    this.moveTo(xy[0]-distance, xy[1], this.preanim(arguments, 2));
+                    break;
+               case "r":
+               case "right":
+                    this.moveTo(xy[0]+distance, xy[1], this.preanim(arguments, 2));
+                    break;
+               case "t":
+               case "top":
+               case "up":
+                    this.moveTo(xy[0], xy[1]-distance, this.preanim(arguments, 2));
+                    break;
+               case "b":
+               case "bottom":
+               case "down":
+                    this.moveTo(xy[0], xy[1]+distance, this.preanim(arguments, 2));
+                    break;
+            }
+            return this;
+        },
+
+        /**
+         *  Store the current overflow setting and clip overflow on the element - use {@link #unclip} to remove
+         * @return {Roo.Element} this
+         */
+        clip : function(){
+            if(!this.isClipped){
+               this.isClipped = true;
+               this.originalClip = {
+                   "o": this.getStyle("overflow"),
+                   "x": this.getStyle("overflow-x"),
+                   "y": this.getStyle("overflow-y")
+               };
+               this.setStyle("overflow", "hidden");
+               this.setStyle("overflow-x", "hidden");
+               this.setStyle("overflow-y", "hidden");
+            }
+            return this;
+        },
+
+        /**
+         *  Return clipping (overflow) to original clipping before clip() was called
+         * @return {Roo.Element} this
+         */
+        unclip : function(){
+            if(this.isClipped){
+                this.isClipped = false;
+                var o = this.originalClip;
+                if(o.o){this.setStyle("overflow", o.o);}
+                if(o.x){this.setStyle("overflow-x", o.x);}
+                if(o.y){this.setStyle("overflow-y", o.y);}
+            }
+            return this;
+        },
+
+
+        /**
+         * Gets the x,y coordinates specified by the anchor position on the element.
+         * @param {String} anchor (optional) The specified anchor position (defaults to "c").  See {@link #alignTo} for details on supported anchor positions.
+         * @param {Object} size (optional) An object containing the size to use for calculating anchor position
+         *                       {width: (target width), height: (target height)} (defaults to the element's current size)
+         * @param {Boolean} local (optional) True to get the local (element top/left-relative) anchor position instead of page coordinates
+         * @return {Array} [x, y] An array containing the element's x and y coordinates
+         */
+        getAnchorXY : function(anchor, local, s){
+            //Passing a different size is useful for pre-calculating anchors,
+            //especially for anchored animations that change the el size.
+
+            var w, h, vp = false;
+            if(!s){
+                var d = this.dom;
+                if(d == document.body || d == document){
+                    vp = true;
+                    w = D.getViewWidth(); h = D.getViewHeight();
+                }else{
+                    w = this.getWidth(); h = this.getHeight();
+                }
+            }else{
+                w = s.width;  h = s.height;
+            }
+            var x = 0, y = 0, r = Math.round;
+            switch((anchor || "tl").toLowerCase()){
+                case "c":
+                    x = r(w*.5);
+                    y = r(h*.5);
+                break;
+                case "t":
+                    x = r(w*.5);
+                    y = 0;
+                break;
+                case "l":
+                    x = 0;
+                    y = r(h*.5);
+                break;
+                case "r":
+                    x = w;
+                    y = r(h*.5);
+                break;
+                case "b":
+                    x = r(w*.5);
+                    y = h;
+                break;
+                case "tl":
+                    x = 0;
+                    y = 0;
+                break;
+                case "bl":
+                    x = 0;
+                    y = h;
+                break;
+                case "br":
+                    x = w;
+                    y = h;
+                break;
+                case "tr":
+                    x = w;
+                    y = 0;
+                break;
+            }
+            if(local === true){
+                return [x, y];
+            }
+            if(vp){
+                var sc = this.getScroll();
+                return [x + sc.left, y + sc.top];
+            }
+            //Add the element's offset xy
+            var o = this.getXY();
+            return [x+o[0], y+o[1]];
+        },
+
+        /**
+         * Gets the x,y coordinates to align this element with another element. See {@link #alignTo} for more info on the
+         * supported position values.
+         * @param {String/HTMLElement/Roo.Element} element The element to align to.
+         * @param {String} position The position to align to.
+         * @param {Array} offsets (optional) Offset the positioning by [x, y]
+         * @return {Array} [x, y]
+         */
+        getAlignToXY : function(el, p, o){
+            el = Roo.get(el);
+            var d = this.dom;
+            if(!el.dom){
+                throw "Element.alignTo with an element that doesn't exist";
+            }
+            var c = false; //constrain to viewport
+            var p1 = "", p2 = "";
+            o = o || [0,0];
+
+            if(!p){
+                p = "tl-bl";
+            }else if(p == "?"){
+                p = "tl-bl?";
+            }else if(p.indexOf("-") == -1){
+                p = "tl-" + p;
+            }
+            p = p.toLowerCase();
+            var m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/);
+            if(!m){
+               throw "Element.alignTo with an invalid alignment " + p;
+            }
+            p1 = m[1]; p2 = m[2]; c = !!m[3];
+
+            //Subtract the aligned el's internal xy from the target's offset xy
+            //plus custom offset to get the aligned el's new offset xy
+            var a1 = this.getAnchorXY(p1, true);
+            var a2 = el.getAnchorXY(p2, false);
+            var x = a2[0] - a1[0] + o[0];
+            var y = a2[1] - a1[1] + o[1];
+            if(c){
+                //constrain the aligned el to viewport if necessary
+                var w = this.getWidth(), h = this.getHeight(), r = el.getRegion();
+                // 5px of margin for ie
+                var dw = D.getViewWidth()-5, dh = D.getViewHeight()-5;
+
+                //If we are at a viewport boundary and the aligned el is anchored on a target border that is
+                //perpendicular to the vp border, allow the aligned el to slide on that border,
+                //otherwise swap the aligned el to the opposite border of the target.
+                var p1y = p1.charAt(0), p1x = p1.charAt(p1.length-1);
+               var p2y = p2.charAt(0), p2x = p2.charAt(p2.length-1);
+               var swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t"));
+               var swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r"));
+
+               var doc = document;
+               var scrollX = (doc.documentElement.scrollLeft || doc.body.scrollLeft || 0)+5;
+               var scrollY = (doc.documentElement.scrollTop || doc.body.scrollTop || 0)+5;
+
+               if((x+w) > dw + scrollX){
+                    x = swapX ? r.left-w : dw+scrollX-w;
+                }
+               if(x < scrollX){
+                   x = swapX ? r.right : scrollX;
+               }
+               if((y+h) > dh + scrollY){
+                    y = swapY ? r.top-h : dh+scrollY-h;
+                }
+               if (y < scrollY){
+                   y = swapY ? r.bottom : scrollY;
+               }
+            }
+            return [x,y];
+        },
+
+        // private
+        getConstrainToXY : function(){
+            var os = {top:0, left:0, bottom:0, right: 0};
+
+            return function(el, local, offsets, proposedXY){
+                el = Roo.get(el);
+                offsets = offsets ? Roo.applyIf(offsets, os) : os;
+
+                var vw, vh, vx = 0, vy = 0;
+                if(el.dom == document.body || el.dom == document){
+                    vw = Roo.lib.Dom.getViewWidth();
+                    vh = Roo.lib.Dom.getViewHeight();
+                }else{
+                    vw = el.dom.clientWidth;
+                    vh = el.dom.clientHeight;
+                    if(!local){
+                        var vxy = el.getXY();
+                        vx = vxy[0];
+                        vy = vxy[1];
+                    }
+                }
+
+                var s = el.getScroll();
+
+                vx += offsets.left + s.left;
+                vy += offsets.top + s.top;
+
+                vw -= offsets.right;
+                vh -= offsets.bottom;
+
+                var vr = vx+vw;
+                var vb = vy+vh;
+
+                var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]);
+                var x = xy[0], y = xy[1];
+                var w = this.dom.offsetWidth, h = this.dom.offsetHeight;
+
+                // only move it if it needs it
+                var moved = false;
+
+                // first validate right/bottom
+                if((x + w) > vr){
+                    x = vr - w;
+                    moved = true;
+                }
+                if((y + h) > vb){
+                    y = vb - h;
+                    moved = true;
+                }
+                // then make sure top/left isn't negative
+                if(x < vx){
+                    x = vx;
+                    moved = true;
+                }
+                if(y < vy){
+                    y = vy;
+                    moved = true;
+                }
+                return moved ? [x, y] : false;
+            };
+        }(),
+
+        // private
+        adjustForConstraints : function(xy, parent, offsets){
+            return this.getConstrainToXY(parent || document, false, offsets, xy) ||  xy;
+        },
+
+        /**
+         * Aligns this element with another element relative to the specified anchor points. If the other element is the
+         * document it aligns it to the viewport.
+         * The position parameter is optional, and can be specified in any one of the following formats:
+         * <ul>
+         *   <li><b>Blank</b>: Defaults to aligning the element's top-left corner to the target's bottom-left corner ("tl-bl").</li>
+         *   <li><b>One anchor (deprecated)</b>: The passed anchor position is used as the target element's anchor point.
+         *       The element being aligned will position its top-left corner (tl) to that point.  <i>This method has been
+         *       deprecated in favor of the newer two anchor syntax below</i>.</li>
+         *   <li><b>Two anchors</b>: If two values from the table below are passed separated by a dash, the first value is used as the
+         *       element's anchor point, and the second value is used as the target's anchor point.</li>
+         * </ul>
+         * In addition to the anchor points, the position parameter also supports the "?" character.  If "?" is passed at the end of
+         * the position string, the element will attempt to align as specified, but the position will be adjusted to constrain to
+         * the viewport if necessary.  Note that the element being aligned might be swapped to align to a different position than
+         * that specified in order to enforce the viewport constraints.
+         * Following are all of the supported anchor positions:
+    <pre>
+    Value  Description
+    -----  -----------------------------
+    tl     The top left corner (default)
+    t      The center of the top edge
+    tr     The top right corner
+    l      The center of the left edge
+    c      In the center of the element
+    r      The center of the right edge
+    bl     The bottom left corner
+    b      The center of the bottom edge
+    br     The bottom right corner
+    </pre>
+    Example Usage:
+    <pre><code>
+    // align el to other-el using the default positioning ("tl-bl", non-constrained)
+    el.alignTo("other-el");
+
+    // align the top left corner of el with the top right corner of other-el (constrained to viewport)
+    el.alignTo("other-el", "tr?");
+
+    // align the bottom right corner of el with the center left edge of other-el
+    el.alignTo("other-el", "br-l?");
+
+    // align the center of el with the bottom left corner of other-el and
+    // adjust the x position by -6 pixels (and the y position by 0)
+    el.alignTo("other-el", "c-bl", [-6, 0]);
+    </code></pre>
+         * @param {String/HTMLElement/Roo.Element} element The element to align to.
+         * @param {String} position The position to align to.
+         * @param {Array} offsets (optional) Offset the positioning by [x, y]
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        alignTo : function(element, position, offsets, animate){
+            var xy = this.getAlignToXY(element, position, offsets);
+            this.setXY(xy, this.preanim(arguments, 3));
+            return this;
+        },
+
+        /**
+         * Anchors an element to another element and realigns it when the window is resized.
+         * @param {String/HTMLElement/Roo.Element} element The element to align to.
+         * @param {String} position The position to align to.
+         * @param {Array} offsets (optional) Offset the positioning by [x, y]
+         * @param {Boolean/Object} animate (optional) True for the default animation or a standard Element animation config object
+         * @param {Boolean/Number} monitorScroll (optional) True to monitor body scroll and reposition. If this parameter
+         * is a number, it is used as the buffer delay (defaults to 50ms).
+         * @param {Function} callback The function to call after the animation finishes
+         * @return {Roo.Element} this
+         */
+        anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){
+            var action = function(){
+                this.alignTo(el, alignment, offsets, animate);
+                Roo.callback(callback, this);
+            };
+            Roo.EventManager.onWindowResize(action, this);
+            var tm = typeof monitorScroll;
+            if(tm != 'undefined'){
+                Roo.EventManager.on(window, 'scroll', action, this,
+                    {buffer: tm == 'number' ? monitorScroll : 50});
+            }
+            action.call(this); // align immediately
+            return this;
+        },
+        /**
+         * Clears any opacity settings from this element. Required in some cases for IE.
+         * @return {Roo.Element} this
+         */
+        clearOpacity : function(){
+            if (window.ActiveXObject) {
+                if(typeof this.dom.style.filter == 'string' && (/alpha/i).test(this.dom.style.filter)){
+                    this.dom.style.filter = "";
+                }
+            } else {
+                this.dom.style.opacity = "";
+                this.dom.style["-moz-opacity"] = "";
+                this.dom.style["-khtml-opacity"] = "";
+            }
+            return this;
+        },
+
+        /**
+         * Hide this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        hide : function(animate){
+            this.setVisible(false, this.preanim(arguments, 0));
+            return this;
+        },
+
+        /**
+        * Show this element - Uses display mode to determine whether to use "display" or "visibility". See {@link #setVisible}.
+        * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        show : function(animate){
+            this.setVisible(true, this.preanim(arguments, 0));
+            return this;
+        },
+
+        /**
+         * @private Test if size has a unit, otherwise appends the default
+         */
+        addUnits : function(size){
+            return Roo.Element.addUnits(size, this.defaultUnit);
+        },
+
+        /**
+         * Temporarily enables offsets (width,height,x,y) for an element with display:none, use endMeasure() when done.
+         * @return {Roo.Element} this
+         */
+        beginMeasure : function(){
+            var el = this.dom;
+            if(el.offsetWidth || el.offsetHeight){
+                return this; // offsets work already
+            }
+            var changed = [];
+            var p = this.dom, b = document.body; // start with this element
+            while((!el.offsetWidth && !el.offsetHeight) && p && p.tagName && p != b){
+                var pe = Roo.get(p);
+                if(pe.getStyle('display') == 'none'){
+                    changed.push({el: p, visibility: pe.getStyle("visibility")});
+                    p.style.visibility = "hidden";
+                    p.style.display = "block";
+                }
+                p = p.parentNode;
+            }
+            this._measureChanged = changed;
+            return this;
+
+        },
+
+        /**
+         * Restores displays to before beginMeasure was called
+         * @return {Roo.Element} this
+         */
+        endMeasure : function(){
+            var changed = this._measureChanged;
+            if(changed){
+                for(var i = 0, len = changed.length; i < len; i++) {
+                    var r = changed[i];
+                    r.el.style.visibility = r.visibility;
+                    r.el.style.display = "none";
+                }
+                this._measureChanged = null;
+            }
+            return this;
+        },
+
+        /**
+        * Update the innerHTML of this element, optionally searching for and processing scripts
+        * @param {String} html The new HTML
+        * @param {Boolean} loadScripts (optional) true to look for and process scripts
+        * @param {Function} callback For async script loading you can be noticed when the update completes
+        * @return {Roo.Element} this
+         */
+        update : function(html, loadScripts, callback){
+            if(typeof html == "undefined"){
+                html = "";
+            }
+            if(loadScripts !== true){
+                this.dom.innerHTML = html;
+                if(typeof callback == "function"){
+                    callback();
+                }
+                return this;
+            }
+            var id = Roo.id();
+            var dom = this.dom;
+
+            html += '<span id="' + id + '"></span>';
+
+            E.onAvailable(id, function(){
+                var hd = document.getElementsByTagName("head")[0];
+                var re = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;
+                var srcRe = /\ssrc=([\'\"])(.*?)\1/i;
+                var typeRe = /\stype=([\'\"])(.*?)\1/i;
+
+                var match;
+                while(match = re.exec(html)){
+                    var attrs = match[1];
+                    var srcMatch = attrs ? attrs.match(srcRe) : false;
+                    if(srcMatch && srcMatch[2]){
+                       var s = document.createElement("script");
+                       s.src = srcMatch[2];
+                       var typeMatch = attrs.match(typeRe);
+                       if(typeMatch && typeMatch[2]){
+                           s.type = typeMatch[2];
+                       }
+                       hd.appendChild(s);
+                    }else if(match[2] && match[2].length > 0){
+                        if(window.execScript) {
+                           window.execScript(match[2]);
+                        } else {
+                            /**
+                             * eval:var:id
+                             * eval:var:dom
+                             * eval:var:html
+                             * 
+                             */
+                           window.eval(match[2]);
+                        }
+                    }
+                }
+                var el = document.getElementById(id);
+                if(el){el.parentNode.removeChild(el);}
+                if(typeof callback == "function"){
+                    callback();
+                }
+            });
+            dom.innerHTML = html.replace(/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig, "");
+            return this;
+        },
+
+        /**
+         * Direct access to the UpdateManager update() method (takes the same parameters).
+         * @param {String/Function} url The url for this request or a function to call to get the url
+         * @param {String/Object} params (optional) The parameters to pass as either a url encoded string "param1=1&amp;param2=2" or an object {param1: 1, param2: 2}
+         * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess)
+         * @param {Boolean} discardUrl (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.
+         * @return {Roo.Element} this
+         */
+        load : function(){
+            var um = this.getUpdateManager();
+            um.update.apply(um, arguments);
+            return this;
+        },
+
+        /**
+        * Gets this element's UpdateManager
+        * @return {Roo.UpdateManager} The UpdateManager
+        */
+        getUpdateManager : function(){
+            if(!this.updateManager){
+                this.updateManager = new Roo.UpdateManager(this);
+            }
+            return this.updateManager;
+        },
+
+        /**
+         * Disables text selection for this element (normalized across browsers)
+         * @return {Roo.Element} this
+         */
+        unselectable : function(){
+            this.dom.unselectable = "on";
+            this.swallowEvent("selectstart", true);
+            this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");
+            this.addClass("x-unselectable");
+            return this;
+        },
+
+        /**
+        * Calculates the x, y to center this element on the screen
+        * @return {Array} The x, y values [x, y]
+        */
+        getCenterXY : function(){
+            return this.getAlignToXY(document, 'c-c');
+        },
+
+        /**
+        * Centers the Element in either the viewport, or another Element.
+        * @param {String/HTMLElement/Roo.Element} centerIn (optional) The element in which to center the element.
+        */
+        center : function(centerIn){
+            this.alignTo(centerIn || document, 'c-c');
+            return this;
+        },
+
+        /**
+         * Tests various css rules/browsers to determine if this element uses a border box
+         * @return {Boolean}
+         */
+        isBorderBox : function(){
+            return noBoxAdjust[this.dom.tagName.toLowerCase()] || Roo.isBorderBox;
+        },
+
+        /**
+         * Return a box {x, y, width, height} that can be used to set another elements
+         * size/location to match this element.
+         * @param {Boolean} contentBox (optional) If true a box for the content of the element is returned.
+         * @param {Boolean} local (optional) If true the element's left and top are returned instead of page x/y.
+         * @return {Object} box An object in the format {x, y, width, height}
+         */
+        getBox : function(contentBox, local){
+            var xy;
+            if(!local){
+                xy = this.getXY();
+            }else{
+                var left = parseInt(this.getStyle("left"), 10) || 0;
+                var top = parseInt(this.getStyle("top"), 10) || 0;
+                xy = [left, top];
+            }
+            var el = this.dom, w = el.offsetWidth, h = el.offsetHeight, bx;
+            if(!contentBox){
+                bx = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: w, height: h};
+            }else{
+                var l = this.getBorderWidth("l")+this.getPadding("l");
+                var r = this.getBorderWidth("r")+this.getPadding("r");
+                var t = this.getBorderWidth("t")+this.getPadding("t");
+                var b = this.getBorderWidth("b")+this.getPadding("b");
+                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)};
+            }
+            bx.right = bx.x + bx.width;
+            bx.bottom = bx.y + bx.height;
+            return bx;
+        },
+
+        /**
+         * Returns the sum width of the padding and borders for the passed "sides". See getBorderWidth()
+         for more information about the sides.
+         * @param {String} sides
+         * @return {Number}
+         */
+        getFrameWidth : function(sides, onlyContentBox){
+            return onlyContentBox && Roo.isBorderBox ? 0 : (this.getPadding(sides) + this.getBorderWidth(sides));
+        },
+
+        /**
+         * 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.
+         * @param {Object} box The box to fill {x, y, width, height}
+         * @param {Boolean} adjust (optional) Whether to adjust for box-model issues automatically
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Roo.Element} this
+         */
+        setBox : function(box, adjust, animate){
+            var w = box.width, h = box.height;
+            if((adjust && !this.autoBoxAdjust) && !this.isBorderBox()){
+               w -= (this.getBorderWidth("lr") + this.getPadding("lr"));
+               h -= (this.getBorderWidth("tb") + this.getPadding("tb"));
+            }
+            this.setBounds(box.x, box.y, w, h, this.preanim(arguments, 2));
+            return this;
+        },
+
+        /**
+         * Forces the browser to repaint this element
+         * @return {Roo.Element} this
+         */
+         repaint : function(){
+            var dom = this.dom;
+            this.addClass("x-repaint");
+            setTimeout(function(){
+                Roo.get(dom).removeClass("x-repaint");
+            }, 1);
+            return this;
+        },
+
+        /**
+         * Returns an object with properties top, left, right and bottom representing the margins of this element unless sides is passed,
+         * then it returns the calculated width of the sides (see getPadding)
+         * @param {String} sides (optional) Any combination of l, r, t, b to get the sum of those sides
+         * @return {Object/Number}
+         */
+        getMargins : function(side){
+            if(!side){
+                return {
+                    top: parseInt(this.getStyle("margin-top"), 10) || 0,
+                    left: parseInt(this.getStyle("margin-left"), 10) || 0,
+                    bottom: parseInt(this.getStyle("margin-bottom"), 10) || 0,
+                    right: parseInt(this.getStyle("margin-right"), 10) || 0
+                };
+            }else{
+                return this.addStyles(side, El.margins);
+             }
+        },
+
+        // private
+        addStyles : function(sides, styles){
+            var val = 0, v, w;
+            for(var i = 0, len = sides.length; i < len; i++){
+                v = this.getStyle(styles[sides.charAt(i)]);
+                if(v){
+                     w = parseInt(v, 10);
+                     if(w){ val += w; }
+                }
+            }
+            return val;
+        },
+
+        /**
+         * Creates a proxy element of this element
+         * @param {String/Object} config The class name of the proxy element or a DomHelper config object
+         * @param {String/HTMLElement} renderTo (optional) The element or element id to render the proxy to (defaults to document.body)
+         * @param {Boolean} matchBox (optional) True to align and size the proxy to this element now (defaults to false)
+         * @return {Roo.Element} The new proxy element
+         */
+        createProxy : function(config, renderTo, matchBox){
+            if(renderTo){
+                renderTo = Roo.getDom(renderTo);
+            }else{
+                renderTo = document.body;
+            }
+            config = typeof config == "object" ?
+                config : {tag : "div", cls: config};
+            var proxy = Roo.DomHelper.append(renderTo, config, true);
+            if(matchBox){
+               proxy.setBox(this.getBox());
+            }
+            return proxy;
+        },
+
+        /**
+         * Puts a mask over this element to disable user interaction. Requires core.css.
+         * This method can only be applied to elements which accept child nodes.
+         * @param {String} msg (optional) A message to display in the mask
+         * @param {String} msgCls (optional) A css class to apply to the msg element
+         * @return {Element} The mask  element
+         */
+        mask : function(msg, msgCls){
+            if(this.getStyle("position") == "static"){
+                this.setStyle("position", "relative");
+            }
+            if(!this._mask){
+                this._mask = Roo.DomHelper.append(this.dom, {cls:"roo-el-mask"}, true);
+            }
+            this.addClass("x-masked");
+            this._mask.setDisplayed(true);
+            if(typeof msg == 'string'){
+                if(!this._maskMsg){
+                    this._maskMsg = Roo.DomHelper.append(this.dom, {cls:"roo-el-mask-msg", cn:{tag:'div'}}, true);
+                }
+                var mm = this._maskMsg;
+                mm.dom.className = msgCls ? "roo-el-mask-msg " + msgCls : "roo-el-mask-msg";
+                mm.dom.firstChild.innerHTML = msg;
+                mm.setDisplayed(true);
+                mm.center(this);
+            }
+            if(Roo.isIE && !(Roo.isIE7 && Roo.isStrict) && this.getStyle('height') == 'auto'){ // ie will not expand full height automatically
+                this._mask.setHeight(this.getHeight());
+            }
+            return this._mask;
+        },
+
+        /**
+         * Removes a previously applied mask. If removeEl is true the mask overlay is destroyed, otherwise
+         * it is cached for reuse.
+         */
+        unmask : function(removeEl){
+            if(this._mask){
+                if(removeEl === true){
+                    this._mask.remove();
+                    delete this._mask;
+                    if(this._maskMsg){
+                        this._maskMsg.remove();
+                        delete this._maskMsg;
+                    }
+                }else{
+                    this._mask.setDisplayed(false);
+                    if(this._maskMsg){
+                        this._maskMsg.setDisplayed(false);
+                    }
+                }
+            }
+            this.removeClass("x-masked");
+        },
+
+        /**
+         * Returns true if this element is masked
+         * @return {Boolean}
+         */
+        isMasked : function(){
+            return this._mask && this._mask.isVisible();
+        },
+
+        /**
+         * Creates an iframe shim for this element to keep selects and other windowed objects from
+         * showing through.
+         * @return {Roo.Element} The new shim element
+         */
+        createShim : function(){
+            var el = document.createElement('iframe');
+            el.frameBorder = 'no';
+            el.className = 'roo-shim';
+            if(Roo.isIE && Roo.isSecure){
+                el.src = Roo.SSL_SECURE_URL;
+            }
+            var shim = Roo.get(this.dom.parentNode.insertBefore(el, this.dom));
+            shim.autoBoxAdjust = false;
+            return shim;
+        },
+
+        /**
+         * Removes this element from the DOM and deletes it from the cache
+         */
+        remove : function(){
+            if(this.dom.parentNode){
+                this.dom.parentNode.removeChild(this.dom);
+            }
+            delete El.cache[this.dom.id];
+        },
+
+        /**
+         * Sets up event handlers to add and remove a css class when the mouse is over this element
+         * @param {String} className
+         * @param {Boolean} preventFlicker (optional) If set to true, it prevents flickering by filtering
+         * mouseout events for children elements
+         * @return {Roo.Element} this
+         */
+        addClassOnOver : function(className, preventFlicker){
+            this.on("mouseover", function(){
+                Roo.fly(this, '_internal').addClass(className);
+            }, this.dom);
+            var removeFn = function(e){
+                if(preventFlicker !== true || !e.within(this, true)){
+                    Roo.fly(this, '_internal').removeClass(className);
+                }
+            };
+            this.on("mouseout", removeFn, this.dom);
+            return this;
+        },
+
+        /**
+         * Sets up event handlers to add and remove a css class when this element has the focus
+         * @param {String} className
+         * @return {Roo.Element} this
+         */
+        addClassOnFocus : function(className){
+            this.on("focus", function(){
+                Roo.fly(this, '_internal').addClass(className);
+            }, this.dom);
+            this.on("blur", function(){
+                Roo.fly(this, '_internal').removeClass(className);
+            }, this.dom);
+            return this;
+        },
+        /**
+         * 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)
+         * @param {String} className
+         * @return {Roo.Element} this
+         */
+        addClassOnClick : function(className){
+            var dom = this.dom;
+            this.on("mousedown", function(){
+                Roo.fly(dom, '_internal').addClass(className);
+                var d = Roo.get(document);
+                var fn = function(){
+                    Roo.fly(dom, '_internal').removeClass(className);
+                    d.removeListener("mouseup", fn);
+                };
+                d.on("mouseup", fn);
+            });
+            return this;
+        },
+
+        /**
+         * Stops the specified event from bubbling and optionally prevents the default action
+         * @param {String} eventName
+         * @param {Boolean} preventDefault (optional) true to prevent the default action too
+         * @return {Roo.Element} this
+         */
+        swallowEvent : function(eventName, preventDefault){
+            var fn = function(e){
+                e.stopPropagation();
+                if(preventDefault){
+                    e.preventDefault();
+                }
+            };
+            if(eventName instanceof Array){
+                for(var i = 0, len = eventName.length; i < len; i++){
+                     this.on(eventName[i], fn);
+                }
+                return this;
+            }
+            this.on(eventName, fn);
+            return this;
+        },
+
+        /**
+         * @private
+         */
+      fitToParentDelegate : Roo.emptyFn, // keep a reference to the fitToParent delegate
+
+        /**
+         * Sizes this element to its parent element's dimensions performing
+         * neccessary box adjustments.
+         * @param {Boolean} monitorResize (optional) If true maintains the fit when the browser window is resized.
+         * @param {String/HTMLElment/Element} targetParent (optional) The target parent, default to the parentNode.
+         * @return {Roo.Element} this
+         */
+        fitToParent : function(monitorResize, targetParent) {
+          Roo.EventManager.removeResizeListener(this.fitToParentDelegate); // always remove previous fitToParent delegate from onWindowResize
+          this.fitToParentDelegate = Roo.emptyFn; // remove reference to previous delegate
+          if (monitorResize === true && !this.dom.parentNode) { // check if this Element still exists
+            return;
+          }
+          var p = Roo.get(targetParent || this.dom.parentNode);
+          this.setSize(p.getComputedWidth() - p.getFrameWidth('lr'), p.getComputedHeight() - p.getFrameWidth('tb'));
+          if (monitorResize === true) {
+            this.fitToParentDelegate = this.fitToParent.createDelegate(this, [true, targetParent]);
+            Roo.EventManager.onWindowResize(this.fitToParentDelegate);
+          }
+          return this;
+        },
+
+        /**
+         * Gets the next sibling, skipping text nodes
+         * @return {HTMLElement} The next sibling or null
+         */
+        getNextSibling : function(){
+            var n = this.dom.nextSibling;
+            while(n && n.nodeType != 1){
+                n = n.nextSibling;
+            }
+            return n;
+        },
+
+        /**
+         * Gets the previous sibling, skipping text nodes
+         * @return {HTMLElement} The previous sibling or null
+         */
+        getPrevSibling : function(){
+            var n = this.dom.previousSibling;
+            while(n && n.nodeType != 1){
+                n = n.previousSibling;
+            }
+            return n;
+        },
+
+
+        /**
+         * Appends the passed element(s) to this element
+         * @param {String/HTMLElement/Array/Element/CompositeElement} el
+         * @return {Roo.Element} this
+         */
+        appendChild: function(el){
+            el = Roo.get(el);
+            el.appendTo(this);
+            return this;
+        },
+
+        /**
+         * Creates the passed DomHelper config and appends it to this element or optionally inserts it before the passed child element.
+         * @param {Object} config DomHelper element config object.  If no tag is specified (e.g., {tag:'input'}) then a div will be
+         * automatically generated with the specified attributes.
+         * @param {HTMLElement} insertBefore (optional) a child element of this element
+         * @param {Boolean} returnDom (optional) true to return the dom node instead of creating an Element
+         * @return {Roo.Element} The new child element
+         */
+        createChild: function(config, insertBefore, returnDom){
+            config = config || {tag:'div'};
+            if(insertBefore){
+                return Roo.DomHelper.insertBefore(insertBefore, config, returnDom !== true);
+            }
+            return Roo.DomHelper[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config,  returnDom !== true);
+        },
+
+        /**
+         * Appends this element to the passed element
+         * @param {String/HTMLElement/Element} el The new parent element
+         * @return {Roo.Element} this
+         */
+        appendTo: function(el){
+            el = Roo.getDom(el);
+            el.appendChild(this.dom);
+            return this;
+        },
+
+        /**
+         * Inserts this element before the passed element in the DOM
+         * @param {String/HTMLElement/Element} el The element to insert before
+         * @return {Roo.Element} this
+         */
+        insertBefore: function(el){
+            el = Roo.getDom(el);
+            el.parentNode.insertBefore(this.dom, el);
+            return this;
+        },
+
+        /**
+         * Inserts this element after the passed element in the DOM
+         * @param {String/HTMLElement/Element} el The element to insert after
+         * @return {Roo.Element} this
+         */
+        insertAfter: function(el){
+            el = Roo.getDom(el);
+            el.parentNode.insertBefore(this.dom, el.nextSibling);
+            return this;
+        },
+
+        /**
+         * Inserts (or creates) an element (or DomHelper config) as the first child of the this element
+         * @param {String/HTMLElement/Element/Object} el The id or element to insert or a DomHelper config to create and insert
+         * @return {Roo.Element} The new child
+         */
+        insertFirst: function(el, returnDom){
+            el = el || {};
+            if(typeof el == 'object' && !el.nodeType){ // dh config
+                return this.createChild(el, this.dom.firstChild, returnDom);
+            }else{
+                el = Roo.getDom(el);
+                this.dom.insertBefore(el, this.dom.firstChild);
+                return !returnDom ? Roo.get(el) : el;
+            }
+        },
+
+        /**
+         * Inserts (or creates) the passed element (or DomHelper config) as a sibling of this element
+         * @param {String/HTMLElement/Element/Object} el The id or element to insert or a DomHelper config to create and insert
+         * @param {String} where (optional) 'before' or 'after' defaults to before
+         * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Roo.Element
+         * @return {Roo.Element} the inserted Element
+         */
+        insertSibling: function(el, where, returnDom){
+            where = where ? where.toLowerCase() : 'before';
+            el = el || {};
+            var rt, refNode = where == 'before' ? this.dom : this.dom.nextSibling;
+
+            if(typeof el == 'object' && !el.nodeType){ // dh config
+                if(where == 'after' && !this.dom.nextSibling){
+                    rt = Roo.DomHelper.append(this.dom.parentNode, el, !returnDom);
+                }else{
+                    rt = Roo.DomHelper[where == 'after' ? 'insertAfter' : 'insertBefore'](this.dom, el, !returnDom);
+                }
+
+            }else{
+                rt = this.dom.parentNode.insertBefore(Roo.getDom(el),
+                            where == 'before' ? this.dom : this.dom.nextSibling);
+                if(!returnDom){
+                    rt = Roo.get(rt);
+                }
+            }
+            return rt;
+        },
+
+        /**
+         * Creates and wraps this element with another element
+         * @param {Object} config (optional) DomHelper element config object for the wrapper element or null for an empty div
+         * @param {Boolean} returnDom (optional) True to return the raw DOM element instead of Roo.Element
+         * @return {HTMLElement/Element} The newly created wrapper element
+         */
+        wrap: function(config, returnDom){
+            if(!config){
+                config = {tag: "div"};
+            }
+            var newEl = Roo.DomHelper.insertBefore(this.dom, config, !returnDom);
+            newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom);
+            return newEl;
+        },
+
+        /**
+         * Replaces the passed element with this element
+         * @param {String/HTMLElement/Element} el The element to replace
+         * @return {Roo.Element} this
+         */
+        replace: function(el){
+            el = Roo.get(el);
+            this.insertBefore(el);
+            el.remove();
+            return this;
+        },
+
+        /**
+         * Inserts an html fragment into this element
+         * @param {String} where Where to insert the html in relation to the this element - beforeBegin, afterBegin, beforeEnd, afterEnd.
+         * @param {String} html The HTML fragment
+         * @param {Boolean} returnEl True to return an Roo.Element
+         * @return {HTMLElement/Roo.Element} The inserted node (or nearest related if more than 1 inserted)
+         */
+        insertHtml : function(where, html, returnEl){
+            var el = Roo.DomHelper.insertHtml(where, this.dom, html);
+            return returnEl ? Roo.get(el) : el;
+        },
+
+        /**
+         * Sets the passed attributes as attributes of this element (a style attribute can be a string, object or function)
+         * @param {Object} o The object with the attributes
+         * @param {Boolean} useSet (optional) false to override the default setAttribute to use expandos.
+         * @return {Roo.Element} this
+         */
+        set : function(o, useSet){
+            var el = this.dom;
+            useSet = typeof useSet == 'undefined' ? (el.setAttribute ? true : false) : useSet;
+            for(var attr in o){
+                if(attr == "style" || typeof o[attr] == "function") continue;
+                if(attr=="cls"){
+                    el.className = o["cls"];
+                }else{
+                    if(useSet) el.setAttribute(attr, o[attr]);
+                    else el[attr] = o[attr];
+                }
+            }
+            if(o.style){
+                Roo.DomHelper.applyStyles(el, o.style);
+            }
+            return this;
+        },
+
+        /**
+         * Convenience method for constructing a KeyMap
+         * @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:
+         *                                  {key: (number or array), shift: (true/false), ctrl: (true/false), alt: (true/false)}
+         * @param {Function} fn The function to call
+         * @param {Object} scope (optional) The scope of the function
+         * @return {Roo.KeyMap} The KeyMap created
+         */
+        addKeyListener : function(key, fn, scope){
+            var config;
+            if(typeof key != "object" || key instanceof Array){
+                config = {
+                    key: key,
+                    fn: fn,
+                    scope: scope
+                };
+            }else{
+                config = {
+                    key : key.key,
+                    shift : key.shift,
+                    ctrl : key.ctrl,
+                    alt : key.alt,
+                    fn: fn,
+                    scope: scope
+                };
+            }
+            return new Roo.KeyMap(this, config);
+        },
+
+        /**
+         * Creates a KeyMap for this element
+         * @param {Object} config The KeyMap config. See {@link Roo.KeyMap} for more details
+         * @return {Roo.KeyMap} The KeyMap created
+         */
+        addKeyMap : function(config){
+            return new Roo.KeyMap(this, config);
+        },
+
+        /**
+         * Returns true if this element is scrollable.
+         * @return {Boolean}
+         */
+         isScrollable : function(){
+            var dom = this.dom;
+            return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth;
+        },
+
+        /**
+         * 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().
+         * @param {String} side Either "left" for scrollLeft values or "top" for scrollTop values.
+         * @param {Number} value The new scroll value
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Element} this
+         */
+
+        scrollTo : function(side, value, animate){
+            var prop = side.toLowerCase() == "left" ? "scrollLeft" : "scrollTop";
+            if(!animate || !A){
+                this.dom[prop] = value;
+            }else{
+                var to = prop == "scrollLeft" ? [value, this.dom.scrollTop] : [this.dom.scrollLeft, value];
+                this.anim({scroll: {"to": to}}, this.preanim(arguments, 2), 'scroll');
+            }
+            return this;
+        },
+
+        /**
+         * Scrolls this element the specified direction. Does bounds checking to make sure the scroll is
+         * within this element's scrollable range.
+         * @param {String} direction Possible values are: "l","left" - "r","right" - "t","top","up" - "b","bottom","down".
+         * @param {Number} distance How far to scroll the element in pixels
+         * @param {Boolean/Object} animate (optional) true for the default animation or a standard Element animation config object
+         * @return {Boolean} Returns true if a scroll was triggered or false if the element
+         * was scrolled as far as it could go.
+         */
+         scroll : function(direction, distance, animate){
+             if(!this.isScrollable()){
+                 return;
+             }
+             var el = this.dom;
+             var l = el.scrollLeft, t = el.scrollTop;
+             var w = el.scrollWidth, h = el.scrollHeight;
+             var cw = el.clientWidth, ch = el.clientHeight;
+             direction = direction.toLowerCase();
+             var scrolled = false;
+             var a = this.preanim(arguments, 2);
+             switch(direction){
+                 case "l":
+                 case "left":
+                     if(w - l > cw){
+                         var v = Math.min(l + distance, w-cw);
+                         this.scrollTo("left", v, a);
+                         scrolled = true;
+                     }
+                     break;
+                case "r":
+                case "right":
+                     if(l > 0){
+                         var v = Math.max(l - distance, 0);
+                         this.scrollTo("left", v, a);
+                         scrolled = true;
+                     }
+                     break;
+                case "t":
+                case "top":
+                case "up":
+                     if(t > 0){
+                         var v = Math.max(t - distance, 0);
+                         this.scrollTo("top", v, a);
+                         scrolled = true;
+                     }
+                     break;
+                case "b":
+                case "bottom":
+                case "down":
+                     if(h - t > ch){
+                         var v = Math.min(t + distance, h-ch);
+                         this.scrollTo("top", v, a);
+                         scrolled = true;
+                     }
+                     break;
+             }
+             return scrolled;
+        },
+
+        /**
+         * Translates the passed page coordinates into left/top css values for this element
+         * @param {Number/Array} x The page x or an array containing [x, y]
+         * @param {Number} y The page y
+         * @return {Object} An object with left and top properties. e.g. {left: (value), top: (value)}
+         */
+        translatePoints : function(x, y){
+            if(typeof x == 'object' || x instanceof Array){
+                y = x[1]; x = x[0];
+            }
+            var p = this.getStyle('position');
+            var o = this.getXY();
+
+            var l = parseInt(this.getStyle('left'), 10);
+            var t = parseInt(this.getStyle('top'), 10);
+
+            if(isNaN(l)){
+                l = (p == "relative") ? 0 : this.dom.offsetLeft;
+            }
+            if(isNaN(t)){
+                t = (p == "relative") ? 0 : this.dom.offsetTop;
+            }
+
+            return {left: (x - o[0] + l), top: (y - o[1] + t)};
+        },
+
+        /**
+         * Returns the current scroll position of the element.
+         * @return {Object} An object containing the scroll position in the format {left: (scrollLeft), top: (scrollTop)}
+         */
+        getScroll : function(){
+            var d = this.dom, doc = document;
+            if(d == doc || d == doc.body){
+                var l = window.pageXOffset || doc.documentElement.scrollLeft || doc.body.scrollLeft || 0;
+                var t = window.pageYOffset || doc.documentElement.scrollTop || doc.body.scrollTop || 0;
+                return {left: l, top: t};
+            }else{
+                return {left: d.scrollLeft, top: d.scrollTop};
+            }
+        },
+
+        /**
+         * Return the CSS color for the specified CSS attribute. rgb, 3 digit (like #fff) and valid values
+         * are convert to standard 6 digit hex color.
+         * @param {String} attr The css attribute
+         * @param {String} defaultValue The default value to use when a valid color isn't found
+         * @param {String} prefix (optional) defaults to #. Use an empty string when working with
+         * YUI color anims.
+         */
+        getColor : function(attr, defaultValue, prefix){
+            var v = this.getStyle(attr);
+            if(!v || v == "transparent" || v == "inherit") {
+                return defaultValue;
+            }
+            var color = typeof prefix == "undefined" ? "#" : prefix;
+            if(v.substr(0, 4) == "rgb("){
+                var rvs = v.slice(4, v.length -1).split(",");
+                for(var i = 0; i < 3; i++){
+                    var h = parseInt(rvs[i]).toString(16);
+                    if(h < 16){
+                        h = "0" + h;
+                    }
+                    color += h;
+                }
+            } else {
+                if(v.substr(0, 1) == "#"){
+                    if(v.length == 4) {
+                        for(var i = 1; i < 4; i++){
+                            var c = v.charAt(i);
+                            color +=  c + c;
+                        }
+                    }else if(v.length == 7){
+                        color += v.substr(1);
+                    }
+                }
+            }
+            return(color.length > 5 ? color.toLowerCase() : defaultValue);
+        },
+
+        /**
+         * Wraps the specified element with a special markup/CSS block that renders by default as a gray container with a
+         * gradient background, rounded corners and a 4-way shadow.
+         * @param {String} class (optional) A base CSS class to apply to the containing wrapper element (defaults to 'x-box').
+         * Note that there are a number of CSS rules that are dependent on this name to make the overall effect work,
+         * so if you supply an alternate base class, make sure you also supply all of the necessary rules.
+         * @return {Roo.Element} this
+         */
+        boxWrap : function(cls){
+            cls = cls || 'x-box';
+            var el = Roo.get(this.insertHtml('beforeBegin', String.format('<div class="{0}">'+El.boxMarkup+'</div>', cls)));
+            el.child('.'+cls+'-mc').dom.appendChild(this.dom);
+            return el;
+        },
+
+        /**
+         * Returns the value of a namespaced attribute from the element's underlying DOM node.
+         * @param {String} namespace The namespace in which to look for the attribute
+         * @param {String} name The attribute name
+         * @return {String} The attribute value
+         */
+        getAttributeNS : Roo.isIE ? function(ns, name){
+            var d = this.dom;
+            var type = typeof d[ns+":"+name];
+            if(type != 'undefined' && type != 'unknown'){
+                return d[ns+":"+name];
+            }
+            return d[name];
+        } : function(ns, name){
+            var d = this.dom;
+            return d.getAttributeNS(ns, name) || d.getAttribute(ns+":"+name) || d.getAttribute(name) || d[name];
+        }
+    };
+
+    var ep = El.prototype;
+
+    /**
+     * Appends an event handler (Shorthand for addListener)
+     * @param {String}   eventName     The type of event to append
+     * @param {Function} fn        The method the event invokes
+     * @param {Object} scope       (optional) The scope (this object) of the fn
+     * @param {Object}   options   (optional)An object with standard {@link Roo.EventManager#addListener} options
+     * @method
+     */
+    ep.on = ep.addListener;
+        // backwards compat
+    ep.mon = ep.addListener;
+
+    /**
+     * Removes an event handler from this element (shorthand for removeListener)
+     * @param {String} eventName the type of event to remove
+     * @param {Function} fn the method the event invokes
+     * @return {Roo.Element} this
+     * @method
+     */
+    ep.un = ep.removeListener;
+
+    /**
+     * true to automatically adjust width and height settings for box-model issues (default to true)
+     */
+    ep.autoBoxAdjust = true;
+
+    // private
+    El.unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;
+
+    // private
+    El.addUnits = function(v, defaultUnit){
+        if(v === "" || v == "auto"){
+            return v;
+        }
+        if(v === undefined){
+            return '';
+        }
+        if(typeof v == "number" || !El.unitPattern.test(v)){
+            return v + (defaultUnit || 'px');
+        }
+        return v;
+    };
+
+    // special markup used throughout Roo when box wrapping elements
+    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>';
+    /**
+     * Visibility mode constant - Use visibility to hide element
+     * @static
+     * @type Number
+     */
+    El.VISIBILITY = 1;
+    /**
+     * Visibility mode constant - Use display to hide element
+     * @static
+     * @type Number
+     */
+    El.DISPLAY = 2;
+
+    El.borders = {l: "border-left-width", r: "border-right-width", t: "border-top-width", b: "border-bottom-width"};
+    El.paddings = {l: "padding-left", r: "padding-right", t: "padding-top", b: "padding-bottom"};
+    El.margins = {l: "margin-left", r: "margin-right", t: "margin-top", b: "margin-bottom"};
+
+
+
+    /**
+     * @private
+     */
+    El.cache = {};
+
+    var docEl;
+
+    /**
+     * Static method to retrieve Element objects. Uses simple caching to consistently return the same object.
+     * Automatically fixes if an object was recreated with the same id via AJAX or DOM.
+     * @param {String/HTMLElement/Element} el The id of the node, a DOM Node or an existing Element.
+     * @return {Element} The Element object
+     * @static
+     */
+    El.get = function(el){
+        var ex, elm, id;
+        if(!el){ return null; }
+        if(typeof el == "string"){ // element id
+            if(!(elm = document.getElementById(el))){
+                return null;
+            }
+            if(ex = El.cache[el]){
+                ex.dom = elm;
+            }else{
+                ex = El.cache[el] = new El(elm);
+            }
+            return ex;
+        }else if(el.tagName){ // dom element
+            if(!(id = el.id)){
+                id = Roo.id(el);
+            }
+            if(ex = El.cache[id]){
+                ex.dom = el;
+            }else{
+                ex = El.cache[id] = new El(el);
+            }
+            return ex;
+        }else if(el instanceof El){
+            if(el != docEl){
+                el.dom = document.getElementById(el.id) || el.dom; // refresh dom element in case no longer valid,
+                                                              // catch case where it hasn't been appended
+                El.cache[el.id] = el; // in case it was created directly with Element(), let's cache it
+            }
+            return el;
+        }else if(el.isComposite){
+            return el;
+        }else if(el instanceof Array){
+            return El.select(el);
+        }else if(el == document){
+            // create a bogus element object representing the document object
+            if(!docEl){
+                var f = function(){};
+                f.prototype = El.prototype;
+                docEl = new f();
+                docEl.dom = document;
+            }
+            return docEl;
+        }
+        return null;
+    };
+
+    // private
+    El.uncache = function(el){
+        for(var i = 0, a = arguments, len = a.length; i < len; i++) {
+            if(a[i]){
+                delete El.cache[a[i].id || a[i]];
+            }
+        }
+    };
+
+    // private
+    // Garbage collection - uncache elements/purge listeners on orphaned elements
+    // so we don't hold a reference and cause the browser to retain them
+    El.garbageCollect = function(){
+        if(!Roo.enableGarbageCollector){
+            clearInterval(El.collectorThread);
+            return;
+        }
+        for(var eid in El.cache){
+            var el = El.cache[eid], d = el.dom;
+            // -------------------------------------------------------
+            // Determining what is garbage:
+            // -------------------------------------------------------
+            // !d
+            // dom node is null, definitely garbage
+            // -------------------------------------------------------
+            // !d.parentNode
+            // no parentNode == direct orphan, definitely garbage
+            // -------------------------------------------------------
+            // !d.offsetParent && !document.getElementById(eid)
+            // display none elements have no offsetParent so we will
+            // also try to look it up by it's id. However, check
+            // offsetParent first so we don't do unneeded lookups.
+            // This enables collection of elements that are not orphans
+            // directly, but somewhere up the line they have an orphan
+            // parent.
+            // -------------------------------------------------------
+            if(!d || !d.parentNode || (!d.offsetParent && !document.getElementById(eid))){
+                delete El.cache[eid];
+                if(d && Roo.enableListenerCollection){
+                    E.purgeElement(d);
+                }
+            }
+        }
+    }
+    El.collectorThreadId = setInterval(El.garbageCollect, 30000);
+
+
+    // dom is optional
+    El.Flyweight = function(dom){
+        this.dom = dom;
+    };
+    El.Flyweight.prototype = El.prototype;
+
+    El._flyweights = {};
+    /**
+     * Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
+     * the dom node can be overwritten by other code.
+     * @param {String/HTMLElement} el The dom node or id
+     * @param {String} named (optional) Allows for creation of named reusable flyweights to
+     *                                  prevent conflicts (e.g. internally Roo uses "_internal")
+     * @static
+     * @return {Element} The shared Element object
+     */
+    El.fly = function(el, named){
+        named = named || '_global';
+        el = Roo.getDom(el);
+        if(!el){
+            return null;
+        }
+        if(!El._flyweights[named]){
+            El._flyweights[named] = new El.Flyweight();
+        }
+        El._flyweights[named].dom = el;
+        return El._flyweights[named];
+    };
+
+    /**
+     * Static method to retrieve Element objects. Uses simple caching to consistently return the same object.
+     * Automatically fixes if an object was recreated with the same id via AJAX or DOM.
+     * Shorthand of {@link Roo.Element#get}
+     * @param {String/HTMLElement/Element} el The id of the node, a DOM Node or an existing Element.
+     * @return {Element} The Element object
+     * @member Roo
+     * @method get
+     */
+    Roo.get = El.get;
+    /**
+     * Gets the globally shared flyweight Element, with the passed node as the active element. Do not store a reference to this element -
+     * the dom node can be overwritten by other code.
+     * Shorthand of {@link Roo.Element#fly}
+     * @param {String/HTMLElement} el The dom node or id
+     * @param {String} named (optional) Allows for creation of named reusable flyweights to
+     *                                  prevent conflicts (e.g. internally Roo uses "_internal")
+     * @static
+     * @return {Element} The shared Element object
+     * @member Roo
+     * @method fly
+     */
+    Roo.fly = El.fly;
+
+    // speedy lookup for elements never to box adjust
+    var noBoxAdjust = Roo.isStrict ? {
+        select:1
+    } : {
+        input:1, select:1, textarea:1
+    };
+    if(Roo.isIE || Roo.isGecko){
+        noBoxAdjust['button'] = 1;
+    }
+
+
+    Roo.EventManager.on(window, 'unload', function(){
+        delete El.cache;
+        delete El._flyweights;
+    });
+})();
+
+
+
+
+if(Roo.DomQuery){
+    Roo.Element.selectorFunction = Roo.DomQuery.select;
+}
+
+Roo.Element.select = function(selector, unique, root){
+    var els;
+    if(typeof selector == "string"){
+        els = Roo.Element.selectorFunction(selector, root);
+    }else if(selector.length !== undefined){
+        els = selector;
+    }else{
+        throw "Invalid selector";
+    }
+    if(unique === true){
+        return new Roo.CompositeElement(els);
+    }else{
+        return new Roo.CompositeElementLite(els);
+    }
+};
+/**
+ * Selects elements based on the passed CSS selector to enable working on them as 1.
+ * @param {String/Array} selector The CSS selector or an array of elements
+ * @param {Boolean} unique (optional) true to create a unique Roo.Element for each element (defaults to a shared flyweight object)
+ * @param {HTMLElement/String} root (optional) The root element of the query or id of the root
+ * @return {CompositeElementLite/CompositeElement}
+ * @member Roo
+ * @method select
+ */
+Roo.select = Roo.Element.select;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+
+
+//Notifies Element that fx methods are available
+Roo.enableFx = true;
+
+/**
+ * @class Roo.Fx
+ * <p>A class to provide basic animation and visual effects support.  <b>Note:</b> This class is automatically applied
+ * to the {@link Roo.Element} interface when included, so all effects calls should be performed via Element.
+ * Conversely, since the effects are not actually defined in Element, Roo.Fx <b>must</b> be included in order for the 
+ * Element effects to work.</p><br/>
+ *
+ * <p>It is important to note that although the Fx methods and many non-Fx Element methods support "method chaining" in that
+ * they return the Element object itself as the method return value, it is not always possible to mix the two in a single
+ * method chain.  The Fx methods use an internal effects queue so that each effect can be properly timed and sequenced.
+ * Non-Fx methods, on the other hand, have no such internal queueing and will always execute immediately.  For this reason,
+ * while it may be possible to mix certain Fx and non-Fx method calls in a single chain, it may not always provide the
+ * expected results and should be done with care.</p><br/>
+ *
+ * <p>Motion effects support 8-way anchoring, meaning that you can choose one of 8 different anchor points on the Element
+ * that will serve as either the start or end point of the animation.  Following are all of the supported anchor positions:</p>
+<pre>
+Value  Description
+-----  -----------------------------
+tl     The top left corner
+t      The center of the top edge
+tr     The top right corner
+l      The center of the left edge
+r      The center of the right edge
+bl     The bottom left corner
+b      The center of the bottom edge
+br     The bottom right corner
+</pre>
+ * <b>Although some Fx methods accept specific custom config parameters, the ones shown in the Config Options section
+ * below are common options that can be passed to any Fx method.</b>
+ * @cfg {Function} callback A function called when the effect is finished
+ * @cfg {Object} scope The scope of the effect function
+ * @cfg {String} easing A valid Easing value for the effect
+ * @cfg {String} afterCls A css class to apply after the effect
+ * @cfg {Number} duration The length of time (in seconds) that the effect should last
+ * @cfg {Boolean} remove Whether the Element should be removed from the DOM and destroyed after the effect finishes
+ * @cfg {Boolean} useDisplay Whether to use the <i>display</i> CSS property instead of <i>visibility</i> when hiding Elements (only applies to 
+ * effects that end with the element being visually hidden, ignored otherwise)
+ * @cfg {String/Object/Function} afterStyle A style specification string, e.g. "width:100px", or an object in the form {width:"100px"}, or
+ * a function which returns such a specification that will be applied to the Element after the effect finishes
+ * @cfg {Boolean} block Whether the effect should block other effects from queueing while it runs
+ * @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
+ * @cfg {Boolean} stopFx Whether subsequent effects should be stopped and removed after the current effect finishes
+ */
+Roo.Fx = {
+       /**
+        * Slides the element into view.  An anchor point can be optionally passed to set the point of
+        * origin for the slide effect.  This function automatically handles wrapping the element with
+        * a fixed-size container if needed.  See the Fx class overview for valid anchor point options.
+        * Usage:
+        *<pre><code>
+// default: slide the element in from the top
+el.slideIn();
+
+// custom: slide the element in from the right with a 2-second duration
+el.slideIn('r', { duration: 2 });
+
+// common config options shown with default values
+el.slideIn('t', {
+    easing: 'easeOut',
+    duration: .5
+});
+</code></pre>
+        * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to top: 't')
+        * @param {Object} options (optional) Object literal with any of the Fx config options
+        * @return {Roo.Element} The Element
+        */
+    slideIn : function(anchor, o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+
+            anchor = anchor || "t";
+
+            // fix display to visibility
+            this.fixDisplay();
+
+            // restore values after effect
+            var r = this.getFxRestore();
+            var b = this.getBox();
+            // fixed size for slide
+            this.setSize(b);
+
+            // wrap if needed
+            var wrap = this.fxWrap(r.pos, o, "hidden");
+
+            var st = this.dom.style;
+            st.visibility = "visible";
+            st.position = "absolute";
+
+            // clear out temp styles after slide and unwrap
+            var after = function(){
+                el.fxUnwrap(wrap, r.pos, o);
+                st.width = r.width;
+                st.height = r.height;
+                el.afterFx(o);
+            };
+            // time to calc the positions
+            var a, pt = {to: [b.x, b.y]}, bw = {to: b.width}, bh = {to: b.height};
+
+            switch(anchor.toLowerCase()){
+                case "t":
+                    wrap.setSize(b.width, 0);
+                    st.left = st.bottom = "0";
+                    a = {height: bh};
+                break;
+                case "l":
+                    wrap.setSize(0, b.height);
+                    st.right = st.top = "0";
+                    a = {width: bw};
+                break;
+                case "r":
+                    wrap.setSize(0, b.height);
+                    wrap.setX(b.right);
+                    st.left = st.top = "0";
+                    a = {width: bw, points: pt};
+                break;
+                case "b":
+                    wrap.setSize(b.width, 0);
+                    wrap.setY(b.bottom);
+                    st.left = st.top = "0";
+                    a = {height: bh, points: pt};
+                break;
+                case "tl":
+                    wrap.setSize(0, 0);
+                    st.right = st.bottom = "0";
+                    a = {width: bw, height: bh};
+                break;
+                case "bl":
+                    wrap.setSize(0, 0);
+                    wrap.setY(b.y+b.height);
+                    st.right = st.top = "0";
+                    a = {width: bw, height: bh, points: pt};
+                break;
+                case "br":
+                    wrap.setSize(0, 0);
+                    wrap.setXY([b.right, b.bottom]);
+                    st.left = st.top = "0";
+                    a = {width: bw, height: bh, points: pt};
+                break;
+                case "tr":
+                    wrap.setSize(0, 0);
+                    wrap.setX(b.x+b.width);
+                    st.left = st.bottom = "0";
+                    a = {width: bw, height: bh, points: pt};
+                break;
+            }
+            this.dom.style.visibility = "visible";
+            wrap.show();
+
+            arguments.callee.anim = wrap.fxanim(a,
+                o,
+                'motion',
+                .5,
+                'easeOut', after);
+        });
+        return this;
+    },
+    
+       /**
+        * Slides the element out of view.  An anchor point can be optionally passed to set the end point
+        * for the slide effect.  When the effect is completed, the element will be hidden (visibility = 
+        * 'hidden') but block elements will still take up space in the document.  The element must be removed
+        * from the DOM using the 'remove' config option if desired.  This function automatically handles 
+        * wrapping the element with a fixed-size container if needed.  See the Fx class overview for valid anchor point options.
+        * Usage:
+        *<pre><code>
+// default: slide the element out to the top
+el.slideOut();
+
+// custom: slide the element out to the right with a 2-second duration
+el.slideOut('r', { duration: 2 });
+
+// common config options shown with default values
+el.slideOut('t', {
+    easing: 'easeOut',
+    duration: .5,
+    remove: false,
+    useDisplay: false
+});
+</code></pre>
+        * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to top: 't')
+        * @param {Object} options (optional) Object literal with any of the Fx config options
+        * @return {Roo.Element} The Element
+        */
+    slideOut : function(anchor, o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+
+            anchor = anchor || "t";
+
+            // restore values after effect
+            var r = this.getFxRestore();
+            
+            var b = this.getBox();
+            // fixed size for slide
+            this.setSize(b);
+
+            // wrap if needed
+            var wrap = this.fxWrap(r.pos, o, "visible");
+
+            var st = this.dom.style;
+            st.visibility = "visible";
+            st.position = "absolute";
+
+            wrap.setSize(b);
+
+            var after = function(){
+                if(o.useDisplay){
+                    el.setDisplayed(false);
+                }else{
+                    el.hide();
+                }
+
+                el.fxUnwrap(wrap, r.pos, o);
+
+                st.width = r.width;
+                st.height = r.height;
+
+                el.afterFx(o);
+            };
+
+            var a, zero = {to: 0};
+            switch(anchor.toLowerCase()){
+                case "t":
+                    st.left = st.bottom = "0";
+                    a = {height: zero};
+                break;
+                case "l":
+                    st.right = st.top = "0";
+                    a = {width: zero};
+                break;
+                case "r":
+                    st.left = st.top = "0";
+                    a = {width: zero, points: {to:[b.right, b.y]}};
+                break;
+                case "b":
+                    st.left = st.top = "0";
+                    a = {height: zero, points: {to:[b.x, b.bottom]}};
+                break;
+                case "tl":
+                    st.right = st.bottom = "0";
+                    a = {width: zero, height: zero};
+                break;
+                case "bl":
+                    st.right = st.top = "0";
+                    a = {width: zero, height: zero, points: {to:[b.x, b.bottom]}};
+                break;
+                case "br":
+                    st.left = st.top = "0";
+                    a = {width: zero, height: zero, points: {to:[b.x+b.width, b.bottom]}};
+                break;
+                case "tr":
+                    st.left = st.bottom = "0";
+                    a = {width: zero, height: zero, points: {to:[b.right, b.y]}};
+                break;
+            }
+
+            arguments.callee.anim = wrap.fxanim(a,
+                o,
+                'motion',
+                .5,
+                "easeOut", after);
+        });
+        return this;
+    },
+
+       /**
+        * Fades the element out while slowly expanding it in all directions.  When the effect is completed, the 
+        * element will be hidden (visibility = 'hidden') but block elements will still take up space in the document. 
+        * The element must be removed from the DOM using the 'remove' config option if desired.
+        * Usage:
+        *<pre><code>
+// default
+el.puff();
+
+// common config options shown with default values
+el.puff({
+    easing: 'easeOut',
+    duration: .5,
+    remove: false,
+    useDisplay: false
+});
+</code></pre>
+        * @param {Object} options (optional) Object literal with any of the Fx config options
+        * @return {Roo.Element} The Element
+        */
+    puff : function(o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+            this.clearOpacity();
+            this.show();
+
+            // restore values after effect
+            var r = this.getFxRestore();
+            var st = this.dom.style;
+
+            var after = function(){
+                if(o.useDisplay){
+                    el.setDisplayed(false);
+                }else{
+                    el.hide();
+                }
+
+                el.clearOpacity();
+
+                el.setPositioning(r.pos);
+                st.width = r.width;
+                st.height = r.height;
+                st.fontSize = '';
+                el.afterFx(o);
+            };
+
+            var width = this.getWidth();
+            var height = this.getHeight();
+
+            arguments.callee.anim = this.fxanim({
+                    width : {to: this.adjustWidth(width * 2)},
+                    height : {to: this.adjustHeight(height * 2)},
+                    points : {by: [-(width * .5), -(height * .5)]},
+                    opacity : {to: 0},
+                    fontSize: {to:200, unit: "%"}
+                },
+                o,
+                'motion',
+                .5,
+                "easeOut", after);
+        });
+        return this;
+    },
+
+       /**
+        * Blinks the element as if it was clicked and then collapses on its center (similar to switching off a television).
+        * When the effect is completed, the element will be hidden (visibility = 'hidden') but block elements will still 
+        * take up space in the document. The element must be removed from the DOM using the 'remove' config option if desired.
+        * Usage:
+        *<pre><code>
+// default
+el.switchOff();
+
+// all config options shown with default values
+el.switchOff({
+    easing: 'easeIn',
+    duration: .3,
+    remove: false,
+    useDisplay: false
+});
+</code></pre>
+        * @param {Object} options (optional) Object literal with any of the Fx config options
+        * @return {Roo.Element} The Element
+        */
+    switchOff : function(o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+            this.clearOpacity();
+            this.clip();
+
+            // restore values after effect
+            var r = this.getFxRestore();
+            var st = this.dom.style;
+
+            var after = function(){
+                if(o.useDisplay){
+                    el.setDisplayed(false);
+                }else{
+                    el.hide();
+                }
+
+                el.clearOpacity();
+                el.setPositioning(r.pos);
+                st.width = r.width;
+                st.height = r.height;
+
+                el.afterFx(o);
+            };
+
+            this.fxanim({opacity:{to:0.3}}, null, null, .1, null, function(){
+                this.clearOpacity();
+                (function(){
+                    this.fxanim({
+                        height:{to:1},
+                        points:{by:[0, this.getHeight() * .5]}
+                    }, o, 'motion', 0.3, 'easeIn', after);
+                }).defer(100, this);
+            });
+        });
+        return this;
+    },
+
+    /**
+     * Highlights the Element by setting a color (applies to the background-color by default, but can be
+     * changed using the "attr" config option) and then fading back to the original color. If no original
+     * color is available, you should provide the "endColor" config option which will be cleared after the animation.
+     * Usage:
+<pre><code>
+// default: highlight background to yellow
+el.highlight();
+
+// custom: highlight foreground text to blue for 2 seconds
+el.highlight("0000ff", { attr: 'color', duration: 2 });
+
+// common config options shown with default values
+el.highlight("ffff9c", {
+    attr: "background-color", //can be any valid CSS property (attribute) that supports a color value
+    endColor: (current color) or "ffffff",
+    easing: 'easeIn',
+    duration: 1
+});
+</code></pre>
+     * @param {String} color (optional) The highlight color. Should be a 6 char hex color without the leading # (defaults to yellow: 'ffff9c')
+     * @param {Object} options (optional) Object literal with any of the Fx config options
+     * @return {Roo.Element} The Element
+     */        
+    highlight : function(color, o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+            color = color || "ffff9c";
+            attr = o.attr || "backgroundColor";
+
+            this.clearOpacity();
+            this.show();
+
+            var origColor = this.getColor(attr);
+            var restoreColor = this.dom.style[attr];
+            endColor = (o.endColor || origColor) || "ffffff";
+
+            var after = function(){
+                el.dom.style[attr] = restoreColor;
+                el.afterFx(o);
+            };
+
+            var a = {};
+            a[attr] = {from: color, to: endColor};
+            arguments.callee.anim = this.fxanim(a,
+                o,
+                'color',
+                1,
+                'easeIn', after);
+        });
+        return this;
+    },
+
+   /**
+    * Shows a ripple of exploding, attenuating borders to draw attention to an Element.
+    * Usage:
+<pre><code>
+// default: a single light blue ripple
+el.frame();
+
+// custom: 3 red ripples lasting 3 seconds total
+el.frame("ff0000", 3, { duration: 3 });
+
+// common config options shown with default values
+el.frame("C3DAF9", 1, {
+    duration: 1 //duration of entire animation (not each individual ripple)
+    // Note: Easing is not configurable and will be ignored if included
+});
+</code></pre>
+    * @param {String} color (optional) The color of the border.  Should be a 6 char hex color without the leading # (defaults to light blue: 'C3DAF9').
+    * @param {Number} count (optional) The number of ripples to display (defaults to 1)
+    * @param {Object} options (optional) Object literal with any of the Fx config options
+    * @return {Roo.Element} The Element
+    */
+    frame : function(color, count, o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+            color = color || "#C3DAF9";
+            if(color.length == 6){
+                color = "#" + color;
+            }
+            count = count || 1;
+            duration = o.duration || 1;
+            this.show();
+
+            var b = this.getBox();
+            var animFn = function(){
+                var proxy = this.createProxy({
+
+                     style:{
+                        visbility:"hidden",
+                        position:"absolute",
+                        "z-index":"35000", // yee haw
+                        border:"0px solid " + color
+                     }
+                  });
+                var scale = Roo.isBorderBox ? 2 : 1;
+                proxy.animate({
+                    top:{from:b.y, to:b.y - 20},
+                    left:{from:b.x, to:b.x - 20},
+                    borderWidth:{from:0, to:10},
+                    opacity:{from:1, to:0},
+                    height:{from:b.height, to:(b.height + (20*scale))},
+                    width:{from:b.width, to:(b.width + (20*scale))}
+                }, duration, function(){
+                    proxy.remove();
+                });
+                if(--count > 0){
+                     animFn.defer((duration/2)*1000, this);
+                }else{
+                    el.afterFx(o);
+                }
+            };
+            animFn.call(this);
+        });
+        return this;
+    },
+
+   /**
+    * Creates a pause before any subsequent queued effects begin.  If there are
+    * no effects queued after the pause it will have no effect.
+    * Usage:
+<pre><code>
+el.pause(1);
+</code></pre>
+    * @param {Number} seconds The length of time to pause (in seconds)
+    * @return {Roo.Element} The Element
+    */
+    pause : function(seconds){
+        var el = this.getFxEl();
+        var o = {};
+
+        el.queueFx(o, function(){
+            setTimeout(function(){
+                el.afterFx(o);
+            }, seconds * 1000);
+        });
+        return this;
+    },
+
+   /**
+    * Fade an element in (from transparent to opaque).  The ending opacity can be specified
+    * using the "endOpacity" config option.
+    * Usage:
+<pre><code>
+// default: fade in from opacity 0 to 100%
+el.fadeIn();
+
+// custom: fade in from opacity 0 to 75% over 2 seconds
+el.fadeIn({ endOpacity: .75, duration: 2});
+
+// common config options shown with default values
+el.fadeIn({
+    endOpacity: 1, //can be any value between 0 and 1 (e.g. .5)
+    easing: 'easeOut',
+    duration: .5
+});
+</code></pre>
+    * @param {Object} options (optional) Object literal with any of the Fx config options
+    * @return {Roo.Element} The Element
+    */
+    fadeIn : function(o){
+        var el = this.getFxEl();
+        o = o || {};
+        el.queueFx(o, function(){
+            this.setOpacity(0);
+            this.fixDisplay();
+            this.dom.style.visibility = 'visible';
+            var to = o.endOpacity || 1;
+            arguments.callee.anim = this.fxanim({opacity:{to:to}},
+                o, null, .5, "easeOut", function(){
+                if(to == 1){
+                    this.clearOpacity();
+                }
+                el.afterFx(o);
+            });
+        });
+        return this;
+    },
+
+   /**
+    * Fade an element out (from opaque to transparent).  The ending opacity can be specified
+    * using the "endOpacity" config option.
+    * Usage:
+<pre><code>
+// default: fade out from the element's current opacity to 0
+el.fadeOut();
+
+// custom: fade out from the element's current opacity to 25% over 2 seconds
+el.fadeOut({ endOpacity: .25, duration: 2});
+
+// common config options shown with default values
+el.fadeOut({
+    endOpacity: 0, //can be any value between 0 and 1 (e.g. .5)
+    easing: 'easeOut',
+    duration: .5
+    remove: false,
+    useDisplay: false
+});
+</code></pre>
+    * @param {Object} options (optional) Object literal with any of the Fx config options
+    * @return {Roo.Element} The Element
+    */
+    fadeOut : function(o){
+        var el = this.getFxEl();
+        o = o || {};
+        el.queueFx(o, function(){
+            arguments.callee.anim = this.fxanim({opacity:{to:o.endOpacity || 0}},
+                o, null, .5, "easeOut", function(){
+                if(this.visibilityMode == Roo.Element.DISPLAY || o.useDisplay){
+                     this.dom.style.display = "none";
+                }else{
+                     this.dom.style.visibility = "hidden";
+                }
+                this.clearOpacity();
+                el.afterFx(o);
+            });
+        });
+        return this;
+    },
+
+   /**
+    * Animates the transition of an element's dimensions from a starting height/width
+    * to an ending height/width.
+    * Usage:
+<pre><code>
+// change height and width to 100x100 pixels
+el.scale(100, 100);
+
+// common config options shown with default values.  The height and width will default to
+// the element's existing values if passed as null.
+el.scale(
+    [element's width],
+    [element's height], {
+    easing: 'easeOut',
+    duration: .35
+});
+</code></pre>
+    * @param {Number} width  The new width (pass undefined to keep the original width)
+    * @param {Number} height  The new height (pass undefined to keep the original height)
+    * @param {Object} options (optional) Object literal with any of the Fx config options
+    * @return {Roo.Element} The Element
+    */
+    scale : function(w, h, o){
+        this.shift(Roo.apply({}, o, {
+            width: w,
+            height: h
+        }));
+        return this;
+    },
+
+   /**
+    * Animates the transition of any combination of an element's dimensions, xy position and/or opacity.
+    * Any of these properties not specified in the config object will not be changed.  This effect 
+    * requires that at least one new dimension, position or opacity setting must be passed in on
+    * the config object in order for the function to have any effect.
+    * Usage:
+<pre><code>
+// slide the element horizontally to x position 200 while changing the height and opacity
+el.shift({ x: 200, height: 50, opacity: .8 });
+
+// common config options shown with default values.
+el.shift({
+    width: [element's width],
+    height: [element's height],
+    x: [element's x position],
+    y: [element's y position],
+    opacity: [element's opacity],
+    easing: 'easeOut',
+    duration: .35
+});
+</code></pre>
+    * @param {Object} options  Object literal with any of the Fx config options
+    * @return {Roo.Element} The Element
+    */
+    shift : function(o){
+        var el = this.getFxEl();
+        o = o || {};
+        el.queueFx(o, function(){
+            var a = {}, w = o.width, h = o.height, x = o.x, y = o.y,  op = o.opacity;
+            if(w !== undefined){
+                a.width = {to: this.adjustWidth(w)};
+            }
+            if(h !== undefined){
+                a.height = {to: this.adjustHeight(h)};
+            }
+            if(x !== undefined || y !== undefined){
+                a.points = {to: [
+                    x !== undefined ? x : this.getX(),
+                    y !== undefined ? y : this.getY()
+                ]};
+            }
+            if(op !== undefined){
+                a.opacity = {to: op};
+            }
+            if(o.xy !== undefined){
+                a.points = {to: o.xy};
+            }
+            arguments.callee.anim = this.fxanim(a,
+                o, 'motion', .35, "easeOut", function(){
+                el.afterFx(o);
+            });
+        });
+        return this;
+    },
+
+       /**
+        * Slides the element while fading it out of view.  An anchor point can be optionally passed to set the 
+        * ending point of the effect.
+        * Usage:
+        *<pre><code>
+// default: slide the element downward while fading out
+el.ghost();
+
+// custom: slide the element out to the right with a 2-second duration
+el.ghost('r', { duration: 2 });
+
+// common config options shown with default values
+el.ghost('b', {
+    easing: 'easeOut',
+    duration: .5
+    remove: false,
+    useDisplay: false
+});
+</code></pre>
+        * @param {String} anchor (optional) One of the valid Fx anchor positions (defaults to bottom: 'b')
+        * @param {Object} options (optional) Object literal with any of the Fx config options
+        * @return {Roo.Element} The Element
+        */
+    ghost : function(anchor, o){
+        var el = this.getFxEl();
+        o = o || {};
+
+        el.queueFx(o, function(){
+            anchor = anchor || "b";
+
+            // restore values after effect
+            var r = this.getFxRestore();
+            var w = this.getWidth(),
+                h = this.getHeight();
+
+            var st = this.dom.style;
+
+            var after = function(){
+                if(o.useDisplay){
+                    el.setDisplayed(false);
+                }else{
+                    el.hide();
+                }
+
+                el.clearOpacity();
+                el.setPositioning(r.pos);
+                st.width = r.width;
+                st.height = r.height;
+
+                el.afterFx(o);
+            };
+
+            var a = {opacity: {to: 0}, points: {}}, pt = a.points;
+            switch(anchor.toLowerCase()){
+                case "t":
+                    pt.by = [0, -h];
+                break;
+                case "l":
+                    pt.by = [-w, 0];
+                break;
+                case "r":
+                    pt.by = [w, 0];
+                break;
+                case "b":
+                    pt.by = [0, h];
+                break;
+                case "tl":
+                    pt.by = [-w, -h];
+                break;
+                case "bl":
+                    pt.by = [-w, h];
+                break;
+                case "br":
+                    pt.by = [w, h];
+                break;
+                case "tr":
+                    pt.by = [w, -h];
+                break;
+            }
+
+            arguments.callee.anim = this.fxanim(a,
+                o,
+                'motion',
+                .5,
+                "easeOut", after);
+        });
+        return this;
+    },
+
+       /**
+        * Ensures that all effects queued after syncFx is called on the element are
+        * run concurrently.  This is the opposite of {@link #sequenceFx}.
+        * @return {Roo.Element} The Element
+        */
+    syncFx : function(){
+        this.fxDefaults = Roo.apply(this.fxDefaults || {}, {
+            block : false,
+            concurrent : true,
+            stopFx : false
+        });
+        return this;
+    },
+
+       /**
+        * Ensures that all effects queued after sequenceFx is called on the element are
+        * run in sequence.  This is the opposite of {@link #syncFx}.
+        * @return {Roo.Element} The Element
+        */
+    sequenceFx : function(){
+        this.fxDefaults = Roo.apply(this.fxDefaults || {}, {
+            block : false,
+            concurrent : false,
+            stopFx : false
+        });
+        return this;
+    },
+
+       /* @private */
+    nextFx : function(){
+        var ef = this.fxQueue[0];
+        if(ef){
+            ef.call(this);
+        }
+    },
+
+       /**
+        * Returns true if the element has any effects actively running or queued, else returns false.
+        * @return {Boolean} True if element has active effects, else false
+        */
+    hasActiveFx : function(){
+        return this.fxQueue && this.fxQueue[0];
+    },
+
+       /**
+        * Stops any running effects and clears the element's internal effects queue if it contains
+        * any additional effects that haven't started yet.
+        * @return {Roo.Element} The Element
+        */
+    stopFx : function(){
+        if(this.hasActiveFx()){
+            var cur = this.fxQueue[0];
+            if(cur && cur.anim && cur.anim.isAnimated()){
+                this.fxQueue = [cur]; // clear out others
+                cur.anim.stop(true);
+            }
+        }
+        return this;
+    },
+
+       /* @private */
+    beforeFx : function(o){
+        if(this.hasActiveFx() && !o.concurrent){
+           if(o.stopFx){
+               this.stopFx();
+               return true;
+           }
+           return false;
+        }
+        return true;
+    },
+
+       /**
+        * Returns true if the element is currently blocking so that no other effect can be queued
+        * until this effect is finished, else returns false if blocking is not set.  This is commonly
+        * used to ensure that an effect initiated by a user action runs to completion prior to the
+        * same effect being restarted (e.g., firing only one effect even if the user clicks several times).
+        * @return {Boolean} True if blocking, else false
+        */
+    hasFxBlock : function(){
+        var q = this.fxQueue;
+        return q && q[0] && q[0].block;
+    },
+
+       /* @private */
+    queueFx : function(o, fn){
+        if(!this.fxQueue){
+            this.fxQueue = [];
+        }
+        if(!this.hasFxBlock()){
+            Roo.applyIf(o, this.fxDefaults);
+            if(!o.concurrent){
+                var run = this.beforeFx(o);
+                fn.block = o.block;
+                this.fxQueue.push(fn);
+                if(run){
+                    this.nextFx();
+                }
+            }else{
+                fn.call(this);
+            }
+        }
+        return this;
+    },
+
+       /* @private */
+    fxWrap : function(pos, o, vis){
+        var wrap;
+        if(!o.wrap || !(wrap = Roo.get(o.wrap))){
+            var wrapXY;
+            if(o.fixPosition){
+                wrapXY = this.getXY();
+            }
+            var div = document.createElement("div");
+            div.style.visibility = vis;
+            wrap = Roo.get(this.dom.parentNode.insertBefore(div, this.dom));
+            wrap.setPositioning(pos);
+            if(wrap.getStyle("position") == "static"){
+                wrap.position("relative");
+            }
+            this.clearPositioning('auto');
+            wrap.clip();
+            wrap.dom.appendChild(this.dom);
+            if(wrapXY){
+                wrap.setXY(wrapXY);
+            }
+        }
+        return wrap;
+    },
+
+       /* @private */
+    fxUnwrap : function(wrap, pos, o){
+        this.clearPositioning();
+        this.setPositioning(pos);
+        if(!o.wrap){
+            wrap.dom.parentNode.insertBefore(this.dom, wrap.dom);
+            wrap.remove();
+        }
+    },
+
+       /* @private */
+    getFxRestore : function(){
+        var st = this.dom.style;
+        return {pos: this.getPositioning(), width: st.width, height : st.height};
+    },
+
+       /* @private */
+    afterFx : function(o){
+        if(o.afterStyle){
+            this.applyStyles(o.afterStyle);
+        }
+        if(o.afterCls){
+            this.addClass(o.afterCls);
+        }
+        if(o.remove === true){
+            this.remove();
+        }
+        Roo.callback(o.callback, o.scope, [this]);
+        if(!o.concurrent){
+            this.fxQueue.shift();
+            this.nextFx();
+        }
+    },
+
+       /* @private */
+    getFxEl : function(){ // support for composite element fx
+        return Roo.get(this.dom);
+    },
+
+       /* @private */
+    fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){
+        animType = animType || 'run';
+        opt = opt || {};
+        var anim = Roo.lib.Anim[animType](
+            this.dom, args,
+            (opt.duration || defaultDur) || .35,
+            (opt.easing || defaultEase) || 'easeOut',
+            function(){
+                Roo.callback(cb, this);
+            },
+            this
+        );
+        opt.anim = anim;
+        return anim;
+    }
+};
+
+// backwords compat
+Roo.Fx.resize = Roo.Fx.scale;
+
+//When included, Roo.Fx is automatically applied to Element so that all basic
+//effects are available directly via the Element API
+Roo.apply(Roo.Element.prototype, Roo.Fx);/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+
+/**
+ * @class Roo.CompositeElement
+ * Standard composite class. Creates a Roo.Element for every element in the collection.
+ * <br><br>
+ * <b>NOTE: Although they are not listed, this class supports all of the set/update methods of Roo.Element. All Roo.Element
+ * actions will be performed on all the elements in this collection.</b>
+ * <br><br>
+ * All methods return <i>this</i> and can be chained.
+ <pre><code>
+ var els = Roo.select("#some-el div.some-class", true);
+ // or select directly from an existing element
+ var el = Roo.get('some-el');
+ el.select('div.some-class', true);
+
+ els.setWidth(100); // all elements become 100 width
+ els.hide(true); // all elements fade out and hide
+ // or
+ els.setWidth(100).hide(true);
+ </code></pre>
+ */
+Roo.CompositeElement = function(els){
+    this.elements = [];
+    this.addElements(els);
+};
+Roo.CompositeElement.prototype = {
+    isComposite: true,
+    addElements : function(els){
+        if(!els) return this;
+        if(typeof els == "string"){
+            els = Roo.Element.selectorFunction(els);
+        }
+        var yels = this.elements;
+        var index = yels.length-1;
+        for(var i = 0, len = els.length; i < len; i++) {
+               yels[++index] = Roo.get(els[i]);
+        }
+        return this;
+    },
+
+    /**
+    * Clears this composite and adds the elements returned by the passed selector.
+    * @param {String/Array} els A string CSS selector, an array of elements or an element
+    * @return {CompositeElement} this
+    */
+    fill : function(els){
+        this.elements = [];
+        this.add(els);
+        return this;
+    },
+
+    /**
+    * Filters this composite to only elements that match the passed selector.
+    * @param {String} selector A string CSS selector
+    * @return {CompositeElement} this
+    */
+    filter : function(selector){
+        var els = [];
+        this.each(function(el){
+            if(el.is(selector)){
+                els[els.length] = el.dom;
+            }
+        });
+        this.fill(els);
+        return this;
+    },
+
+    invoke : function(fn, args){
+        var els = this.elements;
+        for(var i = 0, len = els.length; i < len; i++) {
+               Roo.Element.prototype[fn].apply(els[i], args);
+        }
+        return this;
+    },
+    /**
+    * Adds elements to this composite.
+    * @param {String/Array} els A string CSS selector, an array of elements or an element
+    * @return {CompositeElement} this
+    */
+    add : function(els){
+        if(typeof els == "string"){
+            this.addElements(Roo.Element.selectorFunction(els));
+        }else if(els.length !== undefined){
+            this.addElements(els);
+        }else{
+            this.addElements([els]);
+        }
+        return this;
+    },
+    /**
+    * Calls the passed function passing (el, this, index) for each element in this composite.
+    * @param {Function} fn The function to call
+    * @param {Object} scope (optional) The <i>this</i> object (defaults to the element)
+    * @return {CompositeElement} this
+    */
+    each : function(fn, scope){
+        var els = this.elements;
+        for(var i = 0, len = els.length; i < len; i++){
+            if(fn.call(scope || els[i], els[i], this, i) === false) {
+                break;
+            }
+        }
+        return this;
+    },
+
+    /**
+     * Returns the Element object at the specified index
+     * @param {Number} index
+     * @return {Roo.Element}
+     */
+    item : function(index){
+        return this.elements[index] || null;
+    },
+
+    /**
+     * Returns the first Element
+     * @return {Roo.Element}
+     */
+    first : function(){
+        return this.item(0);
+    },
+
+    /**
+     * Returns the last Element
+     * @return {Roo.Element}
+     */
+    last : function(){
+        return this.item(this.elements.length-1);
+    },
+
+    /**
+     * Returns the number of elements in this composite
+     * @return Number
+     */
+    getCount : function(){
+        return this.elements.length;
+    },
+
+    /**
+     * Returns true if this composite contains the passed element
+     * @return Boolean
+     */
+    contains : function(el){
+        return this.indexOf(el) !== -1;
+    },
+
+    /**
+     * Returns true if this composite contains the passed element
+     * @return Boolean
+     */
+    indexOf : function(el){
+        return this.elements.indexOf(Roo.get(el));
+    },
+
+
+    /**
+    * Removes the specified element(s).
+    * @param {Mixed} el The id of an element, the Element itself, the index of the element in this composite
+    * or an array of any of those.
+    * @param {Boolean} removeDom (optional) True to also remove the element from the document
+    * @return {CompositeElement} this
+    */
+    removeElement : function(el, removeDom){
+        if(el instanceof Array){
+            for(var i = 0, len = el.length; i < len; i++){
+                this.removeElement(el[i]);
+            }
+            return this;
+        }
+        var index = typeof el == 'number' ? el : this.indexOf(el);
+        if(index !== -1){
+            if(removeDom){
+                var d = this.elements[index];
+                if(d.dom){
+                    d.remove();
+                }else{
+                    d.parentNode.removeChild(d);
+                }
+            }
+            this.elements.splice(index, 1);
+        }
+        return this;
+    },
+
+    /**
+    * Replaces the specified element with the passed element.
+    * @param {String/HTMLElement/Element/Number} el The id of an element, the Element itself, the index of the element in this composite
+    * to replace.
+    * @param {String/HTMLElement/Element} replacement The id of an element or the Element itself.
+    * @param {Boolean} domReplace (Optional) True to remove and replace the element in the document too.
+    * @return {CompositeElement} this
+    */
+    replaceElement : function(el, replacement, domReplace){
+        var index = typeof el == 'number' ? el : this.indexOf(el);
+        if(index !== -1){
+            if(domReplace){
+                this.elements[index].replaceWith(replacement);
+            }else{
+                this.elements.splice(index, 1, Roo.get(replacement))
+            }
+        }
+        return this;
+    },
+
+    /**
+     * Removes all elements.
+     */
+    clear : function(){
+        this.elements = [];
+    }
+};
+(function(){
+    Roo.CompositeElement.createCall = function(proto, fnName){
+        if(!proto[fnName]){
+            proto[fnName] = function(){
+                return this.invoke(fnName, arguments);
+            };
+        }
+    };
+    for(var fnName in Roo.Element.prototype){
+        if(typeof Roo.Element.prototype[fnName] == "function"){
+            Roo.CompositeElement.createCall(Roo.CompositeElement.prototype, fnName);
+        }
+    };
+})();
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.CompositeElementLite
+ * @extends Roo.CompositeElement
+ * Flyweight composite class. Reuses the same Roo.Element for element operations.
+ <pre><code>
+ var els = Roo.select("#some-el div.some-class");
+ // or select directly from an existing element
+ var el = Roo.get('some-el');
+ el.select('div.some-class');
+
+ els.setWidth(100); // all elements become 100 width
+ els.hide(true); // all elements fade out and hide
+ // or
+ els.setWidth(100).hide(true);
+ </code></pre><br><br>
+ * <b>NOTE: Although they are not listed, this class supports all of the set/update methods of Roo.Element. All Roo.Element
+ * actions will be performed on all the elements in this collection.</b>
+ */
+Roo.CompositeElementLite = function(els){
+    Roo.CompositeElementLite.superclass.constructor.call(this, els);
+    this.el = new Roo.Element.Flyweight();
+};
+Roo.extend(Roo.CompositeElementLite, Roo.CompositeElement, {
+    addElements : function(els){
+        if(els){
+            if(els instanceof Array){
+                this.elements = this.elements.concat(els);
+            }else{
+                var yels = this.elements;
+                var index = yels.length-1;
+                for(var i = 0, len = els.length; i < len; i++) {
+                    yels[++index] = els[i];
+                }
+            }
+        }
+        return this;
+    },
+    invoke : function(fn, args){
+        var els = this.elements;
+        var el = this.el;
+        for(var i = 0, len = els.length; i < len; i++) {
+            el.dom = els[i];
+               Roo.Element.prototype[fn].apply(el, args);
+        }
+        return this;
+    },
+    /**
+     * Returns a flyweight Element of the dom element object at the specified index
+     * @param {Number} index
+     * @return {Roo.Element}
+     */
+    item : function(index){
+        if(!this.elements[index]){
+            return null;
+        }
+        this.el.dom = this.elements[index];
+        return this.el;
+    },
+
+    // fixes scope with flyweight
+    addListener : function(eventName, handler, scope, opt){
+        var els = this.elements;
+        for(var i = 0, len = els.length; i < len; i++) {
+            Roo.EventManager.on(els[i], eventName, handler, scope || els[i], opt);
+        }
+        return this;
+    },
+
+    /**
+    * Calls the passed function passing (el, this, index) for each element in this composite. <b>The element
+    * passed is the flyweight (shared) Roo.Element instance, so if you require a
+    * a reference to the dom node, use el.dom.</b>
+    * @param {Function} fn The function to call
+    * @param {Object} scope (optional) The <i>this</i> object (defaults to the element)
+    * @return {CompositeElement} this
+    */
+    each : function(fn, scope){
+        var els = this.elements;
+        var el = this.el;
+        for(var i = 0, len = els.length; i < len; i++){
+            el.dom = els[i];
+               if(fn.call(scope || el, el, this, i) === false){
+                break;
+            }
+        }
+        return this;
+    },
+
+    indexOf : function(el){
+        return this.elements.indexOf(Roo.getDom(el));
+    },
+
+    replaceElement : function(el, replacement, domReplace){
+        var index = typeof el == 'number' ? el : this.indexOf(el);
+        if(index !== -1){
+            replacement = Roo.getDom(replacement);
+            if(domReplace){
+                var d = this.elements[index];
+                d.parentNode.insertBefore(replacement, d);
+                d.parentNode.removeChild(d);
+            }
+            this.elements.splice(index, 1, replacement);
+        }
+        return this;
+    }
+});
+Roo.CompositeElementLite.prototype.on = Roo.CompositeElementLite.prototype.addListener;
+
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+
+/**
+ * @class Roo.data.Connection
+ * @extends Roo.util.Observable
+ * The class encapsulates a connection to the page's originating domain, allowing requests to be made
+ * either to a configured URL, or to a URL specified at request time.<br><br>
+ * <p>
+ * Requests made by this class are asynchronous, and will return immediately. No data from
+ * the server will be available to the statement immediately following the {@link #request} call.
+ * To process returned data, use a callback in the request options object, or an event listener.</p><br>
+ * <p>
+ * Note: If you are doing a file upload, you will not get a normal response object sent back to
+ * your callback or event handler.  Since the upload is handled via in IFRAME, there is no XMLHttpRequest.
+ * The response object is created using the innerHTML of the IFRAME's document as the responseText
+ * property and, if present, the IFRAME's XML document as the responseXML property.</p><br>
+ * This means that a valid XML or HTML document must be returned. If JSON data is required, it is suggested
+ * that it be placed either inside a &lt;textarea> in an HTML document and retrieved from the responseText
+ * using a regex, or inside a CDATA section in an XML document and retrieved from the responseXML using
+ * standard DOM methods.
+ * @constructor
+ * @param {Object} config a configuration object.
+ */
+Roo.data.Connection = function(config){
+    Roo.apply(this, config);
+    this.addEvents({
+        /**
+         * @event beforerequest
+         * Fires before a network request is made to retrieve a data object.
+         * @param {Connection} conn This Connection object.
+         * @param {Object} options The options config object passed to the {@link #request} method.
+         */
+        "beforerequest" : true,
+        /**
+         * @event requestcomplete
+         * Fires if the request was successfully completed.
+         * @param {Connection} conn This Connection object.
+         * @param {Object} response The XHR object containing the response data.
+         * See {@link http://www.w3.org/TR/XMLHttpRequest/} for details.
+         * @param {Object} options The options config object passed to the {@link #request} method.
+         */
+        "requestcomplete" : true,
+        /**
+         * @event requestexception
+         * Fires if an error HTTP status was returned from the server.
+         * See {@link http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html} for details of HTTP status codes.
+         * @param {Connection} conn This Connection object.
+         * @param {Object} response The XHR object containing the response data.
+         * See {@link http://www.w3.org/TR/XMLHttpRequest/} for details.
+         * @param {Object} options The options config object passed to the {@link #request} method.
+         */
+        "requestexception" : true
+    });
+    Roo.data.Connection.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.data.Connection, Roo.util.Observable, {
+    /**
+     * @cfg {String} url (Optional) The default URL to be used for requests to the server. (defaults to undefined)
+     */
+    /**
+     * @cfg {Object} extraParams (Optional) An object containing properties which are used as
+     * extra parameters to each request made by this object. (defaults to undefined)
+     */
+    /**
+     * @cfg {Object} defaultHeaders (Optional) An object containing request headers which are added
+     *  to each request made by this object. (defaults to undefined)
+     */
+    /**
+     * @cfg {String} method (Optional) The default HTTP method to be used for requests. (defaults to undefined; if not set but parms are present will use POST, otherwise GET)
+     */
+    /**
+     * @cfg {Number} timeout (Optional) The timeout in milliseconds to be used for requests. (defaults to 30000)
+     */
+    timeout : 30000,
+    /**
+     * @cfg {Boolean} autoAbort (Optional) Whether this request should abort any pending requests. (defaults to false)
+     * @type Boolean
+     */
+    autoAbort:false,
+
+    /**
+     * @cfg {Boolean} disableCaching (Optional) True to add a unique cache-buster param to GET requests. (defaults to true)
+     * @type Boolean
+     */
+    disableCaching: true,
+
+    /**
+     * Sends an HTTP request to a remote server.
+     * @param {Object} options An object which may contain the following properties:<ul>
+     * <li><b>url</b> {String} (Optional) The URL to which to send the request. Defaults to configured URL</li>
+     * <li><b>params</b> {Object/String/Function} (Optional) An object containing properties which are used as parameters to the
+     * request, a url encoded string or a function to call to get either.</li>
+     * <li><b>method</b> {String} (Optional) The HTTP method to use for the request. Defaults to the configured method, or
+     * if no method was configured, "GET" if no parameters are being sent, and "POST" if parameters are being sent.</li>
+     * <li><b>callback</b> {Function} (Optional) The function to be called upon receipt of the HTTP response.
+     * The callback is called regardless of success or failure and is passed the following parameters:<ul>
+     * <li>options {Object} The parameter to the request call.</li>
+     * <li>success {Boolean} True if the request succeeded.</li>
+     * <li>response {Object} The XMLHttpRequest object containing the response data.</li>
+     * </ul></li>
+     * <li><b>success</b> {Function} (Optional) The function to be called upon success of the request.
+     * The callback is passed the following parameters:<ul>
+     * <li>response {Object} The XMLHttpRequest object containing the response data.</li>
+     * <li>options {Object} The parameter to the request call.</li>
+     * </ul></li>
+     * <li><b>failure</b> {Function} (Optional) The function to be called upon failure of the request.
+     * The callback is passed the following parameters:<ul>
+     * <li>response {Object} The XMLHttpRequest object containing the response data.</li>
+     * <li>options {Object} The parameter to the request call.</li>
+     * </ul></li>
+     * <li><b>scope</b> {Object} (Optional) The scope in which to execute the callbacks: The "this" object
+     * for the callback function. Defaults to the browser window.</li>
+     * <li><b>form</b> {Object/String} (Optional) A form object or id to pull parameters from.</li>
+     * <li><b>isUpload</b> {Boolean} (Optional) True if the form object is a file upload (will usually be automatically detected).</li>
+     * <li><b>headers</b> {Object} (Optional) Request headers to set for the request.</li>
+     * <li><b>xmlData</b> {Object} (Optional) XML document to use for the post. Note: This will be used instead of
+     * params for the post data. Any params will be appended to the URL.</li>
+     * <li><b>disableCaching</b> {Boolean} (Optional) True to add a unique cache-buster param to GET requests.</li>
+     * </ul>
+     * @return {Number} transactionId
+     */
+    request : function(o){
+        if(this.fireEvent("beforerequest", this, o) !== false){
+            var p = o.params;
+
+            if(typeof p == "function"){
+                p = p.call(o.scope||window, o);
+            }
+            if(typeof p == "object"){
+                p = Roo.urlEncode(o.params);
+            }
+            if(this.extraParams){
+                var extras = Roo.urlEncode(this.extraParams);
+                p = p ? (p + '&' + extras) : extras;
+            }
+
+            var url = o.url || this.url;
+            if(typeof url == 'function'){
+                url = url.call(o.scope||window, o);
+            }
+
+            if(o.form){
+                var form = Roo.getDom(o.form);
+                url = url || form.action;
+
+                var enctype = form.getAttribute("enctype");
+                if(o.isUpload || (enctype && enctype.toLowerCase() == 'multipart/form-data')){
+                    return this.doFormUpload(o, p, url);
+                }
+                var f = Roo.lib.Ajax.serializeForm(form);
+                p = p ? (p + '&' + f) : f;
+            }
+
+            var hs = o.headers;
+            if(this.defaultHeaders){
+                hs = Roo.apply(hs || {}, this.defaultHeaders);
+                if(!o.headers){
+                    o.headers = hs;
+                }
+            }
+
+            var cb = {
+                success: this.handleResponse,
+                failure: this.handleFailure,
+                scope: this,
+                argument: {options: o},
+                timeout : this.timeout
+            };
+
+            var method = o.method||this.method||(p ? "POST" : "GET");
+
+            if(method == 'GET' && (this.disableCaching && o.disableCaching !== false) || o.disableCaching === true){
+                url += (url.indexOf('?') != -1 ? '&' : '?') + '_dc=' + (new Date().getTime());
+            }
+
+            if(typeof o.autoAbort == 'boolean'){ // options gets top priority
+                if(o.autoAbort){
+                    this.abort();
+                }
+            }else if(this.autoAbort !== false){
+                this.abort();
+            }
+
+            if((method == 'GET' && p) || o.xmlData){
+                url += (url.indexOf('?') != -1 ? '&' : '?') + p;
+                p = '';
+            }
+            this.transId = Roo.lib.Ajax.request(method, url, cb, p, o);
+            return this.transId;
+        }else{
+            Roo.callback(o.callback, o.scope, [o, null, null]);
+            return null;
+        }
+    },
+
+    /**
+     * Determine whether this object has a request outstanding.
+     * @param {Number} transactionId (Optional) defaults to the last transaction
+     * @return {Boolean} True if there is an outstanding request.
+     */
+    isLoading : function(transId){
+        if(transId){
+            return Roo.lib.Ajax.isCallInProgress(transId);
+        }else{
+            return this.transId ? true : false;
+        }
+    },
+
+    /**
+     * Aborts any outstanding request.
+     * @param {Number} transactionId (Optional) defaults to the last transaction
+     */
+    abort : function(transId){
+        if(transId || this.isLoading()){
+            Roo.lib.Ajax.abort(transId || this.transId);
+        }
+    },
+
+    // private
+    handleResponse : function(response){
+        this.transId = false;
+        var options = response.argument.options;
+        response.argument = options ? options.argument : null;
+        this.fireEvent("requestcomplete", this, response, options);
+        Roo.callback(options.success, options.scope, [response, options]);
+        Roo.callback(options.callback, options.scope, [options, true, response]);
+    },
+
+    // private
+    handleFailure : function(response, e){
+        this.transId = false;
+        var options = response.argument.options;
+        response.argument = options ? options.argument : null;
+        this.fireEvent("requestexception", this, response, options, e);
+        Roo.callback(options.failure, options.scope, [response, options]);
+        Roo.callback(options.callback, options.scope, [options, false, response]);
+    },
+
+    // private
+    doFormUpload : function(o, ps, url){
+        var id = Roo.id();
+        var frame = document.createElement('iframe');
+        frame.id = id;
+        frame.name = id;
+        frame.className = 'x-hidden';
+        if(Roo.isIE){
+            frame.src = Roo.SSL_SECURE_URL;
+        }
+        document.body.appendChild(frame);
+
+        if(Roo.isIE){
+           document.frames[id].name = id;
+        }
+
+        var form = Roo.getDom(o.form);
+        form.target = id;
+        form.method = 'POST';
+        form.enctype = form.encoding = 'multipart/form-data';
+        if(url){
+            form.action = url;
+        }
+
+        var hiddens, hd;
+        if(ps){ // add dynamic params
+            hiddens = [];
+            ps = Roo.urlDecode(ps, false);
+            for(var k in ps){
+                if(ps.hasOwnProperty(k)){
+                    hd = document.createElement('input');
+                    hd.type = 'hidden';
+                    hd.name = k;
+                    hd.value = ps[k];
+                    form.appendChild(hd);
+                    hiddens.push(hd);
+                }
+            }
+        }
+
+        function cb(){
+            var r = {  // bogus response object
+                responseText : '',
+                responseXML : null
+            };
+
+            r.argument = o ? o.argument : null;
+
+            try { //
+                var doc;
+                if(Roo.isIE){
+                    doc = frame.contentWindow.document;
+                }else {
+                    doc = (frame.contentDocument || window.frames[id].document);
+                }
+                if(doc && doc.body){
+                    r.responseText = doc.body.innerHTML;
+                }
+                if(doc && doc.XMLDocument){
+                    r.responseXML = doc.XMLDocument;
+                }else {
+                    r.responseXML = doc;
+                }
+            }
+            catch(e) {
+                // ignore
+            }
+
+            Roo.EventManager.removeListener(frame, 'load', cb, this);
+
+            this.fireEvent("requestcomplete", this, r, o);
+            Roo.callback(o.success, o.scope, [r, o]);
+            Roo.callback(o.callback, o.scope, [o, true, r]);
+
+            setTimeout(function(){document.body.removeChild(frame);}, 100);
+        }
+
+        Roo.EventManager.on(frame, 'load', cb, this);
+        form.submit();
+
+        if(hiddens){ // remove dynamic params
+            for(var i = 0, len = hiddens.length; i < len; i++){
+                form.removeChild(hiddens[i]);
+            }
+        }
+    }
+});
+
+/**
+ * @class Roo.Ajax
+ * @extends Roo.data.Connection
+ * Global Ajax request class.
+ *
+ * @singleton
+ */
+Roo.Ajax = new Roo.data.Connection({
+    // fix up the docs
+   /**
+     * @cfg {String} url @hide
+     */
+    /**
+     * @cfg {Object} extraParams @hide
+     */
+    /**
+     * @cfg {Object} defaultHeaders @hide
+     */
+    /**
+     * @cfg {String} method (Optional) @hide
+     */
+    /**
+     * @cfg {Number} timeout (Optional) @hide
+     */
+    /**
+     * @cfg {Boolean} autoAbort (Optional) @hide
+     */
+
+    /**
+     * @cfg {Boolean} disableCaching (Optional) @hide
+     */
+
+    /**
+     * @property  disableCaching
+     * True to add a unique cache-buster param to GET requests. (defaults to true)
+     * @type Boolean
+     */
+    /**
+     * @property  url
+     * The default URL to be used for requests to the server. (defaults to undefined)
+     * @type String
+     */
+    /**
+     * @property  extraParams
+     * An object containing properties which are used as
+     * extra parameters to each request made by this object. (defaults to undefined)
+     * @type Object
+     */
+    /**
+     * @property  defaultHeaders
+     * An object containing request headers which are added to each request made by this object. (defaults to undefined)
+     * @type Object
+     */
+    /**
+     * @property  method
+     * The default HTTP method to be used for requests. (defaults to undefined; if not set but parms are present will use POST, otherwise GET)
+     * @type String
+     */
+    /**
+     * @property  timeout
+     * The timeout in milliseconds to be used for requests. (defaults to 30000)
+     * @type Number
+     */
+
+    /**
+     * @property  autoAbort
+     * Whether a new request should abort any pending requests. (defaults to false)
+     * @type Boolean
+     */
+    autoAbort : false,
+
+    /**
+     * Serialize the passed form into a url encoded string
+     * @param {String/HTMLElement} form
+     * @return {String}
+     */
+    serializeForm : function(form){
+        return Roo.lib.Ajax.serializeForm(form);
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.Ajax
+ * @extends Roo.data.Connection
+ * Global Ajax request class.
+ *
+ * @instanceOf  Roo.data.Connection
+ */
+Roo.Ajax = new Roo.data.Connection({
+    // fix up the docs
+    
+    /**
+     * fix up scoping
+     * @scope Roo.Ajax
+     */
+    
+   /**
+     * @cfg {String} url @hide
+     */
+    /**
+     * @cfg {Object} extraParams @hide
+     */
+    /**
+     * @cfg {Object} defaultHeaders @hide
+     */
+    /**
+     * @cfg {String} method (Optional) @hide
+     */
+    /**
+     * @cfg {Number} timeout (Optional) @hide
+     */
+    /**
+     * @cfg {Boolean} autoAbort (Optional) @hide
+     */
+
+    /**
+     * @cfg {Boolean} disableCaching (Optional) @hide
+     */
+
+    /**
+     * @property  disableCaching
+     * True to add a unique cache-buster param to GET requests. (defaults to true)
+     * @type Boolean
+     */
+    /**
+     * @property  url
+     * The default URL to be used for requests to the server. (defaults to undefined)
+     * @type String
+     */
+    /**
+     * @property  extraParams
+     * An object containing properties which are used as
+     * extra parameters to each request made by this object. (defaults to undefined)
+     * @type Object
+     */
+    /**
+     * @property  defaultHeaders
+     * An object containing request headers which are added to each request made by this object. (defaults to undefined)
+     * @type Object
+     */
+    /**
+     * @property  method
+     * The default HTTP method to be used for requests. (defaults to undefined; if not set but parms are present will use POST, otherwise GET)
+     * @type String
+     */
+    /**
+     * @property  timeout
+     * The timeout in milliseconds to be used for requests. (defaults to 30000)
+     * @type Number
+     */
+
+    /**
+     * @property  autoAbort
+     * Whether a new request should abort any pending requests. (defaults to false)
+     * @type Boolean
+     */
+    autoAbort : false,
+
+    /**
+     * Serialize the passed form into a url encoded string
+     * @param {String/HTMLElement} form
+     * @return {String}
+     */
+    serializeForm : function(form){
+        return Roo.lib.Ajax.serializeForm(form);
+    }
+});/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.UpdateManager
+ * @extends Roo.util.Observable
+ * Provides AJAX-style update for Element object.<br><br>
+ * Usage:<br>
+ * <pre><code>
+ * // Get it from a Roo.Element object
+ * var el = Roo.get("foo");
+ * var mgr = el.getUpdateManager();
+ * mgr.update("http://myserver.com/index.php", "param1=1&amp;param2=2");
+ * ...
+ * mgr.formUpdate("myFormId", "http://myserver.com/index.php");
+ * <br>
+ * // or directly (returns the same UpdateManager instance)
+ * var mgr = new Roo.UpdateManager("myElementId");
+ * mgr.startAutoRefresh(60, "http://myserver.com/index.php");
+ * mgr.on("update", myFcnNeedsToKnow);
+ * <br>
+   // short handed call directly from the element object
+   Roo.get("foo").load({
+        url: "bar.php",
+        scripts:true,
+        params: "for=bar",
+        text: "Loading Foo..."
+   });
+ * </code></pre>
+ * @constructor
+ * Create new UpdateManager directly.
+ * @param {String/HTMLElement/Roo.Element} el The element to update
+ * @param {Boolean} forceNew (optional) By default the constructor checks to see if the passed element already has an UpdateManager and if it does it returns the same instance. This will skip that check (useful for extending this class).
+ */
+Roo.UpdateManager = function(el, forceNew){
+    el = Roo.get(el);
+    if(!forceNew && el.updateManager){
+        return el.updateManager;
+    }
+    /**
+     * The Element object
+     * @type Roo.Element
+     */
+    this.el = el;
+    /**
+     * Cached url to use for refreshes. Overwritten every time update() is called unless "discardUrl" param is set to true.
+     * @type String
+     */
+    this.defaultUrl = null;
+
+    this.addEvents({
+        /**
+         * @event beforeupdate
+         * Fired before an update is made, return false from your handler and the update is cancelled.
+         * @param {Roo.Element} el
+         * @param {String/Object/Function} url
+         * @param {String/Object} params
+         */
+        "beforeupdate": true,
+        /**
+         * @event update
+         * Fired after successful update is made.
+         * @param {Roo.Element} el
+         * @param {Object} oResponseObject The response Object
+         */
+        "update": true,
+        /**
+         * @event failure
+         * Fired on update failure.
+         * @param {Roo.Element} el
+         * @param {Object} oResponseObject The response Object
+         */
+        "failure": true
+    });
+    var d = Roo.UpdateManager.defaults;
+    /**
+     * Blank page URL to use with SSL file uploads (Defaults to Roo.UpdateManager.defaults.sslBlankUrl or "about:blank").
+     * @type String
+     */
+    this.sslBlankUrl = d.sslBlankUrl;
+    /**
+     * Whether to append unique parameter on get request to disable caching (Defaults to Roo.UpdateManager.defaults.disableCaching or false).
+     * @type Boolean
+     */
+    this.disableCaching = d.disableCaching;
+    /**
+     * Text for loading indicator (Defaults to Roo.UpdateManager.defaults.indicatorText or '&lt;div class="loading-indicator"&gt;Loading...&lt;/div&gt;').
+     * @type String
+     */
+    this.indicatorText = d.indicatorText;
+    /**
+     * Whether to show indicatorText when loading (Defaults to Roo.UpdateManager.defaults.showLoadIndicator or true).
+     * @type String
+     */
+    this.showLoadIndicator = d.showLoadIndicator;
+    /**
+     * Timeout for requests or form posts in seconds (Defaults to Roo.UpdateManager.defaults.timeout or 30 seconds).
+     * @type Number
+     */
+    this.timeout = d.timeout;
+
+    /**
+     * True to process scripts in the output (Defaults to Roo.UpdateManager.defaults.loadScripts (false)).
+     * @type Boolean
+     */
+    this.loadScripts = d.loadScripts;
+
+    /**
+     * Transaction object of current executing transaction
+     */
+    this.transaction = null;
+
+    /**
+     * @private
+     */
+    this.autoRefreshProcId = null;
+    /**
+     * Delegate for refresh() prebound to "this", use myUpdater.refreshDelegate.createCallback(arg1, arg2) to bind arguments
+     * @type Function
+     */
+    this.refreshDelegate = this.refresh.createDelegate(this);
+    /**
+     * Delegate for update() prebound to "this", use myUpdater.updateDelegate.createCallback(arg1, arg2) to bind arguments
+     * @type Function
+     */
+    this.updateDelegate = this.update.createDelegate(this);
+    /**
+     * Delegate for formUpdate() prebound to "this", use myUpdater.formUpdateDelegate.createCallback(arg1, arg2) to bind arguments
+     * @type Function
+     */
+    this.formUpdateDelegate = this.formUpdate.createDelegate(this);
+    /**
+     * @private
+     */
+    this.successDelegate = this.processSuccess.createDelegate(this);
+    /**
+     * @private
+     */
+    this.failureDelegate = this.processFailure.createDelegate(this);
+
+    if(!this.renderer){
+     /**
+      * The renderer for this UpdateManager. Defaults to {@link Roo.UpdateManager.BasicRenderer}.
+      */
+    this.renderer = new Roo.UpdateManager.BasicRenderer();
+    }
+    
+    Roo.UpdateManager.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.UpdateManager, Roo.util.Observable, {
+    /**
+     * Get the Element this UpdateManager is bound to
+     * @return {Roo.Element} The element
+     */
+    getEl : function(){
+        return this.el;
+    },
+    /**
+     * Performs an async request, updating this element with the response. If params are specified it uses POST, otherwise it uses GET.
+     * @param {Object/String/Function} url The url for this request or a function to call to get the url or a config object containing any of the following options:
+<pre><code>
+um.update({<br/>
+    url: "your-url.php",<br/>
+    params: {param1: "foo", param2: "bar"}, // or a URL encoded string<br/>
+    callback: yourFunction,<br/>
+    scope: yourObject, //(optional scope)  <br/>
+    discardUrl: false, <br/>
+    nocache: false,<br/>
+    text: "Loading...",<br/>
+    timeout: 30,<br/>
+    scripts: false<br/>
+});
+</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 UpdateManager instance.
+     * @param {String/Object} params (optional) The parameters to pass as either a url encoded string "param1=1&amp;param2=2" or an object {param1: 1, param2: 2}
+     * @param {Function} callback (optional) Callback when transaction is complete - called with signature (oElement, bSuccess, oResponse)
+     * @param {Boolean} discardUrl (optional) By default when you execute an update the defaultUrl is changed to the last used url. If true, it will not store the url.
+     */
+    update : function(url, params, callback, discardUrl){
+        if(this.fireEvent("beforeupdate", this.el, url, params) !== false){
+            var method = this.method, cfg;
+            if(typeof url == "object"){ // must be config object
+                cfg = url;
+                url = cfg.url;
+                params = params || cfg.params;
+                callback = callback || cfg.callback;
+                discardUrl = discardUrl || cfg.discardUrl;
+                if(callback && cfg.scope){
+                    callback = callback.createDelegate(cfg.scope);
+                }
+                if(typeof cfg.method != "undefined"){method = cfg.method;};
+                if(typeof cfg.nocache != "undefined"){this.disableCaching = cfg.nocache;};
+                if(typeof cfg.text != "undefined"){this.indicatorText = '<div class="loading-indicator">'+cfg.text+"</div>";};
+                if(typeof cfg.scripts != "undefined"){this.loadScripts = cfg.scripts;};
+                if(typeof cfg.timeout != "undefined"){this.timeout = cfg.timeout;};
+            }
+            this.showLoading();
+            if(!discardUrl){
+                this.defaultUrl = url;
+            }
+            if(typeof url == "function"){
+                url = url.call(this);
+            }
+
+            method = method || (params ? "POST" : "GET");
+            if(method == "GET"){
+                url = this.prepareUrl(url);
+            }
+
+            var o = Roo.apply(cfg ||{}, {
+                url : url,
+                params: params,
+                success: this.successDelegate,
+                failure: this.failureDelegate,
+                callback: undefined,
+                timeout: (this.timeout*1000),
+                argument: {"url": url, "form": null, "callback": callback, "params": params}
+            });
+
+            this.transaction = Roo.Ajax.request(o);
+        }
+    },
+
+    /**
+     * Performs an async form post, updating this element with the response. If the form has the attribute enctype="multipart/form-data", it assumes it's a file upload.
+     * Uses this.sslBlankUrl for SSL file uploads to prevent IE security warning.
+     * @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 - called with signature (oElement, bSuccess, oResponse)
+     */
+    formUpdate : function(form, url, reset, callback){
+        if(this.fireEvent("beforeupdate", this.el, form, url) !== false){
+            if(typeof url == "function"){
+                url = url.call(this);
+            }
+            form = Roo.getDom(form);
+            this.transaction = Roo.Ajax.request({
+                form: form,
+                url:url,
+                success: this.successDelegate,
+                failure: this.failureDelegate,
+                timeout: (this.timeout*1000),
+                argument: {"url": url, "form": form, "callback": callback, "reset": reset}
+            });
+            this.showLoading.defer(1, this);
+        }
+    },
+
+    /**
+     * 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 == null){
+            return;
+        }
+        this.update(this.defaultUrl, null, callback, true);
+    },
+
+    /**
+     * Set this element to auto refresh.
+     * @param {Number} interval How often to update (in seconds).
+     * @param {String/Function} url (optional) The url for this request or a function to call to get the url (Defaults to the last used url)
+     * @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){
+        if(refreshNow){
+            this.update(url || this.defaultUrl, params, callback, true);
+        }
+        if(this.autoRefreshProcId){
+            clearInterval(this.autoRefreshProcId);
+        }
+        this.autoRefreshProcId = setInterval(this.update.createDelegate(this, [url || this.defaultUrl, params, callback, true]), interval*1000);
+    },
+
+    /**
+     * Stop auto refresh on this element.
+     */
+     stopAutoRefresh : function(){
+        if(this.autoRefreshProcId){
+            clearInterval(this.autoRefreshProcId);
+            delete this.autoRefreshProcId;
+        }
+    },
+
+    isAutoRefreshing : function(){
+       return this.autoRefreshProcId ? true : false;
+    },
+    /**
+     * Called to update the element to "Loading" state. Override to perform custom action.
+     */
+    showLoading : function(){
+        if(this.showLoadIndicator){
+            this.el.update(this.indicatorText);
+        }
+    },
+
+    /**
+     * Adds unique parameter to query string if disableCaching = true
+     * @private
+     */
+    prepareUrl : function(url){
+        if(this.disableCaching){
+            var append = "_dc=" + (new Date().getTime());
+            if(url.indexOf("?") !== -1){
+                url += "&" + append;
+            }else{
+                url += "?" + append;
+            }
+        }
+        return url;
+    },
+
+    /**
+     * @private
+     */
+    processSuccess : function(response){
+        this.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(this.loadScripts){
+            this.renderer.render(this.el, response, this,
+                this.updateComplete.createDelegate(this, [response]));
+        }else{
+            this.renderer.render(this.el, response, this);
+            this.updateComplete(response);
+        }
+    },
+
+    updateComplete : function(response){
+        this.fireEvent("update", this.el, response);
+        if(typeof response.argument.callback == "function"){
+            response.argument.callback(this.el, true, response);
+        }
+    },
+
+    /**
+     * @private
+     */
+    processFailure : function(response){
+        this.transaction = null;
+        this.fireEvent("failure", this.el, response);
+        if(typeof response.argument.callback == "function"){
+            response.argument.callback(this.el, false, response);
+        }
+    },
+
+    /**
+     * Set the content renderer for this UpdateManager. See {@link Roo.UpdateManager.BasicRenderer#render} for more details.
+     * @param {Object} renderer The object implementing the render() method
+     */
+    setRenderer : function(renderer){
+        this.renderer = renderer;
+    },
+
+    getRenderer : function(){
+       return this.renderer;
+    },
+
+    /**
+     * Set the defaultUrl used for updates
+     * @param {String/Function} defaultUrl The url or a function to call to get the url
+     */
+    setDefaultUrl : function(defaultUrl){
+        this.defaultUrl = defaultUrl;
+    },
+
+    /**
+     * Aborts the executing transaction
+     */
+    abort : function(){
+        if(this.transaction){
+            Roo.Ajax.abort(this.transaction);
+        }
+    },
+
+    /**
+     * Returns true if an update is in progress
+     * @return {Boolean}
+     */
+    isUpdating : function(){
+        if(this.transaction){
+            return Roo.Ajax.isLoading(this.transaction);
+        }
+        return false;
+    }
+});
+
+/**
+ * @class Roo.UpdateManager.defaults
+ * @static (not really - but it helps the doc tool)
+ * The defaults collection enables customizing the default properties of UpdateManager
+ */
+   Roo.UpdateManager.defaults = {
+       /**
+         * Timeout for requests or form posts in seconds (Defaults 30 seconds).
+         * @type Number
+         */
+         timeout : 30,
+
+         /**
+         * True to process scripts by default (Defaults to false).
+         * @type Boolean
+         */
+        loadScripts : false,
+
+        /**
+        * Blank page URL to use with SSL file uploads (Defaults to "javascript:false").
+        * @type String
+        */
+        sslBlankUrl : (Roo.SSL_SECURE_URL || "javascript:false"),
+        /**
+         * Whether to append unique parameter on get request to disable caching (Defaults to false).
+         * @type Boolean
+         */
+        disableCaching : false,
+        /**
+         * Whether to show indicatorText when 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>'
+   };
+
+/**
+ * Static convenience method. This method is deprecated in favor of el.load({url:'foo.php', ...}).
+ *Usage:
+ * <pre><code>Roo.UpdateManager.updateElement("my-div", "stuff.php");</code></pre>
+ * @param {String/HTMLElement/Roo.Element} 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 UpdateManager properties you want to set - for example: {disableCaching:true, indicatorText: "Loading data..."}
+ * @static
+ * @deprecated
+ * @member Roo.UpdateManager
+ */
+Roo.UpdateManager.updateElement = function(el, url, params, options){
+    var um = Roo.get(el, true).getUpdateManager();
+    Roo.apply(um, options);
+    um.update(url, params, options ? options.callback : null);
+};
+// alias for backwards compat
+Roo.UpdateManager.update = Roo.UpdateManager.updateElement;
+/**
+ * @class Roo.UpdateManager.BasicRenderer
+ * Default Content renderer. Updates the elements innerHTML with the responseText.
+ */
+Roo.UpdateManager.BasicRenderer = function(){};
+
+Roo.UpdateManager.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 UpdateManager.
+     * @param {Roo.Element} el The element being rendered
+     * @param {Object} response The YUI Connect response object
+     * @param {UpdateManager} updateManager The calling update manager
+     * @param {Function} callback A callback that will need to be called if loadScripts is true on the UpdateManager
+     */
+     render : function(el, response, updateManager, callback){
+        el.update(response.responseText, updateManager.loadScripts, callback);
+    }
+};
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.util.DelayedTask
+ * Provides a convenient method of performing setTimeout where a new
+ * timeout cancels the old timeout. 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.
+ * @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
+ */
+Roo.util.DelayedTask = function(fn, scope, args){
+    var id = null, d, t;
+
+    var call = function(){
+        var now = new Date().getTime();
+        if(now - t >= d){
+            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
+     */
+    this.delay = function(delay, newFn, newScope, newArgs){
+        if(id && delay != d){
+            this.cancel();
+        }
+        d = delay;
+        t = new Date().getTime();
+        fn = newFn || fn;
+        scope = newScope || scope;
+        args = newArgs || args;
+        if(!id){
+            id = setInterval(call, d);
+        }
+    };
+
+    /**
+     * Cancel the last queued timeout
+     */
+    this.cancel = function(){
+        if(id){
+            clearInterval(id);
+            id = null;
+        }
+    };
+};/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+Roo.util.TaskRunner = function(interval){
+    interval = interval || 10;
+    var tasks = [], removeQueue = [];
+    var id = 0;
+    var running = false;
+
+    var stopThread = function(){
+        running = false;
+        clearInterval(id);
+        id = 0;
+    };
+
+    var startThread = function(){
+        if(!running){
+            running = true;
+            id = setInterval(runTasks, interval);
+        }
+    };
+
+    var removeTask = function(task){
+        removeQueue.push(task);
+        if(task.onStop){
+            task.onStop();
+        }
+    };
+
+    var runTasks = function(){
+        if(removeQueue.length > 0){
+            for(var i = 0, len = removeQueue.length; i < len; i++){
+                tasks.remove(removeQueue[i]);
+            }
+            removeQueue = [];
+            if(tasks.length < 1){
+                stopThread();
+                return;
+            }
+        }
+        var now = new Date().getTime();
+        for(var i = 0, len = tasks.length; i < len; ++i){
+            var t = tasks[i];
+            var itime = now - t.taskRunTime;
+            if(t.interval <= itime){
+                var rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
+                t.taskRunTime = now;
+                if(rt === false || t.taskRunCount === t.repeat){
+                    removeTask(t);
+                    return;
+                }
+            }
+            if(t.duration && t.duration <= (now - t.taskStartTime)){
+                removeTask(t);
+            }
+        }
+    };
+
+    /**
+     * Queues a new task.
+     * @param {Object} task
+     */
+    this.start = function(task){
+        tasks.push(task);
+        task.taskStartTime = new Date().getTime();
+        task.taskRunTime = 0;
+        task.taskRunCount = 0;
+        startThread();
+        return task;
+    };
+
+    this.stop = function(task){
+        removeTask(task);
+        return task;
+    };
+
+    this.stopAll = function(){
+        stopThread();
+        for(var i = 0, len = tasks.length; i < len; i++){
+            if(tasks[i].onStop){
+                tasks[i].onStop();
+            }
+        }
+        tasks = [];
+        removeQueue = [];
+    };
+};
+
+Roo.TaskMgr = new Roo.util.TaskRunner();/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.util.MixedCollection
+ * @extends Roo.util.Observable
+ * A Collection class that maintains both numeric indexes and keys and exposes events.
+ * @constructor
+ * @param {Boolean} allowFunctions True if the addAll function should add function references to the
+ * collection (defaults to false)
+ * @param {Function} keyFn A function that can accept an item of the type(s) stored in this MixedCollection
+ * and return the key value for that item.  This is used when available to look up the key on items that
+ * were passed without an explicit key parameter to a MixedCollection method.  Passing this parameter is
+ * equivalent to providing an implementation for the {@link #getKey} method.
+ */
+Roo.util.MixedCollection = function(allowFunctions, keyFn){
+    this.items = [];
+    this.map = {};
+    this.keys = [];
+    this.length = 0;
+    this.addEvents({
+        /**
+         * @event clear
+         * Fires when the collection is cleared.
+         */
+        "clear" : true,
+        /**
+         * @event add
+         * Fires when an item is added to the collection.
+         * @param {Number} index The index at which the item was added.
+         * @param {Object} o The item added.
+         * @param {String} key The key associated with the added item.
+         */
+        "add" : true,
+        /**
+         * @event replace
+         * Fires when an item is replaced in the collection.
+         * @param {String} key he key associated with the new added.
+         * @param {Object} old The item being replaced.
+         * @param {Object} new The new item.
+         */
+        "replace" : true,
+        /**
+         * @event remove
+         * Fires when an item is removed from the collection.
+         * @param {Object} o The item being removed.
+         * @param {String} key (optional) The key associated with the removed item.
+         */
+        "remove" : true,
+        "sort" : true
+    });
+    this.allowFunctions = allowFunctions === true;
+    if(keyFn){
+        this.getKey = keyFn;
+    }
+    Roo.util.MixedCollection.superclass.constructor.call(this);
+};
+
+Roo.extend(Roo.util.MixedCollection, Roo.util.Observable, {
+    allowFunctions : false,
+    
+/**
+ * Adds an item to the collection.
+ * @param {String} key The key to associate with the item
+ * @param {Object} o The item to add.
+ * @return {Object} The item added.
+ */
+    add : function(key, o){
+        if(arguments.length == 1){
+            o = arguments[0];
+            key = this.getKey(o);
+        }
+        if(typeof key == "undefined" || key === null){
+            this.length++;
+            this.items.push(o);
+            this.keys.push(null);
+        }else{
+            var old = this.map[key];
+            if(old){
+                return this.replace(key, o);
+            }
+            this.length++;
+            this.items.push(o);
+            this.map[key] = o;
+            this.keys.push(key);
+        }
+        this.fireEvent("add", this.length-1, o, key);
+        return o;
+    },
+       
+/**
+  * MixedCollection has a generic way to fetch keys if you implement getKey.
+<pre><code>
+// normal way
+var mc = new Roo.util.MixedCollection();
+mc.add(someEl.dom.id, someEl);
+mc.add(otherEl.dom.id, otherEl);
+//and so on
+
+// using getKey
+var mc = new Roo.util.MixedCollection();
+mc.getKey = function(el){
+   return el.dom.id;
+};
+mc.add(someEl);
+mc.add(otherEl);
+
+// or via the constructor
+var mc = new Roo.util.MixedCollection(false, function(el){
+   return el.dom.id;
+});
+mc.add(someEl);
+mc.add(otherEl);
+</code></pre>
+ * @param o {Object} The item for which to find the key.
+ * @return {Object} The key for the passed item.
+ */
+    getKey : function(o){
+         return o.id; 
+    },
+   
+/**
+ * Replaces an item in the collection.
+ * @param {String} key The key associated with the item to replace, or the item to replace.
+ * @param o {Object} o (optional) If the first parameter passed was a key, the item to associate with that key.
+ * @return {Object}  The new item.
+ */
+    replace : function(key, o){
+        if(arguments.length == 1){
+            o = arguments[0];
+            key = this.getKey(o);
+        }
+        var old = this.item(key);
+        if(typeof key == "undefined" || key === null || typeof old == "undefined"){
+             return this.add(key, o);
+        }
+        var index = this.indexOfKey(key);
+        this.items[index] = o;
+        this.map[key] = o;
+        this.fireEvent("replace", key, old, o);
+        return o;
+    },
+   
+/**
+ * Adds all elements of an Array or an Object to the collection.
+ * @param {Object/Array} objs An Object containing properties which will be added to the collection, or
+ * an Array of values, each of which are added to the collection.
+ */
+    addAll : function(objs){
+        if(arguments.length > 1 || objs instanceof Array){
+            var args = arguments.length > 1 ? arguments : objs;
+            for(var i = 0, len = args.length; i < len; i++){
+                this.add(args[i]);
+            }
+        }else{
+            for(var key in objs){
+                if(this.allowFunctions || typeof objs[key] != "function"){
+                    this.add(key, objs[key]);
+                }
+            }
+        }
+    },
+   
+/**
+ * Executes the specified function once for every item in the collection, passing each
+ * item as the first and 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){
+        var items = [].concat(this.items); // each safe for removal
+        for(var i = 0, len = items.length; i < len; i++){
+            if(fn.call(scope || items[i], items[i], i, len) === false){
+                break;
+            }
+        }
+    },
+   
+/**
+ * Executes the specified function once for every key in the collection, passing each
+ * key, and its associated item as the first two parameters.
+ * @param {Function} fn The function to execute for each item.
+ * @param {Object} scope (optional) The scope in which to execute the function.
+ */
+    eachKey : function(fn, scope){
+        for(var i = 0, len = this.keys.length; i < len; i++){
+            fn.call(scope || window, this.keys[i], this.items[i], i, len);
+        }
+    },
+   
+/**
+ * Returns the first item in the collection which elicits a true return value from the
+ * passed selection function.
+ * @param {Function} fn The selection function to execute for each item.
+ * @param {Object} scope (optional) The scope in which to execute the function.
+ * @return {Object} The first item in the collection which returned true from the selection function.
+ */
+    find : function(fn, scope){
+        for(var i = 0, len = this.items.length; i < len; i++){
+            if(fn.call(scope || window, this.items[i], this.keys[i])){
+                return this.items[i];
+            }
+        }
+        return null;
+    },
+   
+/**
+ * Inserts an item at the specified index in the collection.
+ * @param {Number} index The index to insert the item at.
+ * @param {String} key The key to associate with the new item, or the item itself.
+ * @param {Object} o  (optional) If the second parameter was a key, the new item.
+ * @return {Object} The item inserted.
+ */
+    insert : function(index, key, o){
+        if(arguments.length == 2){
+            o = arguments[1];
+            key = this.getKey(o);
+        }
+        if(index >= this.length){
+            return this.add(key, o);
+        }
+        this.length++;
+        this.items.splice(index, 0, o);
+        if(typeof key != "undefined" && key != null){
+            this.map[key] = o;
+        }
+        this.keys.splice(index, 0, key);
+        this.fireEvent("add", index, o, key);
+        return o;
+    },
+   
+/**
+ * Removed an item from the collection.
+ * @param {Object} o The item to remove.
+ * @return {Object} The item removed.
+ */
+    remove : function(o){
+        return this.removeAt(this.indexOf(o));
+    },
+   
+/**
+ * Remove an item from a specified index in the collection.
+ * @param {Number} index The index within the collection of the item to remove.
+ */
+    removeAt : function(index){
+        if(index < this.length && index >= 0){
+            this.length--;
+            var o = this.items[index];
+            this.items.splice(index, 1);
+            var key = this.keys[index];
+            if(typeof key != "undefined"){
+                delete this.map[key];
+            }
+            this.keys.splice(index, 1);
+            this.fireEvent("remove", o, key);
+        }
+    },
+   
+/**
+ * Removed an item associated with the passed key fom the collection.
+ * @param {String} key The key of the item to remove.
+ */
+    removeKey : function(key){
+        return this.removeAt(this.indexOfKey(key));
+    },
+   
+/**
+ * Returns the number of items in the collection.
+ * @return {Number} the number of items in the collection.
+ */
+    getCount : function(){
+        return this.length; 
+    },
+   
+/**
+ * Returns index within the collection of the passed Object.
+ * @param {Object} o The item to find the index of.
+ * @return {Number} index of the item.
+ */
+    indexOf : function(o){
+        if(!this.items.indexOf){
+            for(var i = 0, len = this.items.length; i < len; i++){
+                if(this.items[i] == o) return i;
+            }
+            return -1;
+        }else{
+            return this.items.indexOf(o);
+        }
+    },
+   
+/**
+ * Returns index within the collection of the passed key.
+ * @param {String} key The key to find the index of.
+ * @return {Number} index of the key.
+ */
+    indexOfKey : function(key){
+        if(!this.keys.indexOf){
+            for(var i = 0, len = this.keys.length; i < len; i++){
+                if(this.keys[i] == key) return i;
+            }
+            return -1;
+        }else{
+            return this.keys.indexOf(key);
+        }
+    },
+   
+/**
+ * Returns the item associated with the passed key OR index. Key has priority over index.
+ * @param {String/Number} key The key or index of the item.
+ * @return {Object} The item associated with the passed key.
+ */
+    item : function(key){
+        var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key];
+        return typeof item != 'function' || this.allowFunctions ? item : null; // for prototype!
+    },
+    
+/**
+ * Returns the item at the specified index.
+ * @param {Number} index The index of the item.
+ * @return {Object}
+ */
+    itemAt : function(index){
+        return this.items[index];
+    },
+    
+/**
+ * Returns the item associated with the passed key.
+ * @param {String/Number} key The key of the item.
+ * @return {Object} The item associated with the passed key.
+ */
+    key : function(key){
+        return this.map[key];
+    },
+   
+/**
+ * Returns true if the collection contains the passed Object as an item.
+ * @param {Object} o  The Object to look for in the collection.
+ * @return {Boolean} True if the collection contains the Object as an item.
+ */
+    contains : function(o){
+        return this.indexOf(o) != -1;
+    },
+   
+/**
+ * Returns true if the collection contains the passed Object as a key.
+ * @param {String} key The key to look for in the collection.
+ * @return {Boolean} True if the collection contains the Object as a key.
+ */
+    containsKey : function(key){
+        return typeof this.map[key] != "undefined";
+    },
+   
+/**
+ * Removes all items from the collection.
+ */
+    clear : function(){
+        this.length = 0;
+        this.items = [];
+        this.keys = [];
+        this.map = {};
+        this.fireEvent("clear");
+    },
+   
+/**
+ * Returns the first item in the collection.
+ * @return {Object} the first item in the collection..
+ */
+    first : function(){
+        return this.items[0]; 
+    },
+   
+/**
+ * Returns the last item in the collection.
+ * @return {Object} the last item in the collection..
+ */
+    last : function(){
+        return this.items[this.length-1];   
+    },
+    
+    _sort : function(property, dir, fn){
+        var dsc = String(dir).toUpperCase() == "DESC" ? -1 : 1;
+        fn = fn || function(a, b){
+            return a-b;
+        };
+        var c = [], k = this.keys, items = this.items;
+        for(var i = 0, len = items.length; i < len; i++){
+            c[c.length] = {key: k[i], value: items[i], index: i};
+        }
+        c.sort(function(a, b){
+            var v = fn(a[property], b[property]) * dsc;
+            if(v == 0){
+                v = (a.index < b.index ? -1 : 1);
+            }
+            return v;
+        });
+        for(var i = 0, len = c.length; i < len; i++){
+            items[i] = c[i].value;
+            k[i] = c[i].key;
+        }
+        this.fireEvent("sort", this);
+    },
+    
+    /**
+     * Sorts this collection with the passed comparison function
+     * @param {String} direction (optional) "ASC" or "DESC"
+     * @param {Function} fn (optional) comparison function
+     */
+    sort : function(dir, fn){
+        this._sort("value", dir, fn);
+    },
+    
+    /**
+     * Sorts this collection by keys
+     * @param {String} direction (optional) "ASC" or "DESC"
+     * @param {Function} fn (optional) a comparison function (defaults to case insensitive string)
+     */
+    keySort : function(dir, fn){
+        this._sort("key", dir, fn || function(a, b){
+            return String(a).toUpperCase()-String(b).toUpperCase();
+        });
+    },
+    
+    /**
+     * Returns a range of items in this collection
+     * @param {Number} startIndex (optional) defaults to 0
+     * @param {Number} endIndex (optional) default to the last item
+     * @return {Array} An array of items
+     */
+    getRange : function(start, end){
+        var items = this.items;
+        if(items.length < 1){
+            return [];
+        }
+        start = start || 0;
+        end = Math.min(typeof end == "undefined" ? this.length-1 : end, this.length-1);
+        var r = [];
+        if(start <= end){
+            for(var i = start; i <= end; i++) {
+                   r[r.length] = items[i];
+            }
+        }else{
+            for(var i = start; i >= end; i--) {
+                   r[r.length] = items[i];
+            }
+        }
+        return r;
+    },
+        
+    /**
+     * Filter the <i>objects</i> in this collection by a specific property. 
+     * Returns a new collection that has been filtered.
+     * @param {String} property A property on your objects
+     * @param {String/RegExp} value Either string that the property values 
+     * should start with or a RegExp to test against the property
+     * @return {MixedCollection} The new filtered collection
+     */
+    filter : function(property, value){
+        if(!value.exec){ // not a regex
+            value = String(value);
+            if(value.length == 0){
+                return this.clone();
+            }
+            value = new RegExp("^" + Roo.escapeRe(value), "i");
+        }
+        return this.filterBy(function(o){
+            return o && value.test(o[property]);
+        });
+       },
+    
+    /**
+     * Filter by a function. * Returns a new collection that has been filtered.
+     * The passed function will be called with each 
+     * object in the collection. If the function returns true, the value is included 
+     * otherwise it is filtered.
+     * @param {Function} fn The function to be called, it will receive the args o (the object), k (the key)
+     * @param {Object} scope (optional) The scope of the function (defaults to this) 
+     * @return {MixedCollection} The new filtered collection
+     */
+    filterBy : function(fn, scope){
+        var r = new Roo.util.MixedCollection();
+        r.getKey = this.getKey;
+        var k = this.keys, it = this.items;
+        for(var i = 0, len = it.length; i < len; i++){
+            if(fn.call(scope||this, it[i], k[i])){
+                               r.add(k[i], it[i]);
+                       }
+        }
+        return r;
+    },
+    
+    /**
+     * Creates a duplicate of this collection
+     * @return {MixedCollection}
+     */
+    clone : function(){
+        var r = new Roo.util.MixedCollection();
+        var k = this.keys, it = this.items;
+        for(var i = 0, len = it.length; i < len; i++){
+            r.add(k[i], it[i]);
+        }
+        r.getKey = this.getKey;
+        return r;
+    }
+});
+/**
+ * Returns the item associated with the passed key or index.
+ * @method
+ * @param {String/Number} key The key or index of the item.
+ * @return {Object} The item associated with the passed key.
+ */
+Roo.util.MixedCollection.prototype.get = Roo.util.MixedCollection.prototype.item;/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.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
+ */
+Roo.util.JSON = new (function(){
+    var useHasOwn = {}.hasOwnProperty ? true : false;
+    
+    // crashes Safari in some instances
+    //var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/;
+    
+    var pad = function(n) {
+        return n < 10 ? "0" + n : n;
+    };
+    
+    var m = {
+        "\b": '\\b',
+        "\t": '\\t',
+        "\n": '\\n',
+        "\f": '\\f',
+        "\r": '\\r',
+        '"' : '\\"',
+        "\\": '\\\\'
+    };
+
+    var 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 + '"';
+    };
+    
+    var 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" : Roo.util.JSON.encode(v));
+                        b = true;
+                }
+            }
+            a.push("]");
+            return a.join("");
+    };
+    
+    var 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(o)
+    {
+        // should this be extended to fully wrap stringify..
+        
+        if(typeof o == "undefined" || o === null){
+            return "null";
+        }else if(o instanceof Array){
+            return encodeArray(o);
+        }else if(o instanceof Date){
+            return 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(this.encode(i), ":",
+                                v === null ? "null" : this.encode(v));
+                        b = true;
+                    }
+                }
+            }
+            a.push("}");
+            return a.join("");
+        }
+    };
+    
+    /**
+     * Decodes (parses) a JSON string to an object. If the JSON is invalid, this function throws a SyntaxError.
+     * @param {String} json The JSON string
+     * @return {Object} The resulting object
+     */
+    this.decode = function(json){
+        
+        return  /** eval:var:json */ eval("(" + json + ')');
+    };
+})();
+/** 
+ * Shorthand for {@link Roo.util.JSON#encode}
+ * @member Roo encode 
+ * @method */
+Roo.encode = typeof(JSON) != 'undefined' && JSON.stringify ? JSON.stringify : Roo.util.JSON.encode;
+/** 
+ * Shorthand for {@link Roo.util.JSON#decode}
+ * @member Roo decode 
+ * @method */
+Roo.decode = typeof(JSON) != 'undefined' && JSON.parse ? JSON.parse : Roo.util.JSON.decode;
+/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+/**
+ * @class Roo.util.Format
+ * Reusable data formatting functions
+ * @singleton
+ */
+Roo.util.Format = function(){
+    var trimRe = /^\s+|\s+$/g;
+    return {
+        /**
+         * Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
+         * @param {String} value The string to truncate
+         * @param {Number} length The maximum length to allow before truncating
+         * @return {String} The converted text
+         */
+        ellipsis : function(value, len){
+            if(value && value.length > len){
+                return value.substr(0, len-3)+"...";
+            }
+            return value;
+        },
+
+        /**
+         * Checks a reference and converts it to empty string if it is undefined
+         * @param {Mixed} value Reference to check
+         * @return {Mixed} Empty string if converted, otherwise the original value
+         */
+        undef : function(value){
+            return typeof value != "undefined" ? value : "";
+        },
+
+        /**
+         * Convert certain characters (&, <, >, and ') to their HTML character equivalents for literal display in web pages.
+         * @param {String} value The string to encode
+         * @return {String} The encoded text
+         */
+        htmlEncode : function(value){
+            return !value ? value : String(value).replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
+        },
+
+        /**
+         * Convert certain characters (&, <, >, and ') from their HTML character equivalents.
+         * @param {String} value The string to decode
+         * @return {String} The decoded text
+         */
+        htmlDecode : function(value){
+            return !value ? value : String(value).replace(/&amp;/g, "&").replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"');
+        },
+
+        /**
+         * Trims any whitespace from either side of a string
+         * @param {String} value The text to trim
+         * @return {String} The trimmed text
+         */
+        trim : function(value){
+            return String(value).replace(trimRe, "");
+        },
+
+        /**
+         * Returns a substring from within an original string
+         * @param {String} value The original text
+         * @param {Number} start The start index of the substring
+         * @param {Number} length The length of the substring
+         * @return {String} The substring
+         */
+        substr : function(value, start, length){
+            return String(value).substr(start, length);
+        },
+
+        /**
+         * Converts a string to all lower case letters
+         * @param {String} value The text to convert
+         * @return {String} The converted text
+         */
+        lowercase : function(value){
+            return String(value).toLowerCase();
+        },
+
+        /**
+         * Converts a string to all upper case letters
+         * @param {String} value The text to convert
+         * @return {String} The converted text
+         */
+        uppercase : function(value){
+            return String(value).toUpperCase();
+        },
+
+        /**
+         * Converts the first character only of a string to upper case
+         * @param {String} value The text to convert
+         * @return {String} The converted text
+         */
+        capitalize : function(value){
+            return !value ? value : value.charAt(0).toUpperCase() + value.substr(1).toLowerCase();
+        },
+
+        // private
+        call : function(value, fn){
+            if(arguments.length > 2){
+                var args = Array.prototype.slice.call(arguments, 2);
+                args.unshift(value);
+                 
+                return /** eval:var:value */  eval(fn).apply(window, args);
+            }else{
+                /** eval:var:value */
+                return /** eval:var:value */ eval(fn).call(window, value);
+            }
+        },
+
+       
+        /**
+         * safer version of Math.toFixed..??/
+         * @param {Number/String} value The numeric value to format
+         * @param {Number/String} value Decimal places 
+         * @return {String} The formatted currency string
+         */
+        toFixed : function(v, n)
+        {
+            // why not use to fixed - precision is buggered???
+            if (!n) {
+                return Math.round(v-0);
+            }
+            var fact = Math.pow(10,n+1);
+            v = (Math.round((v-0)*fact))/fact;
+            var z = (''+fact).substring(2);
+            if (v == Math.floor(v)) {
+                return Math.floor(v) + '.' + z;
+            }
+            
+            // now just padd decimals..
+            var ps = String(v).split('.');
+            var fd = (ps[1] + z);
+            var r = fd.substring(0,n); 
+            var rm = fd.substring(n); 
+            if (rm < 5) {
+                return ps[0] + '.' + r;
+            }
+            r*=1; // turn it into a number;
+            r++;
+            if (String(r).length != n) {
+                ps[0]*=1;
+                ps[0]++;
+                r = String(r).substring(1); // chop the end off.
+            }
+            
+            return ps[0] + '.' + r;
+             
+        },
+        
+        /**
+         * Format a number as US currency
+         * @param {Number/String} value The numeric value to format
+         * @return {String} The formatted currency string
+         */
+        usMoney : function(v){
+            v = (Math.round((v-0)*100))/100;
+            v = (v == Math.floor(v)) ? v + ".00" : ((v*10 == Math.floor(v*10)) ? v + "0" : v);
+            v = String(v);
+            var ps = v.split('.');
+            var whole = ps[0];
+            var sub = ps[1] ? '.'+ ps[1] : '.00';
+            var r = /(\d+)(\d{3})/;
+            while (r.test(whole)) {
+                whole = whole.replace(r, '$1' + ',' + '$2');
+            }
+            return "$" + whole + sub ;
+        },
+        
+        /**
+         * Parse a value into a formatted date using the specified format pattern.
+         * @param {Mixed} value The value to format
+         * @param {String} format (optional) Any valid date format string (defaults to 'm/d/Y')
+         * @return {String} The formatted date string
+         */
+        date : function(v, format){
+            if(!v){
+                return "";
+            }
+            if(!(v instanceof Date)){
+                v = new Date(Date.parse(v));
+            }
+            return v.dateFormat(format || "m/d/Y");
+        },
+
+        /**
+         * Returns a date rendering function that can be reused to apply a date format multiple times efficiently
+         * @param {String} format Any valid date format string
+         * @return {Function} The date formatting function
+         */
+        dateRenderer : function(format){
+            return function(v){
+                return Roo.util.Format.date(v, format);  
+            };
+        },
+
+        // private
+        stripTagsRE : /<\/?[^>]+>/gi,
+        
+        /**
+         * Strips all HTML tags
+         * @param {Mixed} value The text from which to strip tags
+         * @return {String} The stripped text
+         */
+        stripTags : function(v){
+            return !v ? v : String(v).replace(this.stripTagsRE, "");
+        }
+    };
+}();/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+
+
+/**
+ * @class Roo.MasterTemplate
+ * @extends Roo.Template
+ * Provides a template that can have child templates. The syntax is:
+<pre><code>
+var t = new Roo.MasterTemplate(
+       '&lt;select name="{name}"&gt;',
+               '&lt;tpl name="options"&gt;&lt;option value="{value:trim}"&gt;{text:ellipsis(10)}&lt;/option&gt;&lt;/tpl&gt;',
+       '&lt;/select&gt;'
+);
+t.add('options', {value: 'foo', text: 'bar'});
+// or you can add multiple child elements in one shot
+t.addAll('options', [
+    {value: 'foo', text: 'bar'},
+    {value: 'foo2', text: 'bar2'},
+    {value: 'foo3', text: 'bar3'}
+]);
+// then append, applying the master template values
+t.append('my-form', {name: 'my-select'});
+</code></pre>
+* A name attribute for the child template is not required if you have only one child
+* template or you want to refer to them by index.
+ */
+Roo.MasterTemplate = function(){
+    Roo.MasterTemplate.superclass.constructor.apply(this, arguments);
+    this.originalHtml = this.html;
+    var st = {};
+    var m, re = this.subTemplateRe;
+    re.lastIndex = 0;
+    var subIndex = 0;
+    while(m = re.exec(this.html)){
+        var name = m[1], content = m[2];
+        st[subIndex] = {
+            name: name,
+            index: subIndex,
+            buffer: [],
+            tpl : new Roo.Template(content)
+        };
+        if(name){
+            st[name] = st[subIndex];
+        }
+        st[subIndex].tpl.compile();
+        st[subIndex].tpl.call = this.call.createDelegate(this);
+        subIndex++;
+    }
+    this.subCount = subIndex;
+    this.subs = st;
+};
+Roo.extend(Roo.MasterTemplate, Roo.Template, {
+    /**
+    * The regular expression used to match sub templates
+    * @type RegExp
+    * @property
+    */
+    subTemplateRe : /<tpl(?:\sname="([\w-]+)")?>((?:.|\n)*?)<\/tpl>/gi,
+
+    /**
+     * Applies the passed values to a child template.
+     * @param {String/Number} name (optional) The name or index of the child template
+     * @param {Array/Object} values The values to be applied to the template
+     * @return {MasterTemplate} this
+     */
+     add : function(name, values){
+        if(arguments.length == 1){
+            values = arguments[0];
+            name = 0;
+        }
+        var s = this.subs[name];
+        s.buffer[s.buffer.length] = s.tpl.apply(values);
+        return this;
+    },
+
+    /**
+     * Applies all the passed values to a child template.
+     * @param {String/Number} name (optional) The name or index of the child template
+     * @param {Array} values The values to be applied to the template, this should be an array of objects.
+     * @param {Boolean} reset (optional) True to reset the template first
+     * @return {MasterTemplate} this
+     */
+    fill : function(name, values, reset){
+        var a = arguments;
+        if(a.length == 1 || (a.length == 2 && typeof a[1] == "boolean")){
+            values = a[0];
+            name = 0;
+            reset = a[1];
+        }
+        if(reset){
+            this.reset();
+        }
+        for(var i = 0, len = values.length; i < len; i++){
+            this.add(name, values[i]);
+        }
+        return this;
+    },
+
+    /**
+     * Resets the template for reuse
+     * @return {MasterTemplate} this
+     */
+     reset : function(){
+        var s = this.subs;
+        for(var i = 0; i < this.subCount; i++){
+            s[i].buffer = [];
+        }
+        return this;
+    },
+
+    applyTemplate : function(values){
+        var s = this.subs;
+        var replaceIndex = -1;
+        this.html = this.originalHtml.replace(this.subTemplateRe, function(m, name){
+            return s[++replaceIndex].buffer.join("");
+        });
+        return Roo.MasterTemplate.superclass.applyTemplate.call(this, values);
+    },
+
+    apply : function(){
+        return this.applyTemplate.apply(this, arguments);
+    },
+
+    compile : function(){return this;}
+});
+
+/**
+ * Alias for fill().
+ * @method
+ */
+Roo.MasterTemplate.prototype.addAll = Roo.MasterTemplate.prototype.fill;
+ /**
+ * Creates a template from the passed element's value (display:none textarea, preferred) or innerHTML. e.g.
+ * var tpl = Roo.MasterTemplate.from('element-id');
+ * @param {String/HTMLElement} el
+ * @param {Object} config
+ * @static
+ */
+Roo.MasterTemplate.from = function(el, config){
+    el = Roo.getDom(el);
+    return new Roo.MasterTemplate(el.value || el.innerHTML, config || '');
+};/*
+ * Based on:
+ * Ext JS Library 1.1.1
+ * Copyright(c) 2006-2007, Ext JS, LLC.
+ *
+ * Originally Released Under LGPL - original licence link has changed is not relivant.
+ *
+ * Fork - LGPL
+ * <script type="text/javascript">
+ */
+
+/**
+ * @class Roo.util.CSS
+ * Utility class for manipulating CSS rules
+ * @singleton
+ */
+Roo.util.CSS = function(){
+       var rules = null;
+       var doc = document;
+
+    var camelRe = /(-[a-z])/gi;
+    var camelFn = function(m, a){ return a.charAt(1).toUpperCase(); };
+
+   return {
+   /**
+    * Very simple dynamic creation of stylesheets from a text blob of rules.  The text will wrapped in a style
+    * tag and appended to the HEAD of the document.
+    * @param {String|Object} cssText The text containing the css rules
+    * @param {String} id An id to add to the stylesheet for later removal
+    * @return {StyleSheet}
+    */
+    createStyleSheet : function(cssText, id){
+        var ss;
+        var head = doc.getElementsByTagName("head")[0];
+        var nrules = doc.createElement("style");
+        nrules.setAttribute("type", "text/css");
+        if(id){
+            nrules.setAttribute("id", id);
+        }
+        if (typeof(cssText) != 'string') {
+            // support object maps..
+            // not sure if this a good idea.. 
+            // perhaps it should be merged with the general css handling
+            // and handle js style props.
+            var cssTextNew = [];
+            for(var n in cssText) {
+                var citems = [];
+                for(var k in cssText[n]) {
+                    citems.push( k + ' : ' +cssText[n][k] + ';' );
+                }
+                cssTextNew.push( n + ' { ' + citems.join(' ') + '} ');
+                
+            }
+            cssText = cssTextNew.join("\n");
+            
+        }
+       
+       
+       if(Roo.isIE){
+           head.appendChild(nrules);
+           ss = nrules.styleSheet;
+           ss.cssText = cssText;
+       }else{
+           try{
+                nrules.appendChild(doc.createTextNode(cssText));
+           }catch(e){
+               nrules.cssText = cssText; 
+           }
+           head.appendChild(nrules);
+           ss = nrules.styleSheet ? nrules.styleSheet : (nrules.sheet || doc.styleSheets[doc.styleSheets.length-1]);
+       }
+       this.cacheStyleSheet(ss);
+       return ss;
+   },
+
+   /**
+    * Removes a style or link tag by id
+    * @param {String} id The id of the tag
+    */
+   removeStyleSheet : function(id){
+       var existing = doc.getElementById(id);
+       if(existing){
+           existing.parentNode.removeChild(existing);
+       }
+   },
+
+   /**
+    * Dynamically swaps an existing stylesheet reference for a new one
+    * @param {String} id The id of an existing link tag to remove
+    * @param {String} url The href of the new stylesheet to include
+    */
+   swapStyleSheet : function(id, url){
+       this.removeStyleSheet(id);
+       var ss = doc.createElement("link");
+       ss.setAttribute("rel", "stylesheet");
+       ss.setAttribute("type", "text/css");
+       ss.setAttribute("id", id);
+       ss.setAttribute("href", url);
+       doc.getElementsByTagName("head")[0].appendChild(ss);
+   },
+   
+   /**
+    * Refresh the rule cache if you have dynamically added stylesheets
+    * @return {Object} An object (hash) of rules indexed by selector
+    */
+   refreshCache : function(){
+       return this.getRules(true);
+   },
+
+   // private
+   cacheStyleSheet : function(stylesheet){
+       if(!rules){
+           rules = {};
+       }
+       try{// try catch for cross domain access issue
+           var ssRules = stylesheet.cssRules || stylesheet.rules;
+           for(var j = ssRules.length-1; j >= 0; --j){
+               rules[ssRules[j].selectorText] = ssRules[j];
+           }
+       }catch(e){}
+   },
+   
+   /**
+    * Gets all css rules for the document
+    * @param {Boolean} refreshCache true to refresh the internal cache
+    * @return {Object} An object (hash) of rules indexed by selector
+    */
+   getRules : function(refreshCache){
+               if(rules == null || refreshCache){
+                       rules = {};
+                       var ds = doc.styleSheets;
+                       for(var i =0, len = ds.length; i < len; i++){
+                           try{
+                       this.cacheStyleSheet(ds[i]);
+                   }catch(e){} 
+               }
+               }
+               return rules;
+       },
+       
+       /**
+    * Gets an an individual CSS rule by selector(s)
+    * @param {String/Array} selector The CSS selector or an array of selectors to try. The first selector that is found is returned.
+    * @param {Boolean} refreshCache true to refresh the internal cache if you have recently updated any rules or added styles dynamically
+    * @return {CSSRule} The CSS rule or null if one is not found
+    */
+   getRule : function(selector, refreshCache){
+               var rs = this.getRules(refreshCache);
+               if(!(selector instanceof Array)){
+                   return rs[selector];
+               }
+               for(var i = 0; i < selector.length; i++){
+                       if(rs[selector[i]]){
+                               return rs[selector[i]];
+                       }
+               }
+               return null;
+       },
+       
+       
+       /**
+    * Updates a rule property
+    * @param {String/Array} selector If it's an array it tries each selector until it finds one. Stops immediately once one is found.
+    * @param {String} property The css property
+    * @param {String} value The new value for the property
+    * @return {Boolean} true If a rule was found and updated
+    */
+   updateRule : function(selector, property, value){
+               if(!(selector instanceof Array)){
+                       var rule = this.getRule(selector);
+                       if(rule){
+                               rule.style[property.replace(camelRe, camelFn)] = value;
+                               return true;
+                       }
+               }else{
+                       for(var i = 0; i < selector.length; i++){
+                               if(this.updateRule(selector[i], property, value)){
+                                       return true;
+                               }
+                       }
+               }
+               return false;
+       }
+   };  
+}();
\ No newline at end of file