There is indeed a preference for window (really the global) object. Try these:
<script>
alert(this == window);
function foo() {
alert(this == window);
}
foo();
</script>
|this| is basically a magical variable that by default is set to the global object, but can also be set by the caller of a function one of two ways:
a) by setting a reference to the function on an object, and calling it with object or bracket notation:
var someObj = {};
someObj.f = theFunction;
someObj.f(); // now |this| inside theFunction will
// point to someObj
someObj["f"](); // same thing
b) by using apply:
theFunction.apply(someObj);
You are right that in the case of event handlers, it is common in the DOM for event handlers to get their |this| set to the DOM node that fired the event. Since the default value of |this| is the global object, it isn't possible in the case of setTimeout for us to tell whether the caller (the host) explicitly set it, or if the function is being called without any value set for |this|.
Basically, |this| is an extra parameter to any function. It is controlled by the caller, and as such, should either be documented as part of the signature of the function, or else should not be relied on by the implementation of the function.
The common misunderstanding with people new to JS is that they expect |this| to be controlled by the callee, like it is in lots of other popular languages, and are surprised when calling convention can change its value.