How do I simplify this?
<script>
function calculate1() {
var subtotal = (prefix.form.quantity1.value) * (prefix.form.price1.value);
prefix.form.sum1.value = subtotal;
if (subtotal == "0"{
prefix.form.sum1.value = "";}
}
function calculate2() {
var subtotal = (prefix.form.quantity2.value) * (prefix.form.price2.value);
prefix.form.sum2.value = subtotal;
if (subtotal == "0"{
prefix.form.sum2.value = "";}
}
function calculate3() {
var subtotal = (prefix.form.quantity3.value) * (prefix.form.price3.value);
prefix.form.sum3.value = subtotal;
if (subtotal == "0"{
prefix.form.sum3.value = "";}
}
</script>
<form>
<tr>
<td align=right><input type="HIDDEN" name="price1" value="995">$995</td>
<td align=right><input type="text" NAME="quantity1" onBlur="calculate1()" SIZE='3'></td>
<td align=right>$<input type="text" NAME="sum1" SIZE='5'>
</td>
</tr>
<tr>
<td align=right><input type="HIDDEN" name="price2" value="150">$150</td>
<td align=right><input type="text" NAME="quantity2" onBlur="calculate2()" SIZE='3'></td>
<td align=right>$<input type="text" NAME="sum2" SIZE='5'></td>
</tr>
<tr>
<td align=right><input type="HIDDEN" name="price3" value="595">$595</td>
<td align=right><input type="text" NAME="quantity3" onBlur="calculate3()" SIZE='3'></td>
<td align=right>$<input type="text" NAME="sum3" SIZE='5'>
</td>
</tr>
<script>
function calculate1() {
var subtotal = (prefix.form.quantity1.value) * (prefix.form.price1.value);
prefix.form.sum1.value = subtotal;
if (subtotal == "0"{
prefix.form.sum1.value = "";}
}
function calculate2() {
var subtotal = (prefix.form.quantity2.value) * (prefix.form.price2.value);
prefix.form.sum2.value = subtotal;
if (subtotal == "0"{
prefix.form.sum2.value = "";}
}
function calculate3() {
var subtotal = (prefix.form.quantity3.value) * (prefix.form.price3.value);
prefix.form.sum3.value = subtotal;
if (subtotal == "0"{
prefix.form.sum3.value = "";}
}
</script>
<form>
<tr>
<td align=right><input type="HIDDEN" name="price1" value="995">$995</td>
<td align=right><input type="text" NAME="quantity1" onBlur="calculate1()" SIZE='3'></td>
<td align=right>$<input type="text" NAME="sum1" SIZE='5'>
</td>
</tr>
<tr>
<td align=right><input type="HIDDEN" name="price2" value="150">$150</td>
<td align=right><input type="text" NAME="quantity2" onBlur="calculate2()" SIZE='3'></td>
<td align=right>$<input type="text" NAME="sum2" SIZE='5'></td>
</tr>
<tr>
<td align=right><input type="HIDDEN" name="price3" value="595">$595</td>
<td align=right><input type="text" NAME="quantity3" onBlur="calculate3()" SIZE='3'></td>
<td align=right>$<input type="text" NAME="sum3" SIZE='5'>
</td>
</tr>