<div id="content-container" class="container ui-widget">
	<div id="content-box" class="box ui-widget-content ui-corner-all">
		<div id="loading">読み込んでいます。</div>
		<div id="new_post"><a href="javascript:T.get_new()"><span id="new_post_cnt">x</span>件の新着メッセージがあります。</a></div>
<?php
if (! can_action('view')) {
	echo '<div class="content">投稿を見るにはログインしてください。</div>';
} else {
	if (! empty($contents)) {
		foreach ($contents as $content) {
?>
<div class="content" i=<?php echo $content['id'];?><?php if ($content['t_id']) echo ' pp='.$content['t_id'];?>>
	<div class="header">
		<?php
			echo $content['id'].'： ';
			echo '<a href="'.BASE_URL;
			if ($content['user_id']) {
				echo 'user/'.rawurlencode($content['login_id']).'" class="name user'.$content['t'].'">'.h($content['n']).'</a>';
			} else {
				echo 'name/'.rawurlencode($content['n']).'" class="name">'.h($content['n']).'</a>';
				if ($content['trip']) {
					echo '<a href="'. BASE_URL.'trip/'.rawurlencode($content['trip']).'" class="name">@'.h($content['trip']).'</a>';
				}
			}
			?><span class="user">-</span><span class="time" d="<?php echo $content['created'];?>"><?php echo $content['created'];?></span>
	</div>
	<div class="body">
<?php
		$lines = explode("\n", h($content['content']));
		echo '<span>'.implode ('</span><br/><span>', $lines).'</span>';
?>
	</div>
	<div class="tag">
<?php
	if ($content['t_theme']) {
		echo '<a href="'.BASE_URL.'theme/'.rawurlencode($content['t_theme']).'" style="font-weight:bold">'.h($content['t_theme']).'</a>';
	}
	$tags = json_decode($content['jt']);
	if ($tags) {
		foreach ($tags as $tag) {
			echo '<a href="'.BASE_URL.'theme/'.rawurlencode($tag).'">'.h($tag).'</a>';
		}
	}
?>
	</div>
	<div class="action"><a href="<?php echo BASE_URL.'read/'.$content['id'];?>">詳細</a></div>
</div>
<?php
		}
	}
}
?>
	</div>
	<div id="read-old">
		<a href="javascript:T.oldRead()" id="read-old-link">古い投稿</a>
	</div>
</div>
<div id="preview-dialog"></div>
<div id="reply-dialog"></div>