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

$begin_time = get_microtime();

include_once("$g4[path]/head.sub.php");

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

    $str = "<table width=140 cellpadding=1 cellspacing=0 id='menu_{$key}' style='position:absolute; display:none; z-index:1;' onpropertychange=\"selectBoxHidden('menu_{$key}')\"><colgroup><colgroup><colgroup width=10><tr><td rowspan=2 colspan=2 bgcolor=#7d7d7d><table width=137 cellpadding=0 cellspacing=0 bgcolor=#fafafa><colgroup style='padding-left:10px'>";
    $str .= print_menu2($key, $no);
    $str .= "</table></td><td></td></tr><tr><td bgcolor=#DDDAD5 height=40></td></tr><tr><td width=4></td><td height=3 width=137 bgcolor=#DDDAD5></td><td bgcolor=#DDDAD5></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}>";
            if ($no == 2)
                $str .= "<img src='{$g4[admin_path]}/img/jimin_img/icon1.jpg' align=absmiddle>&nbsp;&nbsp;";
            $str .= "<a href='{$menu[$key][$i][2]}' style='color:#838383;'>{$span1}{$menu[$key][$i][1]}{$span2}</a></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">
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>
.bg_menu1 { height:24px; 
            padding-left:15px; 
            padding-right:15px; } 
.bg_line1 { height:1px; background-color:#c7c7c7; } 

.bg_menu2 { height:22px; 
            padding-left:20px; } 
.bg_line2 { background-image:url('<?=$g4['admin_path']?>/img/jimin_img/sub_menu_line.jpg'); height:2px; } 
.dot {color:#D6D0C8;border-style:dotted;}

#csshelp1 { border:0px; background:#FFFFFF; padding:6px; }
#csshelp2 { border:2px solid #BDBEC6; padding:0px; }
#csshelp3 { background:#F9F9F9; padding:6px; width:200px; color:#222222; line-height:120%; text-align:left; }
</style>

<!-- 최상단 메뉴 시작 -->
<style type="text/css"> 
#se { height:24px;}
#se .menu { position:absolute; right:5px; top:0; padding:7px 0 0 0;  }
#se .menu .item { float:right; margin:0 5px 0 5px; font-size:8pt; }
#se .menu .item a { font:normal 11px dotum; letter-spacing:-1px; color:#9ca7b9; }
#se .menu .item a:hover { color:#ff6600; }
#se .menu .btn { float:right; margin:-4px 5px 0 5px; font-size:8pt; z-index:5; }
#se table { margin:0 auto 0 auto; padding:0; }
#se .se_item {  float:left;  }
#se .se_item .img { border:0; }
</style>
<!-- 최상단 메뉴 끝 -->

<body leftmargin=0 topmargin=0>
<a name='gnuboard4_admin_head'></a>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<colgroup width=180>
<colgroup>
  <tr>
    <td height="79" background="<?=$g4['admin_path']?>/img/jimin_img/top_bg.jpg"><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="24">
        <div id="se">
    <div class="menu">
        <div class="item"><a href="<?=$g4[path]?>/" target="_blank">사용자메인</a></div>
   		<div class="item"><a href='<?=$g4['admin_path']?>' class="top1">관리자메인</a></div>   
  </div>
</div>        
        </td>
      </tr>
      <tr>
        <td height="51"><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="176" onMouseOver="layer_view('','','','','')" align="center"><a href='<?=$g4['admin_path']?>/'><img src='<?=$g4['admin_path']?>/img/jimin_img/logo.png' border=0></a></td>
            <td style="padding-top:4px;">
            <?
        foreach($amenu as $key=>$value)
        {
            $href1 = $href2 = "";
            if ($menu["menu{$key}"][0][2])
            {
                $href1 = "<a href='".$menu["menu{$key}"][0][2]."'>";
                $href2 = "</a>";
            }
            echo "{$href1}<img src='$g4[admin_path]/img/jimin_img/menu{$key}.jpg' border=0 id='id_menu{$key}' onmouseover=\"layer_view('id_menu{$key}', 'menu_menu{$key}', 'view', -1, 8);\">{$href2}&nbsp;<img src='$g4[admin_path]/img/jimin_img/menu_line.jpg'> ";
            echo print_menu1("menu{$key}", 1);
        }
        ?>
            </td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td height="4"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="63" background="<?=$g4['admin_path']?>/img/jimin_img/top_bg1.jpg">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"></td>
    <td align="right">
    </td>
  </tr>
</table>

    </td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="175" bgcolor="#fafafa" valign="top"><table width="175" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="51" align="center" onMouseOver="layer_view('','','','','')"><a href='<?=$g4['path']?>/'><img src='<?=$g4['admin_path']?>/img/jimin_img/home.jpg' border=0></a><a href='<?=$g4['bbs_path']?>/logout.php'><img src='<?=$g4['admin_path']?>/img/jimin_img/logout.jpg' border=0></td>
          </tr>
          <tr>
            <td height="1" bgcolor="#e9e9e9"></td>
          </tr>
          <tr>
            <td>
            </td>
          </tr>
          <tr>
            <td>
			<?
        if (isset($sub_menu))
            $tmp_menu = substr($sub_menu, 0, 3);
        echo "<tr><td><img src='$g4[admin_path]/img/jimin_img/title_menu{$tmp_menu}.jpg'></td></tr><tr><td height='20'></td></tr>";
        echo print_menu2("menu{$tmp_menu}", 2);
        ?>
        </td>
          </tr>
          <tr><td height="100"></td></tr>
        </table></td>
        <td width="1" bgcolor="#7d7d7d"></td>
        <td onMouseOver="layer_view('','','','','')" valign=top style='padding:12px;'><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td align="right"><img src='<?=$g4['admin_path']?>/img/jimin_img/icon2.jpg' align=absmiddle> 
        &nbsp;<a href='<?=$g4['admin_path']?>/'><font color="#222222">Admin</font></a> > 
        <? 
        $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]." > ";
        }
        ?>
        <?=$g4['title']?> <span class=small>: <?=$member['mb_id']?>님</span>&nbsp;&nbsp;</td>
          </tr>
          <tr>
            <td height="5"></td>
          </tr>
          <tr>
            <td><img src="<?=$g4['admin_path']?>/img/jimin_img/main_title.jpg"></td>
          </tr>
          <tr>
            <td height="8"></td>
          </tr>
          <tr>
            <td height="1" bgcolor="#c7c7c7"></td>
          </tr>
          <tr><td height="20"></td></tr>
          <tr><td>