JavaScript hash change helper