#!/usr/bin/perl

@data=<>;

foreach $_ (@data) {
  $_ =~ s/$//;
  $_ =~ s/\<BODY\>/\<BODY bgcolor=\"#ffffff\"\>/i;
  $_ =~ s/Figure ([0-9])([a-d]) /\<a href=\"multisol.html#fig\1\"\>Figure \1\2\<\/a\> /g;
  $_ =~ s/Figure ([0-9]) /\<a href=\"multisol.html#fig\1\"\>Figure \1\<\/a\> /g;
  $_ =~ s/^Figure ([0-9])([a-d]) /\<a href=\"multisol.html#fig\1\"\>Figure \1\2\<\/a\> /g;
  $_ =~ s/^Figure ([0-9]) /\<a href=\"multisol.html#fig\1\"\>Figure \1\<\/a\> /g;
  $_ =~ s/ figure ([0-9])([a-d]) / \<a href=\"multisol.html#fig\1\"\>Figure \1\2\<\/a\> /g;
  $_ =~ s/ figure(s|) ([0-9])(| )/ \<a href=\"multisol.html#fig\2\"\>Figure\1 \2\3\<\/a\> /g;
  $_ =~ s/&lt;figure ([0-9])( |): /\<p\>\n\<center\>\<a name=\"fig\1\"\>\<img src=\"..\/figs\/gif\/multi\1x.gif\" border=0\>\<\/a\><a href=\"..\/figs\/gif\/multi\1x.gif\"\>\<p\>Figure \1\<\/a\>\<p\>/g;
  $_ =~ s/&gt;/\<\/center\>\<p\>\n/g;
  $_ =~ s/&lt;\<B\>Table/\<center\>\<B\>Table/g;
  $_ =~ s/Table ([I-V]*)/\<a href=\"multitab.html#table\1\"\>Table \1\<\/a\>/;
  $_ =~ s/(\[|,)([0-9]*)(\]|,)/\1<a href=\"multiref.html#\2\"\>\2\<\/a\>\3/g;
  print;
}
