Tested and fixed many problems

Fixed some of the problems happening with the navigation, put specific
javascript within object literals.