// Please leave this comment in place
// Created by: bewise.fr
//
// This javascript file fix the bug with ajax in MOSS, which occurs on the second postback
function _spFormOnSubmitWrapper() {
    if (_spSuppressFormOnSubmitWrapper) {
        return true;
    }
    if (_spFormOnSubmitCalled) {
        return false;
    }
    if (typeof (_spFormOnSubmit) == "function") {
        var retval = _spFormOnSubmit();
        var testval = false;
        if (typeof (retval) == typeof (testval) && retval == testval) {
            return false;
        }
    }

    if ((typeof (Sys) != 'undefined') &&
    (typeof (Sys.WebForms) != 'undefined') &&
     (Sys.WebForms.PageRequestManager.getInstance() != null) &&
     (Sys.WebForms.PageRequestManager.getInstance()._postBackSettings.panelID != ''))
        _spFormOnSubmitCalled = false;
    else
        _spFormOnSubmitCalled = true;

    RestoreToOriginalFormAction();
    _spFormOnSubmitCalled = true;
    return true
}
