<?php

if (!defined('IN_CONTEXT')) die('access violation error!');

if (!function_exists('showMenu')) {
	
    function showMenu(&$menu_tree, $level = 0) {
        foreach ($menu_tree as $menu) {
    ?>
    <li>
    <?php
            if (sizeof($menu->slaves['MenuItem']) > 0) {
                $level++;
    ?>
    <span><a href="<?php if($menu->mi_category == 'outer_url') echo $menu->link; else echo 'index.php?'.$menu->link; ?>" >
    <?php echo $menu->name; ?></a>
    <?php
            echo '<ul>'."\n";
        //if ($level == 1) {
            //echo '<ul class="drop_level">'."\n";
        //} else {
            //echo '<ul class="flyout">'."\n";
        //}
    ?>
        <?php showMenu($menu->slaves['MenuItem'], $level); ?>
    </ul></span>
    <?php
                $level--;
            } else {
    ?>
    <a href="<?php if($menu->mi_category == 'outer_url') echo $menu->link; else echo 'index.php?'.$menu->link; ?>">
    <?php echo $menu->name; ?></a>
    <?php
            }
    ?>
    </li>
    <?php
        }
		
    }
	
}

$id_seed = Toolkit::randomStr();
?>


			<div class="nav_l"></div>
        	<ul id="nav_<?php echo $id_seed; ?>" class="navigation">
			<?php showMenu($menus); ?>
            </ul>
			<div class="nav_r"></div>

		
<script type="text/javascript">

var topMenuNum = 0;
$("#nav_<?php echo $id_seed; ?> li span").hover(
	function(){
		topMenuNum++;
		$(this).attr("id","kindMenuHover"+topMenuNum);
		$("#kindMenuHover" + topMenuNum + " > ul").show();
	},
	function(){
		$("#"+$(this).attr("id")+" > ul").hide();
		$(this).attr("id","");
	}
);
</script>