In the samples where you see the window.map or window.[some variable name] the developer is just writing the sample so that the variable is globally accessible. Basically its attaching the map variable to the window object so you can access it throughout your application.
Here's a link to an article with some more detail:
Global Variables in JavaScript - Snook.ca
And additional reading on global variables in general and why you may want to minimize the use of global variables in your app. See the 'Variable Declarations' section.
Code Conventions for the JavaScript Programming Language