<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  
	// load viewer library
	$libraryPath = 'admin/lib/viewer_functions.php';
	$dirsToCheck = array('/home7/mizrahio/public_html/hunt_dev/','','../','../../','../../../');
	foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
	if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
	
	// load section nav
	list($subnav, $subnavCategory) = getCategories(array(
		'tableName'     => 'archives',
		'defaultCategory'	=> 'first',
		'categoryFormat'=> 'onelevel',
	));
	
	// load page content
	list($page, $pageMetaData) = getRecords(array(
		'tableName'   => 'online_collections',
		'where'       => whereRecordNumberInUrl(1),
		'limit'       => '1',
	));
	$page = @$page[0]; // get first record

?>

<?php
	
	$pagetitle = $page['title'];
	$sectiontitle = "Archives";
	$bodyclass = "archives";
	include("../includes/header.inc.php");

?>

		
<div class="sidebar">
	
	<h3><?php echo $sectiontitle ?></h3>
	
	<?php include("../includes/subnav.inc.php"); ?>

</div><!-- /subnav -->

<div class="maincontent">
	
	<h2><?php echo htmlencode($page['title']) ?></h2>
	
	<div class="twocolumn group">
	
		<div class="primary">
			
			<?php echo $page['primary_content']; ?>
					
		</div><!-- /primary -->
		
		<div class="secondary">
			
			<?php if ($page['featured_image']): ?>
			
				<div class="section selectedWorks">
							
					<?php foreach ($page['featured_image'] as $index => $upload): ?>
						 <img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" />
						 <p><?php echo htmlencode($upload['info1']) ?></p>
					<?php endforeach ?>
					
				</div>

			<?php endif ?>

			<?php if ($page['selected_artworks']): ?>
			
				<div class="selectedWorks section divider">
					
					<h4>Selected Artworks</h4>
					<span style="display:block; margin-bottom: 12px;">[+] Click to enlarge</span>
					
					<ul class="group">
						
						<?php foreach ($page['selected_artworks'] as $index => $upload): ?>
							<li>
								<a href="<?php echo $upload['urlPath'] ?>" class="fancybox" rel="group" title="Click to enlarge">
									<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo htmlencode($upload['info1']) ?>" />								
								</a>
							</li>
						<?php endforeach ?>
					</ul>
				
				</div><!-- /selectedWorks -->
				
			<?php endif ?>
			
		</div><!--/secondary-->
	
	</div>
	
</div><!--/maincontent-->

<?php include("../includes/footer.inc.php"); ?>
