<?php
$title = "Time-series";
ini_set('include_path', './' . PATH_SEPARATOR . '../' . PATH_SEPARATOR . ini_get('include_path'));
include_once("include/header.php");
?>

    <!--
   **** start with layout component from http://getbootstrap.com/css/#grid
   Any relative links not in the same directory as the templated file should be prepended with
   <?php /* echo $BASEDIR */ ?>
-->
<?php

$dom = new DOMDocument;
$dom->loadHTMLFile('index.htm');

// Create the output document
$ndom = new DOMDocument;
$ndom->formatOutput = true;

// Extract the body
$xpath = new DOMXPath($dom);
$nodes = $xpath->query('/html/body/*');

// Copy it to the output document
foreach ($nodes as $rec) {
	$node = $ndom->importNode($rec,true);
	$ndom->appendChild($node);
}

// Delete some surplus nodes
$ndom->removeChild($ndom->firstChild); // imos header
$ndom->removeChild($ndom->firstChild); // null paragraph
/*
$ndom->removeChild($ndom->firstChild); // OceanCurrent - Time-series header
$ndom->removeChild($ndom->lastChild); // copyright etc
*/

/*
// Replace the links
foreach($ndom->getElementsByTagName('a') as $link ) {
	if ($link->hasAttribute( 'href' )) {
		$href = $link->getAttribute( 'href' );
		if ( substr($href,0,1) === '#' ) {
			// leave all hash anchors alone
			continue;
		}
		else if (( substr($href,0,5) != 'http:' )  and (substr($href,0,2) != '..' )) {
		//	$link->setAttribute( 'href', "relink.php?link=$href" );
			continue;  // do nothing for now
		}
	}   
}
*/

// print the beast.
echo "<h3>IMOS current meters on coastal and deep water moorings around Australia</h3>\n";
echo $ndom->saveHTML();

?>


<?php
include("include/footer.php");
?>
