$datafile = 'abbrtb.txt';
$linkfile = 'linktb.txt';

foreach $title (a..z){
	$filename = 'index' . $title . '.htm';
	open(FILE, ">$filename");
	$tmp = $title;
	$title =~ tr/a-z/A-Z/;
	printf FILE ("<HTML>\n<HEAD>\n\t<TITLE>'97最新略語辞典～%s～</TITLE>\n</HEAD>\n\n",$title);
	printf FILE ("<BODY BGCOLOR=\"#ffffff\">\n");
	printf FILE ("<A HREF=\"%s.htm\" target=\"data\"><IMG SRC=\"graphic/%s.gif\" ALT=\"[%s]\" WIDTH=\"32\" HEIGHT=\"32\" BORDER=\"0\"></A><BR>",$tmp, $tmp, $title);
	printf FILE ("<P>\n<TABLE>\n");
#	printf FILE ("<FONT SIZE=\"-1\">\n");
	close(FILE);
}

open(DATA, $datafile);
while (<DATA>){
	@line = split(/\t/, $_);
	$key = $line[5]; #abbrkey
	$abbrid{$key} = $line[0];
	$abbr{$key} = $line[1];
	$categoryid{$key} = $line[2];
	$letter{$key} = $line[3];
	$description{$key} = $line[4];
	$abbrkey{$key} = $line[5];
	$hypertext{$key} = $line[6];
	$abbrname{$key} = $line[1];

	$abbridindex{$abbrid{$key}} = $abbrkey{$key};
}
close(DATA);

foreach $i (sort(keys %abbrkey)){
	$head = substr($abbrkey{$i}, 0, 1);
	$head =~ tr/A-Z/a-z/;
	$href = $head . '.htm#' . $abbrkey{$i};
	$file = 'index' . $head . '.htm';
	open(FILE, ">>$file");
	printf FILE ("<TR><TD><A HREF=\"%s\" TARGET=\"data\">%s</A><BR>\n",$href,$abbr{$i});
	close(FILE);
}

foreach $title (a..z){
	$filename = 'index' . $title . '.htm';
	open(FILE, ">>$filename");
#	printf FILE ("</FONT>\n");
	printf FILE ("</TABLE>\n");
	printf FILE ("\n</BODY>\n</HTML>\n");
	close(FILE);
}

