var UI = UI || {};

/**
 * 
 * Detect Javascript browser capabilities
**/

/** 
 * @description		@namespace UI.Browser
 * @author			Amit Sharma  - amit_sharma2@symantec.com or http://www.symantec.com
 * @date			11/05/09
 * @release			1.0  
 * @functionality	Collections of basic API a
**/

UI.Browser = { };
UI.Browser.IE6     = /*@cc_on @_jscript_version < 5.7 || @*/ false;
UI.Browser.IE7     = !UI.Browser.IE6 && !!window.attachEvent;
UI.Browser.Firefox = !!document.compatMode && !!document.evaluate
UI.Browser.Safari  = !document.compatMode;

/**
 * @namespace UI.Util
 * Utility classes
**/

UI.Util = {};
UI.Util.CustomEvent = Class.create();
UI.Util.CustomEvent.prototype = {

  initialize : function() {
    this.observers = new Array();
  },
  
  observe : function(/*EventObserver */ observer) {
    this.observers.push(observer);
  },
  
  fire : function(object) {
    this.observers.each( function(obs) {
      obs.callback.bind(obs.scope)(object);
    });
  },
  
  stopObserving : function(fn, scope) {
    var obs = this.observers.find( function(obs) { return obs.callback == fn && obs.scope == scope; });
    if(obs) this.observers = this.observers.without(obs);
  }
}

UI.Util.EventObserver = Class.create();
UI.Util.EventObserver.prototype = {
  initialize : function(fn, scope) {
    this.callback = fn;
    this.scope = scope || window;
  }
}

/**
 * Define console functions for IE6 so errors are not thrown if they are accidentally used
**/

/*var console = console || {
  info   : Prototype.emptyFunction,
  debug  : Prototype.emptyFunction,
  warn   : Prototype.emptyFunction,
  log    : Prototype.emptyFunction,
  error  : Prototype.emptyFunction,
 assert : Prototype.emptyFunction
}*/



