refactoring, paging

I broke the javascript out into separate files, created a pager
directive to draw the paging controls and deal with that part of the UI.
I also had to change some of the stuff with the async data access.