// Submit form with given name.
function submitForm(formName) {
	document.forms[formName].submit();
	return false;
}

// Set form action and submit form with given name.
function submitFormAndAction(formName, formAction) {
    var form = document.forms[formName];
    if (formAction) {
        form.action = formAction;
    }
    form.fakeSubmitButton.click();
    return false;
}

// Set the action of the first form and submit this form.
function submitAction(formAction) {
    if (document.forms[0]) {
        document.forms[0].action = formAction;
        document.forms[0].submit();
    } else {
        document.location.href = formAction;
    }
    return false;
}

var submitCount=0;
function documentSubmitted() {
    if (submitCount==0) {
        submitCount++;
        setCursorWait();
        //alert('document not submitted yet');
        return false;
    } else {
        //alert('document already submitted');
        return true;
    }
}

function resetDocumentStatus() {
    submitCount=0;
    resetCursor();
}

function setCursorWait() {
    document.body.style.cursor='wait';
}

function resetCursor() {
    document.body.style.cursor='auto';
}
