<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

$cmmtqry		= "bo_table=$bo_table&wr_id=$wr_id&cmmtview=$zm_board[comment_fold]&cwin=1&cpage=$cpage";
?>
<link rel="stylesheet" type="text/css" href="<?=$board_skin_path?>/style.css">
<style>
.good_button	{ display:inline-block; width:72px; height:55px; background:url(<?=$board_skin_path?>/img/good_bg.gif) no-repeat; text-align:center; }

div.sns_buttons	{ margin:4px; }
div.sns_buttons span	{ display:inline-block; width:40px; height:30px; vertical-align:bottom; cursor:pointer; }
div.sns_buttons span:first-child	{ border-radius:3px 0 0 3px; }
div.sns_buttons span:last-child	{ border-radius:0 3px 3px 0; line-height:200%; text-align:center; }
div.sns_buttons span:last-child a	{ color:#282828; font-size:14px; }
span.icon_facebook	{ background:url("<?=$board_skin_path?>/img/icon_sns.gif") no-repeat 0 -48px; }
span.icon_twitter	{  background:url("<?=$board_skin_path?>/img/icon_sns.gif") no-repeat 0 0px; }
span.icon_kakaos	{ background:url("<?=$board_skin_path?>/img/icon_sns.gif") no-repeat 0 -98px;  }
span.icon_band	{ background:url("<?=$board_skin_path?>/img/icon_sns.gif") no-repeat 0 -148px;  }
</style>

<? //-- 제목 -- ?>
<div class="vw_subject"><?=cut_hangul_last(get_text($view[wr_subject]))?></div>
<? //-- 글 정보 1. 글쓴이, 카테고리 등 ?>
<div class="vw_info1">
	<? if ($is_category && $category_name) : ?><span class="catename"><?=$view[ca_name]?></span><span class="vline">|</span><? endif; ?>	<? //-- 카테고리 ?>
	<?=$view[name]?><span class=""><?=$view[id]?></span>
	<span class="view_etc_info_en"><? if ($is_ip_view) { echo "$ip"; } ?></span>
</div>
<div class="vw_info2">
	<span class="hit">조회 <?=number_format($view[wr_hit])?></span><span class="vline">|</span>
	<span class="datetime">작성 <?=date("m.d H:i", strtotime($view[wr_datetime]))?></span>
<?		if($view[wr_datetime] != $view[wr_last]) : ?><span class="vline">|</span><span class="datetime">수정 <?=date("y.m.d H:i", strtotime($view[wr_last]))?></span><? endif; ?>
</div> <? //-- 글 정보 2. IP, 시간, 조회 정보 등 ?>



<div class="bttn_box">
    <!-- 링크 버튼 -->
<?	ob_start(); ?>
<?	if ($copy_href) { echo "<a href=\"$copy_href\" class='bttn2'>복사</a> "; } ?>
<?	if ($move_href) { echo "<a href=\"$move_href\" class='bttn2'>이동</a> "; } ?>

<?	if ($search_href) { echo "<a href=\"$search_href\" class='bttn1'>검색목록</a> "; } ?>
<?	echo "<a href=\"$list_href\" class='bttn1'>목록</a> "; ?>
<?	if ($update_href) { echo "<a href=\"$update_href\" class='bttn1'>수정</a> "; } ?>
<?	if ($delete_href) { echo "<a href=\"$delete_href\" class='bttn1'>삭제</a> "; } ?>
<?	if ($reply_href) { echo "<a href=\"$reply_href\" class='bttn1'>답글</a> "; } ?>&nbsp;&nbsp;&nbsp;
<?	if ($write_href) { echo "<a href=\"$write_href\" class='bttn2'>글쓰기</a> "; } ?>
<?
    $link_buttons = ob_get_contents();
    ob_end_flush();
?>
</div>




<!-- 본문 -->
<div class="attach_box">	<? //-- 첨부파일, 링크, 이미지 ?>
<?
// 가변 파일
$cnt = 0;
for ($i=0; $i<count($view[file]); $i++) :
    if ($view[file][$i][source] && !$view[file][$i][view]) :
        $cnt++; ?>
		<div class="attach_file">
			<img src='<?=$board_skin_path?>/img/icon_file.gif' valign="middle"> <a onclick="file_download('<?=$view[file][$i][href]?>', '<?=$view[file][$i][source]?>');"><span><?=$view[file][$i][source]?>(<?=$view[file][$i][size]?>)</span><span class="download">[<?=$view[file][$i][download]?>]</span><span class="datetime">DATE : <?=substr($view[file][$i][datetime], 0, 16)?></span></a>
		</div>
<?	endif;
endfor;

// 링크
$cnt = 0;
for ($i = 1; $i <= $g4[link_count]; $i++) :
    if ($view[link][$i]) :
        $cnt++;
        $link = cut_str($view[link][$i], 70); ?>
		<div class="attach_link">
			<img src='<?=$board_skin_path?>/img/icon_link.gif' valign="middle"> <a href='<?=$view[link_href][$i]?>' target="_blank"><span class="link"><?=$link?></span> <span class="hit">[<?=$view[link_hit][$i]?>]</span></a>
		</div>
<?	endif;
endfor; 

//-- 이미지 출력
for ($i = 0; $i <= count($view[file]); $i++) :
	if ($view[file][$i][view]) : ?>
		<div class="attach_image"><?=$view[file][$i][view]?></div>
<?	endif;
endfor; ?>
</div>

<!-- 내용 출력 -->
<div class="content_box"><?=$view[content]?></div>
<?//echo $view[rich_content]; // {이미지:0} 과 같은 코드를 사용할 경우?>
<!-- 테러 태그 방지용 --></xml></xmp><a href=""></a><a href=''></a>
<!-- 본문 끝 -->

<!-- 네임카드 영역 -->
<? if ($is_signature) include_once("$board_skin_path/namecard.skin.php");?>

<!-- 페북 좋아요 버튼 -->
<? if($zm_board[facebooklike]) :
	$fb_url	 = $g4[url] . "/bbs/board.php?bo_table=$bo_table&wr_id=$wr_id&page=$page"; ?>
	<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/ko_KR/all.js#xfbml=1&appId=508784715834901"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script><div style="text-align:center; padding:2px;"><div class="fb-like" data-send="false" data-layout="box_count" data-width="450" data-show-faces="false"></div></div>
<?	endif; ?>
	<div style="text-align:center;">
<?		if ($zm_good_href) : ?>
			<!-- 추천 -->
			<div class="good_button">
			<div style="color:#EF4680; font-size:14px; margin:7px 0 5px 0;"><span style='color:crimson;'><span id="zm_good"><?=number_format($view[wr_good])?></span></span></div>
			<div><a href="<?=$zm_good_href?>" onClick="this.blur()"><img src="<?=$board_skin_path?>/img/icon_good.gif" border='0' align="absmiddle"><span class="good_txt"><?=$zm_board[good_word]?></span></a></div>
			</div>
<?		endif; ?>
<?		if ($zm_nogood_href) : ?>
			<!-- 반대 -->
			<div class="good_button">
			<div style="color:#6783FB; font-size:14px; margin:7px 0 5px 0;"><span id="zm_nogood"><?=number_format($view[wr_nogood])?></span></div>
			<div><a href="<?=$zm_nogood_href?>" onClick="this.blur()"><img src="<?=$board_skin_path?>/img/icon_nogood.gif" border='0' align="absmiddle"><span class="good_txt"><?=$zm_board[nogood_word]?></span></a></div>
			</div>
<?		endif; ?>
	</div>

<div style="position:relative; clear:both; text-align:right;"><?=zm_police($bo_table, $wr_id)?></div>

<div id="buttons" class="sns_buttons"><span class="icon_facebook" onclick="share_sns('fb')"></span><span class="icon_twitter" onclick="share_sns('tw')"></span><span class="icon_kakaos" onclick="share_sns('ks')"></span><span class="icon_band" onclick="share_sns('bd')"></span></div>

<!-- 코멘트 불러오기 -->
<iframe id="ifrmcmmt" frameborder=0 scrolling=no marginwidth=0 marginheight=0 src="<?=$g4[bbs_path]?>/board.php?<?=$cmmtqry?>"></iframe>

<div id="page_move">
	<div>
    <? if ($prev_href) { echo "<img src='$board_skin_path/img/btn_prev.gif' border='0' align='absmiddle'><span class='other_colon'>:</span><a href=\"$prev_href\" title=\"$prev_wr_subject\" style='color:#4D4D4D; font-size:13px;'>$prev_wr_subject</a><span class='other_datetime'>$prev_wr_datetime</span>"; } ?>
	</div>
	<div>
    <? if ($next_href) { echo "<img src='$board_skin_path/img/btn_next.gif' border='0' align='absmiddle'><span class='other_colon'>:</span><a href=\"$next_href\" title=\"$next_wr_subject\" style='color:#4D4D4D; font-size:13px;'>$next_wr_subject</a><span class='other_datetime'>$next_wr_datetime</span>"; } ?>
	</div>
</div>
</div><!-- 내용보기 테두리 끝 -->

<div style="clear:both; text-align:right; padding:10px 0 10px 0; border-top:1px solid #E7E7E7;">
    <!-- 링크 버튼 -->
    <?=$link_buttons?>
</div>

<? /* Not edit */ ?>
<script type="text/javascript">
function file_download(link, file) {
    <? if ($board[bo_download_point] < 0) { ?>if (confirm("'"+file+"' 파일을 다운로드 하시면 포인트가 차감(<?=number_format($board[bo_download_point])?>점)됩니다.\n\n포인트는 게시물당 한번만 차감되며 다음에 다시 다운로드 하셔도 중복하여 차감하지 않습니다.\n\n그래도 다운로드 하시겠습니까?"))<?}?>
    document.location.href=link;
}
</script>

<script type="text/javascript" src="<?="$g4[path]/js/board.js"?>"></script>
<script type="text/javascript">
function share_sns(sns){
	var snsurl		= "<?=$board_skin_path?>/img/ani_loading.gif";
	var long_url	= "<?=$board_skin_path?>/sns_share.php?bo_table=<?=$bo_table?>&wr_id=<?=$wr_id?>";

	snsurl	= long_url + "&sns="+sns;
	var newwin	= window.open(snsurl, "sns", "width=600, height=400, toolbar=0");
}


window.onload=function() {
    resizeBoardImage(<?=(int)$board[bo_image_width]?>);
    drawFont();

	//-- 이미지 리사이즈
    $.post("<?=$board_skin_path?>/ajax.resize.php", { bo_table: "<?=$bo_table?>", wr_id: "<?=$wr_id?>" }, function(data){ });
}
</script>