Moving some inline javascript to a drupal_add_js() call for themes that print $scripts later in the HTML.