  Function.prototype.extend = function( subClass, methods )
  {
    var F = function() {};
    F.prototype = this.prototype;
    subClass.prototype = new F();
    subClass.prototype.constructor = subClass;

    subClass.superclass = this.prototype;
    if( this.prototype.constructor == Object.prototype.constructor )
    {
      this.prototype.constructor = this;
    }

    if(( typeof methods == 'object' ) && ( methods !== null ))
    {
      var prop;
      for( prop in methods )
      {
        subClass.prototype[prop] = methods[prop];
      }
    }

    return subClass;
  }
