What I did, was in my main include file that I include on every page was to make a function called printjs
function printjs($script) {
print "\n\n <script language='javascript'> \n\n $script \n\n script>\n\n";
}
so I just pass it the javscript I want and it addes the script tag and prints it out
so
printjs("alert('Whaazzzzzzzzzup!');");
🙂