
// An object with the flipbook dimensions.

function flipbook_dimensions(tgt_width, tgt_height, tgt_flip) {
   this.win_width = getWindowWidth();
   this.win_height = getWindowHeight() - 50;

// If the window is small resize the book dimensions.

   if (this.win_width < tgt_width || this.win_height < tgt_height) {
      if ((this.win_width/tgt_width) < (this.win_height/tgt_height)) {
         this.book_width = this.win_width;
         this.book_height = tgt_height * this.win_width/tgt_width;
      }
      else {
         this.book_width = this.win_width * this.win_height/tgt_height;
         this.book_height = this.win_height;
         
      }
   }
   else {
      this.book_width = tgt_width;
      this.book_height = tgt_height;
   }
// If we're real small decrease the corner size.

   if (this.book_width < (3 * tgt_flip)) {
      this.tgt_flip = tgt_flip/2;
   }
}
