Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / adapter / ext / ext-base-debug.js
1 /*!
2  * Ext JS Library 3.0.3
3  * Copyright(c) 2006-2009 Ext JS, LLC
4  * licensing@extjs.com
5  * http://www.extjs.com/license
6  */
7 \r
8 // for old browsers\r
9 window.undefined = window.undefined;\r
10 \r
11 /**\r
12  * @class Ext\r
13  * Ext core utilities and functions.\r
14  * @singleton\r
15  */\r
16 \r
17 Ext = {\r
18     /**\r
19      * The version of the framework\r
20      * @type String\r
21      */\r
22     version : '3.0.3'\r
23 };\r
24 \r
25 /**\r
26  * Copies all the properties of config to obj.\r
27  * @param {Object} obj The receiver of the properties\r
28  * @param {Object} config The source of the properties\r
29  * @param {Object} defaults A different object that will also be applied for default values\r
30  * @return {Object} returns obj\r
31  * @member Ext apply\r
32  */\r
33 Ext.apply = function(o, c, defaults){\r
34     // no "this" reference for friendly out of scope calls\r
35     if(defaults){\r
36         Ext.apply(o, defaults);\r
37     }\r
38     if(o && c && typeof c == 'object'){\r
39         for(var p in c){\r
40             o[p] = c[p];\r
41         }\r
42     }\r
43     return o;\r
44 };\r
45 \r
46 (function(){\r
47     var idSeed = 0,\r
48         toString = Object.prototype.toString,\r
49         ua = navigator.userAgent.toLowerCase(),\r
50         check = function(r){\r
51             return r.test(ua);\r
52         },\r
53         DOC = document,\r
54         isStrict = DOC.compatMode == "CSS1Compat",\r
55         isOpera = check(/opera/),\r
56         isChrome = check(/chrome/),\r
57         isWebKit = check(/webkit/),\r
58         isSafari = !isChrome && check(/safari/),\r
59         isSafari2 = isSafari && check(/applewebkit\/4/), // unique to Safari 2\r
60         isSafari3 = isSafari && check(/version\/3/),\r
61         isSafari4 = isSafari && check(/version\/4/),\r
62         isIE = !isOpera && check(/msie/),\r
63         isIE7 = isIE && check(/msie 7/),\r
64         isIE8 = isIE && check(/msie 8/),\r
65         isIE6 = isIE && !isIE7 && !isIE8,\r
66         isGecko = !isWebKit && check(/gecko/),\r
67         isGecko2 = isGecko && check(/rv:1\.8/),\r
68         isGecko3 = isGecko && check(/rv:1\.9/),\r
69         isBorderBox = isIE && !isStrict,\r
70         isWindows = check(/windows|win32/),\r
71         isMac = check(/macintosh|mac os x/),\r
72         isAir = check(/adobeair/),\r
73         isLinux = check(/linux/),\r
74         isSecure = /^https/i.test(window.location.protocol);\r
75 \r
76     // remove css image flicker\r
77     if(isIE6){\r
78         try{\r
79             DOC.execCommand("BackgroundImageCache", false, true);\r
80         }catch(e){}\r
81     }\r
82 \r
83     Ext.apply(Ext, {\r
84         /**\r
85          * URL to a blank file used by Ext when in secure mode for iframe src and onReady src to prevent\r
86          * the IE insecure content warning (<tt>'about:blank'</tt>, except for IE in secure mode, which is <tt>'javascript:""'</tt>).\r
87          * @type String\r
88          */\r
89         SSL_SECURE_URL : isSecure && isIE ? 'javascript:""' : 'about:blank', \r
90         /**\r
91          * True if the browser is in strict (standards-compliant) mode, as opposed to quirks mode\r
92          * @type Boolean\r
93          */\r
94         isStrict : isStrict,\r
95         /**\r
96          * True if the page is running over SSL\r
97          * @type Boolean\r
98          */\r
99         isSecure : isSecure,\r
100         /**\r
101          * True when the document is fully initialized and ready for action\r
102          * @type Boolean\r
103          */\r
104         isReady : false,\r
105 \r
106         /**\r
107          * True if the {@link Ext.Fx} Class is available\r
108          * @type Boolean\r
109          * @property enableFx\r
110          */\r
111 \r
112         /**\r
113          * True to automatically uncache orphaned Ext.Elements periodically (defaults to true)\r
114          * @type Boolean\r
115          */\r
116         enableGarbageCollector : true,\r
117 \r
118         /**\r
119          * True to automatically purge event listeners after uncaching an element (defaults to false).\r
120          * Note: this only happens if {@link #enableGarbageCollector} is true.\r
121          * @type Boolean\r
122          */\r
123         enableListenerCollection : false,\r
124 \r
125         /**\r
126          * Indicates whether to use native browser parsing for JSON methods.\r
127          * This option is ignored if the browser does not support native JSON methods.\r
128          * <b>Note: Native JSON methods will not work with objects that have functions.\r
129          * Also, property names must be quoted, otherwise the data will not parse.</b> (Defaults to false)\r
130          * @type Boolean\r
131          */\r
132         USE_NATIVE_JSON : false,\r
133 \r
134         /**\r
135          * Copies all the properties of config to obj if they don't already exist.\r
136          * @param {Object} obj The receiver of the properties\r
137          * @param {Object} config The source of the properties\r
138          * @return {Object} returns obj\r
139          */\r
140         applyIf : function(o, c){\r
141             if(o){\r
142                 for(var p in c){\r
143                     if(!Ext.isDefined(o[p])){\r
144                         o[p] = c[p];\r
145                     }\r
146                 }\r
147             }\r
148             return o;\r
149         },\r
150 \r
151         /**\r
152          * Generates unique ids. If the element already has an id, it is unchanged\r
153          * @param {Mixed} el (optional) The element to generate an id for\r
154          * @param {String} prefix (optional) Id prefix (defaults "ext-gen")\r
155          * @return {String} The generated Id.\r
156          */\r
157         id : function(el, prefix){\r
158             return (el = Ext.getDom(el) || {}).id = el.id || (prefix || "ext-gen") + (++idSeed);\r
159         },\r
160 \r
161         /**\r
162          * <p>Extends one class to create a subclass and optionally overrides members with the passed literal. This method\r
163          * also adds the function "override()" to the subclass that can be used to override members of the class.</p>\r
164          * For example, to create a subclass of Ext GridPanel:\r
165          * <pre><code>\r
166 MyGridPanel = Ext.extend(Ext.grid.GridPanel, {\r
167     constructor: function(config) {\r
168 \r
169 //      Create configuration for this Grid.\r
170         var store = new Ext.data.Store({...});\r
171         var colModel = new Ext.grid.ColumnModel({...});\r
172 \r
173 //      Create a new config object containing our computed properties\r
174 //      *plus* whatever was in the config parameter.\r
175         config = Ext.apply({\r
176             store: store,\r
177             colModel: colModel\r
178         }, config);\r
179 \r
180         MyGridPanel.superclass.constructor.call(this, config);\r
181 \r
182 //      Your postprocessing here\r
183     },\r
184 \r
185     yourMethod: function() {\r
186         // etc.\r
187     }\r
188 });\r
189 </code></pre>\r
190          *\r
191          * <p>This function also supports a 3-argument call in which the subclass's constructor is\r
192          * passed as an argument. In this form, the parameters are as follows:</p>\r
193          * <div class="mdetail-params"><ul>\r
194          * <li><code>subclass</code> : Function <div class="sub-desc">The subclass constructor.</div></li>\r
195          * <li><code>superclass</code> : Function <div class="sub-desc">The constructor of class being extended</div></li>\r
196          * <li><code>overrides</code> : Object <div class="sub-desc">A literal with members which are copied into the subclass's\r
197          * prototype, and are therefore shared among all instances of the new class.</div></li>\r
198          * </ul></div>\r
199          *\r
200          * @param {Function} subclass The constructor of class being extended.\r
201          * @param {Object} overrides <p>A literal with members which are copied into the subclass's\r
202          * prototype, and are therefore shared between all instances of the new class.</p>\r
203          * <p>This may contain a special member named <tt><b>constructor</b></tt>. This is used\r
204          * to define the constructor of the new class, and is returned. If this property is\r
205          * <i>not</i> specified, a constructor is generated and returned which just calls the\r
206          * superclass's constructor passing on its parameters.</p>\r
207          * <p><b>It is essential that you call the superclass constructor in any provided constructor. See example code.</b></p>\r
208          * @return {Function} The subclass constructor.\r
209          */\r
210         extend : function(){\r
211             // inline overrides\r
212             var io = function(o){\r
213                 for(var m in o){\r
214                     this[m] = o[m];\r
215                 }\r
216             };\r
217             var oc = Object.prototype.constructor;\r
218 \r
219             return function(sb, sp, overrides){\r
220                 if(Ext.isObject(sp)){\r
221                     overrides = sp;\r
222                     sp = sb;\r
223                     sb = overrides.constructor != oc ? overrides.constructor : function(){sp.apply(this, arguments);};\r
224                 }\r
225                 var F = function(){},\r
226                     sbp,\r
227                     spp = sp.prototype;\r
228 \r
229                 F.prototype = spp;\r
230                 sbp = sb.prototype = new F();\r
231                 sbp.constructor=sb;\r
232                 sb.superclass=spp;\r
233                 if(spp.constructor == oc){\r
234                     spp.constructor=sp;\r
235                 }\r
236                 sb.override = function(o){\r
237                     Ext.override(sb, o);\r
238                 };\r
239                 sbp.superclass = sbp.supr = (function(){\r
240                     return spp;\r
241                 });\r
242                 sbp.override = io;\r
243                 Ext.override(sb, overrides);\r
244                 sb.extend = function(o){return Ext.extend(sb, o);};\r
245                 return sb;\r
246             };\r
247         }(),\r
248 \r
249         /**\r
250          * Adds a list of functions to the prototype of an existing class, overwriting any existing methods with the same name.\r
251          * Usage:<pre><code>\r
252 Ext.override(MyClass, {\r
253     newMethod1: function(){\r
254         // etc.\r
255     },\r
256     newMethod2: function(foo){\r
257         // etc.\r
258     }\r
259 });\r
260 </code></pre>\r
261          * @param {Object} origclass The class to override\r
262          * @param {Object} overrides The list of functions to add to origClass.  This should be specified as an object literal\r
263          * containing one or more methods.\r
264          * @method override\r
265          */\r
266         override : function(origclass, overrides){\r
267             if(overrides){\r
268                 var p = origclass.prototype;\r
269                 Ext.apply(p, overrides);\r
270                 if(Ext.isIE && overrides.toString != origclass.toString){\r
271                     p.toString = overrides.toString;\r
272                 }\r
273             }\r
274         },\r
275 \r
276         /**\r
277          * Creates namespaces to be used for scoping variables and classes so that they are not global.\r
278          * Specifying the last node of a namespace implicitly creates all other nodes. Usage:\r
279          * <pre><code>\r
280 Ext.namespace('Company', 'Company.data');\r
281 Ext.namespace('Company.data'); // equivalent and preferable to above syntax\r
282 Company.Widget = function() { ... }\r
283 Company.data.CustomStore = function(config) { ... }\r
284 </code></pre>\r
285          * @param {String} namespace1\r
286          * @param {String} namespace2\r
287          * @param {String} etc\r
288          * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)\r
289          * @method namespace\r
290          */\r
291         namespace : function(){\r
292             var o, d;\r
293             Ext.each(arguments, function(v) {\r
294                 d = v.split(".");\r
295                 o = window[d[0]] = window[d[0]] || {};\r
296                 Ext.each(d.slice(1), function(v2){\r
297                     o = o[v2] = o[v2] || {};\r
298                 });\r
299             });\r
300             return o;\r
301         },\r
302 \r
303         /**\r
304          * Takes an object and converts it to an encoded URL. e.g. Ext.urlEncode({foo: 1, bar: 2}); would return "foo=1&bar=2".  Optionally, property values can be arrays, instead of keys and the resulting string that's returned will contain a name/value pair for each array value.\r
305          * @param {Object} o\r
306          * @param {String} pre (optional) A prefix to add to the url encoded string\r
307          * @return {String}\r
308          */\r
309         urlEncode : function(o, pre){\r
310             var empty,\r
311                 buf = [],\r
312                 e = encodeURIComponent;\r
313 \r
314             Ext.iterate(o, function(key, item){\r
315                 empty = Ext.isEmpty(item);\r
316                 Ext.each(empty ? key : item, function(val){\r
317                     buf.push('&', e(key), '=', (!Ext.isEmpty(val) && (val != key || !empty)) ? (Ext.isDate(val) ? Ext.encode(val).replace(/"/g, '') : e(val)) : '');\r
318                 });\r
319             });\r
320             if(!pre){\r
321                 buf.shift();\r
322                 pre = '';\r
323             }\r
324             return pre + buf.join('');\r
325         },\r
326 \r
327         /**\r
328          * Takes an encoded URL and and converts it to an object. Example: <pre><code>\r
329 Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}\r
330 Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}\r
331 </code></pre>\r
332          * @param {String} string\r
333          * @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).\r
334          * @return {Object} A literal with members\r
335          */\r
336         urlDecode : function(string, overwrite){\r
337             if(Ext.isEmpty(string)){\r
338                 return {};\r
339             }\r
340             var obj = {},\r
341                 pairs = string.split('&'),\r
342                 d = decodeURIComponent,\r
343                 name,\r
344                 value;\r
345             Ext.each(pairs, function(pair) {\r
346                 pair = pair.split('=');\r
347                 name = d(pair[0]);\r
348                 value = d(pair[1]);\r
349                 obj[name] = overwrite || !obj[name] ? value :\r
350                             [].concat(obj[name]).concat(value);\r
351             });\r
352             return obj;\r
353         },\r
354 \r
355         /**\r
356          * Appends content to the query string of a URL, handling logic for whether to place\r
357          * a question mark or ampersand.\r
358          * @param {String} url The URL to append to.\r
359          * @param {String} s The content to append to the URL.\r
360          * @return (String) The resulting URL\r
361          */\r
362         urlAppend : function(url, s){\r
363             if(!Ext.isEmpty(s)){\r
364                 return url + (url.indexOf('?') === -1 ? '?' : '&') + s;\r
365             }\r
366             return url;\r
367         },\r
368 \r
369         /**\r
370          * Converts any iterable (numeric indices and a length property) into a true array\r
371          * Don't use this on strings. IE doesn't support "abc"[0] which this implementation depends on.\r
372          * For strings, use this instead: "abc".match(/./g) => [a,b,c];\r
373          * @param {Iterable} the iterable object to be turned into a true Array.\r
374          * @return (Array) array\r
375          */\r
376         toArray : function(){\r
377             return isIE ?\r
378                 function(a, i, j, res){\r
379                     res = [];\r
380                     Ext.each(a, function(v) {\r
381                         res.push(v);\r
382                     });\r
383                     return res.slice(i || 0, j || res.length);\r
384                 } :\r
385                 function(a, i, j){\r
386                     return Array.prototype.slice.call(a, i || 0, j || a.length);\r
387                 }\r
388         }(),\r
389 \r
390         isIterable : function(v){\r
391             //check for array or arguments\r
392             if(Ext.isArray(v) || v.callee){\r
393                 return true;\r
394             }\r
395             //check for node list type\r
396             if(/NodeList|HTMLCollection/.test(toString.call(v))){\r
397                 return true;\r
398             }\r
399             //NodeList has an item and length property\r
400             //IXMLDOMNodeList has nextNode method, needs to be checked first.\r
401             return ((v.nextNode || v.item) && Ext.isNumber(v.length));\r
402         },\r
403 \r
404         /**\r
405          * Iterates an array calling the supplied function.\r
406          * @param {Array/NodeList/Mixed} array The array to be iterated. If this\r
407          * argument is not really an array, the supplied function is called once.\r
408          * @param {Function} fn The function to be called with each item. If the\r
409          * supplied function returns false, iteration stops and this method returns\r
410          * the current <code>index</code>. This function is called with\r
411          * the following arguments:\r
412          * <div class="mdetail-params"><ul>\r
413          * <li><code>item</code> : <i>Mixed</i>\r
414          * <div class="sub-desc">The item at the current <code>index</code>\r
415          * in the passed <code>array</code></div></li>\r
416          * <li><code>index</code> : <i>Number</i>\r
417          * <div class="sub-desc">The current index within the array</div></li>\r
418          * <li><code>allItems</code> : <i>Array</i>\r
419          * <div class="sub-desc">The <code>array</code> passed as the first\r
420          * argument to <code>Ext.each</code>.</div></li>\r
421          * </ul></div>\r
422          * @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed.\r
423          * Defaults to the <code>item</code> at the current <code>index</code>\r
424          * within the passed <code>array</code>.\r
425          * @return See description for the fn parameter.\r
426          */\r
427         each : function(array, fn, scope){\r
428             if(Ext.isEmpty(array, true)){\r
429                 return;\r
430             }\r
431             if(!Ext.isIterable(array) || Ext.isPrimitive(array)){\r
432                 array = [array];\r
433             }\r
434             for(var i = 0, len = array.length; i < len; i++){\r
435                 if(fn.call(scope || array[i], array[i], i, array) === false){\r
436                     return i;\r
437                 };\r
438             }\r
439         },\r
440 \r
441         /**\r
442          * Iterates either the elements in an array, or each of the properties in an object.\r
443          * <b>Note</b>: If you are only iterating arrays, it is better to call {@link #each}.\r
444          * @param {Object/Array} object The object or array to be iterated\r
445          * @param {Function} fn The function to be called for each iteration.\r
446          * The iteration will stop if the supplied function returns false, or\r
447          * all array elements / object properties have been covered. The signature\r
448          * varies depending on the type of object being interated:\r
449          * <div class="mdetail-params"><ul>\r
450          * <li>Arrays : <tt>(Object item, Number index, Array allItems)</tt>\r
451          * <div class="sub-desc">\r
452          * When iterating an array, the supplied function is called with each item.</div></li>\r
453          * <li>Objects : <tt>(String key, Object value)</tt>\r
454          * <div class="sub-desc">\r
455          * When iterating an object, the supplied function is called with each key-value pair in\r
456          * the object.</div></li>\r
457          * </ul></div>\r
458          * @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed. Defaults to\r
459          * the <code>object</code> being iterated.\r
460          */\r
461         iterate : function(obj, fn, scope){\r
462             if(Ext.isEmpty(obj)){\r
463                 return;\r
464             }\r
465             if(Ext.isIterable(obj)){\r
466                 Ext.each(obj, fn, scope);\r
467                 return;\r
468             }else if(Ext.isObject(obj)){\r
469                 for(var prop in obj){\r
470                     if(obj.hasOwnProperty(prop)){\r
471                         if(fn.call(scope || obj, prop, obj[prop]) === false){\r
472                             return;\r
473                         };\r
474                     }\r
475                 }\r
476             }\r
477         },\r
478 \r
479         /**\r
480          * Return the dom node for the passed String (id), dom node, or Ext.Element.\r
481          * Here are some examples:\r
482          * <pre><code>\r
483 // gets dom node based on id\r
484 var elDom = Ext.getDom('elId');\r
485 // gets dom node based on the dom node\r
486 var elDom1 = Ext.getDom(elDom);\r
487 \r
488 // If we don&#39;t know if we are working with an\r
489 // Ext.Element or a dom node use Ext.getDom\r
490 function(el){\r
491     var dom = Ext.getDom(el);\r
492     // do something with the dom node\r
493 }\r
494          * </code></pre>\r
495          * <b>Note</b>: the dom node to be found actually needs to exist (be rendered, etc)\r
496          * when this method is called to be successful.\r
497          * @param {Mixed} el\r
498          * @return HTMLElement\r
499          */\r
500         getDom : function(el){\r
501             if(!el || !DOC){\r
502                 return null;\r
503             }\r
504             return el.dom ? el.dom : (Ext.isString(el) ? DOC.getElementById(el) : el);\r
505         },\r
506 \r
507         /**\r
508          * Returns the current document body as an {@link Ext.Element}.\r
509          * @return Ext.Element The document body\r
510          */\r
511         getBody : function(){\r
512             return Ext.get(DOC.body || DOC.documentElement);\r
513         },\r
514 \r
515         /**\r
516          * Removes a DOM node from the document.  The body node will be ignored if passed in.\r
517          * @param {HTMLElement} node The node to remove\r
518          */\r
519         removeNode : isIE ? function(){\r
520             var d;\r
521             return function(n){\r
522                 if(n && n.tagName != 'BODY'){\r
523                     d = d || DOC.createElement('div');\r
524                     d.appendChild(n);\r
525                     d.innerHTML = '';\r
526                 }\r
527             }\r
528         }() : function(n){\r
529             if(n && n.parentNode && n.tagName != 'BODY'){\r
530                 n.parentNode.removeChild(n);\r
531             }\r
532         },\r
533 \r
534         /**\r
535          * <p>Returns true if the passed value is empty.</p>\r
536          * <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>\r
537          * <li>null</li>\r
538          * <li>undefined</li>\r
539          * <li>an empty array</li>\r
540          * <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>\r
541          * </ul></div>\r
542          * @param {Mixed} value The value to test\r
543          * @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)\r
544          * @return {Boolean}\r
545          */\r
546         isEmpty : function(v, allowBlank){\r
547             return v === null || v === undefined || ((Ext.isArray(v) && !v.length)) || (!allowBlank ? v === '' : false);\r
548         },\r
549 \r
550         /**\r
551          * Returns true if the passed value is a JavaScript array, otherwise false.\r
552          * @param {Mixed} value The value to test\r
553          * @return {Boolean}\r
554          */\r
555         isArray : function(v){\r
556             return toString.apply(v) === '[object Array]';\r
557         },\r
558 \r
559         /**\r
560          * Returns true if the passed object is a JavaScript date object, otherwise false.\r
561          * @param {Object} object The object to test\r
562          * @return {Boolean}\r
563          */\r
564         isDate : function(v){\r
565             return toString.apply(v) === '[object Date]';\r
566         },\r
567 \r
568         /**\r
569          * Returns true if the passed value is a JavaScript Object, otherwise false.\r
570          * @param {Mixed} value The value to test\r
571          * @return {Boolean}\r
572          */\r
573         isObject : function(v){\r
574             return v && typeof v == "object";\r
575         },\r
576 \r
577         /**\r
578          * Returns true if the passed value is a JavaScript 'primitive', a string, number or boolean.\r
579          * @param {Mixed} value The value to test\r
580          * @return {Boolean}\r
581          */\r
582         isPrimitive : function(v){\r
583             return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);\r
584         },\r
585 \r
586         /**\r
587          * Returns true if the passed value is a JavaScript Function, otherwise false.\r
588          * @param {Mixed} value The value to test\r
589          * @return {Boolean}\r
590          */\r
591         isFunction : function(v){\r
592             return toString.apply(v) === '[object Function]';\r
593         },\r
594 \r
595         /**\r
596          * Returns true if the passed value is a number. Returns false for non-finite numbers.\r
597          * @param {Mixed} value The value to test\r
598          * @return {Boolean}\r
599          */\r
600         isNumber : function(v){\r
601             return typeof v === 'number' && isFinite(v);\r
602         },\r
603 \r
604         /**\r
605          * Returns true if the passed value is a string.\r
606          * @param {Mixed} value The value to test\r
607          * @return {Boolean}\r
608          */\r
609         isString : function(v){\r
610             return typeof v === 'string';\r
611         },\r
612 \r
613         /**\r
614          * Returns true if the passed value is a boolean.\r
615          * @param {Mixed} value The value to test\r
616          * @return {Boolean}\r
617          */\r
618         isBoolean : function(v){\r
619             return typeof v === 'boolean';\r
620         },\r
621 \r
622         /**\r
623          * Returns true if the passed value is not undefined.\r
624          * @param {Mixed} value The value to test\r
625          * @return {Boolean}\r
626          */\r
627         isDefined : function(v){\r
628             return typeof v !== 'undefined';\r
629         },\r
630 \r
631         /**\r
632          * True if the detected browser is Opera.\r
633          * @type Boolean\r
634          */\r
635         isOpera : isOpera,\r
636         /**\r
637          * True if the detected browser uses WebKit.\r
638          * @type Boolean\r
639          */\r
640         isWebKit : isWebKit,\r
641         /**\r
642          * True if the detected browser is Chrome.\r
643          * @type Boolean\r
644          */\r
645         isChrome : isChrome,\r
646         /**\r
647          * True if the detected browser is Safari.\r
648          * @type Boolean\r
649          */\r
650         isSafari : isSafari,\r
651         /**\r
652          * True if the detected browser is Safari 3.x.\r
653          * @type Boolean\r
654          */\r
655         isSafari3 : isSafari3,\r
656         /**\r
657          * True if the detected browser is Safari 4.x.\r
658          * @type Boolean\r
659          */\r
660         isSafari4 : isSafari4,\r
661         /**\r
662          * True if the detected browser is Safari 2.x.\r
663          * @type Boolean\r
664          */\r
665         isSafari2 : isSafari2,\r
666         /**\r
667          * True if the detected browser is Internet Explorer.\r
668          * @type Boolean\r
669          */\r
670         isIE : isIE,\r
671         /**\r
672          * True if the detected browser is Internet Explorer 6.x.\r
673          * @type Boolean\r
674          */\r
675         isIE6 : isIE6,\r
676         /**\r
677          * True if the detected browser is Internet Explorer 7.x.\r
678          * @type Boolean\r
679          */\r
680         isIE7 : isIE7,\r
681         /**\r
682          * True if the detected browser is Internet Explorer 8.x.\r
683          * @type Boolean\r
684          */\r
685         isIE8 : isIE8,\r
686         /**\r
687          * True if the detected browser uses the Gecko layout engine (e.g. Mozilla, Firefox).\r
688          * @type Boolean\r
689          */\r
690         isGecko : isGecko,\r
691         /**\r
692          * True if the detected browser uses a pre-Gecko 1.9 layout engine (e.g. Firefox 2.x).\r
693          * @type Boolean\r
694          */\r
695         isGecko2 : isGecko2,\r
696         /**\r
697          * True if the detected browser uses a Gecko 1.9+ layout engine (e.g. Firefox 3.x).\r
698          * @type Boolean\r
699          */\r
700         isGecko3 : isGecko3,\r
701         /**\r
702          * True if the detected browser is Internet Explorer running in non-strict mode.\r
703          * @type Boolean\r
704          */\r
705         isBorderBox : isBorderBox,\r
706         /**\r
707          * True if the detected platform is Linux.\r
708          * @type Boolean\r
709          */\r
710         isLinux : isLinux,\r
711         /**\r
712          * True if the detected platform is Windows.\r
713          * @type Boolean\r
714          */\r
715         isWindows : isWindows,\r
716         /**\r
717          * True if the detected platform is Mac OS.\r
718          * @type Boolean\r
719          */\r
720         isMac : isMac,\r
721         /**\r
722          * True if the detected platform is Adobe Air.\r
723          * @type Boolean\r
724          */\r
725         isAir : isAir\r
726     });\r
727 \r
728     /**\r
729      * Creates namespaces to be used for scoping variables and classes so that they are not global.\r
730      * Specifying the last node of a namespace implicitly creates all other nodes. Usage:\r
731      * <pre><code>\r
732 Ext.namespace('Company', 'Company.data');\r
733 Ext.namespace('Company.data'); // equivalent and preferable to above syntax\r
734 Company.Widget = function() { ... }\r
735 Company.data.CustomStore = function(config) { ... }\r
736 </code></pre>\r
737      * @param {String} namespace1\r
738      * @param {String} namespace2\r
739      * @param {String} etc\r
740      * @return {Object} The namespace object. (If multiple arguments are passed, this will be the last namespace created)\r
741      * @method ns\r
742      */\r
743     Ext.ns = Ext.namespace;\r
744 })();\r
745 \r
746 Ext.ns("Ext", "Ext.util", "Ext.lib", "Ext.data");\r
747 \r
748 \r
749 /**\r
750  * @class Function\r
751  * These functions are available on every Function object (any JavaScript function).\r
752  */\r
753 Ext.apply(Function.prototype, {\r
754      /**\r
755      * Creates an interceptor function. The passed function is called before the original one. If it returns false,\r
756      * the original one is not called. The resulting function returns the results of the original function.\r
757      * The passed function is called with the parameters of the original function. Example usage:\r
758      * <pre><code>\r
759 var sayHi = function(name){\r
760     alert('Hi, ' + name);\r
761 }\r
762 \r
763 sayHi('Fred'); // alerts "Hi, Fred"\r
764 \r
765 // create a new function that validates input without\r
766 // directly modifying the original function:\r
767 var sayHiToFriend = sayHi.createInterceptor(function(name){\r
768     return name == 'Brian';\r
769 });\r
770 \r
771 sayHiToFriend('Fred');  // no alert\r
772 sayHiToFriend('Brian'); // alerts "Hi, Brian"\r
773 </code></pre>\r
774      * @param {Function} fcn The function to call before the original\r
775      * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.\r
776      * <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>\r
777      * @return {Function} The new function\r
778      */\r
779     createInterceptor : function(fcn, scope){\r
780         var method = this;\r
781         return !Ext.isFunction(fcn) ?\r
782                 this :\r
783                 function() {\r
784                     var me = this,\r
785                         args = arguments;\r
786                     fcn.target = me;\r
787                     fcn.method = method;\r
788                     return (fcn.apply(scope || me || window, args) !== false) ?\r
789                             method.apply(me || window, args) :\r
790                             null;\r
791                 };\r
792     },\r
793 \r
794      /**\r
795      * Creates a callback that passes arguments[0], arguments[1], arguments[2], ...\r
796      * Call directly on any function. Example: <code>myFunction.createCallback(arg1, arg2)</code>\r
797      * Will create a function that is bound to those 2 args. <b>If a specific scope is required in the\r
798      * callback, use {@link #createDelegate} instead.</b> The function returned by createCallback always\r
799      * executes in the window scope.\r
800      * <p>This method is required when you want to pass arguments to a callback function.  If no arguments\r
801      * are needed, you can simply pass a reference to the function as a callback (e.g., callback: myFn).\r
802      * However, if you tried to pass a function with arguments (e.g., callback: myFn(arg1, arg2)) the function\r
803      * would simply execute immediately when the code is parsed. Example usage:\r
804      * <pre><code>\r
805 var sayHi = function(name){\r
806     alert('Hi, ' + name);\r
807 }\r
808 \r
809 // clicking the button alerts "Hi, Fred"\r
810 new Ext.Button({\r
811     text: 'Say Hi',\r
812     renderTo: Ext.getBody(),\r
813     handler: sayHi.createCallback('Fred')\r
814 });\r
815 </code></pre>\r
816      * @return {Function} The new function\r
817     */\r
818     createCallback : function(/*args...*/){\r
819         // make args available, in function below\r
820         var args = arguments,\r
821             method = this;\r
822         return function() {\r
823             return method.apply(window, args);\r
824         };\r
825     },\r
826 \r
827     /**\r
828      * Creates a delegate (callback) that sets the scope to obj.\r
829      * Call directly on any function. Example: <code>this.myFunction.createDelegate(this, [arg1, arg2])</code>\r
830      * Will create a function that is automatically scoped to obj so that the <tt>this</tt> variable inside the\r
831      * callback points to obj. Example usage:\r
832      * <pre><code>\r
833 var sayHi = function(name){\r
834     // Note this use of "this.text" here.  This function expects to\r
835     // execute within a scope that contains a text property.  In this\r
836     // example, the "this" variable is pointing to the btn object that\r
837     // was passed in createDelegate below.\r
838     alert('Hi, ' + name + '. You clicked the "' + this.text + '" button.');\r
839 }\r
840 \r
841 var btn = new Ext.Button({\r
842     text: 'Say Hi',\r
843     renderTo: Ext.getBody()\r
844 });\r
845 \r
846 // This callback will execute in the scope of the\r
847 // button instance. Clicking the button alerts\r
848 // "Hi, Fred. You clicked the "Say Hi" button."\r
849 btn.on('click', sayHi.createDelegate(btn, ['Fred']));\r
850 </code></pre>\r
851      * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.\r
852      * <b>If omitted, defaults to the browser window.</b>\r
853      * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)\r
854      * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,\r
855      * if a number the args are inserted at the specified position\r
856      * @return {Function} The new function\r
857      */\r
858     createDelegate : function(obj, args, appendArgs){\r
859         var method = this;\r
860         return function() {\r
861             var callArgs = args || arguments;\r
862             if (appendArgs === true){\r
863                 callArgs = Array.prototype.slice.call(arguments, 0);\r
864                 callArgs = callArgs.concat(args);\r
865             }else if (Ext.isNumber(appendArgs)){\r
866                 callArgs = Array.prototype.slice.call(arguments, 0); // copy arguments first\r
867                 var applyArgs = [appendArgs, 0].concat(args); // create method call params\r
868                 Array.prototype.splice.apply(callArgs, applyArgs); // splice them in\r
869             }\r
870             return method.apply(obj || window, callArgs);\r
871         };\r
872     },\r
873 \r
874     /**\r
875      * Calls this function after the number of millseconds specified, optionally in a specific scope. Example usage:\r
876      * <pre><code>\r
877 var sayHi = function(name){\r
878     alert('Hi, ' + name);\r
879 }\r
880 \r
881 // executes immediately:\r
882 sayHi('Fred');\r
883 \r
884 // executes after 2 seconds:\r
885 sayHi.defer(2000, this, ['Fred']);\r
886 \r
887 // this syntax is sometimes useful for deferring\r
888 // execution of an anonymous function:\r
889 (function(){\r
890     alert('Anonymous');\r
891 }).defer(100);\r
892 </code></pre>\r
893      * @param {Number} millis The number of milliseconds for the setTimeout call (if less than or equal to 0 the function is executed immediately)\r
894      * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the function is executed.\r
895      * <b>If omitted, defaults to the browser window.</b>\r
896      * @param {Array} args (optional) Overrides arguments for the call. (Defaults to the arguments passed by the caller)\r
897      * @param {Boolean/Number} appendArgs (optional) if True args are appended to call args instead of overriding,\r
898      * if a number the args are inserted at the specified position\r
899      * @return {Number} The timeout id that can be used with clearTimeout\r
900      */\r
901     defer : function(millis, obj, args, appendArgs){\r
902         var fn = this.createDelegate(obj, args, appendArgs);\r
903         if(millis > 0){\r
904             return setTimeout(fn, millis);\r
905         }\r
906         fn();\r
907         return 0;\r
908     }\r
909 });\r
910 \r
911 /**\r
912  * @class String\r
913  * These functions are available on every String object.\r
914  */\r
915 Ext.applyIf(String, {\r
916     /**\r
917      * Allows you to define a tokenized string and pass an arbitrary number of arguments to replace the tokens.  Each\r
918      * token must be unique, and must increment in the format {0}, {1}, etc.  Example usage:\r
919      * <pre><code>\r
920 var cls = 'my-class', text = 'Some text';\r
921 var s = String.format('&lt;div class="{0}">{1}&lt;/div>', cls, text);\r
922 // s now contains the string: '&lt;div class="my-class">Some text&lt;/div>'\r
923      * </code></pre>\r
924      * @param {String} string The tokenized string to be formatted\r
925      * @param {String} value1 The value to replace token {0}\r
926      * @param {String} value2 Etc...\r
927      * @return {String} The formatted string\r
928      * @static\r
929      */\r
930     format : function(format){\r
931         var args = Ext.toArray(arguments, 1);\r
932         return format.replace(/\{(\d+)\}/g, function(m, i){\r
933             return args[i];\r
934         });\r
935     }\r
936 });\r
937 \r
938 /**\r
939  * @class Array\r
940  */\r
941 Ext.applyIf(Array.prototype, {\r
942     /**\r
943      * Checks whether or not the specified object exists in the array.\r
944      * @param {Object} o The object to check for\r
945      * @param {Number} from (Optional) The index at which to begin the search\r
946      * @return {Number} The index of o in the array (or -1 if it is not found)\r
947      */\r
948     indexOf : function(o, from){\r
949         var len = this.length;\r
950         from = from || 0;\r
951         from += (from < 0) ? len : 0;\r
952         for (; from < len; ++from){\r
953             if(this[from] === o){\r
954                 return from;\r
955             }\r
956         }\r
957         return -1;\r
958     },\r
959 \r
960     /**\r
961      * Removes the specified object from the array.  If the object is not found nothing happens.\r
962      * @param {Object} o The object to remove\r
963      * @return {Array} this array\r
964      */\r
965     remove : function(o){\r
966         var index = this.indexOf(o);\r
967         if(index != -1){\r
968             this.splice(index, 1);\r
969         }\r
970         return this;\r
971     }\r
972 });\r
973 /**
974  * @class Ext
975  */
976
977 Ext.ns("Ext.grid", "Ext.dd", "Ext.tree", "Ext.form", "Ext.menu",
978        "Ext.state", "Ext.layout", "Ext.app", "Ext.ux", "Ext.chart", "Ext.direct");
979     /**
980      * Namespace alloted for extensions to the framework.
981      * @property ux
982      * @type Object
983      */
984
985 Ext.apply(Ext, function(){
986     var E = Ext, 
987         idSeed = 0,
988         scrollWidth = null;
989
990     return {
991         /**
992         * A reusable empty function
993         * @property
994         * @type Function
995         */
996         emptyFn : function(){},
997
998         /**
999          * URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images. 
1000          * In older versions of IE, this defaults to "http://extjs.com/s.gif" and you should change this to a URL on your server.
1001          * For other browsers it uses an inline data URL.
1002          * @type String
1003          */
1004         BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
1005                             'http:/' + '/extjs.com/s.gif' :
1006                             'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',
1007
1008         extendX : function(supr, fn){
1009             return Ext.extend(supr, fn(supr.prototype));
1010         },
1011
1012         /**
1013          * Returns the current HTML document object as an {@link Ext.Element}.
1014          * @return Ext.Element The document
1015          */
1016         getDoc : function(){
1017             return Ext.get(document);
1018         },
1019
1020         /**
1021          * Utility method for validating that a value is numeric, returning the specified default value if it is not.
1022          * @param {Mixed} value Should be a number, but any type will be handled appropriately
1023          * @param {Number} defaultValue The value to return if the original value is non-numeric
1024          * @return {Number} Value, if numeric, else defaultValue
1025          */
1026         num : function(v, defaultValue){
1027             v = Number(Ext.isEmpty(v) || Ext.isBoolean(v) ? NaN : v);
1028             return isNaN(v)? defaultValue : v;
1029         },
1030
1031         /**
1032          * <p>Utility method for returning a default value if the passed value is empty.</p>
1033          * <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
1034          * <li>null</li>
1035          * <li>undefined</li>
1036          * <li>an empty array</li>
1037          * <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
1038          * </ul></div>
1039          * @param {Mixed} value The value to test
1040          * @param {Mixed} defaultValue The value to return if the original value is empty
1041          * @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false)
1042          * @return {Mixed} value, if non-empty, else defaultValue
1043          */
1044         value : function(v, defaultValue, allowBlank){
1045             return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
1046         },
1047
1048         /**
1049          * Escapes the passed string for use in a regular expression
1050          * @param {String} str
1051          * @return {String}
1052          */
1053         escapeRe : function(s) {
1054             return s.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1");
1055         },
1056
1057         sequence : function(o, name, fn, scope){
1058             o[name] = o[name].createSequence(fn, scope);
1059         },
1060
1061         /**
1062          * Applies event listeners to elements by selectors when the document is ready.
1063          * The event name is specified with an <tt>&#64;</tt> suffix.
1064          * <pre><code>
1065 Ext.addBehaviors({
1066     // add a listener for click on all anchors in element with id foo
1067     '#foo a&#64;click' : function(e, t){
1068         // do something
1069     },
1070     
1071     // add the same listener to multiple selectors (separated by comma BEFORE the &#64;)
1072     '#foo a, #bar span.some-class&#64;mouseover' : function(){
1073         // do something
1074     }
1075 });
1076          * </code></pre> 
1077          * @param {Object} obj The list of behaviors to apply
1078          */
1079         addBehaviors : function(o){
1080             if(!Ext.isReady){
1081                 Ext.onReady(function(){
1082                     Ext.addBehaviors(o);
1083                 });
1084             } else {
1085                 var cache = {}, // simple cache for applying multiple behaviors to same selector does query multiple times
1086                     parts,
1087                     b,
1088                     s;
1089                 for (b in o) {
1090                     if ((parts = b.split('@'))[1]) { // for Object prototype breakers
1091                         s = parts[0];
1092                         if(!cache[s]){
1093                             cache[s] = Ext.select(s);
1094                         }
1095                         cache[s].on(parts[1], o[b]);
1096                     }
1097                 }
1098                 cache = null;
1099             }
1100         },
1101         
1102         /**
1103          * Utility method for getting the width of the browser scrollbar. This can differ depending on
1104          * operating system settings, such as the theme or font size.
1105          * @param {Boolean} force (optional) true to force a recalculation of the value.
1106          * @return {Number} The width of the scrollbar.
1107          */
1108         getScrollBarWidth: function(force){
1109             if(!Ext.isReady){
1110                 return 0;
1111             }
1112             
1113             if(force === true || scrollWidth === null){
1114                     // Append our div, do our calculation and then remove it
1115                 var div = Ext.getBody().createChild('<div class="x-hide-offsets" style="width:100px;height:50px;overflow:hidden;"><div style="height:200px;"></div></div>'),
1116                     child = div.child('div', true);
1117                 var w1 = child.offsetWidth;
1118                 div.setStyle('overflow', (Ext.isWebKit || Ext.isGecko) ? 'auto' : 'scroll');
1119                 var w2 = child.offsetWidth;
1120                 div.remove();
1121                 // Need to add 2 to ensure we leave enough space
1122                 scrollWidth = w1 - w2 + 2;
1123             }
1124             return scrollWidth;
1125         },
1126
1127
1128         // deprecated
1129         combine : function(){
1130             var as = arguments, l = as.length, r = [];
1131             for(var i = 0; i < l; i++){
1132                 var a = as[i];
1133                 if(Ext.isArray(a)){
1134                     r = r.concat(a);
1135                 }else if(a.length !== undefined && !a.substr){
1136                     r = r.concat(Array.prototype.slice.call(a, 0));
1137                 }else{
1138                     r.push(a);
1139                 }
1140             }
1141             return r;
1142         },
1143
1144         /**
1145          * Copies a set of named properties fom the source object to the destination object.
1146          * <p>example:<pre><code>
1147 ImageComponent = Ext.extend(Ext.BoxComponent, {
1148     initComponent: function() {
1149         this.autoEl = { tag: 'img' };
1150         MyComponent.superclass.initComponent.apply(this, arguments);
1151         this.initialBox = Ext.copyTo({}, this.initialConfig, 'x,y,width,height');
1152     }
1153 });
1154          * </code></pre> 
1155          * @param {Object} The destination object.
1156          * @param {Object} The source object.
1157          * @param {Array/String} Either an Array of property names, or a comma-delimited list
1158          * of property names to copy.
1159          * @return {Object} The modified object.
1160         */
1161         copyTo : function(dest, source, names){
1162             if(Ext.isString(names)){
1163                 names = names.split(/[,;\s]/);
1164             }
1165             Ext.each(names, function(name){
1166                 if(source.hasOwnProperty(name)){
1167                     dest[name] = source[name];
1168                 }
1169             }, this);
1170             return dest;
1171         },
1172
1173         /**
1174          * Attempts to destroy any objects passed to it by removing all event listeners, removing them from the
1175          * DOM (if applicable) and calling their destroy functions (if available).  This method is primarily
1176          * intended for arguments of type {@link Ext.Element} and {@link Ext.Component}, but any subclass of
1177          * {@link Ext.util.Observable} can be passed in.  Any number of elements and/or components can be
1178          * passed into this function in a single call as separate arguments.
1179          * @param {Mixed} arg1 An {@link Ext.Element}, {@link Ext.Component}, or an Array of either of these to destroy
1180          * @param {Mixed} arg2 (optional)
1181          * @param {Mixed} etc... (optional)
1182          */
1183         destroy : function(){
1184             Ext.each(arguments, function(arg){
1185                 if(arg){
1186                     if(Ext.isArray(arg)){
1187                         this.destroy.apply(this, arg);
1188                     }else if(Ext.isFunction(arg.destroy)){
1189                         arg.destroy();
1190                     }else if(arg.dom){
1191                         arg.remove();
1192                     }    
1193                 }
1194             }, this);
1195         },
1196
1197         /**
1198          * Attempts to destroy and then remove a set of named properties of the passed object.
1199          * @param {Object} o The object (most likely a Component) who's properties you wish to destroy.
1200          * @param {Mixed} arg1 The name of the property to destroy and remove from the object.
1201          * @param {Mixed} etc... More property names to destroy and remove.
1202          */
1203         destroyMembers : function(o, arg1, arg2, etc){
1204             for(var i = 1, a = arguments, len = a.length; i < len; i++) {
1205                 Ext.destroy(o[a[i]]);
1206                 delete o[a[i]];
1207             }
1208         },
1209
1210         /**
1211          * Creates a copy of the passed Array with falsy values removed.
1212          * @param {Array/NodeList} arr The Array from which to remove falsy values.
1213          * @return {Array} The new, compressed Array.
1214          */
1215         clean : function(arr){
1216             var ret = [];
1217             Ext.each(arr, function(v){
1218                 if(!!v){
1219                     ret.push(v);
1220                 }
1221             });
1222             return ret;
1223         },
1224
1225         /**
1226          * Creates a copy of the passed Array, filtered to contain only unique values.
1227          * @param {Array} arr The Array to filter
1228          * @return {Array} The new Array containing unique values.
1229          */
1230         unique : function(arr){
1231             var ret = [],
1232                 collect = {};
1233
1234             Ext.each(arr, function(v) {
1235                 if(!collect[v]){
1236                     ret.push(v);
1237                 }
1238                 collect[v] = true;
1239             });
1240             return ret;
1241         },
1242
1243         /**
1244          * Recursively flattens into 1-d Array. Injects Arrays inline.
1245          * @param {Array} arr The array to flatten
1246          * @return {Array} The new, flattened array.
1247          */
1248         flatten : function(arr){
1249             var worker = [];
1250             function rFlatten(a) {
1251                 Ext.each(a, function(v) {
1252                     if(Ext.isArray(v)){
1253                         rFlatten(v);
1254                     }else{
1255                         worker.push(v);
1256                     }
1257                 });
1258                 return worker;
1259             }
1260             return rFlatten(arr);
1261         },
1262
1263         /**
1264          * Returns the minimum value in the Array.
1265          * @param {Array|NodeList} arr The Array from which to select the minimum value.
1266          * @param {Function} comp (optional) a function to perform the comparision which determines minimization.
1267          *                   If omitted the "<" operator will be used. Note: gt = 1; eq = 0; lt = -1
1268          * @return {Object} The minimum value in the Array.
1269          */
1270         min : function(arr, comp){
1271             var ret = arr[0];
1272             comp = comp || function(a,b){ return a < b ? -1 : 1; };
1273             Ext.each(arr, function(v) {
1274                 ret = comp(ret, v) == -1 ? ret : v;
1275             });
1276             return ret;
1277         },
1278
1279         /**
1280          * Returns the maximum value in the Array
1281          * @param {Array|NodeList} arr The Array from which to select the maximum value.
1282          * @param {Function} comp (optional) a function to perform the comparision which determines maximization.
1283          *                   If omitted the ">" operator will be used. Note: gt = 1; eq = 0; lt = -1
1284          * @return {Object} The maximum value in the Array.
1285          */
1286         max : function(arr, comp){
1287             var ret = arr[0];
1288             comp = comp || function(a,b){ return a > b ? 1 : -1; };
1289             Ext.each(arr, function(v) {
1290                 ret = comp(ret, v) == 1 ? ret : v;
1291             });
1292             return ret;
1293         },
1294
1295         /**
1296          * Calculates the mean of the Array
1297          * @param {Array} arr The Array to calculate the mean value of.
1298          * @return {Number} The mean.
1299          */
1300         mean : function(arr){
1301            return Ext.sum(arr) / arr.length;
1302         },
1303
1304         /**
1305          * Calculates the sum of the Array
1306          * @param {Array} arr The Array to calculate the sum value of.
1307          * @return {Number} The sum.
1308          */
1309         sum : function(arr){
1310            var ret = 0;
1311            Ext.each(arr, function(v) {
1312                ret += v;
1313            });
1314            return ret;
1315         },
1316
1317         /**
1318          * Partitions the set into two sets: a true set and a false set.
1319          * Example: 
1320          * Example2: 
1321          * <pre><code>
1322 // Example 1:
1323 Ext.partition([true, false, true, true, false]); // [[true, true, true], [false, false]]
1324
1325 // Example 2:
1326 Ext.partition(
1327     Ext.query("p"),
1328     function(val){
1329         return val.className == "class1"
1330     }
1331 );
1332 // true are those paragraph elements with a className of "class1",
1333 // false set are those that do not have that className.
1334          * </code></pre>
1335          * @param {Array|NodeList} arr The array to partition
1336          * @param {Function} truth (optional) a function to determine truth.  If this is omitted the element
1337          *                   itself must be able to be evaluated for its truthfulness.
1338          * @return {Array} [true<Array>,false<Array>]
1339          */
1340         partition : function(arr, truth){
1341             var ret = [[],[]];
1342             Ext.each(arr, function(v, i, a) {
1343                 ret[ (truth && truth(v, i, a)) || (!truth && v) ? 0 : 1].push(v);
1344             });
1345             return ret;
1346         },
1347
1348         /**
1349          * Invokes a method on each item in an Array.
1350          * <pre><code>
1351 // Example:
1352 Ext.invoke(Ext.query("p"), "getAttribute", "id");
1353 // [el1.getAttribute("id"), el2.getAttribute("id"), ..., elN.getAttribute("id")]
1354          * </code></pre>
1355          * @param {Array|NodeList} arr The Array of items to invoke the method on.
1356          * @param {String} methodName The method name to invoke.
1357          * @param {Anything} ... Arguments to send into the method invocation.
1358          * @return {Array} The results of invoking the method on each item in the array.
1359          */
1360         invoke : function(arr, methodName){
1361             var ret = [],
1362                 args = Array.prototype.slice.call(arguments, 2);
1363             Ext.each(arr, function(v,i) {
1364                 if (v && Ext.isFunction(v[methodName])) {
1365                     ret.push(v[methodName].apply(v, args));
1366                 } else {
1367                     ret.push(undefined);
1368                 }
1369             });
1370             return ret;
1371         },
1372
1373         /**
1374          * Plucks the value of a property from each item in the Array
1375          * <pre><code>
1376 // Example:
1377 Ext.pluck(Ext.query("p"), "className"); // [el1.className, el2.className, ..., elN.className]
1378          * </code></pre>
1379          * @param {Array|NodeList} arr The Array of items to pluck the value from.
1380          * @param {String} prop The property name to pluck from each element.
1381          * @return {Array} The value from each item in the Array.
1382          */
1383         pluck : function(arr, prop){
1384             var ret = [];
1385             Ext.each(arr, function(v) {
1386                 ret.push( v[prop] );
1387             });
1388             return ret;
1389         },
1390
1391         /**
1392          * <p>Zips N sets together.</p>
1393          * <pre><code>
1394 // Example 1:
1395 Ext.zip([1,2,3],[4,5,6]); // [[1,4],[2,5],[3,6]]
1396 // Example 2:
1397 Ext.zip(
1398     [ "+", "-", "+"],
1399     [  12,  10,  22],
1400     [  43,  15,  96],
1401     function(a, b, c){
1402         return "$" + a + "" + b + "." + c
1403     }
1404 ); // ["$+12.43", "$-10.15", "$+22.96"]
1405          * </code></pre>
1406          * @param {Arrays|NodeLists} arr This argument may be repeated. Array(s) to contribute values.
1407          * @param {Function} zipper (optional) The last item in the argument list. This will drive how the items are zipped together.
1408          * @return {Array} The zipped set.
1409          */
1410         zip : function(){
1411             var parts = Ext.partition(arguments, function( val ){ return !Ext.isFunction(val); }),
1412                 arrs = parts[0],
1413                 fn = parts[1][0],
1414                 len = Ext.max(Ext.pluck(arrs, "length")),
1415                 ret = [];
1416
1417             for (var i = 0; i < len; i++) {
1418                 ret[i] = [];
1419                 if(fn){
1420                     ret[i] = fn.apply(fn, Ext.pluck(arrs, i));
1421                 }else{
1422                     for (var j = 0, aLen = arrs.length; j < aLen; j++){
1423                         ret[i].push( arrs[j][i] );
1424                     }
1425                 }
1426             }
1427             return ret;
1428         },
1429
1430         /**
1431          * This is shorthand reference to {@link Ext.ComponentMgr#get}.
1432          * Looks up an existing {@link Ext.Component Component} by {@link Ext.Component#id id}
1433          * @param {String} id The component {@link Ext.Component#id id}
1434          * @return Ext.Component The Component, <tt>undefined</tt> if not found, or <tt>null</tt> if a
1435          * Class was found.
1436         */
1437         getCmp : function(id){
1438             return Ext.ComponentMgr.get(id);
1439         },
1440
1441         /**
1442          * By default, Ext intelligently decides whether floating elements should be shimmed. If you are using flash,
1443          * you may want to set this to true.
1444          * @type Boolean
1445          */
1446         useShims: E.isIE6 || (E.isMac && E.isGecko2),
1447
1448         // inpired by a similar function in mootools library
1449         /**
1450          * Returns the type of object that is passed in. If the object passed in is null or undefined it
1451          * return false otherwise it returns one of the following values:<div class="mdetail-params"><ul>
1452          * <li><b>string</b>: If the object passed is a string</li>
1453          * <li><b>number</b>: If the object passed is a number</li>
1454          * <li><b>boolean</b>: If the object passed is a boolean value</li>
1455          * <li><b>date</b>: If the object passed is a Date object</li>
1456          * <li><b>function</b>: If the object passed is a function reference</li>
1457          * <li><b>object</b>: If the object passed is an object</li>
1458          * <li><b>array</b>: If the object passed is an array</li>
1459          * <li><b>regexp</b>: If the object passed is a regular expression</li>
1460          * <li><b>element</b>: If the object passed is a DOM Element</li>
1461          * <li><b>nodelist</b>: If the object passed is a DOM NodeList</li>
1462          * <li><b>textnode</b>: If the object passed is a DOM text node and contains something other than whitespace</li>
1463          * <li><b>whitespace</b>: If the object passed is a DOM text node and contains only whitespace</li>
1464          * </ul></div>
1465          * @param {Mixed} object
1466          * @return {String}
1467          */
1468         type : function(o){
1469             if(o === undefined || o === null){
1470                 return false;
1471             }
1472             if(o.htmlElement){
1473                 return 'element';
1474             }
1475             var t = typeof o;
1476             if(t == 'object' && o.nodeName) {
1477                 switch(o.nodeType) {
1478                     case 1: return 'element';
1479                     case 3: return (/\S/).test(o.nodeValue) ? 'textnode' : 'whitespace';
1480                 }
1481             }
1482             if(t == 'object' || t == 'function') {
1483                 switch(o.constructor) {
1484                     case Array: return 'array';
1485                     case RegExp: return 'regexp';
1486                     case Date: return 'date';
1487                 }
1488                 if(Ext.isNumber(o.length) && Ext.isFunction(o.item)) {
1489                     return 'nodelist';
1490                 }
1491             }
1492             return t;
1493         },
1494
1495         intercept : function(o, name, fn, scope){
1496             o[name] = o[name].createInterceptor(fn, scope);
1497         },
1498
1499         // internal
1500         callback : function(cb, scope, args, delay){
1501             if(Ext.isFunction(cb)){
1502                 if(delay){
1503                     cb.defer(delay, scope, args || []);
1504                 }else{
1505                     cb.apply(scope, args || []);
1506                 }
1507             }
1508         }
1509     };
1510 }());
1511
1512 /**
1513  * @class Function
1514  * These functions are available on every Function object (any JavaScript function).
1515  */
1516 Ext.apply(Function.prototype, {
1517     /**
1518      * Create a combined function call sequence of the original function + the passed function.
1519      * The resulting function returns the results of the original function.
1520      * The passed fcn is called with the parameters of the original function. Example usage:
1521      * <pre><code>
1522 var sayHi = function(name){
1523     alert('Hi, ' + name);
1524 }
1525
1526 sayHi('Fred'); // alerts "Hi, Fred"
1527
1528 var sayGoodbye = sayHi.createSequence(function(name){
1529     alert('Bye, ' + name);
1530 });
1531
1532 sayGoodbye('Fred'); // both alerts show
1533 </code></pre>
1534      * @param {Function} fcn The function to sequence
1535      * @param {Object} scope (optional) The scope (<code><b>this</b></code> reference) in which the passed function is executed.
1536      * <b>If omitted, defaults to the scope in which the original function is called or the browser window.</b>
1537      * @return {Function} The new function
1538      */
1539     createSequence : function(fcn, scope){
1540         var method = this;
1541         return !Ext.isFunction(fcn) ?
1542                 this :
1543                 function(){
1544                     var retval = method.apply(this || window, arguments);
1545                     fcn.apply(scope || this || window, arguments);
1546                     return retval;
1547                 };
1548     }
1549 });
1550
1551
1552 /**
1553  * @class String
1554  * These functions are available as static methods on the JavaScript String object.
1555  */
1556 Ext.applyIf(String, {
1557
1558     /**
1559      * Escapes the passed string for ' and \
1560      * @param {String} string The string to escape
1561      * @return {String} The escaped string
1562      * @static
1563      */
1564     escape : function(string) {
1565         return string.replace(/('|\\)/g, "\\$1");
1566     },
1567
1568     /**
1569      * Pads the left side of a string with a specified character.  This is especially useful
1570      * for normalizing number and date strings.  Example usage:
1571      * <pre><code>
1572 var s = String.leftPad('123', 5, '0');
1573 // s now contains the string: '00123'
1574      * </code></pre>
1575      * @param {String} string The original string
1576      * @param {Number} size The total length of the output string
1577      * @param {String} char (optional) The character with which to pad the original string (defaults to empty string " ")
1578      * @return {String} The padded string
1579      * @static
1580      */
1581     leftPad : function (val, size, ch) {
1582         var result = String(val);
1583         if(!ch) {
1584             ch = " ";
1585         }
1586         while (result.length < size) {
1587             result = ch + result;
1588         }
1589         return result;
1590     }
1591 });
1592
1593 /**
1594  * Utility function that allows you to easily switch a string between two alternating values.  The passed value
1595  * is compared to the current string, and if they are equal, the other value that was passed in is returned.  If
1596  * they are already different, the first value passed in is returned.  Note that this method returns the new value
1597  * but does not change the current string.
1598  * <pre><code>
1599 // alternate sort directions
1600 sort = sort.toggle('ASC', 'DESC');
1601
1602 // instead of conditional logic:
1603 sort = (sort == 'ASC' ? 'DESC' : 'ASC');
1604 </code></pre>
1605  * @param {String} value The value to compare to the current string
1606  * @param {String} other The new value to use if the string already equals the first value passed in
1607  * @return {String} The new value
1608  */
1609 String.prototype.toggle = function(value, other){
1610     return this == value ? other : value;
1611 };
1612
1613 /**
1614  * Trims whitespace from either end of a string, leaving spaces within the string intact.  Example:
1615  * <pre><code>
1616 var s = '  foo bar  ';
1617 alert('-' + s + '-');         //alerts "- foo bar -"
1618 alert('-' + s.trim() + '-');  //alerts "-foo bar-"
1619 </code></pre>
1620  * @return {String} The trimmed string
1621  */
1622 String.prototype.trim = function(){
1623     var re = /^\s+|\s+$/g;
1624     return function(){ return this.replace(re, ""); };
1625 }();
1626
1627 // here to prevent dependency on Date.js
1628 /**
1629  Returns the number of milliseconds between this date and date
1630  @param {Date} date (optional) Defaults to now
1631  @return {Number} The diff in milliseconds
1632  @member Date getElapsed
1633  */
1634 Date.prototype.getElapsed = function(date) {
1635     return Math.abs((date || new Date()).getTime()-this.getTime());
1636 };
1637
1638
1639 /**
1640  * @class Number
1641  */
1642 Ext.applyIf(Number.prototype, {
1643     /**
1644      * Checks whether or not the current number is within a desired range.  If the number is already within the
1645      * range it is returned, otherwise the min or max value is returned depending on which side of the range is
1646      * exceeded.  Note that this method returns the constrained value but does not change the current number.
1647      * @param {Number} min The minimum number in the range
1648      * @param {Number} max The maximum number in the range
1649      * @return {Number} The constrained value if outside the range, otherwise the current value
1650      */
1651     constrain : function(min, max){
1652         return Math.min(Math.max(this, min), max);
1653     }
1654 });
1655 /**
1656  * @class Ext.util.TaskRunner
1657  * Provides the ability to execute one or more arbitrary tasks in a multithreaded
1658  * manner.  Generally, you can use the singleton {@link Ext.TaskMgr} instead, but
1659  * if needed, you can create separate instances of TaskRunner.  Any number of
1660  * separate tasks can be started at any time and will run independently of each
1661  * other. Example usage:
1662  * <pre><code>
1663 // Start a simple clock task that updates a div once per second
1664 var updateClock = function(){
1665     Ext.fly('clock').update(new Date().format('g:i:s A'));
1666
1667 var task = {
1668     run: updateClock,
1669     interval: 1000 //1 second
1670 }
1671 var runner = new Ext.util.TaskRunner();
1672 runner.start(task);
1673
1674 // equivalent using TaskMgr
1675 Ext.TaskMgr.start({
1676     run: updateClock,
1677     interval: 1000
1678 });
1679
1680  * </code></pre>
1681  * Also see {@link Ext.util.DelayedTask}. 
1682  * 
1683  * @constructor
1684  * @param {Number} interval (optional) The minimum precision in milliseconds supported by this TaskRunner instance
1685  * (defaults to 10)
1686  */
1687 Ext.util.TaskRunner = function(interval){
1688     interval = interval || 10;
1689     var tasks = [], 
1690         removeQueue = [],
1691         id = 0,
1692         running = false,
1693
1694         // private
1695         stopThread = function(){
1696                 running = false;
1697                 clearInterval(id);
1698                 id = 0;
1699             },
1700
1701         // private
1702         startThread = function(){
1703                 if(!running){
1704                     running = true;
1705                     id = setInterval(runTasks, interval);
1706                 }
1707             },
1708
1709         // private
1710         removeTask = function(t){
1711                 removeQueue.push(t);
1712                 if(t.onStop){
1713                     t.onStop.apply(t.scope || t);
1714                 }
1715             },
1716             
1717         // private
1718         runTasks = function(){
1719                 var rqLen = removeQueue.length,
1720                         now = new Date().getTime();                                             
1721             
1722                 if(rqLen > 0){
1723                     for(var i = 0; i < rqLen; i++){
1724                         tasks.remove(removeQueue[i]);
1725                     }
1726                     removeQueue = [];
1727                     if(tasks.length < 1){
1728                         stopThread();
1729                         return;
1730                     }
1731                 }               
1732                 for(var i = 0, t, itime, rt, len = tasks.length; i < len; ++i){
1733                     t = tasks[i];
1734                     itime = now - t.taskRunTime;
1735                     if(t.interval <= itime){
1736                         rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
1737                         t.taskRunTime = now;
1738                         if(rt === false || t.taskRunCount === t.repeat){
1739                             removeTask(t);
1740                             return;
1741                         }
1742                     }
1743                     if(t.duration && t.duration <= (now - t.taskStartTime)){
1744                         removeTask(t);
1745                     }
1746                 }
1747             };
1748
1749     /**
1750      * Starts a new task.
1751      * @method start
1752      * @param {Object} task A config object that supports the following properties:<ul>
1753      * <li><code>run</code> : Function<div class="sub-desc">The function to execute each time the task is run. The
1754      * function will be called at each interval and passed the <code>args</code> argument if specified.  If a
1755      * particular scope is required, be sure to specify it using the <code>scope</code> argument.</div></li>
1756      * <li><code>interval</code> : Number<div class="sub-desc">The frequency in milliseconds with which the task
1757      * should be executed.</div></li>
1758      * <li><code>args</code> : Array<div class="sub-desc">(optional) An array of arguments to be passed to the function
1759      * specified by <code>run</code>.</div></li>
1760      * <li><code>scope</code> : Object<div class="sub-desc">(optional) The scope (<tt>this</tt> reference) in which to execute the
1761      * <code>run</code> function. Defaults to the task config object.</div></li>
1762      * <li><code>duration</code> : Number<div class="sub-desc">(optional) The length of time in milliseconds to execute
1763      * the task before stopping automatically (defaults to indefinite).</div></li>
1764      * <li><code>repeat</code> : Number<div class="sub-desc">(optional) The number of times to execute the task before
1765      * stopping automatically (defaults to indefinite).</div></li>
1766      * </ul>
1767      * @return {Object} The task
1768      */
1769     this.start = function(task){
1770         tasks.push(task);
1771         task.taskStartTime = new Date().getTime();
1772         task.taskRunTime = 0;
1773         task.taskRunCount = 0;
1774         startThread();
1775         return task;
1776     };
1777
1778     /**
1779      * Stops an existing running task.
1780      * @method stop
1781      * @param {Object} task The task to stop
1782      * @return {Object} The task
1783      */
1784     this.stop = function(task){
1785         removeTask(task);
1786         return task;
1787     };
1788
1789     /**
1790      * Stops all tasks that are currently running.
1791      * @method stopAll
1792      */
1793     this.stopAll = function(){
1794         stopThread();
1795         for(var i = 0, len = tasks.length; i < len; i++){
1796             if(tasks[i].onStop){
1797                 tasks[i].onStop();
1798             }
1799         }
1800         tasks = [];
1801         removeQueue = [];
1802     };
1803 };
1804
1805 /**
1806  * @class Ext.TaskMgr
1807  * @extends Ext.util.TaskRunner
1808  * A static {@link Ext.util.TaskRunner} instance that can be used to start and stop arbitrary tasks.  See
1809  * {@link Ext.util.TaskRunner} for supported methods and task config properties.
1810  * <pre><code>
1811 // Start a simple clock task that updates a div once per second
1812 var task = {
1813     run: function(){
1814         Ext.fly('clock').update(new Date().format('g:i:s A'));
1815     },
1816     interval: 1000 //1 second
1817 }
1818 Ext.TaskMgr.start(task);
1819 </code></pre>
1820  * @singleton
1821  */
1822 Ext.TaskMgr = new Ext.util.TaskRunner();(function(){\r
1823         var libFlyweight;\r
1824         \r
1825         function fly(el) {\r
1826         if (!libFlyweight) {\r
1827             libFlyweight = new Ext.Element.Flyweight();\r
1828         }\r
1829         libFlyweight.dom = el;\r
1830         return libFlyweight;\r
1831     }\r
1832     \r
1833     (function(){\r
1834         var doc = document,\r
1835                 isCSS1 = doc.compatMode == "CSS1Compat",\r
1836                 MAX = Math.max,         \r
1837         ROUND = Math.round,\r
1838                 PARSEINT = parseInt;\r
1839                 \r
1840         Ext.lib.Dom = {\r
1841             isAncestor : function(p, c) {\r
1842                     var ret = false;\r
1843                         \r
1844                         p = Ext.getDom(p);\r
1845                         c = Ext.getDom(c);\r
1846                         if (p && c) {\r
1847                                 if (p.contains) {\r
1848                                         return p.contains(c);\r
1849                                 } else if (p.compareDocumentPosition) {\r
1850                                         return !!(p.compareDocumentPosition(c) & 16);\r
1851                                 } else {\r
1852                                         while (c = c.parentNode) {\r
1853                                                 ret = c == p || ret;                                    \r
1854                                         }\r
1855                                 }                   \r
1856                         }       \r
1857                         return ret;\r
1858                 },\r
1859                 \r
1860         getViewWidth : function(full) {\r
1861             return full ? this.getDocumentWidth() : this.getViewportWidth();\r
1862         },\r
1863 \r
1864         getViewHeight : function(full) {\r
1865             return full ? this.getDocumentHeight() : this.getViewportHeight();\r
1866         },\r
1867 \r
1868         getDocumentHeight: function() {            \r
1869             return MAX(!isCSS1 ? doc.body.scrollHeight : doc.documentElement.scrollHeight, this.getViewportHeight());\r
1870         },\r
1871 \r
1872         getDocumentWidth: function() {            \r
1873             return MAX(!isCSS1 ? doc.body.scrollWidth : doc.documentElement.scrollWidth, this.getViewportWidth());\r
1874         },\r
1875 \r
1876         getViewportHeight: function(){\r
1877                 return Ext.isIE ? \r
1878                            (Ext.isStrict ? doc.documentElement.clientHeight : doc.body.clientHeight) :\r
1879                            self.innerHeight;\r
1880         },\r
1881 \r
1882         getViewportWidth : function() {\r
1883                 return !Ext.isStrict && !Ext.isOpera ? doc.body.clientWidth :\r
1884                            Ext.isIE ? doc.documentElement.clientWidth : self.innerWidth;\r
1885         },\r
1886         \r
1887         getY : function(el) {\r
1888             return this.getXY(el)[1];\r
1889         },\r
1890 \r
1891         getX : function(el) {\r
1892             return this.getXY(el)[0];\r
1893         },\r
1894 \r
1895         getXY : function(el) {\r
1896             var p, \r
1897                 pe, \r
1898                 b,\r
1899                 bt, \r
1900                 bl,     \r
1901                 dbd,            \r
1902                 x = 0,\r
1903                 y = 0, \r
1904                 scroll,\r
1905                 hasAbsolute, \r
1906                 bd = (doc.body || doc.documentElement),\r
1907                 ret = [0,0];\r
1908                 \r
1909             el = Ext.getDom(el);\r
1910 \r
1911             if(el != bd){\r
1912                     if (el.getBoundingClientRect) {\r
1913                         b = el.getBoundingClientRect();\r
1914                         scroll = fly(document).getScroll();\r
1915                         ret = [ROUND(b.left + scroll.left), ROUND(b.top + scroll.top)];\r
1916                     } else {  \r
1917                             p = el;             \r
1918                             hasAbsolute = fly(el).isStyle("position", "absolute");\r
1919                 \r
1920                             while (p) {\r
1921                                     pe = fly(p);                \r
1922                                 x += p.offsetLeft;\r
1923                                 y += p.offsetTop;\r
1924                 \r
1925                                 hasAbsolute = hasAbsolute || pe.isStyle("position", "absolute");\r
1926                                                 \r
1927                                 if (Ext.isGecko) {                                  \r
1928                                     y += bt = PARSEINT(pe.getStyle("borderTopWidth"), 10) || 0;\r
1929                                     x += bl = PARSEINT(pe.getStyle("borderLeftWidth"), 10) || 0;        \r
1930                 \r
1931                                     if (p != el && !pe.isStyle('overflow','visible')) {\r
1932                                         x += bl;\r
1933                                         y += bt;\r
1934                                     }\r
1935                                 }\r
1936                                 p = p.offsetParent;\r
1937                             }\r
1938                 \r
1939                             if (Ext.isSafari && hasAbsolute) {\r
1940                                 x -= bd.offsetLeft;\r
1941                                 y -= bd.offsetTop;\r
1942                             }\r
1943                 \r
1944                             if (Ext.isGecko && !hasAbsolute) {\r
1945                                 dbd = fly(bd);\r
1946                                 x += PARSEINT(dbd.getStyle("borderLeftWidth"), 10) || 0;\r
1947                                 y += PARSEINT(dbd.getStyle("borderTopWidth"), 10) || 0;\r
1948                             }\r
1949                 \r
1950                             p = el.parentNode;\r
1951                             while (p && p != bd) {\r
1952                                 if (!Ext.isOpera || (p.tagName != 'TR' && !fly(p).isStyle("display", "inline"))) {\r
1953                                     x -= p.scrollLeft;\r
1954                                     y -= p.scrollTop;\r
1955                                 }\r
1956                                 p = p.parentNode;\r
1957                             }\r
1958                             ret = [x,y];\r
1959                     }\r
1960                 }\r
1961             return ret\r
1962         },\r
1963 \r
1964         setXY : function(el, xy) {\r
1965             (el = Ext.fly(el, '_setXY')).position();\r
1966             \r
1967             var pts = el.translatePoints(xy),\r
1968                 style = el.dom.style,\r
1969                 pos;                    \r
1970             \r
1971             for (pos in pts) {              \r
1972                     if(!isNaN(pts[pos])) style[pos] = pts[pos] + "px"\r
1973             }\r
1974         },\r
1975 \r
1976         setX : function(el, x) {\r
1977             this.setXY(el, [x, false]);\r
1978         },\r
1979 \r
1980         setY : function(el, y) {\r
1981             this.setXY(el, [false, y]);\r
1982         }\r
1983     };\r
1984 })();Ext.lib.Dom.getRegion = function(el) {\r
1985     return Ext.lib.Region.getRegion(el);\r
1986 };Ext.lib.Event = function() {\r
1987     var loadComplete = false,\r
1988         listeners = [],\r
1989         unloadListeners = [],\r
1990         retryCount = 0,\r
1991         onAvailStack = [],\r
1992         _interval,\r
1993         locked = false,\r
1994         win = window,\r
1995         doc = document,\r
1996         \r
1997         // constants            \r
1998         POLL_RETRYS = 200,\r
1999         POLL_INTERVAL = 20,\r
2000         EL = 0,\r
2001         TYPE = 1,\r
2002         FN = 2,\r
2003         WFN = 3,\r
2004         OBJ = 3,\r
2005         ADJ_SCOPE = 4,   \r
2006         SCROLLLEFT = 'scrollLeft',\r
2007         SCROLLTOP = 'scrollTop',\r
2008         UNLOAD = 'unload',\r
2009         MOUSEOVER = 'mouseover',\r
2010         MOUSEOUT = 'mouseout',\r
2011         // private\r
2012         doAdd = function() {\r
2013             var ret;\r
2014             if (win.addEventListener) {\r
2015                 ret = function(el, eventName, fn, capture) {\r
2016                     if (eventName == 'mouseenter') {\r
2017                         fn = fn.createInterceptor(checkRelatedTarget);\r
2018                         el.addEventListener(MOUSEOVER, fn, (capture));\r
2019                     } else if (eventName == 'mouseleave') {\r
2020                         fn = fn.createInterceptor(checkRelatedTarget);\r
2021                         el.addEventListener(MOUSEOUT, fn, (capture));\r
2022                     } else {\r
2023                         el.addEventListener(eventName, fn, (capture));\r
2024                     }\r
2025                     return fn;\r
2026                 };\r
2027             } else if (win.attachEvent) {\r
2028                 ret = function(el, eventName, fn, capture) {\r
2029                     el.attachEvent("on" + eventName, fn);\r
2030                     return fn;\r
2031                 };\r
2032             } else {\r
2033                 ret = function(){};\r
2034             }\r
2035             return ret;\r
2036         }(),    \r
2037         // private\r
2038         doRemove = function(){\r
2039             var ret;\r
2040             if (win.removeEventListener) {\r
2041                 ret = function (el, eventName, fn, capture) {\r
2042                     if (eventName == 'mouseenter') {\r
2043                         eventName = MOUSEOVER;\r
2044                     } else if (eventName == 'mouseleave') {\r
2045                         eventName = MOUSEOUT;\r
2046                     }                        \r
2047                     el.removeEventListener(eventName, fn, (capture));\r
2048                 };\r
2049             } else if (win.detachEvent) {\r
2050                 ret = function (el, eventName, fn) {\r
2051                     el.detachEvent("on" + eventName, fn);\r
2052                 };\r
2053             } else {\r
2054                 ret = function(){};\r
2055             }\r
2056             return ret;\r
2057         }();        \r
2058         \r
2059     function checkRelatedTarget(e) {\r
2060         return !elContains(e.currentTarget, pub.getRelatedTarget(e));\r
2061     }\r
2062 \r
2063     function elContains(parent, child) {\r
2064        if(parent && parent.firstChild){  \r
2065          while(child) {\r
2066             if(child === parent) {\r
2067                 return true;\r
2068             }\r
2069             child = child.parentNode;            \r
2070             if(child && (child.nodeType != 1)) {\r
2071                 child = null;\r
2072             }\r
2073           }\r
2074         }\r
2075         return false;\r
2076     }\r
2077 \r
2078         \r
2079     // private  \r
2080     function _getCacheIndex(el, eventName, fn) {\r
2081         for(var v, index = -1, len = listeners.length, i = len - 1; i >= 0; --i){\r
2082             v = listeners[i];\r
2083             if (v && v[FN] == fn && v[EL] == el && v[TYPE] == eventName) {\r
2084                 index = i;\r
2085                 break;\r
2086             }\r
2087         }\r
2088         return index;\r
2089     }\r
2090                     \r
2091     // private\r
2092     function _tryPreloadAttach() {\r
2093         var ret = false,                \r
2094             notAvail = [],\r
2095             element,\r
2096             tryAgain = !loadComplete || (retryCount > 0);                       \r
2097         \r
2098         if (!locked) {\r
2099             locked = true;\r
2100             \r
2101             Ext.each(onAvailStack, function (v,i,a){\r
2102                 if(v && (element = doc.getElementById(v.id))){\r
2103                     if(!v.checkReady || loadComplete || element.nextSibling || (doc && doc.body)) {\r
2104                         element = v.override ? (v.override === true ? v.obj : v.override) : element;\r
2105                         v.fn.call(element, v.obj);\r
2106                         onAvailStack[i] = null;\r
2107                     } else {\r
2108                         notAvail.push(v);\r
2109                     }\r
2110                 }   \r
2111             });\r
2112 \r
2113             retryCount = (notAvail.length === 0) ? 0 : retryCount - 1;\r
2114 \r
2115             if (tryAgain) { \r
2116                 startInterval();\r
2117             } else {\r
2118                 clearInterval(_interval);\r
2119                 _interval = null;\r
2120             }\r
2121 \r
2122             ret = !(locked = false);\r
2123         }\r
2124         return ret;\r
2125     }\r
2126     \r
2127     // private              \r
2128     function startInterval() {            \r
2129         if(!_interval){                    \r
2130             var callback = function() {\r
2131                 _tryPreloadAttach();\r
2132             };\r
2133             _interval = setInterval(callback, POLL_INTERVAL);\r
2134         }\r
2135     }\r
2136     \r
2137     // private \r
2138     function getScroll() {\r
2139         var dd = doc.documentElement, \r
2140             db = doc.body;\r
2141         if(dd && (dd[SCROLLTOP] || dd[SCROLLLEFT])){\r
2142             return [dd[SCROLLLEFT], dd[SCROLLTOP]];\r
2143         }else if(db){\r
2144             return [db[SCROLLLEFT], db[SCROLLTOP]];\r
2145         }else{\r
2146             return [0, 0];\r
2147         }\r
2148     }\r
2149         \r
2150     // private\r
2151     function getPageCoord (ev, xy) {\r
2152         ev = ev.browserEvent || ev;\r
2153         var coord  = ev['page' + xy];\r
2154         if (!coord && coord !== 0) {\r
2155             coord = ev['client' + xy] || 0;\r
2156 \r
2157             if (Ext.isIE) {\r
2158                 coord += getScroll()[xy == "X" ? 0 : 1];\r
2159             }\r
2160         }\r
2161 \r
2162         return coord;\r
2163     }\r
2164 \r
2165     var pub =  {\r
2166         onAvailable : function(p_id, p_fn, p_obj, p_override) {             \r
2167             onAvailStack.push({ \r
2168                 id:         p_id,\r
2169                 fn:         p_fn,\r
2170                 obj:        p_obj,\r
2171                 override:   p_override,\r
2172                 checkReady: false });\r
2173 \r
2174             retryCount = POLL_RETRYS;\r
2175             startInterval();\r
2176         },\r
2177 \r
2178 \r
2179         addListener: function(el, eventName, fn) {\r
2180             var ret;                \r
2181             el = Ext.getDom(el);                \r
2182             if (el && fn) {\r
2183                 if (UNLOAD == eventName) {\r
2184                     ret = !!(unloadListeners[unloadListeners.length] = [el, eventName, fn]);                    \r
2185                 } else {\r
2186                     listeners.push([el, eventName, fn, ret = doAdd(el, eventName, fn, false)]);\r
2187                 }\r
2188             }\r
2189             return !!ret;\r
2190         },\r
2191 \r
2192         removeListener: function(el, eventName, fn) {\r
2193             var ret = false,\r
2194                 index, \r
2195                 cacheItem;\r
2196 \r
2197             el = Ext.getDom(el);\r
2198 \r
2199             if(!fn) {                   \r
2200                 ret = this.purgeElement(el, false, eventName);\r
2201             } else if (UNLOAD == eventName) {   \r
2202                 Ext.each(unloadListeners, function(v, i, a) {\r
2203                     if( v && v[0] == el && v[1] == eventName && v[2] == fn) {\r
2204                         unloadListeners.splice(i, 1);\r
2205                         ret = true;\r
2206                     }\r
2207                 });\r
2208             } else {    \r
2209                 index = arguments[3] || _getCacheIndex(el, eventName, fn);\r
2210                 cacheItem = listeners[index];\r
2211                 \r
2212                 if (el && cacheItem) {\r
2213                     doRemove(el, eventName, cacheItem[WFN], false);     \r
2214                     cacheItem[WFN] = cacheItem[FN] = null;                       \r
2215                     listeners.splice(index, 1);     \r
2216                     ret = true;\r
2217                 }\r
2218             }\r
2219             return ret;\r
2220         },\r
2221 \r
2222         getTarget : function(ev) {\r
2223             ev = ev.browserEvent || ev;                \r
2224             return this.resolveTextNode(ev.target || ev.srcElement);\r
2225         },\r
2226 \r
2227         resolveTextNode : Ext.isGecko ? function(node){\r
2228             if(!node){\r
2229                 return;\r
2230             }\r
2231             // work around firefox bug, https://bugzilla.mozilla.org/show_bug.cgi?id=101197\r
2232             var s = HTMLElement.prototype.toString.call(node);\r
2233             if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){\r
2234                 return;\r
2235             }\r
2236             return node.nodeType == 3 ? node.parentNode : node;\r
2237         } : function(node){\r
2238             return node && node.nodeType == 3 ? node.parentNode : node;\r
2239         },\r
2240 \r
2241         getRelatedTarget : function(ev) {\r
2242             ev = ev.browserEvent || ev;\r
2243             return this.resolveTextNode(ev.relatedTarget || \r
2244                     (ev.type == MOUSEOUT ? ev.toElement :\r
2245                      ev.type == MOUSEOVER ? ev.fromElement : null));\r
2246         },\r
2247         \r
2248         getPageX : function(ev) {\r
2249             return getPageCoord(ev, "X");\r
2250         },\r
2251 \r
2252         getPageY : function(ev) {\r
2253             return getPageCoord(ev, "Y");\r
2254         },\r
2255 \r
2256 \r
2257         getXY : function(ev) {                             \r
2258             return [this.getPageX(ev), this.getPageY(ev)];\r
2259         },\r
2260 \r
2261 // Is this useful?  Removing to save space unless use case exists.\r
2262 //             getTime: function(ev) {\r
2263 //                 ev = ev.browserEvent || ev;\r
2264 //                 if (!ev.time) {\r
2265 //                     var t = new Date().getTime();\r
2266 //                     try {\r
2267 //                         ev.time = t;\r
2268 //                     } catch(ex) {\r
2269 //                         return t;\r
2270 //                     }\r
2271 //                 }\r
2272 \r
2273 //                 return ev.time;\r
2274 //             },\r
2275 \r
2276         stopEvent : function(ev) {                            \r
2277             this.stopPropagation(ev);\r
2278             this.preventDefault(ev);\r
2279         },\r
2280 \r
2281         stopPropagation : function(ev) {\r
2282             ev = ev.browserEvent || ev;\r
2283             if (ev.stopPropagation) {\r
2284                 ev.stopPropagation();\r
2285             } else {\r
2286                 ev.cancelBubble = true;\r
2287             }\r
2288         },\r
2289 \r
2290         preventDefault : function(ev) {\r
2291             ev = ev.browserEvent || ev;\r
2292             if (ev.preventDefault) {\r
2293                 ev.preventDefault();\r
2294             } else {\r
2295                 ev.returnValue = false;\r
2296             }\r
2297         },\r
2298         \r
2299         getEvent : function(e) {\r
2300             e = e || win.event;\r
2301             if (!e) {\r
2302                 var c = this.getEvent.caller;\r
2303                 while (c) {\r
2304                     e = c.arguments[0];\r
2305                     if (e && Event == e.constructor) {\r
2306                         break;\r
2307                     }\r
2308                     c = c.caller;\r
2309                 }\r
2310             }\r
2311             return e;\r
2312         },\r
2313 \r
2314         getCharCode : function(ev) {\r
2315             ev = ev.browserEvent || ev;\r
2316             return ev.charCode || ev.keyCode || 0;\r
2317         },\r
2318 \r
2319         //clearCache: function() {},\r
2320 \r
2321         _load : function(e) {\r
2322             loadComplete = true;\r
2323             var EU = Ext.lib.Event;    \r
2324             if (Ext.isIE && e !== true) {\r
2325         // IE8 complains that _load is null or not an object\r
2326         // so lets remove self via arguments.callee\r
2327                 doRemove(win, "load", arguments.callee);\r
2328             }\r
2329         },            \r
2330         \r
2331         purgeElement : function(el, recurse, eventName) {\r
2332             var me = this;\r
2333             Ext.each( me.getListeners(el, eventName), function(v){\r
2334                 if(v){\r
2335                     me.removeListener(el, v.type, v.fn, v.index);\r
2336                 }\r
2337             });\r
2338 \r
2339             if (recurse && el && el.childNodes) {\r
2340                 Ext.each(el.childNodes, function(v){\r
2341                     me.purgeElement(v, recurse, eventName);\r
2342                 });\r
2343             }\r
2344         },\r
2345 \r
2346         getListeners : function(el, eventName) {\r
2347             var me = this,\r
2348                 results = [], \r
2349                 searchLists;\r
2350 \r
2351             if (eventName){  \r
2352                 searchLists = eventName == UNLOAD ? unloadListeners : listeners;\r
2353             }else{\r
2354                 searchLists = listeners.concat(unloadListeners);\r
2355             }\r
2356 \r
2357             Ext.each(searchLists, function(v, i){\r
2358                 if (v && v[EL] == el && (!eventName || eventName == v[TYPE])) {\r
2359                     results.push({\r
2360                                 type:   v[TYPE],\r
2361                                 fn:     v[FN],\r
2362                                 obj:    v[OBJ],\r
2363                                 adjust: v[ADJ_SCOPE],\r
2364                                 index:  i\r
2365                             });\r
2366                 }   \r
2367             });                \r
2368 \r
2369             return results.length ? results : null;\r
2370         },\r
2371 \r
2372         _unload : function(e) {\r
2373              var EU = Ext.lib.Event, \r
2374                 i, \r
2375                 j, \r
2376                 l, \r
2377                 len, \r
2378                 index,\r
2379                 scope;\r
2380                 \r
2381 \r
2382             Ext.each(unloadListeners, function(v) {\r
2383                 if (v) {\r
2384                     try{\r
2385                         scope =  v[ADJ_SCOPE] ? (v[ADJ_SCOPE] === true ? v[OBJ] : v[ADJ_SCOPE]) :  win; \r
2386                         v[FN].call(scope, EU.getEvent(e), v[OBJ]);\r
2387                     }catch(ex){}\r
2388                 }   \r
2389             });     \r
2390 \r
2391             unloadListeners = null;\r
2392 \r
2393             if(listeners && (j = listeners.length)){                    \r
2394                 while(j){                        \r
2395                     if((l = listeners[index = --j])){\r
2396                         EU.removeListener(l[EL], l[TYPE], l[FN], index);\r
2397                     }                        \r
2398                 }\r
2399                 //EU.clearCache();\r
2400             }\r
2401 \r
2402             doRemove(win, UNLOAD, EU._unload);\r
2403         }            \r
2404     };        \r
2405     \r
2406     // Initialize stuff.\r
2407     pub.on = pub.addListener;\r
2408     pub.un = pub.removeListener;\r
2409     if (doc && doc.body) {\r
2410         pub._load(true);\r
2411     } else {\r
2412         doAdd(win, "load", pub._load);\r
2413     }\r
2414     doAdd(win, UNLOAD, pub._unload);    \r
2415     _tryPreloadAttach();\r
2416     \r
2417     return pub;\r
2418 }();/*\r
2419  * Portions of this file are based on pieces of Yahoo User Interface Library\r
2420  * Copyright (c) 2007, Yahoo! Inc. All rights reserved.\r
2421  * YUI licensed under the BSD License:\r
2422  * http://developer.yahoo.net/yui/license.txt\r
2423  */\r
2424     Ext.lib.Ajax = function() {     \r
2425             var activeX = ['MSXML2.XMLHTTP.3.0',\r
2426                                    'MSXML2.XMLHTTP',\r
2427                                    'Microsoft.XMLHTTP'],\r
2428             CONTENTTYPE = 'Content-Type';\r
2429                                    \r
2430                 // private\r
2431                 function setHeader(o) {\r
2432                 var conn = o.conn,\r
2433                         prop;\r
2434                 \r
2435                 function setTheHeaders(conn, headers){\r
2436                         for (prop in headers) {\r
2437                     if (headers.hasOwnProperty(prop)) {\r
2438                         conn.setRequestHeader(prop, headers[prop]);\r
2439                     }\r
2440                 }   \r
2441                 }               \r
2442                 \r
2443             if (pub.defaultHeaders) {\r
2444                     setTheHeaders(conn, pub.defaultHeaders);\r
2445             }\r
2446 \r
2447             if (pub.headers) {\r
2448                                 setTheHeaders(conn, pub.headers);\r
2449                 delete pub.headers;                \r
2450             }\r
2451         }    \r
2452         \r
2453         // private\r
2454         function createExceptionObject(tId, callbackArg, isAbort, isTimeout) {          \r
2455             return {\r
2456                     tId : tId,\r
2457                     status : isAbort ? -1 : 0,\r
2458                     statusText : isAbort ? 'transaction aborted' : 'communication failure',\r
2459                 isAbort: isAbort,\r
2460                 isTimeout: isTimeout,\r
2461                     argument : callbackArg\r
2462             };\r
2463         }  \r
2464         \r
2465         // private \r
2466         function initHeader(label, value) {         \r
2467                         (pub.headers = pub.headers || {})[label] = value;                                   \r
2468         }\r
2469             \r
2470         // private\r
2471         function createResponseObject(o, callbackArg) {\r
2472             var headerObj = {},\r
2473                 headerStr,              \r
2474                 conn = o.conn,\r
2475                 t,\r
2476                 s;\r
2477 \r
2478             try {\r
2479                 headerStr = o.conn.getAllResponseHeaders();   \r
2480                 Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){\r
2481                     t = v.indexOf(':');\r
2482                     if(t >= 0){\r
2483                         s = v.substr(0, t).toLowerCase();\r
2484                         if(v.charAt(t + 1) == ' '){\r
2485                             ++t;\r
2486                         }\r
2487                         headerObj[s] = v.substr(t + 1);\r
2488                     }\r
2489                 });\r
2490             } catch(e) {}\r
2491                         \r
2492             return {\r
2493                 tId : o.tId,\r
2494                 status : conn.status,\r
2495                 statusText : conn.statusText,\r
2496                 getResponseHeader : function(header){return headerObj[header.toLowerCase()];},\r
2497                 getAllResponseHeaders : function(){return headerStr},\r
2498                 responseText : conn.responseText,\r
2499                 responseXML : conn.responseXML,\r
2500                 argument : callbackArg\r
2501             };\r
2502         }\r
2503         \r
2504         // private\r
2505         function releaseObject(o) {\r
2506             o.conn = null;\r
2507             o = null;\r
2508         }        \r
2509             \r
2510         // private\r
2511         function handleTransactionResponse(o, callback, isAbort, isTimeout) {\r
2512             if (!callback) {\r
2513                 releaseObject(o);\r
2514                 return;\r
2515             }\r
2516 \r
2517             var httpStatus, responseObject;\r
2518 \r
2519             try {\r
2520                 if (o.conn.status !== undefined && o.conn.status != 0) {\r
2521                     httpStatus = o.conn.status;\r
2522                 }\r
2523                 else {\r
2524                     httpStatus = 13030;\r
2525                 }\r
2526             }\r
2527             catch(e) {\r
2528                 httpStatus = 13030;\r
2529             }\r
2530 \r
2531             if ((httpStatus >= 200 && httpStatus < 300) || (Ext.isIE && httpStatus == 1223)) {\r
2532                 responseObject = createResponseObject(o, callback.argument);\r
2533                 if (callback.success) {\r
2534                     if (!callback.scope) {\r
2535                         callback.success(responseObject);\r
2536                     }\r
2537                     else {\r
2538                         callback.success.apply(callback.scope, [responseObject]);\r
2539                     }\r
2540                 }\r
2541             }\r
2542             else {\r
2543                 switch (httpStatus) {\r
2544                     case 12002:\r
2545                     case 12029:\r
2546                     case 12030:\r
2547                     case 12031:\r
2548                     case 12152:\r
2549                     case 13030:\r
2550                         responseObject = createExceptionObject(o.tId, callback.argument, (isAbort ? isAbort : false), isTimeout);\r
2551                         if (callback.failure) {\r
2552                             if (!callback.scope) {\r
2553                                 callback.failure(responseObject);\r
2554                             }\r
2555                             else {\r
2556                                 callback.failure.apply(callback.scope, [responseObject]);\r
2557                             }\r
2558                         }\r
2559                         break;\r
2560                     default:\r
2561                         responseObject = createResponseObject(o, callback.argument);\r
2562                         if (callback.failure) {\r
2563                             if (!callback.scope) {\r
2564                                 callback.failure(responseObject);\r
2565                             }\r
2566                             else {\r
2567                                 callback.failure.apply(callback.scope, [responseObject]);\r
2568                             }\r
2569                         }\r
2570                 }\r
2571             }\r
2572 \r
2573             releaseObject(o);\r
2574             responseObject = null;\r
2575         }  \r
2576         \r
2577         // private\r
2578         function handleReadyState(o, callback){\r
2579             callback = callback || {};\r
2580             var conn = o.conn,\r
2581                 tId = o.tId,\r
2582                 poll = pub.poll,\r
2583                 cbTimeout = callback.timeout || null;\r
2584 \r
2585             if (cbTimeout) {\r
2586                 pub.timeout[tId] = setTimeout(function() {\r
2587                     pub.abort(o, callback, true);\r
2588                 }, cbTimeout);\r
2589             }\r
2590 \r
2591             poll[tId] = setInterval(\r
2592                 function() {\r
2593                     if (conn && conn.readyState == 4) {\r
2594                         clearInterval(poll[tId]);\r
2595                         poll[tId] = null;\r
2596 \r
2597                         if (cbTimeout) {\r
2598                             clearTimeout(pub.timeout[tId]);\r
2599                             pub.timeout[tId] = null;\r
2600                         }\r
2601 \r
2602                         handleTransactionResponse(o, callback);\r
2603                     }\r
2604                 },\r
2605                 pub.pollInterval);\r
2606         }\r
2607         \r
2608         // private\r
2609         function asyncRequest(method, uri, callback, postData) {\r
2610             var o = getConnectionObject() || null;\r
2611 \r
2612             if (o) {\r
2613                 o.conn.open(method, uri, true);\r
2614 \r
2615                 if (pub.useDefaultXhrHeader) {                    \r
2616                         initHeader('X-Requested-With', pub.defaultXhrHeader);\r
2617                 }\r
2618 \r
2619                 if(postData && pub.useDefaultHeader && (!pub.headers || !pub.headers[CONTENTTYPE])){\r
2620                     initHeader(CONTENTTYPE, pub.defaultPostHeader);\r
2621                 }\r
2622 \r
2623                 if (pub.defaultHeaders || pub.headers) {\r
2624                     setHeader(o);\r
2625                 }\r
2626 \r
2627                 handleReadyState(o, callback);\r
2628                 o.conn.send(postData || null);\r
2629             }\r
2630             return o;\r
2631         }\r
2632         \r
2633         // private\r
2634         function getConnectionObject() {\r
2635             var o;              \r
2636 \r
2637             try {\r
2638                 if (o = createXhrObject(pub.transactionId)) {\r
2639                     pub.transactionId++;\r
2640                 }\r
2641             } catch(e) {\r
2642             } finally {\r
2643                 return o;\r
2644             }\r
2645         }\r
2646                \r
2647         // private\r
2648         function createXhrObject(transactionId) {\r
2649             var http;\r
2650                 \r
2651             try {\r
2652                 http = new XMLHttpRequest();                \r
2653             } catch(e) {\r
2654                 for (var i = 0; i < activeX.length; ++i) {                  \r
2655                     try {\r
2656                         http = new ActiveXObject(activeX[i]);                        \r
2657                         break;\r
2658                     } catch(e) {}\r
2659                 }\r
2660             } finally {\r
2661                 return {conn : http, tId : transactionId};\r
2662             }\r
2663         }\r
2664                  \r
2665             var pub = {\r
2666                 request : function(method, uri, cb, data, options) {\r
2667                             if(options){\r
2668                                 var me = this,                  \r
2669                                         xmlData = options.xmlData,\r
2670                                         jsonData = options.jsonData,\r
2671                         hs;\r
2672                                         \r
2673                                 Ext.applyIf(me, options);               \r
2674                             \r
2675                             if(xmlData || jsonData){\r
2676                         hs = me.headers;\r
2677                         if(!hs || !hs[CONTENTTYPE]){\r
2678                                         initHeader(CONTENTTYPE, xmlData ? 'text/xml' : 'application/json');\r
2679                         }\r
2680                                     data = xmlData || (Ext.isObject(jsonData) ? Ext.encode(jsonData) : jsonData);\r
2681                                 }\r
2682                             }                               \r
2683                             return asyncRequest(method || options.method || "POST", uri, cb, data);\r
2684                 },\r
2685         \r
2686                 serializeForm : function(form) {\r
2687                         var fElements = form.elements || (document.forms[form] || Ext.getDom(form)).elements,\r
2688                         hasSubmit = false,\r
2689                         encoder = encodeURIComponent,\r
2690                                 element,\r
2691                         options, \r
2692                         name, \r
2693                         val,                    \r
2694                         data = '',\r
2695                         type;\r
2696                         \r
2697                         Ext.each(fElements, function(element) {                     \r
2698                         name = element.name;                 \r
2699                                         type = element.type;\r
2700                                         \r
2701                         if (!element.disabled && name){\r
2702                                 if(/select-(one|multiple)/i.test(type)){                                        \r
2703                                             Ext.each(element.options, function(opt) {\r
2704                                                     if (opt.selected) {\r
2705                                                             data += String.format("{0}={1}&",                                                                                             \r
2706                                                                                                  encoder(name),\r
2707                                                          encoder((opt.hasAttribute ? opt.hasAttribute('value') : opt.getAttribute('value') !== null) ? opt.value : opt.text));\r
2708                                 }                                                               \r
2709                             });\r
2710                                 } else if(!/file|undefined|reset|button/i.test(type)) {\r
2711                                         if(!(/radio|checkbox/i.test(type) && !element.checked) && !(type == 'submit' && hasSubmit)){\r
2712                                     \r
2713                                 data += encoder(name) + '=' + encoder(element.value) + '&';                     \r
2714                                 hasSubmit = /submit/i.test(type);    \r
2715                             }                           \r
2716                                 } \r
2717                         }\r
2718                     });            \r
2719                     return data.substr(0, data.length - 1);\r
2720                 },\r
2721                 \r
2722                 useDefaultHeader : true,\r
2723                 defaultPostHeader : 'application/x-www-form-urlencoded; charset=UTF-8',\r
2724                 useDefaultXhrHeader : true,\r
2725                 defaultXhrHeader : 'XMLHttpRequest',        \r
2726                 poll : {},\r
2727                 timeout : {},\r
2728                 pollInterval : 50,\r
2729                 transactionId : 0,\r
2730                 \r
2731 //      This is never called - Is it worth exposing this?                       \r
2732 //              setProgId : function(id) {\r
2733 //                  activeX.unshift(id);\r
2734 //              },\r
2735 \r
2736 //      This is never called - Is it worth exposing this?       \r
2737 //              setDefaultPostHeader : function(b) {\r
2738 //                  this.useDefaultHeader = b;\r
2739 //              },\r
2740                 \r
2741 //      This is never called - Is it worth exposing this?       \r
2742 //              setDefaultXhrHeader : function(b) {\r
2743 //                  this.useDefaultXhrHeader = b;\r
2744 //              },\r
2745 \r
2746 //      This is never called - Is it worth exposing this?               \r
2747 //              setPollingInterval : function(i) {\r
2748 //                  if (typeof i == 'number' && isFinite(i)) {\r
2749 //                      this.pollInterval = i;\r
2750 //                  }\r
2751 //              },\r
2752                 \r
2753 //      This is never called - Is it worth exposing this?\r
2754 //              resetDefaultHeaders : function() {\r
2755 //                  this.defaultHeaders = null;\r
2756 //              },\r
2757         \r
2758                 abort : function(o, callback, isTimeout) {\r
2759                         var me = this,\r
2760                                 tId = o.tId,\r
2761                                 isAbort = false;\r
2762                         \r
2763                     if (me.isCallInProgress(o)) {\r
2764                         o.conn.abort();\r
2765                         clearInterval(me.poll[tId]);\r
2766                         me.poll[tId] = null;\r
2767                         if (isTimeout) {\r
2768                             me.timeout[tId] = null;\r
2769                         }\r
2770                                         \r
2771                         handleTransactionResponse(o, callback, (isAbort = true), isTimeout);                \r
2772                     }\r
2773                     return isAbort;\r
2774                 },\r
2775         \r
2776                 isCallInProgress : function(o) {\r
2777                     // if there is a connection and readyState is not 0 or 4\r
2778                     return o.conn && !{0:true,4:true}[o.conn.readyState];               \r
2779                 }\r
2780             };\r
2781             return pub;\r
2782     }();        Ext.lib.Region = function(t, r, b, l) {\r
2783                 var me = this;\r
2784         me.top = t;\r
2785         me[1] = t;\r
2786         me.right = r;\r
2787         me.bottom = b;\r
2788         me.left = l;\r
2789         me[0] = l;\r
2790     };\r
2791 \r
2792     Ext.lib.Region.prototype = {\r
2793         contains : function(region) {\r
2794                 var me = this;\r
2795             return ( region.left >= me.left &&\r
2796                      region.right <= me.right &&\r
2797                      region.top >= me.top &&\r
2798                      region.bottom <= me.bottom );\r
2799 \r
2800         },\r
2801 \r
2802         getArea : function() {\r
2803                 var me = this;\r
2804             return ( (me.bottom - me.top) * (me.right - me.left) );\r
2805         },\r
2806 \r
2807         intersect : function(region) {\r
2808             var me = this,\r
2809                 t = Math.max(me.top, region.top),\r
2810                 r = Math.min(me.right, region.right),\r
2811                 b = Math.min(me.bottom, region.bottom),\r
2812                 l = Math.max(me.left, region.left);\r
2813 \r
2814             if (b >= t && r >= l) {\r
2815                 return new Ext.lib.Region(t, r, b, l);\r
2816             }\r
2817         },\r
2818         \r
2819         union : function(region) {\r
2820                 var me = this,\r
2821                 t = Math.min(me.top, region.top),\r
2822                 r = Math.max(me.right, region.right),\r
2823                 b = Math.max(me.bottom, region.bottom),\r
2824                 l = Math.min(me.left, region.left);\r
2825 \r
2826             return new Ext.lib.Region(t, r, b, l);\r
2827         },\r
2828 \r
2829         constrainTo : function(r) {\r
2830                 var me = this;\r
2831             me.top = me.top.constrain(r.top, r.bottom);\r
2832             me.bottom = me.bottom.constrain(r.top, r.bottom);\r
2833             me.left = me.left.constrain(r.left, r.right);\r
2834             me.right = me.right.constrain(r.left, r.right);\r
2835             return me;\r
2836         },\r
2837 \r
2838         adjust : function(t, l, b, r) {\r
2839                 var me = this;\r
2840             me.top += t;\r
2841             me.left += l;\r
2842             me.right += r;\r
2843             me.bottom += b;\r
2844             return me;\r
2845         }\r
2846     };\r
2847 \r
2848     Ext.lib.Region.getRegion = function(el) {\r
2849         var p = Ext.lib.Dom.getXY(el),\r
2850                 t = p[1],\r
2851                 r = p[0] + el.offsetWidth,\r
2852                 b = p[1] + el.offsetHeight,\r
2853                 l = p[0];\r
2854 \r
2855         return new Ext.lib.Region(t, r, b, l);\r
2856     };  Ext.lib.Point = function(x, y) {\r
2857         if (Ext.isArray(x)) {\r
2858             y = x[1];\r
2859             x = x[0];\r
2860         }\r
2861         var me = this;\r
2862         me.x = me.right = me.left = me[0] = x;\r
2863         me.y = me.top = me.bottom = me[1] = y;\r
2864     };\r
2865 \r
2866     Ext.lib.Point.prototype = new Ext.lib.Region();\r
2867 (function(){    \r
2868     var EXTLIB = Ext.lib,\r
2869         noNegatives = /width|height|opacity|padding/i,\r
2870         offsetAttribute = /^((width|height)|(top|left))$/,\r
2871         defaultUnit = /width|height|top$|bottom$|left$|right$/i,\r
2872         offsetUnit =  /\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i,\r
2873         isset = function(v){\r
2874             return typeof v !== 'undefined';\r
2875         },\r
2876         now = function(){\r
2877             return new Date();    \r
2878         };\r
2879         \r
2880     EXTLIB.Anim = {\r
2881         motion : function(el, args, duration, easing, cb, scope) {\r
2882             return this.run(el, args, duration, easing, cb, scope, Ext.lib.Motion);\r
2883         },\r
2884 \r
2885         run : function(el, args, duration, easing, cb, scope, type) {\r
2886             type = type || Ext.lib.AnimBase;\r
2887             if (typeof easing == "string") {\r
2888                 easing = Ext.lib.Easing[easing];\r
2889             }\r
2890             var anim = new type(el, args, duration, easing);\r
2891             anim.animateX(function() {\r
2892                 if(Ext.isFunction(cb)){\r
2893                     cb.call(scope);\r
2894                 }\r
2895             });\r
2896             return anim;\r
2897         }\r
2898     };\r
2899     \r
2900     EXTLIB.AnimBase = function(el, attributes, duration, method) {\r
2901         if (el) {\r
2902             this.init(el, attributes, duration, method);\r
2903         }\r
2904     };\r
2905 \r
2906     EXTLIB.AnimBase.prototype = {\r
2907         doMethod: function(attr, start, end) {\r
2908             var me = this;\r
2909             return me.method(me.curFrame, start, end - start, me.totalFrames);\r
2910         },\r
2911 \r
2912 \r
2913         setAttr: function(attr, val, unit) {\r
2914             if (noNegatives.test(attr) && val < 0) {\r
2915                 val = 0;\r
2916             }\r
2917             Ext.fly(this.el, '_anim').setStyle(attr, val + unit);\r
2918         },\r
2919 \r
2920 \r
2921         getAttr: function(attr) {\r
2922             var el = Ext.fly(this.el),\r
2923                 val = el.getStyle(attr),\r
2924                 a = offsetAttribute.exec(attr) || []\r
2925 \r
2926             if (val !== 'auto' && !offsetUnit.test(val)) {\r
2927                 return parseFloat(val);\r
2928             }\r
2929 \r
2930             return (!!(a[2]) || (el.getStyle('position') == 'absolute' && !!(a[3]))) ? el.dom['offset' + a[0].charAt(0).toUpperCase() + a[0].substr(1)] : 0;\r
2931         },\r
2932 \r
2933 \r
2934         getDefaultUnit: function(attr) {\r
2935             return defaultUnit.test(attr) ? 'px' : '';\r
2936         },\r
2937 \r
2938         animateX : function(callback, scope) {\r
2939             var me = this,\r
2940                 f = function() {\r
2941                 me.onComplete.removeListener(f);\r
2942                 if (Ext.isFunction(callback)) {\r
2943                     callback.call(scope || me, me);\r
2944                 }\r
2945             };\r
2946             me.onComplete.addListener(f, me);\r
2947             me.animate();\r
2948         },\r
2949 \r
2950 \r
2951         setRunAttr: function(attr) {            \r
2952             var me = this,\r
2953                 a = this.attributes[attr],\r
2954                 to = a.to,\r
2955                 by = a.by,\r
2956                 from = a.from,\r
2957                 unit = a.unit,\r
2958                 ra = (this.runAttrs[attr] = {}),\r
2959                 end;\r
2960 \r
2961             if (!isset(to) && !isset(by)){\r
2962                 return false;\r
2963             }\r
2964 \r
2965             var start = isset(from) ? from : me.getAttr(attr);\r
2966             if (isset(to)) {\r
2967                 end = to;\r
2968             }else if(isset(by)) {\r
2969                 if (Ext.isArray(start)){\r
2970                     end = [];\r
2971                     Ext.each(start, function(v, i){\r
2972                         end[i] = v + by[i];\r
2973                     });\r
2974                 }else{\r
2975                     end = start + by;\r
2976                 }\r
2977             }\r
2978 \r
2979             Ext.apply(ra, {\r
2980                 start: start,\r
2981                 end: end,\r
2982                 unit: isset(unit) ? unit : me.getDefaultUnit(attr)\r
2983             });\r
2984         },\r
2985 \r
2986 \r
2987         init: function(el, attributes, duration, method) {\r
2988             var me = this,\r
2989                 actualFrames = 0,\r
2990                 mgr = EXTLIB.AnimMgr;\r
2991                 \r
2992             Ext.apply(me, {\r
2993                 isAnimated: false,\r
2994                 startTime: null,\r
2995                 el: Ext.getDom(el),\r
2996                 attributes: attributes || {},\r
2997                 duration: duration || 1,\r
2998                 method: method || EXTLIB.Easing.easeNone,\r
2999                 useSec: true,\r
3000                 curFrame: 0,\r
3001                 totalFrames: mgr.fps,\r
3002                 runAttrs: {},\r
3003                 animate: function(){\r
3004                     var me = this,\r
3005                         d = me.duration;\r
3006                     \r
3007                     if(me.isAnimated){\r
3008                         return false;\r
3009                     }\r
3010 \r
3011                     me.curFrame = 0;\r
3012                     me.totalFrames = me.useSec ? Math.ceil(mgr.fps * d) : d;\r
3013                     mgr.registerElement(me); \r
3014                 },\r
3015                 \r
3016                 stop: function(finish){\r
3017                     var me = this;\r
3018                 \r
3019                     if(finish){\r
3020                         me.curFrame = me.totalFrames;\r
3021                         me._onTween.fire();\r
3022                     }\r
3023                     mgr.stop(me);\r
3024                 }\r
3025             });\r
3026 \r
3027             var onStart = function(){\r
3028                 var me = this,\r
3029                     attr;\r
3030                 \r
3031                 me.onStart.fire();\r
3032                 me.runAttrs = {};\r
3033                 for(attr in this.attributes){\r
3034                     this.setRunAttr(attr);\r
3035                 }\r
3036 \r
3037                 me.isAnimated = true;\r
3038                 me.startTime = now();\r
3039                 actualFrames = 0;\r
3040             };\r
3041 \r
3042 \r
3043             var onTween = function(){\r
3044                 var me = this;\r
3045 \r
3046                 me.onTween.fire({\r
3047                     duration: now() - me.startTime,\r
3048                     curFrame: me.curFrame\r
3049                 });\r
3050 \r
3051                 var ra = me.runAttrs;\r
3052                 for (var attr in ra) {\r
3053                     this.setAttr(attr, me.doMethod(attr, ra[attr].start, ra[attr].end), ra[attr].unit);\r
3054                 }\r
3055 \r
3056                 ++actualFrames;\r
3057             };\r
3058 \r
3059             var onComplete = function() {\r
3060                 var me = this,\r
3061                     actual = (now() - me.startTime) / 1000,\r
3062                     data = {\r
3063                         duration: actual,\r
3064                         frames: actualFrames,\r
3065                         fps: actualFrames / actual\r
3066                     };\r
3067 \r
3068                 me.isAnimated = false;\r
3069                 actualFrames = 0;\r
3070                 me.onComplete.fire(data);\r
3071             };\r
3072 \r
3073             me.onStart = new Ext.util.Event(me);\r
3074             me.onTween = new Ext.util.Event(me);            \r
3075             me.onComplete = new Ext.util.Event(me);\r
3076             (me._onStart = new Ext.util.Event(me)).addListener(onStart);\r
3077             (me._onTween = new Ext.util.Event(me)).addListener(onTween);\r
3078             (me._onComplete = new Ext.util.Event(me)).addListener(onComplete); \r
3079         }\r
3080     };\r
3081 \r
3082 \r
3083     Ext.lib.AnimMgr = new function() {\r
3084         var me = this,\r
3085             thread = null,\r
3086             queue = [],\r
3087             tweenCount = 0;\r
3088 \r
3089 \r
3090         Ext.apply(me, {\r
3091             fps: 1000,\r
3092             delay: 1,\r
3093             registerElement: function(tween){\r
3094                 queue.push(tween);\r
3095                 ++tweenCount;\r
3096                 tween._onStart.fire();\r
3097                 me.start();\r
3098             },\r
3099             \r
3100             unRegister: function(tween, index){\r
3101                 tween._onComplete.fire();\r
3102                 index = index || getIndex(tween);\r
3103                 if (index != -1) {\r
3104                     queue.splice(index, 1);\r
3105                 }\r
3106 \r
3107                 if (--tweenCount <= 0) {\r
3108                     me.stop();\r
3109                 }\r
3110             },\r
3111             \r
3112             start: function(){\r
3113                 if(thread === null){\r
3114                     thread = setInterval(me.run, me.delay);\r
3115                 }\r
3116             },\r
3117             \r
3118             stop: function(tween){\r
3119                 if(!tween){\r
3120                     clearInterval(thread);\r
3121                     for(var i = 0, len = queue.length; i < len; ++i){\r
3122                         if(queue[0].isAnimated){\r
3123                             me.unRegister(queue[0], 0);\r
3124                         }\r
3125                     }\r
3126 \r
3127                     queue = [];\r
3128                     thread = null;\r
3129                     tweenCount = 0;\r
3130                 }else{\r
3131                     me.unRegister(tween);\r
3132                 }\r
3133             },\r
3134             \r
3135             run: function(){\r
3136                 var tf;\r
3137                 Ext.each(queue, function(tween){\r
3138                     if(tween && tween.isAnimated){\r
3139                         tf = tween.totalFrames;\r
3140                         if(tween.curFrame < tf || tf === null){\r
3141                             ++tween.curFrame;\r
3142                             if(tween.useSec){\r
3143                                 correctFrame(tween);\r
3144                             }\r
3145                             tween._onTween.fire();\r
3146                         }else{\r
3147                             me.stop(tween);\r
3148                         }\r
3149                     }\r
3150                 }, me);\r
3151             }\r
3152         });\r
3153 \r
3154         var getIndex = function(anim) {\r
3155             var out = -1;\r
3156             Ext.each(queue, function(item, idx){\r
3157                 if(item == anim){\r
3158                     out = idx;\r
3159                     return false;\r
3160                 }\r
3161             });\r
3162             return out;\r
3163         };\r
3164 \r
3165 \r
3166         var correctFrame = function(tween) {\r
3167             var frames = tween.totalFrames,\r
3168                 frame = tween.curFrame,\r
3169                 duration = tween.duration,\r
3170                 expected = (frame * duration * 1000 / frames),\r
3171                 elapsed = (now() - tween.startTime),\r
3172                 tweak = 0;\r
3173 \r
3174             if(elapsed < duration * 1000){\r
3175                 tweak = Math.round((elapsed / expected - 1) * frame);\r
3176             }else{\r
3177                 tweak = frames - (frame + 1);\r
3178             }\r
3179             if(tweak > 0 && isFinite(tweak)){\r
3180                 if(tween.curFrame + tweak >= frames){\r
3181                     tweak = frames - (frame + 1);\r
3182                 }\r
3183                 tween.curFrame += tweak;\r
3184             }\r
3185         };\r
3186     };\r
3187 \r
3188     EXTLIB.Bezier = new function() {\r
3189 \r
3190         this.getPosition = function(points, t) {\r
3191             var n = points.length,\r
3192                 tmp = [],\r
3193                 c = 1 - t, \r
3194                 i,\r
3195                 j;\r
3196 \r
3197             for (i = 0; i < n; ++i) {\r
3198                 tmp[i] = [points[i][0], points[i][1]];\r
3199             }\r
3200 \r
3201             for (j = 1; j < n; ++j) {\r
3202                 for (i = 0; i < n - j; ++i) {\r
3203                     tmp[i][0] = c * tmp[i][0] + t * tmp[parseInt(i + 1, 10)][0];\r
3204                     tmp[i][1] = c * tmp[i][1] + t * tmp[parseInt(i + 1, 10)][1];\r
3205                 }\r
3206             }\r
3207 \r
3208             return [ tmp[0][0], tmp[0][1] ];\r
3209 \r
3210         };\r
3211     };\r
3212 \r
3213 \r
3214     EXTLIB.Easing = {\r
3215         easeNone: function (t, b, c, d) {\r
3216             return c * t / d + b;\r
3217         },\r
3218 \r
3219 \r
3220         easeIn: function (t, b, c, d) {\r
3221             return c * (t /= d) * t + b;\r
3222         },\r
3223 \r
3224 \r
3225         easeOut: function (t, b, c, d) {\r
3226             return -c * (t /= d) * (t - 2) + b;\r
3227         }\r
3228     };\r
3229 \r
3230     (function() {\r
3231         EXTLIB.Motion = function(el, attributes, duration, method) {\r
3232             if (el) {\r
3233                 EXTLIB.Motion.superclass.constructor.call(this, el, attributes, duration, method);\r
3234             }\r
3235         };\r
3236 \r
3237         Ext.extend(EXTLIB.Motion, Ext.lib.AnimBase);\r
3238 \r
3239         var superclass = EXTLIB.Motion.superclass,\r
3240             proto = EXTLIB.Motion.prototype,\r
3241             pointsRe = /^points$/i;\r
3242 \r
3243         Ext.apply(EXTLIB.Motion.prototype, {\r
3244             setAttr: function(attr, val, unit){\r
3245                 var me = this,\r
3246                     setAttr = superclass.setAttr;\r
3247                     \r
3248                 if (pointsRe.test(attr)) {\r
3249                     unit = unit || 'px';\r
3250                     setAttr.call(me, 'left', val[0], unit);\r
3251                     setAttr.call(me, 'top', val[1], unit);\r
3252                 } else {\r
3253                     setAttr.call(me, attr, val, unit);\r
3254                 }\r
3255             },\r
3256             \r
3257             getAttr: function(attr){\r
3258                 var me = this,\r
3259                     getAttr = superclass.getAttr;\r
3260                     \r
3261                 return pointsRe.test(attr) ? [getAttr.call(me, 'left'), getAttr.call(me, 'top')] : getAttr.call(me, attr);\r
3262             },\r
3263             \r
3264             doMethod: function(attr, start, end){\r
3265                 var me = this;\r
3266                 \r
3267                 return pointsRe.test(attr)\r
3268                         ? EXTLIB.Bezier.getPosition(me.runAttrs[attr], me.method(me.curFrame, 0, 100, me.totalFrames) / 100)\r
3269                         : superclass.doMethod.call(me, attr, start, end);\r
3270             },\r
3271             \r
3272             setRunAttr: function(attr){\r
3273                 if(pointsRe.test(attr)){\r
3274                     \r
3275                     var me = this,\r
3276                         el = this.el,\r
3277                         points = this.attributes.points,\r
3278                         control = points.control || [],\r
3279                         from = points.from,\r
3280                         to = points.to,\r
3281                         by = points.by,\r
3282                         DOM = EXTLIB.Dom,\r
3283                         start,\r
3284                         i,\r
3285                         end,\r
3286                         len,\r
3287                         ra;\r
3288                   \r
3289 \r
3290                     if(control.length > 0 && !Ext.isArray(control[0])){\r
3291                         control = [control];\r
3292                     }else{\r
3293                         /*\r
3294                         var tmp = [];\r
3295                         for (i = 0,len = control.length; i < len; ++i) {\r
3296                             tmp[i] = control[i];\r
3297                         }\r
3298                         control = tmp;\r
3299                         */\r
3300                     }\r
3301 \r
3302                     Ext.fly(el, '_anim').position();\r
3303                     DOM.setXY(el, isset(from) ? from : DOM.getXY(el));\r
3304                     start = me.getAttr('points');\r
3305 \r
3306 \r
3307                     if(isset(to)){\r
3308                         end = translateValues.call(me, to, start);\r
3309                         for (i = 0,len = control.length; i < len; ++i) {\r
3310                             control[i] = translateValues.call(me, control[i], start);\r
3311                         }\r
3312                     } else if (isset(by)) {\r
3313                         end = [start[0] + by[0], start[1] + by[1]];\r
3314 \r
3315                         for (i = 0,len = control.length; i < len; ++i) {\r
3316                             control[i] = [ start[0] + control[i][0], start[1] + control[i][1] ];\r
3317                         }\r
3318                     }\r
3319 \r
3320                     ra = this.runAttrs[attr] = [start];\r
3321                     if (control.length > 0) {\r
3322                         ra = ra.concat(control);\r
3323                     }\r
3324 \r
3325                     ra[ra.length] = end;\r
3326                 }else{\r
3327                     superclass.setRunAttr.call(this, attr);\r
3328                 }\r
3329             }\r
3330         });\r
3331 \r
3332         var translateValues = function(val, start) {\r
3333             var pageXY = EXTLIB.Dom.getXY(this.el);\r
3334             return [val[0] - pageXY[0] + start[0], val[1] - pageXY[1] + start[1]];\r
3335         };\r
3336     })();\r
3337 })();// Easing functions\r
3338 (function(){\r
3339         // shortcuts to aid compression\r
3340         var abs = Math.abs,\r
3341                 pi = Math.PI,\r
3342                 asin = Math.asin,\r
3343                 pow = Math.pow,\r
3344                 sin = Math.sin,\r
3345                 EXTLIB = Ext.lib;\r
3346                 \r
3347     Ext.apply(EXTLIB.Easing, {\r
3348         \r
3349         easeBoth: function (t, b, c, d) {\r
3350                 return ((t /= d / 2) < 1)  ?  c / 2 * t * t + b  :  -c / 2 * ((--t) * (t - 2) - 1) + b;               \r
3351         },\r
3352         \r
3353         easeInStrong: function (t, b, c, d) {\r
3354             return c * (t /= d) * t * t * t + b;\r
3355         },\r
3356 \r
3357         easeOutStrong: function (t, b, c, d) {\r
3358             return -c * ((t = t / d - 1) * t * t * t - 1) + b;\r
3359         },\r
3360 \r
3361         easeBothStrong: function (t, b, c, d) {\r
3362             return ((t /= d / 2) < 1)  ?  c / 2 * t * t * t * t + b  :  -c / 2 * ((t -= 2) * t * t * t - 2) + b;\r
3363         },\r
3364 \r
3365         elasticIn: function (t, b, c, d, a, p) {\r
3366                 if (t == 0 || (t /= d) == 1) {\r
3367                 return t == 0 ? b : b + c;\r
3368             }               \r
3369             p = p || (d * .3);              \r
3370 \r
3371                         var s;\r
3372                         if (a >= abs(c)) {\r
3373                                 s = p / (2 * pi) * asin(c / a);\r
3374                         } else {\r
3375                                 a = c;\r
3376                                 s = p / 4;\r
3377                         }\r
3378         \r
3379             return -(a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b;\r
3380                       \r
3381         },      \r
3382         \r
3383                 elasticOut: function (t, b, c, d, a, p) {\r
3384                 if (t == 0 || (t /= d) == 1) {\r
3385                 return t == 0 ? b : b + c;\r
3386             }               \r
3387             p = p || (d * .3);              \r
3388 \r
3389                         var s;\r
3390                         if (a >= abs(c)) {\r
3391                                 s = p / (2 * pi) * asin(c / a);\r
3392                         } else {\r
3393                                 a = c;\r
3394                                 s = p / 4;\r
3395                         }\r
3396         \r
3397             return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b;        \r
3398         },      \r
3399         \r
3400         elasticBoth: function (t, b, c, d, a, p) {\r
3401             if (t == 0 || (t /= d / 2) == 2) {\r
3402                 return t == 0 ? b : b + c;\r
3403             }                           \r
3404                     \r
3405             p = p || (d * (.3 * 1.5));              \r
3406 \r
3407             var s;\r
3408             if (a >= abs(c)) {\r
3409                     s = p / (2 * pi) * asin(c / a);\r
3410             } else {\r
3411                     a = c;\r
3412                 s = p / 4;\r
3413             }\r
3414 \r
3415             return t < 1 ?\r
3416                         -.5 * (a * pow(2, 10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p)) + b :\r
3417                     a * pow(2, -10 * (t -= 1)) * sin((t * d - s) * (2 * pi) / p) * .5 + c + b;\r
3418         },\r
3419 \r
3420         backIn: function (t, b, c, d, s) {\r
3421             s = s ||  1.70158;              \r
3422             return c * (t /= d) * t * ((s + 1) * t - s) + b;\r
3423         },\r
3424 \r
3425 \r
3426         backOut: function (t, b, c, d, s) {\r
3427             if (!s) {\r
3428                 s = 1.70158;\r
3429             }\r
3430             return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;\r
3431         },\r
3432 \r
3433 \r
3434         backBoth: function (t, b, c, d, s) {\r
3435             s = s || 1.70158;               \r
3436 \r
3437             return ((t /= d / 2 ) < 1) ?\r
3438                     c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b :                  \r
3439                         c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;\r
3440         },\r
3441 \r
3442 \r
3443         bounceIn: function (t, b, c, d) {\r
3444             return c - EXTLIB.Easing.bounceOut(d - t, 0, c, d) + b;\r
3445         },\r
3446 \r
3447 \r
3448         bounceOut: function (t, b, c, d) {\r
3449         if ((t /= d) < (1 / 2.75)) {\r
3450                 return c * (7.5625 * t * t) + b;\r
3451             } else if (t < (2 / 2.75)) {\r
3452                 return c * (7.5625 * (t -= (1.5 / 2.75)) * t + .75) + b;\r
3453             } else if (t < (2.5 / 2.75)) {\r
3454                 return c * (7.5625 * (t -= (2.25 / 2.75)) * t + .9375) + b;\r
3455             }\r
3456             return c * (7.5625 * (t -= (2.625 / 2.75)) * t + .984375) + b;\r
3457         },\r
3458 \r
3459 \r
3460         bounceBoth: function (t, b, c, d) {\r
3461             return (t < d / 2) ?\r
3462                    EXTLIB.Easing.bounceIn(t * 2, 0, c, d) * .5 + b : \r
3463                    EXTLIB.Easing.bounceOut(t * 2 - d, 0, c, d) * .5 + c * .5 + b;\r
3464         }\r
3465     });\r
3466 })();\r
3467 \r
3468 (function() {\r
3469     var EXTLIB = Ext.lib;\r
3470         // Color Animation\r
3471         EXTLIB.Anim.color = function(el, args, duration, easing, cb, scope) {\r
3472             return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.ColorAnim);\r
3473         }\r
3474         \r
3475     EXTLIB.ColorAnim = function(el, attributes, duration, method) {\r
3476         EXTLIB.ColorAnim.superclass.constructor.call(this, el, attributes, duration, method);\r
3477     };\r
3478 \r
3479     Ext.extend(EXTLIB.ColorAnim, EXTLIB.AnimBase);\r
3480 \r
3481     var superclass = EXTLIB.ColorAnim.superclass,\r
3482         colorRE = /color$/i,\r
3483         transparentRE = /^transparent|rgba\(0, 0, 0, 0\)$/,\r
3484         rgbRE = /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,\r
3485         hexRE= /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,\r
3486         hex3RE = /^#?([0-9A-F]{1})([0-9A-F]{1})([0-9A-F]{1})$/i,\r
3487         isset = function(v){\r
3488             return typeof v !== 'undefined';\r
3489         }\r
3490                 \r
3491         // private      \r
3492     function parseColor(s) {    \r
3493         var pi = parseInt,\r
3494             base,\r
3495             out = null,\r
3496             c;\r
3497         \r
3498             if (s.length == 3) {\r
3499             return s;\r
3500         }\r
3501         \r
3502         Ext.each([hexRE, rgbRE, hex3RE], function(re, idx){\r
3503             base = (idx % 2 == 0) ? 16 : 10;\r
3504             c = re.exec(s);\r
3505             if(c && c.length == 4){\r
3506                 out = [pi(c[1], base), pi(c[2], base), pi(c[3], base)];\r
3507                 return false;\r
3508             }\r
3509         });\r
3510         return out;\r
3511     }   \r
3512 \r
3513     Ext.apply(EXTLIB.ColorAnim.prototype, {\r
3514         getAttr : function(attr) {\r
3515             var me = this,\r
3516                 el = me.el,\r
3517                 val;                \r
3518             if(colorRE.test(attr)){\r
3519                 while(el && transparentRE.test(val = Ext.fly(el).getStyle(attr))){\r
3520                     el = el.parentNode;\r
3521                     val = "fff";\r
3522                 }\r
3523             }else{\r
3524                 val = superclass.getAttr.call(me, attr);\r
3525             }\r
3526             return val;\r
3527         },\r
3528 \r
3529         doMethod : function(attr, start, end) {\r
3530             var me = this,\r
3531                 val,\r
3532                 floor = Math.floor;            \r
3533 \r
3534             if(colorRE.test(attr)){\r
3535                 val = [];\r
3536              \r
3537                     Ext.each(start, function(v, i) {\r
3538                     val[i] = superclass.doMethod.call(me, attr, v, end[i]);\r
3539                 });\r
3540 \r
3541                 val = 'rgb(' + floor(val[0]) + ',' + floor(val[1]) + ',' + floor(val[2]) + ')';\r
3542             }else{\r
3543                 val = superclass.doMethod.call(me, attr, start, end);\r
3544             }\r
3545             return val;\r
3546         },\r
3547 \r
3548         setRunAttr : function(attr) {\r
3549             var me = this,\r
3550                 a = me.attributes[attr],\r
3551                 to = a.to,\r
3552                 by = a.by,\r
3553                 ra;\r
3554                 \r
3555             superclass.setRunAttr.call(me, attr);\r
3556             ra = me.runAttrs[attr];\r
3557             if(colorRE.test(attr)){\r
3558                 var start = parseColor(ra.start),\r
3559                     end = parseColor(ra.end);\r
3560 \r
3561                 if(!isset(to) && isset(by)){\r
3562                     end = parseColor(by);\r
3563                     Ext.each(start, function(item, i){\r
3564                         end[i] = item + end[i];\r
3565                     });\r
3566                 }\r
3567                 ra.start = start;\r
3568                 ra.end = end;\r
3569             }\r
3570         }\r
3571         });\r
3572 })();   \r
3573 \r
3574         \r
3575 (function() {\r
3576             // Scroll Animation \r
3577     var EXTLIB = Ext.lib;\r
3578         EXTLIB.Anim.scroll = function(el, args, duration, easing, cb, scope) {          \r
3579             return EXTLIB.Anim.run(el, args, duration, easing, cb, scope, EXTLIB.Scroll);\r
3580         }\r
3581         \r
3582     EXTLIB.Scroll = function(el, attributes, duration, method) {\r
3583         if(el){\r
3584             EXTLIB.Scroll.superclass.constructor.call(this, el, attributes, duration, method);\r
3585         }\r
3586     };\r
3587 \r
3588     Ext.extend(EXTLIB.Scroll, EXTLIB.ColorAnim);\r
3589 \r
3590     var superclass = EXTLIB.Scroll.superclass,\r
3591         SCROLL = 'scroll';\r
3592 \r
3593     Ext.apply(EXTLIB.Scroll.prototype, {\r
3594 \r
3595         doMethod : function(attr, start, end) {\r
3596             var val,\r
3597                 me = this,\r
3598                 curFrame = me.curFrame,\r
3599                 totalFrames = me.totalFrames;\r
3600 \r
3601             if(attr == SCROLL){\r
3602                 val = [me.method(curFrame, start[0], end[0] - start[0], totalFrames),\r
3603                        me.method(curFrame, start[1], end[1] - start[1], totalFrames)];\r
3604             }else{\r
3605                 val = superclass.doMethod.call(me, attr, start, end);\r
3606             }\r
3607             return val;\r
3608         },\r
3609 \r
3610         getAttr : function(attr) {\r
3611             var me = this;\r
3612 \r
3613             if (attr == SCROLL) {\r
3614                 return [me.el.scrollLeft, me.el.scrollTop];\r
3615             }else{\r
3616                 return superclass.getAttr.call(me, attr);\r
3617             }\r
3618         },\r
3619 \r
3620         setAttr : function(attr, val, unit) {\r
3621             var me = this;\r
3622 \r
3623             if(attr == SCROLL){\r
3624                 me.el.scrollLeft = val[0];\r
3625                 me.el.scrollTop = val[1];\r
3626             }else{\r
3627                 superclass.setAttr.call(me, attr, val, unit);\r
3628             }\r
3629         }\r
3630     });\r
3631 })();   \r
3632         if(Ext.isIE) {\r
3633         function fnCleanUp() {\r
3634             var p = Function.prototype;\r
3635             delete p.createSequence;\r
3636             delete p.defer;\r
3637             delete p.createDelegate;\r
3638             delete p.createCallback;\r
3639             delete p.createInterceptor;\r
3640 \r
3641             window.detachEvent("onunload", fnCleanUp);\r
3642         }\r
3643         window.attachEvent("onunload", fnCleanUp);\r
3644     }\r
3645 })();