<?php
	if ($_COOKIE['psketch_thumbs_width'].'' <> '') {
		$psketch_width = $_COOKIE['psketch_thumbs_width'];
	} else {
		$psketch_width = psketch_THUMBS_DEF_WIDTH;
	}
?>
<div>
<script type="text/javascript">
var psketch_width = <?= $psketch_width ?>;
function resizepsketchSize(up_width) {
	setpsketchSize(psketch_width + up_width);
}
function setpsketchSize(width) {
	width = Number(width);
	if (width < <?= psketch_THUMBS_MIN_WIDTH ?>) {
		return;
	}
	if (width > <?= psketch_THUMBS_MAX_WIDTH ?>) {
		return;
	}
	psketch_width = width;
	$("img.psketch_img").css("width", width);
	$("#psketchWidth").val(width);
	$.cookie('psketch_thumbs_width', width, { expires: 365 });
	$.cookie('psketch_thumbs_height', height, { expires: 365 });
}
function selectpsketchSize() {
	width = $("#psketchWidth").val();
	setpsketchSize(width);
}
</script>
サイズ：<select id="psketchWidth" onChange="selectpsketchSize()">
<?php	for ($size=psketch_THUMBS_MIN_WIDTH; $size<=psketch_THUMBS_MAX_WIDTH; $size+=psketch_THUMBS_UPDOWN_WIDTH) { ?>
<option value="<?= $size ?>"<?= $size == $psketch_width ? ' selected' : '' ?>><?= $size ?>
<?php	} ?>
</select>
<input type="button" value="小さく" onClick="resizepsketchSize(-<?= psketch_THUMBS_UPDOWN_WIDTH ?>)">
<input type="button" value="大きく" onClick="resizepsketchSize(<?= psketch_THUMBS_UPDOWN_WIDTH ?>)">
<input type="button" value="最小" onClick="setpsketchSize(<?= psketch_THUMBS_MIN_WIDTH ?>)">
<input type="button" value="最大" onClick="setpsketchSize(<?= psketch_THUMBS_MAX_WIDTH ?>)">
</div>
<?php
	mysql_data_seek($rs, $startline);
	$line = $startline;
	while ($rec=mysql_fetch_array($rs) and $line<=$endline) {
?>
	<div class="list_thumb_box" style="">
		<div style="float:left;">
			<a title="<?= my_htmlspecialchars($rec['c_subject']) ?>" href="view.php?id=<?= $rec['id_psketch'] ?>&move=<?= $line ?>&row=<?= $rowcnt ?>&page=<?= $page ?>"><img class="psketch_img" style="width:<?= $psketch_width ?>px;" src="<?= str_replace(' ', '+', $rec['c_image']) ?>"></a>
		</div>
		<div class="list_caption">
		<span class="list_subject"><?= $rec['id_psketch'] ?>:<?= my_htmlspecialchars($rec['c_subject']) ?></span><br>
		<span class="list_handle">by <a href="list.php?ac=<?= $rec['id_account'] ?>"><?= my_htmlspecialchars($rec['c_handle']) ?></a></span>
		</div>
	</div>
<?php
		$line++;
	}
?>
<?php
function psketch_date_view($datetime) {
	$view_date = date_from_mysql("y/m/d H:i:s", $datetime);
	$now_date = date("y/m/d");
	if (left($view_date,8) == $now_date) {
		return '<span class="psketch_today">'.$view_date.'</span>';
	} else {
		$before_week = date("y/m/d", mktime(0, 0, 0, intval(date("n")), intval(date("j"))-6, intval(date("Y"))));
		if (left($view_date,8) >= $before_week) {
			return '<span class="psketch_recent_day">'.$view_date.'</span>';
		}
	}
	return $view_date;
}
?>
