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

<table width='100%' cellpadding='0' cellspacing='0' border='0'>
	<tr><td height='25' colspan='3' bgcolor='#F6F6F6'>
		<table width='100%' cellpadding='0' cellspacing='0' border='0'>
			<tr>
				<td class='small'><span style='vertical-align:-5px;'>&nbsp;<b>ㆍ</b>접속자 : <?=connect('basic')?></span></td>
				<td width='10'></td>
				<td class='small' align='right'><span style='vertical-align:-5px;'>&nbsp;<?=visit('basic')?></span>&nbsp;</td>
			</tr>
		</table>
		</td></tr>
	<tr><td height='1' colspan='3' bgcolor='#DDDDDD'></td></tr>
	<tr height='50'>
		<td><a href='<?=$g4[path]?>'><img src='<?=$sub_skin_path?>/img/logo_sub.gif' alt='Onuri' border='0'></a></td>
		<td align='right'>
		<table cellspacing='0' cellpadding='0' border='0'>
		<form name='fsearchbox' method='get' action='javascript:fsearchbox_submit(document.fsearchbox);'>
		<script type='text/javascript'>
			function fsearchbox_submit(f)
			{
				if (f.stx.value == '')
				{
					alert('검색어를 입력하세요.');
					f.stx.select();
					f.stx.focus();
					return;
				}
					/*
				// 검색에 많은 부하가 걸리는 경우 이 주석을 제거하세요.
				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;
				}
				*/
					f.action = '<?=$g4[bbs_path]?>/search.php';
					f.submit();
				}
			</script>
			<tr>
				<input type='hidden' name='sfl' value='wr_subject||wr_content'>
				<input type='hidden' name='sop' value='and'>
				<td>
					<select id='gr_id' name='gr_id' class=select>
					<option value=''>통합검색</option>
					<?
					if($config[cf_home_ex_search_use] == 1) $home_ex_search = $config[cf_home_ex_search];
					else $home_ex_search = "''";

					$excgr = "(".$home_ex_search.")";
					$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_10, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0' and a.gr_id not in " . $excgr . " ORDER BY a.gr_admin";
					$result = sql_query($sql);
					for ($i=0; $row=sql_fetch_array($result); $i++){
					?>
					<option value='<?=$row['gr_id']?>'><?=$row['gr_subject']?></option>
					<?}?>
					</select>
				</td>
				<td width='5'></td>
				<td><INPUT name='stx' maxlength='100' style='width:150px;height:21;' tabIndex=1 class=ed trim value='<?=$stx?>'></td>
				<td width='5'></td>
				<td width='28' align='right'><INPUT type=image src='<?=$sub_skin_path?>/img/btn_search.gif' border='0'></td></tr>
				<tr><td></td></tr></form>
		</table>
		</td>
	</tr>
</table>
<table width='100%'' cellpadding='0' cellspacing='0' border='0'>
		<tr height='40'>
			<td width='10'><img src='<?=$sub_skin_path?>/img/menubar_left_cyan.gif' alt=''></td>
			<td background='<?=$sub_skin_path?>/img/menubar_bg_cyan.gif'>
			<table width='100%' height='40' cellpadding='0' cellspacing='0' border='0'>
				<tr>
					<td valign="bottom">					
						<?if($gr_id||$bo_table){

						if($config[cf_home_ex_sub_use] == 1) $home_ex_sub = $config[cf_home_ex_sub];
						else $home_ex_sub = "''";
						
						$excgr = "(".$home_ex_sub.")";

						$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_10, b.mb_id FROM $g4[group_table] AS a LEFT JOIN $g4[group_member_table] AS b ON a.gr_id = b.gr_id WHERE (b.mb_id = '$member[mb_id]' AND a.gr_use_access = '1' ) OR a.gr_use_access = '0' and a.gr_id not in " . $excgr . " ORDER BY a.gr_1";

						$result = sql_query($sql);
						?>
						<table height='30' cellpadding='0' cellspacing='0' border='0'>
							<tr>
							<?
							for ($i=0; $row=sql_fetch_array($result); $i++){
							$gLink = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/'.'group.php?gr_id=' .$row['gr_id'];//그룹링크
							
							if($row['gr_id'] == $gr_id){
							echo "<td width='6' background='$sub_skin_path/img/bar_l.gif'></td><td background='$sub_skin_path/img/bar_bg.gif' style='padding: 3 8 0 8;' style='cursor:pointer;' onclick=location.href='".$gLink."'><span class='text1'>".$row['gr_subject']."</span></td><td width='5' background='$sub_skin_path/img/bar_r.gif'></td>";
							}else{
							echo "<td width='10'></td><td><a href='".$gLink."'><span class='text2'>".$row['gr_subject']."</span></a></td><td width='10'></td>";
							}
						}?>
						</tr></table>
						<?}else{echo "<table height='30' cellpadding='0' cellspacing='0' border='0'>							<tr><td width='6' background='$sub_skin_path/img/bar_l.gif'></td><td background='$sub_skin_path/img/bar_bg.gif' style='padding: 3 8 0 8;'><span class='text1'>$home_name</span></td><td width='5' background='$sub_skin_path/img/bar_r.gif'></td><td style='padding: 0 8 0 8;' class='text2'></td></tr></table>";}?>						
					</td><font color='#f2f2f2'></font>
				</tr>
			</table>
			</td>
			<td width='10'><img src='<?=$sub_skin_path?>/img/menubar_right_cyan.gif' alt=''></td>
		</tr>
		<tr height='33'>
			<td width='10'><img src='<?=$sub_skin_path?>/img/menubar_sub_left.gif' alt=''></td>
			<td background='<?=$sub_skin_path?>/img/menubar_sub_bg.gif' class='small'>
			<?
			if($config[cf_home_ex_board_use] == 1) $home_ex_board = $config[cf_home_ex_board];
			else $home_ex_board = "''";
			
			$excgr = "(".$home_ex_board.")";
			$sql = " select * from $g4[board_table] where gr_id = '$gr_id' and bo_list_level <= '$member[mb_level]' and bo_table not in " . $excgr . "order by bo_table "; 
			$result = sql_query($sql); 
			$sub_cnt = mysql_num_rows($result) - 1;
			?>
			<table cellpadding='0' cellspacing='0' border='0'>
				<tr>
					<td width="5"></td>
					<td>
					<?for ($i=0; $row=sql_fetch_array($result); $i++) { 
						if($row[bo_table] == $bo_table) 
							$sub_menu = "<span style='color:#f0761c;font-weight:bold;'>".$row[bo_subject]."</span>";
						else
							$sub_menu = $row[bo_subject];

						if($i < ($sub_cnt)){
							$img = "<td align='center' style='padding: 0 3 3 3;'><img src='".$sub_skin_path."/img/menubar_sub_bar.gif'></td>";
						}else{
							$img ="";
						};
						
						echo "<td style='padding: 0 5 3 5;'><a href='".$g4[path]."/bbs/board.php?bo_table=".$row[bo_table]."'>".$sub_menu."</a></td>".$img."";
						
					}?>
					</td>
				</tr>
			</table>
			</td>
			<td width='10'><img src='<?=$sub_skin_path?>/img/menubar_sub_right.gif' alt=''></td></tr></table>