// JavaScript Document

      function BookBrowser(max) {
        this.i = 1;
        this.max = max ? max : 8;
        this.text = new Array();
        this.title = new Array();
        this.description = false;
        
		for(k=2; k<=this.max; ++k) {
		document.getElementById('book_browser_'+k).style.display = "none";
		}
		
        this.change = function() {
          document.getElementById('book_browser_no').innerHTML = this.i;
          document.getElementById('book_browser_prev').style.visibility = this.i > 1 ? 'visible' : 'hidden';
          document.getElementById('book_browser_next').style.visibility = this.i < this.max ? 'visible' : 'hidden';
        }
        
        this.prev = function() {
          if(this.i > 1) {
            document.getElementById('book_browser_'+this.i).style.display = "none";
            --this.i;
            this.change();
            document.getElementById('book_browser_'+this.i).style.display = "block";
          }
          book.click();
        }
        
        this.next = function() {
          if(this.i < this.max) {
            document.getElementById('book_browser_'+this.i).style.display = "none";
            ++this.i;
            this.change();
            document.getElementById('book_browser_'+this.i).style.display = "block";
          }
          book.click();
        }
        
        this.click = function(id) {
          if(this.title[id] && this.text[id]) {
            description = document.getElementById('book_browser_description');
            if(this.description && (!id || id == this.description)) {
              description.style.display = "none";
              this.description = false;
            }
            else if(id) {
              document.getElementById('book_browser_description_title').innerHTML = this.title[id];
              document.getElementById('book_browser_description_text').innerHTML = this.text[id];
              description.style.display = "block";
              this.description = id;
            }
          }
		  else {
			description.style.display = "none";
			this.description = false;
		  }
        }
		

        this.change();
        
      }

