Fixed deep linking for nested content and improved selected hash checking

The regular expression for the selected hash wasn't checking for an exact match causing "subtab" to match on "subsubtab", for instance.

Additionally, the logic to set the section active was only setting it for the immediate parent causing the deep linking to not work correctly for deeply nested items, so I fixed it.  :)