javascript sorting index table