<?php
$title      = '';
$content    = '';

if($mode=='edit') {
    $title      = $result['title'];
	$title 		= htmlspecialchars($title);
    $content    = $result['content'];
	$content   	= htmlentities($result['content']);
}


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



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

<form name="input_form" id="input_form" action="/admin/cs/cs_notice_reg_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="mode" name="mode" value="<?=$mode?>">
<input type="hidden" id="img_path" name="img_path">
	
	
	
	
	
    
<div class="common_table">
    <table>
	<tr>
		<th>제목</th>
		<td class="tl">
			<input type="text" name="title" id="title" class="input00" size="100" value="<?=$title?>">
		</td>
	</tr>
	<tr>
		<th>공지내용</th>
		<td>
		<!-- <textarea id="content" name="content"><?=$content?></textarea> -->
		<textarea name="content" id="ir1" style="width:100%; height:500px;" /><?=$content?></textarea>
		</td>
	</tr>
	</tr>
	</table>
</div>	
	
<div class="write_btn tc">
	<a href="javascript:notice_reg_proc();">저장하기</a>
	<a href="/admin/cs/cs_notice_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 notice_reg_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>