<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

if (G5_IS_MOBILE) {
    include_once(G5_THEME_MOBILE_PATH.'/tail.php');
    return;
}
?>
	</div>
	</div>

	<!-- Sidebar -->
	<div id="sidebar">


		<div class="inner">

			<!-- Logo -->
			<div id="logo" >
				<img src="<? echo G5_THEME_IMG_URL; ?>/logo.png" onclick="window.location='<? echo G5_URL; ?>';">
			</div>

			<!-- Search -->
				<section id="search" class="alt">
					<form name="fsearchbox" method="get" action="<?php echo G5_BBS_URL ?>/search.php" onsubmit="return fsearchbox_submit(this);">
						<input type="hidden" name="sfl" value="wr_subject||wr_content">
						<input type="hidden" name="sop" value="and">
						<label for="sch_stx" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
						<input type="text" name="stx" id="sch_stx" maxlength="20">
						<!-- <input type="submit" id="sch_submit" value="검색"> -->
					</form>
				</section>
				<script>
				function fsearchbox_submit(f)
				{
					if (f.stx.value.length < 2) {
						alert("검색어는 두글자 이상 입력하십시오.");
						f.stx.select();
						f.stx.focus();
						return false;
					}

					// 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
					var cnt = 0;
					for (var i=0; i<f.stx.value.length; i++) {
						if (f.stx.value.charAt(i) == ' ')
							cnt++;
					}

					if (cnt > 1) {
						alert("빠른 검색을 위하여 검색어에 공백은 한개만 입력할 수 있습니다.");
						f.stx.select();
						f.stx.focus();
						return false;
					}

					return true;
				}
				</script>
			<!-- Menu -->
				<nav id="menu">
					<header class="major">
						<h2>Menu</h2>
					</header>
					<ul>

					<?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>
						<?
						$ck_sql2 = sql_fetch( "select count(*) total 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 " );
						?>
						<?if($ck_sql2['total'] > 0){?>
							<span class="opener"><?php echo $row['me_name'] ?></span>
						<?} else {?>
							<a href="<?php echo $row['me_link']; ?>" target="_<?php echo $row['me_target']; ?>" class="gnb_1da"><?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>'.PHP_EOL;
						?>
							<li><a href="<?php echo $row2['me_link']; ?>" target="_<?php echo $row2['me_target']; ?>"><?php echo $row2['me_name'] ?></a></li>
						<?php
						}

						if($k > 0)
							echo '</ul>'.PHP_EOL;
						?>
						</li>
					<?}?>
					</ul>
				</nav>



			<!-- Section -->
				<section>
					<header class="major">
						<h2>Customer</h2>
					</header>
					<ul class="contact">
						<li class="fa-envelope-o"><a href="#">kdhlove741@naver.com</a></li>
						<li class="fa-phone">010-5511-6166</li>
					</ul>
				</section>

			<!-- Footer -->
				<footer id="footer">
					<p class="copyright">CopyRight &copy; Group By EYE.</p>
				</footer>

		</div>
	</div>

	<script src="<?php echo G5_THEME_JS_URL ?>/jquery.min.js"></script>
	<script src="<?php echo G5_THEME_JS_URL ?>/skel.min.js"></script>
	<script src="<?php echo G5_THEME_JS_URL ?>/util.js"></script>
	<!--[if lte IE 8]><script src="<?php echo G5_THEME_JS_URL ?>/ie/respond.min.js"></script><![endif]-->
	<script src="<?php echo G5_THEME_JS_URL ?>/main.js"></script>

</div>



<!-- } 콘텐츠 끝 -->


<?php
include_once(G5_THEME_PATH."/tail.sub.php");
?>