Minor javascript improvements for table of contents navigation