<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 
?>
<style>
body	{ background:#fff; }
#title	{ font-weight:700; background:#E7E7E7; height:35px; }
#title span	{ display:inline-block; width:45%; padding-top:5px; }
#tomail	{ border-bottom:1px solid #C3C3C3; padding:4px; }
#tomail span	{ color:#008000; }

.item	{ display:inline-block; float:left; font-weight:700; width:20%; }
.noitem	{ display:inline-block; width:80%; }
.field_rec	{ clear:both; margin:3px 0 3px 0; padding:3px; border-bottom:1px solid #e7e7e7; }
</style>

<div id="title">
	<span>&nbsp;<?=$g4[title]?></span>
	<span style="text-align:right;"><a href="#" onclick="window.close();"><img src="<?=$member_skin_path?>/img/btn_close.gif"></a></span>
</div>
<div id="tomail">
	<span><?=$name?></span>님께 메일보내기
</div>

<form name="fformmail" method="post" onsubmit="return fformmail_submit(this);" enctype="multipart/form-data" style="margin:0px;">
<input type="hidden" name="to"     value="<?=$email?>">
<input type="hidden" name="attach" value="2">
<input type="hidden" name="token"  value="<?=$token?>">
<? if ($is_member) { // 회원이면 ?>
	<input type='hidden' name='fnick'  value='<?=$member[mb_nick]?>'>
    <input type='hidden' name='fmail'  value='<?=$member[mb_email]?>'>
<? } else { ?>
<div class="field_rec">
	<span class="item">이름</span>
	<span class="noitem"><input type=text style='width:97%;' name='fnick' required minlength=2 itemname='이름'></span>
</div>
<div class="field_rec">
	<span class="item">E-mail</span>
    <span class="noitem"><input type=text style='width:97%;' name='fmail' required email itemname='E-mail'></span>
</div>
<? } ?>
<div class="field_rec">
	<span class="item">제목</span>
	<span class="noitem"><input type=text style='width:97%;' name='subject' required itemname='제목'></span>
</div>
<div class="field_rec">
	<span class="item">선택</span>
	<span class="noitem"><input type='radio' name='type' value='0' checked> TEXT <input type='radio' name='type' value='1' > HTML <input type='radio' name='type' value='2' > TEXT+HTML</span>
</div>
<div class="field_rec">
	<span><textarea name="content" style='width:97%;' rows='9' required itemname='내용'></textarea></span>
</div>
<div class="field_rec">
	<span class="item">파일</span>
    <span class="noitem"><input type=file style='width:97%;' name='file1'></span>
</div>
<div class="field_rec">
	<span class="item"><img id='kcaptcha_image' /></span>
    <span class="noitem"><input class='ed' type=input size=10 name=wr_key itemname="자동등록방지" required>&nbsp;&nbsp;왼쪽의 글자를 입력</span>
</div>
<div class="field_rec" style="text-align:center;">
    <input id=btn_submit type=image src="<?=$member_skin_path?>/img/btn_mail_send.gif" border=0>
</div>
</form>

<script type="text/javascript" src="<?="$g4[path]/js/md5.js"?>"></script>
<script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script>
<script type="text/javascript">
with (document.fformmail) {
    if (typeof fname != "undefined")
        fname.focus();
    else if (typeof subject != "undefined")
        subject.focus();
}

function fformmail_submit(f)
{
    if (!check_kcaptcha(f.wr_key)) {
        return false;
    }

    if (f.file1.value || f.file2.value) {
        // 4.00.11
        if (!confirm("첨부파일의 용량이 큰경우 전송시간이 오래 걸립니다.\n\n메일보내기가 완료되기 전에 창을 닫거나 새로고침 하지 마십시오."))
            return false;
    }

    document.getElementById('btn_submit').disabled = true;

    f.action = "./formmail_send.php";
    return true;
}
</script>
