code: function getChildElementById( dNode, id ) {
  
  	var dResult = null;
  
  	if ( dNode.getAttribute('id') == id )
  		return dNode;
  
  	for ( var i = 0; i < dNode.childNodes.length; i++ ) {
  		if ( dNode.childNodes[i].nodeType == 1 ) {
                          dResult = getChildElementById( dNode.childNodes[i], id ); //note: 1-level deep would suffice here, doesn't need to recurse into further childs. but this works.
                          if ( dResult != null )
  				break;
  		}
  	}
  
  	return dResult;
  }
docs: Function will get element by id starting from specified node.
  Author: Renato Bebić <renato.bebic@gmail.com>
  
  The material getter below borked if there is e.g. a scene node with the same name as the material.
  This is used to fix that by only looking for materials in the library_materials element.