Hi,

I need to use an external javascript file on specific pages where some js-based charts are displayed. The way I currently have this set up is:
- whenever the blocks or pages containing the chart show up, they set a variable (say, as TRUE)
- then, in hook_footer I put in the script (which works anywhere on the page), and also would like to add the external js.

My workaround so far has been to add that js file to every page using hook_init(), but is there a better way?
Here's what I have:

/**
 * Implementation of hook_init() .
 */
function mymodule_init() {
    drupal_set_html_head('<script src="http://path/to/external/js.js" 
        type="text/javascript"></script>');
}
/**
 * Implementation of hook_footer() .
 */
function qmo_bugzilla_footer() {
  if ($found) {
   //do something..
  }
}

Here's what I wish worked:

/**
 * Implementation of hook_footer() .
 */
function qmo_bugzilla_footer() {
  if ($found) {
   //do something..
    drupal_set_html_head('<script src="http://path/to/external/js.js" 
        type="text/javascript"></script>');
  }
}

Is there a different hook_ I could use?

Thanks a ton!
Paul C