// 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). //Converts value to integer //checks value to make sure its an int before conversion. function _LU_isMozilla() { var userAgent = navigator.userAgent.toLowerCase(); if (((userAgent.indexOf('mozilla') > -1) && (userAgent.indexOf('msie') < 0)) || (userAgent.indexOf('firefox') > -1)) { return true; } else { return false; } } function _LU_toInt(value, defaultValue){ var nValue = parseInt(value); if (isNaN(nValue)){ if (defaultValue){ return defaultValue; } return 0; } return nValue; } function _LU_getStyle(obj){ try { if (document.defaultView && xGetComputedStyle(document.defaultView)){ return xGetComputedStyle(obj); } else if (obj.currentStyle){ return obj.currentStyle; } } catch (e){} return obj.style; } function _LU_getTop(obj) { var curtop = 0; try { if (xParent(obj)) { while (xParent(obj)) { curtop += xOffsetTop(obj) obj = xParent(obj); } } else if (xPageY(obj)) { curtop += xPageY(obj); } }catch (e) {} return curtop; } function getWindowHeight(){ if( typeof( window.innerHeight ) == 'number' ) { return window.innerHeight; } else if( document.documentElement && document.documentElement.clientHeight ) { return document.documentElement.clientHeight; } else if( document.body && document.body.clientHeight ) { return document.body.clientHeight; } } function _LU_getLastSiblingPositionedBelow(obj) { var lastValidSibling = null; var sibling = obj.nextSibling; while (sibling != null ) { if (sibling.tagName != null){ var siblingStyle = _LU_getStyle(sibling); var isVisible = siblingStyle.display.toLowerCase() != "none" ; var isRelative = siblingStyle.position.toLowerCase() != "absolute" ; if (sibling.offsetHeight != null && isVisible && isRelative){ var isSiblingPlacedBelow = _LU_getTop(obj) + obj.offsetHeight <= _LU_getTop(sibling); if (isSiblingPlacedBelow){ obj = sibling; lastValidSibling = sibling; } } } sibling = sibling.nextSibling; } return lastValidSibling; } function _LU_getExtraBottomContent(obj) { var extraContentHeight; var lastSibling = _LU_getLastSiblingPositionedBelow(obj); if (lastSibling != null){ var distance = _LU_getTop(lastSibling) - _LU_getTop(obj) - obj.offsetHeight; extraContentHeight = distance + _LU_toInt(_LU_getStyle(lastSibling).marginTop) + lastSibling.offsetHeight + _LU_toInt(_LU_getStyle(lastSibling).marginBottom) } else{ extraContentHeight = _LU_toInt(_LU_getStyle(obj).marginBottom); } var parent =xParent(obj, true); var offsetParent = xParent(obj); if (parent && obj != document.body) { var parentStyle = _LU_getStyle(parent); if (parent != null && offsetParent != null && parent.rowIndex != null && offsetParent.cellSpacing != null && offsetParent.rows != null){ var cellspacing = _LU_toInt(offsetParent.cellSpacing, 2) * (offsetParent.rows.length - parent.rowIndex ); extraContentHeight += cellspacing; } extraContentHeight += _LU_toInt(parentStyle.paddingBottom) + _LU_toInt(parentStyle.borderBottomWidth); extraContentHeight += _LU_getExtraBottomContent(parent); } return extraContentHeight; } var _LU_minHeight = 100; function _LU_getNewHeight(id) { try { var eDiv= xGetElementById(id); if (eDiv != null) { var extraBottomContent = _LU_getExtraBottomContent(eDiv); var newHeight = xClientHeight() - _LU_getTop(eDiv) - extraBottomContent; if (newHeight < _LU_minHeight){ newHeight = _LU_minHeight; } if (_LU_isMozilla()) { var runtimeStyle = _LU_getStyle(eDiv); if (runtimeStyle){ if (runtimeStyle.borderTopWidth){ newHeight -= _LU_toInt(runtimeStyle.borderTopWidth); } if (runtimeStyle.borderBottomWidth){ newHeight -= _LU_toInt(runtimeStyle.borderBottomWidth); } } } return newHeight; } }catch(e){} } function _LU_setHeight(id, newHeight, refresh){ var eDiv= xGetElementById(id); if (eDiv != null) { newHeight -= 2; xHeight(eDiv,newHeight); if (_LU_isMozilla()) { if (refresh){ var oldBorderColor = eDiv.style.borderColor; var oldBorderWidth = eDiv.style.borderWidth; eDiv.style.borderWidth="1"; eDiv.style.borderColor="transparent"; setTimeout("xGetElementById(\""+id+"\").style.borderWidth = \""+oldBorderWidth+"\"" ,1); setTimeout("xGetElementById(\""+id+"\").style.borderColor = \""+oldBorderColor+"\"" ,1); } } } } function _LU_resize_main(elemId) { var newHeight; newHeight = _LU_getNewHeight(elemId); _LU_setHeight(elemId, newHeight, true); }