As of version 5.0, Drupal's built-in methods for implementing Javascript have changed a bit.
Drupal 5.0's new stable of javascript files includes:

drupal.js
General Drupal Javascript Library
jquery.js
jQuery Library, simplifies many javascript functions
autocomplete.js
autocomplete tools
collapse.js
collasping item tools
progress.js
Progressbar tools
textarea.js
Text Area tools
update.js
upload.js
Upload helpers

These files can be found in the /misc directory.
There are also several php functions in includes/common.inc for adding various javascript features
into your modules:

drupal_add_js
Add a JavaScript file, setting or inline code to the page.
drupal_get_js
Returns a themed presentation of all JavaScript code for the current page. References to JavaScript files are placed in a certain order: first, all 'core' files, then all 'module' and finally all 'theme' JavaScript...
drupal_to_js
Converts a PHP variable into its Javascript equivalent.

Changes for 5.0 include

  • addLoadEvent(somefunctionjsfunction) Replaced by: $(document).ready(somefunctionjsfunction) from the jQuery library
  • Many JS functions have now been wrapped in the Drupal object, and some functions have become properties. I'll add these as I find them. (Example: isJsEnabled() function has been replaced by Drupal.jsEnabled property.

F.A.Q.

  • Why isn't jquery.js included on all pages by default?
    Drupal only adds the jquery.js file if at least one call to drupal_add_js() was made. On most pages however, Drupal already does this seemingly automatically, but it really is a core module doing this. Collapsing fields for example, which are virtually everywhere.