<?php
	require("__include-common.php");
	require("../account/__logincheck.php");
	if ($_SESSION['photo_open_path'] == '') {
		header("Location: index.php");
	}
	if (empty($_SESSION['photo'])) {
		header("Location: index.php");
	}
	if (empty($_SESSION['photo_img_count'])) {
		header("Location: index.php");
	}
	if ($_SESSION['photo_img_count'] < 1) {
		header("Location: index.php");
	}
	$open_path = $_SESSION['photo_open_path'];
	if (defined("photo_LIMITED_IMAGES_FOLDER") and photo_LIMITED_IMAGES_FOLDER <> '') {
		if ($_SESSION['システム管理者'] <> 'YES' or photo_LIMITED_ADMIN_NOLIMIT <> 'YES') {
			$len = strlen(photo_LIMITED_IMAGES_FOLDER);
			if (substr($open_path.'/', 0, $len+1) <> photo_LIMITED_IMAGES_FOLDER.'/') {
				header("Location: index.php");
			}
		}
	}
?>
<!DOCTYPE html>
<html>
<head>
<title>MyHome Photo jQuery CollagePlus</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="jquery-collagePlus/css/examples.css" media="all">
<link rel="stylesheet" href="jquery-collagePlus/css/transitions.css" media="all">
<!--[if lt IE 9]>
<script src="../scripts/jquery-1.8.3.js"></script>
<![endif]-->
<!--[if (gte IE 9) | (!IE)]><!-->
<script src="../scripts//jquery-2.0.2.js"></script>
<!--<![endif]-->
<!--[if IE]>
<script src="../scripts/html5.js"></script>
<![endif]-->
<script src="jquery-collagePlus/jquery.collagePlus.js"></script>
<script src="jquery-collagePlus/extras/jquery.removeWhitespace.js"></script>
<script src="jquery-collagePlus/extras/jquery.collageCaption.js"></script>
<script type="text/javascript">
// All images need to be loaded for this plugin to work so
// we end up waiting for the whole window to load in this example
$(window).load(function () {
	$(document).ready(function(){
		collage();
		$('.Collage').collageCaption();
	});
});
// Here we apply the actual CollagePlus plugin
function collage() {
	$('.Collage').removeWhitespace().collagePlus(
		{
			'fadeSpeed'	: 2000
			,'targetHeight'	: 200
				/*	,'effect'	: 'effect-1'
					,'direction'	: 'vertical'
				*/
		}
	);
};
// This is just for the case that the browser window is resized
var resizeTimer = null;
$(window).bind('resize', function() {
	// hide all the images until we resize them
	$('.Collage .Image_Wrapper').css("opacity", 0);
	// set a timer to re-apply the plugin
	if (resizeTimer) clearTimeout(resizeTimer);
	resizeTimer = setTimeout(collage, 200);
});
</script>
<script>
document.onkeydown = keyPress;
function keyPress( e ) {
	e = e || window.event;
	if (e.keyCode == 27) {		// ESC ：Exit, Return
		location.href='index.php';
		return false;
	}
	return true;			// その他 (ファンクションキーなどを有効にするため)
}
</script>
</head>
<body>
<section class="Collage effect-parent" style="margin-bottom:20px;">
<?php
	$img_count = $_SESSION['photo_img_count'];
	for ($ix = 0; $ix < $img_count; $ix++) {
		$img_file = $open_path.'/'.$_SESSION['photo'][$ix]['file'];
		if ($_SESSION['photo'][$ix]['type'] == 'video') {
			$img = 'video-jpeg.php?file='.urlencode($img_file).'&ss='.$_SESSION['video_thumb_ss'];
		} else {
			$img = 'img-view.php?img='.urlencode($img_file);
		}
?>
<div class="Image_Wrapper"><a href="slide.php?path=<?= $open_path ?>&page=<?= $ix+1 ?>" target="_blank"><img src="<?= $img ?>"></a></div>
<?
	}
?>
</section>
</body>
</html>