code: public static int getAvailableHeight() {
  
          int height = CmsGalleryDialog.DEFAULT_DIALOG_HEIGHT;
          if (Window.getClientHeight() > 590) {
              height = (int)Math.ceil((Window.getClientHeight() - 50) * 0.9);
          }
          return height;
      }
docs: Calculates the popup height to use.<p>
  
  @return the height