function expand2(argTable, argImage) { var oStyle = document.getElementById(argTable).style; if (oStyle.display == 'none') { oStyle.display = 'block'; oStyle.visibility = 'visible'; if (argImage) argImage.src = "/images/collapse2.gif"; } else { oStyle.display = 'none'; oStyle.visibility = 'hidden'; if (argImage) argImage.src = "/images/expand2.gif"; } } function expandPlay(argTable) { var oStyle = document.getElementById(argTable).style; if (oStyle.display == 'none') { oStyle.display = 'block'; oStyle.visibility = 'visible'; } else { oStyle.display = 'none'; oStyle.visibility = 'hidden'; } } function fitPreviewImage() { var oImage = document.getElementById("imgprew"), oMainTable = document.getElementsByClassName("mainTable"), oImageHost, nHeightDiff, nHeight, nImageHeight; if (oMainTable && (oMainTable = oMainTable.item(0)) && oImage && (nHeightDiff = window.innerHeight - (~~oMainTable.getBoundingClientRect().height + 4))) { nHeight = ~~(nHeightDiff + oImage.getBoundingClientRect().height); if (nHeight > 128) { oImageHost = oImage.closest('.host-preview-control'); nImageHeight = Math.min(nHeight, 512); nHeight = Math.min(nHeight, window.innerHeight); oImageHost.style.height = nHeight + "px"; if ( parseInt(oImage.dataset.resize) ) oImage.style.height = nImageHeight - 0 * (parseInt(getComputedStyle(oImageHost).marginTop) + parseInt(getComputedStyle(oImageHost).marginBottom)) + "px"; oImageHost.style.maxHeight = oImage.parentElement.style.maxHeight = oImage.style.maxHeight = "none"; } } // displays the image once the host is resized to fully fit the window's height if (oImage) oImage.style.visibility = "initial"; } window.addEventListener("load", function() { fitPreviewImage(); // fit the preview-image to the window's height (prevent adding vertical scroll-bar) });