Improve this javascript code: It displays hidden text and highlights the selected page number
Here are some ideas:


Use either tab or, preferably, 4-spaces for indention consistently. Right now the indention is all screwy on JSBin.
Put all your variable declarations at the top, even if you don't define them yet. This'll prevent any confusion from variable hoisting.
Since null is a falsy value, you can change document.getElementById(...) !== null to document.getElementById(...) to check for the existence of an element in you if statements.
Space out your if statements (so if (...) instead of if(...).)
Maybe think about using jQuery? It'll make working with events and elements much easier than using the DOM directly. So for example, hiding all the pages could be written as easy as: $('div').hide().


That's all I have time for now!