src/cm/media/js/lib/yui/yui_3.0.0b1/build/yui-base/yui-base-debug.js
changeset 0 40c8f766c9b8
equal deleted inserted replaced
-1:000000000000 0:40c8f766c9b8
       
     1 /*
       
     2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
       
     3 Code licensed under the BSD License:
       
     4 http://developer.yahoo.net/yui/license.txt
       
     5 version: 3.0.0b1
       
     6 build: 1163
       
     7 */
       
     8 (function() {
       
     9 
       
    10     var _instances = {}, 
       
    11         _startTime = new Date().getTime(), 
       
    12         p, 
       
    13         i,
       
    14 
       
    15         add = function () {
       
    16             if (window.addEventListener) {
       
    17                 return function(el, type, fn, capture) {
       
    18                     el.addEventListener(type, fn, (!!capture));
       
    19                 };
       
    20             } else if (window.attachEvent) {
       
    21                 return function(el, type, fn) {
       
    22                     el.attachEvent("on" + type, fn);
       
    23                 };
       
    24             } else {
       
    25                 return function(){};
       
    26             }
       
    27         }(),
       
    28 
       
    29         remove = function() {
       
    30             if (window.removeEventListener) {
       
    31                 return function (el, type, fn, capture) {
       
    32                     el.removeEventListener(type, fn, !!capture);
       
    33                 };
       
    34             } else if (window.detachEvent) {
       
    35                 return function (el, type, fn) {
       
    36                     el.detachEvent("on" + type, fn);
       
    37                 };
       
    38             } else {
       
    39                 return function(){};
       
    40             }
       
    41         }(),
       
    42 
       
    43         globalListener = function() {
       
    44             YUI.Env.windowLoaded = true;
       
    45             YUI.Env.DOMReady = true;
       
    46             remove(window, 'load', globalListener);
       
    47         },
       
    48 
       
    49 // @TODO: this needs to be created at build time from module metadata
       
    50 
       
    51         _APPLY_TO_WHITE_LIST = {
       
    52             'io.xdrReady': 1,
       
    53             'io.start': 1,
       
    54             'io.success': 1,
       
    55             'io.failure': 1
       
    56         },
       
    57 
       
    58         SLICE = Array.prototype.slice;
       
    59         
       
    60 // reduce to one or the other
       
    61 if (typeof YUI === 'undefined' || !YUI) {
       
    62 
       
    63     /**
       
    64      * The YUI global namespace object.  If YUI is already defined, the
       
    65      * existing YUI object will not be overwritten so that defined
       
    66      * namespaces are preserved.  
       
    67      *
       
    68      * @class YUI
       
    69      * @constructor
       
    70      * @global
       
    71      * @uses EventTarget
       
    72      * @param o Optional configuration object.  This object is stored
       
    73      * in YUI.config.  See config for the list of supported properties.
       
    74      */
       
    75 
       
    76     /*global YUI*/
       
    77     // Make a function, disallow direct instantiation
       
    78     YUI = function(o) {
       
    79 
       
    80         var Y = this;
       
    81 
       
    82         // Allow instantiation without the new operator
       
    83         if (!(Y instanceof YUI)) {
       
    84             return new YUI(o);
       
    85         } else {
       
    86             // set up the core environment
       
    87             Y._init(o);
       
    88 
       
    89             // bind the specified additional modules for this instance
       
    90             Y._setup();
       
    91 
       
    92             return Y;
       
    93         }
       
    94     };
       
    95 }
       
    96 
       
    97 // The prototype contains the functions that are required to allow the external
       
    98 // modules to be registered and for the instance to be initialized.
       
    99 YUI.prototype = {
       
   100 
       
   101     /**
       
   102      * Initialize this YUI instance
       
   103      * @param o config options
       
   104      * @private
       
   105      */
       
   106     _init: function(o) {
       
   107 
       
   108         o = o || {};
       
   109 
       
   110         // find targeted window/frame
       
   111         // @TODO create facades
       
   112         var v = '3.0.0b1', Y = this;
       
   113         o.win = o.win || window || {};
       
   114         o.win = o.win.contentWindow || o.win;
       
   115         o.doc = o.win.document;
       
   116         o.debug = ('debug' in o) ? o.debug : true;
       
   117         o.useBrowserConsole = ('useBrowserConsole' in o) ? o.useBrowserConsole : true;
       
   118         o.throwFail = ('throwFail' in o) ? o.throwFail : true;
       
   119     
       
   120         // add a reference to o for anything that needs it
       
   121         // before _setup is called.
       
   122         Y.config = o;
       
   123 
       
   124         Y.Env = {
       
   125             // @todo expand the new module metadata
       
   126             mods: {},
       
   127             _idx: 0,
       
   128             _used: {},
       
   129             _attached: {},
       
   130             _yidx: 0,
       
   131             _uidx: 0,
       
   132             _loaded: {}
       
   133         };
       
   134 
       
   135 
       
   136         if (v.indexOf('@') > -1) {
       
   137             v = 'test';
       
   138         }
       
   139 
       
   140         Y.version = v;
       
   141 
       
   142         Y.Env._loaded[v] = {};
       
   143 
       
   144         if (YUI.Env) {
       
   145             Y.Env._yidx = (++YUI.Env._yidx);
       
   146             Y.Env._guidp = ('yui_' + this.version + '-' + Y.Env._yidx + '-' + _startTime).replace(/\./g, '_');
       
   147             Y.id = Y.stamp(Y);
       
   148             _instances[Y.id] = Y;
       
   149         }
       
   150 
       
   151         Y.constructor = YUI;
       
   152 
       
   153 
       
   154         // this.log(this.id + ') init ');
       
   155     },
       
   156     
       
   157     /**
       
   158      * Finishes the instance setup. Attaches whatever modules were defined
       
   159      * when the yui modules was registered.
       
   160      * @method _setup
       
   161      * @private
       
   162      */
       
   163     _setup: function(o) {
       
   164         this.use("yui-base");
       
   165         // @TODO eval the need to copy the config
       
   166         this.config = this.merge(this.config);
       
   167     },
       
   168 
       
   169     /**
       
   170      * Executes a method on a YUI instance with
       
   171      * the specified id if the specified method is whitelisted.
       
   172      * @method applyTo
       
   173      * @param id {string} the YUI instance id
       
   174      * @param method {string} the name of the method to exectute.
       
   175      * Ex: 'Object.keys'
       
   176      * @param args {Array} the arguments to apply to the method
       
   177      * @return {object} the return value from the applied method or null
       
   178      */
       
   179     applyTo: function(id, method, args) {
       
   180 
       
   181         if (!(method in _APPLY_TO_WHITE_LIST)) {
       
   182             this.error(method + ': applyTo not allowed');
       
   183             return null;
       
   184         }
       
   185 
       
   186         var instance = _instances[id], nest, m, i;
       
   187 
       
   188         if (instance) {
       
   189 
       
   190             nest = method.split('.'); 
       
   191             m = instance;
       
   192 
       
   193             for (i=0; i<nest.length; i=i+1) {
       
   194 
       
   195                 m = m[nest[i]];
       
   196 
       
   197                 if (!m) {
       
   198                     this.error('applyTo not found: ' + method);
       
   199                 }
       
   200             }
       
   201 
       
   202             return m.apply(instance, args);
       
   203         }
       
   204 
       
   205         return null;
       
   206     }, 
       
   207 
       
   208     /**
       
   209      * Register a module
       
   210      * @method add
       
   211      * @param name {string} module name
       
   212      * @param fn {Function} entry point into the module that
       
   213      * is used to bind module to the YUI instance
       
   214      * @param version {string} version string
       
   215      * @param details optional config data: 
       
   216      * requires   - features that should be present before loading
       
   217      * optional   - optional features that should be present if load optional defined
       
   218      * use  - features that should be attached automatically
       
   219      * skinnable  -
       
   220      * rollup
       
   221      * omit - features that should not be loaded if this module is present
       
   222      * @return {YUI} the YUI instance
       
   223      *
       
   224      */
       
   225     add: function(name, fn, version, details) {
       
   226 
       
   227         // this.log('Adding a new component ' + name);
       
   228 
       
   229         // @todo expand this to include version mapping
       
   230         
       
   231         // @todo allow requires/supersedes
       
   232 
       
   233         // @todo may want to restore the build property
       
   234         
       
   235         // @todo fire moduleAvailable event
       
   236         
       
   237         var m = {
       
   238             name: name, 
       
   239             fn: fn,
       
   240             version: version,
       
   241             details: details || {}
       
   242         };
       
   243 
       
   244         YUI.Env.mods[name] = m;
       
   245 
       
   246         return this; // chain support
       
   247     },
       
   248 
       
   249     _attach: function(r, fromLoader) {
       
   250 
       
   251         var mods = YUI.Env.mods,
       
   252             attached = this.Env._attached,
       
   253             i, l = r.length, name, m, d, req, use;
       
   254 
       
   255         for (i=0; i<l; i=i+1) {
       
   256 
       
   257             name = r[i]; 
       
   258             m    = mods[name];
       
   259 
       
   260             if (!attached[name] && m) {
       
   261 
       
   262                 attached[name] = true;
       
   263 
       
   264                 d   = m.details; 
       
   265                 req = d.requires; 
       
   266                 use = d.use;
       
   267 
       
   268                 if (req) {
       
   269                     this._attach(this.Array(req));
       
   270                 }
       
   271 
       
   272                 // this.log('attaching ' + name, 'info', 'yui');
       
   273 
       
   274                 if (m.fn) {
       
   275                     m.fn(this);
       
   276                 }
       
   277 
       
   278                 if (use) {
       
   279                     this._attach(this.Array(use));
       
   280                 }
       
   281             }
       
   282         }
       
   283 
       
   284     },
       
   285 
       
   286     /**
       
   287      * Bind a module to a YUI instance
       
   288      * @param modules* {string} 1-n modules to bind (uses arguments array)
       
   289      * @param *callback {function} callback function executed when 
       
   290      * the instance has the required functionality.  If included, it
       
   291      * must be the last parameter.
       
   292      *
       
   293      * @TODO 
       
   294      * Implement versioning?  loader can load different versions?
       
   295      * Should sub-modules/plugins be normal modules, or do
       
   296      * we add syntax for specifying these?
       
   297      *
       
   298      * YUI().use('dragdrop')
       
   299      * YUI().use('dragdrop:2.4.0'); // specific version
       
   300      * YUI().use('dragdrop:2.4.0-'); // at least this version
       
   301      * YUI().use('dragdrop:2.4.0-2.9999.9999'); // version range
       
   302      * YUI().use('*'); // use all available modules
       
   303      * YUI().use('lang+dump+substitute'); // use lang and some plugins
       
   304      * YUI().use('lang+*'); // use lang and all known plugins
       
   305      *
       
   306      *
       
   307      * @return {YUI} the YUI instance
       
   308      */
       
   309     use: function() {
       
   310 
       
   311         if (this._loading) {
       
   312             this._useQueue.add(SLICE.call(arguments, 0));
       
   313             return this;
       
   314         }
       
   315 
       
   316         var Y = this, 
       
   317             a=SLICE.call(arguments, 0), 
       
   318             mods = YUI.Env.mods, 
       
   319             used = Y.Env._used,
       
   320             loader, 
       
   321             firstArg = a[0], 
       
   322             dynamic = false,
       
   323             callback = a[a.length-1],
       
   324             k, i, l, missing = [], 
       
   325             r = [], 
       
   326             f = function(name) {
       
   327 
       
   328                 // only attach a module once
       
   329                 if (used[name]) {
       
   330                     // Y.log(name + ' already used', 'info', 'yui');
       
   331                     return;
       
   332                 }
       
   333 
       
   334                 var m = mods[name], j, req, use;
       
   335 
       
   336                 if (m) {
       
   337 
       
   338                     // Y.log('USING ' + name, 'info', 'yui');
       
   339 
       
   340                     used[name] = true;
       
   341 
       
   342                     req = m.details.requires;
       
   343                     use = m.details.use;
       
   344                 } else {
       
   345 
       
   346                     // CSS files don't register themselves, see if it has been loaded
       
   347                     if (!YUI.Env._loaded[Y.version][name]) {
       
   348                         Y.log('module not found: ' + name, 'info', 'yui');
       
   349                         missing.push(name);
       
   350                     } else {
       
   351                         // probably css
       
   352                         // Y.log('module not found BUT HAS BEEN LOADED: ' + name, 'info', 'yui');
       
   353                         used[name] = true;
       
   354                     }
       
   355                 }
       
   356 
       
   357                 // make sure requirements are attached
       
   358                 if (req) {
       
   359                     if (Y.Lang.isString(req)) {
       
   360                         f(req);
       
   361                     } else {
       
   362                         for (j = 0; j < req.length; j = j + 1) {
       
   363                             // Y.log('using module\'s requirements: ' + name, 'info', 'yui');
       
   364                             f(req[j]);
       
   365                         }
       
   366                     }
       
   367                 }
       
   368 
       
   369                 // add this module to full list of things to attach
       
   370                 // Y.log('adding to requires list: ' + name);
       
   371                 r.push(name);
       
   372 
       
   373             },
       
   374 
       
   375             onComplete = function(fromLoader) {
       
   376 
       
   377                 // Y.log('Use complete');
       
   378 
       
   379                 fromLoader = fromLoader || {
       
   380                     success: true,
       
   381                     msg: 'not dynamic'
       
   382                 };
       
   383 
       
   384                 if (Y.Env._callback) {
       
   385 
       
   386                     var cb = Y.Env._callback;
       
   387                     Y.Env._callback = null;
       
   388                     cb(Y, fromLoader);
       
   389                 }
       
   390 
       
   391                 if (Y.fire) {
       
   392                     Y.fire('yui:load', Y, fromLoader);
       
   393                 }
       
   394 
       
   395                 // process queued use requests as long until done 
       
   396                 // or dynamic load happens again.
       
   397                 this._loading = false;
       
   398                 while (this._useQueue && this._useQueue.size() && !this._loading) {
       
   399                     Y.use.apply(Y, this._useQueue.next());
       
   400                 }
       
   401             };
       
   402 
       
   403         // Y.log(Y.id + ': use called: ' + a + ' :: ' + callback);
       
   404 
       
   405         // The last argument supplied to use can be a load complete callback
       
   406         if (typeof callback === 'function') {
       
   407             a.pop();
       
   408             Y.Env._callback = callback;
       
   409         } else {
       
   410             callback = null;
       
   411         }
       
   412 
       
   413         // YUI().use('*'); // bind everything available
       
   414         if (firstArg === "*") {
       
   415             a = [];
       
   416             for (k in mods) {
       
   417                 if (mods.hasOwnProperty(k)) {
       
   418                     a.push(k);
       
   419                 }
       
   420             }
       
   421 
       
   422             // Y.log('Use *: ' + a);
       
   423 
       
   424             return Y.use.apply(Y, a);
       
   425 
       
   426         }
       
   427         
       
   428         // Y.log('loader before: ' + a.join(','));
       
   429 
       
   430         // use loader to expand dependencies and sort the 
       
   431         // requirements if it is available.
       
   432         if (Y.Loader) {
       
   433             dynamic = true;
       
   434             this._useQueue = this._useQueue || new Y.Queue();
       
   435             loader = new Y.Loader(Y.config);
       
   436             loader.require(a);
       
   437             loader.ignoreRegistered = true;
       
   438             loader.allowRollup = false;
       
   439             loader.calculate();
       
   440             a = loader.sorted;
       
   441         }
       
   442 
       
   443         // Y.log('loader after: ' + a.join(','));
       
   444 
       
   445         l = a.length;
       
   446 
       
   447         // process each requirement and any additional requirements 
       
   448         // the module metadata specifies
       
   449         for (i=0; i<l; i=i+1) {
       
   450             f(a[i]);
       
   451         }
       
   452 
       
   453         // Y.log('all reqs: ' + r + ' --- missing: ' + missing + ', l: ' + l + ', ' + r[0]);
       
   454 
       
   455         // dynamic load
       
   456         if (Y.Loader && missing.length) {
       
   457             Y.log('Attempting to dynamically load the missing modules ' + missing, 'info', 'yui');
       
   458             this._loading = true;
       
   459             loader = new Y.Loader(Y.config);
       
   460             loader.onSuccess = onComplete;
       
   461             loader.onFailure = onComplete;
       
   462             loader.onTimeout = onComplete;
       
   463             loader.attaching = a;
       
   464             loader.require(missing);
       
   465             loader.insert();
       
   466         } else {
       
   467             Y._attach(r);
       
   468             onComplete();
       
   469         }
       
   470 
       
   471         return Y; // chain support var yui = YUI().use('dragdrop');
       
   472     },
       
   473 
       
   474 
       
   475     /**
       
   476      * Returns the namespace specified and creates it if it doesn't exist
       
   477      * <pre>
       
   478      * YUI.namespace("property.package");
       
   479      * YUI.namespace("YAHOO.property.package");
       
   480      * </pre>
       
   481      * Either of the above would create YUI.property, then
       
   482      * YUI.property.package (YAHOO is scrubbed out, this is
       
   483      * to remain compatible with YUI2)
       
   484      *
       
   485      * Be careful when naming packages. Reserved words may work in some browsers
       
   486      * and not others. For instance, the following will fail in Safari:
       
   487      * <pre>
       
   488      * YUI.namespace("really.long.nested.namespace");
       
   489      * </pre>
       
   490      * This fails because "long" is a future reserved word in ECMAScript
       
   491      *
       
   492      * @method namespace
       
   493      * @param  {string*} arguments 1-n namespaces to create 
       
   494      * @return {object}  A reference to the last namespace object created
       
   495      */
       
   496     namespace: function() {
       
   497         var a=arguments, o=null, i, j, d;
       
   498         for (i=0; i<a.length; i=i+1) {
       
   499             d = ("" + a[i]).split(".");
       
   500             o = this;
       
   501             for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
       
   502                 o[d[j]] = o[d[j]] || {};
       
   503                 o = o[d[j]];
       
   504             }
       
   505         }
       
   506         return o;
       
   507     },
       
   508 
       
   509     // this is replaced if the log module is included
       
   510     log: function() {
       
   511 
       
   512     },
       
   513 
       
   514     /**
       
   515      * Report an error.  The reporting mechanism is controled by
       
   516      * the 'throwFail' configuration attribute.  If throwFail is
       
   517      * not specified, the message is written to the Logger, otherwise
       
   518      * a JS error is thrown
       
   519      * @method error
       
   520      * @param msg {string} the error message
       
   521      * @param e {Error} Optional JS error that was caught.  If supplied
       
   522      * and throwFail is specified, this error will be re-thrown.
       
   523      * @return {YUI} this YUI instance
       
   524      */
       
   525     error: function(msg, e) {
       
   526         if (this.config.throwFail) {
       
   527             throw (e || new Error(msg)); 
       
   528         } else {
       
   529             this.message(msg, "error"); // don't scrub this one
       
   530         }
       
   531 
       
   532         return this;
       
   533     },
       
   534 
       
   535     /**
       
   536      * Generate an id that is unique among all YUI instances
       
   537      * @method guid
       
   538      * @param pre {string} optional guid prefix
       
   539      * @return {string} the guid
       
   540      */
       
   541     guid: function(pre) {
       
   542         var id =  this.Env._guidp + (++this.Env._uidx);
       
   543         return (pre) ? (pre + id) : id;
       
   544     },
       
   545 
       
   546     /**
       
   547      * Returns a guid associated with an object.  If the object
       
   548      * does not have one, a new one is created unless readOnly
       
   549      * is specified.
       
   550      * @method stamp
       
   551      * @param o The object to stamp
       
   552      * @param readOnly {boolean} if true, a valid guid will only
       
   553      * be returned if the object has one assigned to it.
       
   554      * @return {string} The object's guid or null
       
   555      */
       
   556     stamp: function(o, readOnly) {
       
   557 
       
   558         if (!o) {
       
   559             return o;
       
   560         }
       
   561 
       
   562         var uid = (typeof o === 'string') ? o : o._yuid;
       
   563 
       
   564         if (!uid) {
       
   565             uid = this.guid();
       
   566             if (!readOnly) {
       
   567                 try {
       
   568                     o._yuid = uid;
       
   569                 } catch(e) {
       
   570                     uid = null;
       
   571                 }
       
   572             }
       
   573         }
       
   574 
       
   575         return uid;
       
   576     }
       
   577 };
       
   578 
       
   579 // Give the YUI global the same properties as an instance.
       
   580 // This makes it so that the YUI global can be used like the YAHOO
       
   581 // global was used prior to 3.x.  More importantly, the YUI global
       
   582 // provides global metadata, so env needs to be configured.
       
   583 // @TODO review
       
   584 
       
   585     p = YUI.prototype;
       
   586 
       
   587     // inheritance utilities are not available yet
       
   588     for (i in p) {
       
   589         if (true) {
       
   590             YUI[i] = p[i];
       
   591         }
       
   592     }
       
   593 
       
   594     // set up the environment
       
   595     YUI._init();
       
   596 
       
   597     // add a window load event at load time so we can capture
       
   598     // the case where it fires before dynamic loading is
       
   599     // complete.
       
   600     add(window, 'load', globalListener);
       
   601 
       
   602     YUI.Env.add = add;
       
   603     YUI.Env.remove = remove;
       
   604 
       
   605     /*
       
   606      * Subscribe to an event.  The signature differs depending on the
       
   607      * type of event you are attaching to.
       
   608      * @method on 
       
   609      * @param type {string|function|object} The type of the event.  If
       
   610      * this is a function, this is dispatched to the aop system.  If an
       
   611      * object, it is parsed for multiple subsription definitions
       
   612      * @param fn {Function} The callback
       
   613      * @param elspec {any} DOM element(s), selector string(s), and or
       
   614      * Node ref(s) to attach DOM related events to (only applies to
       
   615      * DOM events).
       
   616      * @param
       
   617      * @return the event target or a detach handle per 'chain' config
       
   618      */
       
   619 
       
   620 })();
       
   621 
       
   622 /**
       
   623  * The config object contains all of the configuration options for
       
   624  * the YUI instance.  This object is supplied by the implementer 
       
   625  * when instantiating a YUI instance.  Some properties have default
       
   626  * values if they are not supplied by the implementer.
       
   627  * @class config
       
   628  * @static
       
   629  */
       
   630 
       
   631 /**
       
   632  * Turn debug statements on or off
       
   633  * @property debug
       
   634  * @type boolean
       
   635  * @default true
       
   636  */
       
   637 
       
   638 /**
       
   639  * Log to the browser console if debug is on and the browser has a
       
   640  * supported console
       
   641  * @property useBrowserConsole
       
   642  * @type boolean
       
   643  * @default true
       
   644  */
       
   645 
       
   646 /**
       
   647  * A hash of log sources that should be logged.  If specified, only log messages from these sources will be logged.
       
   648  * @property logInclude
       
   649  * @type object
       
   650  */
       
   651 
       
   652 /**
       
   653  * A hash of log sources that should be not be logged.  If specified, all sources are logged if not on this list.</li>
       
   654  * @property logExclude
       
   655  * @type object
       
   656  */
       
   657 
       
   658 /**
       
   659  * Set to true if the yui seed file was dynamically loaded in 
       
   660  * order to bootstrap components relying on the window load event 
       
   661  * and onDOMReady.
       
   662  * @property injected
       
   663  * @type object
       
   664  */
       
   665 
       
   666 /**
       
   667  * If throwFail is set, Y.fail will generate or re-throw a JS Error.  Otherwise the failure is logged.
       
   668  * @property throwFail
       
   669  * @type boolean
       
   670  * @default true
       
   671  */
       
   672 
       
   673 /**
       
   674  * The window/frame that this instance should operate in
       
   675  * @property win
       
   676  * @type Window
       
   677  * @default the window hosting YUI
       
   678  */
       
   679 
       
   680 /**
       
   681  * The document associated with the 'win' configuration
       
   682  * @property doc
       
   683  * @type Document
       
   684  * @default the document hosting YUI
       
   685  */
       
   686 
       
   687 /**
       
   688  * A list of modules that defines the YUI core (overrides the default)</li>
       
   689  * @property core
       
   690  * @type string[]
       
   691  */
       
   692 
       
   693 /**
       
   694  * The default date format
       
   695  * @property dateFormat
       
   696  * @type string
       
   697  */
       
   698 
       
   699 /**
       
   700  * The default locale
       
   701  * @property locale
       
   702  * @type string
       
   703  */
       
   704 
       
   705 /**
       
   706  * The default interval when polling in milliseconds.
       
   707  * @property pollInterval
       
   708  * @type int
       
   709  * @default 20
       
   710  */
       
   711 
       
   712 /**
       
   713  * The number of dynamic nodes to insert by default before
       
   714  * automatically removing them.  This applies to script nodes
       
   715  * because remove the node will not make the evaluated script
       
   716  * unavailable.  Dynamic CSS is not auto purged, because removing
       
   717  * a linked style sheet will also remove the style definitions.
       
   718  * @property purgethreshold
       
   719  * @type int
       
   720  * @default 20
       
   721  */
       
   722 
       
   723 /**
       
   724  * The default interval when polling in milliseconds.
       
   725  * @property windowResizeDelay
       
   726  * @type int
       
   727  * @default 40
       
   728  */
       
   729 
       
   730 /**
       
   731  * Base directory for dynamic loading
       
   732  * @property base
       
   733  * @type string
       
   734  */
       
   735 
       
   736 /**
       
   737  * The secure base dir (not implemented)
       
   738  * For dynamic loading.
       
   739  * @property secureBase
       
   740  * @type string
       
   741  */
       
   742 
       
   743 /**
       
   744  * The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?
       
   745  * For dynamic loading.
       
   746  * @property comboBase
       
   747  * @type string
       
   748  */
       
   749 
       
   750 /**
       
   751  * The root path to prepend to module names for the combo service. Ex: 3.0.0b1/build/
       
   752  * For dynamic loading.
       
   753  * @property root
       
   754  * @type string
       
   755  */
       
   756 
       
   757 /**
       
   758  * A filter to apply to result urls.  This filter will modify the default
       
   759  * path for all modules.  The default path for the YUI library is the
       
   760  * minified version of the files (e.g., event-min.js).  The filter property
       
   761  * can be a predefined filter or a custom filter.  The valid predefined 
       
   762  * filters are:
       
   763  * <dl>
       
   764  *  <dt>DEBUG</dt>
       
   765  *  <dd>Selects the debug versions of the library (e.g., event-debug.js).
       
   766  *      This option will automatically include the Logger widget</dd>
       
   767  *  <dt>RAW</dt>
       
   768  *  <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
       
   769  * </dl>
       
   770  * You can also define a custom filter, which must be an object literal 
       
   771  * containing a search expression and a replace string:
       
   772  * <pre>
       
   773  *  myFilter: &#123; 
       
   774  *      'searchExp': "-min\\.js", 
       
   775  *      'replaceStr': "-debug.js"
       
   776  *  &#125;
       
   777  * </pre>
       
   778  * For dynamic loading.
       
   779  * @property filter
       
   780  * @type string|object
       
   781  */
       
   782 
       
   783 /**
       
   784  * Hash of per-component filter specification.  If specified for a given component, 
       
   785  * this overrides the filter config
       
   786  * For dynamic loading.
       
   787  * @property filters
       
   788  * @type object
       
   789  */
       
   790 
       
   791 /**
       
   792  * Use the YUI combo service to reduce the number of http connections 
       
   793  * required to load your dependencies
       
   794  * For dynamic loading.
       
   795  * @property combine
       
   796  * @type boolean
       
   797  * @default true if 'base' is not supplied, false if it is.
       
   798  */
       
   799 
       
   800 /**
       
   801  * A list of modules that should never be dynamically loaded
       
   802  * @property ignore
       
   803  * @type string[]
       
   804  */
       
   805 
       
   806 /**
       
   807  * A list of modules that should always be loaded when required, even if already 
       
   808  * present on the page.
       
   809  * @property force
       
   810  * @type string[]
       
   811  */
       
   812 
       
   813 /**
       
   814  * Node or id for a node that should be used as the insertion point for new nodes
       
   815  * For dynamic loading.
       
   816  * @property insertBefore
       
   817  * @type string
       
   818  */
       
   819 
       
   820 /**
       
   821  * charset for dynamic nodes
       
   822  * @property charset
       
   823  * @type string
       
   824  */
       
   825 
       
   826 /**
       
   827  * Object literal containing attributes to add to dynamically loaded script nodes.
       
   828  * @property jsAttributes
       
   829  * @type string
       
   830  */
       
   831 
       
   832 /**
       
   833  * Object literal containing attributes to add to dynamically loaded link nodes.
       
   834  * @property cssAttributes
       
   835  * @type string
       
   836  */
       
   837 
       
   838 /**
       
   839  * Number of milliseconds before a timeout occurs when dynamically 
       
   840  * loading nodes. If not set, there is no timeout.
       
   841  * @property timeout
       
   842  * @type int
       
   843  */
       
   844 
       
   845 /**
       
   846  * Callback for the 'CSSComplete' event.  When dynamically loading YUI 
       
   847  * components with CSS, this property fires when the CSS is finished
       
   848  * loading but script loading is still ongoing.  This provides an
       
   849  * opportunity to enhance the presentation of a loading page a little
       
   850  * bit before the entire loading process is done.
       
   851  * @property onCSS
       
   852  * @type function
       
   853  */
       
   854 
       
   855 /**
       
   856  * A list of module definitions to add to the list of YUI components.  
       
   857  * These components can then be dynamically loaded side by side with
       
   858  * YUI via the use() method.See Loader.addModule for the supported
       
   859  * module metadata.
       
   860  * @property modules
       
   861  * @type function
       
   862  */
       
   863  
       
   864 YUI.add('yui-base', function(Y) {
       
   865 
       
   866 /*
       
   867  * YUI stub
       
   868  * @module yui
       
   869  * @submodule yui-base
       
   870  */
       
   871 (function() {
       
   872 
       
   873 var instance = Y,
       
   874     LOGEVENT = 'yui:log',
       
   875     _published;
       
   876 
       
   877 /**
       
   878  * If the 'debug' config is true, a 'yui:log' event will be
       
   879  * dispatched, which the Console widget and anything else
       
   880  * can consume.  If the 'useBrowserConsole' config is true, it will
       
   881  * write to the browser console if available.  YUI-specific log
       
   882  * messages will only be present in the -debug versions of the
       
   883  * JS files.  The build system is supposed to remove log statements
       
   884  * from the raw and minified versions of the files.
       
   885  *
       
   886  * @method log
       
   887  * @for YUI
       
   888  * @param  {String}  msg  The message to log.
       
   889  * @param  {String}  cat  The log category for the message.  Default
       
   890  *                        categories are "info", "warn", "error", time".
       
   891  *                        Custom categories can be used as well. (opt)
       
   892  * @param  {String}  src  The source of the the message (opt)
       
   893  * @param  {boolean} silent If true, the log event won't fire
       
   894  * @return {YUI}      YUI instance
       
   895  */
       
   896 instance.log = function(msg, cat, src, silent) {
       
   897     var Y = instance, c = Y.config, bail = false, exc, inc, m, f;
       
   898     // suppress log message if the config is off or the event stack
       
   899     // or the event call stack contains a consumer of the yui:log event
       
   900     if (c.debug) {
       
   901         // apply source filters
       
   902         if (src) {
       
   903 
       
   904             exc = c.logExclude; 
       
   905             inc = c.logInclude;
       
   906 
       
   907             if (inc && !(src in inc)) {
       
   908                 bail = true;
       
   909             } else if (exc && (src in exc)) {
       
   910                 bail = true;
       
   911             }
       
   912         }
       
   913 
       
   914         if (!bail) {
       
   915 
       
   916             if (c.useBrowserConsole) {
       
   917                 m = (src) ? src + ': ' + msg : msg;
       
   918                 if (typeof console != 'undefined') {
       
   919                     f = (cat && console[cat]) ? cat : 'log';
       
   920                     console[f](m);
       
   921                 } else if (typeof opera != 'undefined') {
       
   922                     opera.postError(m);
       
   923                 }
       
   924             }
       
   925 
       
   926             if (Y.fire && !bail && !silent) {
       
   927                 if (!_published) {
       
   928                     Y.publish(LOGEVENT, {
       
   929                         broadcast: 2,
       
   930                         emitFacade: true
       
   931                     });
       
   932 
       
   933                     _published = true;
       
   934 
       
   935                 }
       
   936                 Y.fire(LOGEVENT, {
       
   937                     msg: msg, 
       
   938                     cat: cat, 
       
   939                     src: src
       
   940                 });
       
   941             }
       
   942         }
       
   943     }
       
   944 
       
   945     return Y;
       
   946 };
       
   947 
       
   948 /**
       
   949  * Write a system message.  This message will be preserved in the
       
   950  * minified and raw versions of the YUI files, unlike log statements.
       
   951  * @method message
       
   952  * @for YUI
       
   953  * @param  {String}  msg  The message to log.
       
   954  * @param  {String}  cat  The log category for the message.  Default
       
   955  *                        categories are "info", "warn", "error", time".
       
   956  *                        Custom categories can be used as well. (opt)
       
   957  * @param  {String}  src  The source of the the message (opt)
       
   958  * @param  {boolean} silent If true, the log event won't fire
       
   959  * @return {YUI}      YUI instance
       
   960  */
       
   961 instance.message = function() {
       
   962     return instance.log.apply(instance, arguments);
       
   963 };
       
   964 
       
   965 /*
       
   966  * @TODO I'm not convinced the current log statement scrubbing routine can
       
   967  * be made safe with all the variations that could be supplied for
       
   968  * the condition.
       
   969  *
       
   970  * Logs a message with Y.log() if the first parameter is true
       
   971  * Y.logIf((life == 'good'), 'yay'); 
       
   972  * logIf statements are stripped from the raw and min files.
       
   973  * @method logIf
       
   974  * @for YUI
       
   975  * @param  {boolean} condition Logging only occurs if a truthy value is provided
       
   976  * @param  {String}  msg  The message to log.
       
   977  * @param  {String}  cat  The log category for the message.  Default
       
   978  *                        categories are "info", "warn", "error", time".
       
   979  *                        Custom categories can be used as well. (opt)
       
   980  * @param  {String}  src  The source of the the message (opt)
       
   981  * @param  {boolean} silent If true, the log event won't fire
       
   982  * @return {YUI}      YUI instance
       
   983  */
       
   984 // instance.logIf = function(condition, msg, cat, src, silent) {
       
   985 //     if (condition) {
       
   986 //         return Y.log.apply(Y, arguments);
       
   987 //     }
       
   988 // };
       
   989 
       
   990 })();
       
   991 (function() {
       
   992 /**
       
   993  * Provides the language utilites and extensions used by the library
       
   994  * @class Lang
       
   995  * @static
       
   996  */
       
   997 Y.Lang    = Y.Lang || {};
       
   998 
       
   999 var L     = Y.Lang, 
       
  1000 
       
  1001 ARRAY     = 'array',
       
  1002 BOOLEAN   = 'boolean',
       
  1003 DATE      = 'date',
       
  1004 ERROR     = 'error',
       
  1005 FUNCTION  = 'function',
       
  1006 NUMBER    = 'number',
       
  1007 NULL      = 'null',
       
  1008 OBJECT    = 'object',
       
  1009 REGEX     = 'regexp',
       
  1010 STRING    = 'string',
       
  1011 TOSTRING  = Object.prototype.toString,
       
  1012 UNDEFINED = 'undefined',
       
  1013 
       
  1014 TYPES     = {
       
  1015     'undefined'         : UNDEFINED,
       
  1016     'number'            : NUMBER,
       
  1017     'boolean'           : BOOLEAN,
       
  1018     'string'            : STRING,
       
  1019     '[object Function]' : FUNCTION,
       
  1020     '[object RegExp]'   : REGEX,
       
  1021     '[object Array]'    : ARRAY,
       
  1022     '[object Date]'     : DATE,
       
  1023     '[object Error]'    : ERROR 
       
  1024 },
       
  1025 
       
  1026 TRIMREGEX = /^\s+|\s+$/g,
       
  1027 EMPTYSTRING = '';
       
  1028 
       
  1029 /**
       
  1030  * Determines whether or not the provided item is an array.
       
  1031  * Returns false for array-like collections such as the
       
  1032  * function arguments collection or HTMLElement collection
       
  1033  * will return false.  You can use @see Array.test if you 
       
  1034  * want to
       
  1035  * @method isArray
       
  1036  * @static
       
  1037  * @param o The object to test
       
  1038  * @return {boolean} true if o is an array
       
  1039  */
       
  1040 L.isArray = function(o) { 
       
  1041     return L.type(o) === ARRAY;
       
  1042 };
       
  1043 
       
  1044 /**
       
  1045  * Determines whether or not the provided item is a boolean
       
  1046  * @method isBoolean
       
  1047  * @static
       
  1048  * @param o The object to test
       
  1049  * @return {boolean} true if o is a boolean
       
  1050  */
       
  1051 L.isBoolean = function(o) {
       
  1052     return typeof o === BOOLEAN;
       
  1053 };
       
  1054 
       
  1055 /**
       
  1056  * Determines whether or not the provided item is a function
       
  1057  * Note: Internet Explorer thinks certain functions are objects:
       
  1058  *
       
  1059  * var obj = document.createElement("object");
       
  1060  * Y.Lang.isFunction(obj.getAttribute) // reports false in IE
       
  1061  *
       
  1062  * var input = document.createElement("input"); // append to body
       
  1063  * Y.Lang.isFunction(input.focus) // reports false in IE
       
  1064  *
       
  1065  * You will have to implement additional tests if these functions
       
  1066  * matter to you.
       
  1067  *
       
  1068  * @method isFunction
       
  1069  * @static
       
  1070  * @param o The object to test
       
  1071  * @return {boolean} true if o is a function
       
  1072  */
       
  1073 L.isFunction = function(o) {
       
  1074     return L.type(o) === FUNCTION;
       
  1075 };
       
  1076     
       
  1077 /**
       
  1078  * Determines whether or not the supplied item is a date instance
       
  1079  * @method isDate
       
  1080  * @static
       
  1081  * @param o The object to test
       
  1082  * @return {boolean} true if o is a date
       
  1083  */
       
  1084 L.isDate = function(o) {
       
  1085     // return o instanceof Date;
       
  1086     return L.type(o) === DATE;
       
  1087 };
       
  1088 
       
  1089 /**
       
  1090  * Determines whether or not the provided item is null
       
  1091  * @method isNull
       
  1092  * @static
       
  1093  * @param o The object to test
       
  1094  * @return {boolean} true if o is null
       
  1095  */
       
  1096 L.isNull = function(o) {
       
  1097     return o === null;
       
  1098 };
       
  1099     
       
  1100 /**
       
  1101  * Determines whether or not the provided item is a legal number
       
  1102  * @method isNumber
       
  1103  * @static
       
  1104  * @param o The object to test
       
  1105  * @return {boolean} true if o is a number
       
  1106  */
       
  1107 L.isNumber = function(o) {
       
  1108     return typeof o === NUMBER && isFinite(o);
       
  1109 };
       
  1110   
       
  1111 /**
       
  1112  * Determines whether or not the provided item is of type object
       
  1113  * or function
       
  1114  * @method isObject
       
  1115  * @static
       
  1116  * @param o The object to test
       
  1117  * @param failfn {boolean} fail if the input is a function
       
  1118  * @return {boolean} true if o is an object
       
  1119  */  
       
  1120 L.isObject = function(o, failfn) {
       
  1121 return (o && (typeof o === OBJECT || (!failfn && L.isFunction(o)))) || false;
       
  1122 };
       
  1123     
       
  1124 /**
       
  1125  * Determines whether or not the provided item is a string
       
  1126  * @method isString
       
  1127  * @static
       
  1128  * @param o The object to test
       
  1129  * @return {boolean} true if o is a string
       
  1130  */
       
  1131 L.isString = function(o) {
       
  1132     return typeof o === STRING;
       
  1133 };
       
  1134     
       
  1135 /**
       
  1136  * Determines whether or not the provided item is undefined
       
  1137  * @method isUndefined
       
  1138  * @static
       
  1139  * @param o The object to test
       
  1140  * @return {boolean} true if o is undefined
       
  1141  */
       
  1142 L.isUndefined = function(o) {
       
  1143     return typeof o === UNDEFINED;
       
  1144 };
       
  1145 
       
  1146 /**
       
  1147  * Returns a string without any leading or trailing whitespace.  If 
       
  1148  * the input is not a string, the input will be returned untouched.
       
  1149  * @method trim
       
  1150  * @static
       
  1151  * @param s {string} the string to trim
       
  1152  * @return {string} the trimmed string
       
  1153  */
       
  1154 L.trim = function(s){
       
  1155     try {
       
  1156         return s.replace(TRIMREGEX, EMPTYSTRING);
       
  1157     } catch(e) {
       
  1158         return s;
       
  1159     }
       
  1160 };
       
  1161 
       
  1162 /**
       
  1163  * A convenience method for detecting a legitimate non-null value.
       
  1164  * Returns false for null/undefined/NaN, true for other values, 
       
  1165  * including 0/false/''
       
  1166  * @method isValue
       
  1167  * @static
       
  1168  * @param o The item to test
       
  1169  * @return {boolean} true if it is not null/undefined/NaN || false
       
  1170  */
       
  1171 L.isValue = function(o) {
       
  1172     var t = L.type(o);
       
  1173     switch (t) {
       
  1174         case NUMBER:
       
  1175             return isFinite(o);
       
  1176         case NULL:
       
  1177         case UNDEFINED:
       
  1178             return false;
       
  1179         default:
       
  1180             return !!(t);
       
  1181     }
       
  1182 };
       
  1183 
       
  1184 /**
       
  1185  * Returns a string representing the type of the item passed in.
       
  1186  * @method type
       
  1187  * @param o the item to test
       
  1188  * @return {string} the detected type
       
  1189  */
       
  1190 L.type = function (o) {
       
  1191     return  TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? OBJECT : NULL);
       
  1192 };
       
  1193 
       
  1194 })();
       
  1195 
       
  1196 /*
       
  1197  * Provides information about the environment hosting YUI
       
  1198  * @module yui
       
  1199  * @submodule Array
       
  1200  */
       
  1201 
       
  1202 (function() {
       
  1203 
       
  1204 var L = Y.Lang, Native = Array.prototype,
       
  1205 
       
  1206 /**
       
  1207  * Adds the following array utilities to the YUI instance.  Additional
       
  1208  * array helpers can be found in the collection component.
       
  1209  * @class Array
       
  1210  */
       
  1211 
       
  1212 /** 
       
  1213  * Y.Array(o) returns an array:
       
  1214  * - Arrays are return unmodified unless the start position is specified.
       
  1215  * - "Array-like" collections (@see Array.test) are converted to arrays
       
  1216  * - For everything else, a new array is created with the input as the sole item
       
  1217  * - The start position is used if the input is or is like an array to return
       
  1218  *   a subset of the collection.
       
  1219  *
       
  1220  *   @TODO this will not automatically convert elements that are also collections
       
  1221  *   such as forms and selects.  Passing true as the third param will
       
  1222  *   force a conversion.
       
  1223  *
       
  1224  * @method ()
       
  1225  * @static
       
  1226  *   @param o the item to arrayify
       
  1227  *   @param i {int} if an array or array-like, this is the start index
       
  1228  *   @param al {boolean} if true, it forces the array-like fork.  This
       
  1229  *   can be used to avoid multiple array.test calls.
       
  1230  *   @return {Array} the resulting array
       
  1231  */
       
  1232 YArray = function(o, startIdx, al) {
       
  1233     var t = (al) ? 2 : Y.Array.test(o), i, l, a;
       
  1234 
       
  1235     // switch (t) {
       
  1236     //     case 1:
       
  1237     //         // return (startIdx) ? o.slice(startIdx) : o;
       
  1238     //     case 2:
       
  1239     //         return Native.slice.call(o, startIdx || 0);
       
  1240     //     default:
       
  1241     //         return [o];
       
  1242     // }
       
  1243 
       
  1244     if (t) {
       
  1245         try {
       
  1246             return Native.slice.call(o, startIdx || 0);
       
  1247         // IE errors when trying to slice element collections
       
  1248         } catch(e) {
       
  1249             a=[];
       
  1250             for (i=0, l=o.length; i<l; i=i+1) {
       
  1251                 a.push(o[i]);
       
  1252             }
       
  1253             return a;
       
  1254         }
       
  1255     } else {
       
  1256         return [o];
       
  1257     }
       
  1258 
       
  1259 };
       
  1260 
       
  1261 Y.Array = YArray;
       
  1262 
       
  1263 /** 
       
  1264  * Evaluates the input to determine if it is an array, array-like, or 
       
  1265  * something else.  This is used to handle the arguments collection 
       
  1266  * available within functions, and HTMLElement collections
       
  1267  *
       
  1268  * @method test
       
  1269  * @static
       
  1270  *
       
  1271  * @todo current implementation (intenionally) will not implicitly 
       
  1272  * handle html elements that are array-like (forms, selects, etc).  
       
  1273  *
       
  1274  * @return {int} a number indicating the results:
       
  1275  * 0: Not an array or an array-like collection
       
  1276  * 1: A real array. 
       
  1277  * 2: array-like collection.
       
  1278  */
       
  1279 YArray.test = function(o) {
       
  1280     var r = 0;
       
  1281     if (L.isObject(o)) {
       
  1282         if (L.isArray(o)) {
       
  1283             r = 1; 
       
  1284         } else {
       
  1285             try {
       
  1286                 // indexed, but no tagName (element) or alert (window)
       
  1287                 if ("length" in o && !("tagName" in o) && !("alert" in o) && 
       
  1288                     (!Y.Lang.isFunction(o.size) || o.size() > 1)) {
       
  1289                     r = 2;
       
  1290                 }
       
  1291                     
       
  1292             } catch(e) {}
       
  1293         }
       
  1294     }
       
  1295     return r;
       
  1296 };
       
  1297 
       
  1298 /**
       
  1299  * Executes the supplied function on each item in the array.
       
  1300  * @method each
       
  1301  * @param a {Array} the array to iterate
       
  1302  * @param f {Function} the function to execute on each item
       
  1303  * @param o Optional context object
       
  1304  * @static
       
  1305  * @return {YUI} the YUI instance
       
  1306  */
       
  1307 YArray.each = (Native.forEach) ?
       
  1308     function (a, f, o) { 
       
  1309         Native.forEach.call(a || [], f, o || Y);
       
  1310         return Y;
       
  1311     } :
       
  1312     function (a, f, o) { 
       
  1313         var l = (a && a.length) || 0, i;
       
  1314         for (i = 0; i < l; i=i+1) {
       
  1315             f.call(o || Y, a[i], i, a);
       
  1316         }
       
  1317         return Y;
       
  1318     };
       
  1319 
       
  1320 /**
       
  1321  * Returns an object using the first array as keys, and
       
  1322  * the second as values.  If the second array is not
       
  1323  * provided the value is set to true for each.
       
  1324  * @method hash
       
  1325  * @static
       
  1326  * @param k {Array} keyset
       
  1327  * @param v {Array} optional valueset
       
  1328  * @return {object} the hash
       
  1329  */
       
  1330 YArray.hash = function(k, v) {
       
  1331     var o = {}, l = k.length, vl = v && v.length, i;
       
  1332     for (i=0; i<l; i=i+1) {
       
  1333         o[k[i]] = (vl && vl > i) ? v[i] : true;
       
  1334     }
       
  1335 
       
  1336     return o;
       
  1337 };
       
  1338 
       
  1339 /**
       
  1340  * Returns the index of the first item in the array
       
  1341  * that contains the specified value, -1 if the
       
  1342  * value isn't found.
       
  1343  * @method indexOf
       
  1344  * @static
       
  1345  * @param a {Array} the array to search
       
  1346  * @param val the value to search for
       
  1347  * @return {int} the index of the item that contains the value or -1
       
  1348  */
       
  1349 YArray.indexOf = (Native.indexOf) ?
       
  1350     function(a, val) {
       
  1351         return a.indexOf(val);
       
  1352     } :
       
  1353     function(a, val) {
       
  1354         for (var i=0; i<a.length; i=i+1) {
       
  1355             if (a[i] === val) {
       
  1356                 return i;
       
  1357             }
       
  1358         }
       
  1359 
       
  1360         return -1;
       
  1361     };
       
  1362 
       
  1363 /**
       
  1364  * Numeric sort convenience function.
       
  1365  * Y.ArrayAssert.itemsAreEqual([1, 2, 3], [3, 1, 2].sort(Y.Array.numericSort));
       
  1366  * @method numericSort
       
  1367  */
       
  1368 YArray.numericSort = function(a, b) { 
       
  1369     return (a - b); 
       
  1370 };
       
  1371 
       
  1372 /**
       
  1373  * Executes the supplied function on each item in the array.
       
  1374  * Returning true from the processing function will stop the 
       
  1375  * processing of the remaining
       
  1376  * items.
       
  1377  * @method some
       
  1378  * @param a {Array} the array to iterate
       
  1379  * @param f {Function} the function to execute on each item
       
  1380  * @param o Optional context object
       
  1381  * @static
       
  1382  * @return {boolean} true if the function returns true on
       
  1383  * any of the items in the array
       
  1384  */
       
  1385  YArray.some = (Native.some) ?
       
  1386     function (a, f, o) { 
       
  1387         return Native.some.call(a, f, o);
       
  1388     } :
       
  1389     function (a, f, o) {
       
  1390         var l = a.length, i;
       
  1391         for (i=0; i<l; i=i+1) {
       
  1392             if (f.call(o, a[i], i, a)) {
       
  1393                 return true;
       
  1394             }
       
  1395         }
       
  1396         return false;
       
  1397     };
       
  1398 
       
  1399 })();
       
  1400 (function() {
       
  1401 
       
  1402 var L = Y.Lang, 
       
  1403 DELIMITER = '__',
       
  1404 // FROZEN = {
       
  1405 //     'prototype': 1,
       
  1406 //     '_yuid': 1
       
  1407 // },
       
  1408 
       
  1409 /*
       
  1410  * IE will not enumerate native functions in a derived object even if the
       
  1411  * function was overridden.  This is a workaround for specific functions 
       
  1412  * we care about on the Object prototype. 
       
  1413  * @property _iefix
       
  1414  * @for YUI
       
  1415  * @param {Function} r  the object to receive the augmentation
       
  1416  * @param {Function} s  the object that supplies the properties to augment
       
  1417  * @private
       
  1418  */
       
  1419 _iefix = function(r, s) {
       
  1420     var fn = s.toString;
       
  1421     if (L.isFunction(fn) && fn != Object.prototype.toString) {
       
  1422         r.toString = fn;
       
  1423     }
       
  1424 };
       
  1425 
       
  1426 
       
  1427 /**
       
  1428  * Returns a new object containing all of the properties of
       
  1429  * all the supplied objects.  The properties from later objects
       
  1430  * will overwrite those in earlier objects.  Passing in a
       
  1431  * single object will create a shallow copy of it.  For a deep
       
  1432  * copy, use clone.
       
  1433  * @method merge
       
  1434  * @for YUI
       
  1435  * @param arguments {Object*} the objects to merge
       
  1436  * @return {object} the new merged object
       
  1437  */
       
  1438 Y.merge = function() {
       
  1439     var a = arguments, o = {}, i, l = a.length;
       
  1440     for (i=0; i<l; i=i+1) {
       
  1441         Y.mix(o, a[i], true);
       
  1442     }
       
  1443     return o;
       
  1444 };
       
  1445    
       
  1446 /**
       
  1447  * Applies the supplier's properties to the receiver.  By default
       
  1448  * all prototype and static propertes on the supplier are applied
       
  1449  * to the corresponding spot on the receiver.  By default all
       
  1450  * properties are applied, and a property that is already on the
       
  1451  * reciever will not be overwritten.  The default behavior can
       
  1452  * be modified by supplying the appropriate parameters.
       
  1453  *
       
  1454  * @TODO add constants for the modes
       
  1455  *
       
  1456  * @method mix
       
  1457  * @param {Function} r  the object to receive the augmentation
       
  1458  * @param {Function} s  the object that supplies the properties to augment
       
  1459  * @param ov {boolean} if true, properties already on the receiver
       
  1460  * will be overwritten if found on the supplier.
       
  1461  * @param wl {string[]} a whitelist.  If supplied, only properties in 
       
  1462  * this list will be applied to the receiver.
       
  1463  * @param {int} mode what should be copies, and to where
       
  1464  *        default(0): object to object
       
  1465  *        1: prototype to prototype (old augment)
       
  1466  *        2: prototype to prototype and object props (new augment)
       
  1467  *        3: prototype to object
       
  1468  *        4: object to prototype
       
  1469  * @param merge {boolean} merge objects instead of overwriting/ignoring
       
  1470  * Used by Y.aggregate
       
  1471  * @return {object} the augmented object
       
  1472  */
       
  1473 Y.mix = function(r, s, ov, wl, mode, merge) {
       
  1474 
       
  1475     if (!s||!r) {
       
  1476         return r || Y;
       
  1477     }
       
  1478 
       
  1479     if (mode) {
       
  1480         switch (mode) {
       
  1481             case 1: // proto to proto
       
  1482                 return Y.mix(r.prototype, s.prototype);
       
  1483             case 2: // object to object and proto to proto
       
  1484                 Y.mix(r.prototype, s.prototype);
       
  1485                 break; // pass through 
       
  1486             case 3: // proto to static
       
  1487                 return Y.mix(r, s.prototype);
       
  1488             case 4: // static to proto
       
  1489                 return Y.mix(r.prototype, s);
       
  1490             default:  // object to object is what happens below
       
  1491         }
       
  1492     }
       
  1493 
       
  1494     // Maybe don't even need this wl && wl.length check anymore??
       
  1495     var arr = merge && L.isArray(r), i, l, p;
       
  1496 
       
  1497     if (wl && wl.length) {
       
  1498         for (i = 0, l = wl.length; i < l; ++i) {
       
  1499             p = wl[i];
       
  1500             if (p in s) {
       
  1501                 if (merge && L.isObject(r[p], true)) {
       
  1502                     Y.mix(r[p], s[p]);
       
  1503                 } else if (!arr && (ov || !(p in r))) {
       
  1504                     r[p] = s[p];
       
  1505                 } else if (arr) {
       
  1506                     r.push(s[p]);
       
  1507                 }
       
  1508             }
       
  1509         }
       
  1510     } else {
       
  1511         for (i in s) { 
       
  1512             // if (s.hasOwnProperty(i) && !(i in FROZEN)) {
       
  1513                 // check white list if it was supplied
       
  1514                 // if the receiver has this property, it is an object,
       
  1515                 // and merge is specified, merge the two objects.
       
  1516                 if (merge && L.isObject(r[i], true)) {
       
  1517                     Y.mix(r[i], s[i]); // recursive
       
  1518                 // otherwise apply the property only if overwrite
       
  1519                 // is specified or the receiver doesn't have one.
       
  1520                 } else if (!arr && (ov || !(i in r))) {
       
  1521                     r[i] = s[i];
       
  1522                 // if merge is specified and the receiver is an array,
       
  1523                 // append the array item
       
  1524                 } else if (arr) {
       
  1525                     r.push(s[i]);
       
  1526                 }
       
  1527             // }
       
  1528         }
       
  1529     
       
  1530         if (Y.UA.ie) {
       
  1531             _iefix(r, s);
       
  1532         }
       
  1533     }
       
  1534 
       
  1535     return r;
       
  1536 };
       
  1537 
       
  1538 /**
       
  1539  * Returns a wrapper for a function which caches the
       
  1540  * return value of that function, keyed off of the combined 
       
  1541  * argument values.
       
  1542  * @function cached
       
  1543  * @param source {function} the function to memoize
       
  1544  * @param cache an optional cache seed
       
  1545  * @return {Function} the wrapped function
       
  1546  */
       
  1547 Y.cached = function(source, cache){
       
  1548     cache = cache || {};
       
  1549 
       
  1550     // I want the profiler to show me separate entries for each
       
  1551     // cached function.  Is this too much to ask?
       
  1552     
       
  1553     // return function cached_sourceFunction
       
  1554     // return this['cached_' + source.name] = function
       
  1555     // var a = function(){}; a.name = 'foo'; return a;
       
  1556 
       
  1557     return function cached(arg1, arg2) {
       
  1558 
       
  1559         // (?)()   51  5.76%   0.571ms 1.01ms  0.02ms  0.001ms 0.041ms
       
  1560         // A() 76  6.58%   0.652ms 0.652ms 0.009ms 0.005ms 0.03ms
       
  1561         // var key = (arg2 !== undefined) ? Y.Array(arguments, 0, true).join(DELIMITER) : arg1;
       
  1562 
       
  1563         // (?)()   51  8.57%   0.837ms 0.838ms 0.016ms 0.013ms 0.024ms
       
  1564         // var key = (arguments.length > 1) ? Array.prototype.join.call(arguments, DELIMITER) : arg1;
       
  1565 
       
  1566         // (?)()   51  8.06%  0.761ms 0.762ms 0.015ms 0.002ms 0.025ms
       
  1567         // var key = (arg2 !== undefined) ? Array.prototype.join.call(arguments, DELIMITER) : arg1;
       
  1568         
       
  1569         // (?)()   51  7.87%   0.749ms 0.751ms 0.015ms 0.001ms 0.027ms
       
  1570         // A() 30  2.23%   0.214ms 0.214ms 0.007ms 0.005ms 0.009ms
       
  1571         var key = (arg2) ? Array.prototype.join.call(arguments, DELIMITER) : arg1;
       
  1572 
       
  1573         if (!(key in cache)) {
       
  1574             cache[key] = source.apply(source, arguments);
       
  1575         }
       
  1576 
       
  1577         return cache[key];
       
  1578     };
       
  1579 
       
  1580 };
       
  1581 
       
  1582 })();
       
  1583 
       
  1584 (function() {
       
  1585 
       
  1586 /**
       
  1587  * Adds the following Object utilities to the YUI instance
       
  1588  * @class Object
       
  1589  */
       
  1590 
       
  1591 /**
       
  1592  * Y.Object(o) returns a new object based upon the supplied object.  
       
  1593  * @TODO Use native Object.create() when available
       
  1594  * @method ()
       
  1595  * @static
       
  1596  * @param o the supplier object
       
  1597  * @return {Object} the new object
       
  1598  */
       
  1599 Y.Object = function(o) {
       
  1600     var F = function() {};
       
  1601     F.prototype = o;
       
  1602     return new F();
       
  1603 }; 
       
  1604 
       
  1605 var O = Y.Object,
       
  1606 
       
  1607 UNDEFINED = undefined,
       
  1608 
       
  1609 /**
       
  1610  * Extracts the keys, values, or size from an object
       
  1611  * 
       
  1612  * @method _extract
       
  1613  * @param o the object
       
  1614  * @param what what to extract (0: keys, 1: values, 2: size)
       
  1615  * @return {boolean|Array} the extracted info
       
  1616  * @static
       
  1617  * @private
       
  1618  */
       
  1619 _extract = function(o, what) {
       
  1620     var count = (what === 2), out = (count) ? 0 : [], i;
       
  1621 
       
  1622     for (i in o) {
       
  1623         if (count) {
       
  1624             out++;
       
  1625         } else {
       
  1626             if (o.hasOwnProperty(i)) {
       
  1627                 out.push((what) ? o[i] : i);
       
  1628             }
       
  1629         }
       
  1630     }
       
  1631 
       
  1632     return out;
       
  1633 };
       
  1634 
       
  1635 /**
       
  1636  * Returns an array containing the object's keys
       
  1637  * @TODO use native Object.keys() if available
       
  1638  * @method keys
       
  1639  * @static
       
  1640  * @param o an object
       
  1641  * @return {string[]} the keys
       
  1642  */
       
  1643 O.keys = function(o) {
       
  1644     return _extract(o);
       
  1645 };
       
  1646 
       
  1647 /**
       
  1648  * Returns an array containing the object's values
       
  1649  * @TODO use native Object.values() if available
       
  1650  * @method values
       
  1651  * @static
       
  1652  * @param o an object
       
  1653  * @return {Array} the values
       
  1654  */
       
  1655 O.values = function(o) {
       
  1656     return _extract(o, 1);
       
  1657 };
       
  1658 
       
  1659 /**
       
  1660  * Returns the size of an object
       
  1661  * @TODO use native Object.size() if available
       
  1662  * @method size
       
  1663  * @static
       
  1664  * @param o an object
       
  1665  * @return {int} the size
       
  1666  */
       
  1667 O.size = function(o) {
       
  1668     return _extract(o, 2);
       
  1669 };
       
  1670 
       
  1671 /**
       
  1672  * Returns true if the object contains a given key
       
  1673  * @method hasKey
       
  1674  * @static
       
  1675  * @param o an object
       
  1676  * @param k the key to query
       
  1677  * @return {boolean} true if the object contains the key
       
  1678  */
       
  1679 O.hasKey = function(o, k) {
       
  1680     // return (o.hasOwnProperty(k));
       
  1681     return (k in o);
       
  1682 };
       
  1683 
       
  1684 /**
       
  1685  * Returns true if the object contains a given value
       
  1686  * @method hasValue
       
  1687  * @static
       
  1688  * @param o an object
       
  1689  * @param v the value to query
       
  1690  * @return {boolean} true if the object contains the value
       
  1691  */
       
  1692 O.hasValue = function(o, v) {
       
  1693     return (Y.Array.indexOf(O.values(o), v) > -1);
       
  1694 };
       
  1695 
       
  1696 /**
       
  1697  * Determines whether or not the property was added
       
  1698  * to the object instance.  Returns false if the property is not present
       
  1699  * in the object, or was inherited from the prototype.
       
  1700  *
       
  1701  * @deprecated Safari 1.x support has been removed, so this is simply a 
       
  1702  * wrapper for the native implementation.  Use the native implementation
       
  1703  * directly instead.
       
  1704  *
       
  1705  * @TODO Remove in B1
       
  1706  *
       
  1707  * @method owns
       
  1708  * @static
       
  1709  * @param o {any} The object being testing
       
  1710  * @param p {string} the property to look for
       
  1711  * @return {boolean} true if the object has the property on the instance
       
  1712  */
       
  1713 O.owns = function(o, k) {
       
  1714     return (o.hasOwnProperty(k));
       
  1715 };
       
  1716 
       
  1717 /**
       
  1718  * Executes a function on each item. The function
       
  1719  * receives the value, the key, and the object
       
  1720  * as paramters (in that order).
       
  1721  * @method each
       
  1722  * @static
       
  1723  * @param o the object to iterate
       
  1724  * @param f {function} the function to execute
       
  1725  * @param c the execution context
       
  1726  * @param proto {boolean} include proto
       
  1727  * @return {YUI} the YUI instance
       
  1728  */
       
  1729 O.each = function (o, f, c, proto) {
       
  1730     var s = c || Y, i;
       
  1731 
       
  1732     for (i in o) {
       
  1733         if (proto || o.hasOwnProperty(i)) {
       
  1734             f.call(s, o[i], i, o);
       
  1735         }
       
  1736     }
       
  1737     return Y;
       
  1738 };
       
  1739 
       
  1740 /**
       
  1741  * Retrieves the sub value at the provided path,
       
  1742  * from the value object provided.
       
  1743  *
       
  1744  * @method getValue
       
  1745  * @param o The object from which to extract the property value
       
  1746  * @param path {Array} A path array, specifying the object traversal path
       
  1747  * from which to obtain the sub value.
       
  1748  * @return {Any} The value stored in the path, undefined if not found.
       
  1749  * Returns the source object if an empty path is provided.
       
  1750  */
       
  1751 O.getValue = function (o, path) {
       
  1752     var p=Y.Array(path), l=p.length, i;
       
  1753 
       
  1754     for (i=0; o !== UNDEFINED && i < l; i=i+1) {
       
  1755         o = o[p[i]];
       
  1756     }
       
  1757 
       
  1758     return o;
       
  1759 };
       
  1760 
       
  1761 /**
       
  1762  * Sets the sub-attribute value at the provided path on the 
       
  1763  * value object.  Returns the modified value object, or 
       
  1764  * undefined if the path is invalid.
       
  1765  *
       
  1766  * @method setValue
       
  1767  * @param o             The object on which to set the sub value.
       
  1768  * @param path {Array}  A path array, specifying the object traversal path
       
  1769  *                      at which to set the sub value.
       
  1770  * @param val {Any}     The new value for the sub-attribute.
       
  1771  * @return {Object}     The modified object, with the new sub value set, or 
       
  1772  *                      undefined, if the path was invalid.
       
  1773  */
       
  1774 O.setValue = function(o, path, val) {
       
  1775 
       
  1776     var p=Y.Array(path), leafIdx=p.length-1, i, ref=o;
       
  1777 
       
  1778     if (leafIdx >= 0) {
       
  1779         for (i=0; ref !== UNDEFINED && i < leafIdx; i=i+1) {
       
  1780             ref = ref[p[i]];
       
  1781         }
       
  1782 
       
  1783         if (ref !== UNDEFINED) {
       
  1784             ref[p[i]] = val;
       
  1785         } else {
       
  1786             return UNDEFINED;
       
  1787         }
       
  1788     }
       
  1789 
       
  1790     return o;
       
  1791 };
       
  1792 
       
  1793 
       
  1794 })();
       
  1795 
       
  1796 /*
       
  1797  * Provides information about the environment hosting YUI
       
  1798  * @module yui
       
  1799  * @submodule UA
       
  1800  */
       
  1801 /**
       
  1802  * YUI user agent detection.
       
  1803  * Do not fork for a browser if it can be avoided.  Use feature detection when
       
  1804  * you can.  Use the user agent as a last resort.  UA stores a version
       
  1805  * number for the browser engine, 0 otherwise.  This value may or may not map
       
  1806  * to the version number of the browser using the engine.  The value is 
       
  1807  * presented as a float so that it can easily be used for boolean evaluation 
       
  1808  * as well as for looking for a particular range of versions.  Because of this, 
       
  1809  * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9 
       
  1810  * reports 1.8).
       
  1811  * @class UA
       
  1812  * @static
       
  1813  */
       
  1814 Y.UA = function() {
       
  1815 
       
  1816     var nav = navigator,
       
  1817         o = {
       
  1818 
       
  1819         /**
       
  1820          * Internet Explorer version number or 0.  Example: 6
       
  1821          * @property ie
       
  1822          * @type float
       
  1823          * @static
       
  1824          */
       
  1825         ie:0,
       
  1826 
       
  1827         /**
       
  1828          * Opera version number or 0.  Example: 9.2
       
  1829          * @property opera
       
  1830          * @type float
       
  1831          * @static
       
  1832          */
       
  1833         opera:0,
       
  1834 
       
  1835         /**
       
  1836          * Gecko engine revision number.  Will evaluate to 1 if Gecko 
       
  1837          * is detected but the revision could not be found. Other browsers
       
  1838          * will be 0.  Example: 1.8
       
  1839          * <pre>
       
  1840          * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
       
  1841          * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
       
  1842          * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
       
  1843          * Firefox 3 alpha: 1.9a4   <-- Reports 1.9
       
  1844          * </pre>
       
  1845          * @property gecko
       
  1846          * @type float
       
  1847          * @static
       
  1848          */
       
  1849         gecko:0,
       
  1850 
       
  1851         /**
       
  1852          * AppleWebKit version.  KHTML browsers that are not WebKit browsers 
       
  1853          * will evaluate to 1, other browsers 0.  Example: 418.9
       
  1854          * <pre>
       
  1855          * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 
       
  1856          *                                   latest available for Mac OSX 10.3.
       
  1857          * Safari 2.0.2:         416     <-- hasOwnProperty introduced
       
  1858          * Safari 2.0.4:         418     <-- preventDefault fixed
       
  1859          * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
       
  1860          *                                   different versions of webkit
       
  1861          * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
       
  1862          *                                   updated, but not updated
       
  1863          *                                   to the latest patch.
       
  1864          * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native SVG
       
  1865          *                                   and many major issues fixed).
       
  1866          * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic update
       
  1867          *                                   from 2.x via the 10.4.11 OS patch
       
  1868          * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
       
  1869          *                                   yahoo.com user agent hack removed.
       
  1870          * </pre>
       
  1871          * http://en.wikipedia.org/wiki/Safari_(web_browser)#Version_history
       
  1872          * @property webkit
       
  1873          * @type float
       
  1874          * @static
       
  1875          */
       
  1876         webkit:0,
       
  1877 
       
  1878         /**
       
  1879          * The mobile property will be set to a string containing any relevant
       
  1880          * user agent information when a modern mobile browser is detected.
       
  1881          * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
       
  1882          * devices with the WebKit-based browser, and Opera Mini.  
       
  1883          * @property mobile 
       
  1884          * @type string
       
  1885          * @static
       
  1886          */
       
  1887         mobile: null,
       
  1888 
       
  1889         /**
       
  1890          * Adobe AIR version number or 0.  Only populated if webkit is detected.
       
  1891          * Example: 1.0
       
  1892          * @property air
       
  1893          * @type float
       
  1894          */
       
  1895         air: 0,
       
  1896 
       
  1897         /**
       
  1898          * Google Caja version number or 0.
       
  1899          * @property caja
       
  1900          * @type float
       
  1901          */
       
  1902         caja: nav.cajaVersion,
       
  1903 
       
  1904         /**
       
  1905          * Set to true if the page appears to be in SSL
       
  1906          * @property secure
       
  1907          * @type boolean
       
  1908          * @static
       
  1909          */
       
  1910         secure: false,
       
  1911 
       
  1912         /**
       
  1913          * The operating system.  Currently only detecting windows or macintosh
       
  1914          * @property os
       
  1915          * @type string
       
  1916          * @static
       
  1917          */
       
  1918         os: null
       
  1919         
       
  1920     },
       
  1921 
       
  1922     ua = nav && nav.userAgent, 
       
  1923 
       
  1924     loc = Y.config.win.location,
       
  1925 
       
  1926     href = loc && loc.href,
       
  1927     
       
  1928     m;
       
  1929 
       
  1930     o.secure = href && (href.toLowerCase().indexOf("https") === 0);
       
  1931 
       
  1932     if (ua) {
       
  1933 
       
  1934         if ((/windows|win32/).test(ua)) {
       
  1935             o.os = 'windows';
       
  1936         } else if ((/macintosh/).test(ua)) {
       
  1937             o.os = 'macintosh';
       
  1938         }
       
  1939 
       
  1940         // Modern KHTML browsers should qualify as Safari X-Grade
       
  1941         if ((/KHTML/).test(ua)) {
       
  1942             o.webkit=1;
       
  1943         }
       
  1944         // Modern WebKit browsers are at least X-Grade
       
  1945         m=ua.match(/AppleWebKit\/([^\s]*)/);
       
  1946         if (m&&m[1]) {
       
  1947             o.webkit=parseFloat(m[1]);
       
  1948 
       
  1949             // Mobile browser check
       
  1950             if (/ Mobile\//.test(ua)) {
       
  1951                 o.mobile = "Apple"; // iPhone or iPod Touch
       
  1952             } else {
       
  1953                 m=ua.match(/NokiaN[^\/]*/);
       
  1954                 if (m) {
       
  1955                     o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
       
  1956                 }
       
  1957             }
       
  1958 
       
  1959             m=ua.match(/AdobeAIR\/([^\s]*)/);
       
  1960             if (m) {
       
  1961                 o.air = m[0]; // Adobe AIR 1.0 or better
       
  1962             }
       
  1963 
       
  1964         }
       
  1965 
       
  1966         if (!o.webkit) { // not webkit
       
  1967             // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
       
  1968             m=ua.match(/Opera[\s\/]([^\s]*)/);
       
  1969             if (m&&m[1]) {
       
  1970                 o.opera=parseFloat(m[1]);
       
  1971                 m=ua.match(/Opera Mini[^;]*/);
       
  1972                 if (m) {
       
  1973                     o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
       
  1974                 }
       
  1975             } else { // not opera or webkit
       
  1976                 m=ua.match(/MSIE\s([^;]*)/);
       
  1977                 if (m&&m[1]) {
       
  1978                     o.ie=parseFloat(m[1]);
       
  1979                 } else { // not opera, webkit, or ie
       
  1980                     m=ua.match(/Gecko\/([^\s]*)/);
       
  1981                     if (m) {
       
  1982                         o.gecko=1; // Gecko detected, look for revision
       
  1983                         m=ua.match(/rv:([^\s\)]*)/);
       
  1984                         if (m&&m[1]) {
       
  1985                             o.gecko=parseFloat(m[1]);
       
  1986                         }
       
  1987                     }
       
  1988                 }
       
  1989             }
       
  1990         }
       
  1991     }
       
  1992     
       
  1993     return o;
       
  1994 }();
       
  1995 (function() {
       
  1996     var L = Y.Lang,
       
  1997 
       
  1998     /**
       
  1999      * Executes the supplied function in the context of the supplied 
       
  2000      * object 'when' milliseconds later.  Executes the function a 
       
  2001      * single time unless periodic is set to true.
       
  2002      * @method later
       
  2003      * @for YUI
       
  2004      * @param when {int} the number of milliseconds to wait until the fn 
       
  2005      * is executed.
       
  2006      * @param o the context object.
       
  2007      * @param fn {Function|String} the function to execute or the name of 
       
  2008      * the method in the 'o' object to execute.
       
  2009      * @param data [Array] data that is provided to the function.  This accepts
       
  2010      * either a single item or an array.  If an array is provided, the
       
  2011      * function is executed with one parameter for each array item.  If
       
  2012      * you need to pass a single array parameter, it needs to be wrapped in
       
  2013      * an array [myarray].
       
  2014      * @param periodic {boolean} if true, executes continuously at supplied 
       
  2015      * interval until canceled.
       
  2016      * @return {object} a timer object. Call the cancel() method on this object to 
       
  2017      * stop the timer.
       
  2018      */
       
  2019     later = function(when, o, fn, data, periodic) {
       
  2020         when = when || 0; 
       
  2021         o = o || {};
       
  2022         var m=fn, d=data, f, r;
       
  2023 
       
  2024         if (L.isString(fn)) {
       
  2025             m = o[fn];
       
  2026         }
       
  2027 
       
  2028         if (!m) {
       
  2029             Y.error("method undefined");
       
  2030         }
       
  2031 
       
  2032         if (!L.isArray(d)) {
       
  2033             d = [data];
       
  2034         }
       
  2035 
       
  2036         f = function() {
       
  2037             m.apply(o, d);
       
  2038         };
       
  2039 
       
  2040         r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
       
  2041 
       
  2042         return {
       
  2043             id: r,
       
  2044             interval: periodic,
       
  2045             cancel: function() {
       
  2046                 if (this.interval) {
       
  2047                     clearInterval(r);
       
  2048                 } else {
       
  2049                     clearTimeout(r);
       
  2050                 }
       
  2051             }
       
  2052         };
       
  2053     };
       
  2054 
       
  2055     Y.later = later;
       
  2056     L.later = later;
       
  2057 
       
  2058 })();
       
  2059 (function() {
       
  2060 
       
  2061     // var min = ['yui-base', 'log', 'lang', 'array', 'core'], core, C = Y.config;
       
  2062     var min = ['yui-base'], core, C = Y.config;
       
  2063 
       
  2064     // apply the minimal required functionality
       
  2065     Y.use.apply(Y, min);
       
  2066 
       
  2067     Y.log(Y.id + ' initialized', 'info', 'yui');
       
  2068 
       
  2069     if (C.core) {
       
  2070 
       
  2071         core = C.core;
       
  2072 
       
  2073     } else {
       
  2074 
       
  2075         core = ['queue-base', 'get', 'loader'];
       
  2076     }
       
  2077 
       
  2078     Y.use.apply(Y, core);
       
  2079 
       
  2080      
       
  2081 })();
       
  2082 
       
  2083 
       
  2084 
       
  2085 }, '3.0.0b1' );