Submitted a form with javascript (based on variable)

I want to use Javascript to submit one of two forms,

“myform” and “myotherform”

If the value of TotalMinutes is greater then 0, I want to submit MyOtherForm, if it is 0(empty), I want to submit MyForm

The code I am using:

<script language=“javascript”>
totalMinutes = 0;

function calculateTotalMinutes(thisCheckbox){
if (thisCheckbox.checked)
totalMinutes += parseFloat(thisCheckbox.value);
} else {
totalMinutes -= parseFloat(thisCheckbox.value);
document.getElementById(“totalMinutes”).value = totalMinutes;
document.getElementById(“totalMinutes2”).value = totalMinutes;

<script type=“text/javascript”>
function submitform()

Once you’ve defined the variables, you could just do something like:

(totalMinutes > 0)
    ? myOtherForm.submit()
    : myForm.submit();