Use Context to load JavaScript on certain pages
The Context Add Assets module does exactly that :)

Taken from the README


  Supports adding active theme files to page via context


I've used 7.x-1.0-beta1 with no major problems, so don't be afraid that there's no full release :)