<?php
/************************************************************************
 * This file is part of Windows Image Gallery.				*
 *									*
 * Windows Image Gallery is free software:				*
 * you can redistribute it and/or modify				*
 * it under the terms of the GNU General Public License as published by	*
 * the Free Software Foundation, either version 3 of the License, or	*
 * (at your option) any later version.					*
 *									*
 * Windows Image Gallery is distributed in the hope that it will be	*
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty	*
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the	*
 * GNU General Public License for more details.				*
 *									*
 * You should have received a copy of the GNU General Public License	*
 * along with Windows Image Gallery.					*
 * If not, see <http://www.gnu.org/licenses>.				*
 ************************************************************************/

require('config.php');
?>
<html>

<head>
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title><?php echo $sitename; ?></title>
<link rel="stylesheet" href="include/basic.css" type="text/css" />
<script type="text/javascript" src="include/dhtmlwindow.js"></script>
</head>

<?php include ('include/getwallpaper.php'); ?>
<body background="wallpapers/<?php echo $afbeelding[$rand]; ?>" style="background-attachment: fixed">
<center><img border="0" src="include/images/wig_header.png"></center>

 
	<?php
		$directory = "images/";
		$files = glob($directory . "*");
		foreach($files as $file) {
			if(is_dir($file)) {
				$url = $file;
				$file = ltrim($file, $directory);
				$dirnamecleaned = str_replace("_", " ", $file);

				if(!file_exists($url."/thumbs/")) {
					mkdir($url."/thumbs/");
				}

			?>


<script type="text/javascript">
function <?php echo $file; ?>(){ //Define arbitrary function to run desired DHTML Window widget codes
ajaxwin=dhtmlwindow.open("<?php echo $file; ?>", "ajax", "gallery.php?dir=<?php echo $file; ?>", "<?php echo $dirnamecleaned; ?>", "width=<?php echo $gallery_window_width; ?>px, height=<?php echo $gallery_window_height; ?>px, left=300px, top=100px, resize=1, scrolling=1")
}
</script>
			<?php
 			}
		}
	?>





<?php
	$div_left = "10";
	$div_top = "120";
	$div_count = 0;
	$directory = "images/";
	$files = glob($directory . "*");
	foreach($files as $file) {
		if(is_dir($file)) {
			$url = $file;
			$file = ltrim($file, $directory);
			$div_count = $div_count+1;
			$dirnamecleaned = str_replace("_", " ", $file);
		?>

		<div id="divid" onmouseover="this.style.background='<?php echo $backgroundcolor; ?>';" onmouseout="this.style.background='';" style="position:absolute; width:95px; left:<?php echo $div_left; ?>; top:<?php echo $div_top; ?>;">
			<center>
				<?php include ("include/icon.php"); ?>
				<a href="#" onClick="<?php echo $file; ?>(); return false">
				<img border="0" src="<?php echo $icon; ?>" width="64" height="64"><br>
				<span style="background-color: <?php echo $linkbgcolor;?>"><?php echo $dirnamecleaned; ?></span>
			</center>
		</div>



		<?php

			$div_top = $div_top+105;
			if ($div_count == $icons_vertical) {
				$div_left = $div_left+105;
  				$div_top = 120;
				$div_count = "0";
			}
		}
	}

?>







		<div id="divid" onmouseover="this.style.background='<?php echo $backgroundcolor; ?>';" onmouseout="this.style.background='';" style="position:absolute; width:95px; right:15; top:105;">
			<center>

<a href="#" onClick="ajaxwin=dhtmlwindow.open('ajaxbox', 'iframe', 'contact_form.php', 'Contact Me', 'width=550px,height=300px,left=400px,top=150px,resize=0,scrolling=1'); return false"><img border="0" src="icons/contact_form.png" width="64" height="64"><br><span style="background-color: <?php echo $linkbgcolor;?>">Contact Me</span></a>



			</center>
		</div>








</body>

</html>



