new algorithm for choose example id in index page