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;
}

Array.prototype.in_array = function(valeur) {
	for (var i in this) { if (this[i] == valeur) return true;}
	return false;
}

String.prototype.verifemail = function(){
	var rv = true;
	var emailFormat = /^\w(\.?[\w-])*@\w(\.?[\w-])*\.[a-zA-Z]{2,6}(\.[a-zA-Z]{2})?$/i;
	if( this.search( emailFormat ) == -1 ){
		rv = false;
	}
	return rv;
}