#!/usr/local/bin/perl5

if ($ENV{QUERY_STRING}=~ /name=(love|peace|truth|plenty)/) {
   $search= $1;
} else {
  print("Location: main.html\n\n");
  exit(0);
}
$new= $ENV{QUERY_STRING}=~ /newjoin/;

if ($new) {
    $desc= "<B>Welcome...</B>";
} else {
    $desc="";
}

open(POP, "enlist/people");

$count= 1;
$totalcount= 1;
$list= "";

if ($search eq "plenty") { $fontcolor="black"; }
else { $color = "black"; }

while (<POP>) {
    ($name, $email, $effort, $team, $img, $quotation)= split(/\#\#\#/);
    if( $team eq $search ) {
	$list.= "<TR align=center>\n<TD align=center><A href=";

	# Make the cell with the image:
	if ($img && $img ne "http://") {
	    $list.= "\"$img\"><img src=\"$img\"";
	} else {
	    $list.= "main.html><IMG src=eyes/logoEye.gif";
	}
	$list.= " border=0 height=70></A></TD>\n";

        # Make the cell with the name:
	$list.= "<TD align=center>";
        $list.= "<A href=mailto:$email><FONT size=+1><NOBR>$name</NOBR></FONT></A>";
        if( $totalcount <= 8 ) {
	    $list.= "<BR>Party Leader";
        }
        $list.= "</TD>\n";

	$quotation=~ s!///!<BR>!g;
        # Make the cell with the quotation:
	$list.= "<TD align=center><FONT color=$fontcolor>$quotation";
	$list.= "</FONT></td></tr>\n";
	$count++;
    }
    elsif ($team eq $search) {
	$capmail = $email;
    }
	
    $totalcount++;
}

$pic = $search._pic;
$n = $search._name;

if ($search eq "love") {
    $ministry = "Ministry of Love";
    $color = "red";
}
elsif ($search eq "plenty") {
    $ministry = "Ministry of Plenty";
    $color = "#666666";
}
elsif ($search eq "peace") {
    $ministry = "Ministry of Peace";
    $color = "white";
}
else {
    $ministry = "Ministry of Truth";
    $color = "#CCCCCC";
}


print <<EOF;
Content-type: text/html

<HTML>

<HEAD>

<TITLE>$ministry</TITLE>

<STYLE type="text/css">
<!--
A{text-decoration:none}
A:hover{color:yellow}
-->
</STYLE>

</HEAD>

<BODY bgcolor=$color text=black link=black vlink=black alink=black>

$desc

<CENTER>

<A href=main.html><IMG src=logos/$search.gif border=0 width=100></IMG></A>

<A href=main.html><H1><FONT color=black>$ministry</FONT></H1></A>
<BR>

<TABLE cellspacing=5 cellpadding=5 border=1 width=100%
bordercolor=black bordercolordark=black bordercolorlight=black>

$list

</TABLE>

<BR><!A href=main.html><!IMG src=eyes/logoEye.gif border=0><!/IMG></A>

</CENTER>

<BR><BR>

<CENTER>
[<A href=main.html><FONT color=black>Back</FONT></A>]
</CENTER>


</BODY>
</HTML>
EOF
    ;













