function removeClassName( node, className ) {
  var cName = node.className.split( className );
  var newName = '';
  for( var i=0; i<cName.length; i++ )
    if ( cName[ i ].length > 0 )
      newName += cName[ i ];
  node.className = newName;
}
function addClassName( node, className ) {
  if ( node.className.indexOf( className ) == -1 )
    node.className += ' ' + className;
}

function isSet( mixed ) {
  return ( typeof( mixed ) != 'undefined' && !isNull( mixed ) );
}
function isNull( mixed ) {
  return ( mixed == null );
}

function toString( obj ) {
  var rv = '[ ';
  for( var i in obj ) {
      rv += i + ': ' + obj[ i ] + ', ';
  }
  if ( rv.length > 2 )
    rv = rv.substr( 0, rv.length - 2 );
  rv += ' ]';
  return rv;
}

if ( typeof( String.prototype.trim ) == 'undefined' )
  String.prototype.trim = function() {
      return this.replace( /^\s+/, '' ).replace( /\s+$/, '' );
  }

/**
  @param  superConstructor  function  la fonction de la super classe
  @note   ne pas oublier de faire appel au constructeur de la super-classe
    this.constructor.call( this );
    // ou si on doit passer le paramètre value
    this.constructor.call( this, value );
*/
/*
Function.prototype.extend = function( superConstructor ) {
	if ( typeof( superConstructor ) == "function" ) {
		this.prototype = superConstructor.prototype;
		this.prototype.constructor = superConstructor;
	}
	return this.prototype;
}
Object.prototype.extend = function( superClass ) {
  for( var i in superClass )
    if ( typeof( this[ i ] ) == 'undefined' )
      this[ i ] = superClass[ i ];
}
*/
function extend( instance, superClass ) {
  for( var i in superClass )
    if ( typeof( instance[ i ] ) == 'undefined' )
      instance[ i ] = superClass[ i ];
}

var xmlTools = {
  extractText: function( parent, nodeName ) {
    var tmp = parent.getElementsByTagName( nodeName );
    if ( tmp && tmp.length != 0 )
      return tmp[ 0 ].firstChild.nodeValue;
    return null;
  },
  populate: function( obj, struct ) {
    for( var i in struct )
      if ( typeof( obj[ i ] ) != 'undefined' )
        obj[ i ] = struct[ i ];
    return obj;
  }
}