If you don't know what should go where, put it in the bottom javascript. That's a better place for things to go that don't have to be in the top javascript because the page will display faster.
These are the reasons I can think of to put something in the top javascript:
- If you need the code to execute immediately before the page loads and displays. For example, if you want to check for some condition (e.g. a specific URL) and redirect to another page, you might as well do that before the page loads.
- If the javascript code needs to be available or already initialized during page load because some inline scripts in the page may use/reference it.
- If you're loading some resource for use in the page and you want the loading of that resource (image, ajax results, etc...) to be available as soon as possible, then it will start loading a little sooner if you start it from the top javascript rather than the bottom javascript - but it could slightly slow down the display of the page - it is a tradeoff.
Keep in mind that the top javascript is loaded BEFORE the page is loaded so you cannot access the page contents at all at the time that the top javascript first executes. You can place DOMReady calls in the top javascript that will wait for the DOM to be loaded, but at that point, you might as well just put the code in the bottom javascript.
The bottom javascript section is before the </html> tag, but after most other body contents.