tidied up client side javascript
added some spaces to make code easier to read
Tidier way of generating navigation menu