function isSet( mixed ) {
  return ( typeof( mixed ) != 'undefined' && !isNull( mixed ) );
}
function isNull( mixed ) {
  return ( mixed == null );
}
function isInstance( mixed, aConstructor ) {
  return ( typeof( mixed ) == 'object' && isSet( mixed.constructor ) && mixed.constructor == aConstructor );
}

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+$/, '' );
  }

if ( typeof( String.prototype.nl2br ) == 'undefined' )
  String.prototype.nl2br = function() {
      return this.replace( /\r|\n/, '<br />' );
  }

/**
  @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;
}