Your pattern is fine. Consider this, though:
// global code
(function () {
var root = this;
// use root variable to refer to the global object
}).call( this );
This pattern does not rely on the "window"
name, which makes it portable. (The name "root"
is, of course, arbitrary.)