#!/bin/csh -f
echo "Content-type: text/html"
echo ""
source build-opt-env

unsetenv PATH_INFO

if ( "${SUBSELS}x" == "x" ) then
  set DISPFULL=${OBJECT}
  set CALLFULL=${OBJECT}
  set CALLURL=${OBJECT}
else
  set DISPFULL="${OBJECT}(${DISPSS})"
  set CALLURL="${OBJECT}?${SUBSELS}"
  set CALLFULL="${OBJECT}(${SUBSELS})"
endif

cat << XXSTUFFXX
<html><head><title>Mathematical operations</title></head>
<body>
<a href="/math-help.html">
<img alt="[HELP]" align=right border=0 src="/images/helpbutton.gif"></a>
<h1>Mathematical operations</h1>
<b>Current object is:  $DISPFULL</b></br>
<hr noshade>
<p>
<ul>
<li>Create a variable by placing it on the left side of the equation.
<li>Legal operators are <tt>sin, cos, exp, ln, log10, int, +, -, *, /,^</tt>
<li>There are spaces for 4 formulas. Enter multiple formulas, if you wish. 
</ul>
<b>Example:  <tt>rho:=28.5-0.2*temp+0.7*(sal-35)</tt></b>

<form action="/jg/mathopt$CALLURL" method="POST">

<b><font size="5">Enter formula(s) below:</font></b>
<p>
<pre>      Variable    Formula to use to create it
</pre>
<ol>
<b>
<li><input name="lhs1" type="text" size="8">
:=
<input name="rhs1" type="text" size="25">
<font color=00cfcf size="5"><input type="submit" value="Go"></font>
<input type="reset" value="Clear all">
<p>
</b>
</ol>
Existing variables in this data object are:<br><b>
XXSTUFFXX
${OPTHOME}/bin/listvar "$CALLFULL"
cat << XXSTUFFXX
</b>
<ol START="2">
<li><input name="lhs2" type="text" size="8">
:=
<input name="rhs2" type="text" size="25">
<p>
<li><input name="lhs3" type="text" size="8">
:=
<input name="rhs3" type="text" size="25">
<p>
<li><input name="lhs4" type="text" size="8">
:=
<input name="rhs4" type="text" size="25"> 
</ol>
</form><p>
XXSTUFFXX
echo "</body></html>"
