How to define function and object of same name?
===

So according to [this](http://stackoverflow.com/questions/3663775/object-name-same-a-function-name), it isn't possible.  But I call bullshit, because the `jQuery` object, for instance, is able to be called as an object with member functions (`jQuery.cookie()`), but also as a function itself (`jQuery('my_selector')`).

How can I achieve the same effect with my objects?  Let's say that I want an *object named* `foo` in the `window` namespace, with a *member function* `bar`, but also a *function named* `foo` in the same `window` namespace as the `foo` *object*.  After declaring such an object-function hybrid, I'll be able to make the following calls:

`window.foo(arg); `

`window.foo.bar(arg);`