// when the form loads the session was technically refreshed
var ocSessionRefreshed = new Date();
// refresh only every 29 minutes (1540000 ms)
var ocSessionRefreshFrequency = 1540000;
var urlForOCRefresh = null;

/**
 * Ensures that the session is reset before submitting the form
 * @return whether or not the form submition should be made outside
 */
var makeEmptyJsRequest = function () {
    ajaxSubmit(
            'GET',
            urlForOCRefresh,
            null,
            null,
            function() {
                // ignore
            },
            function() {
                //ignore
            }
    );

    return false;
};

function initOCSessionRefresh(url) {
    urlForOCRefresh = url;

    setTimeout(makeEmptyJsRequest, ocSessionRefreshFrequency);
}