<?php if (!defined('_GNUBOARD_')) exit;
add_stylesheet('<link rel="stylesheet" href="../../../plugins/font-awesome/css/font-awesome.min.css" type="text/css" media="screen">',0);
add_stylesheet('<link rel="stylesheet" href="../../../plugins/sky-forms/version-2.0.5/css/sky-forms.css" type="text/css" media="screen">',0);
add_stylesheet('<link rel="stylesheet" href="../../../css_mo/style_mo.css" type="text/css" media="screen">',0);
add_stylesheet('<link rel="stylesheet" href="../../../css_mo/custom_mo.css" type="text/css" media="screen">',0);
?>

<div class="formmail">
	<div class="headline"><h5><i class="fa fa-send"></i> {_name}님께 메일보내기</h5></div>
    <div class="formmail-box margin-top-20">
		<!-- 메일 쓰기 시작 -->
	    <form name="fformmail" action="./formmail_send.php" onsubmit="return fformmail_submit(this);" method="post" enctype="multipart/form-data" class="sky-form">
	    <input type="hidden" name="to" value="{_email}">
	    <input type="hidden" name="attach" value="2">
	    <input type="hidden" name="token" value="{_token}">
		<!--{? _is_member}-->
	    <input type="hidden" name="fnick" value="{member.mb_nick}">
	    <input type="hidden" name="fmail" value="{member.mb_email}">
	    <!--{/}-->

		<!--{? !_is_member}-->
        <section>
            <label for="fnick" class="label">이름<strong class="sound_only">필수</strong></label>
            <label class="input">
                <i class="icon-append fa fa-user"></i>
                <input type="text" name="fnick" id="fnick" required>
            </label>
        </section>
        <section>
            <label for="fmail" class="label">E-mail<strong class="sound_only">필수</strong></label>
            <label class="input">
                <i class="icon-append fa fa-envelope-o"></i>
                <input type="text" name="fmail"  id="fmail" required>
            </label>
        </section>
		<div class="margin-hr-10"></div>
        <!--{/}-->
        <section>
            <label for="subject" class="label">제목<strong class="sound_only">필수</strong></label>
            <label class="input">
            	<i class="icon-append fa fa-tag"></i>
            	<input type="text" name="subject" id="subject" required>
            </label>
		</section>
		<section>
			<label class="label">형식</label>
            <div class="inline-group">
                <label for="type_text" class="radio"><input type="radio" name="type" value="0" id="type_text" checked><i class="rounded-x"></i>TEXT</label>
                <label for="type_html" class="radio"><input type="radio" name="type" value="1" id="type_html"><i class="rounded-x"></i>HTML</label>
                <label for="type_both" class="radio"><input type="radio" name="type" value="2" id="type_both"><i class="rounded-x"></i>TEXT+HTML</label>
            </div>
		</section>
		<div class="margin-hr-10"></div>
        <section>
            <label for="content" class="label">내용<strong class="sound_only">필수</strong></label>
            <label class="textarea textarea-resizable">
            	<textarea name="content" id="content" required></textarea>
            </label>
        </section>
		<div class="margin-hr-10"></div>
        <section>
            <label for="file1" class="label">첨부파일 1</label>
            <label for="file1" class="input input-file">
                <div class="button bg-color-light"><input type="file" name="file1" id="file1" value="첨부파일1" onchange="this.parentNode.nextSibling.value = this.value">파일선택</div><input type="text" readonly>
            </label>
        </section>
		<div class="margin-hr-10"></div>
        <section>
            <label for="file2" class="label">첨부파일 2</label>
            <label for="file2" class="input input-file">
                <div class="button bg-color-light"><input type="file" name="file2" id="file2" value="첨부파일2" onchange="this.parentNode.nextSibling.value = this.value">파일선택</div><input type="text" readonly>
            </label>
        </section>
		<div class="margin-hr-10"></div>
        <section>
            <label class="label">자동등록방지</label>
            <div class="vc-captcha">{=captcha_html()}</div>
        </section>
        <div class="margin-bottom-20"></div>
	    <div class="t-center margin-bottom-20">
	        <input type="submit" value="메일발송" id="btn_submit" class="eb-button eb-button-red">
	        <button type="button" onclick="window.close();" class="eb-button eb-button-dark">창닫기</button>
	    </div>
	    </form>
		<!-- 메일 쓰기 끝 -->
    </div>
</div>

<style>
.formmail {padding:15px}
.formmail .formmail-box {border:1px solid #e5e5e5;padding:10px}
</style>

<script type="text/javascript" src="../../../plugins/sky-forms/version-2.0.5/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="../../../plugins/sky-forms/version-2.0.5/js/jquery.form.min.js"></script>
<script type="text/javascript" src="../../../js_mo/newwin_mo.js"></script>
<!--[if lt IE 9]>
	<script src="../../../plugins/sky-forms/version-2.0.5/js/sky-forms-ie8.js"></script>
<![endif]-->
<script>
with (document.fformmail) {
    if (typeof fname != "undefined")
        fname.focus();
    else if (typeof subject != "undefined")
        subject.focus();
}

function fformmail_submit(f)
{
    <?php echo chk_captcha_js();  ?>

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

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

    return true;
}
</script>