<?php
/**
* @Copyright Copyright (C) 2010 VTEM . All rights reserved.
* @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
* @link     	http://www.vtem.net
**/
// no direct access
defined('_JEXEC') or die('Restricted access');
require_once (dirname(__FILE__).DS.'menu_css_var.php');
if ($params->get('layout') == 1){
?>
<div class="vt_menu_wapper_ver" id="<?php echo $params->get('menuid','vt_menu'); ?>">
<?php } else { ?>
<div class="vt_menu_wapper" id="<?php echo $params->get('menuid','vt_menu'); ?>">
<?php }?>
    <div class="vtem_roundedleft"></div>
    <div class="vtem_roundedcenter">
	<ul class="vt_menu<?php echo $params->get('moduleclass_sfx'); ?>">
		<?php
        $zindex = 12000;

        foreach ($items as $i => &$item) {

            if ($item->content) {
                echo '<li class="' . $item->classe . ' level' . $item->level . '">' . $item->content;
            } elseif (isset($item->colonne)) {
                if (!isset($item->onlycoltitle))
                    echo '</ul><div class="clr"></div></div><div class="vt_menu_sub" ' . $item->colwidth . '><ul class="vt_menu_sub">';
                if (isset($item->coltitle))
                    echo $item->coltitle;
            }
            elseif ($item->title != "") {
                if ($params->get('imageonly', '0') == '1' || $item->img)
                    $item->title = '';
                echo '<li class="' . $item->classe . ' level' . $item->level . '" style="z-index : ' . $zindex . ';">';
                switch ($item->type) :
                    default:
                        echo '<a class=" ' . $item->anchor_css . '" href="' . $item->link . '" title="' . $item->anchor_title . '"' . $item->rel . '><span class="vt_title">' . $item->image . $item->title . '</span></a>';
                        break;
                    case 'separator':
                        echo '<span class="separator ' . $item->anchor_css . '"><span class="vt_title">' . $item->image . $item->title . '</span></span>';
                        break;
                    case 'url':
                    case 'component':
                        switch ($item->browserNav) :
                            default:
                            case 0:
                                echo '<a class=" ' . $item->anchor_css . '" href="' . $item->link . '" title="' . $item->anchor_title . '"' . $item->rel . '><span class="vt_title">' . $item->image . $item->title . '</span></a>';
                                break;
                            case 1:
                                // _blank
                                echo '<a class=" ' . $item->anchor_css . '" href="' . $item->link . '" target="_blank" title="' . $item->anchor_title . '"' . $item->rel . '><span class="vt_title">' . $item->image . $item->title . '</span></a>';
                                break;
                            case 2:
                                // window.open
                                //$attribs = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,'.$this->_params->get('window_open');
                                echo '<a class=" ' . $item->anchor_css . '" href="' . $item->link . '&tmpl=component" onclick="window.open(this.href,\'targetWindow\',\'$attribs\');return false;" title="' . $item->anchor_title . '"' . $item->rel . '><span class="vt_title">' . $item->image . $item->title . '</span></a>';
                                break;
                        endswitch;
                        break;
                endswitch;
            }

            if ($item->deeper) {

                if (isset($item->submenuswidth) || $item->leftmargin || $item->topmargin) {
                    $item->styles = "style=\"";
                    if ($item->leftmargin)
                        $item->styles .= "margin-left:" . $item->leftmargin . "px;";
                    if ($item->topmargin)
                        $item->styles .= "margin-top:" . $item->topmargin . "px;";
                    if (isset($item->submenuswidth))
                        $item->styles .= "width:" . $item->submenuswidth . "px;";

                    $item->styles .= "\"";
                } else {
                    $item->styles = "";
                }
                
                echo "\n\t<div class=\"vt_nav" . $item->divclasse . "\" ".$item->styles."><div class=\"vtemdrop-top\"></div><div class=\"vtemdrop-main\"><div class=\"vt_menu_sub first\" ".$item->colwidth.">\n\t<ul class=\"vt_menu_sub\">";
                if (isset($item->coltitle)) echo $item->coltitle;
            }
            // The next item is shallower.
            elseif ($item->shallower) {
                echo "\n\t</li>";

                echo str_repeat("\n\t</ul>\n\t<div class=\"clr\"></div></div><div class=\"clr\"></div></div><div class=\"vtemdrop-bottom\"></div></div>\n\t</li>", $item->level_diff);
            }
            // the item is the last.
            elseif ($item->is_end) {
                echo str_repeat("</li>\n\t</ul>\n\t<div class=\"clr\"></div></div><div class=\"clr\"></div></div><div class=\"vtemdrop-bottom\"></div></div>", $item->level_diff);
                echo "</li>";
            }
            // The next item is on the same level.
            else {
                if (!isset($item->colonne))
                    echo "\n\t\t</li>\n";
            }

            $zindex--;
        }
        ?>
	</ul>
	<div style="clear:both; height:0px; overflow:hidden;"></div>
</div>
<div class="vtem_roundedright"></div>
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>

