#!/usr/bin/env perl

use CGI;

$q = new CGI;

$DocDir  = "/var/www/html/goodfight/leon";

$debug_me = $q->param('debug');

print $q->header('text/html');

print $q->Dump if $debug_me;

$token = $q->param('tk');

if ($token)
{
    &show_answer();
} else {
    print $q->start_html("Please choose a topic");
    print $q->h3("Please choose a topic from the list");
    print $q->hr;
    print $q->p($q->a({-href=>"/leon/index.php"}, "Back to Index"));
    print $q->p($q->a({-href=>"/index.php"}, "Back to The Good Fight"));
    print $q->end_html;
}

exit 0;

sub show_answer {
    print $q->start_html("Leon's Q & A");
    print $q->p($q->a({-href=>"/leon/index.php"}, "Back to Index"));
    print $q->p($q->a({-href=>"/index.php"}, "Back to The Good Fight"));

    print $q->p($q->font({-size=>"+1", -color=>"red"}, "We're in!")) if $debug_me;

    print $q->hr, "<PRE>\n";

    open(CMD, "< $DocDir/$token");
    while (<CMD>) {
	print;
    }

    print "</PRE>", $q->hr;

    print "If you have corrections, questions, comments or suggestions ",
          "about these questions and answers, please contact Leon Mauldin ",
          "directly at ";

    print $q->a({-href=>"mailto:leon.mauldin\@gmail.com"},
		"leon.mauldin\@gmail.com");

    print $q->hr;
    print $q->p($q->a({-href=>"/leon/index.php"}, "Back to Index"));
    print $q->p($q->a({-href=>"/index.php"}, "Back to The Good Fight"));
    print $q->end_html;

    0;
}