<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
?>
<nav class="nav">
	<h2 class="blind">메인메뉴</h2>
	<div class="nav__wrap">
		<ul class="nav__list">
		<?php
			$sql = "select *
					from {$g5['menu_table']}
					where me_use = '1'
					and length(me_code) = '2'
					order by me_order, me_id ";
			$result = sql_query($sql, false);
			//$gnb_zindex = 999; // gnb_1dli z-index 값 설정용

			for ($i=0; $row=sql_fetch_array($result); $i++) {
		?>
			<li class="nav__item">
				<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="nav__link"><?php echo $row['me_name'] ?></a>

			<?php
				$sql2 = "select *
						from {$g5['menu_table']}
						where me_use = '1'
						and length(me_code) = '4'
						and substring(me_code, 1, 2) = '{$row['me_code']}'
						order by me_order, me_id ";
				$result2 = sql_query($sql2);

				for ($k=0; $row2=sql_fetch_array($result2); $k++) {
					if($k == 0)
						echo '<ul class="nav__list-2dep">'.PHP_EOL;
			?>
				<li class="nav__item-2dep">
					<a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>" class="nav__link-2dep"><?php echo $row2['me_name'] ?></a>
				</li>
			<?php
				}

				if($k > 0)
					echo '</ul>'.PHP_EOL;
			?>
			</li>
			<?php
			}

			if ($i == 0) {  ?>
			<?php } ?>
		</ul>
	</div>
</nav>


<style type="text/css">
	.nav {width: 100%; height: 55px; z-index: 9999; background: #fff; transition: height 0.3s; border-bottom: 1px solid #ddd; border-top: 1px solid #ddd; }
.nav.on { height: 375px; }
.nav.on:before { content: ''; position: absolute; left: 0; top: 70px; width: 100%; height: 1px; border-top: 1px solid #e1e4e8; }
.nav__wrap { position: relative; width: 1200px; margin: 0 auto; height: 100%; }
.nav__list { position: absolute; left: 0; top:0px; }
.nav__item { position: relative; float: left; margin-left: 97px; padding:19px 0;}
.nav__item:nth-child(1) { margin-left: 0; }
.nav__item:nth-child(1) ul {}
.nav__link { font-weight: 600; font-size: 13px; }
.nav__link:hover{color:#bf1d1d}
.nav__list-2dep { position: absolute; left: -15px; top: 53px; min-width: 150px; background: #fff; border:1px solid #ddd; display:none; z-index:9999;}
.nav__link-2dep { display: block; font-size: 13px; line-height: 2.5; padding:5px 10px;}
.nav__link-2dep:hover {color:red;}
</style>
