<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
  
  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/clientdata/apache-www/s/t/stpaulsburwood.org.au/www/','','../','../../','../../../');
  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 record from 'galleries_intro'
  list($galleries_introRecords, $galleries_introMetaData) = getRecords(array(
    'tableName'   => 'galleries_intro',
    'where'       => '', // load first record
    'loadUploads' => true,
    'allowSearch' => false,
    'limit'       => '1',
  ));
  $galleries_introRecord = @$galleries_introRecords[0]; // get first record
  if (!$galleries_introRecord) { dieWith404("Record not found!"); } // show error message if no record found


   
   // load Featured Gallery Image records
  list($galleriesRecords, $galleriesMetaData) = getRecords(array(
    'tableName'   => 'galleries',
    'allowSearch' => false
  ));

?>


<!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">

<!DOCTYPE html>
<!--[if lt IE 7]> <html dir="ltr" lang="en-US" class="ie6"> <![endif]-->
<!--[if IE 7]>    <html dir="ltr" lang="en-US" class="ie7"> <![endif]-->
<!--[if IE 8]>    <html dir="ltr" lang="en-US" class="ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html dir="ltr" lang="en-US"> <!--<![endif]-->

<!-- BEGIN head -->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Fancy Gallery</title>
    
    <!-- Style sheets -->
    <link rel="stylesheet" type="text/css" href="fancygallery/example/bootstrap/css/bootstrap.css" />
    <link rel="stylesheet" href="fancygallery/example/preview/main.css" type="text/css" media="screen" />
	<link rel="stylesheet" type="text/css" href="fancygallery/example/css/jquery.fancygallery.css" />
	<link rel="stylesheet" href="fancygallery/example/prettyphoto/css/prettyPhoto.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="fancygallery/example/fancybox/jquery.fancybox.css?v=2.1.1" type="text/css" media="screen" />
    
    <!-- Include js files -->
    <script src="fancygallery/example/js/jquery.min.js" type="text/javascript"></script>
    <script src="fancygallery/example/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="fancygallery/example/prettyphoto/jquery.prettyPhoto.js" type="text/javascript"></script>
	<script src="fancygallery/example/fancybox/jquery.fancybox.pack.js?v=2.1.1" type="text/javascript"></script>
    <script src="fancygallery/example/js/jquery.fancygallery.min.js" type="text/javascript"></script>
    
    <script type="text/javascript">
	    
	    jQuery(document).ready(function(){
	    	
	    	//code for example one
	    	$('#one-fg').fancygallery({navigation: 'pagination'});
	    	
	    	//code for example two
	    	$('#two-fg').fancygallery({albumSelection: 'menu', lightbox: 'fancybox', allMediasSelector: 'Show All', navigation: 'dots'});
	    
	    });
	    
    </script>
    
    <!-- Stylesheets -->
	<link rel="stylesheet" href="css/style.css" type="text/css"  media="all" />
	<link rel="stylesheet" href="css/colours/goldblack.css" type="text/css"  media="all" />
	<link rel="stylesheet" href="css/flexslider.css" type="text/css"  media="all" />
	<link rel="stylesheet" href="css/superfish.css" type="text/css"  media="all" />
	<link rel="stylesheet" href="css/responsive.css" type="text/css"  media="all" />
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600,600italic,700,700italic,800,800italic' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,700,900' rel='stylesheet' type='text/css'>
	<link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700' rel='stylesheet' type='text/css'>
	<!-- Favicon -->
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
	<script src="lightbox/js/lightbox.js"></script>
	<link href="lightbox/css/lightbox.css" rel="stylesheet" />

	<!-- JavaScript (must go in header) -->
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
	
	<!-- JavaScript For IE -->
		
	<!--[if (gte IE 6)&(lte IE 8)]>
		<script type="text/javascript" src="js/selectivizr-min.js"></script>
	<![endif]-->

<!-- END head -->
</head>

<!-- BEGIN body -->

    <body class="loading">
	
	<!-- BEGIN #background-wrapper -->
	<div id="background-wrapper">
	
	<!-- BEGIN #wrapper -->
	<div id="wrapper">
		
		
		<?php include("header.php") ?>
		
		
		<div id="page-header" style="background:url(/cmsAdmin/uploads/<?php echo htmlencode($galleries_introRecord['banner_image_name']) ?>) no-repeat top center;">

			<h2><font color="#FFFFFF" ><?php echo htmlencode($galleries_introRecord['title']) ?></font></h2>
		</div>

		<!-- BEGIN .content-wrapper -->
		<div class="content-wrapper clearfix">
			
			<!-- BEGIN .main-content -->
			<div class="main-content full-width page-content">
				
				<?php if ($galleries_introRecord['page_image_name']): ?><img src="/cmsAdmin/uploads/<?php echo htmlencode($galleries_introRecord['page_image_name']) ?>" class="event-image" alt="" /><?php endif; ?>
				<p><?php echo htmlencode($galleries_introRecord['intro_copy']) ?></p>
				
				
				<!-- BEGIN LIST -->

    			<!--gallery-->
<!--gallery-->
<?php if(!@$galleriesRecords): ?>


<?php else: ?>
  <div class="gallery">
<ul>
<?php $record_counter = 1; ?>
  <?php foreach ($galleriesRecords as $record): ?>
   <?php if($record_counter == 4) {$record_counter = 1;} ?>
                <li class="work-<?php echo $record_counter; ?>">

        <div class="gallery-bg">
        <div class="gallery-figur">
        <?php foreach ($record['gallery_image'] as $index => $upload): ?>
        	<?php if ($upload['hasThumbnail']): ?>
      	  		<img src="<?php echo $upload['thumbUrlPath'] ?>" alt=""/>
            	<?php break; //show first image only ?>
            <?php endif; ?>
        <?php endforeach; ?>
        </div>
        <div class="gallery-title">
           
         <?php $counter = 1; ?>
         <?php foreach ($record['gallery_image'] as $upload): ?>
         	<?php if($counter == 1) : ?>
            <a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[<?php echo $record['num'] ?>]"><?php echo $record['gallery_title']; ?></a>
            <?php $counter++; ?>
            <?php else : ?>
            <a href="<?php echo $upload['urlPath'] ?>" rel="lightbox[<?php echo $record['num'] ?>]" style="visibility:hidden;"></a>
            <?php endif; ?>
        <?php endforeach; ?>
        </div>
        </div>
        </li>
        <?php $record_counter++; ?>
<?php endforeach; ?>

</ul>
</div>
<?php endif; ?>
<!--gallery end-->
<!--gallery end-->

	    	  <!-- END .main-content -->	
			</div>
				
		<!-- END .content-wrapper -->
		</div>
		
		<!-- BEGIN #footer -->
		<div id="footer">
			
			<!-- BEGIN .content-wrapper -->
			<div class="content-wrapper clearfix">
				
				
				</div>
				
				
				</div>
				
				
				</div>
				
				
				</div>
				
				<div class="clearboth"></div>
				
				
				</div>
				
			<!-- END .content-wrapper -->
			</div>
		
		<!-- END #footer -->
		</div>
		
	<!-- END #wrapper -->
	</div>
	
	<!-- END #background-wrapper -->
	</div>
	
	
	
<!-- END body -->
</body>
</html>