You should place all your global functions,variable etc in a .js file and then on all pages that need to call any of these routines you should declare it like this
<script src="myglobals.js" type="text/javascript"></script>
Now you can access your global functions and variables.Happy Coding