Adding pagenavi file instead of inside functions

Also integrating this with Foundation