Added JavaScript to detect hash change and click associated pill