You have to use drupal_add_js function
The second parameter is $options, that you can pass the group of your Javascript file
- JS_LIBRARY: Any libraries, settings, or jQuery plugins.
- JS_DEFAULT: Any module-layer JavaScript.
- JS_THEME: Any theme-layer JavaScript.
Also you can pass the weight of your script to define the order you want.
Here is an example
drupal_add_js('jQuery(document).ready(function () {
alert("Hello!"); });',
array('type' => 'inline', 'scope' => 'footer', 'weight' => 5)
);
I recommend you to read this article: Managing javascript in Drupal 7