<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
?>
<table width='100%' cellpadding='0' cellspacing='0' border='0'>
	<tr height='10'><td></td></tr>
	<tr height='45'><td align='center'><a href='<?=$g4[path]?>'><img src='<?=$main_skin_path?>/img/logo_02.gif' alt='Onuri' border='0'></a></td></tr>
	<tr><td>
		<table width='100%' cellpadding='0' cellspacing='0' border='0'>
			<tr height='100'>
				<td width='15'><img src='<?=$main_skin_path?>/img/search/left_02.gif' alt=''></td>
				<td background='<?=$main_skin_path?>/img/search/bg_02.gif' align='center' valign='top'>
				<table width='100%' cellspacing='0' cellpadding='0' border='0'>
					<tr>
						<td width='10'></td>
						<td width='150' align='center'></td>
						<td align='center'>
						<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 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_1";
								$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:320px;height:21;' tabIndex=1 class=input_02 trim value="<?=$text_stx?>"></td>
							<td width='5'></td>
							<td width='28' align='right'><input type=image src='<?=$main_skin_path?>/img/search/btn_search_02.gif' tabindex=3 style='width:55px;height:25px' title='검색' onmouseover=this.src='<?=$main_skin_path?>/img/search/btn_search2_02.gif' onmouseout=this.src='<?=$main_skin_path?>/img/search/btn_search_02.gif' onmousedown=this.src='<?=$main_skin_path?>/img/search/btn_search3_02.gif' alt='검색' onfocus='this.blur();'></span>
							</td></tr>
							</form>
						</table>
						</td>
						<td width='150' align='center'></td>
						<td width='10'></td>
					</tr>
					<tr height="5"><td colspan="4"></td></tr>
					<tr height='2'><td colspan='5' background='<?=$main_skin_path?>/img/search/line_02.gif'></td></tr>
					<tr>
						<td width='10'></td>
						<td align='center' colspan='3'>
						<table cellpadding='0' cellspacing='0' border='0' style='padding: 9 0 0 0 ;'>
							<tr>
								<?
								if($config[cf_home_ex_main_use] == 1) $home_ex_main = $config[cf_home_ex_main];
								else $home_ex_main = "''";

								$excgr = "(".$home_ex_main.")";
								$sql = " SELECT a.gr_id, a.gr_subject, a.gr_use_access, a.gr_9, 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);
								for ($i=0; $row=sql_fetch_array($result); $i++){

								$gr_name = ($row['gr_id'] == $gr_id)?"<span style=''>" .$row['gr_subject']."</span>":"<span style=''>" .$row['gr_subject']."</span>";//그룹제목
								$gr_target = (!empty($row['gr_9']))?$row['gr_9']:"_self";
								$gr_link = (!empty($row['gr_10']))?$row['gr_10']:$g4['bbs_path'].'/'.'group.php?gr_id=' .$row['gr_id'];//그룹링크 - 별도링크 필요하면 gr_10 필드에 전체 url 입력
								echo "<td><a href='" . $gr_link . "' style='color:#FFFFFF;' class='quick_link_02' target='".$gr_target."'>" . $gr_name . "</a></font></td><td><img src='$main_skin_path/img/search/_bar_02.gif' alt='' width='2' height='12'></td>"; // 그룹명 출력
								}
								?><td><a href='<?=$g4[bbs_path]?>/board.php?bo_table=01_3' style='color:#ffffff;' class='quick_link_02'>배너등록</a></td>
							</tr>
						</table>
						</td>
						<td width='10'></td>
					</tr>
					<tr height='12'><td colspan='5'></td></tr>
					<tr>
						<td colspan='5'>
						<table width='100%' cellpadding='0' cellspacing='0' border='0'>
							<tr><td width='42'><span style='color:#000000;vertical-align:0px;font-weight:bold;'>공지 :</span></td><td><?=latest('notice', '01_1', 1, 74)?></td>
							<td><?include_once("$g4[path]/rank_.php");?></td></tr></table>							
						</td>
					</tr>
				</table>
				</td>
				<td width='15'><img src='<?=$main_skin_path?>/img/search/right_02.gif' alt=''></td>
			</tr>
		</table>
		</td>
	</tr><tr height='5'><td></td></tr>
</table>