next and previous picture functionality