<? $aMainMenu = $this->config->item('main_menu'); ?>

<div id="userMenu">
	<? if( empty( $this->aSystemVar['current_user']['Name'] ) ): ?>
	<div id="loginBlock">
			<?= form_open('user/login/') ?>
				<div class="text"><?=$this->lang->line('user_name')?></div>
				<div class="input"><input type="text" name="Name" class="text" /></div>
				<div class="text"><?=$this->lang->line('user_password')?></div>
				<div class="input"><input type="password" name="Password" class="password" /></div>
				<div class="submit"><input type="image" src="<?= $this->config->item('design_pic_url') ?>submit_button.gif" class="submit" /></div>
			<?= form_close();

				foreach ( $aMainMenu['visitor'] as $aMenu )
				{
					if ( empty($aMenu['param']) )
						echo '<div class="textCenter marginbottom5">' . anchor( $aMenu['url'], $this->lang->line($aMenu['lang_key'])) . '</div>';
					else
					{
						$sParam = isset($this->aSystemVar[$aItem['param']]) ? $this->aSystemVar[$aItem['param']] : 0;
						echo '<div class="textCenter">' . anchor( $aMenu['url'] . $sParam, $this->lang->line($aMenu['lang_key'])) . '</div>';
					}
				}

			?>
		</div>
	<? else: ?>
		<div style="padding:10px 0px;">
			<div class="usernick">
				<?= @$this->aSystemVar['current_user']['Name'] ?>
			</div>
			<div style="position:absolute;top:0px;right:10px;">
				<?
					if ( !empty($this->aSystemVar['current_user']['iconUrl']) )
						echo '<img src="' . @$this->aSystemVar['current_user']['iconUrl'] . '" alt="' . @$this->aSystemVar['current_user']['Name'] . '" title="' . @$this->aSystemVar['current_user']['Name'] . '" class="icon" />';
				?>
			</div>
		</div>

		<div id="memberMenu">
			<?
			foreach( $aMainMenu['member'] as $aCatMenu => $aMenu )
			{
				echo '<div class="capt">'.$aCatMenu.'</div>';
				if($this->bAdmin)
				{
					echo '<div class="mItem">' . anchor( 'admin', 'admin panel') . '</div>';
				}

				foreach($aMenu as $aItem)
				{
					if ( empty($aItem['param']) )
						echo '<div class="mItem">' . anchor( $aItem['url'], $this->lang->line($aItem['lang_key'])) . '</div>';
					else
					{
						$sParam = isset($this->aSystemVar[$aItem['param']]) ? $this->aSystemVar[$aItem['param']] : 0;
						echo '<div class="mItem">' . anchor( $aItem['url'] . $sParam, $this->lang->line($aItem['lang_key'])) . '</div>';
					}
				}
			}
			?>
			<!-- Whats New? [ v sleduushey versii ]  -->
		</div>
	<? endif; ?>
</div>

<div id="mainMenu" style="margin-bottom: 20px;">
<?

//	$aMainMenu = $this->config->item('main_menu');

	foreach ( $aMainMenu['general'] as $aMenu )
	{
		if ( empty($aMenu['param']) )
			echo '<div class="textCenter">' . anchor( $aMenu['url'], $this->lang->line($aMenu['lang_key'])) . '</div>';
		else
		{
			$sParam = isset($this->aSystemVar[$aItem['param']]) ? $this->aSystemVar[$aItem['param']] : 0;
			echo '<div class="textCenter">' . anchor( $aMenu['url'] . $sParam, $this->lang->line($aMenu['lang_key'])) . '</div>';
		}
	}

?>
</div>