function template_tp_below()
{
    global $context;
    if ($context['TPortal']['lowerpanel'] == 1) {
        echo '
				<div id="tplowerbarHeader" style="', in_array('tplowerbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
				', TPortal_panel('lower'), '</div>';
    }
    echo '</div>
			</td>';
    // TinyPortal integrated bars
    if ($context['TPortal']['rightpanel'] == 1) {
        echo '
			<td id="tprightbarContainer" style="width:', $context['TPortal']['rightbar_width'], 'px;', in_array('tprightbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '" valign="top">
				<div id="tprightbarHeader" style="', in_array('tprightbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
				', $context['TPortal']['useroundframepanels'] == 1 ? '<span class="upperframe"><span></span></span>
				<div class="roundframe">' : '', TPortal_panel('right'), $context['TPortal']['useroundframepanels'] == 1 ? '</div>
				<span class="lowerframe"><span></span></span>' : '', '
				</div>
			</td>';
    }
    echo '
		</tr>
	</table>';
    if ($context['TPortal']['bottompanel'] == 1) {
        echo '
		<div id="tpbottombarHeader" style="clear: both;', in_array('tpbottombarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
				', TPortal_panel('bottom'), '
		</div>';
    }
}
function template_frontpage()
{
    global $context;
    if ($context['TPortal']['frontblock_type'] == 'first' || $context['TPortal']['front_type'] == 'frontblock') {
        echo '<div id="tpfrontpanel_top" style="margin: 0 0 4px 0; padding: 0;">', TPortal_panel('front'), '</div>';
    }
    if (!isset($context['TPortal']['category'])) {
        // check the frontblocks first
        if ($context['TPortal']['frontblock_type'] == 'last' && $context['TPortal']['front_type'] != 'frontblock') {
            echo '<div id="tpfrontpanel_bottom">', TPortal_panel('front'), '</div>';
        }
        return;
    }
    $front = $context['TPortal']['category'];
    // get the grids
    $grid = tp_grids();
    // any pageindex?
    if (!empty($context['TPortal']['pageindex'])) {
        echo '
	<div class="tp_pageindex_upper">', $context['TPortal']['pageindex'], '</div>';
    }
    // use a customised template or the built-in?
    render_template_layout($grid[!empty($front['options']['layout']) ? $front['options']['layout'] : $context['TPortal']['frontpage_layout']]['code'], 'category_');
    // any pageindex?
    if (!empty($context['TPortal']['pageindex'])) {
        echo '
	<div class="tp_pageindex_lower">', $context['TPortal']['pageindex'], '</div>';
    }
    if ($context['TPortal']['frontblock_type'] == 'last' && $context['TPortal']['front_type'] != 'frontblock') {
        TPortal_panel('front');
    }
}
function template_tp_below()
{
    global $context;
    if ($context['TPortal']['lowerpanel'] == 1) {
        echo '
				<div id="tplowerbarHeader" style="', in_array('tplowerbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
					', TPortal_panel('lower'), '
				</div>';
    }
    echo '
			</div>
			<div class="HiddenLowercontainer"', $context['TPortal']['rightpanel'] == 1 ? ' style="width:' . $context['TPortal']['rightbar_width'] . 'px;"' : '', '>';
    // TinyPortal integrated bars
    if ($context['TPortal']['leftpanel'] == 1) {
        echo '
				<div class="tpleftbottomContainer tpContent-show', $context['TPortal']['rightpanel'] != 1 ? ' tpfull-width' : '', '" id="tpbottomleftbarContainer" style="width:', $context['TPortal']['leftbar_width'], 'px; ', in_array('tpleftbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
					<div id="tpbottomleftbarHeader" style="', in_array('tpleftbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
					', $context['TPortal']['useroundframepanels'] == 1 ? '<span class="upperframe"><span></span></span>
					<div class="roundframe" style="overflow: auto;">' : '
						', TPortal_panel('left'), $context['TPortal']['useroundframepanels'] == 1 ? '</div>
					<span class="lowerframe"><span></span></span>' : '', '
					</div>
				</div>';
    }
    // TinyPortal integrated bars
    if ($context['TPortal']['rightpanel'] == 1) {
        echo '
				<div class="tprightbottomContainer ', $context['TPortal']['leftpanel'] != 1 ? ' tpfull-width' : '', '"" id="tprightbarContainer" style="width:', $context['TPortal']['rightbar_width'], 'px;', in_array('tprightbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? ' display: none;' : '', '">
					<div id="tprightbarHeader" style="', in_array('tprightbarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
					', $context['TPortal']['useroundframepanels'] == 1 ? '<span class="upperframe"><span></span></span>
					<div class="roundframe">' : '', TPortal_panel('right'), $context['TPortal']['useroundframepanels'] == 1 ? '</div>
					<span class="lowerframe"><span></span></span>' : '', '
					</div>
				</div>';
    }
    echo '
		</div>
	</div>';
    if ($context['TPortal']['bottompanel'] == 1) {
        echo '
		<div id="tpbottombarHeader" style="clear: both;', in_array('tpbottombarHeader', $context['tp_panels']) && $context['TPortal']['showcollapse'] == 1 ? 'display: none;' : '', '">
				', TPortal_panel('bottom'), '
		</div>';
    }
}