<?php
// Copyright 1999-2024. WebPros International GmbH. All rights reserved.
?>
<div id="frameWrapper">
    <iframe allowtransparency="true" id="pageIframe" src="<?php echo $this->escape($this->pageUrl); ?>" width="100%" height="400" frameborder="0" scrolling="auto" style="display: block;"></iframe>
</div>

<script type="text/javascript">
//<![CDATA[
Jsw.onReady(() => {
    const resizeBlocks = () => {
        let frameHeight = document.body.clientHeight
            - Element.cumulativeOffset(document.getElementById('frameWrapper'))[1]
            - parseInt(Element.getStyle(document.querySelector('.pul-layout__main-inner'), 'paddingBottom'));
        if (document.querySelector('.pul-layout__footer')) {
            frameHeight -= Element.getHeight(document.querySelector('.pul-layout__footer'));
        }

        document.getElementById('pageIframe').style.height = frameHeight + 'px';
    };

    resizeBlocks();
    window.addEventListener('resize', resizeBlocks);
});
//]]>
</script>
