<?php

$menu=array(
	'istanze'=>array('liadd'=>null, 'href'=>null, 'title'=>'Istanze', 'selected'=>false, 'submenu'=>
		array(
			'elenco'=>array('liadd'=>null, 'href'=>'instances.php', 'title'=>'Elenco', 'selected'=>false, 'submenu'=>null),
			'modifica'=>array('liadd'=>null, 'href'=>null, 'title'=>'Modifica', 'selected'=>false, 'submenu'=>null)
		),
	),
/*	'blacklist'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Blacklist', 'selected'=>false, 'submenu'=>null),
	'accounts'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Accounts', 'selected'=>false, 'submenu'=>null),
	'forse'=>array('liadd'=>null, 'href'=>'#', 'title'=>'Forse', 'selected'=>false, 'submenu'=>null)*/
);


/*
 <li><a href=".">Guide</a></li>
 <li><a href="instances">Instances</a></li>
 <li><a href="about">About us</a></li>
 <li onmouseover="chulsh(this,true)" onmouseout="chulsh(this,false)">Language
  <ul class="ula" onmouseover="ulsh(this,true)" onmouseout="ulsh(this,false)">
  <li><a href="#">English</a></li>
  <li><a href="#">Italiano</a></li>
  </ul>
 </li>
*/

$menuout='';

function buildmenu($menu) {
	global $menuout;
	foreach ($menu as $key=>$arr) {
		$menuout.='<li';
		if (!is_null($arr['liadd'])) $menuout.=' '.$arr['liadd'];
		if (!is_null($arr['submenu'])) $menuout.=' onmouseover="chulsh(this,true)" onmouseout="chulsh(this,false)"';
		if ($arr['selected']) $menuout.=' class="hil"';
		$menuout.='>';
		if (!is_null($arr['href']))
			$menuout.='<a href="'.$arr['href'].'">'.$arr['title'].'</a>';
		else
			$menuout.=$arr['title'];
		if (!is_null($arr['submenu'])) {
// qui bisognerebbe aggiungere che a seconda del "livello" imposta class giusta: ula, oppure ulb per livello > 1
			$menuout.=N.'<ul class="ula" onmouseover="ulsh(this,true)" onmouseout="ulsh(this,false)">'.N;
			buildmenu($arr['submenu']);
			$menuout.='</ul>'.N;
		}
		$menuout.='</li>'.N;
	}
}

?>
