<?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>
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="ja"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie ie7 no-js" lang="ja"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie ie8 no-js" lang="ja"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie ie9 no-js" lang="ja"> <![endif]-->
<!--[if gt IE 9]><!--><html class="no-js" lang="ja"><!--<![endif]-->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>MyHome Photo Fullscreen Background Image Slideshow with CSS3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Fullscreen Background Image Slideshow with CSS3 - A Css-only fullscreen background image slideshow">
<meta name="keywords" content="css3, css-only, fullscreen, background, slideshow, images, content">
<meta name="author" content="Codrops">
<link rel="stylesheet" href="CSS3FullscreenSlideshow/css/demo.css">
<link rel="stylesheet" href="CSS3FullscreenSlideshow/css/style4-ok2nd.css">
<style>
<?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'];
			$css_width = 100;
			$css_left = '0px';
		} else {
			$img = 'img-view.php?img='.urlencode($img_file);
			list($width, $height) = getimagesize(myfile_ENCODE($img_file));
			if ($height > $width) {
				$css_width = intval($width*100/$height*photo_DISPLAY_RATIO);	// 縦長画像調整
				$css_left = intval((100-$css_width)/2).'%';	// 横位置を中央にするため
			} else {
				$css_width = 100;
				$css_left = '0px';
			}
		}
		$sec = $ix * 6;
?>
.cb-slideshow li:nth-child(<?= $ix+1 ?>) span {
	background-image: url(<?= $img ?>);
	-webkit-animation-delay: <?= $sec ?>s;
	-moz-animation-delay: <?= $sec ?>s;
	-o-animation-delay: <?= $sec ?>s;
	-ms-animation-delay: <?= $sec ?>s;
	animation-delay: <?= $sec ?>s;
	width: <?= $css_width ?>%;
	left: <?= $css_left ?>;
}
<?
	}
?>
</style>
<script src="CSS3FullscreenSlideshow/js/modernizr.custom.86080.js"></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 id="page">
	<ul class="cb-slideshow">
<?php	for ($ix = 0; $ix < $img_count; $ix++) { ?>
		<li><span></span></li>
<?php	} ?>
	</ul>
</body>
</html>