Jquery anonymous function calls

Jquery anonymous function calls

Hello,
Im seeing a lot of jquery codes wrapped in an anonymous function call like this :

filename : sample.js

  1. (function($) {  /*more code here*/  })(jQuery);
And then this file (sample.js) get included in the page via the src attribute of the script tag. My questions are :

1.  When is this anonymous function call executed?
2.  Does this imply it already has $(document).ready() with it?
3.  How can i access variables defined inside this anonymous function calls in firebug for example or in any other code that would want to use the methods and variables inside it?

Thanks!