#!/usr/bin/perl

chdir "archives/rosegarden";
require "library.pl";

%input = &readInput;

$woman = $input{'woman'};

&dieNice('You must specify a woman to view her page.<br><br><br><br><br>') unless($woman);

&dieNice("Sorry, $woman was not found in the Sharlot Hall Museum website.<br><br><br><br><br>") unless(-e "text/$woman.txt");

if(-e "images/$woman.jpg") {
	$ext = 'jpg';
	$page = 'show_with_image';
} elsif(-e "images/$woman.gif") {
	$ext = 'gif';
	$page = 'show_with_image';
} else {
	$page = 'show_without_image';
}

$escWoman = $woman;
$escWoman =~ s/(\W)/sprintf("%%%x", ord($1))/eg;
$womanText = &getText("text/$woman.txt");
$womanText =~ s/\r\n/<br>/g;

if($input{'h'}) { # text specified to highlight
	$h = $input{'h'};
	$womanText =~ s/$h/<span class="highlight">$h<\/span>/ig;
	$styleX .= <<'EOB';
.highlight { font-weight:bold; font-style:italic }
EOB
}

$styleX .= <<'EOB';
.name { font-weight:bold; font-size:14pt }
EOB

$content = &interpretText("segments/$page.html");

if($h) {
	$content .= <<"EOB";
<hr width=100% size=1>
"$h," your search term, is shown highlighted above.  To turn off this feature, <a href="show.pl?woman=$escWoman">click here</a>.
EOB
}

&writePage;
