<?php
	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';

	$cd_board 		= "01";
	$cd_board 		= $_REQUEST["cd_board"];
	$ds_kind 		= $_REQUEST["ds_kind"];
	$s_cd_user 		= $_SESSION['s_cd_user'];
	$s_cd_dealer 	= $_SESSION['s_cd_dealer'];
	$s_nm_name 		= $_SESSION['s_nm_name'];

	// if ( ($ds_kind == "A" && empty($s_cd_user))
	// 		|| ($ds_kind == "D" && empty($s_cd_dealer))
	// 	){
	// 	AlertRedirect("잘못된 요청입니다.","/index.php");
	// }

	//미라온 게시판 글작성
	if($cd_seq!="" || $cd_seq!=null){

		$sql ="SELECT
				cd_seq , cd_board ,cd_user ,cd_userid , nm_title , nm_name, ds_top, ds_main, ds_kind
				,no_hit, ds_open, nm_content, nm_file, nm_updir, nm_reply, dt_insert, ds_delind ,nm_etc1, nm_etc2, nm_etc3, nm_etc4, nm_etc5
			FROM board_master
			WHERE
				cd_board='$cd_board' AND cd_seq='$cd_seq' AND ds_delind='N'";

		$col=mysql_fetch_array(mysql_query($sql));

		if (!empty($col['cd_seq'])){ //일반회원

			$cd_seq = $col['cd_seq'];
			$cd_board = $col['cd_board'];
			$cd_user = $col['cd_user'];
			$cd_userid = $col['cd_userid'];
			$nm_title = $col['nm_title'];
			$no_hit = $col['no_hit'];
			$ds_open = $col['ds_open'];
			$nm_content = $col['nm_content'];
			$nm_file = $col['nm_file'];
			$nm_updir = $col['nm_updir'];
			$nm_reply = $col['nm_reply'];
			$dt_insert = $col['dt_insert'];
			$ds_delind = $col['ds_delind'];
			$ds_top = $col['ds_top'];
			$ds_main = $col['ds_main'];
			$ds_kind = $col['ds_kind'];
			$nm_name = $col['nm_name'];
			$nm_etc1 = $col['nm_etc1'];
			$nm_etc2 = $col['nm_etc2'];
			$nm_etc3 = $col['nm_etc3'];
			$nm_etc4 = $col['nm_etc4'];
			$nm_etc5 = $col['nm_etc5'];

			//if($_SESSION['cd_userid'] != $cd_userid){
			//	AlertBack("게시물을 수정할 권한이 없습니다.");
			//}

			$mode="Update";

		}else{
			AlertBack("게시물을 가져오지 못하였습니다.");
		}
		$PageNo = $PageNo;
	}else{
		$mode="Add";
	}

	if ($mode=="Add" || $mode == "Reply"){
		$cd_userid = $_SESSION['admin_cd_userid'];
		$nm_name = $_SESSION['admin_nm_name'];
		$ds_main="N";
	}
?>
<?php include("../inc/inc_header.php"); ?>

<main class="pb123">
	<section>
		<div class="sub--top--visual">
			<div class="contents--inner">
				<h2>고객 센터</h2>
				<p>이차조아에 대해 궁금하신 점이 있다면 무엇이든 물어보세요.</p>
			</div>
		</div>
	</section>



	<section>
		<div class="notice--board--wrap view--type">
			<div class="board--view--wrap">
				<h2><?=$nm_title?></h2>
				<p class="date--box"><span class="icon--date"></span><?=$dt_insert?></p>
				<div class="editor--wrap">
					<?=$nm_content?>
				</div>
				<div class="btn--wrapper d-flex justify-content-center mt200">
					<button type="button" class="btn btn-list" id="btn_list">목록</button>
				</div>
			</div>
		</div>
	</section>


</main>

<script>
function go_list() {
	var url  = "notice_list.php";
	var params = {
		PageNo : "<?=$PageNo?>",
		PageSort : "<?=$PageSort?>",
		searchtype : "<?=$searchtype?>",
		searchword : "<?=$searchword?>",
	}
	link(url+"?"+$.param(params));

}
$(function() {
	$("#btn_list").on("click", function() {
		go_list();
	})
})
</script>


<?php include("../inc/inc_footer.php"); ?>
