/*--------------------------------------------------------------------------
 *  YOJA-WEB.COM : yoja core
 *  Copyright (c) Jamal Chaqouri, Yohann Fontaine, of yoja team (http://www.yoja-web.com)
 *
 *  yoja core is a yoja-web.com work.
 *  For details, see the yoja web site: http://www.yoja-web.com
/*--------------------------------------------------------------------------*/


/** Gestion conflit **/
var $j = jQuery.noConflict();

/*********************************/
/**        Load util            **/
/*********************************/

function _Entry(_fn, _args) {
       this.key = _fn;
       this.value = _args;
};

var DocumentReadyExecuter = {
  
  _functions : new Array(),  
  
  addTraitement : function()   {
        var args = this.toArray(arguments);
        var entree = new _Entry(args.shift(), args);
        this._functions.push(entree);
  },
  
  execute : function() {
    var taille = this._functions.length;
    for (var index = 0; index < this._functions.length; index++) {
      var entree = this._functions[index];         
      entree.key.apply(entree.key,entree.value);
    }
  },
  
  toArray : function(iterable) {
      var results = [];
      for (var i = 0, length = iterable.length; i < length; i++)
        results.push(iterable[i]);
      return results;
  }  
  
};

function onDocumentReady(){
      DocumentReadyExecuter.execute();           
};

$j(function() {
    onDocumentReady();
});

/*********************************/
/**   YOJA CORE                 **/
/*********************************/


YOJAUtil = {
   wrapUlList : function(jvar) {
      jvar.wrapAll("<ul></ul>");
      jvar.wrap("<li></li>");
      return jvar;
   },
   
   cleanAnchor : function(anchor) {
       $j("*:empty, img", anchor).remove();
       return YOJAUtil.cleanStyle(anchor);
   },
   
   cleanStyle : function(jqVar) {
      jqVar.removeAttr("class").removeAttr("style");
      return jqVar; 
   }
};