﻿
function showProgress() {
    var TIMEOUT_WAIT_DURATION = 25;

    hidePage();

    //loading is visible by default
    //$("#loading").show();

    if (!window.isTimeoutSet) {
        window.isTimeoutSet = setTimeout(showTimeout, TIMEOUT_WAIT_DURATION * 1000);
    }

}

function showTimeout() {
    $("#timeout").show();
}

function hideProgress() {
    $("#loading").hide();
    hideTimeout();

    showPage();
}

function hideTimeout() {
    $("#timeout").hide();

    if (window.isTimeoutSet) {
        clearTimeout(window.isTimeoutSet);
        window.isTimeoutSet = undefined;
    }
}

function hidePage() {
    //we do this with inline styles
    //$("#maincontent, #footer").hide();
}

function showPage() {
    $("#maincontent, #footer").show();
}

// Process timeout set early on within page
showProgress();
