<?
if (!defined("_GNUBOARD_")) exit;

//-- 일반 모드에서 호출 되었습니다.
$bbs_path		= $g4[path];
$adm_path		= ".";
$is_admin_mode	= false;

if($adm_sub_path) {
	//-- adm 하위 디렉토리에서 호출 됐을 때
	$bbs_path		= "../..";
	$adm_path		= "../";
	$is_admin_mode	= true;
}

$begin_time = get_microtime();

@include_once($adm_path."/_common.php");
include_once($g4[path] . "/head.sub.php");
include_once($adm_path."/admin.config.php");
?>

<script type="text/javascript">
if (!g4_is_ie) document.captureEvents(Event.MOUSEMOVE)
function imageview(id, w, h)
{

    menu(id);

    var el_id = document.getElementById(id);

    //submenu = eval(name+".style");
    submenu = el_id.style;
    submenu.left = tempX - ( w + 11 );
    submenu.top  = tempY - ( h / 2 );

    selectBoxVisible();

    if (el_id.style.display != 'none')
        selectBoxHidden(id);
}

function help(id, left, top)
{
    menu(id);

    var el_id = document.getElementById(id);

    //submenu = eval(name+".style");
    submenu = el_id.style;
    submenu.left = tempX - 50 + left;
    submenu.top  = tempY + 15 + top;

    selectBoxVisible();

    if (el_id.style.display != 'none')
        selectBoxHidden(id);
}

// TEXTAREA 사이즈 변경
function textarea_size(fld, size)
{
	var rows = parseInt(fld.rows);

	rows += parseInt(size);
	if (rows > 0) {
		fld.rows = rows;
	}
}
</script>

<script type="text/javascript" src="<?=$g4['path']?>/js/common.js"></script>
<script type="text/javascript" src="<?=$g4['path']?>/js/sideview.js"></script>
<script type="text/javascript" src="<?=$g4['path']?>/zm.extend/js/common.js"></script>
<script type="text/javascript">
var save_layer = null;
function layer_view(link_id, menu_id, opt, x, y)
{
    var link = document.getElementById(link_id);
    var menu = document.getElementById(menu_id);

    //for (i in link) { document.write(i + '<br/>'); } return;

    if (save_layer != null)
    {
        save_layer.style.display = "none";
        selectBoxVisible();
    }

    if (link_id == '')
        return;

    if (opt == 'hide')
    {
        menu.style.display = 'none';
        selectBoxVisible();
    }
    else
    {
        x = parseInt(x);
        y = parseInt(y);
        menu.style.left = get_left_pos(link) + x + 'px';
        menu.style.top  = get_top_pos(link) + link.offsetHeight + y + 'px';
        menu.style.display = 'block';
    }

    save_layer = menu;
}
</script>

<link rel="stylesheet" href="<?=$g4['admin_path']?>/admin.style.css" type="text/css">
<link rel="stylesheet" href="<?=$g4['admin_path']?>/admin.head.style.css" type="text/css">
<style>
aside		{ width:200px; float:left; border-right:1px solid #E7E7E7; margin-right:5px; }
div#wrap	{ float:left; width:1010px; padding:10px; }
footer		{ clear:both; }

.cssbtn		{ height:35px; border:0px solid; background-color:#4E566E; margin:0 5px 1px 5px; letter-spacing:-1px; cursor:pointer; font-weight:700; }
.cssbtn1	{ color:#DDDFE3; }		/* 기본환경, 회원, 게시판 */
.cssbtn2	{ color:#FFFFFF; }		/* 지음빌더 */
.cssbtn_bg	{ background:#3A4053; }	/* 선택 된 메뉴 배경 */

#csshelp1	{ border:0px; background:#FFFFFF; padding:6px; }		/* 도움말 풍선 */
#csshelp2	{ border:1px solid #6A8BAB; border-radius:4px; padding:0px; }
#csshelp3	{ background:#EEF4F9; padding:3px 10px 10px 10px; border-radius:4px; width:300px; color:#39648F; line-height:120%; text-align:left; font-family:나눔고딕; }

#admtitle	{ color:#3A4052; font-weight:bold; font-size:1.12em; text-align:center; margin:2px; padding:5px; }
a			{ cursor:hand; }

.line		{ margin:0; padding:0; border-top:1px solid #E3E3E3; border-bottom:1px solid #fff; }

/* 현재 선택 된 메뉴 그룹 */
.currentmenu	{ background:#79A4CF; }
.currentmenuc	{ color:#ffffff; }

/* 지음빌더 메뉴 */
.zmb		{ font-weight:bold; }

/* 목록 타이틀 */
.listtitle .listtitle_txt	{ padding-left:4px; font-size:14px; font-family:Gullim; }
</style>

<body>
<? 
//-- 현재 페이지가 포함 된 메뉴의 키 값을 구함
foreach($menu as $k=>$v){
	for($j = 1; $j < count($menu[$k]); $j++) {
		if(strpos($menu[$k][$j][2], $_SERVER[PHP_SELF])) {
			$menukey	= $k;
			$menurow	= $j;
		}
	}
}
unset($k);
unset($v);

foreach($menu as $key=>$val){
	foreach($menu[$key] as $k=>$v){
		$auth_menu[$menu[$key][$k][0]] = $menu[$key][$k][1];
	}
}


//-- 탑 메뉴 -- 
ksort($menu);
?>
<nav>
<div class="menu_left"><a href='<?=$g4['path']?>/adm'><img src='<?=$g4['admin_path']?>/img/txt_admin.gif' border=0></a></div><div class="menu_center">
	<div id='topmenugroup'>
	<ul id='mgroup'>
<?	foreach($menu as $k=>$v) :
		if($menukey == $k)	$crrt_bg	= "currentmenu";
		else				$crrt_bg	= "currentmenuc";
		if($k >= "menu400")	$css_zmb	= "zmb";
		else				$css_zmb	= "";
?>
		<li class='<?=$crrt_bg?>'><a href=""><span class="<?=$css_zmb?>"><?=$menu[$k][0][1]?></span></a>
<?		if($menu[$k][1][1]) : //-- 서브 메뉴가 있다면 ?>
			<ul>
<?			for($j = 1; $j < count($menu[$k]); $j++) :		//-- 서브 메뉴
				if($is_admin == "super" || $auth[$menu[$k][$j][0]]) :
					if($menu[$k][$j][0] == "-") : ?>
						<li><div class="submenuline1"></div></li>
<?					else : ?>
						<li><a href="<?=$menu[$k][$j][2]?>"><?=$menu[$k][$j][1]?></a></li>
<?					endif; 
				endif; ?>
<?			endfor; ?>
			</ul>
<?		endif; ?>
		</li>
<?	endforeach; ?>
	</ul>
	</div>
</div><div class="menu_right">
	<a href='<?=$g4['path']?>/' title="HOME"><img src='<?=$g4['admin_path']?>/img/home.gif' border=0></a>
	<a href='<?=$g4['bbs_path']?>/logout.php' title="Logout"><img src='<?=$g4['admin_path']?>/img/logout.gif' border=0></a>
</div> <!-- end menu_right -->
</nav>

<a name='gnuboard4_admin_head'></a>
<aside>
<?	if(($sub_menu == "300100") || ($bo_table)) {
		//-- 게시판 목록 전체 불러오기
		include_once("zm.board_all_list.php");
	}else{		//-- 좌측 서브 메뉴 ?>
		<div class="subtitle"><?=($menu[$menukey][$menurow][1])?$menu[$menukey][$menurow][1]:"관리페이지"?></div>
<?		for($i = 1; $i < count($menu[$menukey]); $i++) :
			if($menu[$menukey][$i][0] == "-") : ?>
				<div class="submenuline"></div>
<?			else : ?>
				<div class="submenu <?=($menu[$menukey][$menurow][1] == $menu[$menukey][$i][1])?"submenu_crrt":""?>" onclick="zm_gourl('<?=$menu[$menukey][$i][2]?>')"><?=$menu[$menukey][$i][1]?></div>
<?			endif;
		endfor;
	}
	if(!$sub_menu) include_once("zm.main_left.php"); ?>
</aside>
<div id="wrap">
<!-- 내용 시작 -->