<?php
	require_once("inc/page.inc.php");
	
	htmlStart("Photos");
	page("pics");

	if($urlArgs['id'] == NULL) {
		$c = new Filter("galleries");
		foreach($c->apply() as $galleryid) {
			$g = new Object($galleryid);
			print("<h3>".$g->getName().", ". strftime("%d %B %Y", $g->getFieldData("datum")) ."</h3>");
			for($x = 1; $x <= 20; $x++) {
				$f = $g->getField("img$x");
				$f = $f->sdt;
				if($f->width != NULL) {
					if($f->width <= $f->height) {
						print("<a href='images/redone/300..$f->id.jpg' rel='lightbox[$g->id]' title='".$g->getFieldData("img$x")."'>");
					} else {
						print("<a href='images/redone/.450.$f->id.jpg' rel='lightbox[$g->id]' title='".$g->getFieldData("img$x")."'>");
					}
					print("<img src='images/redone/100.100.$f->id.jpg'></a> ");
				}
			}
			spacer();
		}
	} else {
		$album = new Object($urlArgs['id']);
		if(!RedOne::isError($album)) {
			$tinyHead = $album->getFieldData("tiny_head");
			$tinyHead = ($tinyHead == NULL) ? "" : " - " . $tinyHead;
		
			album($album, NULL, strftime("%B %Y", $album->getFieldData("datum")) . $tinyHead);
		}
		spacer();
?>
<?
	}
	
	htmlEnd();
?>