<?php
// Call in the XComponents engine and options file
define('MOD_PHP', substr(PHP_SAPI, 0, 3) != 'cgi'); // Are we running as mod_php?
define('DOCROOT', 
	MOD_PHP && isset($_SERVER['DOCUMENT_ROOT']) ? 
		$_SERVER['DOCUMENT_ROOT'] : 
		(
			MOD_PHP && isset($_SERVER['SCRIPT_FILENAME']) ? 
				substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF'])) : 
				(
					substr(str_repeat('../', count(explode('/', preg_replace('_/+_', '/', $_SERVER['PHP_SELF'])))-2), 0, -1) != '' ?
						substr(str_repeat('../', count(explode('/', preg_replace('_/+_', '/', $_SERVER['PHP_SELF'])))-2), 0, -1) :
						'.'
				)
		)
	);
include(DOCROOT . '/dmx/dmx_options.php');
include(DOCROOT . '/dmx/core/php/dmx_shop_handler.php');
include(DOCROOT . '/dmx/core/php/dmx_shop_components.php');

// Abs code starts here
$abs_root = '';
@include(DOCROOT . '/abs_version_control.php');
include(DOCROOT . $abs_root . '/common/header.php');
?>

	<?php
	// Search the current content directory for fragments and store filenames in arrays
	$dh = dir(DOCROOT . $abs_root . '/_PANELS/' . $abs_content['version'] . '/');
	while ($entry = $dh->read()) {
		if (substr($entry, 0, 8) == 'fragment') {
			list($entry,) = explode('.', substr($entry, 10));
			switch (substr($entry, 0, 3)) {
				case '.':
				case '..':
				case '.DS':
					break;
				case 'sb_':
					$sidebar[] = $entry;
					break;
				case 'sp_':
					$sidepage[] =$entry;
					break;
				default:
					$maincol[] = $entry;
					break;
			}
		}
	}
	$dh->close();
	?>

	<!-- STYLESHEET OVERRIDES FOR IN-PAGE POPUPS (or 'SIDEPAGES') -->
	<!-- These are normally hidden floating layers, but are shown in this page -->
	<style type="text/css">
	#sp_0, #sp_1, #sp_2, #sp_3, #sp_4, #sp_5, #sp_6, #sp_7, #sp_8, #sp_9
	{
		position: relative;
		visibility: visible;
		top: 0px;
		z-index: 0;
	}
	</style>	

<!-- MAIN CONTENT AREA -->
<div id="main_area" onmouseover="sub_menu_hide();">
	<div id="main_area_content">
		
		<div class="main_column">
		<!-- ----------------- -->
		<!-- BEGIN MAIN COLUMN -->
		<!-- ----------------- -->
			
<h1>Fragment reference page</h1>

<div id="teaser_1">
<?php abs_inc_panel('main1'); ?>
</div>
	
<h2 class="developer_highlight">Main column fragments</h2>

<?php
// Show fragments that appear in the main column
for ($i=0; $i<count($maincol); $i++) {
	echo '<br><p class="developer_highlight">' . $maincol[$i] . "</p>\n";
	abs_inc_fragment($maincol[$i]);
}
?>

		<!-- --------------- -->
		<!-- END MAIN COLUMN -->
		<!-- --------------- -->
		</div>
		
		<div class="sidebar">
		<!-- ------- -->
		<!-- SIDEBAR -->
		<!-- ------- -->
			
<div class="sidebar_box_heading">
	<h2>Controls</h2>
</div>
<div class="sidebar_box_content">
	<div>
		
		<p>
		<br>
		<a href="../index.php">CMS control centre</a><br>
		<a href="../adaptingbody/index.php">Adapting body index</a><br>
		</p>

		<p>
		<br>
		<strong>Conplex fragments</strong>
		</p>
		
		<p>
		<a href="sp_tariffs_demo.php">Tariffs fragment demo</a>
		</p>

	</div>
</div>

<h2 style="top-margin: 0px;" class="developer_highlight">Sidebar fragments</h2>

<?php
// Show sidebar fragments
for ($i=0; $i<count($sidebar); $i++) {
	echo '<br><p class="developer_highlight">' . $sidebar[$i] . "</p>\n";
	abs_inc_fragment($sidebar[$i]);
}
?>
		
		<!-- ----------- -->
		<!-- END SIDEBAR -->
		<!-- ----------- -->
		</div>
		
<br style="clear: both;">
<br>

<h2 class="developer_highlight">Sidepage fragments</h2>

<?php
// Show in-page popup layers
for ($i=0; $i<count($sidepage); $i++) {
	echo '<br><p class="developer_highlight">' . $sidepage[$i] . "</p>\n";
	abs_inc_fragment($sidepage[$i]);
}
?>

		
	</div>
</div>
<!-- END MAIN CONTENT AREA -->

<br style="clear: both;">
<br>

<?php include(DOCROOT . $abs_root . '/common/footer.php'); ?>
