[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/yuilib/2in3/2.9.0/build/yui2-yuiloader/ -> yui2-yuiloader-debug.js (source)

   1  YUI.add('yui2-yahoo', function(Y) { Y.use('yui2-yuiloader'); }, '3.3.0' ,{});
   2  YUI.add('yui2-get', function(Y) { Y.use('yui2-yuiloader'); }, '3.3.0' ,{"requires": ["yui2-yahoo"]});
   3  YUI.add('yui2-yuiloader', function(Y) {
   4      /*
   5  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
   6  Code licensed under the BSD License:
   7  http://developer.yahoo.com/yui/license.html
   8  version: 2.9.0
   9  */
  10  /**
  11   * The YAHOO object is the single global object used by YUI Library.  It
  12   * contains utility function for setting up namespaces, inheritance, and
  13   * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
  14   * created automatically for and used by the library.
  15   * @module yahoo
  16   * @title  YAHOO Global
  17   */
  18  
  19  /**
  20   * YAHOO_config is not included as part of the library.  Instead it is an
  21   * object that can be defined by the implementer immediately before
  22   * including the YUI library.  The properties included in this object
  23   * will be used to configure global properties needed as soon as the
  24   * library begins to load.
  25   * @class YAHOO_config
  26   * @static
  27   */
  28  
  29  /**
  30   * A reference to a function that will be executed every time a YAHOO module
  31   * is loaded.  As parameter, this function will receive the version
  32   * information for the module. See <a href="YAHOO.env.html#getVersion">
  33   * YAHOO.env.getVersion</a> for the description of the version data structure.
  34   * @property listener
  35   * @type Function
  36   * @static
  37   * @default undefined
  38   */
  39  
  40  /**
  41   * Set to true if the library will be dynamically loaded after window.onload.
  42   * Defaults to false
  43   * @property injecting
  44   * @type boolean
  45   * @static
  46   * @default undefined
  47   */
  48  
  49  /**
  50   * Instructs the yuiloader component to dynamically load yui components and
  51   * their dependencies.  See the yuiloader documentation for more information
  52   * about dynamic loading
  53   * @property load
  54   * @static
  55   * @default undefined
  56   * @see yuiloader
  57   */
  58  
  59  /**
  60   * Forces the use of the supplied locale where applicable in the library
  61   * @property locale
  62   * @type string
  63   * @static
  64   * @default undefined
  65   */
  66  
  67  if (typeof YAHOO == "undefined" || !YAHOO) {
  68      /**
  69       * The YAHOO global namespace object.  If YAHOO is already defined, the
  70       * existing YAHOO object will not be overwritten so that defined
  71       * namespaces are preserved.
  72       * @class YAHOO
  73       * @static
  74       */
  75      var YAHOO = {};
  76  }
  77  
  78  /**
  79   * Returns the namespace specified and creates it if it doesn't exist
  80   * <pre>
  81   * YAHOO.namespace("property.package");
  82   * YAHOO.namespace("YAHOO.property.package");
  83   * </pre>
  84   * Either of the above would create YAHOO.property, then
  85   * YAHOO.property.package
  86   *
  87   * Be careful when naming packages. Reserved words may work in some browsers
  88   * and not others. For instance, the following will fail in Safari:
  89   * <pre>
  90   * YAHOO.namespace("really.long.nested.namespace");
  91   * </pre>
  92   * This fails because "long" is a future reserved word in ECMAScript
  93   *
  94   * For implementation code that uses YUI, do not create your components
  95   * in the namespaces defined by YUI (
  96   * <code>YAHOO.util</code>,
  97   * <code>YAHOO.widget</code>,
  98   * <code>YAHOO.lang</code>,
  99   * <code>YAHOO.tool</code>,
 100   * <code>YAHOO.example</code>,
 101   * <code>YAHOO.env</code>) -- create your own namespace (e.g., 'companyname').
 102   *
 103   * @method namespace
 104   * @static
 105   * @param  {String*} arguments 1-n namespaces to create
 106   * @return {Object}  A reference to the last namespace object created
 107   */
 108  YAHOO.namespace = function() {
 109      var a=arguments, o=null, i, j, d;
 110      for (i=0; i<a.length; i=i+1) {
 111          d=(""+a[i]).split(".");
 112          o=YAHOO;
 113  
 114          // YAHOO is implied, so it is ignored if it is included
 115          for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
 116              o[d[j]]=o[d[j]] || {};
 117              o=o[d[j]];
 118          }
 119      }
 120  
 121      return o;
 122  };
 123  
 124  /**
 125   * Uses YAHOO.widget.Logger to output a log message, if the widget is
 126   * available.
 127   * Note: LogReader adds the message, category, and source to the DOM as HTML.
 128   *
 129   * @method log
 130   * @static
 131   * @param  {HTML}  msg  The message to log.
 132   * @param  {HTML}  cat  The log category for the message.  Default
 133   *                        categories are "info", "warn", "error", time".
 134   *                        Custom categories can be used as well. (opt)
 135   * @param  {HTML}  src  The source of the the message (opt)
 136   * @return {Boolean}      True if the log operation was successful.
 137   */
 138  YAHOO.log = function(msg, cat, src) {
 139      var l=YAHOO.widget.Logger;
 140      if(l && l.log) {
 141          return l.log(msg, cat, src);
 142      } else {
 143          return false;
 144      }
 145  };
 146  
 147  /**
 148   * Registers a module with the YAHOO object
 149   * @method register
 150   * @static
 151   * @param {String}   name    the name of the module (event, slider, etc)
 152   * @param {Function} mainClass a reference to class in the module.  This
 153   *                             class will be tagged with the version info
 154   *                             so that it will be possible to identify the
 155   *                             version that is in use when multiple versions
 156   *                             have loaded
 157   * @param {Object}   data      metadata object for the module.  Currently it
 158   *                             is expected to contain a "version" property
 159   *                             and a "build" property at minimum.
 160   */
 161  YAHOO.register = function(name, mainClass, data) {
 162      var mods = YAHOO.env.modules, m, v, b, ls, i;
 163  
 164      if (!mods[name]) {
 165          mods[name] = {
 166              versions:[],
 167              builds:[]
 168          };
 169      }
 170  
 171      m  = mods[name];
 172      v  = data.version;
 173      b  = data.build;
 174      ls = YAHOO.env.listeners;
 175  
 176      m.name = name;
 177      m.version = v;
 178      m.build = b;
 179      m.versions.push(v);
 180      m.builds.push(b);
 181      m.mainClass = mainClass;
 182  
 183      // fire the module load listeners
 184      for (i=0;i<ls.length;i=i+1) {
 185          ls[i](m);
 186      }
 187      // label the main class
 188      if (mainClass) {
 189          mainClass.VERSION = v;
 190          mainClass.BUILD = b;
 191      } else {
 192          YAHOO.log("mainClass is undefined for module " + name, "warn");
 193      }
 194  };
 195  
 196  /**
 197   * YAHOO.env is used to keep track of what is known about the YUI library and
 198   * the browsing environment
 199   * @class YAHOO.env
 200   * @static
 201   */
 202  YAHOO.env = YAHOO.env || {
 203  
 204      /**
 205       * Keeps the version info for all YUI modules that have reported themselves
 206       * @property modules
 207       * @type Object[]
 208       */
 209      modules: [],
 210  
 211      /**
 212       * List of functions that should be executed every time a YUI module
 213       * reports itself.
 214       * @property listeners
 215       * @type Function[]
 216       */
 217      listeners: []
 218  };
 219  
 220  /**
 221   * Returns the version data for the specified module:
 222   *      <dl>
 223   *      <dt>name:</dt>      <dd>The name of the module</dd>
 224   *      <dt>version:</dt>   <dd>The version in use</dd>
 225   *      <dt>build:</dt>     <dd>The build number in use</dd>
 226   *      <dt>versions:</dt>  <dd>All versions that were registered</dd>
 227   *      <dt>builds:</dt>    <dd>All builds that were registered.</dd>
 228   *      <dt>mainClass:</dt> <dd>An object that was was stamped with the
 229   *                 current version and build. If
 230   *                 mainClass.VERSION != version or mainClass.BUILD != build,
 231   *                 multiple versions of pieces of the library have been
 232   *                 loaded, potentially causing issues.</dd>
 233   *       </dl>
 234   *
 235   * @method getVersion
 236   * @static
 237   * @param {String}  name the name of the module (event, slider, etc)
 238   * @return {Object} The version info
 239   */
 240  YAHOO.env.getVersion = function(name) {
 241      return YAHOO.env.modules[name] || null;
 242  };
 243  
 244  /**
 245   * Do not fork for a browser if it can be avoided.  Use feature detection when
 246   * you can.  Use the user agent as a last resort.  YAHOO.env.ua stores a version
 247   * number for the browser engine, 0 otherwise.  This value may or may not map
 248   * to the version number of the browser using the engine.  The value is
 249   * presented as a float so that it can easily be used for boolean evaluation
 250   * as well as for looking for a particular range of versions.  Because of this,
 251   * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
 252   * reports 1.8).
 253   * @class YAHOO.env.ua
 254   * @static
 255   */
 256  
 257  /**
 258   * parses a user agent string (or looks for one in navigator to parse if
 259   * not supplied).
 260   * @method parseUA
 261   * @since 2.9.0
 262   * @static
 263   */
 264  YAHOO.env.parseUA = function(agent) {
 265  
 266          var numberify = function(s) {
 267              var c = 0;
 268              return parseFloat(s.replace(/\./g, function() {
 269                  return (c++ == 1) ? '' : '.';
 270              }));
 271          },
 272  
 273          nav = navigator,
 274  
 275          o = {
 276  
 277          /**
 278           * Internet Explorer version number or 0.  Example: 6
 279           * @property ie
 280           * @type float
 281           * @static
 282           */
 283          ie: 0,
 284  
 285          /**
 286           * Opera version number or 0.  Example: 9.2
 287           * @property opera
 288           * @type float
 289           * @static
 290           */
 291          opera: 0,
 292  
 293          /**
 294           * Gecko engine revision number.  Will evaluate to 1 if Gecko
 295           * is detected but the revision could not be found. Other browsers
 296           * will be 0.  Example: 1.8
 297           * <pre>
 298           * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
 299           * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
 300           * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
 301           * Firefox 3.0   <-- 1.9
 302           * Firefox 3.5   <-- 1.91
 303           * </pre>
 304           * @property gecko
 305           * @type float
 306           * @static
 307           */
 308          gecko: 0,
 309  
 310          /**
 311           * AppleWebKit version.  KHTML browsers that are not WebKit browsers
 312           * will evaluate to 1, other browsers 0.  Example: 418.9
 313           * <pre>
 314           * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
 315           *                                   latest available for Mac OSX 10.3.
 316           * Safari 2.0.2:         416     <-- hasOwnProperty introduced
 317           * Safari 2.0.4:         418     <-- preventDefault fixed
 318           * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
 319           *                                   different versions of webkit
 320           * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
 321           *                                   updated, but not updated
 322           *                                   to the latest patch.
 323           * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native
 324           * SVG and many major issues fixed).
 325           * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic
 326           * update from 2.x via the 10.4.11 OS patch.
 327           * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
 328           *                                   yahoo.com user agent hack removed.
 329           * </pre>
 330           * http://en.wikipedia.org/wiki/Safari_version_history
 331           * @property webkit
 332           * @type float
 333           * @static
 334           */
 335          webkit: 0,
 336  
 337          /**
 338           * Chrome will be detected as webkit, but this property will also
 339           * be populated with the Chrome version number
 340           * @property chrome
 341           * @type float
 342           * @static
 343           */
 344          chrome: 0,
 345  
 346          /**
 347           * The mobile property will be set to a string containing any relevant
 348           * user agent information when a modern mobile browser is detected.
 349           * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
 350           * devices with the WebKit-based browser, and Opera Mini.
 351           * @property mobile
 352           * @type string
 353           * @static
 354           */
 355          mobile: null,
 356  
 357          /**
 358           * Adobe AIR version number or 0.  Only populated if webkit is detected.
 359           * Example: 1.0
 360           * @property air
 361           * @type float
 362           */
 363          air: 0,
 364          /**
 365           * Detects Apple iPad's OS version
 366           * @property ipad
 367           * @type float
 368           * @static
 369           */
 370          ipad: 0,
 371          /**
 372           * Detects Apple iPhone's OS version
 373           * @property iphone
 374           * @type float
 375           * @static
 376           */
 377          iphone: 0,
 378          /**
 379           * Detects Apples iPod's OS version
 380           * @property ipod
 381           * @type float
 382           * @static
 383           */
 384          ipod: 0,
 385          /**
 386           * General truthy check for iPad, iPhone or iPod
 387           * @property ios
 388           * @type float
 389           * @static
 390           */
 391          ios: null,
 392          /**
 393           * Detects Googles Android OS version
 394           * @property android
 395           * @type float
 396           * @static
 397           */
 398          android: 0,
 399          /**
 400           * Detects Palms WebOS version
 401           * @property webos
 402           * @type float
 403           * @static
 404           */
 405          webos: 0,
 406  
 407          /**
 408           * Google Caja version number or 0.
 409           * @property caja
 410           * @type float
 411           */
 412          caja: nav && nav.cajaVersion,
 413  
 414          /**
 415           * Set to true if the page appears to be in SSL
 416           * @property secure
 417           * @type boolean
 418           * @static
 419           */
 420          secure: false,
 421  
 422          /**
 423           * The operating system.  Currently only detecting windows or macintosh
 424           * @property os
 425           * @type string
 426           * @static
 427           */
 428          os: null
 429  
 430      },
 431  
 432      ua = agent || (navigator && navigator.userAgent),
 433  
 434      loc = window && window.location,
 435  
 436      href = loc && loc.href,
 437  
 438      m;
 439  
 440      o.secure = href && (href.toLowerCase().indexOf("https") === 0);
 441  
 442      if (ua) {
 443  
 444          if ((/windows|win32/i).test(ua)) {
 445              o.os = 'windows';
 446          } else if ((/macintosh/i).test(ua)) {
 447              o.os = 'macintosh';
 448          } else if ((/rhino/i).test(ua)) {
 449              o.os = 'rhino';
 450          }
 451  
 452          // Modern KHTML browsers should qualify as Safari X-Grade
 453          if ((/KHTML/).test(ua)) {
 454              o.webkit = 1;
 455          }
 456          // Modern WebKit browsers are at least X-Grade
 457          m = ua.match(/AppleWebKit\/([^\s]*)/);
 458          if (m && m[1]) {
 459              o.webkit = numberify(m[1]);
 460  
 461              // Mobile browser check
 462              if (/ Mobile\//.test(ua)) {
 463                  o.mobile = 'Apple'; // iPhone or iPod Touch
 464  
 465                  m = ua.match(/OS ([^\s]*)/);
 466                  if (m && m[1]) {
 467                      m = numberify(m[1].replace('_', '.'));
 468                  }
 469                  o.ios = m;
 470                  o.ipad = o.ipod = o.iphone = 0;
 471  
 472                  m = ua.match(/iPad|iPod|iPhone/);
 473                  if (m && m[0]) {
 474                      o[m[0].toLowerCase()] = o.ios;
 475                  }
 476              } else {
 477                  m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);
 478                  if (m) {
 479                      // Nokia N-series, Android, webOS, ex: NokiaN95
 480                      o.mobile = m[0];
 481                  }
 482                  if (/webOS/.test(ua)) {
 483                      o.mobile = 'WebOS';
 484                      m = ua.match(/webOS\/([^\s]*);/);
 485                      if (m && m[1]) {
 486                          o.webos = numberify(m[1]);
 487                      }
 488                  }
 489                  if (/ Android/.test(ua)) {
 490                      o.mobile = 'Android';
 491                      m = ua.match(/Android ([^\s]*);/);
 492                      if (m && m[1]) {
 493                          o.android = numberify(m[1]);
 494                      }
 495  
 496                  }
 497              }
 498  
 499              m = ua.match(/Chrome\/([^\s]*)/);
 500              if (m && m[1]) {
 501                  o.chrome = numberify(m[1]); // Chrome
 502              } else {
 503                  m = ua.match(/AdobeAIR\/([^\s]*)/);
 504                  if (m) {
 505                      o.air = m[0]; // Adobe AIR 1.0 or better
 506                  }
 507              }
 508          }
 509  
 510          if (!o.webkit) { // not webkit
 511  // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
 512              m = ua.match(/Opera[\s\/]([^\s]*)/);
 513              if (m && m[1]) {
 514                  o.opera = numberify(m[1]);
 515                  m = ua.match(/Version\/([^\s]*)/);
 516                  if (m && m[1]) {
 517                      o.opera = numberify(m[1]); // opera 10+
 518                  }
 519                  m = ua.match(/Opera Mini[^;]*/);
 520                  if (m) {
 521                      o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
 522                  }
 523              } else { // not opera or webkit
 524                  m = ua.match(/MSIE\s([^;]*)/);
 525                  if (m && m[1]) {
 526                      o.ie = numberify(m[1]);
 527                  } else { // not opera, webkit, or ie
 528                      m = ua.match(/Gecko\/([^\s]*)/);
 529                      if (m) {
 530                          o.gecko = 1; // Gecko detected, look for revision
 531                          m = ua.match(/rv:([^\s\)]*)/);
 532                          if (m && m[1]) {
 533                              o.gecko = numberify(m[1]);
 534                          }
 535                      }
 536                  }
 537              }
 538          }
 539      }
 540  
 541      return o;
 542  };
 543  
 544  YAHOO.env.ua = YAHOO.env.parseUA();
 545  
 546  /*
 547   * Initializes the global by creating the default namespaces and applying
 548   * any new configuration information that is detected.  This is the setup
 549   * for env.
 550   * @method init
 551   * @static
 552   * @private
 553   */
 554  (function() {
 555      YAHOO.namespace("util", "widget", "example");
 556      /*global YAHOO_config*/
 557      if ("undefined" !== typeof YAHOO_config) {
 558          var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i;
 559          if (l) {
 560              // if YAHOO is loaded multiple times we need to check to see if
 561              // this is a new config object.  If it is, add the new component
 562              // load listener to the stack
 563              for (i=0; i<ls.length; i++) {
 564                  if (ls[i] == l) {
 565                      unique = false;
 566                      break;
 567                  }
 568              }
 569  
 570              if (unique) {
 571                  ls.push(l);
 572              }
 573          }
 574      }
 575  })();
 576  /**
 577   * Provides the language utilites and extensions used by the library
 578   * @class YAHOO.lang
 579   */
 580  YAHOO.lang = YAHOO.lang || {};
 581  
 582  (function() {
 583  
 584  
 585  var L = YAHOO.lang,
 586  
 587      OP = Object.prototype,
 588      ARRAY_TOSTRING = '[object Array]',
 589      FUNCTION_TOSTRING = '[object Function]',
 590      OBJECT_TOSTRING = '[object Object]',
 591      NOTHING = [],
 592  
 593      HTML_CHARS = {
 594          '&': '&amp;',
 595          '<': '&lt;',
 596          '>': '&gt;',
 597          '"': '&quot;',
 598          "'": '&#x27;',
 599          '/': '&#x2F;',
 600          '`': '&#x60;'
 601      },
 602  
 603      // ADD = ["toString", "valueOf", "hasOwnProperty"],
 604      ADD = ["toString", "valueOf"],
 605  
 606      OB = {
 607  
 608      /**
 609       * Determines wheather or not the provided object is an array.
 610       * @method isArray
 611       * @param {any} o The object being testing
 612       * @return {boolean} the result
 613       */
 614      isArray: function(o) {
 615          return OP.toString.apply(o) === ARRAY_TOSTRING;
 616      },
 617  
 618      /**
 619       * Determines whether or not the provided object is a boolean
 620       * @method isBoolean
 621       * @param {any} o The object being testing
 622       * @return {boolean} the result
 623       */
 624      isBoolean: function(o) {
 625          return typeof o === 'boolean';
 626      },
 627  
 628      /**
 629       * Determines whether or not the provided object is a function.
 630       * Note: Internet Explorer thinks certain functions are objects:
 631       *
 632       * var obj = document.createElement("object");
 633       * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE
 634       *
 635       * var input = document.createElement("input"); // append to body
 636       * YAHOO.lang.isFunction(input.focus) // reports false in IE
 637       *
 638       * You will have to implement additional tests if these functions
 639       * matter to you.
 640       *
 641       * @method isFunction
 642       * @param {any} o The object being testing
 643       * @return {boolean} the result
 644       */
 645      isFunction: function(o) {
 646          return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
 647      },
 648  
 649      /**
 650       * Determines whether or not the provided object is null
 651       * @method isNull
 652       * @param {any} o The object being testing
 653       * @return {boolean} the result
 654       */
 655      isNull: function(o) {
 656          return o === null;
 657      },
 658  
 659      /**
 660       * Determines whether or not the provided object is a legal number
 661       * @method isNumber
 662       * @param {any} o The object being testing
 663       * @return {boolean} the result
 664       */
 665      isNumber: function(o) {
 666          return typeof o === 'number' && isFinite(o);
 667      },
 668  
 669      /**
 670       * Determines whether or not the provided object is of type object
 671       * or function
 672       * @method isObject
 673       * @param {any} o The object being testing
 674       * @return {boolean} the result
 675       */
 676      isObject: function(o) {
 677  return (o && (typeof o === 'object' || L.isFunction(o))) || false;
 678      },
 679  
 680      /**
 681       * Determines whether or not the provided object is a string
 682       * @method isString
 683       * @param {any} o The object being testing
 684       * @return {boolean} the result
 685       */
 686      isString: function(o) {
 687          return typeof o === 'string';
 688      },
 689  
 690      /**
 691       * Determines whether or not the provided object is undefined
 692       * @method isUndefined
 693       * @param {any} o The object being testing
 694       * @return {boolean} the result
 695       */
 696      isUndefined: function(o) {
 697          return typeof o === 'undefined';
 698      },
 699  
 700  
 701      /**
 702       * IE will not enumerate native functions in a derived object even if the
 703       * function was overridden.  This is a workaround for specific functions
 704       * we care about on the Object prototype.
 705       * @property _IEEnumFix
 706       * @param {Function} r  the object to receive the augmentation
 707       * @param {Function} s  the object that supplies the properties to augment
 708       * @static
 709       * @private
 710       */
 711      _IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
 712              var i, fname, f;
 713              for (i=0;i<ADD.length;i=i+1) {
 714  
 715                  fname = ADD[i];
 716                  f = s[fname];
 717  
 718                  if (L.isFunction(f) && f!=OP[fname]) {
 719                      r[fname]=f;
 720                  }
 721              }
 722      } : function(){},
 723  
 724      /**
 725       * <p>
 726       * Returns a copy of the specified string with special HTML characters
 727       * escaped. The following characters will be converted to their
 728       * corresponding character entities:
 729       * <code>&amp; &lt; &gt; &quot; &#x27; &#x2F; &#x60;</code>
 730       * </p>
 731       *
 732       * <p>
 733       * This implementation is based on the
 734       * <a href="http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet">OWASP
 735       * HTML escaping recommendations</a>. In addition to the characters
 736       * in the OWASP recommendation, we also escape the <code>&#x60;</code>
 737       * character, since IE interprets it as an attribute delimiter when used in
 738       * innerHTML.
 739       * </p>
 740       *
 741       * @method escapeHTML
 742       * @param {String} html String to escape.
 743       * @return {String} Escaped string.
 744       * @static
 745       * @since 2.9.0
 746       */
 747      escapeHTML: function (html) {
 748          return html.replace(/[&<>"'\/`]/g, function (match) {
 749              return HTML_CHARS[match];
 750          });
 751      },
 752  
 753      /**
 754       * Utility to set up the prototype, constructor and superclass properties to
 755       * support an inheritance strategy that can chain constructors and methods.
 756       * Static members will not be inherited.
 757       *
 758       * @method extend
 759       * @static
 760       * @param {Function} subc   the object to modify
 761       * @param {Function} superc the object to inherit
 762       * @param {Object} overrides  additional properties/methods to add to the
 763       *                              subclass prototype.  These will override the
 764       *                              matching items obtained from the superclass
 765       *                              if present.
 766       */
 767      extend: function(subc, superc, overrides) {
 768          if (!superc||!subc) {
 769              throw new Error("extend failed, please check that " +
 770                              "all dependencies are included.");
 771          }
 772          var F = function() {}, i;
 773          F.prototype=superc.prototype;
 774          subc.prototype=new F();
 775          subc.prototype.constructor=subc;
 776          subc.superclass=superc.prototype;
 777          if (superc.prototype.constructor == OP.constructor) {
 778              superc.prototype.constructor=superc;
 779          }
 780  
 781          if (overrides) {
 782              for (i in overrides) {
 783                  if (L.hasOwnProperty(overrides, i)) {
 784                      subc.prototype[i]=overrides[i];
 785                  }
 786              }
 787  
 788              L._IEEnumFix(subc.prototype, overrides);
 789          }
 790      },
 791  
 792      /**
 793       * Applies all properties in the supplier to the receiver if the
 794       * receiver does not have these properties yet.  Optionally, one or
 795       * more methods/properties can be specified (as additional
 796       * parameters).  This option will overwrite the property if receiver
 797       * has it already.  If true is passed as the third parameter, all
 798       * properties will be applied and _will_ overwrite properties in
 799       * the receiver.
 800       *
 801       * @method augmentObject
 802       * @static
 803       * @since 2.3.0
 804       * @param {Function} r  the object to receive the augmentation
 805       * @param {Function} s  the object that supplies the properties to augment
 806       * @param {String*|boolean}  arguments zero or more properties methods
 807       *        to augment the receiver with.  If none specified, everything
 808       *        in the supplier will be used unless it would
 809       *        overwrite an existing property in the receiver. If true
 810       *        is specified as the third parameter, all properties will
 811       *        be applied and will overwrite an existing property in
 812       *        the receiver
 813       */
 814      augmentObject: function(r, s) {
 815          if (!s||!r) {
 816              throw new Error("Absorb failed, verify dependencies.");
 817          }
 818          var a=arguments, i, p, overrideList=a[2];
 819          if (overrideList && overrideList!==true) { // only absorb the specified properties
 820              for (i=2; i<a.length; i=i+1) {
 821                  r[a[i]] = s[a[i]];
 822              }
 823          } else { // take everything, overwriting only if the third parameter is true
 824              for (p in s) {
 825                  if (overrideList || !(p in r)) {
 826                      r[p] = s[p];
 827                  }
 828              }
 829  
 830              L._IEEnumFix(r, s);
 831          }
 832  
 833          return r;
 834      },
 835  
 836      /**
 837       * Same as YAHOO.lang.augmentObject, except it only applies prototype properties
 838       * @see YAHOO.lang.augmentObject
 839       * @method augmentProto
 840       * @static
 841       * @param {Function} r  the object to receive the augmentation
 842       * @param {Function} s  the object that supplies the properties to augment
 843       * @param {String*|boolean}  arguments zero or more properties methods
 844       *        to augment the receiver with.  If none specified, everything
 845       *        in the supplier will be used unless it would overwrite an existing
 846       *        property in the receiver.  if true is specified as the third
 847       *        parameter, all properties will be applied and will overwrite an
 848       *        existing property in the receiver
 849       */
 850      augmentProto: function(r, s) {
 851          if (!s||!r) {
 852              throw new Error("Augment failed, verify dependencies.");
 853          }
 854          //var a=[].concat(arguments);
 855          var a=[r.prototype,s.prototype], i;
 856          for (i=2;i<arguments.length;i=i+1) {
 857              a.push(arguments[i]);
 858          }
 859          L.augmentObject.apply(this, a);
 860  
 861          return r;
 862      },
 863  
 864  
 865      /**
 866       * Returns a simple string representation of the object or array.
 867       * Other types of objects will be returned unprocessed.  Arrays
 868       * are expected to be indexed.  Use object notation for
 869       * associative arrays.
 870       * @method dump
 871       * @since 2.3.0
 872       * @param o {Object} The object to dump
 873       * @param d {int} How deep to recurse child objects, default 3
 874       * @return {String} the dump result
 875       */
 876      dump: function(o, d) {
 877          var i,len,s=[],OBJ="{...}",FUN="f(){...}",
 878              COMMA=', ', ARROW=' => ';
 879  
 880          // Cast non-objects to string
 881          // Skip dates because the std toString is what we want
 882          // Skip HTMLElement-like objects because trying to dump
 883          // an element will cause an unhandled exception in FF 2.x
 884          if (!L.isObject(o)) {
 885              return o + "";
 886          } else if (o instanceof Date || ("nodeType" in o && "tagName" in o)) {
 887              return o;
 888          } else if  (L.isFunction(o)) {
 889              return FUN;
 890          }
 891  
 892          // dig into child objects the depth specifed. Default 3
 893          d = (L.isNumber(d)) ? d : 3;
 894  
 895          // arrays [1, 2, 3]
 896          if (L.isArray(o)) {
 897              s.push("[");
 898              for (i=0,len=o.length;i<len;i=i+1) {
 899                  if (L.isObject(o[i])) {
 900                      s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
 901                  } else {
 902                      s.push(o[i]);
 903                  }
 904                  s.push(COMMA);
 905              }
 906              if (s.length > 1) {
 907                  s.pop();
 908              }
 909              s.push("]");
 910          // objects {k1 => v1, k2 => v2}
 911          } else {
 912              s.push("{");
 913              for (i in o) {
 914                  if (L.hasOwnProperty(o, i)) {
 915                      s.push(i + ARROW);
 916                      if (L.isObject(o[i])) {
 917                          s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
 918                      } else {
 919                          s.push(o[i]);
 920                      }
 921                      s.push(COMMA);
 922                  }
 923              }
 924              if (s.length > 1) {
 925                  s.pop();
 926              }
 927              s.push("}");
 928          }
 929  
 930          return s.join("");
 931      },
 932  
 933      /**
 934       * Does variable substitution on a string. It scans through the string
 935       * looking for expressions enclosed in { } braces. If an expression
 936       * is found, it is used a key on the object.  If there is a space in
 937       * the key, the first word is used for the key and the rest is provided
 938       * to an optional function to be used to programatically determine the
 939       * value (the extra information might be used for this decision). If
 940       * the value for the key in the object, or what is returned from the
 941       * function has a string value, number value, or object value, it is
 942       * substituted for the bracket expression and it repeats.  If this
 943       * value is an object, it uses the Object's toString() if this has
 944       * been overridden, otherwise it does a shallow dump of the key/value
 945       * pairs.
 946       *
 947       * By specifying the recurse option, the string is rescanned after
 948       * every replacement, allowing for nested template substitutions.
 949       * The side effect of this option is that curly braces in the
 950       * replacement content must be encoded.
 951       *
 952       * @method substitute
 953       * @since 2.3.0
 954       * @param s {String} The string that will be modified.
 955       * @param o {Object} An object containing the replacement values
 956       * @param f {Function} An optional function that can be used to
 957       *                     process each match.  It receives the key,
 958       *                     value, and any extra metadata included with
 959       *                     the key inside of the braces.
 960       * @param recurse {boolean} default true - if not false, the replaced
 961       * string will be rescanned so that nested substitutions are possible.
 962       * @return {String} the substituted string
 963       */
 964      substitute: function (s, o, f, recurse) {
 965          var i, j, k, key, v, meta, saved=[], token, lidx=s.length,
 966              DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}',
 967              dump, objstr;
 968  
 969          for (;;) {
 970              i = s.lastIndexOf(LBRACE, lidx);
 971              if (i < 0) {
 972                  break;
 973              }
 974              j = s.indexOf(RBRACE, i);
 975              if (i + 1 > j) {
 976                  break;
 977              }
 978  
 979              //Extract key and meta info
 980              token = s.substring(i + 1, j);
 981              key = token;
 982              meta = null;
 983              k = key.indexOf(SPACE);
 984              if (k > -1) {
 985                  meta = key.substring(k + 1);
 986                  key = key.substring(0, k);
 987              }
 988  
 989              // lookup the value
 990              v = o[key];
 991  
 992              // if a substitution function was provided, execute it
 993              if (f) {
 994                  v = f(key, v, meta);
 995              }
 996  
 997              if (L.isObject(v)) {
 998                  if (L.isArray(v)) {
 999                      v = L.dump(v, parseInt(meta, 10));
1000                  } else {
1001                      meta = meta || "";
1002  
1003                      // look for the keyword 'dump', if found force obj dump
1004                      dump = meta.indexOf(DUMP);
1005                      if (dump > -1) {
1006                          meta = meta.substring(4);
1007                      }
1008  
1009                      objstr = v.toString();
1010  
1011                      // use the toString if it is not the Object toString
1012                      // and the 'dump' meta info was not found
1013                      if (objstr === OBJECT_TOSTRING || dump > -1) {
1014                          v = L.dump(v, parseInt(meta, 10));
1015                      } else {
1016                          v = objstr;
1017                      }
1018                  }
1019              } else if (!L.isString(v) && !L.isNumber(v)) {
1020                  // This {block} has no replace string. Save it for later.
1021                  v = "~-" + saved.length + "-~";
1022                  saved[saved.length] = token;
1023  
1024                  // break;
1025              }
1026  
1027              s = s.substring(0, i) + v + s.substring(j + 1);
1028  
1029              if (recurse === false) {
1030                  lidx = i-1;
1031              }
1032  
1033          }
1034  
1035          // restore saved {block}s
1036          for (i=saved.length-1; i>=0; i=i-1) {
1037              s = s.replace(new RegExp("~-" + i + "-~"), "{"  + saved[i] + "}", "g");
1038          }
1039  
1040          return s;
1041      },
1042  
1043  
1044      /**
1045       * Returns a string without any leading or trailing whitespace.  If
1046       * the input is not a string, the input will be returned untouched.
1047       * @method trim
1048       * @since 2.3.0
1049       * @param s {string} the string to trim
1050       * @return {string} the trimmed string
1051       */
1052      trim: function(s){
1053          try {
1054              return s.replace(/^\s+|\s+$/g, "");
1055          } catch(e) {
1056              return s;
1057          }
1058      },
1059  
1060      /**
1061       * Returns a new object containing all of the properties of
1062       * all the supplied objects.  The properties from later objects
1063       * will overwrite those in earlier objects.
1064       * @method merge
1065       * @since 2.3.0
1066       * @param arguments {Object*} the objects to merge
1067       * @return the new merged object
1068       */
1069      merge: function() {
1070          var o={}, a=arguments, l=a.length, i;
1071          for (i=0; i<l; i=i+1) {
1072              L.augmentObject(o, a[i], true);
1073          }
1074          return o;
1075      },
1076  
1077      /**
1078       * Executes the supplied function in the context of the supplied
1079       * object 'when' milliseconds later.  Executes the function a
1080       * single time unless periodic is set to true.
1081       * @method later
1082       * @since 2.4.0
1083       * @param when {int} the number of milliseconds to wait until the fn
1084       * is executed
1085       * @param o the context object
1086       * @param fn {Function|String} the function to execute or the name of
1087       * the method in the 'o' object to execute
1088       * @param data [Array] data that is provided to the function.  This accepts
1089       * either a single item or an array.  If an array is provided, the
1090       * function is executed with one parameter for each array item.  If
1091       * you need to pass a single array parameter, it needs to be wrapped in
1092       * an array [myarray]
1093       * @param periodic {boolean} if true, executes continuously at supplied
1094       * interval until canceled
1095       * @return a timer object. Call the cancel() method on this object to
1096       * stop the timer.
1097       */
1098      later: function(when, o, fn, data, periodic) {
1099          when = when || 0;
1100          o = o || {};
1101          var m=fn, d=data, f, r;
1102  
1103          if (L.isString(fn)) {
1104              m = o[fn];
1105          }
1106  
1107          if (!m) {
1108              throw new TypeError("method undefined");
1109          }
1110  
1111          if (!L.isUndefined(data) && !L.isArray(d)) {
1112              d = [data];
1113          }
1114  
1115          f = function() {
1116              m.apply(o, d || NOTHING);
1117          };
1118  
1119          r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
1120  
1121          return {
1122              interval: periodic,
1123              cancel: function() {
1124                  if (this.interval) {
1125                      clearInterval(r);
1126                  } else {
1127                      clearTimeout(r);
1128                  }
1129              }
1130          };
1131      },
1132  
1133      /**
1134       * A convenience method for detecting a legitimate non-null value.
1135       * Returns false for null/undefined/NaN, true for other values,
1136       * including 0/false/''
1137       * @method isValue
1138       * @since 2.3.0
1139       * @param o {any} the item to test
1140       * @return {boolean} true if it is not null/undefined/NaN || false
1141       */
1142      isValue: function(o) {
1143          // return (o || o === false || o === 0 || o === ''); // Infinity fails
1144  return (L.isObject(o) || L.isString(o) || L.isNumber(o) || L.isBoolean(o));
1145      }
1146  
1147  };
1148  
1149  /**
1150   * Determines whether or not the property was added
1151   * to the object instance.  Returns false if the property is not present
1152   * in the object, or was inherited from the prototype.
1153   * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
1154   * There is a discrepancy between YAHOO.lang.hasOwnProperty and
1155   * Object.prototype.hasOwnProperty when the property is a primitive added to
1156   * both the instance AND prototype with the same value:
1157   * <pre>
1158   * var A = function() {};
1159   * A.prototype.foo = 'foo';
1160   * var a = new A();
1161   * a.foo = 'foo';
1162   * alert(a.hasOwnProperty('foo')); // true
1163   * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
1164   * </pre>
1165   * @method hasOwnProperty
1166   * @param {any} o The object being testing
1167   * @param prop {string} the name of the property to test
1168   * @return {boolean} the result
1169   */
1170  L.hasOwnProperty = (OP.hasOwnProperty) ?
1171      function(o, prop) {
1172          return o && o.hasOwnProperty && o.hasOwnProperty(prop);
1173      } : function(o, prop) {
1174          return !L.isUndefined(o[prop]) &&
1175                  o.constructor.prototype[prop] !== o[prop];
1176      };
1177  
1178  // new lang wins
1179  OB.augmentObject(L, OB, true);
1180  
1181  /*
1182   * An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
1183   * @class YAHOO.util.Lang
1184   */
1185  YAHOO.util.Lang = L;
1186  
1187  /**
1188   * Same as YAHOO.lang.augmentObject, except it only applies prototype
1189   * properties.  This is an alias for augmentProto.
1190   * @see YAHOO.lang.augmentObject
1191   * @method augment
1192   * @static
1193   * @param {Function} r  the object to receive the augmentation
1194   * @param {Function} s  the object that supplies the properties to augment
1195   * @param {String*|boolean}  arguments zero or more properties methods to
1196   *        augment the receiver with.  If none specified, everything
1197   *        in the supplier will be used unless it would
1198   *        overwrite an existing property in the receiver.  if true
1199   *        is specified as the third parameter, all properties will
1200   *        be applied and will overwrite an existing property in
1201   *        the receiver
1202   */
1203  L.augment = L.augmentProto;
1204  
1205  /**
1206   * An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
1207   * @for YAHOO
1208   * @method augment
1209   * @static
1210   * @param {Function} r  the object to receive the augmentation
1211   * @param {Function} s  the object that supplies the properties to augment
1212   * @param {String*}  arguments zero or more properties methods to
1213   *        augment the receiver with.  If none specified, everything
1214   *        in the supplier will be used unless it would
1215   *        overwrite an existing property in the receiver
1216   */
1217  YAHOO.augment = L.augmentProto;
1218  
1219  /**
1220   * An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
1221   * @method extend
1222   * @static
1223   * @param {Function} subc   the object to modify
1224   * @param {Function} superc the object to inherit
1225   * @param {Object} overrides  additional properties/methods to add to the
1226   *        subclass prototype.  These will override the
1227   *        matching items obtained from the superclass if present.
1228   */
1229  YAHOO.extend = L.extend;
1230  
1231  })();
1232  YAHOO.register("yahoo", YAHOO, {version: "2.9.0", build: "2800"});
1233  /**
1234   * Provides a mechanism to fetch remote resources and
1235   * insert them into a document
1236   * This utility can fetch JavaScript and CSS files, inserting script
1237   * tags for script and link tags for CSS.  Note, this
1238   * is done via the normal browser mechanisms for inserting
1239   * these resources and making the content available to
1240   * code that would access it.  Be careful when retreiving
1241   * remote resources.  Only use this utility to fetch
1242   * files from sites you trust.
1243   *
1244   * @module get
1245   * @requires yahoo
1246   */
1247  
1248  /**
1249   * Fetches and inserts one or more script or link nodes into the document.
1250   * This utility can fetch JavaScript and CSS files, inserting script
1251   * tags for script and link tags for CSS.  Note, this
1252   * is done via the normal browser mechanisms for inserting
1253   * these resources and making the content available to
1254   * code that would access it.  Be careful when retreiving
1255   * remote resources.  Only use this utility to fetch
1256   * files from sites you trust.
1257   *
1258   * @namespace YAHOO.util
1259   * @class YAHOO.util.Get
1260   */
1261  YAHOO.util.Get = function() {
1262  
1263      /**
1264       * hash of queues to manage multiple requests
1265       * @property queues
1266       * @private
1267       */
1268      var queues={},
1269  
1270      /**
1271       * queue index used to generate transaction ids
1272       * @property qidx
1273       * @type int
1274       * @private
1275       */
1276          qidx=0,
1277  
1278      /**
1279       * node index used to generate unique node ids
1280       * @property nidx
1281       * @type int
1282       * @private
1283       */
1284          nidx=0,
1285  
1286      /**
1287       * interal property used to prevent multiple simultaneous purge
1288       * processes
1289       * @property purging
1290       * @type boolean
1291       * @private
1292       */
1293          _purging=false,
1294  
1295          ua=YAHOO.env.ua,
1296  
1297          lang=YAHOO.lang,
1298  
1299      _fail,
1300      _purge,
1301      _track,
1302  
1303      /**
1304       * Generates an HTML element, this is not appended to a document
1305       * @method _node
1306       * @param type {string} the type of element
1307       * @param attr {string} the attributes
1308       * @param win {Window} optional window to create the element in
1309       * @return {HTMLElement} the generated node
1310       * @private
1311       */
1312      _node = function(type, attr, win) {
1313          var w = win || window, d=w.document, n=d.createElement(type), i;
1314  
1315          for (i in attr) {
1316              if (attr.hasOwnProperty(i)) {
1317                  n.setAttribute(i, attr[i]);
1318              }
1319          }
1320  
1321          return n;
1322      },
1323  
1324      /**
1325       * Generates a link node
1326       * @method _linkNode
1327       * @param url {string} the url for the css file
1328       * @param win {Window} optional window to create the node in
1329       * @return {HTMLElement} the generated node
1330       * @private
1331       */
1332      _linkNode = function(url, win, attributes) {
1333  
1334          var o = {
1335              id:   "yui__dyn_" + (nidx++),
1336              type: "text/css",
1337              rel:  "stylesheet",
1338              href: url
1339          };
1340  
1341          if (attributes) {
1342              lang.augmentObject(o, attributes);
1343          }
1344  
1345          return _node("link", o, win);
1346      },
1347  
1348      /**
1349       * Generates a script node
1350       * @method _scriptNode
1351       * @param url {string} the url for the script file
1352       * @param win {Window} optional window to create the node in
1353       * @return {HTMLElement} the generated node
1354       * @private
1355       */
1356      _scriptNode = function(url, win, attributes) {
1357          var o = {
1358              id:   "yui__dyn_" + (nidx++),
1359              type: "text/javascript",
1360              src:  url
1361          };
1362  
1363          if (attributes) {
1364              lang.augmentObject(o, attributes);
1365          }
1366  
1367          return _node("script", o, win);
1368      },
1369  
1370      /**
1371       * Returns the data payload for callback functions
1372       * @method _returnData
1373       * @private
1374       */
1375      _returnData = function(q, msg) {
1376          return {
1377                  tId: q.tId,
1378                  win: q.win,
1379                  data: q.data,
1380                  nodes: q.nodes,
1381                  msg: msg,
1382                  purge: function() {
1383                      _purge(this.tId);
1384                  }
1385              };
1386      },
1387  
1388      _get = function(nId, tId) {
1389          var q = queues[tId],
1390              n = (lang.isString(nId)) ? q.win.document.getElementById(nId) : nId;
1391          if (!n) {
1392              _fail(tId, "target node not found: " + nId);
1393          }
1394  
1395          return n;
1396      },
1397  
1398  
1399      /**
1400       * The request is complete, so executing the requester's callback
1401       * @method _finish
1402       * @param id {string} the id of the request
1403       * @private
1404       */
1405      _finish = function(id) {
1406          YAHOO.log("Finishing transaction " + id);
1407          var q = queues[id], msg, context;
1408          q.finished = true;
1409  
1410          if (q.aborted) {
1411              msg = "transaction " + id + " was aborted";
1412              _fail(id, msg);
1413              return;
1414          }
1415  
1416          // execute success callback
1417          if (q.onSuccess) {
1418              context = q.scope || q.win;
1419              q.onSuccess.call(context, _returnData(q));
1420          }
1421      },
1422  
1423      /**
1424       * Timeout detected
1425       * @method _timeout
1426       * @param id {string} the id of the request
1427       * @private
1428       */
1429      _timeout = function(id) {
1430          YAHOO.log("Timeout " + id, "info", "get");
1431          var q = queues[id], context;
1432          if (q.onTimeout) {
1433              context = q.scope || q;
1434              q.onTimeout.call(context, _returnData(q));
1435          }
1436      },
1437  
1438      /**
1439       * Loads the next item for a given request
1440       * @method _next
1441       * @param id {string} the id of the request
1442       * @param loaded {string} the url that was just loaded, if any
1443       * @private
1444       */
1445      _next = function(id, loaded) {
1446  
1447          YAHOO.log("_next: " + id + ", loaded: " + loaded, "info", "Get");
1448  
1449          var q = queues[id], w=q.win, d=w.document, h=d.getElementsByTagName("head")[0],
1450              n, msg, url, s, extra;
1451  
1452          if (q.timer) {
1453              // Y.log('cancel timer');
1454              q.timer.cancel();
1455          }
1456  
1457          if (q.aborted) {
1458              msg = "transaction " + id + " was aborted";
1459              _fail(id, msg);
1460              return;
1461          }
1462  
1463          if (loaded) {
1464              q.url.shift();
1465              if (q.varName) {
1466                  q.varName.shift();
1467              }
1468          } else {
1469              // This is the first pass: make sure the url is an array
1470              q.url = (lang.isString(q.url)) ? [q.url] : q.url;
1471              if (q.varName) {
1472                  q.varName = (lang.isString(q.varName)) ? [q.varName] : q.varName;
1473              }
1474          }
1475  
1476  
1477          if (q.url.length === 0) {
1478              // Safari 2.x workaround - There is no way to know when
1479              // a script is ready in versions of Safari prior to 3.x.
1480              // Adding an extra node reduces the problem, but doesn't
1481              // eliminate it completely because the browser executes
1482              // them asynchronously.
1483              if (q.type === "script" && ua.webkit && ua.webkit < 420 &&
1484                      !q.finalpass && !q.varName) {
1485                  // Add another script node.  This does not guarantee that the
1486                  // scripts will execute in order, but it does appear to fix the
1487                  // problem on fast connections more effectively than using an
1488                  // arbitrary timeout.  It is possible that the browser does
1489                  // block subsequent script execution in this case for a limited
1490                  // time.
1491                  extra = _scriptNode(null, q.win, q.attributes);
1492                  extra.innerHTML='YAHOO.util.Get._finalize("' + id + '");';
1493                  q.nodes.push(extra); h.appendChild(extra);
1494  
1495              } else {
1496                  _finish(id);
1497              }
1498  
1499              return;
1500          }
1501  
1502  
1503          url = q.url[0];
1504  
1505          // if the url is undefined, this is probably a trailing comma problem in IE
1506          if (!url) {
1507              q.url.shift();
1508              YAHOO.log('skipping empty url');
1509              return _next(id);
1510          }
1511  
1512          YAHOO.log("attempting to load " + url, "info", "Get");
1513  
1514          if (q.timeout) {
1515              // Y.log('create timer');
1516              q.timer = lang.later(q.timeout, q, _timeout, id);
1517          }
1518  
1519          if (q.type === "script") {
1520              n = _scriptNode(url, w, q.attributes);
1521          } else {
1522              n = _linkNode(url, w, q.attributes);
1523          }
1524  
1525          // track this node's load progress
1526          _track(q.type, n, id, url, w, q.url.length);
1527  
1528          // add the node to the queue so we can return it to the user supplied callback
1529          q.nodes.push(n);
1530  
1531          // add it to the head or insert it before 'insertBefore'
1532          if (q.insertBefore) {
1533              s = _get(q.insertBefore, id);
1534              if (s) {
1535                  s.parentNode.insertBefore(n, s);
1536              }
1537          } else {
1538              h.appendChild(n);
1539          }
1540  
1541          YAHOO.log("Appending node: " + url, "info", "Get");
1542  
1543          // FireFox does not support the onload event for link nodes, so there is
1544          // no way to make the css requests synchronous. This means that the css
1545          // rules in multiple files could be applied out of order in this browser
1546          // if a later request returns before an earlier one.  Safari too.
1547          if ((ua.webkit || ua.gecko) && q.type === "css") {
1548              _next(id, url);
1549          }
1550      },
1551  
1552      /**
1553       * Removes processed queues and corresponding nodes
1554       * @method _autoPurge
1555       * @private
1556       */
1557      _autoPurge = function() {
1558  
1559          if (_purging) {
1560              return;
1561          }
1562  
1563          _purging = true;
1564  
1565          var i, q;
1566  
1567          for (i in queues) {
1568              if (queues.hasOwnProperty(i)) {
1569                  q = queues[i];
1570                  if (q.autopurge && q.finished) {
1571                      _purge(q.tId);
1572                      delete queues[i];
1573                  }
1574              }
1575          }
1576  
1577          _purging = false;
1578      },
1579  
1580      /**
1581       * Saves the state for the request and begins loading
1582       * the requested urls
1583       * @method queue
1584       * @param type {string} the type of node to insert
1585       * @param url {string} the url to load
1586       * @param opts the hash of options for this request
1587       * @private
1588       */
1589      _queue = function(type, url, opts) {
1590  
1591          var id = "q" + (qidx++), q;
1592          opts = opts || {};
1593  
1594          if (qidx % YAHOO.util.Get.PURGE_THRESH === 0) {
1595              _autoPurge();
1596          }
1597  
1598          queues[id] = lang.merge(opts, {
1599              tId: id,
1600              type: type,
1601              url: url,
1602              finished: false,
1603              aborted: false,
1604              nodes: []
1605          });
1606  
1607          q = queues[id];
1608          q.win = q.win || window;
1609          q.scope = q.scope || q.win;
1610          q.autopurge = ("autopurge" in q) ? q.autopurge :
1611                        (type === "script") ? true : false;
1612  
1613          q.attributes = q.attributes || {};
1614          q.attributes.charset = opts.charset || q.attributes.charset || 'utf-8';
1615  
1616          lang.later(0, q, _next, id);
1617  
1618          return {
1619              tId: id
1620          };
1621      };
1622  
1623      /**
1624       * Detects when a node has been loaded.  In the case of
1625       * script nodes, this does not guarantee that contained
1626       * script is ready to use.
1627       * @method _track
1628       * @param type {string} the type of node to track
1629       * @param n {HTMLElement} the node to track
1630       * @param id {string} the id of the request
1631       * @param url {string} the url that is being loaded
1632       * @param win {Window} the targeted window
1633       * @param qlength the number of remaining items in the queue,
1634       * including this one
1635       * @param trackfn {Function} function to execute when finished
1636       * the default is _next
1637       * @private
1638       */
1639      _track = function(type, n, id, url, win, qlength, trackfn) {
1640          var f = trackfn || _next, rs, q, a, freq, w, l, i, msg;
1641  
1642          // IE supports the readystatechange event for script and css nodes
1643          if (ua.ie) {
1644              n.onreadystatechange = function() {
1645                  rs = this.readyState;
1646                  if ("loaded" === rs || "complete" === rs) {
1647                      YAHOO.log(id + " onload " + url, "info", "Get");
1648                      n.onreadystatechange = null;
1649                      f(id, url);
1650                  }
1651              };
1652  
1653          // webkit prior to 3.x is problemmatic
1654          } else if (ua.webkit) {
1655  
1656              if (type === "script") {
1657  
1658                  // Safari 3.x supports the load event for script nodes (DOM2)
1659                  if (ua.webkit >= 420) {
1660  
1661                      n.addEventListener("load", function() {
1662                          YAHOO.log(id + " DOM2 onload " + url, "info", "Get");
1663                          f(id, url);
1664                      });
1665  
1666                  // Nothing can be done with Safari < 3.x except to pause and hope
1667                  // for the best, particularly after last script is inserted. The
1668                  // scripts will always execute in the order they arrive, not
1669                  // necessarily the order in which they were inserted.  To support
1670                  // script nodes with complete reliability in these browsers, script
1671                  // nodes either need to invoke a function in the window once they
1672                  // are loaded or the implementer needs to provide a well-known
1673                  // property that the utility can poll for.
1674                  } else {
1675                      // Poll for the existence of the named variable, if it
1676                      // was supplied.
1677                      q = queues[id];
1678                      if (q.varName) {
1679                          freq = YAHOO.util.Get.POLL_FREQ;
1680                          YAHOO.log("Polling for " + q.varName[0]);
1681                          q.maxattempts = YAHOO.util.Get.TIMEOUT/freq;
1682                          q.attempts = 0;
1683                          q._cache = q.varName[0].split(".");
1684                          q.timer = lang.later(freq, q, function(o) {
1685                              a = this._cache;
1686                              l = a.length;
1687                              w = this.win;
1688                              for (i=0; i<l; i=i+1) {
1689                                  w = w[a[i]];
1690                                  if (!w) {
1691                                      // if we have exausted our attempts, give up
1692                                      this.attempts++;
1693                                      if (this.attempts++ > this.maxattempts) {
1694                                          msg = "Over retry limit, giving up";
1695                                          q.timer.cancel();
1696                                          _fail(id, msg);
1697                                      } else {
1698                                          YAHOO.log(a[i] + " failed, retrying");
1699                                      }
1700                                      return;
1701                                  }
1702                              }
1703  
1704                              YAHOO.log("Safari poll complete");
1705  
1706                              q.timer.cancel();
1707                              f(id, url);
1708  
1709                          }, null, true);
1710                      } else {
1711                          lang.later(YAHOO.util.Get.POLL_FREQ, null, f, [id, url]);
1712                      }
1713                  }
1714              }
1715  
1716          // FireFox and Opera support onload (but not DOM2 in FF) handlers for
1717          // script nodes.  Opera, but not FF, supports the onload event for link
1718          // nodes.
1719          } else {
1720              n.onload = function() {
1721                  YAHOO.log(id + " onload " + url, "info", "Get");
1722                  f(id, url);
1723              };
1724          }
1725      };
1726  
1727      /*
1728       * The request failed, execute fail handler with whatever
1729       * was accomplished.  There isn't a failure case at the
1730       * moment unless you count aborted transactions
1731       * @method _fail
1732       * @param id {string} the id of the request
1733       * @private
1734       */
1735      _fail = function(id, msg) {
1736          YAHOO.log("get failure: " + msg, "warn", "Get");
1737          var q = queues[id], context;
1738          // execute failure callback
1739          if (q.onFailure) {
1740              context = q.scope || q.win;
1741              q.onFailure.call(context, _returnData(q, msg));
1742          }
1743      };
1744  
1745      /**
1746       * Removes the nodes for the specified queue
1747       * @method _purge
1748       * @private
1749       */
1750      _purge = function(tId) {
1751          if (queues[tId]) {
1752  
1753              var q     = queues[tId],
1754                  nodes = q.nodes,
1755                  l     = nodes.length,
1756                  d     = q.win.document,
1757                  h     = d.getElementsByTagName("head")[0],
1758                  sib, i, node, attr;
1759  
1760              if (q.insertBefore) {
1761                  sib = _get(q.insertBefore, tId);
1762                  if (sib) {
1763                      h = sib.parentNode;
1764                  }
1765              }
1766  
1767              for (i=0; i<l; i=i+1) {
1768                  node = nodes[i];
1769                  if (node.clearAttributes) {
1770                      node.clearAttributes();
1771                  } else {
1772                      for (attr in node) {
1773                          if (node.hasOwnProperty(attr)) {
1774                              delete node[attr];
1775                          }
1776                      }
1777                  }
1778  
1779                  h.removeChild(node);
1780              }
1781  
1782              q.nodes = [];
1783          }
1784      };
1785  
1786  
1787      return {
1788  
1789          /**
1790           * The default poll freqency in ms, when needed
1791           * @property POLL_FREQ
1792           * @static
1793           * @type int
1794           * @default 10
1795           */
1796          POLL_FREQ: 10,
1797  
1798          /**
1799           * The number of request required before an automatic purge.
1800           * property PURGE_THRESH
1801           * @static
1802           * @type int
1803           * @default 20
1804           */
1805          PURGE_THRESH: 20,
1806  
1807          /**
1808           * The length time to poll for varName when loading a script in
1809           * Safari 2.x before the transaction fails.
1810           * property TIMEOUT
1811           * @static
1812           * @type int
1813           * @default 2000
1814           */
1815          TIMEOUT: 2000,
1816  
1817          /**
1818           * Called by the the helper for detecting script load in Safari
1819           * @method _finalize
1820           * @param id {string} the transaction id
1821           * @private
1822           */
1823          _finalize: function(id) {
1824              YAHOO.log(id + " finalized ", "info", "Get");
1825              lang.later(0, null, _finish, id);
1826          },
1827  
1828          /**
1829           * Abort a transaction
1830           * @method abort
1831           * @param {string|object} either the tId or the object returned from
1832           * script() or css()
1833           */
1834          abort: function(o) {
1835              var id = (lang.isString(o)) ? o : o.tId,
1836                  q = queues[id];
1837              if (q) {
1838                  YAHOO.log("Aborting " + id, "info", "Get");
1839                  q.aborted = true;
1840              }
1841          },
1842  
1843          /**
1844           * Fetches and inserts one or more script nodes into the head
1845           * of the current document or the document in a specified window.
1846           *
1847           * @method script
1848           * @static
1849           * @param url {string|string[]} the url or urls to the script(s)
1850           * @param opts {object} Options:
1851           * <dl>
1852           * <dt>onSuccess</dt>
1853           * <dd>
1854           * callback to execute when the script(s) are finished loading
1855           * The callback receives an object back with the following
1856           * data:
1857           * <dl>
1858           * <dt>win</dt>
1859           * <dd>the window the script(s) were inserted into</dd>
1860           * <dt>data</dt>
1861           * <dd>the data object passed in when the request was made</dd>
1862           * <dt>nodes</dt>
1863           * <dd>An array containing references to the nodes that were
1864           * inserted</dd>
1865           * <dt>purge</dt>
1866           * <dd>A function that, when executed, will remove the nodes
1867           * that were inserted</dd>
1868           * <dt>
1869           * </dl>
1870           * </dd>
1871           * <dt>onFailure</dt>
1872           * <dd>
1873           * callback to execute when the script load operation fails
1874           * The callback receives an object back with the following
1875           * data:
1876           * <dl>
1877           * <dt>win</dt>
1878           * <dd>the window the script(s) were inserted into</dd>
1879           * <dt>data</dt>
1880           * <dd>the data object passed in when the request was made</dd>
1881           * <dt>nodes</dt>
1882           * <dd>An array containing references to the nodes that were
1883           * inserted successfully</dd>
1884           * <dt>purge</dt>
1885           * <dd>A function that, when executed, will remove any nodes
1886           * that were inserted</dd>
1887           * <dt>
1888           * </dl>
1889           * </dd>
1890           * <dt>onTimeout</dt>
1891           * <dd>
1892           * callback to execute when a timeout occurs.
1893           * The callback receives an object back with the following
1894           * data:
1895           * <dl>
1896           * <dt>win</dt>
1897           * <dd>the window the script(s) were inserted into</dd>
1898           * <dt>data</dt>
1899           * <dd>the data object passed in when the request was made</dd>
1900           * <dt>nodes</dt>
1901           * <dd>An array containing references to the nodes that were
1902           * inserted</dd>
1903           * <dt>purge</dt>
1904           * <dd>A function that, when executed, will remove the nodes
1905           * that were inserted</dd>
1906           * <dt>
1907           * </dl>
1908           * </dd>
1909           * <dt>scope</dt>
1910           * <dd>the execution context for the callbacks</dd>
1911           * <dt>win</dt>
1912           * <dd>a window other than the one the utility occupies</dd>
1913           * <dt>autopurge</dt>
1914           * <dd>
1915           * setting to true will let the utilities cleanup routine purge
1916           * the script once loaded
1917           * </dd>
1918           * <dt>data</dt>
1919           * <dd>
1920           * data that is supplied to the callback when the script(s) are
1921           * loaded.
1922           * </dd>
1923           * <dt>varName</dt>
1924           * <dd>
1925           * variable that should be available when a script is finished
1926           * loading.  Used to help Safari 2.x and below with script load
1927           * detection.  The type of this property should match what was
1928           * passed into the url parameter: if loading a single url, a
1929           * string can be supplied.  If loading multiple scripts, you
1930           * must supply an array that contains the variable name for
1931           * each script.
1932           * </dd>
1933           * <dt>insertBefore</dt>
1934           * <dd>node or node id that will become the new node's nextSibling</dd>
1935           * </dl>
1936           * <dt>charset</dt>
1937           * <dd>Node charset, deprecated, use 'attributes'</dd>
1938           * <dt>attributes</dt>
1939           * <dd>A hash of attributes to apply to dynamic nodes.</dd>
1940           * <dt>timeout</dt>
1941           * <dd>Number of milliseconds to wait before aborting and firing the timeout event</dd>
1942           * <pre>
1943           * // assumes yahoo, dom, and event are already on the page
1944           * &nbsp;&nbsp;YAHOO.util.Get.script(
1945           * &nbsp;&nbsp;["http://yui.yahooapis.com/2.7.0/build/dragdrop/dragdrop-min.js",
1946           * &nbsp;&nbsp;&nbsp;"http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"], &#123;
1947           * &nbsp;&nbsp;&nbsp;&nbsp;onSuccess: function(o) &#123;
1948           * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YAHOO.log(o.data); // foo
1949           * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new YAHOO.util.DDProxy("dd1"); // also new o.reference("dd1"); would work
1950           * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.log("won't cause error because YAHOO is the scope");
1951           * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this.log(o.nodes.length === 2) // true
1952           * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// o.purge(); // optionally remove the script nodes immediately
1953           * &nbsp;&nbsp;&nbsp;&nbsp;&#125;,
1954           * &nbsp;&nbsp;&nbsp;&nbsp;onFailure: function(o) &#123;
1955           * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;YAHOO.log("transaction failed");
1956           * &nbsp;&nbsp;&nbsp;&nbsp;&#125;,
1957           * &nbsp;&nbsp;&nbsp;&nbsp;data: "foo",
1958           * &nbsp;&nbsp;&nbsp;&nbsp;timeout: 10000, // 10 second timeout
1959           * &nbsp;&nbsp;&nbsp;&nbsp;scope: YAHOO,
1960           * &nbsp;&nbsp;&nbsp;&nbsp;// win: otherframe // target another window/frame
1961           * &nbsp;&nbsp;&nbsp;&nbsp;autopurge: true // allow the utility to choose when to remove the nodes
1962           * &nbsp;&nbsp;&#125;);
1963           * </pre>
1964           * @return {tId: string} an object containing info about the transaction
1965           */
1966          script: function(url, opts) { return _queue("script", url, opts); },
1967  
1968          /**
1969           * Fetches and inserts one or more css link nodes into the
1970           * head of the current document or the document in a specified
1971           * window.
1972           * @method css
1973           * @static
1974           * @param url {string} the url or urls to the css file(s)
1975           * @param opts Options:
1976           * <dl>
1977           * <dt>onSuccess</dt>
1978           * <dd>
1979           * callback to execute when the css file(s) are finished loading
1980           * The callback receives an object back with the following
1981           * data:
1982           * <dl>win</dl>
1983           * <dd>the window the link nodes(s) were inserted into</dd>
1984           * <dt>data</dt>
1985           * <dd>the data object passed in when the request was made</dd>
1986           * <dt>nodes</dt>
1987           * <dd>An array containing references to the nodes that were
1988           * inserted</dd>
1989           * <dt>purge</dt>
1990           * <dd>A function that, when executed, will remove the nodes
1991           * that were inserted</dd>
1992           * <dt>
1993           * </dl>
1994           * </dd>
1995           * <dt>scope</dt>
1996           * <dd>the execution context for the callbacks</dd>
1997           * <dt>win</dt>
1998           * <dd>a window other than the one the utility occupies</dd>
1999           * <dt>data</dt>
2000           * <dd>
2001           * data that is supplied to the callbacks when the nodes(s) are
2002           * loaded.
2003           * </dd>
2004           * <dt>insertBefore</dt>
2005           * <dd>node or node id that will become the new node's nextSibling</dd>
2006           * <dt>charset</dt>
2007           * <dd>Node charset, deprecated, use 'attributes'</dd>
2008           * <dt>attributes</dt>
2009           * <dd>A hash of attributes to apply to dynamic nodes.</dd>
2010           * </dl>
2011           * <pre>
2012           *      YAHOO.util.Get.css("http://yui.yahooapis.com/2.7.0/build/menu/assets/skins/sam/menu.css");
2013           * </pre>
2014           * <pre>
2015           *      YAHOO.util.Get.css(["http://yui.yahooapis.com/2.7.0/build/menu/assets/skins/sam/menu.css",
2016           *                          "http://yui.yahooapis.com/2.7.0/build/logger/assets/skins/sam/logger.css"]);
2017           * </pre>
2018           * @return {tId: string} an object containing info about the transaction
2019           */
2020          css: function(url, opts) {
2021              return _queue("css", url, opts);
2022          }
2023      };
2024  }();
2025  
2026  YAHOO.register("get", YAHOO.util.Get, {version: "2.9.0", build: "2800"});
2027  /*jslint evil: true, strict: false, regexp: false*/
2028  
2029  /**
2030   * Provides dynamic loading for the YUI library.  It includes the dependency
2031   * info for the library, and will automatically pull in dependencies for
2032   * the modules requested.  It supports rollup files (such as utilities.js
2033   * and yahoo-dom-event.js), and will automatically use these when
2034   * appropriate in order to minimize the number of http connections
2035   * required to load all of the dependencies.
2036   *
2037   * @module yuiloader
2038   * @namespace YAHOO.util
2039   */
2040  
2041  /**
2042   * YUILoader provides dynamic loading for YUI.
2043   * @class YAHOO.util.YUILoader
2044   * @todo
2045   *      version management, automatic sandboxing
2046   */
2047  (function() {
2048  
2049      var Y = YAHOO,
2050          util = Y.util,
2051          lang = Y.lang,
2052          env = Y.env,
2053          PROV = "_provides",
2054          SUPER = "_supersedes",
2055          REQ = "expanded",
2056          AFTER = "_after",
2057          VERSION = "2.9.0";
2058  
2059      // version hack for cdn testing
2060      // if (/VERSION/.test(VERSION)) {
2061          // VERSION = "2.8.2";
2062      // }
2063  
2064      var YUI = {
2065  
2066          dupsAllowed: {'yahoo': true, 'get': true},
2067  
2068          /*
2069           * The library metadata for the current release  The is the default
2070           * value for YAHOO.util.YUILoader.moduleInfo
2071           * @property YUIInfo
2072           * @static
2073           */
2074          info: {
2075  
2076      // 'root': '2.5.2/build/',
2077      // 'base': 'http://yui.yahooapis.com/2.5.2/build/',
2078  
2079      'root': VERSION + '/build/',
2080      'base': 'http://yui.yahooapis.com/' + VERSION + '/build/',
2081  
2082      'comboBase': 'http://yui.yahooapis.com/combo?',
2083  
2084      'skin': {
2085          'defaultSkin': 'sam',
2086          'base': 'assets/skins/',
2087          'path': 'skin.css',
2088          'after': ['reset', 'fonts', 'grids', 'base'],
2089          'rollup': 3
2090      },
2091  
2092      dupsAllowed: ['yahoo', 'get'],
2093  
2094      'moduleInfo': {
2095  
2096          'animation': {
2097              'type': 'js',
2098              'path': 'animation/animation-min.js',
2099              'requires': ['dom', 'event']
2100          },
2101  
2102          'autocomplete': {
2103              'type': 'js',
2104              'path': 'autocomplete/autocomplete-min.js',
2105              'requires': ['dom', 'event', 'datasource'],
2106              'optional': ['connection', 'animation'],
2107              'skinnable': true
2108          },
2109  
2110          'base': {
2111              'type': 'css',
2112              'path': 'base/base-min.css',
2113              'after': ['reset', 'fonts', 'grids']
2114          },
2115  
2116          'button': {
2117              'type': 'js',
2118              'path': 'button/button-min.js',
2119              'requires': ['element'],
2120              'optional': ['menu'],
2121              'skinnable': true
2122          },
2123  
2124          'calendar': {
2125              'type': 'js',
2126              'path': 'calendar/calendar-min.js',
2127              'requires': ['event', 'dom'],
2128              supersedes: ['datemath'],
2129              'skinnable': true
2130          },
2131  
2132          'carousel': {
2133              'type': 'js',
2134              'path': 'carousel/carousel-min.js',
2135              'requires': ['element'],
2136              'optional': ['animation'],
2137              'skinnable': true
2138          },
2139  
2140          'charts': {
2141              'type': 'js',
2142              'path': 'charts/charts-min.js',
2143              'requires': ['element', 'json', 'datasource', 'swf']
2144          },
2145  
2146          'colorpicker': {
2147              'type': 'js',
2148              'path': 'colorpicker/colorpicker-min.js',
2149              'requires': ['slider', 'element'],
2150              'optional': ['animation'],
2151              'skinnable': true
2152          },
2153  
2154          'connection': {
2155              'type': 'js',
2156              'path': 'connection/connection-min.js',
2157              'requires': ['event'],
2158              'supersedes': ['connectioncore']
2159          },
2160  
2161          'connectioncore': {
2162              'type': 'js',
2163              'path': 'connection/connection_core-min.js',
2164              'requires': ['event'],
2165              'pkg': 'connection'
2166          },
2167  
2168          'container': {
2169              'type': 'js',
2170              'path': 'container/container-min.js',
2171              'requires': ['dom', 'event'],
2172              // button is also optional, but this creates a circular
2173              // dependency when loadOptional is specified.  button
2174              // optionally includes menu, menu requires container.
2175              'optional': ['dragdrop', 'animation', 'connection'],
2176              'supersedes': ['containercore'],
2177              'skinnable': true
2178          },
2179  
2180          'containercore': {
2181              'type': 'js',
2182              'path': 'container/container_core-min.js',
2183              'requires': ['dom', 'event'],
2184              'pkg': 'container'
2185          },
2186  
2187          'cookie': {
2188              'type': 'js',
2189              'path': 'cookie/cookie-min.js',
2190              'requires': ['yahoo']
2191          },
2192  
2193          'datasource': {
2194              'type': 'js',
2195              'path': 'datasource/datasource-min.js',
2196              'requires': ['event'],
2197              'optional': ['connection']
2198          },
2199  
2200          'datatable': {
2201              'type': 'js',
2202              'path': 'datatable/datatable-min.js',
2203              'requires': ['element', 'datasource'],
2204              'optional': ['calendar', 'dragdrop', 'paginator'],
2205              'skinnable': true
2206          },
2207  
2208          datemath: {
2209              'type': 'js',
2210              'path': 'datemath/datemath-min.js',
2211              'requires': ['yahoo']
2212          },
2213  
2214          'dom': {
2215              'type': 'js',
2216              'path': 'dom/dom-min.js',
2217              'requires': ['yahoo']
2218          },
2219  
2220          'dragdrop': {
2221              'type': 'js',
2222              'path': 'dragdrop/dragdrop-min.js',
2223              'requires': ['dom', 'event']
2224          },
2225  
2226          'editor': {
2227              'type': 'js',
2228              'path': 'editor/editor-min.js',
2229              'requires': ['menu', 'element', 'button'],
2230              'optional': ['animation', 'dragdrop'],
2231              'supersedes': ['simpleeditor'],
2232              'skinnable': true
2233          },
2234  
2235          'element': {
2236              'type': 'js',
2237              'path': 'element/element-min.js',
2238              'requires': ['dom', 'event'],
2239              'optional': ['event-mouseenter', 'event-delegate']
2240          },
2241  
2242          'element-delegate': {
2243              'type': 'js',
2244              'path': 'element-delegate/element-delegate-min.js',
2245              'requires': ['element']
2246          },
2247  
2248          'event': {
2249              'type': 'js',
2250              'path': 'event/event-min.js',
2251              'requires': ['yahoo']
2252          },
2253  
2254          'event-simulate': {
2255              'type': 'js',
2256              'path': 'event-simulate/event-simulate-min.js',
2257              'requires': ['event']
2258          },
2259  
2260          'event-delegate': {
2261              'type': 'js',
2262              'path': 'event-delegate/event-delegate-min.js',
2263              'requires': ['event'],
2264              'optional': ['selector']
2265          },
2266  
2267          'event-mouseenter': {
2268              'type': 'js',
2269              'path': 'event-mouseenter/event-mouseenter-min.js',
2270              'requires': ['dom', 'event']
2271          },
2272  
2273          'fonts': {
2274              'type': 'css',
2275              'path': 'fonts/fonts-min.css'
2276          },
2277  
2278          'get': {
2279              'type': 'js',
2280              'path': 'get/get-min.js',
2281              'requires': ['yahoo']
2282          },
2283  
2284          'grids': {
2285              'type': 'css',
2286              'path': 'grids/grids-min.css',
2287              'requires': ['fonts'],
2288              'optional': ['reset']
2289          },
2290  
2291          'history': {
2292              'type': 'js',
2293              'path': 'history/history-min.js',
2294              'requires': ['event']
2295          },
2296  
2297           'imagecropper': {
2298               'type': 'js',
2299               'path': 'imagecropper/imagecropper-min.js',
2300               'requires': ['dragdrop', 'element', 'resize'],
2301               'skinnable': true
2302           },
2303  
2304           'imageloader': {
2305              'type': 'js',
2306              'path': 'imageloader/imageloader-min.js',
2307              'requires': ['event', 'dom']
2308           },
2309  
2310           'json': {
2311              'type': 'js',
2312              'path': 'json/json-min.js',
2313              'requires': ['yahoo']
2314           },
2315  
2316           'layout': {
2317               'type': 'js',
2318               'path': 'layout/layout-min.js',
2319               'requires': ['element'],
2320               'optional': ['animation', 'dragdrop', 'resize', 'selector'],
2321               'skinnable': true
2322           },
2323  
2324          'logger': {
2325              'type': 'js',
2326              'path': 'logger/logger-min.js',
2327              'requires': ['event', 'dom'],
2328              'optional': ['dragdrop'],
2329              'skinnable': true
2330          },
2331  
2332          'menu': {
2333              'type': 'js',
2334              'path': 'menu/menu-min.js',
2335              'requires': ['containercore'],
2336              'skinnable': true
2337          },
2338  
2339          'paginator': {
2340              'type': 'js',
2341              'path': 'paginator/paginator-min.js',
2342              'requires': ['element'],
2343              'skinnable': true
2344          },
2345  
2346          'profiler': {
2347              'type': 'js',
2348              'path': 'profiler/profiler-min.js',
2349              'requires': ['yahoo']
2350          },
2351  
2352  
2353          'profilerviewer': {
2354              'type': 'js',
2355              'path': 'profilerviewer/profilerviewer-min.js',
2356              'requires': ['profiler', 'yuiloader', 'element'],
2357              'skinnable': true
2358          },
2359  
2360          'progressbar': {
2361              'type': 'js',
2362              'path': 'progressbar/progressbar-min.js',
2363              'requires': ['element'],
2364              'optional': ['animation'],
2365              'skinnable': true
2366          },
2367  
2368          'reset': {
2369              'type': 'css',
2370              'path': 'reset/reset-min.css'
2371          },
2372  
2373          'reset-fonts-grids': {
2374              'type': 'css',
2375              'path': 'reset-fonts-grids/reset-fonts-grids.css',
2376              'supersedes': ['reset', 'fonts', 'grids', 'reset-fonts'],
2377              'rollup': 4
2378          },
2379  
2380          'reset-fonts': {
2381              'type': 'css',
2382              'path': 'reset-fonts/reset-fonts.css',
2383              'supersedes': ['reset', 'fonts'],
2384              'rollup': 2
2385          },
2386  
2387           'resize': {
2388               'type': 'js',
2389               'path': 'resize/resize-min.js',
2390               'requires': ['dragdrop', 'element'],
2391               'optional': ['animation'],
2392               'skinnable': true
2393           },
2394  
2395          'selector': {
2396              'type': 'js',
2397              'path': 'selector/selector-min.js',
2398              'requires': ['yahoo', 'dom']
2399          },
2400  
2401          'simpleeditor': {
2402              'type': 'js',
2403              'path': 'editor/simpleeditor-min.js',
2404              'requires': ['element'],
2405              'optional': ['containercore', 'menu', 'button', 'animation', 'dragdrop'],
2406              'skinnable': true,
2407              'pkg': 'editor'
2408          },
2409  
2410          'slider': {
2411              'type': 'js',
2412              'path': 'slider/slider-min.js',
2413              'requires': ['dragdrop'],
2414              'optional': ['animation'],
2415              'skinnable': true
2416          },
2417  
2418          'storage': {
2419              'type': 'js',
2420              'path': 'storage/storage-min.js',
2421              'requires': ['yahoo', 'event', 'cookie'],
2422              'optional': ['swfstore']
2423          },
2424  
2425           'stylesheet': {
2426              'type': 'js',
2427              'path': 'stylesheet/stylesheet-min.js',
2428              'requires': ['yahoo']
2429           },
2430  
2431          'swf': {
2432              'type': 'js',
2433              'path': 'swf/swf-min.js',
2434              'requires': ['element'],
2435              'supersedes': ['swfdetect']
2436          },
2437  
2438          'swfdetect': {
2439              'type': 'js',
2440              'path': 'swfdetect/swfdetect-min.js',
2441              'requires': ['yahoo']
2442          },
2443  
2444          'swfstore': {
2445              'type': 'js',
2446              'path': 'swfstore/swfstore-min.js',
2447              'requires': ['element', 'cookie', 'swf']
2448          },
2449  
2450          'tabview': {
2451              'type': 'js',
2452              'path': 'tabview/tabview-min.js',
2453              'requires': ['element'],
2454              'optional': ['connection'],
2455              'skinnable': true
2456          },
2457  
2458          'treeview': {
2459              'type': 'js',
2460              'path': 'treeview/treeview-min.js',
2461              'requires': ['event', 'dom'],
2462              'optional': ['json', 'animation', 'calendar'],
2463              'skinnable': true
2464          },
2465  
2466          'uploader': {
2467              'type': 'js',
2468              'path': 'uploader/uploader-min.js',
2469              'requires': ['element']
2470          },
2471  
2472          'utilities': {
2473              'type': 'js',
2474              'path': 'utilities/utilities.js',
2475              'supersedes': ['yahoo', 'event', 'dragdrop', 'animation', 'dom', 'connection', 'element', 'yahoo-dom-event', 'get', 'yuiloader', 'yuiloader-dom-event'],
2476              'rollup': 8
2477          },
2478  
2479          'yahoo': {
2480              'type': 'js',
2481              'path': 'yahoo/yahoo-min.js'
2482          },
2483  
2484          'yahoo-dom-event': {
2485              'type': 'js',
2486              'path': 'yahoo-dom-event/yahoo-dom-event.js',
2487              'supersedes': ['yahoo', 'event', 'dom'],
2488              'rollup': 3
2489          },
2490  
2491          'yuiloader': {
2492              'type': 'js',
2493              'path': 'yuiloader/yuiloader-min.js',
2494              'supersedes': ['yahoo', 'get']
2495          },
2496  
2497          'yuiloader-dom-event': {
2498              'type': 'js',
2499              'path': 'yuiloader-dom-event/yuiloader-dom-event.js',
2500              'supersedes': ['yahoo', 'dom', 'event', 'get', 'yuiloader', 'yahoo-dom-event'],
2501              'rollup': 5
2502          },
2503  
2504          'yuitest': {
2505              'type': 'js',
2506              'path': 'yuitest/yuitest-min.js',
2507              'requires': ['logger'],
2508              'optional': ['event-simulate'],
2509              'skinnable': true
2510          }
2511      }
2512  },
2513          ObjectUtil: {
2514              appendArray: function(o, a) {
2515                  if (a) {
2516                      for (var i=0; i<a.length; i=i+1) {
2517                          o[a[i]] = true;
2518                      }
2519                  }
2520              },
2521  
2522              keys: function(o, ordered) {
2523                  var a=[], i;
2524                  for (i in o) {
2525                      if (lang.hasOwnProperty(o, i)) {
2526                          a.push(i);
2527                      }
2528                  }
2529  
2530                  return a;
2531              }
2532          },
2533  
2534          ArrayUtil: {
2535  
2536              appendArray: function(a1, a2) {
2537                  Array.prototype.push.apply(a1, a2);
2538                  /*
2539                  for (var i=0; i<a2.length; i=i+1) {
2540                      a1.push(a2[i]);
2541                  }
2542                  */
2543              },
2544  
2545              indexOf: function(a, val) {
2546                  for (var i=0; i<a.length; i=i+1) {
2547                      if (a[i] === val) {
2548                          return i;
2549                      }
2550                  }
2551  
2552                  return -1;
2553              },
2554  
2555              toObject: function(a) {
2556                  var o = {};
2557                  for (var i=0; i<a.length; i=i+1) {
2558                      o[a[i]] = true;
2559                  }
2560  
2561                  return o;
2562              },
2563  
2564              /*
2565               * Returns a unique array.  Does not maintain order, which is fine
2566               * for this application, and performs better than it would if it
2567               * did.
2568               */
2569              uniq: function(a) {
2570                  return YUI.ObjectUtil.keys(YUI.ArrayUtil.toObject(a));
2571              }
2572          }
2573      };
2574  
2575      YAHOO.util.YUILoader = function(o) {
2576  
2577          /**
2578           * Internal callback to handle multiple internal insert() calls
2579           * so that css is inserted prior to js
2580           * @property _internalCallback
2581           * @private
2582           */
2583          this._internalCallback = null;
2584  
2585          /**
2586           * Use the YAHOO environment listener to detect script load.  This
2587           * is only switched on for Safari 2.x and below.
2588           * @property _useYahooListener
2589           * @private
2590           */
2591          this._useYahooListener = false;
2592  
2593          /**
2594           * Callback that will be executed when the loader is finished
2595           * with an insert
2596           * @method onSuccess
2597           * @type function
2598           */
2599          this.onSuccess = null;
2600  
2601          /**
2602           * Callback that will be executed if there is a failure
2603           * @method onFailure
2604           * @type function
2605           */
2606          this.onFailure = Y.log;
2607  
2608          /**
2609           * Callback that will be executed each time a new module is loaded
2610           * @method onProgress
2611           * @type function
2612           */
2613          this.onProgress = null;
2614  
2615          /**
2616           * Callback that will be executed if a timeout occurs
2617           * @method onTimeout
2618           * @type function
2619           */
2620          this.onTimeout = null;
2621  
2622          /**
2623           * The execution scope for all callbacks
2624           * @property scope
2625           * @default this
2626           */
2627          this.scope = this;
2628  
2629          /**
2630           * Data that is passed to all callbacks
2631           * @property data
2632           */
2633          this.data = null;
2634  
2635          /**
2636           * Node reference or id where new nodes should be inserted before
2637           * @property insertBefore
2638           * @type string|HTMLElement
2639           */
2640          this.insertBefore = null;
2641  
2642          /**
2643           * The charset attribute for inserted nodes
2644           * @property charset
2645           * @type string
2646           * @default utf-8
2647           */
2648          this.charset = null;
2649  
2650          /**
2651           * The name of the variable in a sandbox or script node
2652           * (for external script support in Safari 2.x and earlier)
2653           * to reference when the load is complete.  If this variable
2654           * is not available in the specified scripts, the operation will
2655           * fail.
2656           * @property varName
2657           * @type string
2658           */
2659          this.varName = null;
2660  
2661          /**
2662           * The base directory.
2663           * @property base
2664           * @type string
2665           * @default http://yui.yahooapis.com/[YUI VERSION]/build/
2666           */
2667          this.base = YUI.info.base;
2668  
2669          /**
2670           * Base path for the combo service
2671           * @property comboBase
2672           * @type string
2673           * @default http://yui.yahooapis.com/combo?
2674           */
2675          this.comboBase = YUI.info.comboBase;
2676  
2677          /**
2678           * If configured, YUI will use the the combo handler on the
2679           * Yahoo! CDN to pontentially reduce the number of http requests
2680           * required.
2681           * @property combine
2682           * @type boolean
2683           * @default false
2684           */
2685          // this.combine = (o && !('base' in o));
2686          this.combine = false;
2687  
2688  
2689          /**
2690           * Root path to prepend to module path for the combo
2691           * service
2692           * @property root
2693           * @type string
2694           * @default [YUI VERSION]/build/
2695           */
2696          this.root = YUI.info.root;
2697  
2698          /**
2699           * Timeout value in milliseconds.  If set, this value will be used by
2700           * the get utility.  the timeout event will fire if
2701           * a timeout occurs.
2702           * @property timeout
2703           * @type int
2704           */
2705          this.timeout = 0;
2706  
2707          /**
2708           * A list of modules that should not be loaded, even if
2709           * they turn up in the dependency tree
2710           * @property ignore
2711           * @type string[]
2712           */
2713          this.ignore = null;
2714  
2715          /**
2716           * A list of modules that should always be loaded, even
2717           * if they have already been inserted into the page.
2718           * @property force
2719           * @type string[]
2720           */
2721          this.force = null;
2722  
2723          /**
2724           * Should we allow rollups
2725           * @property allowRollup
2726           * @type boolean
2727           * @default true
2728           */
2729          this.allowRollup = true;
2730  
2731          /**
2732           * A filter to apply to result urls.  This filter will modify the default
2733           * path for all modules.  The default path for the YUI library is the
2734           * minified version of the files (e.g., event-min.js).  The filter property
2735           * can be a predefined filter or a custom filter.  The valid predefined
2736           * filters are:
2737           * <dl>
2738           *  <dt>DEBUG</dt>
2739           *  <dd>Selects the debug versions of the library (e.g., event-debug.js).
2740           *      This option will automatically include the logger widget</dd>
2741           *  <dt>RAW</dt>
2742           *  <dd>Selects the non-minified version of the library (e.g., event.js).
2743           * </dl>
2744           * You can also define a custom filter, which must be an object literal
2745           * containing a search expression and a replace string:
2746           * <pre>
2747           *  myFilter: &#123;
2748           *      'searchExp': "-min\\.js",
2749           *      'replaceStr': "-debug.js"
2750           *  &#125;
2751           * </pre>
2752           * @property filter
2753           * @type string|{searchExp: string, replaceStr: string}
2754           */
2755          this.filter = null;
2756  
2757          /**
2758           * The list of requested modules
2759           * @property required
2760           * @type {string: boolean}
2761           */
2762          this.required = {};
2763  
2764          /**
2765           * The library metadata
2766           * @property moduleInfo
2767           */
2768          this.moduleInfo = lang.merge(YUI.info.moduleInfo);
2769  
2770          /**
2771           * List of rollup files found in the library metadata
2772           * @property rollups
2773           */
2774          this.rollups = null;
2775  
2776          /**
2777           * Whether or not to load optional dependencies for
2778           * the requested modules
2779           * @property loadOptional
2780           * @type boolean
2781           * @default false
2782           */
2783          this.loadOptional = false;
2784  
2785          /**
2786           * All of the derived dependencies in sorted order, which
2787           * will be populated when either calculate() or insert()
2788           * is called
2789           * @property sorted
2790           * @type string[]
2791           */
2792          this.sorted = [];
2793  
2794          /**
2795           * Set when beginning to compute the dependency tree.
2796           * Composed of what YAHOO reports to be loaded combined
2797           * with what has been loaded by the tool
2798           * @propery loaded
2799           * @type {string: boolean}
2800           */
2801          this.loaded = {};
2802  
2803          /**
2804           * Flag to indicate the dependency tree needs to be recomputed
2805           * if insert is called again.
2806           * @property dirty
2807           * @type boolean
2808           * @default true
2809           */
2810          this.dirty = true;
2811  
2812          /**
2813           * List of modules inserted by the utility
2814           * @property inserted
2815           * @type {string: boolean}
2816           */
2817          this.inserted = {};
2818  
2819          /**
2820           * Provides the information used to skin the skinnable components.
2821           * The following skin definition would result in 'skin1' and 'skin2'
2822           * being loaded for calendar (if calendar was requested), and
2823           * 'sam' for all other skinnable components:
2824           *
2825           *   <code>
2826           *   skin: {
2827           *
2828           *      // The default skin, which is automatically applied if not
2829           *      // overriden by a component-specific skin definition.
2830           *      // Change this in to apply a different skin globally
2831           *      defaultSkin: 'sam',
2832           *
2833           *      // This is combined with the loader base property to get
2834           *      // the default root directory for a skin. ex:
2835           *      // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
2836           *      base: 'assets/skins/',
2837           *
2838           *      // The name of the rollup css file for the skin
2839           *      path: 'skin.css',
2840           *
2841           *      // The number of skinnable components requested that are
2842           *      // required before using the rollup file rather than the
2843           *      // individual component css files
2844           *      rollup: 3,
2845           *
2846           *      // Any component-specific overrides can be specified here,
2847           *      // making it possible to load different skins for different
2848           *      // components.  It is possible to load more than one skin
2849           *      // for a given component as well.
2850           *      overrides: {
2851           *          calendar: ['skin1', 'skin2']
2852           *      }
2853           *   }
2854           *   </code>
2855           *   @property skin
2856           */
2857  
2858          var self = this;
2859  
2860          env.listeners.push(function(m) {
2861              if (self._useYahooListener) {
2862                  //Y.log("YAHOO listener: " + m.name);
2863                  self.loadNext(m.name);
2864              }
2865          });
2866  
2867          this.skin = lang.merge(YUI.info.skin);
2868  
2869          this._config(o);
2870  
2871      };
2872  
2873      Y.util.YUILoader.prototype = {
2874  
2875          FILTERS: {
2876              RAW: {
2877                  'searchExp': "-min\\.js",
2878                  'replaceStr': ".js"
2879              },
2880              DEBUG: {
2881                  'searchExp': "-min\\.js",
2882                  'replaceStr': "-debug.js"
2883              }
2884          },
2885  
2886          SKIN_PREFIX: "skin-",
2887  
2888          _config: function(o) {
2889  
2890              // apply config values
2891              if (o) {
2892                  for (var i in o) {
2893                      if (lang.hasOwnProperty(o, i)) {
2894                          if (i == "require") {
2895                              this.require(o[i]);
2896                          } else {
2897                              this[i] = o[i];
2898                          }
2899                      }
2900                  }
2901              }
2902  
2903              // fix filter
2904              var f = this.filter;
2905  
2906              if (lang.isString(f)) {
2907                  f = f.toUpperCase();
2908  
2909                  // the logger must be available in order to use the debug
2910                  // versions of the library
2911                  if (f === "DEBUG") {
2912                      this.require("logger");
2913                  }
2914  
2915                  // hack to handle a a bug where LogWriter is being instantiated
2916                  // at load time, and the loader has no way to sort above it
2917                  // at the moment.
2918                  if (!Y.widget.LogWriter) {
2919                      Y.widget.LogWriter = function() {
2920                          return Y;
2921                      };
2922                  }
2923  
2924                  this.filter = this.FILTERS[f];
2925              }
2926  
2927          },
2928  
2929          /** Add a new module to the component metadata.
2930           * <dl>
2931           *     <dt>name:</dt>       <dd>required, the component name</dd>
2932           *     <dt>type:</dt>       <dd>required, the component type (js or css)</dd>
2933           *     <dt>path:</dt>       <dd>required, the path to the script from "base"</dd>
2934           *     <dt>requires:</dt>   <dd>array of modules required by this component</dd>
2935           *     <dt>optional:</dt>   <dd>array of optional modules for this component</dd>
2936           *     <dt>supersedes:</dt> <dd>array of the modules this component replaces</dd>
2937           *     <dt>after:</dt>      <dd>array of modules the components which, if present, should be sorted above this one</dd>
2938           *     <dt>rollup:</dt>     <dd>the number of superseded modules required for automatic rollup</dd>
2939           *     <dt>fullpath:</dt>   <dd>If fullpath is specified, this is used instead of the configured base + path</dd>
2940           *     <dt>skinnable:</dt>  <dd>flag to determine if skin assets should automatically be pulled in</dd>
2941           * </dl>
2942           * @method addModule
2943           * @param o An object containing the module data
2944           * @return {boolean} true if the module was added, false if
2945           * the object passed in did not provide all required attributes
2946           */
2947          addModule: function(o) {
2948  
2949              if (!o || !o.name || !o.type || (!o.path && !o.fullpath)) {
2950                  return false;
2951              }
2952  
2953              o.ext = ('ext' in o) ? o.ext : true;
2954              o.requires = o.requires || [];
2955  
2956              this.moduleInfo[o.name] = o;
2957              this.dirty = true;
2958  
2959              return true;
2960          },
2961  
2962          /**
2963           * Add a requirement for one or more module
2964           * @method require
2965           * @param what {string[] | string*} the modules to load
2966           */
2967          require: function(what) {
2968              var a = (typeof what === "string") ? arguments : what;
2969              this.dirty = true;
2970              YUI.ObjectUtil.appendArray(this.required, a);
2971          },
2972  
2973          /**
2974           * Adds the skin def to the module info
2975           * @method _addSkin
2976           * @param skin {string} the name of the skin
2977           * @param mod {string} the name of the module
2978           * @return {string} the module name for the skin
2979           * @private
2980           */
2981          _addSkin: function(skin, mod) {
2982  
2983              // Add a module definition for the skin rollup css
2984              var name = this.formatSkin(skin), info = this.moduleInfo,
2985                  sinf = this.skin, ext = info[mod] && info[mod].ext;
2986  
2987              // Y.log('ext? ' + mod + ": " + ext);
2988              if (!info[name]) {
2989                  // Y.log('adding skin ' + name);
2990                  this.addModule({
2991                      'name': name,
2992                      'type': 'css',
2993                      'path': sinf.base + skin + '/' + sinf.path,
2994                      //'supersedes': '*',
2995                      'after': sinf.after,
2996                      'rollup': sinf.rollup,
2997                      'ext': ext
2998                  });
2999              }
3000  
3001              // Add a module definition for the module-specific skin css
3002              if (mod) {
3003                  name = this.formatSkin(skin, mod);
3004                  if (!info[name]) {
3005                      var mdef = info[mod], pkg = mdef.pkg || mod;
3006                      // Y.log('adding skin ' + name);
3007                      this.addModule({
3008                          'name': name,
3009                          'type': 'css',
3010                          'after': sinf.after,
3011                          'path': pkg + '/' + sinf.base + skin + '/' + mod + '.css',
3012                          'ext': ext
3013                      });
3014                  }
3015              }
3016  
3017              return name;
3018          },
3019  
3020          /**
3021           * Returns an object containing properties for all modules required
3022           * in order to load the requested module
3023           * @method getRequires
3024           * @param mod The module definition from moduleInfo
3025           */
3026          getRequires: function(mod) {
3027              if (!mod) {
3028                  return [];
3029              }
3030  
3031              if (!this.dirty && mod.expanded) {
3032                  return mod.expanded;
3033              }
3034  
3035              mod.requires=mod.requires || [];
3036              var i, d=[], r=mod.requires, o=mod.optional, info=this.moduleInfo, m;
3037              for (i=0; i<r.length; i=i+1) {
3038                  d.push(r[i]);
3039                  m = info[r[i]];
3040                  YUI.ArrayUtil.appendArray(d, this.getRequires(m));
3041              }
3042  
3043              if (o && this.loadOptional) {
3044                  for (i=0; i<o.length; i=i+1) {
3045                      d.push(o[i]);
3046                      YUI.ArrayUtil.appendArray(d, this.getRequires(info[o[i]]));
3047                  }
3048              }
3049  
3050              mod.expanded = YUI.ArrayUtil.uniq(d);
3051  
3052              return mod.expanded;
3053          },
3054  
3055  
3056          /**
3057           * Returns an object literal of the modules the supplied module satisfies
3058           * @method getProvides
3059           * @param name{string} The name of the module
3060           * @param notMe {string} don't add this module name, only include superseded modules
3061           * @return what this module provides
3062           */
3063          getProvides: function(name, notMe) {
3064              var addMe = !(notMe), ckey = (addMe) ? PROV : SUPER,
3065                  m = this.moduleInfo[name], o = {};
3066  
3067              if (!m) {
3068                  return o;
3069              }
3070  
3071              if (m[ckey]) {
3072  // Y.log('cached: ' + name + ' ' + ckey + ' ' + lang.dump(this.moduleInfo[name][ckey], 0));
3073                  return m[ckey];
3074              }
3075  
3076              var s = m.supersedes, done={}, me = this;
3077  
3078              // use worker to break cycles
3079              var add = function(mm) {
3080                  if (!done[mm]) {
3081                      // Y.log(name + ' provides worker trying: ' + mm);
3082                      done[mm] = true;
3083                      // we always want the return value normal behavior
3084                      // (provides) for superseded modules.
3085                      lang.augmentObject(o, me.getProvides(mm));
3086                  }
3087  
3088                  // else {
3089                  // Y.log(name + ' provides worker skipping done: ' + mm);
3090                  // }
3091              };
3092  
3093              // calculate superseded modules
3094              if (s) {
3095                  for (var i=0; i<s.length; i=i+1) {
3096                      add(s[i]);
3097                  }
3098              }
3099  
3100              // supersedes cache
3101              m[SUPER] = o;
3102              // provides cache
3103              m[PROV] = lang.merge(o);
3104              m[PROV][name] = true;
3105  
3106  // Y.log(name + " supersedes " + lang.dump(m[SUPER], 0));
3107  // Y.log(name + " provides " + lang.dump(m[PROV], 0));
3108  
3109              return m[ckey];
3110          },
3111  
3112  
3113          /**
3114           * Calculates the dependency tree, the result is stored in the sorted
3115           * property
3116           * @method calculate
3117           * @param o optional options object
3118           */
3119          calculate: function(o) {
3120              if (o || this.dirty) {
3121                  this._config(o);
3122                  this._setup();
3123                  this._explode();
3124                  if (this.allowRollup) {
3125                      this._rollup();
3126                  }
3127                  this._reduce();
3128                  this._sort();
3129  
3130                  // Y.log("after calculate: " + lang.dump(this.required));
3131  
3132                  this.dirty = false;
3133              }
3134          },
3135  
3136          /**
3137           * Investigates the current YUI configuration on the page.  By default,
3138           * modules already detected will not be loaded again unless a force
3139           * option is encountered.  Called by calculate()
3140           * @method _setup
3141           * @private
3142           */
3143          _setup: function() {
3144  
3145              var info = this.moduleInfo, name, i, j;
3146  
3147              // Create skin modules
3148              for (name in info) {
3149  
3150                  if (lang.hasOwnProperty(info, name)) {
3151                      var m = info[name];
3152                      if (m && m.skinnable) {
3153                          // Y.log("skinning: " + name);
3154                          var o=this.skin.overrides, smod;
3155                          if (o && o[name]) {
3156                              for (i=0; i<o[name].length; i=i+1) {
3157                                  smod = this._addSkin(o[name][i], name);
3158                              }
3159                          } else {
3160                              smod = this._addSkin(this.skin.defaultSkin, name);
3161                          }
3162  
3163                          if (YUI.ArrayUtil.indexOf(m.requires, smod) == -1) {
3164                              m.requires.push(smod);
3165                          }
3166                      }
3167                  }
3168  
3169              }
3170  
3171              var l = lang.merge(this.inserted); // shallow clone
3172  
3173              if (!this._sandbox) {
3174                  l = lang.merge(l, env.modules);
3175              }
3176  
3177              // Y.log("Already loaded stuff: " + lang.dump(l, 0));
3178  
3179              // add the ignore list to the list of loaded packages
3180              if (this.ignore) {
3181                  YUI.ObjectUtil.appendArray(l, this.ignore);
3182              }
3183  
3184              // remove modules on the force list from the loaded list
3185              if (this.force) {
3186                  for (i=0; i<this.force.length; i=i+1) {
3187                      if (this.force[i] in l) {
3188                          delete l[this.force[i]];
3189                      }
3190                  }
3191              }
3192  
3193              // expand the list to include superseded modules
3194              for (j in l) {
3195                  // Y.log("expanding: " + j);
3196                  if (lang.hasOwnProperty(l, j)) {
3197                      lang.augmentObject(l, this.getProvides(j));
3198                  }
3199              }
3200  
3201              // Y.log("loaded expanded: " + lang.dump(l, 0));
3202  
3203              this.loaded = l;
3204  
3205          },
3206  
3207  
3208          /**
3209           * Inspects the required modules list looking for additional
3210           * dependencies.  Expands the required list to include all
3211           * required modules.  Called by calculate()
3212           * @method _explode
3213           * @private
3214           */
3215          _explode: function() {
3216  
3217              var r=this.required, i, mod;
3218  
3219              for (i in r) {
3220                  if (lang.hasOwnProperty(r, i)) {
3221                      mod = this.moduleInfo[i];
3222                      if (mod) {
3223  
3224                          var req = this.getRequires(mod);
3225  
3226                          if (req) {
3227                              YUI.ObjectUtil.appendArray(r, req);
3228                          }
3229                      }
3230                  }
3231              }
3232          },
3233  
3234          /*
3235           * @method _skin
3236           * @private
3237           * @deprecated
3238           */
3239          _skin: function() {
3240          },
3241  
3242          /**
3243           * Returns the skin module name for the specified skin name.  If a
3244           * module name is supplied, the returned skin module name is
3245           * specific to the module passed in.
3246           * @method formatSkin
3247           * @param skin {string} the name of the skin
3248           * @param mod {string} optional: the name of a module to skin
3249           * @return {string} the full skin module name
3250           */
3251          formatSkin: function(skin, mod) {
3252              var s = this.SKIN_PREFIX + skin;
3253              if (mod) {
3254                  s = s + "-" + mod;
3255              }
3256  
3257              return s;
3258          },
3259  
3260          /**
3261           * Reverses <code>formatSkin</code>, providing the skin name and
3262           * module name if the string matches the pattern for skins.
3263           * @method parseSkin
3264           * @param mod {string} the module name to parse
3265           * @return {skin: string, module: string} the parsed skin name
3266           * and module name, or null if the supplied string does not match
3267           * the skin pattern
3268           */
3269          parseSkin: function(mod) {
3270  
3271              if (mod.indexOf(this.SKIN_PREFIX) === 0) {
3272                  var a = mod.split("-");
3273                  return {skin: a[1], module: a[2]};
3274              }
3275  
3276              return null;
3277          },
3278  
3279          /**
3280           * Look for rollup packages to determine if all of the modules a
3281           * rollup supersedes are required.  If so, include the rollup to
3282           * help reduce the total number of connections required.  Called
3283           * by calculate()
3284           * @method _rollup
3285           * @private
3286           */
3287          _rollup: function() {
3288              var i, j, m, s, rollups={}, r=this.required, roll,
3289                  info = this.moduleInfo;
3290  
3291              // find and cache rollup modules
3292              if (this.dirty || !this.rollups) {
3293                  for (i in info) {
3294                      if (lang.hasOwnProperty(info, i)) {
3295                          m = info[i];
3296                          //if (m && m.rollup && m.supersedes) {
3297                          if (m && m.rollup) {
3298                              rollups[i] = m;
3299                          }
3300                      }
3301                  }
3302  
3303                  this.rollups = rollups;
3304              }
3305  
3306              // make as many passes as needed to pick up rollup rollups
3307              for (;;) {
3308                  var rolled = false;
3309  
3310                  // go through the rollup candidates
3311                  for (i in rollups) {
3312  
3313                      // there can be only one
3314                      if (!r[i] && !this.loaded[i]) {
3315                          m =info[i]; s = m.supersedes; roll=false;
3316  
3317                          if (!m.rollup) {
3318                              continue;
3319                          }
3320  
3321                          var skin = (m.ext) ? false : this.parseSkin(i), c = 0;
3322  
3323                          // Y.log('skin? ' + i + ": " + skin);
3324                          if (skin) {
3325                              for (j in r) {
3326                                  if (lang.hasOwnProperty(r, j)) {
3327                                      if (i !== j && this.parseSkin(j)) {
3328                                          c++;
3329                                          roll = (c >= m.rollup);
3330                                          if (roll) {
3331                                              // Y.log("skin rollup " + lang.dump(r));
3332                                              break;
3333                                          }
3334                                      }
3335                                  }
3336                              }
3337  
3338                          } else {
3339  
3340                              // check the threshold
3341                              for (j=0;j<s.length;j=j+1) {
3342  
3343                                  // if the superseded module is loaded, we can't load the rollup
3344                                  if (this.loaded[s[j]] && (!YUI.dupsAllowed[s[j]])) {
3345                                      roll = false;
3346                                      break;
3347                                  // increment the counter if this module is required.  if we are
3348                                  // beyond the rollup threshold, we will use the rollup module
3349                                  } else if (r[s[j]]) {
3350                                      c++;
3351                                      roll = (c >= m.rollup);
3352                                      if (roll) {
3353                                          // Y.log("over thresh " + c + ", " + lang.dump(r));
3354                                          break;
3355                                      }
3356                                  }
3357                              }
3358                          }
3359  
3360                          if (roll) {
3361                              // Y.log("rollup: " +  i + ", " + lang.dump(this, 1));
3362                              // add the rollup
3363                              r[i] = true;
3364                              rolled = true;
3365  
3366                              // expand the rollup's dependencies
3367                              this.getRequires(m);
3368                          }
3369                      }
3370                  }
3371  
3372                  // if we made it here w/o rolling up something, we are done
3373                  if (!rolled) {
3374                      break;
3375                  }
3376              }
3377          },
3378  
3379          /**
3380           * Remove superceded modules and loaded modules.  Called by
3381           * calculate() after we have the mega list of all dependencies
3382           * @method _reduce
3383           * @private
3384           */
3385          _reduce: function() {
3386  
3387              var i, j, s, m, r=this.required;
3388              for (i in r) {
3389  
3390                  // remove if already loaded
3391                  if (i in this.loaded) {
3392                      delete r[i];
3393  
3394                  // remove anything this module supersedes
3395                  } else {
3396  
3397                      var skinDef = this.parseSkin(i);
3398  
3399                      if (skinDef) {
3400                          //YAHOO.log("skin found in reduce: " + skinDef.skin + ", " + skinDef.module);
3401                          // the skin rollup will not have a module name
3402                          if (!skinDef.module) {
3403                              var skin_pre = this.SKIN_PREFIX + skinDef.skin;
3404                              //YAHOO.log("skin_pre: " + skin_pre);
3405                              for (j in r) {
3406  
3407                                  if (lang.hasOwnProperty(r, j)) {
3408                                      m = this.moduleInfo[j];
3409                                      var ext = m && m.ext;
3410                                      if (!ext && j !== i && j.indexOf(skin_pre) > -1) {
3411                                          // Y.log ("removing component skin: " + j);
3412                                          delete r[j];
3413                                      }
3414                                  }
3415                              }
3416                          }
3417                      } else {
3418  
3419                           m = this.moduleInfo[i];
3420                           s = m && m.supersedes;
3421                           if (s) {
3422                               for (j=0; j<s.length; j=j+1) {
3423                                   if (s[j] in r) {
3424                                       delete r[s[j]];
3425                                   }
3426                               }
3427                           }
3428                      }
3429                  }
3430              }
3431          },
3432  
3433          _onFailure: function(msg) {
3434              YAHOO.log('Failure', 'info', 'loader');
3435  
3436              var f = this.onFailure;
3437              if (f) {
3438                  f.call(this.scope, {
3439                      msg: 'failure: ' + msg,
3440                      data: this.data,
3441                      success: false
3442                  });
3443              }
3444          },
3445  
3446          _onTimeout: function() {
3447              YAHOO.log('Timeout', 'info', 'loader');
3448              var f = this.onTimeout;
3449              if (f) {
3450                  f.call(this.scope, {
3451                      msg: 'timeout',
3452                      data: this.data,
3453                      success: false
3454                  });
3455              }
3456          },
3457  
3458          /**
3459           * Sorts the dependency tree.  The last step of calculate()
3460           * @method _sort
3461           * @private
3462           */
3463          _sort: function() {
3464              // create an indexed list
3465              var s=[], info=this.moduleInfo, loaded=this.loaded,
3466                  checkOptional=!this.loadOptional, me = this;
3467  
3468              // returns true if b is not loaded, and is required
3469              // directly or by means of modules it supersedes.
3470              var requires = function(aa, bb) {
3471  
3472                  var mm=info[aa];
3473  
3474                  if (loaded[bb] || !mm) {
3475                      return false;
3476                  }
3477  
3478                  var ii,
3479                      rr = mm.expanded,
3480                      after = mm.after,
3481                      other = info[bb],
3482                      optional = mm.optional;
3483  
3484  
3485                  // check if this module requires the other directly
3486                  if (rr && YUI.ArrayUtil.indexOf(rr, bb) > -1) {
3487                      return true;
3488                  }
3489  
3490                  // check if this module should be sorted after the other
3491                  if (after && YUI.ArrayUtil.indexOf(after, bb) > -1) {
3492                      return true;
3493                  }
3494  
3495                  // if loadOptional is not specified, optional dependencies still
3496                  // must be sorted correctly when present.
3497                  if (checkOptional && optional && YUI.ArrayUtil.indexOf(optional, bb) > -1) {
3498                      return true;
3499                  }
3500  
3501                  // check if this module requires one the other supersedes
3502                  var ss=info[bb] && info[bb].supersedes;
3503                  if (ss) {
3504                      for (ii=0; ii<ss.length; ii=ii+1) {
3505                          if (requires(aa, ss[ii])) {
3506                              return true;
3507                          }
3508                      }
3509                  }
3510  
3511                  // external css files should be sorted below yui css
3512                  if (mm.ext && mm.type == 'css' && !other.ext && other.type == 'css') {
3513                      return true;
3514                  }
3515  
3516                  return false;
3517              };
3518  
3519              // get the required items out of the obj into an array so we
3520              // can sort
3521              for (var i in this.required) {
3522                  if (lang.hasOwnProperty(this.required, i)) {
3523                      s.push(i);
3524                  }
3525              }
3526  
3527              // pointer to the first unsorted item
3528              var p=0;
3529  
3530              // keep going until we make a pass without moving anything
3531              for (;;) {
3532  
3533                  var l=s.length, a, b, j, k, moved=false;
3534  
3535                  // start the loop after items that are already sorted
3536                  for (j=p; j<l; j=j+1) {
3537  
3538                      // check the next module on the list to see if its
3539                      // dependencies have been met
3540                      a = s[j];
3541  
3542                      // check everything below current item and move if we
3543                      // find a requirement for the current item
3544                      for (k=j+1; k<l; k=k+1) {
3545                          if (requires(a, s[k])) {
3546  
3547                              // extract the dependency so we can move it up
3548                              b = s.splice(k, 1);
3549  
3550                              // insert the dependency above the item that
3551                              // requires it
3552                              s.splice(j, 0, b[0]);
3553  
3554                              moved = true;
3555                              break;
3556                          }
3557                      }
3558  
3559                      // jump out of loop if we moved something
3560                      if (moved) {
3561                          break;
3562                      // this item is sorted, move our pointer and keep going
3563                      } else {
3564                          p = p + 1;
3565                      }
3566                  }
3567  
3568                  // when we make it here and moved is false, we are
3569                  // finished sorting
3570                  if (!moved) {
3571                      break;
3572                  }
3573  
3574              }
3575  
3576              this.sorted = s;
3577          },
3578  
3579          toString: function() {
3580              var o = {
3581                  type: "YUILoader",
3582                  base: this.base,
3583                  filter: this.filter,
3584                  required: this.required,
3585                  loaded: this.loaded,
3586                  inserted: this.inserted
3587              };
3588  
3589              lang.dump(o, 1);
3590          },
3591  
3592          _combine: function() {
3593  
3594                  this._combining = [];
3595  
3596                  var self = this,
3597                      s=this.sorted,
3598                      len = s.length,
3599                      js = this.comboBase,
3600                      css = this.comboBase,
3601                      target,
3602                      startLen = js.length,
3603                      i, m, type = this.loadType;
3604  
3605                  YAHOO.log('type ' + type);
3606  
3607                  for (i=0; i<len; i=i+1) {
3608  
3609                      m = this.moduleInfo[s[i]];
3610  
3611                      if (m && !m.ext && (!type || type === m.type)) {
3612  
3613                          target = this.root + m.path;
3614  
3615                          // if (i < len-1) {
3616                          target += '&';
3617                          // }
3618  
3619                          if (m.type == 'js') {
3620                              js += target;
3621                          } else {
3622                              css += target;
3623                          }
3624  
3625                          // YAHOO.log(target);
3626                          this._combining.push(s[i]);
3627                      }
3628                  }
3629  
3630                  if (this._combining.length) {
3631  
3632  YAHOO.log('Attempting to combine: ' + this._combining, "info", "loader");
3633  
3634                      var callback=function(o) {
3635                          // YAHOO.log('Combo complete: ' + o.data, "info", "loader");
3636                          // this._combineComplete = true;
3637  
3638                          var c=this._combining, len=c.length, i, m;
3639                          for (i=0; i<len; i=i+1) {
3640                              this.inserted[c[i]] = true;
3641                          }
3642  
3643                          this.loadNext(o.data);
3644                      },
3645  
3646                      loadScript = function() {
3647                          // YAHOO.log('combining js: ' + js);
3648                          if (js.length > startLen) {
3649                              YAHOO.util.Get.script(self._filter(js), {
3650                                  data: self._loading,
3651                                  onSuccess: callback,
3652                                  onFailure: self._onFailure,
3653                                  onTimeout: self._onTimeout,
3654                                  insertBefore: self.insertBefore,
3655                                  charset: self.charset,
3656                                  timeout: self.timeout,
3657                                  scope: self
3658                              });
3659                          } else {
3660                              this.loadNext();
3661                          }
3662                      };
3663  
3664                      // load the css first
3665                      // YAHOO.log('combining css: ' + css);
3666                      if (css.length > startLen) {
3667                          YAHOO.util.Get.css(this._filter(css), {
3668                              data: this._loading,
3669                              onSuccess: loadScript,
3670                              onFailure: this._onFailure,
3671                              onTimeout: this._onTimeout,
3672                              insertBefore: this.insertBefore,
3673                              charset: this.charset,
3674                              timeout: this.timeout,
3675                              scope: self
3676                          });
3677                      } else {
3678                          loadScript();
3679                      }
3680  
3681                      return;
3682  
3683                  } else {
3684                      // this._combineComplete = true;
3685                      this.loadNext(this._loading);
3686                  }
3687          },
3688  
3689          /**
3690           * inserts the requested modules and their dependencies.
3691           * <code>type</code> can be "js" or "css".  Both script and
3692           * css are inserted if type is not provided.
3693           * @method insert
3694           * @param o optional options object
3695           * @param type {string} the type of dependency to insert
3696           */
3697          insert: function(o, type) {
3698              // if (o) {
3699              //     Y.log("insert: " + lang.dump(o, 1) + ", " + type);
3700              // } else {
3701              //     Y.log("insert: " + this.toString() + ", " + type);
3702              // }
3703  
3704              // build the dependency list
3705              this.calculate(o);
3706  
3707  
3708              // set a flag to indicate the load has started
3709              this._loading = true;
3710  
3711              // flag to indicate we are done with the combo service
3712              // and any additional files will need to be loaded
3713              // individually
3714              // this._combineComplete = false;
3715  
3716              // keep the loadType (js, css or undefined) cached
3717              this.loadType = type;
3718  
3719              if (this.combine) {
3720                  return this._combine();
3721              }
3722  
3723              if (!type) {
3724                  // Y.log("trying to load css first");
3725                  var self = this;
3726                  this._internalCallback = function() {
3727                              self._internalCallback = null;
3728                              self.insert(null, "js");
3729                          };
3730                  this.insert(null, "css");
3731                  return;
3732              }
3733  
3734  
3735              // start the load
3736              this.loadNext();
3737  
3738          },
3739  
3740          /**
3741           * Interns the script for the requested modules.  The callback is
3742           * provided a reference to the sandboxed YAHOO object.  This only
3743           * applies to the script: css can not be sandboxed; css will be
3744           * loaded into the page normally if specified.
3745           * @method sandbox
3746           * @param callback {Function} the callback to exectued when the load is
3747           *        complete.
3748           */
3749          sandbox: function(o, type) {
3750              // if (o) {
3751                  // YAHOO.log("sandbox: " + lang.dump(o, 1) + ", " + type);
3752              // } else {
3753                  // YAHOO.log("sandbox: " + this.toString() + ", " + type);
3754              // }
3755  
3756              var self = this,
3757                  success = function(o) {
3758  
3759                      var idx=o.argument[0], name=o.argument[2];
3760  
3761                      // store the response in the position it was requested
3762                      self._scriptText[idx] = o.responseText;
3763  
3764                      // YAHOO.log("received: " + o.responseText.substr(0, 100) + ", " + idx);
3765  
3766                      if (self.onProgress) {
3767                          self.onProgress.call(self.scope, {
3768                                      name: name,
3769                                      scriptText: o.responseText,
3770                                      xhrResponse: o,
3771                                      data: self.data
3772                                  });
3773                      }
3774  
3775                      // only generate the sandbox once everything is loaded
3776                      self._loadCount++;
3777  
3778                      if (self._loadCount >= self._stopCount) {
3779  
3780                          // the variable to find
3781                          var v = self.varName || "YAHOO";
3782  
3783                          // wrap the contents of the requested modules in an anonymous function
3784                          var t = "(function() {\n";
3785  
3786                          // return the locally scoped reference.
3787                          var b = "\nreturn " + v + ";\n})();";
3788  
3789                          var ref = eval(t + self._scriptText.join("\n") + b);
3790  
3791                          self._pushEvents(ref);
3792  
3793                          if (ref) {
3794                              self.onSuccess.call(self.scope, {
3795                                      reference: ref,
3796                                      data: self.data
3797                                  });
3798                          } else {
3799                              self._onFailure.call(self.varName + " reference failure");
3800                          }
3801                      }
3802                  },
3803  
3804                  failure = function(o) {
3805                      self.onFailure.call(self.scope, {
3806                              msg: "XHR failure",
3807                              xhrResponse: o,
3808                              data: self.data
3809                          });
3810                  };
3811  
3812              self._config(o);
3813  
3814              if (!self.onSuccess) {
3815  throw new Error("You must supply an onSuccess handler for your sandbox");
3816              }
3817  
3818              self._sandbox = true;
3819  
3820  
3821              // take care of any css first (this can't be sandboxed)
3822              if (!type || type !== "js") {
3823                  self._internalCallback = function() {
3824                              self._internalCallback = null;
3825                              self.sandbox(null, "js");
3826                          };
3827                  self.insert(null, "css");
3828                  return;
3829              }
3830  
3831              // get the connection manager if not on the page
3832              if (!util.Connect) {
3833                  // get a new loader instance to load connection.
3834                  var ld = new YAHOO.util.YUILoader();
3835                  ld.insert({
3836                      base: self.base,
3837                      filter: self.filter,
3838                      require: "connection",
3839                      insertBefore: self.insertBefore,
3840                      charset: self.charset,
3841                      onSuccess: function() {
3842                          self.sandbox(null, "js");
3843                      },
3844                      scope: self
3845                  }, "js");
3846                  return;
3847              }
3848  
3849              self._scriptText = [];
3850              self._loadCount = 0;
3851              self._stopCount = self.sorted.length;
3852              self._xhr = [];
3853  
3854              self.calculate();
3855  
3856              var s=self.sorted, l=s.length, i, m, url;
3857  
3858              for (i=0; i<l; i=i+1) {
3859                  m = self.moduleInfo[s[i]];
3860  
3861                  // undefined modules cause a failure
3862                  if (!m) {
3863                      self._onFailure("undefined module " + m);
3864                      for (var j=0;j<self._xhr.length;j=j+1) {
3865                          self._xhr[j].abort();
3866                      }
3867                      return;
3868                  }
3869  
3870                  // css files should be done
3871                  if (m.type !== "js") {
3872                      self._loadCount++;
3873                      continue;
3874                  }
3875  
3876                  url = m.fullpath;
3877                  url = (url) ? self._filter(url) : self._url(m.path);
3878  
3879                  // YAHOO.log("xhr request: " + url + ", " + i);
3880  
3881                  var xhrData = {
3882                      success: success,
3883                      failure: failure,
3884                      scope: self,
3885                      // [module index, module name, sandbox name]
3886                      argument: [i, url, s[i]]
3887                  };
3888  
3889                  self._xhr.push(util.Connect.asyncRequest('GET', url, xhrData));
3890              }
3891          },
3892  
3893          /**
3894           * Executed every time a module is loaded, and if we are in a load
3895           * cycle, we attempt to load the next script.  Public so that it
3896           * is possible to call this if using a method other than
3897           * YAHOO.register to determine when scripts are fully loaded
3898           * @method loadNext
3899           * @param mname {string} optional the name of the module that has
3900           * been loaded (which is usually why it is time to load the next
3901           * one)
3902           */
3903          loadNext: function(mname) {
3904  
3905              // It is possible that this function is executed due to something
3906              // else one the page loading a YUI module.  Only react when we
3907              // are actively loading something
3908              if (!this._loading) {
3909                  return;
3910              }
3911  
3912              var self = this,
3913                  donext = function(o) {
3914                      self.loadNext(o.data);
3915                  }, successfn, s = this.sorted, len=s.length, i, fn, m, url;
3916  
3917  
3918              if (mname) {
3919  
3920                  // if the module that was just loaded isn't what we were expecting,
3921                  // continue to wait
3922                  if (mname !== this._loading) {
3923                      return;
3924                  }
3925  
3926                  // YAHOO.log("loadNext executing, just loaded " + mname);
3927  
3928                  // The global handler that is called when each module is loaded
3929                  // will pass that module name to this function.  Storing this
3930                  // data to avoid loading the same module multiple times
3931                  this.inserted[mname] = true;
3932  
3933                  if (this.onProgress) {
3934                      this.onProgress.call(this.scope, {
3935                              name: mname,
3936                              data: this.data
3937                          });
3938                  }
3939                  //var o = this.getProvides(mname);
3940                  //this.inserted = lang.merge(this.inserted, o);
3941              }
3942  
3943  
3944  
3945              for (i=0; i<len; i=i+1) {
3946  
3947                  // This.inserted keeps track of what the loader has loaded
3948                  if (s[i] in this.inserted) {
3949                      // YAHOO.log(s[i] + " alread loaded ");
3950                      continue;
3951                  }
3952  
3953                  // Because rollups will cause multiple load notifications
3954                  // from YAHOO, loadNext may be called multiple times for
3955                  // the same module when loading a rollup.  We can safely
3956                  // skip the subsequent requests
3957                  if (s[i] === this._loading) {
3958                      // YAHOO.log("still loading " + s[i] + ", waiting");
3959                      return;
3960                  }
3961  
3962                  // log("inserting " + s[i]);
3963                  m = this.moduleInfo[s[i]];
3964  
3965                  if (!m) {
3966                      this.onFailure.call(this.scope, {
3967                              msg: "undefined module " + m,
3968                              data: this.data
3969                          });
3970                      return;
3971                  }
3972  
3973                  // The load type is stored to offer the possibility to load
3974                  // the css separately from the script.
3975                  if (!this.loadType || this.loadType === m.type) {
3976  
3977                      successfn = donext;
3978  
3979                      this._loading = s[i];
3980                      //YAHOO.log("attempting to load " + s[i] + ", " + this.base);
3981  
3982                      fn = (m.type === "css") ? util.Get.css : util.Get.script;
3983                      url = m.fullpath;
3984                      url = (url) ? this._filter(url) : this._url(m.path);
3985  
3986                      // safari 2.x or lower, script, and part of YUI
3987                      if (env.ua.webkit && env.ua.webkit < 420 && m.type === "js" &&
3988                            !m.varName) {
3989                            //YUI.info.moduleInfo[s[i]]) {
3990                            //YAHOO.log("using YAHOO env " + s[i] + ", " + m.varName);
3991                          successfn = null;
3992                          this._useYahooListener = true;
3993                      }
3994  
3995                      fn(url, {
3996                          data: s[i],
3997                          onSuccess: successfn,
3998                          onFailure: this._onFailure,
3999                          onTimeout: this._onTimeout,
4000                          insertBefore: this.insertBefore,
4001                          charset: this.charset,
4002                          timeout: this.timeout,
4003                          varName: m.varName,
4004                          scope: self
4005                      });
4006  
4007                      return;
4008                  }
4009              }
4010  
4011              // we are finished
4012              this._loading = null;
4013  
4014              // internal callback for loading css first
4015              if (this._internalCallback) {
4016                  var f = this._internalCallback;
4017                  this._internalCallback = null;
4018                  f.call(this);
4019              } else if (this.onSuccess) {
4020                  this._pushEvents();
4021                  this.onSuccess.call(this.scope, {
4022                          data: this.data
4023                      });
4024              }
4025  
4026          },
4027  
4028          /**
4029           * In IE, the onAvailable/onDOMReady events need help when Event is
4030           * loaded dynamically
4031           * @method _pushEvents
4032           * @param {Function} optional function reference
4033           * @private
4034           */
4035          _pushEvents: function(ref) {
4036              var r = ref || YAHOO;
4037              if (r.util && r.util.Event) {
4038                  r.util.Event._load();
4039              }
4040          },
4041  
4042          /**
4043           * Applies filter
4044           * method _filter
4045           * @return {string} the filtered string
4046           * @private
4047           */
4048          _filter: function(str) {
4049              var f = this.filter;
4050              return (f) ?  str.replace(new RegExp(f.searchExp, 'g'), f.replaceStr) : str;
4051          },
4052  
4053          /**
4054           * Generates the full url for a module
4055           * method _url
4056           * @param path {string} the path fragment
4057           * @return {string} the full url
4058           * @private
4059           */
4060          _url: function(path) {
4061              return this._filter((this.base || "") + path);
4062          }
4063  
4064      };
4065  
4066  })();
4067  
4068  YAHOO.register("yuiloader", YAHOO.util.YUILoader, {version: "2.9.0", build: "2800"});
4069  
4070      Y.YUI2 = YAHOO;
4071  }, '2.9.0' ,{"supersedes": ["yui2-yahoo", "yui2-get"]});


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1