<?php
	require("../__common__/__define_common.php");
	require("__define.php");
	require("../__common__/include-common-all.php");
	require("../__common__/include-common-html.php");
	require("_contents-header.php");

	my_session_start();

	if (isset($_GET['debug'])) {
		$_SESSION['debug'] = $_GET['debug'];
	}

	// ----- コンテンツ毎にユーザ切り替え -----
	$contents = current_contents_name($_SERVER['SCRIPT_NAME']);
	if ($_SESSION['current_id'.$contents]."" <> "") {
		$_SESSION['current_id'] = $_SESSION['current_id'.$contents];
		$_SESSION['current_handle'] = $_SESSION['current_handle'.$contents];
	}
	// ----- コンテンツ毎にユーザ切り替え -----

	//error_reporting(0);
	error_reporting(E_ERROR | E_PARSE);		// E_ERROR | E_WARNING | E_PARSE | E_NOTICE
?>
<?php
// ****************************************************************
function img_view($path, $pathDirName, $width) {
// ****************************************************************
	$pathSJIS = opendir(mb_convert_encoding($path, 'SJIS-win', 'UTF-8'));
	if ($dir = opendir($pathSJIS)) {
		while (($file = readdir($dir)) !== false) {
			if ($file != "." && $file != ".." && !is_dir($pathSJIS . "/" . $file)) {
				if (is_img_file($file)) {
					$filePath = $pathSJIS . "/" . $file;
					$img = "<span style='position:relative;'>";
					$img .= "<img src='" . $filePath . "' width=" . $width . " border=0 alt='" . $pathDirName . "'align=top />";
					//$img .= "<span style='font-size:10px; position:absolute; top:0px; left:0px; color:#000000; height:40px;'>";
					$img .= "<span style='position:absolute; top:0px; left:0px; color:#ffff80; text-decoration: none;'>";
					$img .= $pathDirName;
					$img .= "</span></span>";
					return($img);
				}
			}
		} 
		closedir($dir);
	}
	return($pathDirName);
}
?>
