rearranged the functions in navbar.js per jslint instructions