#! /bin/tcsh -f

set id1  = $1
set dir  = $id1
set sen1 = "`scripts/get_sensor.csh $id1`"
set sennam = "${sen1}(${id1})"
set testid = $id1

cd $dir

set ofile = index.html

echo "<html>" > $ofile
echo "  <head>" >> $ofile
echo "    <title>Level-2 Trends</title>" >> $ofile
echo "  </head>" >> $ofile
echo "<center>" >> $ofile
echo "  <body>" >> $ofile
echo "<br>" >> $ofile
echo "<h1>$sennam</h1>" >> $ofile
echo "<h1>Level-2 Trends</h1>" >> $ofile
echo "</center>" >> $ofile

if (-e scan) then
../scripts/make_scan_html.csh scan $id1 
echo "<li><a href="scan">Residual Scan Dependence</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e scan_total) then
../scripts/make_scan_html.csh scan_total $id1 
echo "<li><a href="scan_total">Normalized Scan Dependence</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e scan_perdet) then
../scripts/make_scan_html.csh scan_perdet $id1 
echo "<li><a href="scan_perdet">Residual Scan Dependence per Detector</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e det) then
../scripts/make_det_html.csh det $id1 
echo "<li><a href="det">Residual Detector Dependence</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

if (-e det_perscan) then
../scripts/make_det_perscan_html.csh det_perscan $id1 
echo "<li><a href="det_perscan">Residual Detector Dependence per Scan Pixel Range</a></li>" >> $ofile
echo "<p>" >> $ofile
endif

echo "</body></html>" >> $ofile

exit 0



