#!/bin/sh

echo Content-type: text/html
echo

eval `echo $QUERY_STRING | sed -e "s/&/;/g"`

if [ $eostype -eq 1 ] 
then
   checked1=checked
elif [ $eostype -eq 2 ] 
then
   checked2=checked
elif [ $eostype -eq 3 ] 
then
   checked3=checked
elif [ $eostype -eq 4 ] 
then
   checked4=checked
elif [ $eostype -eq 5 ]
then
   checked5=checked
fi

echo "<html><head>

 <title>Thermodynamics on the Web</title>
 
 </head><body>

 <h1>Thermodynamics on the Web</h1>

 <p>
 Get thermodynamics values for any combination of temperature,
 density, hydrogen mass fraction and heavy elements mass fraction.

 <p>
 <form method=get action=\"/physics/therm/therm.cgi\">

 EOS Type:
 <input type=radio name=eostype value=1 "$checked1"> MHD (Z=0.02)
 <input type=radio name=eostype value=2 "$checked2"> OPAL (Z=0.02)
 <input type=radio name=eostype value=3 "$checked3"> ISG (Z=0.02)
 <input type=radio name=eostype value=4 "$checked4"> ISG (variable Z)
 <input type=radio name=eostype value=5 "$checked5"> OPAL 2001 (variable Z)

 <table width=100% cellpadding=5>
 <tr>
 <td> Temperature, K
 <td> <input name=temp size=50 value=\""$temp"\">

 <tr>
 <td> Density, g/cm^3
 <td> <input name=dens size=50 value=\""$dens"\">

 <tr>
 <td> Hydrogen mass fraction X (0.0 - 0.9)
 <td> <input name=x size=50 value=\""$x"\">

 <tr>
 <td> Heavy elements mass fraction Z (0.01 - 0.025)
 <td> <input name=z size=50 value=\""$z"\">

 </table>

 <p>
 <input type=\"submit\" value=\"Compute\">
 </form>

 <hr>
 "

cd bin
echo $temp $dens $x $z $eostype | ./web_therm.exe

echo "<hr>
 <i><a href=\"mailto:asv@sai.msu.su\">Send your comments</a> to Sergey Ayukov</i>
 </body></html>"
 
 