<?php $option_value = $this->getCurrentOption(); ?>
<?php $application = $this->getCurrentApp(); ?>
<?php $sourcecode = $option_value->getObject(); ?>

<div>
    <iframe id="sourcecode_<?php echo $option_value->getId(); ?>"></iframe>
</div>
<script type="text/javascript">

    var subpage = page.getSubpage('<?php echo $option_value->getId(); ?>');

    subpage.setCallback('willappear', function() {
        this.setContentSize();
        <?php if($sourcecode->getHtmlCode()) : ?>
        loader.show();
        var html_file_path = "<?php echo $sourcecode->getHtmlFilePath(); ?>";
        $('#sourcecode_<?php echo $option_value->getId(); ?>').load(loader.hide.bind(loader)).attr('src', html_file_path);
        <?php endif; ?>
    });
    subpage.setContentSize = function() {
        $('#sourcecode_<?php echo $option_value->getId(); ?>').css({
            width: $('#pages').width(),
            height: $('#pages').height() - $('#page_header_'+this.id).height()
        });
    }

</script>