handling next and prev in the popup. Correcting the script links in details.html