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

$url = '';
if ($g4['https_url']) {
    if (preg_match("/^\./", $urlencode))
        $url = $g4[url];
    else
        $url = $g4[url].$urlencode;
} else {
    $url = $urlencode;
}

// 아이디 자동저장
$ck_id_save = get_cookie("ck_id_save");

if ($ck_id_save) {
	$ch_id_save_chk = "checked";
	$ck_id_save = "{$ck_id_save}";
} else {
	$ck_id_save = "아이디";
}
$table_width = 190;//테이블 크기
$home_name = get_text($config[cf_home_name]);
?>
<script type="text/javascript" language=JavaScript>
// 엠파스 로긴 참고
var bReset = true;
function chkReset(f) 
{
    if (bReset) { if ( f.mb_id.value == '아이디' ) f.mb_id.value = ''; bReset = false; }
    document.getElementById("pw1").style.display = "none";
    document.getElementById("pw2").style.display = "";
}
</script>

<!-- 로그인 전 외부로그인 시작 -->
<form name="fhead" method="post" action="javascript:fhead_submit(document.fhead);" autocomplete="off" style="margin:0">
<input type="hidden" name="url" value="<?=$url?>">
<table width="<?=$table_width?>" border="0" cellspacing="0" cellpadding="0">
	<tr height="5">
		<td width="5"><img src="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_1.gif"></td>
		<td width="100%" background="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_2.gif"></td>
		<td width="5"><img src="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_3.gif"></td>
	</tr>
	<tr>
		<td background="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_4.gif"></td>
		<td>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr height="20"><td colspan="2">&nbsp;&nbsp;<strong><span style="color:#555555;"><?=$home_name?></span></strong><span style="color:#aaaaaa" class="small">&nbsp;LOGIN</span></td></tr>
			<tr>
				<td>&nbsp;&nbsp;<input name="mb_id" type="text" class=outlogin maxlength="20" required itemname="아이디"  value='<?=$ck_id_save?>' onMouseOver='chkReset(this.form);' onFocus='chkReset(this.form);' style="width:108px;height:19px;" tabIndex=3></td>
				<td class="small" rowspan="3"><input type="image" src="<?=$outlogin_skin_path?>/img/login_button.gif" tabIndex=5></td>
			</tr>
			<tr height="2"><td></td></tr>
			<tr>
				<td id="pw1">&nbsp;&nbsp;<input type="text" class=outlogin maxlength="20" required itemname="패스워드" value='비밀번호' onMouseOver='chkReset(this.form);' onfocus='chkReset(this.form);' style="width:108px;height:19px;" tabIndex=4></td>
				<td id=pw2 style='display:none;'>&nbsp;&nbsp;<input name="mb_password" type="password" class=outlogin maxlength="20" itemname="패스워드" onMouseOver='chkReset(this.form);' onfocus='chkReset(this.form);' style="width:108px;height:19px;" tabIndex=4></td>
			</tr>
			<tr height="25">
				<td colspan="2" class="small">&nbsp;&nbsp;<input type='checkbox' id='id_save' name='id_save' <?=$ch_id_save_chk?>><span class="lo_id_save">ID저장&nbsp;&nbsp;<input type="checkbox" name="auto_login" value="1" onclick="if (this.checked) { if (confirm('자동로그인을 사용하시면 다음부터 회원아이디와 패스워드를 입력하실 필요가 없습니다.\n\n\공공장소에서는 개인정보가 유출될 수 있으니 사용을 자제하여 주십시오.\n\n자동로그인을 사용하시겠습니까?')) { this.checked = true; } else { this.checked = false; } }">자동로그인</td>
			</tr>
			<tr height="1"><td colspan="2"></td></tr>
			<tr>
				<td colspan="2" align="center">
				<table width="95%" height="22" border="0" cellspacing="0" cellpadding="0" bgcolor="#f5f5f5">
					<tr><td width="8"></td><td class="small"><span style='vertical-align:-3px;'><a href="<?=$g4[bbs_path]?>/register.php" style="color:#f0761c; font-weight:bold;">회원가입</a>&nbsp;<a href="javascript:win_password_forget();">아이디/비밀번호 찾기</a></span></td></tr></table>
				</td>
			</tr>
			<tr height="2">
				<td colspan="2"></td>
			</tr>
		</table>
		</td>
		<td background="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_5.gif"></td>
	</tr>
	<tr height="5">
		<td width="5"><img src="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_6.gif"></td>
		<td width="100%" background="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_7.gif"></td>
		<td width="5"><img src="<?=$outlogin_skin_path?>/img/<?=$outlogin_color?>_8.gif"></td>
	</tr>
	<tr>
</table>
</form>
<script language="JavaScript">
function fhead_submit(f)
{
    if (!f.mb_id.value)
    {
        alert("회원아이디를 입력하십시오.");
        f.mb_id.focus();
        return;
    }

    if (document.getElementById('pw2').style.display!='none' && !f.mb_password.value)
    {
        alert("패스워드를 입력하십시오.");
        f.mb_password.focus();
        return;
    }

    <?
    if ($g4[https_url])
        echo "f.action = '$g4[https_url]/$g4[bbs]/login_check.php';";
    else
        echo "f.action = '$g4[bbs_path]/login_check.php';";
    ?>
    f.submit();
}
</script>
<!-- 로그인 전 외부로그인 끝 -->
