<?php 

$Menu = array(
    /*  0 => array("Typ - 1/2/3","Odkaz","Popisek");
    // typ: 1- kategorie
    //      2- položka
    //      3- jiné */

        1 => array(1,"index.php?id=uvod","Hlavni"),
        2 => array(2,"./../","Zpět na web"),
        3 => array(2,"./../forum/","Forum"),
        4 => array(2,"./../registrace/","Registrace"),
        5 => array(2,"./index.php?id=bugreport$SID","Hlášení chyb"),
//        6 => array(2,"./index.php?id=stats$SID","Statistiky"),
//        7 => array(2,"./index.php?id=races$SID","Rasy"),
//        8 => array(2,"./index.php?id=classes$SID","Povolání"),
//        9 => array(1,"#","Obecné Hledání"),
//        10 => array(3,"<span style=\"padding-left: 5px;\">\n                <input type=\"text\" name=\"search\" maxlength=\"255\" class=\"search\" title=\"Pro Odeslání stiskněte Enter\">\n              </span>",""),
//        11 => array(1,"#","Uživatelé"),
//        12 => array(2,"./index.php?id=chars$SID","Postavy"),
//        13 => array(2,"./index.php?id=myacc$SID","Muj účet"),
//        14 => array(2,"./index.php?id=guild$SID","Guildy"),
//        15 => array(1,"./index.php?id=items$SID","Itemy"),
//        16 => array(2,"./index.php?id=items$SID","Hledání"),
//        17 => array(2,"./index.php?id=itemsets$SID","Sety"),
        18 => array(1,"./index.php?id=questy$SID","Questy"),
        19 => array(2,"./index.php?id=questy$SID","Hledání"),
//        20 => array(2,"./index.php?id=qzone$SID","Zóny"),
//        21 => array(2,"./index.php?id=qtrskill$SID","Profese"),
//        22 => array(2,"./index.php?id=qspecial$SID","Speciální"),
//        23 => array(1,"./index.php?id=creeps$SID","Bestiář"),
//        24 => array(2,"./index.php?id=creeps$SID","Hledání"),
//        25 => array(2,"./index.php?id=czone$SID","Zóny"),
//        26 => array(2,"./index.php?id=ctype$SID","Typy"),
//        27 => array(2,"./index.php?id=crare$SID","Unikátní"),
//        28 => array(1,"#","Geografie"),
//        29 => array(2,"./index.php?id=glevel$SID","Podle levelu"),
//        30 => array(2,"./index.php?id=gzone$SID","Zóny"),
//        31 => array(1,"./index.php?id=spells$SID","Spell"),
//        32 => array(2,"./index.php?id=spells$SID","Hledání"),
//        33 => array(2,"./index.php?id=sclass$SID","Podle tříd"),
//        34 => array(1,"./index.php?id=talents$SID","Talenty"),
//        35 => array(2,"./index.php?id=talents$SID","Prohlížet"),
//        36 => array(1,"./index.php?id=profes$SID","Profese"),
//        37 => array(2,"./index.php?id=profes$SID","Prohlížet"),
//        38 => array(2,"./index.php?id=pteach$SID","Učitelé"),
        );

  function GenerateMenu(){ 
    global $Menu;

    $klice = array_keys($Menu);
    $klice_count = count($klice);

    for($i=0; $i <= $klice_count ;$i++){
    	if($Menu[$klice[$i]][0] == 1){  
        if( $inside_submenu == 1 ){ $Generated_Menu .= "          </ul></li>\n"; }
        elseif( !empty($Generated_Menu) ){ $Generated_Menu .= "</li>\n"; } unset($inside_submenu);

          $Generated_Menu .= "          <li><a href=\"".$Menu[$klice[$i]][1]."\">".$Menu[$klice[$i]][2]."</a>";

        $submenu = 1;
        } 
      elseif($Menu[$klice[$i]][0] == 2){ 
        if( $submenu == 1 ){ $Generated_Menu .= "<ul>\n"; }; unset($submenu);

          $Generated_Menu .= "            <li><a href=\"".$Menu[$klice[$i]][1]."\">".$Menu[$klice[$i]][2]."</a><li>\n";

        $inside_submenu = 1;
        } 
      elseif($Menu[$klice[$i]][0] == 3){ 
        if( $submenu == 1 ){ $Generated_Menu .= "<ul>"; }; unset($submenu); 

          $Generated_Menu .= "          <li>".$Menu[$klice[$i]][1]."</li>\n";

        $inside_submenu = 1;
        } 
      elseif( !empty($Menu[$klice[$i]][0]) AND !empty($Menu[$klice[$i]][1]) AND !empty($Menu[$klice[$i]][2]) ){ 
        $Generated_Menu .= "          <li><a href=\"#\">Chyba !!</a>"; }
      else{ $Generated_Menu .= "          </ul></li>\n"; };

      };
    
    return $Generated_Menu;
    };

/*
          <li><a href=""></a><ul>
              <li><a href=""></a></li>
              <li><a href=""></a></li>
            </ul></li>
*/

?>
