<?php
	if (VIDEO_PREVIEW == 'YES') {
?>
	<script type="text/javascript" src="../scripts/JWPlayer/swfobject.js"></script>
	<script type="text/javascript" src="../scripts/JWPlayer/movie_preview.js"></script>
	<script type="text/javascript" src="../scripts/JWPlayer/silverlight.js"></script>
	<script type="text/javascript" src="../scripts/JWPlayer/wmvplayer.js"></script>
<?php
	}
?>
	<table id="memo_list_table">
<?php
	mysql_data_seek($rs, $startline);			//テーブル内の指定行に移動
	$line = $startline;					//$lineに$startlineを代入
	$trans = 0;
	while ($rec=mysql_fetch_array($rs) and $line<=$endline) {
		if ($rec['c_privacy'] == 444) {
			$view_category_class = 'memo_list_category_privacy';
			$view_memo_class = 'memo_list_memo_privacy';
		} else {
			$view_category_class = 'memo_list_category';
			$view_memo_class = 'memo_list_memo';
		}
?>
	<tr class="memo_list_table_data">
	<td rowspan=2 class="<?= $view_category_class ?>">
		<?= $rec['c_categoryName'] ?>
	</td>
	<td class="memo_list_subject">
<?php
	if ($_SESSION['memo_translate'] <> 'on') {
?>
		<p><?= ins_atag_br_keystr($rec['c_subject'], $keystring) ?>
<?php
	} else {
		++$trans;
?>
		<p><span id="source<?= $trans ?>"><?= ins_atag_br($rec['c_subject']) ?></span>
<?php
	}
?>
		<? if (check_permit_id($_SESSION['login_id'], $_SESSION['current_id']) == "w") { ?>
		<a class="a_update_form" href='input.php?id=<?= $rec['id_memo'] ?>&page=<?= $page ?>&<?= query_from_http_arg_pool($http_arg) ?>'>[修正]</a>&nbsp;
		<? } ?>
		<a class="a_translate" href="javascript:popup_translate(<?= $rec['id_memo'] ?>)">[翻訳]</a>
		</p>
<?php
	if ($_SESSION['memo_translate'] == 'on') {
?>
		<p id="translation<?= $trans ?>" class="translation"></p>
<?php
	}
?>
	</td>
	</tr>
	<tr>
	<td class="<?= $view_memo_class ?>">
<?php
	if ($_SESSION['memo_translate'] <> 'on') {
?>
	<p><?= ins_atag_br_keystr($rec['c_memo'], $keystring) ?></p>
<?php
	} else {
		$memo = str_replace('\n\n','\n',str_replace('。',"。\n",str_replace('. ',".\n",$rec['c_memo'])));
		$memo_ary = explode("\n", $memo);
		foreach ($memo_ary as $source) {
			if (left($source,7) == 'http://' or left($source,8) == 'https://') {
?>
	<p><?= ins_atag_br($source) ?></p>
<?php
			} else {
				++$trans;
?>
	<p id="source<?= $trans ?>"><?= ins_atag_br($source) ?></p>
	<p id="translation<?= $trans ?>" class="translation"></p>
<?php
			}
		}
	}
?>
	<?php
		$filename1 = $rec['c_attachFile1'];
		$filename2 = $rec['c_attachFile2'];
		$filename3 = $rec['c_attachFile3'];
		if ($filename1 <> "" || $filename2 <> "" || $filename3 <> "") {
	?>
			<p>
	<?php
			attach_file_view($rec['id_account'], $filename1, '<br>', VIEW_PHOTO_WIDTH, True, False, True,
				VIDEO_PREVIEW_WIDTH, VIDEO_PREVIEW_HEIGHT);
			attach_file_view($rec['id_account'], $filename2, '<br>', VIEW_PHOTO_WIDTH, True, False, True,
				VIDEO_PREVIEW_WIDTH, VIDEO_PREVIEW_HEIGHT);
			attach_file_view($rec['id_account'], $filename3, '<br>', VIEW_PHOTO_WIDTH, True, False, True,
				VIDEO_PREVIEW_WIDTH, VIDEO_PREVIEW_HEIGHT);
	?>
			</p>
	<?php
		}
	?>
	</td>
	</tr>
<?php
		$line++;
	}
?>
	</table>
<script type="text/javascript">
function popup_translate(id) {
	w01 = window.open("translate-google.php?id="+id,"","toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=660,height=300");
}
</script>
<?php
	if ($_SESSION['memo_translate'] == 'on') { 
?>
<script type="text/javascript">
function translate_all() {
	for (ix=1; ix<=<?= $trans ?>; ix++) {
		translate(ix);
	}
}
function translate(num) {
	var source = document.getElementById("source"+num).innerHTML;
	google.language.translate(source, '', '<?= $_SESSION['memo_trans_lang'] ?>', function(result) {
		var translated = document.getElementById("translation"+num);
		if (result.translation) {
			translated.innerHTML = result.translation;
		}
	});
}
translate_all();
</script>
<?php
	}
?>