<?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) <> photo_LIMITED_IMAGES_FOLDER) {
				header("Location: index.php");
			}
		}
	}
?>
<!DOCTYPE html>
<html>
<head>
<title>MyHome Photo Supersized Slideshow</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<!--
	Supersized - Fullscreen Slideshow jQuery Plugin
	Version 3.1.3
	www.buildinternet.com/project/supersized
	By Sam Dunn / One Mighty Roar (www.onemightyroar.com)
	Released under MIT License / GPL License
-->
<link rel="stylesheet" href="supersized/slideshow/css/supersized.css" type="text/css" media="screen" />
<style type="text/css">
/*Demo Styles*/
p{ padding:0 30px 30px 30px; color:#fff; font:11pt "Helvetica Neue", "Helvetica", Arial, sans-serif; text-shadow: #000 0px 1px 0px; line-height:200%; }
p a{ font-size:10pt; text-decoration:none; outline: none; color:#ddd; background:#222; border-top:1px solid #333; padding:5px 8px; -moz-border-radius:3px; -webkit-border-radius:3px; border-radius:3px; -moz-box-shadow: 0px 1px 1px #000; -webkit-box-shadow: 0px 1px 1px #000; box-shadow: 0px 1px 1px #000; }
p a:hover{ background-color:#427cb4; border-color:#5c94cb; color:#fff; }
h3{ padding:30px 30px 20px 30px; }
#content{ position:absolute; top:50px; left:50px; background:#111; background:rgba(0,0,0,0.70); width:360px; text-align:left; }
.stamp{ float: right; margin: 15px 30px 0 0;}
</style>
<script type="text/javascript" src="../scripts/jquery.js"></script>
<script type="text/javascript" src="supersized/slideshow/js/supersized.3.1.3.min.js"></script>
<script type="text/javascript">
jQuery(function($){
	$.supersized({
		//Functionality
		slideshow               :   1,		//Slideshow on/off
		autoplay		:   1,		//Slideshow starts playing automatically
		start_slide             :   1,		//Start slide (0 is random)
		random			:   0,		//Randomize slide order (Ignores start slide)
		slide_interval          :   3000,	//Length between transitions
		transition              :   1, 		//0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
		transition_speed	:   500,	//Speed of transition
		new_window		:   1,		//Image links open in new window/tab
		pause_hover             :   0,		//Pause slideshow on hover
		keyboard_nav            :   1,		//Keyboard navigation on/off
		performance		:   1,		//0-Normal, 1-Hybrid speed/quality, 2-Optimizes image quality, 3-Optimizes transition speed // (Only works for Firefox/IE, not Webkit)
		image_protect		:   1,		//Disables image dragging and right click with Javascript
		image_path		:   'img/',	//Default image path
		//Size & Position
		min_width		:   0,		//Min width allowed (in pixels)
		min_height		:   0,		//Min height allowed (in pixels)
		vertical_center         :   1,		//Vertically center background
		horizontal_center       :   1,		//Horizontally center background
		fit_portrait         	:   1,		//Portrait images will not exceed browser height
		fit_landscape		:   0,		//Landscape images will not exceed browser width
		//Components
		navigation              :   1,		//Slideshow controls on/off
		thumbnail_navigation    :   1,		//Thumbnail navigation
		slide_counter           :   1,		//Display slide numbers
		slide_captions          :   1,		//Slide caption (Pull from "title" in slides array)
		slides 			:	[
<?php
	$img_count = $_SESSION['photo_img_count'];
	for ($ix = 0; $ix < $img_count; $ix++) {
		if ($ix <> 0) {
			echo ',';
		}
		$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);
		}
?>
		{image : '<?= $img ?>', title : '<?= $_SESSION['photo'][$ix]['file'] ?>', url : ''}
<?
	}
?>
						]
	});
});
</script>
<script>
document.onkeydown = keyPress;
$('.images').galleria();
function keyPress( e ) {
	e = e || window.event;
	if (e.keyCode == 27) {		// ESC ：Exit, Return
		history.back();
		return false;
	}
	return true;			// その他 (ファンクションキーなどを有効にするため)
}
</script>
</head>
<body>
	<div id="content">
	</div>
	<!--Thumbnail Navigation-->
	<div id="prevthumb"></div> <div id="nextthumb"></div>
	<!--Control Bar-->
	<div id="controls-wrapper">
		<div id="controls">
			<!--Slide counter-->
			<div id="slidecounter">
				<span class="slidenumber"></span>/<span class="totalslides"></span>
			</div>
			<!--Slide captions displayed here-->
			<div id="slidecaption"></div>
			<!--Navigation-->
			<div id="navigation">
			</div>
		</div>
	</div>
</body>
</html>