<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<style type="text/css">
<!--
body {
	background-color: #990000;
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
}
#thumb {
	background-color: #000000;
	text-align: center;
	width: 150px;
	padding: 2px;
	margin: 3px;
	clear: none;
	float: left;
}
#imagem {
	background-color: #000000;
	text-align: center;
	width: 150px;
	padding: 10px;
	margin: 20px;
	clear: none;
	float: none;
}
img {
	border-top-style: none;
	border-right-style: none;
	border-bottom-style: none;
	border-left-style: none;
}
a:link, a:active, a:visited, a:hover {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	color: #FFFFFF;
	text-decoration: none;
}
#titulo {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 36px;
	font-weight: bold;
	text-transform: capitalize;
	color: #FFFFFF;
	text-decoration: none;
	text-align: center;
	white-space: nowrap;
}
-->
</style>
</head>

<body><center><?php
//$id = $_REQUEST['id'];
$id = $_GET['id'];
//if($id){
//	$dir = "./";
//} else {
//	$dir = "./".$id."/";
//}
$dir = "./".$id."/";
$dh = opendir($dir);
if($id){
	echo("<div id=\"titulo\">".str_replace("_"," ",$id)."</div>");
}
while (false !== ($filename = readdir($dh))) {
	if($id){
		if ((substr($filename,-4) == ".jpg" or substr($filename,-4) == ".jpe" or substr($filename,-4) == "jpeg") and substr($filename,-9) != "thumb.jpg") {
			echo "<div id=\"imagem\"><img src='".$dir.$filename."'></div>";
		}
	} else {
		if(is_dir($filename) and $filename != "." and $filename != ".."){
			echo "<div id=\"thumb\"><a href=\"?id=$filename\"><img src=\"$filename/thumb.jpg\" width=\"150\" height=\"75\" /><br />".str_replace("_"," ",$filename)."</div>";
		}
	}
}
closedir($dh);
?></center></body>
</html>