In CRM 2011 Javascript is no longer embedded in forms but now has build in feature to use external resource files. You can edit these files using the web browser or in an external editor. Visual studio supports Intellisense for JavaScript, this explains how enable the support for the CRM provided objects such as the Xrm.Page object to be shown.
To enable this support Visual Studio needs a reference to base the IntelliSense. First you need to download the reference file XrmPage-vsdoc.js (right click and choose save). Save this file on a convinient location for example a folder named 'IntelliSense'. Now you can create a new js file in Visual Studio then add the following line to the top of this file:
///<reference path="IntelliSense\XrmPage-vsdoc.js"/>
The path to the file can either be relative or absolute, in this example the reference file is placed in a folder named IntelliSense in the folder where the new web resource js file is saved.
I have only tried this file with Visual Studio 2010. If there are any function which are incorrect or other errors please let me know.
This file is also available on https://nuget.org/ and http://crm2011snippets.codeplex.com.