<?
  if ( !isset($module) && (!$loggedIn) ) { $module='login'; };
  if ($module) {
      $headerfile = "views/$module/header.php";
      $footerfile = "views/$module/footer.php";
      $controllerfile = "controllers/$module/";
      if (isset($action) && $action != '') {
        $controllerfile .= "$action.php";
      } else {
        $controllerfile .= "index.php";
      }
      if (file_exists($headerfile)) {
          include($headerfile);
      }
      if (file_exists($controllerfile)) {
          include($controllerfile);
      } else {
          print "Cannot find module '$module' with action '$action'<br/>\n";
      }
      if (file_exists($footerfile)) {
          include($footerfile);
      }
  } else {
      include('start.php');
  }
?>
<script type="text/javascript">
  function adjustcontentheight() {
          $('#content').height(
              Math.max($('#navi').height(),
                       $('#content').height())
              );
  }
  $(document).ready(function() {
          adjustcontentheight();
  });
</script>
