Javascript Inheritance and this
<p>Lets say I have a namespace called ns and ns has to functions on it:</p>

<pre><code>ns = {};
ns.Foo = function(message, fn){
    this.message = message;
    fn.call(this);
};
ns.bar = function() {
    alert('Hello, world!');
};
</code></pre>

<p>And I call it like this:</p>

<pre><code>var foo = new Foo('My Message', function() {
    bar();
});
</code></pre>

<p>I get an error saying bar() is undefined. But if I call it this way:</p>

<pre><code>var foo = new Foo('My Message', function() {
    this.bar();
});
</code></pre>

<p>It works. Is there a way to structure my JavaScript so I can just call bar() without the this?</p>

<p>Thanks!</p>
