#!/usr/local/bin/perl
open (READ, "data");

$line = <READ>;
$count = 0;
while($line ne ""){
  if(($line eq "aa\n")||($line eq "aai\n")||($line eq "aau\n")||($line eq "aam\n")||($line eq "aan\n")||($line eq "aang\n")||($line eq "aap\n")||($line eq "aat\n")||($line eq "aak\n")||($line eq "ai\n")||($line eq "au\n")||($line eq "am\n")||($line eq "an\n")||($line eq "ang\n")||($line eq "ap\n")||($line eq "at\n")||($line eq "ak\n")||($line eq "ei\n")||($line eq "eng\n")||($line eq "ek\n")||($line eq "e\n")||($line eq "i\n")||($line eq "iu\n")||($line eq "im\n")||($line eq "in\n")||($line eq "ing\n")||($line eq "ip\n")||($line eq "it\n")||($line eq "ik\n")||($line eq "ou\n")||($line eq "o\n")||($line eq "oi\n")||($line eq "on\n")||($line eq "ong\n")||($line eq "ot\n")||($line eq "ok\n")||($line eq "oe\n")||($line eq "eoi\n")||($line eq "eon\n")||($line eq "oeng\n")||($line eq "eot\n")||($line eq "oek\n")||($line eq "u\n")||($line eq "ui\n")||($line eq "un\n")||($line eq "ung\n")||($line eq "ut\n")||($line eq "uk\n")||($line eq "yu\n")||($line eq "yun\n")||($line eq "yut\n")||($line eq "m\n")||($line eq "ng\n")){

    if ($count!=0){
        print WRITE ("</TABLE>\n</BODY>\n</HTML>\n");
      }

    chop($line);
    $name=$line;

    $line=$line.".html";
    open (WRITE, ">/can/finals/$line");

    print WRITE ("<HTML>\n");
    print WRITE ("<BODY background=\"/Img/matt3b.jpg\" BGCOLOR=moccasin>\n");
#    print WRITE ("<PRE>\n");
    print WRITE ("<table border=0 width=100%><tr><td>\n");
    print WRITE ("<img src=\"/Img/redtri.gif\"><font size=+2 color=red> $name</font>\n");   
    print WRITE ("<td align=right><a href=\"/Lexis/Canton/finals/53finals.html\"><img src=\"/Img/top.gif\" align=right border=0></a></table>\n");     
    print WRITE ("<p>\n");
    print WRITE ("<table cellpadding=5 border=1>\n"); 

    $count++;
    $line = <READ>;
    }
  else{
      chop($line); 
      @array=split(/:/,$line);
      chop($array[1]);
      @word=split(/ +/,$array[1]);
      
      print WRITE ("<tr><td valign=top><b>$array[0]</b><td valign=top><a href=\"/Lexis/Canton/sound/$array[0].wav\"><img src=\"/Img/sounder.gif\" hspace=3 border=0></a>\n");

      print WRITE ("<td>");
      $number=1;

      while($word[$number] ne ""){
           chop($word[$number]);
           #$word[$number]=split(/[\t ]+/,$word[$number]);
           print WRITE ("<a href=\"/cgi-bin/canton-f2.pl?query=$word[$number]\">$word[$number]</a>\n");
           $number++;
            }


      print WRITE ("</tr>\n"); 


      #print WRITE ($line);
      $line = <READ>;    
      }
    }
close(READ);
close(WRITE);  
