<?php
	require("../__common__/__define_common.php");
	require("__define.php");
	require("../__common__/include-common-all.php");
	require("../account/__logincheck.php");

	$img_file = my_GET('img').'';
	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($img_file, 0, $len) <> photo_LIMITED_IMAGES_FOLDER) {
				exit;
			}
		}
	}
	if ($img_file == '') {
		exit;
	}
?>
<!DOCTYPE html>
<html>
<head>
<title>ジグソーパズル by Snapfit</title>
<meta charset="utf-8">
<link rel="stylesheet" href="<?= _STYLE_SHEET_FOLDER_COMMON ?>/common.css?20131130">
<link rel="stylesheet" href="<?= _STYLE_SHEET_BUTTON ?>">
<!--[if lt IE 8]>
<link media=all href="../scripts/snapfit/prj_ie.css" type=text/css rel=stylesheet>
<link href="../scripts/snapfit/overlay_ie.css" type=text/css rel=stylesheet>
<![endif]-->
<!--[if IE]>
<link href="../scripts/snapfit/accordion_ie.css" type=text/css rel=stylesheet>
<link media=print href="../scripts/snapfit/prt_ie.css" type=text/css rel=stylesheet>
<![endif]-->
<!--[if lt IE 7]>
<script src="../scripts/snapfit/fixed.js" type=text/javascript></script>
<style type=text/css>.png {
	visibility: hidden; behavior: url(../cvi/../scripts/snapfit/iepngfix2.htc)
}
</style>
<![endif]-->
<script src="../scripts/snapfit/snapfit.js" type=text/javascript></script>
</head>
<body>
<div class=demo>
<div style="outline: 1px solid silver">
<?php
	if (is_video_filename($img_file)) {
		$getimg = "video-jpeg.php?file=".urlencode($img_file);
	} else {
		$getimg = "img-view.php?img=".urlencode($img_file);
	}
	if ($_GET['h'].'' <> '') {
		$height = $_GET['h'];
	} else {
		$height = 480;
	}
?>
<img id=jigsaw height=<?= $height ?> alt=jigsaw src="<?= $getimg ?>" onload="snapfit.add(this,{aborder:true, aimage:true, polygon:true, space:20});" border=0>
</div>
<script>
function SelectionHeight(form, sel) {
	for (i = 0; i < sel.options.length; i++) {
		if (sel.options[i].selected == true) {
			window.location.href = '<?= $_SERVER['SCRIPT_NAME'] ?>?img=<?= $img_file ?>&h=' + escape(sel.options[i].value);
		}
	}
}
</script>
<strong>サイズ</strong>
<select name="" onchange="SelectionHeight(this.form, this)">
<?php
	$keyary = explode(',', '240,320,400,480,560,640,720,800');
	foreach ($keyary as $keytmp) {
?>
	<option value="<?= $keytmp ?>"<?= $height == $keytmp ? " selected" : "" ?>><?= $keytmp ?>
<?php
	}
?>
</select>
<strong>レベル</strong>
<select id=level onchange="snapfit.reset(document.getElementById('jigsaw'),parseInt(this.options[this.selectedIndex].value));" size=1>
<option value=0>160px (１ 簡単)</option>
<option value=1 selected>128px (２ やさしい)</option>
<option value=2>104px (３ やや難しい)</option>
<option value=3>080px (４ かなり難しい)</option>
<option value=4>064px (５ スーパー)</option>
<option value=5>056px (☆ スペシャル)</option>
<option value=6>048px (★ エクストラ)</option>
</select>
<button onclick="snapfit.admix(document.getElementById('jigsaw'));">バラバラにする</button>
<button onclick="snapfit.solve(document.getElementById('jigsaw'));">揃える</button>
<br>
</div>
<script src="../scripts/snapfit/overlay.js" type=text/javascript></script>
<script src="scripts/tenbyou.js"></script>
<script>
document.onkeydown = keyPress;
function keyPress( e ) {
	e = e || window.event;;
	if (e.keyCode == 27) {	// Esc
		window.close();
	} else {			// その他 (ファンクションキーなどを有効にするため)
		return true;
	}
	return false;
}
</script>
<div id="footer" style="margin-left: 10px; clear: both;">
<a href="http://www.netzgesta.de/snapfit" target="_blank" style="color:#b0b0ff;">Powered by Snapfit</a><br />
<a href="http://ok2nd.web.fc2.com/" target="_blank" style="color:#b0b0ff;">Powered by ok.2nd</a>
</div>
</body>
</html>
