I hope this site is friendly to beginner questions.
I would like to add some javascript for sitewide effect. Specifically, I want to make it so that when you scroll down a page, certain elements (e.g. the Category nav, and the Filter bar which I have set horizontally above catalog products) stick to the top and stay visible as you go down the page. Other elements, like the header area where the Logo and search bar sit (in my design), would get covered by these.
For reference, I am looking at this jquery code: http://viget.com/inspire/jquery-stick-em You can see how the author's face "sticks" to the bottom of the header element and stays there as you scroll down. But my question isn't about making this or that particular javascript code work, it's more general.
My question is, where do I place the javascript code to follow the intended use of Magento's design?
Where would I put the javascript if, for example, I just wanted it to affect the product view pages?