/****
 * Extends the functions available to all objects to allow inheritance.  
 *
 * Type: Class
 *
 * Constructors:
 *    <none>
 *
 * Methods:
 *    inherits(class) - Allows inheritance to be used. Functions can be 
 *       overwritten by simply declaring them after the inherit function is 
 *       called or within the constructor. The super class's constructor can be
 *       called by this.<super class name>.  If an overwritten superclass 
 *       function needs to be accessed it must be declared with the following 
 *       line:
 *           <subclass>.prototype.<superclass>_<function> = 
 *                                          <superclass>.prototype.<function>;
 *    getClassName() - Returns the class name as a string, as discovered by 
 *        parsing the stringified version of the constructor
 *
 * Attributes:
 *    <none>
 *
 * Dependencies:
 *    <none>
 *
 * Inherits from:
 *    <none>
 */

Object.prototype.inherits = function (superClass)
{
   /* Creates a temporary class with the superClasses prototype and a 
    * blank constructor.  Then sets the current class's prototype to an 
    * instance of the temporary object.  This will prevent any 'real' 
    * constructor from being called. Finally we make the superclass's 
    * constructor accessable.
    */
 
   var tmpClass = function () {/*Intentionally Blank*/};
   tmpClass.prototype = superClass.prototype;
 
   this.prototype = new tmpClass;

   var className = superClass.getClassName();
   this.prototype[className] = superClass;
};

Object.prototype.getClassName = function()
{
   return this.toString().match(/function\s*(\w+)/)[1];
};
