<!--#include virtual="/content/board/nnupload/create.asp"-->
<%

If b_num = "" then		'//일반등록

	w_mode = "W"

	If b_type = "" then b_type = "N"		'//값이 있으면 답변타입이다..
	If b_type = "N" then b_content = a_writecontent

'	If a_close="Y" Then
'		b_open = "N"
'	else
		b_open = "Y"
'	End if
	b_noticechk = "N"

elseIf b_num <> "" And b_type = "R" then	'//답변글쓰기 일때

	w_mode = "WR"

	'//레코드필드
	R_Fields = "b_num, b_subject, b_content, b_ref, b_step, b_level, b_open"

	R_tablename_str = a_tablename

	R_WHERE_str = " WHERE b_num=" & b_num

	Call SelectQuery ( R_Fields, R_tablename_str, R_WHERE_str )

	b_subject = "RE:" & b_subject

	If a_edit = "Y" then
		b_content = "<br /><br /><br /><br />------------------ 원문 -------------------------<br /><br />" & b_content
	Else
		b_content = vbcrlf & vbcrlf & vbcrlf & vbcrlf & "------------------ 원문 -------------------------" & vbcrlf & vbcrlf & b_content
	End if

	b_open = b_open

		
ElseIf b_num <> "" then		'//그냥 수정일때..
	
	w_mode = "M"

	If is_ad_cms <> "Y" then	'//관리자가아닐때 체크

		If SESSION("pwd_chk_" & a_num & "_" & b_num) <> "ok" then	'//체크통과했으면..
			
			Call locationhref("pwd.asp?prepage=modi&a_num=" & a_num & "&b_num=" & b_num & "&" & page_info)

		End if

	End if

	

	'//레코드필드
	R_Fields = "b_num, b_type, b_id, b_name, b_pwd, b_subject, b_email, b_jumin, b_phone1, b_phone2, b_phone3, b_cate, b_catename, b_noticechk, b_content, b_ip, b_count, b_look, b_open, b_ref, b_step, b_level, b_regdate, b_chuchun, b_sbjclr, b_sdate, b_edate, b_temp1, b_temp2, b_temp3, b_temp4,b_temp5, b_temp6, b_temp7, b_keyword, b_zip1, b_zip2, b_addr1, b_addr2"

	' 첨부파일
	If Not IsNumeric(a_upload_len) Then a_upload_len = 5
	For u=1 To a_upload_len
		R_Fields = R_Fields & ", b_file"&u			'' b_file1, b_file2, b_file3, ‥‥
	Next
	
	R_tablename_str = a_tablename

	R_WHERE_str = " WHERE b_num=" & b_num

	Call SelectQuery (R_Fields, R_tablename_str, R_WHERE_str)
	
End if

prepage = Request.ServerVariables("path_info") & "?" & Request.ServerVariables("query_string")
%>
<!--#include virtual="/content/board/top.asp"-->

	<div>
	
	<script type="text/javascript">//<![CDATA[
		var xed;
		
		function w_chk(){
			
			if (CheckSpaces(document.getElementById('frm').b_name, '이름')) {return false;}
			else if (CheckSpaces(document.getElementById('frm').b_pwd, '비밀번호')) {return false;}

			else if (CheckSpaces(document.getElementById('frm').b_subject, '제목')) {return false;}

			<%If a_cate = "Y" and b_type <> "R" then '//분류%>
			else if (CheckSpaces(document.getElementById('frm').b_cate_tot, '분류')) {return false;}
			<%end if%>



			//loading_st(1);
			UploadClick();
			return false;

		}

		function delete_ok(z){
			if(confirm("첨부파일을 삭제하시겠습니까?")){
				location.href="/content/board/img_delete_ok.asp?a_num=<%=a_num%>&b_num=<%=b_num%>&b_file="+z+"&prepage=<%=server.URLEncode(prepage)%>";
			}else{
				return;
			}
		}
	//]]>
	</script>
	</div>

<!-- 쓰기 -->
<div id="board" style="width:<%=a_width%>;">
	
	<form id="frm" method="post" action="write.asp?a_num=<%=a_num%>&amp;<%=replace( page_info, "&","&amp;")%>&proc_mode=write_ok" enctype="multipart/form-data" onsubmit="return w_chk();">
	<div>
	<input type="hidden" name="b_num" value="<%=b_num%>" /><!-- (수정일때사용) -->
	<input type="hidden" name="b_type" value="<%=b_type%>" />
	<input type="hidden" name="w_mode" value="<%=w_mode%>" />
	<%If a_type = "N" Or a_type="T" then	'//공개여부%>
	<input type="hidden" name="b_open" value="Y" />
	<%End if%>

	<input type="hidden" name="b_ref" value="<%=b_ref%>" />
	<input type="hidden" name="b_step" value="<%=b_step%>" />
	<input type="hidden" name="b_level" value="<%=b_level%>" />

	<%If is_ad_cms = "Y" then '//관리자일때 비밀번호 자동으로%>
	<input type="hidden" name="b_pwd" value="<%=b_pwd%>" />
	<%End if%>
	</div>


	<div class="guide">
		<span><img src="/content/board/nninc_simple/img/ic_vcheck.gif" width="7" height="10" alt="*" /> 표시가 된 곳은 필수 항목입니다.</span>
	</div>

	<!-- 쓰기 테이블 -->
	<div class="table_bwrite">

			<table cellspacing="0" >
			<caption><%=replace( tit_name, " | ", "")%></caption>
				<colgroup>
				<col width="130" />
				<col width="" />
				</colgroup>
			<thead>
				<tr>
					<th scope="col" class="th_end" colspan="2">글쓰기</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<th scope="row"><label for="b_name"><img height="10" width="7" alt="*" src="/content/board/nninc_simple/img/ic_vcheck.gif"/> 이름</label></th>
					<td><input type="text" size="20" id="b_name" name="b_name" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_name%>" maxlength="30" <%=readonly%> /> <span class="text1">* 한글만 사용하실 수 있습니다. </span></td>
				</tr>

				<%If is_ad_cms <> "Y" then	'//관리자일때 비밀번호 자동으로%>
				<tr>
					<th scope="row"><label for="b_pwd"><img height="10" width="7" alt="*" src="/content/board/nninc_simple/img/ic_vcheck.gif"/> 비밀번호</label></th>
					<td><input type="password" size="22" id="b_pwd" name="b_pwd" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_pwd%>" maxlength="30"  /> <span class="text1">* 10자 이내의 영문/숫자만 사용하실 수 있습니다. </span></td>
				</tr>
				<%End if%>

				<%If a_type = "Y" then	'//공개/비공개%>
				<tr>
					<th scope="row">공개여부</th>
					<td>
						<input type="radio" id="b_open_Y" name="b_open" value="Y" <%=chkRadio(b_open, "Y")%>  /><label for="b_open_Y">공개</label>
						<input type="radio" id="b_open_N" name="b_open" value="N" <%=chkRadio(b_open, "N")%>  /><label for="b_open_N">비공개</label>
					</td>
				</tr>
				<%End if%>

				<%If a_phone = "Y" then '//전화번호%>
				<tr>
					<th scope="row"><label for="b_phone1">연락처</label></th>
					<td><input type="text" size="4" title="연락처 첫번째" id="b_phone1" name="b_phone1" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_phone1%>" maxlength="4"  /> - <input type="text" size="4" title="연락처 두번째" id="b_phone2" name="b_phone2" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_phone2%>"  maxlength="4"  /> - <input type="text" size="4" title="연락처 세번째" id="b_phone3" name="b_phone3" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_phone3%>"  maxlength="4"  /></td>
				</tr>
				<%End if%>

				<%If a_email = "Y" then	'//이메일%>
				<tr>
					<th scope="row"><label for="b_email">이메일</label></th>
					<td><input type="text" size="50" id="b_email" name="b_email" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_email%>" maxlength="200"  /> <span class="text1">* <strong>@</strong>포함한 이메일주소를 입력하세요.</span></td>
				</tr>
				<%End if%>

				

				
				
				<%If is_ad_cms = "Y" And b_type <> "R" then	'//공지여부%>
				<tr>
					<th scope="row">공지여부</th>
					<td>
						<input type="radio" id="b_noticechk_Y" name="b_noticechk" value="Y" <%=chkRadio(b_noticechk, "Y")%> /><label for="b_noticechk_Y">사용</label>
						<input type="radio" id="b_noticechk_N" name="b_noticechk" value="" <%=chkRadio(b_noticechk, "N")%> /><label for="b_noticechk_N">사용안함</label>
					</td>
				</tr>
				<%End if%>

				<%If a_cate = "Y" and b_type <> "R" then '//분류%>
				<tr>
					<th scope="row"><label for="b_cate_tot"><img height="10" width="7" alt="*" src="/content/board/nninc_simple/img/ic_vcheck.gif"/> 분류</label></th>
					<td>
						<select  name="b_cate_tot" >
							<option value="" selected="selected" >분류선택</option>
							<%
							'//분류 부분
							R_Fields_code = "ct_idx, ct_code, ct_name, ct_ref, ct_depth, ct_chk, ct_wdate, ct_codeno, ct_file, a_num"
							Select Case a_num
								Case "91134381", "85563030", "85125042", "49892315", "44876323", "71879802"
									SQL = "Select " & R_Fields_code & " FROM board_code WHERE ct_chk = 'Y' AND a_num='71074505'  ORDER BY ct_code ASC"
								Case else
									SQL = "Select " & R_Fields_code & " FROM board_code WHERE ct_chk = 'Y' AND a_num='" & a_num & "'  ORDER BY ct_code ASC"
							End Select
							Set rs_code = dbcon.execute( sql )
							
							If Not( rs_code.bof Or rs_code.eof ) then
								Do Until rs_code.eof
									ct_idx		= rs_code("ct_idx")
									ct_name		= rs_code("ct_name")
							%>

								<option value="<%=ct_idx%>,<%=ct_name%>" <%=chkSelect(ct_idx, b_cate)%>><%=ct_name%></option>

							<%
									rs_code.movenext
								loop
							End if
							Set rs_code = nothing
							%>
						</select>
					</td>
				</tr>
				<%End if%>

				<!-- 주소 -->
				<%If a_home = "Y" then		'//주소사용시%>
				<tr>
					<th scope="row"><label for="b_zip1">주소</label></th>
					<td>
					
						<div id="Addr_search1">

							<input type="button" value="우편번호찾기" class="ct_bt01" onclick="document.getElementById('Addr_search1').style.display='none';document.getElementById('Addr_search2').style.display='block';document.getElementById('frm').ZC_SG.focus();" />

							<input type="text" size="4" title="우편번호 첫번째 3자리" id="b_zip1" name="b_zip1" class="input_box"  value="<%=b_zip1%>"  />
							- 
							<input type="text" size="4" title="우편번호 두번째 3자리" id="b_zip2" name="b_zip2" class="input_box"  value="<%=b_zip2%>"  />

							<div class="pt3">
							<input type="text" size="20" title="주소" id="b_addr1" name="b_addr1" class="input_box" value="<%=b_addr1%>"  />
							<input type="text" size="55" title="상세주소" id="b_addr2" name="b_addr2" class="input_box" value="<%=b_addr2%>" maxlength="100"  /><br />
							</div>

						</div>



						
						<!-- 우편번호 찾기 부분 -->
						<div id="Addr_search2" class="disnone" >
							<div class="post_write"><label for="ZC_SG">동이름</label> :
								<input type="text" id="ZC_SG" name="ZC_SG" size="10" class="input_box" onkeydown="if(event.keyCode==13) wdSearch_Addr();" value=""  />
								<input type="button" value=" 검색 " class="post_btn" onclick="wdSearch_Addr()"  />
								<input type="button" value=" 취소 " class="post_btn" onclick="document.getElementById('Addr_search1').style.display='block';document.getElementById('Addr_search2').style.display='none';"  /> 예)내당동, 수성구
							</div>
							<div class="post_search_wrap">
								<strong>↓ 기본 주소 </strong> - 동이름 검색 결과 목록입니다. 목록중 한개를 선택하세요.

								<!-- 우편번호 나열 -->
								<div id="Search_Form" class="post_search2"></div>

							</div>
						</div>



						<script type="text/javascript">
						<!--
						function wdSearch_Addr(){

							if(!document.getElementById("frm").ZC_SG.value) {

								alert("검색어를 적어주세요");
								document.getElementById("frm").ZC_SG.focus();

							}else{
								//document.getElementById("Search_Form").innerHTML= " <table valign='top'><tr><td>찾는 중입니다!!!</td></tr><table> ";

								document.getElementById("frm_addr").ZC_SG.value = document.getElementById("frm").ZC_SG.value;

								document.getElementById("frm_addr").action = "/content/board/addr_search.asp";
								document.getElementById("frm_addr").target = "Search_Iframe";

								document.getElementById("Search_Form").innerHTML="<iframe name='Search_Iframe' width='100%' height='100%' frameborder='0'></iframe>";

								document.getElementById("frm_addr").submit();
							}
						}

						//-->
						</script>
					</td>
				</tr>
				<%End if%>
				



				<%
				'//사용자필드
				for z=1 To 4
					a_ftemp		= eval("a_ftemp" & z )
					a_ftemp_str	= eval("a_ftemp" & z & "_str")
					b_temp		= eval("b_temp" & z )

					If a_ftemp = "Y" then
				%>
				<tr>
					<th scope="row"><label for="b_temp<%=z%>"><%=a_ftemp_str%></label></th>
					<td><input type="text" size="50" id="b_temp<%=z%>" name="b_temp<%=z%>" class="board_input" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_temp%>" /></td>
				</tr>

				<%
					End if
				next
				%>

				<tr>
					<th scope="row"><label for="b_subject"><img height="10" width="7" alt="*" src="/content/board/nninc_simple/img/ic_vcheck.gif"/> 제목</label></th>
					<td><input type="text" size="100" id="b_subject" name="b_subject" class="board_input subject" onfocus="focus_on1(this);" onblur="focus_off1(this);" value="<%=b_subject%>" maxlength="200"  /></td>
				</tr>


				<tr>
					<td colspan="2" class="content">
						
						<%If a_edit = "Y" then	'//에디터가 사용일때

							'//$_SESSION["fck_filepath"] = "/userfiles/";			//첨부파일경로
							'//$_SESSION["fck_filepath"] = "/data/popup/";			//첨부파일경로
							session("fck_filepath") = "/data/board/"& a_tablename & "/"	'업로드 경로(동적경로를 위해 세션사용)
							'response.write session("fck_filepath")
							Set oFCKeditor = New FCKeditor
							oFCKeditor.BasePath = "/fckeditor/"
							oFCKeditor.value = b_content
							oFCKeditor.ToolbarSet = "Basic"
							oFCKeditor.Create "b_content"


						Else
						%>
						<textarea cols="50" rows="15" id="b_content" name="b_content" title="게시글 내용 입력" style="width:98%;" onfocus="focus_on1(this);" onblur="focus_off1(this);" ><%=b_content%></textarea>
						<%End if%>
					</td>
				</tr>


				<%
				If a_upload = "Y" then	'//첨부파일 사용일때
				%>
				<tr>
					<th scope="row">첨부파일</th>
					<td>
				<%
					file_cnt = 0
					for z=1 to a_upload_len
						b_file_name = eval("b_file" & z)
				%>
						<input type="hidden" name="b_file<%=z%>" id="b_file<%=z%>" value="<%=b_file_name%>" />

				<%
						If b_file_name <> "" then
							file_cnt = file_cnt + 1
				%>
							<%=b_file_name%> <a href="#delete" onclick="delete_ok(<%=z%>);" onkeyup="delete_ok(<%=z%>);"><img src="/content/board/<%=a_level%>/img/dr_del_bt.gif" alt="첨부파일 삭제하기" /></a><br />
				<%
						End if
					next
				%>
				<%
					'nn_basePath 하위에 Upload 폴더와 nn_uploadPath에 지정될 폴더는 인터넷게스트계정는 또는 Users 계정에 수정/쓰기 권한이 있어야 합니다.

					nn_basePath = "/content/board/nnupload/"	'nn업로드가 설치된 경로
					nn_paramFilter = "." & Replace(a_nofile,",","|.")	'"|.jpg|.zip|.txt|.xls"		'업로드 허용 파일
					nn_paramMaxFileSize = a_nofilesize						'업로드 용량(MB)
					nn_paramMaxFileNumber = a_upload_len - file_cnt			'업로드 개수
					nn_width = "100%"							'가로크기
					nn_height = "150px"							'세로크기
					nn_uploadPath = "/data/board/" & a_tablename & "/"			'업로드할 경로
					nn_key = Application("nn_key")		'키
					%>
					<script type="text/javascript">
						var filenames = "";

						function UploadClick() {
							try{
								nnupload.content.UploadFile.StartUpload();
								document.getElementById("submitbtn").disabled = true;
							}catch(e){
								document.getElementById('frm').submit();	//글등록
							}
						}

						function AbortUploadNotFile() {
							//alert("업로드 할 파일 없습니다.");
							document.getElementById('frm').submit();	//글등록
						}

						function getFileName(){
							var b_file, filenames_arr;
							filenames_arr = filenames.split("|");

							for(z=0;z<=filenames_arr.length-1;z++){

								for(i=1;i<=<%=a_upload_len%>;i++){
									b_file = document.getElementById("b_file"+i);
									if(b_file.value == ""){			//비어있는 b_file값에만 저장한다.
										b_file.value = filenames_arr[z];
										break;
									}
								}

							}

							filenames = "";
							document.getElementById('frm').submit();	//글등록

							//alert("업로드 완료");
							//Initialize();	//초기화
						}

					</script>
					<%
					If CInt(a_upload_len) > file_cnt then
						createUpload()
					End if
				
				%>
				</td>
			</tr>
			<%
			End if
			%>
			</tbody>
			</table>
	
	</div>
	<!-- //쓰기 테이블 -->

	<!-- 버튼 -->
	<div class="board_button2">
		<span><input id="submitbtn" type="image" src="/content/board/nninc_simple/img/save_bt.gif" alt="저장" /></span>
		<span><a href="list.asp?a_num=<%=a_num%>&amp;<%=replace( page_info, "&", "&amp;" )%>" ><img src="/content/board/nninc_simple/img/list_bt.gif" width="62" height="23" alt="목록" /></a></span>
	</div>
	<!-- //버튼 -->

	</form>

	<%If a_home = "Y" then	'//주소사용시%>
	<form id= "frm_addr" method='post'>
		<div>
			<input type="hidden" name="ZC_SG" />
		</div>
	</form>
	<%End if%>

</div>
<!-- //쓰기 -->
<!--#include virtual="/content/board/bottom.asp"-->