<?php
global $menuArr;
/*
			<li><a class="big_item bi_3" title="Investice" href="<?php echo URL;?>/investice/">Investice</a>
					<li><a href="<?php echo URL; ?>/dluhopisy/">Dluhopisy e-Finance II</a></li>
					<li><a href="<?php echo URL; ?>/investice/allianz-bonusinvest/">Allianz BONUSinvest</a></li>
					<li><a href="<?php echo URL; ?>/investice/clear-deal-vklad/">J&T Clear Deal vklad</a></li>
					<li><a href="<?php echo URL; ?>/investice/cp-invest/">�P INVEST</a></li>
			<li><a class="big_item bi_4" title="�v�ry" href="<?php echo URL;?>/uvery/">�v�ry</a>
					<li><a href="<?php echo URL?>/uvery/hypoteky/">Hypot�ka na m�ru</a></li>
			<li><a class="big_item bi_5" title="Podnikov� poradenstv�" href="<?php echo URL;?>/podnikove-poradenstvi/">Podnikov� poradenstv�</a>
					<li><a href="<?php echo URL?>/ucetnictvi/podnikove-ucetnictvi/">Podnikov� ��etnictv�</a></li>
			<li><a class="big_item bi_6" title="Poradenstv� s dluhy" href="<?php echo URL;?>/dluhy-poradenstvi/">Poradenstv� s dluhy</a>
					<li><a href="<?php echo URL?>/dluhy-poradenstvi/">Dluhy poradenstv�</a></li>
*/

///?stavba=1#stavebnictvi
$menuArr = Array (
    0 => array(
		"title" => "Nab�dka pr�ce",
               "url" => "prace",
		"items" => array (
			0 => array (
				"title" => 'Realitn� makl��',
				"url" => "prace/hledame-realitni-maklere",
			),
		
		/*	2 => array (
				"title" => "Pr�ce ve stavebnictv�",
                                "url" => "prace",
				"items" => array (
                                     0 => array('title'=>'obklada�','url'=>'prace/obkladac')
                                    ,1 => array('title'=>'podlah��','url'=>'prace/podlahar')
                                    ,2 => array('title'=>'zedn�k','url'=>'prace/zednik')
                                    ,3 => array('title'=>'mal��','url'=>'prace/malir')
                                    ,4 => array('title'=>'tesa�','url'=>'prace/tesar')
                                    ,5 => array('title'=>'pomocn� stavebn� pr�ce','url'=>'prace/pomocne-stavebni-prace')           
				)
			) */
		)
	),
    
    1 => array(
		"title" => "Nab�dka poji�t�n�",
		"items" => array (
			0 => array (
				"title" => 'Poji�t�n� na cesty',
				"url" => "pojisteni-do-zahranici",
				"items" => array (
					0 => array('title'=>'Cestovn� poji�t�n�','url'=>'http://www.pojisteni.com/cestovni-pojisteni'),
					1 => array('title'=>'Poji�t�n� storna','url'=>'http://www.pojisteni.com/pojisteni-storna')
				)
			),
			1 => array (
				"title" => "Poji�t�n� vozidel",
				"url" => "pojisteni-vozidel",
				"items" => array (
					0 => array('title'=>'Povinn� ru�en�','url'=>'http://www.pojisteni.com/povinne-ruceni-porovnani'),
					1 => array('title'=>'Havarijn� poji�t�n�','url'=>'http://www.pojisteni.com/havarijni-pojisteni')
				)
			),
			2 => array (
				"title" => "Poji�t�n� odpov�dnosti",
				"url" => "pojisteni-odpovednosti",
				"items" => array (
					0 => array('title'=>'Poji�t�n� odpov�dnosti zam�stnance','url'=>'http://www.pojisteni.com/pojisteni-odpovednosti')
				)
			),
			3 => array (
				"title" => "Poji�t�n� bytu, domu",
				"url" => "pojisteni-majetku",
				"items" => array (
					0 => array('title'=>'Poji�t�n� dom�cnosti','url'=>'http://www.pojisteni.com/pojisteni-domacnosti'),
					1 => array('title'=>'Poji�t�n� nemovitosti','url'=>'http://www.pojisteni.com/pojisteni-nemovitosti')
				)
			),
			4 => array (
				"title" => "Poji�t�n� osob",
				"url" => "pojisteni-osob",
				"items" => array (
					0 => array('title'=>'�ivotn� poji�t�n�','url'=>'http://www.pojisteni.com/zivotni-pojisteni')
				)
			),	
			5 => array (
				"title" => "Poji�t�n� podnikatel�",
				"url" => "informace/pojisteni-podnikatelu",
				"items" => array (
					0 => array('title'=>'Souhrnn� poji�t�n� majetku','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/souhrnne-pojisteni-majetku'),
					1 => array('title'=>'Poji�t�n� elektroniky','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-elektroniky'),
					2 => array('title'=>'Poji�t�n� stroj�','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-stroju'),
					3 => array('title'=>'Poji�t�n� stavebn� a mont�n�','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-stavebni-a-montazni'),
					4 => array('title'=>'Poji�t�n� p�eru�en� provozu','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-preruseni-provozu'),
					5 => array('title'=>'Poji�t�n� odpov�dnosti za �kodu a vadu v�robku','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-profesni-odpovednosti'),
					6 => array('title'=>'Poji�t�n� profesn� odpov�dnosti','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-profesni-odpovednosti'),
					7 => array('title'=>'Poji�t�n� odpov�dnosti zam�stnance za �kodu zp�sobenou zam�stnavateli','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-odpovednosti-zamestnance-za-skodu-zpusobenou-zamestnavateli'),
					8 => array('title'=>'Poji�t�n� managementu','url'=>'http://www.pojisteni.com/informace/pojisteni-podnikatelu/pojisteni-managementu')
				)
			)	
		)
	),
    
	2 => array (
		"title" => "Reality",
		'url' => 'http://www.e-finance-reality.cz',
		"items" => Array (
			0 => array (
				"title" => "Nab�dka nemovitost�",
				"url" => "http://www.e-finance-reality.cz/reality-nabidka/?set"
			),	
			1 => array (
				"title" => "Popt�vka nemovitost�",
				"url" => "http://www.e-finance-reality.cz/reality-poptavka/?set&amp;show=demand"
			),
			2 => array(
				'title' => 'Nab�dn�te nemovitost',
				'url' => 'http://www.e-finance-reality.cz/nabidnete-nemovitost/'
			),
			3 => array(
				'title' => 'Zadejte si popt�vku',
				'url' => 'http://www.e-finance-reality.cz/zadani-poptavky/'
			)
		)
	),
	3 => array (
		"title" => "Investice",
		'url' => URL . '/investice/',
		"items" => Array (
			0 => array (
				"title" => "Dluhopisy e-Finance",
				"url" => URL . "/dluhopisy/"
			),	
//			1 => array (
//				"title" => "Allianz BONUSivest",
//				"url" => URL . "/investice/allianz-bonusinvest/"
//			),
//			2 => array(
//				'title' => 'J&T Clear Deal vklad',
//				'url' => URL . '/investice/clear-deal-vklad/'
//			),
//			3 => array(
//				'title' => '�P INVEST',
//				'url' => URL . '/investice/cp-invest/'
//			)
		)
	),

	5 => array(
		'title' => 'Podnikov� poradenstv�',
		'url' => URL . '/podnikove-poradenstvi/',
		'items' => array(
			0 => array(
				'title' => 'Podnikov� ��etnictv�',
				'url' => URL . '/ucetnictvi/podnikove-ucetnictvi/'
			)
		)
	),
	6 => array(
		'title' => 'Poradenstv� s dluhy',
		'url' => URL . '/dluhy-poradenstv�/',
		'items' => array(
			0 => array(
				'title' => 'Dluhy poradenstv�',
				'url' => URL . '/dluhy-poradenstv�/'
			)
		)
	)
);


function render_left_menu_static() {
	global $menuArr;
	global $db;
	
	$out = "<div class='left_menu_box_hp'>";
	$c = 0;
	
	$erase_hide = '';
	foreach ($menuArr as $key => $value) {
		$c++;
		$out .= "<h2>" . $value['title'] . "</h2>";
		$act_yet = '';
		$out .= '<ul class="main">';
		foreach ($value['items'] as $k => $v) {
			$temp_out = '';
			$active = $not_act_parent = '';
			$it_id = 'it_' . $key . '_' . $k;
			if ($v['items']) {
				$li_class = ($k < 3 && $erase_hide != $it_id) ? '' : 'class="hide"';
				$temp_out .= '<li id="' . $it_id . '_cov" ' . $li_class . '><ul class="sub">';
				foreach ($v['items'] as $kk => $vv) {
					if ($vv['url'] && $vv['url'] != '#') {
						
                                                $active = (ereg("/" . $vv['url'] . "/", $_SERVER['REQUEST_URI'])) ? ' class="active" ' : '';
                                                
                    //if(!$active && $_GET['stavba'] && $vv['url'])
                                                if ($active) {
							$not_act_parent = true;
							$temp_out = preg_replace("/class=\"hide\"/", "", $temp_out);
							$erase_hide = $it_id;                                                      
						}
                                                
						$url = (preg_match("/http/", $vv['url'])) ? $vv['url'] : '/' . $vv['url'];
						$temp_out .= "<li class='menu_a'><a href='" . $url . "' title='" . $vv['title'] . "' " . $active . ">" . $vv['title'] . "</a></li>";
					} else {
						$temp_out .= "<li ><span class='no_click'>" . $vv['title'] . "</span></li>";
					}
				}
				$temp_out .= '</ul></li>';
			} //$v['items']
			$f_class = '';
			if ($k == 0) {
				$f_class = ' first_menu_a ';
			
		//$out .= "<li class='top_sep' ></li>";
			}
			if ($v['url'] && $v['url'] != '#') {
				if ($temp_out && $not_act_parent) {
					$active = ''; //pokud mame aktivni detskou polozku, nemuze byt aktivni i rodic
				} else {
					$active = (ereg("/" . $v['url'] . "/", $_SERVER['REQUEST_URI'])) ? 'active' : '';
				}
				
				$url = (preg_match("/http/", $v['url'])) ? $v['url'] : '/' . $v['url'];
				if ($k > 0) {
					$out .= '<li class="menu_sep" ></li>';
				}
				$out .= "<li class='menu_a" . $f_class . "'>";
				
				$class_no_items = '';
                                if($act_yet) {
                                    $active = '';
                                }
				if ($active) {
					$temp_out = preg_replace("/class=\"hide\"/", "", $temp_out);
					$erase_hide = $it_id;
                                        $act_yet = true;
				}
				if ($temp_out) {
					$plus_minus = ($k < 3 || $erase_hide == $it_id) ? 'minus' : 'plus';
					$out .= '<a href="#" id="' . $it_id . '" class="' . $plus_minus . '">&nbsp;</a> ';
				} else {
					$class_no_items = 'noi';
				}
				
				$class = '';
				
				if ($active || $class_no_items) {
					$class = ' class="' . $active . ' ' . $class_no_items . '" ';
				}
				$out .= "<a href='" . $url . "' title='" . $v['title'] . "' " . $class . " >" . $v['title'] . "</a></li>";
			} else {
				$out .= "<li >";
				if ($k > 0) { //$out .= '<div class="menu_sep" ></div>';
				}
				$out .= "<span class='no_click'>" . $v['title'] . "</span></li>";
			}
			
			//podpolozky
			if ($temp_out) {
				$out .= $temp_out;
			}
		}
		$out .= '</ul>';
		$out .= "<div class='menu_separator'></div>";
	
	} //foreach
	$out .= "</div>";
	return $out;
}
?>