<?php $subs = Array(); ?>
<?php if ($depth == 0): ?>

<div id="menu-top">
    <table border="0" cellspacing="0" cellpadding="0">
        <tr> 
    <?php foreach ($items as $i => $item): ?>
        <?php if ($i%3 == 0): ?>
        
            <td align="left" valign="top" nowrap="nowrap">
        <?php endif; ?>
                <p>
                    <a href="<?php echo htmlspecialchars($item['link']) ?>"><?php echo $item['title'] ?></a>
                </p>
        <?php if (($i+1)%3 == 0 || !isset($items[$i+1])): ?>
            </td>        
        <?php endif; ?>
    <?php endforeach; ?>
        </tr>
    </table>
</div>

<?php //$this->trace($subs) ?>
<?php foreach ($subs as $sub): ?>
<?php if (!empty($sub['html'])): ?>
<div parent="<?php echo $sub['parent'] ?>" class="menu-top-subitems" id="menu-top-subitems-<?php echo $sub['parent'] ?>" style="display: none; width: 200px">
    <?php echo $sub['html'] ?>
</div>
<?php endif; ?>
<?php endforeach; ?>

<?php else: ?>
<?php //$this->trace($items) ?>
<?php if (!empty($items)): ?>
<?php foreach ($items as $item): ?>
<div class="menu-top-subitems-item">
    <a href="<?php echo htmlspecialchars($item['link']) ?>">
        <?php echo $item['title'] ?>
    </a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endif; ?>