Changed algorithm of building pages. Add a button for open book.