updating javascript index