<?php if ($QUERY_STRING=="pastor") include "pastor.php3";
elseif ($QUERY_STRING=="worship") include "worship.php3";
elseif ($QUERY_STRING=="education") include "education.php3";
elseif ($QUERY_STRING=="activities") include "activities.php3";
elseif ($QUERY_STRING=="maps") include "maps.php3";
elseif ($QUERY_STRING=="history") include "history.php3";
else {
include "include/sitedefs.php3";
if (($QUERY_STRING=="home") or ($QUERY_STRING=="") or ($QUERY_STRING=="/")){ 
  heading("Welcome to $name") ?>
  <h1><img src="http://eternaltrinitylcms.org/images/cross.gif" alt=""  width=128 height=128 STYLE="float: left"><?php echo $name ?></h1>
<blockquote>
   <p><?php echo $address ?> see <a href="http://eternaltrinitylcms.org/maps.php3">map</a>
   <br>Telephone: (850)623-5780
<?php if ($fax!="") { ?> <br>Fax: <?php echo $fax; } ?>
<?php if ($email!="") { ?> <br>e-mail: 
   <a href="mailto:<?php echo "$pastor &lt;$email&gt;" ?>">
   <?php echo $email ?></a> <?php } ?>
</blockquote>
<?php navigation(); ?>
</td><td STYLE="background-color: white">
<table>
<tr>
<td>
Pastor: <a href="http://eternaltrinitylcms.org/pastor.php3"><?php echo $pastor ?></a>
<ul>
<li><a href="http://eternaltrinitylcms.org/worship.php3">Worship</a>: 
<?php echo $worshiptime ?></li>
<li><a href="http://eternaltrinitylcms.org/education.php3">S. S. and Bible Class</a>: 
<?php echo $sstime ?></li>
</ul>
</td>
<td>
<?php //<img src="http://eternaltrinitylcms.org/images/building.jpg" width="563" height="441" alt="Church and Fellowship Buildings"> ?>
<img src="http://eternaltrinitylcms.org/images/sm_building.jpg" width="265" height="165" alt="Church and Fellowship Buildings">
</table>

<p>Thank you for your interest in <?php echo $name ?>.
Eternal Trinity is a Christian congregation which belongs 
to the <a href="http://www.lcms.org">Lutheran Church Missouri 
Synod</a>. It is dedicated to preaching the Gospel of Jesus Christ
to all people.  We teach the historic Christian faith as we have received 
it through Scripture and as the Church has confessed it in the creeds and 
the Lutheran Confessions. You may find more resources describing what
Lutherans <a href="http://www.lcms.org/?112">believe</a> at the
Synod's site.
</p>

<p>
Please join us for worship or consider one of the other 
<a href="http://eternaltrinitylcms.org/activities.php3">activities</a> at <?php echo $name?>.
</p>
<?php include "include/special" ?>
<?php } 
elseif(file_exists(  "include/" . $QUERY_STRING . ".txt" ) ) {
  ereg("([a-z]+)([0-9]{4})",$QUERY_STRING,$issue);
  heading(ucfirst($issue[1]) . " " . $issue[2] . " Newsletter");
  navigation(); 
  echo "</td><td>\n";
  
  $column="include/" . $QUERY_STRING . ".txt";
  echo "<h3> Pastor's ".  ucfirst($issue[1]) . " " . $issue[2] . " Newsletter Column</h3>\n<p>";
  $file=fopen($column,"r");
  while (! feof($file)) {
    $line= str_replace("~"," ",str_replace("\\rm ","</EM>",str_replace("\\it ","<EM>",fgets($file,4096))));
    if (strlen($line)>1) echo $line;
    else echo "</P>\n<P>";
  }
  fclose($file);
?>

<img src="http://eternaltrinitylcms.org/images/signature.gif" width="256" height="64" alt="Pastor Thies" >
<? }
elseif ($QUERY_STRING=="news") {
  heading("What's New at $name");
  navigation(); 
  echo "</td><td>\n";
  $handle=opendir('news');
  while ($file=$articles[]=readdir($handle)) ;
  rsort($articles);
  function printarticle($filename) {
    if(!$filename) return false ;
    if(ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})-([0-9]{2})",$filename,$data))
      {
      if (mktime()<mktime(0,0,0,$data[2],$data[3]+$data[4],$data[1]))
        {
	echo "\n<h3>";
        echo date("F j, Y",mktime(0,0,0,$data[2],$data[3],$data[1]));
	echo "</h3><blockquote>\n<p>";
        $file=fopen("news/" . $filename,"r");
	while (!feof($file))
          {
	  echo $line=fgets($file,4096);
          if ($line=="\n") echo "<p>";
          }
	echo "</blockquote>\n";
	}
      }
    return true;
    }
  printarticle(current($articles));
  reset($articles);
  while(printarticle(next($articles)));
  closedir($handle);
}
elseif ($QUERY_STRING=="congregations") {
  heading("Neighboring Lutheran Congregations");
  navigation(); 
  echo "</td><td>\n";
$file = fopen("include/sisters","r");
  echo "<dl>\n";
while ( ! feof($file)) {
  $church = fgets($file,4096);
  $line=fgets($file,4096);
  echo "<dt>$church</dt><dd>";
  while ( !($line=="\n") ) {
    if (feof($file)) break ;
    echo "$line<br>";
    $line=fgets($file,4096);
    }
  echo "</dd>";
  }
echo "</dl>";
fclose($file);
} 
elseif (file_exists("." . $QUERY_STRING) ) {
if ( strstr($QUERY_STRING,".jpg") )
  header("Content-Type: image/jpeg");
else
  header("Content-Type: image/gif");
//readfile("/usr/local/apache/htdocs" . $QUERY_STRING);
readfile( "." . $QUERY_STRING);
exit;
}
elseif($QUERY_STRING=="plan9") {
  header("Content-Type: text/plain");
  readfile("include/log");
  exit;
}
else { 
header("http/1.1 404 Not Found");
?>
<HTML>
<?php //phpinfo() ?>
<HEAD>
<TITLE>404 File Not Found</TITLE></HEAD>
<BODY>
File Not Found
</BODY>
</HTML>
<?php exit; } 
makefooter(); 
} 
?>
