<script language=javascript>
function csclear()
{
document.cs.a1.value = '';
document.cs.b1.value = '';
document.cs.c1.value = '';
document.cs.res.value = '';
document.cs.res2.value = '';
var ss = document.getElementById('output');
ss.innerHTML = '';
document.cs.a.focus();
}
function isNum(args)
{
args = args.toString();
if (args.length == 0)
return false;
for (var i = 0; i
"9") && args.substring(i, i+1) != "."&& args.substring(i, i+1) != "-")
{
return false;
}
}
return true;
}
function cscheck(i)
{
var a1 = document.cs.a1.value;
var b1 = document.cs.b1.value;
var c1 = document.cs.c1.value;
//alert(c);
if (i == "1" && !isNum(a1))
{
a1 = a1.substring(0,a1.length-1);
document.cs.a1.value = a1;
return;
}
if (i == "2" && !isNum(b1))
{
b1 = b1.substring(0,b1.length-1);
document.cs.b1.value = b1;
return;
}
if (i == "3" && !isNum(c1))
{
c1 = c1.substring(0,c1.length-1);
document.cs.c1.value = c1;
return;
}
}
function calcs()
{
var a1 = document.cs.a1.value;
var b1 = document.cs.b1.value;
var c1 = document.cs.c1.value;
//alert(c1);
if (a1 == "" && b1== "" && c1 == "") {return;}
if (a1 == "") {return;}
if (b1 == "") {b1 = 0;}
if (c1 == "") {c1 = 0;}
var res = -1 * b1/ ( 2 * a1);
var res2 = res * res * a1 + res * b1 + parseFloat(c1);
res = res.toFixed(8);
res2 = res2.toFixed(8);
document.cs.res.value=res;
document.cs.res2.value=res2;
var ss = document.getElementById('output');
var str = ss.innerHTML;
if (str == "")
{
str = "Results:\n";
}
else
{
str =str.replace("
","");
str = str.replace("","");
str =str.replace("","");
}
var str2 = "When Y = " + a1 + "X2 + " + b1 + "+X ";
if (c1 != 0)
{
str2 += " " + c1 + " |
Then X = " + res + "; Y = " + res2 + " |
\n";
}
else
{
str2 += " X = " + res + "; Y = " + res2 + " | \n";
}
//alert(str);
str = str.replace("",str2);
str += "\n";
ss.innerHTML = str;
}
</script>