<?php

$title 		= $result['title'];
$title 		= htmlspecialchars($title);
$write_id 	= $result['write_id'];
$reg_date 	= $result['reg_date'];
$content   	= htmlentities($result['content']);

$content_txt = '<br /><br /><br /><br />';
$content_txt.= '-----------------------------------------------<br />';
$content_txt.= '--- 원글내용 ---<br /><br />';
$content_txt.= '제목: '.$title.'<br />';
$content_txt.= '작성자: '.$write_id.'<br />';
$content_txt.= '작성일자: '.$reg_date.'<br />';
$content_txt.= '내용: <br />';
$content_txt.= $content;


?>


<script src="/ckeditor/ckeditor.js"></script>

<?
$menu_code = '71';
require_once (APPPATH.'views/skin/admin/_content_comm.php');
?>

<form name="input_form" id="input_form" action="/admin/cs/cs_question_reply_add_proc" method="post">
<input type="hidden" name="idx" id="idx" value="<?=$idx?>">
<input type="hidden" id="search_type" name="search_type" value="<?=$search_type?>">
<input type="hidden" id="search_keyword" name="search_keyword" value="<?=$search_keyword?>">
<input type="hidden" id="page" name="page" value="<?=$page?>">
<input type="hidden" id="img_path" name="img_path">

<div class="common_table">
	<table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
	<tr>
		<th class="tb_tit18">제목</th>
		<td class="tb_tit01">
			<input type="text" name="title" id="title" class="input00" size="100" value="RE : <?=$title?>">
		</td>
	</tr>
	<tr>
		<th class="tb_tit18">문의내용</th>
		<td class="tb_tit01">
			<!-- <textarea id="content" name="content"><?=$content_txt?></textarea> -->
			<textarea name="content" id="ir1" style="width:100%; height:500px;" /><?=$content_txt?></textarea>
		</td>
	</tr>
	</tr>
</table>
<div class="write_btn tc">
	<a href="javascript:question_reply_add_proc();">저장하기</a>
	<a href="/admin/cs/cs_question_list/7/<?=$page?>?search_type=<?=$search_type?>&search_keyword=<?=$search_keyword?>">목록으로</a>
</div>
</form>

<script type="text/javascript">
var oEditors = [];
var oEditors2 = [];

$(function(){
      nhn.husky.EZCreator.createInIFrame({
          oAppRef: oEditors,
          elPlaceHolder: "ir1",
          sSkinURI: "/smarteditor/SmartEditor2Skin.html",  
          htParams : {
              bUseToolbar : true,             
              bUseVerticalResizer : true,     
              bUseModeChanger : true,         
              fOnBeforeUnload : function(){
              }
          }, 
          fOnAppLoad : function(){
          },
          fCreator: "createSEditor2"
      });
      
      nhn.husky.EZCreator.createInIFrame({
          oAppRef: oEditors2,
          elPlaceHolder: "ir2", 
          sSkinURI: "/smarteditor/SmartEditor2Skin.html",  
          htParams : {
              bUseToolbar : true,             
              bUseVerticalResizer : true,     
              bUseModeChanger : true,         
              fOnBeforeUnload : function(){
              }
          }, 
          fOnAppLoad : function(){
          },
          fCreator: "createSEditor2"
      });

});
</script>

<script type="text/javascript">
$(document).ready(function() {
    /*
	CKEDITOR.replace('content', {
        height: '400px'
    });
	*/
});

function question_reply_add_proc(){
	//CKEDITOR.instances.content.updateElement();
	oEditors.getById["ir1"].exec("UPDATE_CONTENTS_FIELD", []);
	//oEditors2.getById["ir2"].exec("UPDATE_CONTENTS_FIELD", []);

	if($("#title").val()=='') {
		alert("제목을 입력해주세요.");
		return false;
	}
	/*
	if($("#content").val()=='') {
		alert("내용을 입력해주세요.");
		return false;
	}
	*/
	if($("#ir1").val()=='' || $("#ir1").val()=='null' || $("#ir1").val()=='&nbsp;' || $("#ir1").val()=='<p>&nbsp;</p>') {
		alert("내용을 입력해주세요.");
		oEditors.getById["ir1"].exec("focus");
		return false;
	}

	$("#input_form").submit();

}

</script>