<script type="text/javascript">
fob = document.forms[0];
function calc()
{
n1 = fob.num1.value;
n2 = fob.num2.value;
d1 = fob.den1.value;
d2 = fob.den2.value;
err = false;
if (n1 == "" || d1 == "")
{
err=true;
alert("Both values on the left side of the equation need to have values.");
}
if (n2 == "" && d2 == "")
{
err=true;
alert("Only one of the values on the right side of the equation can have a value.");
}
if (!err)
{
if (n2 == "")
{
fob.num2.value = Math.round(d2 * n1 / d1);
}
if (d2 == "")
{
fob.den2.value = Math.round(d1 * n2 / n1);
}
}
}
</script>