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

//모바일 구분자
if(G5_IS_MOBILE) {
	$scope = '';
	$tr = '</tr><tr>';
	$colspan = '';
	$rowspan = '';
} else {
	$scope = ' scope="row" class="th-w"';
	$tr = '';
	$colspan = ' colspan=2';
	$rowspan = ' rowspan=2';
}

//헤드스킨
include($head_skin_path.'/head.skin.php');

?>

<table id="bo_w" border="1" class="frm_tbl">
<tbody>

<?php if ($is_name) { ?>
<tr>
	<th<?php echo $scope; ?>><label for="wr_name">이름</label></th>
	<?php echo $tr; ?>
	<td><input id="wr_name" type="text" maxlength="20" size="15" name="wr_name" itemname="이름" value="<?php echo $name; ?>" class="wr-m"></td>
</tr>
<?php } ?>

<?php if ($is_password) { ?>
<tr>
    <th<?php echo $scope; ?>><label for="wr_password">비밀번호</label></th>
	<?php echo $tr; ?>
    <td><input id="wr_password" type="password" maxlength="20" size="15" name="wr_password" itemname="비밀번호" class="wr-m"></td>
</tr>
<?php } ?>

<?php if ($is_email) { ?>
<tr>
    <th<?php echo $scope; ?>><label for="wr_email">이메일</label></th>
	<?php echo $tr; ?>
	<td><input id="wr_email" type="text" maxlength="100" size="50" name="wr_email" email itemname="이메일" value="<?php echo $email; ?>" class="wr-l"></td>
</tr>
<?php } ?>

<?php if ($is_homepage) { ?>
<tr>
    <th<?php echo $scope; ?>><label for="wr_homepage">홈페이지</label></th>
	<?php echo $tr; ?>
    <td><input id="wr_homepage" type="text" size="50" name="wr_homepage" itemname="홈페이지" value="<?php echo $homepage; ?>" class="wr-l"></td>
</tr>
<?php } ?>

<?php if ($option) { ?>
<tr>
    <th<?php echo $scope; ?>><label>글옵션</label></th>
	<?php echo $tr; ?>
    <td>
		<?php echo $option; ?><?php if ($is_secret && $is_secret !=1) echo ' (자동비밀글)'; ?>
	</td>
</tr>
<?php } ?>

<?php if ($is_category) { ?>
<tr>
    <th<?php echo $scope; ?>><label for="ca_name">카테고리</label></th>
	<?php echo $tr; ?>
    <td>
		<select id="ca_name" name="ca_name" itemname="분류">
			<option value="">선택하세요</option>
			<?php echo $category_option; ?>
		</select>
	</td>
</tr>
<?php } ?>

<?php if ($is_star) { ?>
<tr>
    <th<?php echo $scope; ?>><label>별점주기</label></th>
	<?php echo $tr; ?>
    <td>
		<input type="radio" id="star_score10" name="star_score" value="10"<?php if($star['score'] == "10" || !$star['score']) echo ' checked'; ?>>
		<label for="star_score10"><?php echo amina_star_mark($amina['star_color'],"10|1","s"); ?><span class="none">10점</span></label>

		<input type="radio" id="star_score8" name="star_score" value="8"<?php if($star['score'] == "8") echo ' checked'; ?>>
		<label for="star_score8"><?php echo amina_star_mark($amina['star_color'],"8|1","s"); ?><span class="none">8점</span></label>

		<input type="radio" id="star_score6" name="star_score" value="6"<?php if($star['score'] == "6") echo ' checked'; ?>>
		<label for="star_score6"><?php echo amina_star_mark($amina['star_color'],"6|1","s"); ?><span class="none">6점</span></label>

		<input type="radio" id="star_score4" name="star_score" value="4"<?php if($star['score'] == "4") echo ' checked'; ?>>
		<label for="star_score4"><?php echo amina_star_mark($amina['star_color'],"4|1","s"); ?><span class="none">4점</span></label>

		<input type="radio" id="star_score2" name="star_score" value="2"<?php if($star['score'] == "2") echo ' checked'; ?>>
		<label for="star_score2"><?php echo amina_star_mark($amina['star_color'],"2|1","s"); ?><span class="none">2점</span></label>
	</td>
</tr>
<?php } ?>

<?php if ($is_emoticon) { ?>
<tr>
    <th<?php echo $scope; ?>><label>이모티콘</label></th>
	<?php echo $tr; ?>
    <td>
		<a class="fbox-win" href="<?php echo AMINA_URL.'/tool.php?action=emo&bo_table='.$bo_table; ?>"><img id="emo_icon" name="emo_icon" src="<?php echo $emo_skin_url.'/'.$wr_icon['post_icon']; ?>.gif" alt="이모티콘" /></a>
		<input type="hidden" name="post_icon" value="<?php echo $wr_icon['post_icon']; ?>">
		<?php if($member['mb_id']) { ?>	
			<p><input type="checkbox" id="post_icon_mb" name="post_icon_mb" value="1"<?php if($wr_icon['post_icon_mb'] == "1") echo ' checked'; ?>> <label for="post_icon_mb">이모티콘 대신 회원사진 적용</label></p>
		<?php } ?>
		<div class="clear"></div>
	</td>
</tr>
<?php } ?>

<tr>
    <th<?php echo $scope; ?>>
		<label for="wr_subject">글제목
		<?php if($set['write_subj_icon']) { ?>
			<a class="fbox-win" href="<?php echo AMINA_URL.'/tool.php?action=scon&bo_table='.$bo_table; ?>"><span id="btn_subj_icon"><i class="fa fa-<?php echo $wr_post['subj_icon'] ? $wr_post['subj_icon'] : 'info-circle';?> fa-lg"></i></span></a>
			<input type="hidden" id="subj_icon" name="subj_icon" value="<?php echo $wr_post['subj_icon'];?>">
		<?php } ?>
		</label>
	</th>
	<?php echo $tr; ?>
    <td>
	<input type="text" name="wr_subject" size="50" id="wr_subject" itemname="제목" value="<?php echo $subject; ?>" class="wr-max">
	</td>
</tr>

<?php if ($is_admin) { ?>
<tr>
    <th<?php echo $scope; ?>><label>제목모양</label></th>
	<?php echo $tr; ?>
    <td>
		<input type="checkbox" id="subj_b" name="subj_b" value="1"<?php if($wr_post['subj_b'] == "1") echo ' checked'; ?>>
		<label for="subj_b">&lt;b></label>

		<input type="checkbox" id="subj_i" name="subj_i" value="1"<?php if($wr_post['subj_i'] == "1") echo ' checked'; ?>>
		<label for="subj_i">&lt;i></label>

		<input type="checkbox" id="subj_s" name="subj_s" value="1"<?php if($wr_post['subj_s'] == "1") echo ' checked'; ?>>
		<label for="subj_s">&lt;del></label>

		<script src="<?php echo AMINA_URL?>/app/iColorPicker/iColorPicker.js" type="text/javascript"></script>
		<input type="text" id="subj_color" name="subj_color" itemname="제목색상" value="<?php echo $wr_post['subj_color']; ?>" size="8" class="iColorPicker">
	</td>
</tr>
<?php } ?>

<tr>
    <td<?php echo $colspan; ?> class="wcontent">
        <div id="autosave_wrapper">
			<?php if ($set['write_emo_icon']) { ?>
				<a class="fbox-win" href="<?php echo AMINA_URL.'/tool.php?action=ticon&bo_table='.$bo_table; ?>" target="_blank"><span class="wr-icon"><i class="fa fa-meh-o fa-lg" ></i></span></a>
			<?php } ?>
			<?php if ($set['write_cont_icon']) { ?>
				<a class="fbox-win" href="<?php echo AMINA_URL.'/tool.php?action=icon&bo_table='.$bo_table; ?>" target="_blank"><span class="wr-icon"><i class="fa fa-info-circle fa-lg" ></i></span></a>
			<?php } ?>
			<?php if(!$editor_form) { ?>
				<?php if ($write_min || $write_max) { ?>
					<button type="button" class="wr-frm-btn">
						<b><span id="char_count"></span></b>자
						<?php 
							if ($write_min && $write_max) { 
								echo '('.$write_min.'/'.$write_max.')';
							} else if (!$write_min && $write_max) { 
								echo '(최대 '.$write_max.')';
							} else if ($write_min && !$write_max) { 
								echo '(최소 '.$write_min.')';
							}
						?>
					</button>
				<?php } ?>
				<a href="javascript:amina_textarea('wr_content', 'down');" title="창크기 늘이기"><span class="wr-icon"><i class="fa fa-chevron-circle-down fa-lg" ></i></span></a>
		        <a href="javascript:amina_textarea('wr_content', '150');" title="창크기 초기화"><span class="wr-icon"><i class="fa fa-minus-circle fa-lg"></i></span></a>
				<a href="javascript:amina_textarea('wr_content', 'up');"  title="창크기 줄이기"><span class="wr-icon"><i class="fa fa-chevron-circle-up fa-lg"></i></span></a>
			<?php } ?>
			<a class="fbox-win" href="<?php echo AMINA_URL; ?>/tool.php?action=help&bo_table=<?php echo $bo_table; ?>"><span class="wr-icon"><i class="fa fa-question-circle fa-lg" title="도움말 보기"></i></span></a>
			<?php if ($is_member && $set['write_autosave']) { // 임시 저장된 글 기능 
				$autosave_count = $autosave_count ? $autosave_count : autosave_count($member['mb_id']);
			?>
				<script src="<?php echo $write_skin_url; ?>/autosave.js"></script>
		        <span id="btn_autosave" class="wr-icon wr-cursor"><i class="fa fa-undo fa-lg"></i> 임시저장 (<span id="autosave_count"><?php echo $autosave_count; ?></span>)</span>
			    <div id="autosave_pop">
		            <div><b>임시저장 글 목록</b> <button type="button" class="autosave_close"><i class="fa fa-times-circle"></i></button></div>
			        <ul></ul>
		        </div>
            <?php } ?>
        </div>
		<?php if($editor_form) { ?>
            <?php echo $editor_form; ?>
		<?php } else { ?>
			<div class="wr_content_wrap">
				<textarea id="wr_content" name="wr_content" rows="10" itemname="내용" required 
		        <?php if ($write_min || $write_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?>><?php echo $content; ?></textarea>
			    <?php if ($write_min || $write_max) { ?><script> check_byte('wr_content', 'char_count'); </script><?php } ?>
			</div>
        <?php } ?>
	</td>
</tr>
<?php if ($set['write_ccl']) { ?>
	<tr>
		<th<?php echo $scope; ?>><label>CCL</label></th>
		<?php echo $tr; ?>
	    <td>
			<select id="ccl" name="post_ccl">
				<option value=""<?php if(!$wr_post['post_ccl']) echo ' selected'; ?>>표기안함</option>
				<option value="1"<?php if($wr_post['post_ccl'] == "1") echo ' selected'; ?>>저작자표시</option>
				<option value="2"<?php if($wr_post['post_ccl'] == "2") echo ' selected'; ?>>저작자표시-비영리</option>
				<option value="3"<?php if($wr_post['post_ccl'] == "3") echo ' selected'; ?>>저작자표시-변경금지</option>
				<option value="4"<?php if($wr_post['post_ccl'] == "4") echo ' selected'; ?>>저작자표시-동일조건변경허락</option>
				<option value="5"<?php if($wr_post['post_ccl'] == "5") echo ' selected'; ?>>저작자표시-비영리-동일조건변경허락</option>
				<option value="6"<?php if($wr_post['post_ccl'] == "6") echo ' selected'; ?>>저작자표시-비영리-변경금지</option>
			</select>
		</td>
	</tr>
<?php } ?>
<?php if ($set['write_linked']) { ?>
	<tr>
		<th<?php echo $scope; ?>><label>연동글</label></th>
		<?php echo $tr; ?>
	    <td>
			<a class="fbox-win" href="<?php echo AMINA_URL; ?>/search.wr.php?action=linked">
				<span class="wr-btn" id="wr_linked">연동하기</span>
			</a>
			<?php if ($set['write_linked_down']) { ?>
				&nbsp;
				<select id="po_wr_type" name="po_wr_type">
					<option value=""<?php if(!$wr_icon['po_wr_type']) echo ' selected'; ?>>연동글과 상관없이</option>
					<option value="both"<?php if($wr_icon['po_wr_type'] == "both") echo ' selected'; ?>>연동글 다운/열람 회원만</option>
					<option value="down"<?php if($wr_icon['po_wr_type'] == "down") echo ' selected'; ?>>연동글 다운 회원만</option>
					<option value="view"<?php if($wr_icon['po_wr_type'] == "view") echo ' selected'; ?>>연동글 열람 회원만</option>
				</select>
				다운로드 가능
			<?php } ?>
		</td>
	</tr>
<?php } ?>
<?php if ($is_po_view || $is_po_down || $is_choice) { ?>
	<tr>
		<th<?php echo $scope; ?>>
			<label>포인트</label>
		</th>
		<?php echo $tr; ?>
	    <td>
			<?php if ($is_po_view) { ?>
				<input type="text" size="6" name="po_view_point" id="po_view_point" numeric itemname="열람포인트" class="wr-t" value="<?php echo $wr_icon['po_view_point']; ?>">
				<label for="po_view_point">열람</label>
				&nbsp; &nbsp;
			<?php } ?>
			<?php if ($is_po_down) { ?>
				<input type="text" size="6" name="po_down_point" id="po_down_point" numeric itemname="다운포인트" class="wr-t" value="<?php echo $wr_icon['po_down_point']; ?>">
				<label for="po_down_point">다운</label>
				&nbsp; &nbsp;
			<?php } ?>
			<?php if ($is_choice) { ?>
				<input type="text" size="6" id="choice_point" name="choice_point" id="choice_point" numeric itemname="<?php echo $amina['cmt_choice_txt']; ?>포인트" value="<?php echo $wr_icon['choice_point']; ?>" class="wr-t" <?php if(!$is_admin && $w=="u") echo 'readonly style="background:pink;" title="수정불가"'; ?>>
				<label for="choice_point"><?php echo $amina['cmt_choice_txt']; ?></label>
				(최대 <b><?php echo number_format($member['mb_point']); ?></b>점 <?php if($amina['cmt_choice_return'] > 0) { ?> / <?php echo $amina['cmt_choice_txt']; ?>시 <b><?php echo $amina['cmt_choice_return']; ?></b>% 복구<?php } ?>)
			<?php } ?>
		</td>
	</tr>
<?php } ?>

<?php if ($set['write_summary']) { ?>
	<tr>
		<th<?php echo $scope; ?>><label for="wr_3">요약글</label></th>
		<?php echo $tr; ?>
	    <td>
			<?php if($wr_icon['po_img_cnt'] == "") $wr_icon['po_img_cnt'] = 1; ?>
			<label><input type="text" size="2" name="po_img_cnt" id="po_img_cnt" numeric itemname="요약 스샷" class="wr-t" value="<?php echo $wr_icon['po_img_cnt']; ?>"> 개 스샷</label>
			&nbsp;-&nbsp;
			글자수 <b><span id="po_summary">0</span></b>자 / 250자
			<p></p>
			<div class="wr_content_wrap">
				<textarea id="wr_3" name="wr_3" rows=3 itemname="요약글" placeholder="최근글, 목록, 열람글 등에서 나타날 안내글로 250자 이하로 입력하세요." onkeyup="check_byte('wr_3', 'po_summary');"><?php echo $write['wr_3']; ?></textarea>
			    <script> check_byte('wr_3', 'po_summary'); </script>
			</div>
		</td>
	</tr>
<?php } ?>

<?php if ($set['write_video']) { $movie = amina_array_video($write['wr_6']); ?>
<tr> 
	<th<?php echo $scope; ?>>
		<label for="movie_url">동영상</label><a href="javascript:amina_show('movie_opt');"><i class="fa fa-cog fa-lg" title="옵션설정"></i></a>
	</th>
	<?php echo $tr; ?>
	<td>
		<select id="movie_file" name="movie_file">
			<option value=""<?php if(!$movie['movie_file']) echo ' selected'; ?>>공유주소</option>
			<option value="1"<?php if($movie['movie_file'] == "1") echo ' selected'; ?>>파일주소</option>
		</select>
		<input type="text" size="35" id="movie_url" name="movie_url" itemname="동영상" placeholder="유튜브, 비메오 등 동영상 공유주소 또는 동영상 파일 URL 입력" value="<?php echo $movie['movie_url']; ?>" class="wr-l">

		<div id="movie_opt" style="padding-top:4px; display:<?php if($movie['movie_img'] || $movie['movie_align']) { echo 'block'; } else { echo 'none'; } ?>">
			<select id="movie_align" name="movie_align">
				<option value=""<?php if(!$movie['movie_align']) echo ' selected'; ?>>상단출력</option>
				<option value="1"<?php if($movie['movie_align'] == "1") echo ' selected'; ?>>하단출력</option>
			</select>
			<input type="text" size="35" id="movie_img" name="movie_img" itemname="동영상 썸네일 이미지 URL" value="<?php echo $movie['movie_img']; ?>" class="wr-l" placeholder="JWPlayer에서 사용할 썸네일 이미지파일 URL 입력">
			<p>
				<select id="movie_caption_use" name="movie_caption_use">
					<option value="">자막파일</option>
				</select>
				<input type="text" size="35" id="movie_caption" name="movie_caption" itemname="동영상 자막 URL" value="<?php echo $movie['movie_caption']; ?>" class="wr-l" placeholder="JWPlayer에서 사용할 자막파일 URL 입력">
			</p>
		</div>
	</td>
</tr>
<?php } ?>

<?php if ($is_file) { ?>
<tr>
    <th<?php echo $scope; ?><?php echo $rowspan?>>
		<label>파일첨부</label>
    </th>
	<?php echo $tr; ?>
	<td>
	<?php 
		if($is_uploader) {
			echo $is_uploader;
		} else {
			$upload_max = number_format(($board['bo_upload_size'] / 1024),0); 

			$file_script = "";
			$file_length = -1;
			// 수정의 경우 파일업로드 필드가 가변적으로 늘어나야 하고 삭제 표시도 해주어야 합니다.
			if ($w == "u") {
			    for ($i=0; $i<$file['count']; $i++) {
				    $row = sql_fetch(" select bf_file, bf_content from {$g5['board_file_table']} where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' ");
					if ($row['bf_file']) {
						$file_script .= "add_file(\"<p><label><input type='checkbox' name='bf_file_del[$i]' value='1'> {$file[$i][source]}({$file[$i][size]}) 파일 삭제</label></p>";
				        if ($is_file_content)
			                $file_script .= "<p><input type='text' size=50 class='wr-l' name='bf_content[$i]' value='".addslashes(get_text($row['bf_content']))."' title='업로드 이미지 파일에 해당 되는 내용을 입력하세요.'></p>";
					        $file_script .= "\");\n";
				        } else {
						    $file_script .= "add_file('');\n";
						}
				    }
					$file_length = $file['count'] - 1;
				}

				if ($file_length < 0) {
				    $file_script .= "add_file('');\n";
				    $file_length = 0;
				}
		?>
		<table id="variableFiles" border="1">
		<tr><td>
			<ul class="bar11">
				<li class="first"><a onclick="add_file();" class="wr-cursor"><i class="fa fa-plus-circle"></i> &nbsp;파일 추가</a></li>
				<li class="last"><a onclick="del_file();" class="wr-cursor"><i class="fa fa-minus-circle"></i> &nbsp;파일 삭제</a></li>
			</ul>		
		</td></tr>
		</table><?// print_r2($file); ?>
        <script>
        var flen = 0;
        function add_file(delete_code)
        {
            var upload_count = <?php echo (int)$board['bo_upload_count']; ?>;
            if (upload_count && flen >= upload_count)
            {
                alert("이 게시판은 "+upload_count+"개 까지만 파일 업로드가 가능합니다.");
                return;
            }

            var objTbl;
            var objRow;
            var objCell;
            if (document.getElementById)
                objTbl = document.getElementById("variableFiles");
            else
                objTbl = document.all['"variableFiles"'];

            objRow = objTbl.insertRow(objTbl.rows.length);
            objCell = objRow.insertCell(0);

            objCell.innerHTML = '<p><input type="file" class="wr-l" name="bf_file[]" title="파일 용량 <?php echo $upload_max?>KB 이하만 업로드 가능"></p>';
            if (delete_code)
                objCell.innerHTML += delete_code;
            else
            {
                <?php if ($is_file_content) { ?>
                objCell.innerHTML += '<p><input type="text" class="wr-l" name="bf_content[]" title="업로드 이미지 파일에 해당 되는 내용을 입력하세요."></p>';
                <?php } ?>
                ;
            }

            flen++;
        }

        <?php echo $file_script; //수정시에 필요한 스크립트 ?>

        function del_file()
        {
            // file_length 이하로는 필드가 삭제되지 않아야 합니다.
            var file_length = <?php echo (int)$file_length; ?>;
            var objTbl = document.getElementById("variableFiles");
            if (objTbl.rows.length - 2 > file_length)
            {
                objTbl.deleteRow(objTbl.rows.length - 1);
                flen--;
            }
        }
        </script>
		<?php } ?>
	</td>
</tr>
<tr>
    <td>
		<select id="img_location" name="img_location"<?php echo $is_uploader_script; ?>>
			<option value="top">사진 상단출력</option>
			<option value="bottom"<?php if($wr_post['img_location'] == "bottom") echo ' selected'; ?>>사진 하단출력</option>
			<option value="insert"<?php if($wr_post['img_location'] == "insert") echo ' selected'; ?>>사진 본문삽입</option>
			<option value="hide"<?php if($wr_post['img_location'] == "hide") echo ' selected'; ?>>사진 출력안함</option>
		</select>

		<span class="wr-nowrap">
			<input type="checkbox" id="img_except" name="img_except" value="1"<?php if($wr_post['img_except'] == "1") echo ' checked'; ?>>
			<label for="img_except">상ㆍ하단 첫사진 숨기기</label>
		</span>

		<span class="wr-nowrap">
			<input type="checkbox" id="img_space" name="img_space" value="1"<?php if($wr_post['img_space'] == "1") echo ' checked'; ?>>
			<label for="img_space">상ㆍ하단 사진 붙이기</label>
		</span>
	</td>
</tr>
<?php } ?>

<?php if ($is_link) { ?>
	<tr> 
		<th<?php echo $scope; ?>>
			<label>관련링크</label>
		</th>
		<?php echo $tr; ?>
		<td>
			<?php for ($i=1; $i <= G5_LINK_COUNT; $i++) { ?>
				<p><input type="text" size="50" id="wr_link<?php echo $i; ?>" name="wr_link<?php echo $i; ?>" itemname="링크 #<?php echo $i; ?>" value="<?php if($w=="u") echo $write['wr_link'.$i]; ?>" class="wr-max"></p>
			<?php } ?>
		</td> 
	</tr>
<?php } ?>

<?php if ($set['write_map']) { ?>
	<tr>
		<th<?php echo $scope; ?>>
			<label>구글지도</label>
		</th>
		<?php echo $tr; ?>
	    <td>
			<div class="left" style="margin-right:10px;">
				<a class="fbox-win" href="<?php echo AMINA_URL; ?>/tool.php?action=map">
					<span class="wr-btn">코드생성</span>
				</a>
			</div>
			<input type="text" size="30" id="map_code" name="map_code" value="" class="wr-l" placeholder="지도코드 생성후 복사해서 본문에 붙여넣기">
		</td>
	</tr>
<?php } ?>

<?php if ($is_poll) { ?> 
	<tr>
		<th<?php echo $scope; ?>>
			<label>설문조사</label>
		</th>
		<?php echo $tr; ?>
	    <td>
			<a class="fbox-win" href="<?php echo AMINA_URL; ?>/tool.php?action=poll&bo_table=<?php echo $bo_table; ?>">
				<span class="wr-btn"><?php echo $poll_btn; ?></span>
			</a>
			<span class="wr-nowrap">
				<input type="checkbox" id="chk_poll" name="chk_poll" value="poll"<?php if($wr_post['chk_poll'] == "poll") echo ' checked'; ?>>
				<label for="chk_poll">등록하기</label>
			</span>
			
			<input type="hidden" id="poll_subject" name="poll_subject" value="<?php echo $poll['poll_subject']; ?>">
			<input type="hidden" id="poll_y" name="poll_y" value="<?php echo date("Y", $poll['poll_enddate']); ?>">
			<input type="hidden" id="poll_m" name="poll_m" value="<?php echo date("m", $poll['poll_enddate']); ?>">
			<input type="hidden" id="poll_d" name="poll_d" value="<?php echo date("d", $poll['poll_enddate']); ?>">
			<input type="hidden" id="poll_h" name="poll_h" value="<?php echo date("H", $poll['poll_enddate']); ?>">
			<input type="hidden" id="poll_i" name="poll_i" value="<?php echo date("i", $poll['poll_enddate']); ?>">
			<input type="hidden" id="poll_level" name="poll_level" value="<?php echo $poll['poll_level']; ?>">
			<input type="hidden" id="poll_location" name="poll_location" value="<?php echo $wr_post['poll_location']; ?>">

			<?php $poll['poll_point'] = $poll['poll_point'] ? $poll['poll_point'] : $amina['poll_point']; ?>
			<input type="hidden" id="poll_point" name="poll_point" value="<?php echo $poll['poll_point']; ?>">
			<input type="hidden" id="poll_item1" name="poll_item1" value="<?php echo $poll['poll_item1']; ?>">
			<input type="hidden" id="poll_item2" name="poll_item2" value="<?php echo $poll['poll_item2']; ?>">
			<input type="hidden" id="poll_item3" name="poll_item3" value="<?php echo $poll['poll_item3']; ?>">
			<input type="hidden" id="poll_item4" name="poll_item4" value="<?php echo $poll['poll_item4']; ?>">
			<input type="hidden" id="poll_item5" name="poll_item5" value="<?php echo $poll['poll_item5']; ?>">
			<input type="hidden" id="poll_item6" name="poll_item6" value="<?php echo $poll['poll_item6']; ?>">
			<input type="hidden" id="poll_item7" name="poll_item7" value="<?php echo $poll['poll_item7']; ?>">
			<input type="hidden" id="poll_item8" name="poll_item8" value="<?php echo $poll['poll_item8']; ?>">
			<input type="hidden" id="poll_item9" name="poll_item9" value="<?php echo $poll['poll_item9']; ?>">
		</td>
	</tr>
<?php } ?>

<?php if ($set['write_daumview']) { ?>
	<tr> 
		<th<?php echo $scope; ?>>
			<label for="daum_view">다음뷰</label>
		</th>
		<?php echo $tr; ?>
		<td>
			<input type="text" size="35" id="daum_view" name="daum_view" itemname="다음 View nid" value="<?php echo $wr_post['daum_view']; ?>" class="wr-m">
			<span class="wr-nowrap">다음view의 주소 nid 값</span>
		</td>
	</tr>
<?php } ?>

<?php if ($is_tag) { //태그사용여부 체크 ?>
<tr>
    <th<?php echo $scope; ?>>
		<label for="related_tag">관련글</label>
	</th>
	<?php echo $tr; ?>
    <td>
		<?php if($w == "u" && $write['wr_7']) $rtag = amina_array_tag($write['wr_7']); ?>
		<input type="text" size="34" maxlength="100" id="related_tag" name="related_tag" itemname="관련글" value="<?php echo $rtag['related_tag']; ?>" class="wr-l">
		<span class="wr-nowrap">
			<input type="radio" id="tag_and" name="tag_sop" value="and"<?php if($rtag['tag_sop'] != "or") echo ' checked'; ?>>
			<label for="tag_and">일치</label>
			<input type="radio" id="tag_or" name="tag_sop" value="or"<?php if($rtag['tag_sop'] == "or") echo ' checked'; ?>>
			<label for="tag_or">포함</label>
		</span>
	</td>
</tr>
<tr>
    <th<?php echo $scope; ?>>
		<label for="tag">태그(tag)</label>
	</th>
	<?php echo $tr; ?>
    <td>
		<?php
			if($wr_post['chk_tag']) {
			    include_once(AMINA_PATH.'/lib/tag.lib.php');
				$tag = amina_get_tag($bo_table, $wr_id);
			}
		?>
		<input type="text" size="34" id="tag" name="tag" itemname="태그" value="<?php echo $tag; ?>" class="wr-l">
		<span class="wr-nowrap">
			<input type="checkbox" id="chk_tag" name="chk_tag" value="1"<?php if($wr_post['chk_tag'] == "1") echo ' checked'; ?>>
			<label for="chk_tag">등록하기</label>
		</span>
	</td>
</tr>
<?php } ?>

<?php if (!AMINA && $is_trackback) { ?>
<tr>
    <th<?php echo $scope; ?>>
		<label for="wr_trackback">트랙백</label>
	</th>
	<?php echo $tr; ?>
    <td><input type="text" size="50" id="wr_trackback" name="wr_trackback" itemname="트랙백" value="<?php echo $trackback; ?>" class="wr-l">
        <?php if ($w=="u") { ?><span class="wr-nowrap"><input type="checkbox" id="re_trackback" name="re_trackback" value="1"> <label for="re_trackback">핑 보냄</label></span><?php } ?>
	</td>
</tr>
<?php } ?>

<?php if($captcha_html) { ?>
	<tr>
	    <th<?php echo $scope; ?>>
			<label for="captcha_key">등록코드</label>
		</th>
		<?php echo $tr; ?>
		<td class="wr_cpatcha">
	        <?php echo $captcha_html; ?>
	    </td>
	</tr>
<?php } ?>
</tbody>
</table>

<script>
<?php
// 관리자라면 분류 선택에 '공지' 옵션을 추가함
if ($is_admin) {
    echo "
    if (typeof(document.fwrite.ca_name) != 'undefined')
    {
        document.fwrite.ca_name.options.length += 1;
        document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].value = '공지';
        document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].text = '공지';
    }";
} 
?>

with (document.fwrite) 
{
    if (typeof(wr_name) != "undefined")
        wr_name.focus();
    else if (typeof(wr_subject) != "undefined")
        wr_subject.focus();
    else if (typeof(wr_content) != "undefined")
        wr_content.focus();

    if (typeof(ca_name) != "undefined")
        if (w.value == "u")
            ca_name.value = "<?php echo $write[ca_name]?>";
}

function html_auto_br(obj) 
{
    if (obj.checked) {
        result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다.");
        if (result)
            obj.value = "html2";
        else
            obj.value = "html1";
    }
    else
        obj.value = "";
}

</script>