Added index2 using JS.

Added index2 using JS. It works! Looking for a way to save the last
position.