<?
//로그인확인
include_once $_SERVER[DOCUMENT_ROOT] . "/module/member/auth.php";

//DB연결
$dblink = SetConn($_conf_db["main_db"]);

//내 게시물 인지 확인
$arrList = getOneToOneInfo(mysql_real_escape_string($_REQUEST[idx]));

//DB해제
SetDisConn($dblink);

if($arrList["total"] < 1){
		jsMsg("존재하지 않는 글 입니다.");
		jsHistory("-1") ;
}

if($_SESSION[$_SITE["DOMAIN"]]["MEMBER"]["ID"] != $arrList["list"][0]["user_id"]){
		jsMsg("고객님의 문의 글이 아닙니다.");
		jsHistory("-1") ;
}
?>

<script language="javascript">
	function deleteOneToOne(idx){
		var cfm = false;
		cfm = confirm("이 상담내역을 삭제 하시겠습니까?");
		if(cfm==true){
			new Ajax.Request('/module/one_to_one/one_to_one_evn.php',
			{
				method:'post',
				parameters: {idx: idx, evnMode: 'deleteAjax'},
				asynchronous: this.asynchronous,
				encoding: 'utf-8',
				contentType: 'application/x-www-form-urlencoded',

				onSuccess: function(transport){
					var response = transport.responseText || "응답된 내역이 없습니다."; 
					if(response=="true"){
						alert("삭제 되었습니다.");
						document.location.href="/shop.php?goPage=MyQna";
					}else{
						alert("삭제에 실패 하였습니다.");
					}
				},
				
				onFailure: function(){ 
					alert('AJAX 데이터 응답중 오류가 발생하였습니다.') 
				}   
			});
		}
	}
</script>

	<div id="sub_title">		
		<h2><img src="../images/title/tt_mypage.gif" alt="마이페이지" /></h2>
	</div>
    <div id="content">
        <div class="con_area">
			
            <!-- 본문내용 START -->
            <? include $_SERVER[DOCUMENT_ROOT] . "/include/menu_mypage.php"; ?>

		<div class="board_view">
			<dl>
				<dt>제목</dt>
				<dd><strong><?=stripslashes($arrList["list"][0][subject])?></strong></dd>
			</dl>
			<dl>
				<dt>작성자</dt>
				<dd><?=$arrList["list"][0][user_name]?></dd>
			</dl>
			<dl class="date">
				<dt>작성일자</dt>
				<dd><?=$arrList["list"][0][wdate]?></dd>
			</dl>
		</div>

		<div class="view_content">
			<?=stripslashes($arrList["list"][0][contents])?>
		</div>

		<?if($arrList["list"][0][status]=="Y"){?>
		<div class="view_content">
			<?=stripslashes($arrList["list"][0][re_contents])?>
		</div>
		<?}else{?>
		<div class="view_content">
			등록된 답변이 없습니다.
		</div>
		<?}?>

		<div class="buttons">
			<div class="fr">
				<span class="btn_pack medium"><a href="/shop.php?goPage=MyQna">목록</a></span>
				<span class="btn_pack medium"><a href="javascript:deleteOneToOne('<?=$arrList["list"][0][idx]?>');">삭제</a></span>
			</div>
		</div>

		</div>
	</div>
