<?php
function joomlaposition_5() {
    $document = JFactory::getDocument();
    $view = $document->view;
    $isPreview  = $GLOBALS['theme_settings']['is_preview'];
    if (isset($GLOBALS['isModuleContentExists']) && false == $GLOBALS['isModuleContentExists'])
        $GLOBALS['isModuleContentExists'] = $view->containsModules('right_mod') ? true : false;
?>
    <?php if ($isPreview || $view->containsModules('right_mod')) : ?>

    <?php if ($isPreview && !$view->containsModules('right_mod')) : ?>
    <!-- empty::begin -->
    <?php endif; ?>
    <div class=" bd-joomlaposition-5 clearfix" <?php echo buildDataPositionAttr('right_mod'); ?>>
        <?php echo $view->position('right_mod', 'block%joomlaposition_block_5', '5'); ?>
    </div>
    <?php if ($isPreview && !$view->containsModules('right_mod')) : ?>
    <!-- empty::end -->
    <?php endif; ?>
    <?php endif; ?>
<?php
}