Here's the link to the full document on module developing aspect which I assume is not your main goal, there are some ways that you wanna skip for now, my suggestion is depending on the theme you are using, is to do it via .info
file. the easiest and common way.
This link is a very good guide for adding js files to omega subtheme, you may find it useful.
The .info file approach:
first open your theme's .info file that it should be something like YOURTHEMENAME.info
if you are using a subtheme there must be already some js files in there, you can find them and use them as an example.
what you wanna do is to add your js file like this:
scripts[] = somescript.js
this way the js file will be added to head of your website, remember after each time of editing a .info file you need to clear cache.
Adding External js to your site:
In your theme's template.php file use drupal_add_js() to the page preprocess method (or an equivalent preprocess).
function hook_preprocess_page(&$vars) {
drupal_add_js('http://cdn.jquerytools.org/1.2.6/jquery.tools.min.js', 'external');
}
Edit: also with the extra info you just provided regarding using functions in the header you need to make a custom tpl file, locate the file that has <head>
tag in your theme, it most likely be html.tpl.php
(depends on the base theme you are using) if you couldnt find it you can copy it from modules/system/html.tpl.php
and paste it into your theme's folder. edit the name of your file as this:
html--node--id.tpl.php
like html--node--1.tpl.php
and clear cache afterwards. edit the file as you wish and you must be good to go.
drupal_add_js()
?