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

include_once("$g4[path]/head.sub.php");
include_once("$g4[path]/lib/outlogin.lib.php");
include_once("$g4[path]/lib/poll.lib.php");
include_once("$g4[path]/lib/visit.lib.php");
include_once("$g4[path]/lib/connect.lib.php");
include_once("$g4[path]/lib/popular.lib.php");

//print_r2(get_defined_constants());
?>

<!-- 상단 로고 시작 -->
<table width="950" cellspacing="0" cellpadding="0" border="0" align="center">
<tr height="10"><td></td></tr></table>
<table width="950" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td>
&nbsp;&nbsp;&nbsp;ㆍ<a href="javascript:bookmark()">즐겨찾기추가</a>
</td>
<td width="400" align="right">
						<table width='400' cellpadding='0' cellspacing='0' border='0' align='center'>
						<tr>
						<!-- 메인 상단 그룹 시작-->
						<?
								//접근가능그룹 여분필드 1 순서로 추출
								//조건외 제외시키고자 하는 그룹 수동으로 추가
								$excgr = "('00', '00', '00')"; // 00 , 00 , 00 그룹은 제외시킴
								$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++){

								$gSubject = ($row['gr_id'] == $gr_id)?"<span style=''>" .$row['gr_subject']."</span>":"<span style=''>" .$row['gr_subject']."</span>";//그룹제목
								$gLink = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/board.php?bo_table='.'' .$row['gr_id'];//그룹링크 - 별도링크 필요하면 gr_10 필드에 전체 url 입력
								echo "<td><a href='" . $gLink . "' style='color:#000000;'><b>" . $gSubject . "</b></a></font></td><td>&nbsp;<font color='000000'>|</font>&nbsp;</td>"; // 그룹명 출력
								}
								?></tr></table>

</td>
</tr>
</table>

<table width="950" cellspacing="0" cellpadding="0" border="0" align="center">
<tr height="10"><td></td></tr></table>
<!-- 상단 메뉴스킨 시작 -->
<table width="950" cellspacing="0" cellpadding="0" border="0" align="center">
<tr>
<td width="12" height="120">
<img src="<?=$head_menu_skin_path?>/img/left.gif">
</td>
<td background="<?=$head_menu_skin_path?>/img/bg.gif" width="926" height="120">
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
					

						<tr>
						<td width='10'></td>
					</tr>



					      <tr>
						<td width='10'></td>
						<td width='235' align='center'><a href='<?=$g4[path]?>'><img src='<?=$g4[path]?>/img/logo.gif' border='0'></a></td>
						<td align='center' width='440'>
        <div style='height:10px;'></div><?=popular("basic", 5); // 인기검색어 ?>
<div style='height:10px;'>
						<table cellspacing="0" border="0" cellpadding="0" cellspacing="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 height='10'><td></td></tr>
						<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 = "''";

								$text_stx = get_text(stripslashes($stx));
								$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='10'></td>
							<td><INPUT name='stx' maxlength='100' style='width:270px;height:21;' tabIndex=1 class=input_04 trim value="<?=$text_stx?>"></td>
							<td width='10'></td>
							<td width='28' align='right'><input type=image src='<?=$g4[path]?>/img/search/btn_search.gif' tabindex=3 style='width:55px;height:25px' title='검색' onmouseover=this.src='<?=$g4[path]?>/img/search/btn_search2.gif' onmouseout=this.src='<?=$g4[path]?>/img/search/btn_search.gif' onmousedown=this.src='<?=$g4[path]?>/img/search/btn_search3.gif' alt='검색' onfocus='this.blur();'></span>
							</td></tr>
							</form>
						</table>
</td><td width="150"></td>
</tr>
</table>

<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
&nbsp;&nbsp;<table width='400' cellpadding='0' cellspacing='0' border='0' align='center'>
						<tr>
						<!-- 메인 상단 그룹 시작-->
						<?
								//접근가능그룹 여분필드 1 순서로 추출
								//조건외 제외시키고자 하는 그룹 수동으로 추가
								$excgr = "('00', '00', '00')"; // 00 , 00 , 00 그룹은 제외시킴
								$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++){

								$gSubject = ($row['gr_id'] == $gr_id)?"<span style=''>" .$row['gr_subject']."</span>":"<span style=''>" .$row['gr_subject']."</span>";//그룹제목
								$gLink = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/board.php?bo_table='.'' .$row['gr_id'];//그룹링크 - 별도링크 필요하면 gr_10 필드에 전체 url 입력
								echo "<td><a href='" . $gLink . "' style='color:#000000;'><b>" . $gSubject . "</b></a></font></td><td>&nbsp;<font color='000000'>|</font>&nbsp;</td>"; // 그룹명 출력
								}
								?></tr></table>

</td>
</tr>
</table>
</td>
<td width="12">
<img src="<?=$head_menu_skin_path?>/img/right.gif">
</td>
</tr>
</table>
<!-- 상단 메뉴스킨 끝 -->
