function getState(unObjet)
{
   var result = '',prop,value;
   for (prop in unObjet) {
     if (typeof(unObjet[prop]) == 'function') {
       value = '[function ...]';
     } else {
      value = unObjet[prop];
      
     }
     result += prop + ' : ' + value + "\n"; 
   }
    return result;
}

//DOM fonction
function getChildrenByTagName(element,tagName)
{ 
  var result = new Array();
  
  for (var i=0 ; i<element.childNodes.length ; i++) {
    var child = element.childNodes[i];
    if (child.nodeType == 1 && child.nodeName.toLowerCase() == tagName.toLowerCase()) {
      result.push(child);
    }  
  }  
  return result;
}

function removeChilds(oEl)
{
   while (oEl.childNodes.length>0) {
      oEl.removeChild(oEl.firstChild);
    }
 
}



//créer et attache un tag à un element existant
function eq_tag(tagName,parentId,aAttributs)
{
  var oTag = eq_createTag(tagName,aAttributs);
  var oParent = dojo.byId(parentId);
  oParent.appendChild(oTag);
  return(oTag);
}


//creer un objet et ses attributs et le renvoi
function eq_createTag(tagName,aAttributs)
{ 
  var x = document.createElement(tagName);
  var sKey;
  if (aAttributs != false) {
    for ( sKey in aAttributs ) { 
      if (sKey == 'className') {
        x.className = aAttributs[sKey];
      } else {
        x.setAttribute(sKey,aAttributs[sKey]);
      }
    }
  }
  return x;
}

//ajoute un node texte et le texte à un element existant
function eq_addText(parentId,texte)
{
  //creation du tableau (un tableau par ligne)
  var z = document.createTextNode(texte);
  document.getElementById(parentId).appendChild(z);
}

function echoDom(x,attribut,nomAttribut)
{
  if (typeof(attribut) == 'undefined' ) {
    var attribut = 0; 
  }
  if (typeof(nomAttribut) == 'undefined') {
    var nomAttribut = 0; 
  }
  
  if (typeof(compteur) == "undefined") {
    compteur = 0;  
    strDom = '';
    x = dojo.byId(x);
  } else {  
    compteur++; 
  }
  
  var position = compteur;
  
  strDom += '<ul>';
  strDom += '<li>--' + x.id;
  
  if (attribut == 1) {
    strDom += '<ul>';
    for (prop in x) {
      if (nomAttribut == 0 || nomAttribut == prop) {
        strDom += '<li>' + prop + ' : ' + eval('x.' + prop) + '</li>';
                
      }
    }
    strDom += '</ul>';
  }
  
  var nodeEnfant = dojo.dom.firstElement(x);
  //alert(nodeEnfant);
  
  while(nodeEnfant != null) {
    echoDom(nodeEnfant,attribut,nomAttribut);
    nodeEnfant = dojo.dom.nextElement(nodeEnfant);
    
  }
  
  strDom += '</li></ul>';
  
  if (position == 0) {
    
    dojo.byId('echoDom').innerHTML = strDom;
    delete(compteur);
    strDom = '';
  }
}