general syntax and behavior questions

general syntax and behavior questions

Hi,
My name is Avi.
I just started using jQuery.
1.  Although I have used JavaScript in the past I don't understand a certain syntax in the jQuery library.
There's:
  1. (function( window, undefined ) {
  2. ....
  3. ....
  4. })(window);
What does the opening and closing paranthesis of the 'function' mean? There's a casting of that object to a window object?

2. My second question is about plug-in behavior. Although it's a plug-in issue it's a basic question so I decided to place it here.
I saw a plug-in samples and in those samples there's the $ parameter which is passed to the function and which is suppose to be the jQuery object. I don't understand how can the two .js files i.e the jQuery file and the plug-in file can be connected.
Is it something the browser do? and if so, what does it do?



I hope my questions were clear

Thanks,

Avi