Javascript proxy-pattern problem
<p>I have something like that:</p>

<pre><code>// original function
Foo = function(params) {
  do foo...
}
Foo.prototype.alert = function() {
  alert('foo');
}
</code></pre>

<p>Now i want to interfere:</p>

<pre><code>Bar = Foo;
Foo = function(params) {
  do bar...
  return Foo(params);
}
</code></pre>

<p>Or the JQuery way:</p>

<pre><code>(function() {
  var proxied = Foo;
  Foo = function() {
    do bar...
    return proxied.apply(this, arguments);
  };
})();
</code></pre>

<p>The problem now is that Foo is missing all its prototype methods. Any idea how I could make this work?</p>
