if (bookCase.alpha + bookPG0.alpha != 0)
{bookCase.alpha = 0; bookPG0.alpha = 0; bookPG1.alpha = 0; bookPG2.alpha = 0; bookShow.alpha = 0;}

for (i = 0; i < book.length; i++) {
if (book [i] != undefined && book [i] [0] == true) {
	if (effect.getOverlay() != null) {player.setStunned(1);}
	if ((keyboard.isKeyDown(1) || keyboard.isKeyDown(18))) {book [i] [0] = false; effect.clearOverlay();}
	bookCase.alpha = 1; bookPG0.alpha = 1; bookPG1.alpha = 1; bookPG2.alpha = 1; bookShow.alpha = 1;
	if (book [i] [3] < 1) {book [i] [3] = 1;} bookPG0.text = "<" + (book [i] [3] - book [i] [1]); 
	bookPG2.text = (book [i] [3] - book [i] [1] + 2) + ">"; bookPG1.text = (book [i] [3] - book [i] [1] + 1) + "/" + book [i] [2];
	bookPG0.x = width/2 - 94;
	bookPG0.red = 0; bookPG0.blue = 0; bookPG0.green = 0; bookPG0.shadow = false; 
	bookPG1.x = width/2 - ui.getStringWidth(book [i] [3] + "/" + book [i] [2])/2;
	bookPG1.red = 0; bookPG1.blue = 0; bookPG1.green = 0; bookPG1.shadow = false; 
	bookPG2.x = width/2 + 91 - ui.getStringWidth((book [i] [3] + 1) + ">");
	bookPG2.red = 0; bookPG2.blue = 0; bookPG2.green = 0; bookPG2.shadow = false;  
	bookCase.texture = "gui/books/bookCase.png"; bookShow.texture = "gui/books/bookPage"+book [i] [3]+".png";
	if (book [i] [3] < book [i] [2] && isKeyActive(32, 6)) {book [i] [3] += 1;}
	if (book [i] != undefined) {
	if (book [i] [3] > book [i] [1] && isKeyActive(30, 6)) {book [i] [3] -= 1;}
	if (book [i] [3] == book [i] [2]) {bookPG2.alpha = 0;} if (book [i] [3] == book [i] [1]) {bookPG0.alpha = 0;}
	}
}}