<?
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");

function print_menu1($key, $no)
{
    global $menu;

    $str = "
	<table cellpadding=1 cellspacing=0 id='menu_{$key}' style='position:absolute; display:none; z-index:1;' onpropertychange=\"selectBoxHidden('menu_{$key}')\">
	<tr>
		<td bgcolor=#848484>
		<table width=130 cellpadding=0 cellspacing=0 bgcolor=#FBFBFB>
		<colgroup style='padding-left:10px'>";
    $str .= print_menu2($key, $no);
    $str .= "</table>
		</td>
	</tr>
	</table>\n";

    return $str;
}


function print_menu2($key, $no)
{
    global $menu, $auth_menu, $is_admin, $auth, $g4;

    $str = "";
    for($i=1; $i<count($menu[$key]); $i++) {
        if ($is_admin != "super" && (!array_key_exists($menu[$key][$i][0],$auth) || !strstr($auth[$menu[$key][$i][0]], "r")))
            continue;

        if ($menu[$key][$i][0] == "-")
            $str .= "<tr><td class=bg_line{$no}></td></tr>";
        else  {
            $span1 = $span2 = "";
            if (isset($menu[$key][$i][3])) {
                $span1 = "<span style='{$menu[$key][$i][3]}'>";
                $span2 = "</span>";
            }
			$str .= "<tr><td class=bg_menu{$no} onMouseOver='this.style.backgroundColor=\"#6A829E\"; this.style.color=\"#fff\"' onMouseOut='this.style.backgroundColor=\"\"; this.style.color=\"\"' onClick='document.location.href=\"{$menu[$key][$i][2]}\"'>";
            $str .= "{$span1}{$menu[$key][$i][1]}{$span2}</td></tr>";
            $auth_menu[$menu[$key][$i][0]] = $menu[$key][$i][1];
        }
    }

    return $str;
}
?>

<script type="text/javascript">
if (!g4_is_ie) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
var prevdiv = null;
var timerID = null;

function getMouseXY(e) 
{
    if (g4_is_ie) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX + document.body.scrollLeft;
        tempY = event.clientY + document.body.scrollTop;
    } else {  // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }  

    if (tempX < 0) {tempX = 0;}
    if (tempY < 0) {tempY = 0;}  

    return true;
}

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">
<style>
a			{ font-family:Dotum; }
.bg_menu1	{ height:25px;	padding-left:5px;	padding-right:5px; color:#5E5E5E; cursor:pointer; font-family:Dotum; letter-spacing:-1px; font-size:11px; } 
.bg_line1	{ height:1px;	background-color:#E3E3E3; } 
.bg_menu2	{ height:25px;	padding-left:15px; color:#75787F; font-family:Dotum; letter-spacing:-1px; font-size:11px; cursor:pointer; }				/* 페이지 왼쪽 메뉴 */
.bg_line2	{ padding:0; border-top:1px solid #E3E3E3; border-bottom:1px solid #fff; } 

.dot		{ color:#D6D0C8; border-style:dotted; }
.admtitle	{ color:#D2D4DA; text-align:center; font-weight:bold;  }
.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:2px solid #7489A6; padding:0px; }
#csshelp3	{ background:#EAF2FA; padding:6px; width:300px; color:#222222; line-height:120%; text-align:left; }

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

.zm_cfg_btn_off	{ border:1px solid #91AED0; background-color:#FFFFFF; font-weight:bold; height:25px; cursor:hand; padding:2px 10px 0 10px; margin:0 0 0 0; cursor:pointer; }
.zm_cfg_btn_on	{ border:1px solid #91AED0; background-color:#91AED0; font-weight:bold; height:25px; cursor:hand; padding:2px 10px 0 10px; margin:0 0 0 0; color:#ffffff; cursor:pointer; }

.brdmsg		{ padding:5px; color:#616161; border:1px solid #DFDFDF; background-color:#F7F7F7; }
.area_left	{ background:#F0F2F8; border-right:2px solid #CECED8; } /* 왼쪽 메뉴 영역 */
.line		{ margin:0; padding:0; border-top:1px solid #E3E3E3; border-bottom:1px solid #fff; }
</style>

<body leftmargin=0 topmargin=0>
<a name='gnuboard4_admin_head'></a>
<table width="100%" cellpadding=0 cellspacing=0 border=0>
<tr bgcolor=#4E566E height=30>
    <td width="180" class="admtitle"><a onClick="document.location.href='<?=$g4['admin_path']?>/'"><img src="<?=$adm_path?>/img/txt_admin.gif"></a></td>
    <td>
<?		foreach($amenu as $key=>$value) {
            $href1 = $href2 = "";
            if ($menu["menu{$key}"][0][2]) {
                $href1 = "<a href='".$menu["menu{$key}"][0][2]."'>";
                $href2 = "</a>";

            }
			if("menu{$key}" > "menu300")	$s_css	= "cssbtn cssbtn2"; else $s_css = "cssbtn cssbtn1";
			if(substr($sub_menu, 0, 3) == $key) $s_css_bg	= "cssbtn_bg"; else $s_css_bg = "";

            echo "<input type='button' id='id_menu{$key}' value='".$menu["menu{$key}"][0][1]."' onmouseover=\"layer_view('id_menu{$key}', 'menu_menu{$key}', 'view', 10, 0);\" class='".$s_css." ".$s_css_bg."'>";
            echo print_menu1("menu{$key}", 1);
        }
?>
	</td>
	<td width="200">
		<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>
    </td>
</tr>
</table>
<table width="100%" cellpadding=0 cellspacing=0 border=0>
<colgroup width=180>
<colgroup>
<tr onmouseover="layer_view('','','','','')">
    <td class="area_left"><div id="admtitle"></div><div class="line"></div></td>
    <td bgcolor="#F0F2F8" align=left>&nbsp;
<?  
		$tmp_menu = "";
        if (isset($sub_menu))
            $tmp_menu = substr($sub_menu, 0, 3);
        if (isset($menu["menu{$tmp_menu}"][0][1])) {
            if ($menu["menu{$tmp_menu}"][0][2]) {
                echo "<a href='".$menu["menu{$tmp_menu}"][0][2]."'>";
                echo $menu["menu{$tmp_menu}"][0][1];
                echo "</a> > ";
            } else
                echo $menu["menu{$tmp_menu}"][0][1]." > ";
        }
		if($menu["menu{$tmp_menu}"][0][1])	$admintitle		= $menu["menu{$tmp_menu}"][0][1];
		else								$admintitle		= "관리자 메인";
?>
        <?=$g4['title']?></td>
</tr>
<script language="javascript">
$("#admtitle").html('<?=$admintitle?>');
</script>
<tr onmouseover="layer_view('','','','','')">
    <td class="area_left" valign=top>
        <table width=180 cellpadding=0 cellspacing=0>
<?		if(($sub_menu == "300100") || ($bo_table)) {
			//-- 게시판 목록 전체 불러오기
			include_once("zm.board_all_list.php");
		}else{
			echo print_menu2("menu{$tmp_menu}", 2);   
		}
		if(!$sub_menu) include_once("zm.main_left.php"); ?>
        </table>
    </td>
    <td valign=top style='padding:10px;'>
	<!-- 내용 시작 -->