title: Re-initialize a javascript function object by variable
body: <p>This one is something that is fairly easy to do in PHP and I find my self in a situation where it would come in handy, but I do not believe the PHP trick will work.</p>
  
  <p>Basically I want to use a variable passed from a function within an object to then reinitialize that object using the child (defined by the variable).</p>
  
  <pre><code>var View = function(){
      var fn = this;
  
      fn.load = function(name){
          return new name();
      }
  }
  var view = View.load('titleView');
  </code></pre>
  
  <p>This is a very early work on it, so forgive the fact that it looks so strange (still need to tinker more with the concept). But overall it should roughly show the concept.</p>
  
  <p>Is there a way to basically recreate the current functions instance with a new function? To do this in the aspect I am thinking of I will need to use a variable rather then pass the new object. Is this possible? I am sure in some form it has to be. Any ideas/pointers? Google has been failing me since I am not sure of the right keywords for this.</p>
  
  <p>EDIT:
  should also show the idea behind the "titleView" class</p>
  
  <pre><code>var titleView = function(){}
  
  titleView.prototype = new View;
  </code></pre>