<?php
    require_once 'contents.php';
    require_once 'common.php';
    
    if (!is_numeric($_GET['p']))
    {
        header( 'Location: index.php' ) ; 
        exit;
    }
    
    $page = $_GET['p'] + 0;
    
    function drawLinkbar()
    {
        global $page;
        echo '<table width="100%" border="0"><tr><td width="33%">';
        if ($page > 0)
        {
            echo '<a href="page.php?p=' . strval($page-1) . '">';
            echo getEntryName($page - 1);
            echo '</a>';
        }
        echo '</td><td width="33%"><center><a href="index.php">Table of Contents</a></center></td><td width="33%">';
        if ($page < getLastEntryIndex())
        {
            echo '<p align="right"><a href="page.php?p=' . strval($page + 1) . '">';
            echo getEntryName($page + 1);
            echo '</a></p>';
        }
        echo '</td></tr></table>';
    }
    
    function screenshot($name)
    {
        global $page;
        $id = getEntryIdentity($page);
        echo '<center><img src="' . "images/${id}_$name.png" . '"/></center>';
    }
?>

<html>
    <head>
        <title>J2EE Setup Tutorial - <?php echo getEntryName($page); ?></title>
        <link rel="StyleSheet" href="./j2ee-tutorial.css" type="text/css"/>
    </head>
    <body>
        <center><?php homeLink(); ?></center>
    
        <?php drawLinkbar(); ?>
        
        <hr/>
    
        <h1><?php global $page; echo "$page. "; echo getEntryName($page); ?></h1>
        
        <?php global $page; include getEntryFilename($page); ?>
        
        <hr/>
        
        <?php drawLinkbar(); ?>
        
        <?php footer(); ?>
    </body>
</html>