new Image pagination algorythm tks to http://blog.vjeux.com