/**
 * pulp javascript framework
 * @version 0.8.5
 * @date August 2009
 * @link {http://pulpjs.org}
 * @license MIT-style license http://pulpjs.org/license
 */
/**
 * The pulp namespace contains all pulp modules. Properties beginning with an uppercase
 * letter are meant to be reserved utility properties.  Properties beginning with
 * a lowercase letter are modules. Modules can be functions, static objects, or
 * classes. The exceptions are pulp.window and pulp.document--they are reserved
 * utility properties, not modules.
 * @namespace
 */
var pulp = {
  /**
   * Current version of pulp (major.minor.revision}
   * @type {String}
   */
  Version: '0.8.5',
  /**
   * Index of registered pulp modules
   * @namespace
   */  
  Modules: {},
  /**
   * An empty function meant for reuse so as to save memory
   * @type {Function}
   */
  EmptyFunction: function() {},
  /**
   * A simple function that returns the value it is given
   * @type {Function}
   */
  K: function(v) { return v; },
  /**
   * A unique object meant to be thrown and caught
   * @type {Object}
   */
  Break: {},
  /**
   * The current window on which to perform methods (affects pulp.event for example)
   * @type {Object}
   */  
  window: window.self,
  /**
   * The current document on which to perform methods (affects pulp.event for example)
   * @type {Object}
   */  
  document: document,
  /**
   * Browser reports itself as IE6
   * @type {Boolean}
   */
  isIE6: navigator.userAgent.indexOf('MSIE 6') > -1,  
  /**
   * Browser is not Adobe Air or Caja and eval is available
   * @type {Boolean}
   */
  evalAvailable: !(navigator.userAgent.match(/AdobeAIR\/([^\s]*)/) || navigator.userAgent.match(/Caja\/([^\s]*)/)),
  /**
   * Bring pulp module shortcuts into the global scope or a given scope
   * e.g. var mine = {}; pulp.ImportShortcuts(mine);
   *
   * @param {Array} [scope=pulp.widnow]  To where to copy the shortcuts
   * @param {Array|String} [names]  If given, limit the modules exported to the names of those passed (array or space-separated string)
   * @return {String}
   */
  ImportShortcuts: function(scope) {
    scope = scope || pulp.window;
    for (var name in pulp.Modules) {
      if (pulp[name]) {
        scope[pulp.Modules[name]] = (typeof pulp[name].getInstance == 'function' ?	pulp[name].getInstance : pulp[name]);
      }
    }	
  }
};

// IE6 FIX for background images redownloading
if (pulp.isIE6) {
  try { document.execCommand('BackgroundImageCache', false, true); } catch (e) {}
}