add the function of previous and next links