// Licensed Materials - Property of IBM // // IBM Cognos Products: cpscrn // // (C) Copyright IBM Corp. 2005, 2011 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. // // // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved. // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). function adjustScrollSection(formName,top,middle,bottom,layoutCorrection) { var bottomSection = document.getElementById(bottom); // Get the bottom section of the pane and add 8 pixels to the size // to account for the bottom edge of the panel dipping below the browser. var staticBottomHeight = bottomSection ? bottomSection.offsetHeight + 8 : 0; var formObj = document.getElementById(formName); // Ensure there is a scrollable section to resize. if(formObj) { // Get the middle section of the pane var scrollSection = document.getElementById(middle); if( scrollSection != null ) { // Acquire the height of viewable area of the browser. var viewableHeight = 0; var db = (document.body) ? document.body : null; var dde = (document.documentElement) ? document.documentElement : null; if (dde && dde.clientHeight) { viewableHeight = dde.clientHeight; } else if (db && db.offsetHeight) { viewableHeight = db.offsetHeight; } // Calculate the height from the top of the middle section to the top of the viewable area. var staticTopHeight = scrollSection.offsetTop; var parentEle = scrollSection.offsetParent; while (parentEle != null) { staticTopHeight += parentEle.offsetTop - parentEle.scrollTop; parentEle = parentEle.offsetParent; } // Calculate the target height based on the difference between the viewable height // and the heights of the areas above and below the middle section. var targetHeight = (viewableHeight - (staticTopHeight + staticBottomHeight)); // Must have a sizeable scroll section to work with. if (0 < targetHeight) { // Set up the scrollSection now. scrollSection.style.height = (targetHeight) + "px"; if( typeof(layoutCorrection)!='undefined' && layoutCorrection.indexOf('HIDE_XSCROLL') > -1) { // This is required for browsers that require special processing to hide unnecessary horizontal scrollbar. scrollSection.style.overflowY = "auto"; if (scrollSection.clientWidth > 0) { var barWidth = scrollSection.offsetWidth - scrollSection.clientWidth; if(0 < barWidth && barWidth < 20) { scrollSection.style.paddingRight = barWidth + "px"; scrollSection.style.overflowX = "hidden"; } else { scrollSection.style.overflowX = "auto"; } } } else { scrollSection.style.overflow = "auto"; } if( typeof(layoutCorrection)!='undefined' && layoutCorrection.indexOf('POSN_YSCROLL') > -1) { // This is required for browsers that require special processing to effectively display vertical scrollbars. if( 0 < (scrollSection.offsetWidth - scrollSection.clientWidth)) scrollSection.style.marginRight = (scrollSection.offsetWidth - scrollSection.clientWidth) + "px"; } } else { scrollSection.style.height = "0px"; scrollSection.style.overflow = "hidden"; } } } }