function change_tab_ezreport(tab, action) {
    change_tab(tab, action, 'tab', 'ezreport');
}

function change_tab(tab, action, tab_prefix, div_prefix) {
    var old = document.getElementById(tab_prefix + '-current');
    var old_tab = document.getElementById(tab_prefix + '-' + old.name);
    var old_step = document.getElementById(div_prefix + '-' + old.name);

    var new_step = document.getElementById(div_prefix + '-' + tab);
    var new_tab = document.getElementById(tab_prefix + '-' + tab);

    var show_tab = document.getElementById(tab_prefix + '-show_tab');

    if (action == 'on') {
        if (show_tab) show_tab.value = tab;

        old.name = tab;
        old_tab.className = tab_prefix + '-off';
        old_step.style.display = 'none';

        new_tab.className = tab_prefix + '-on';
        new_step.style.display = '';
    } else if (action == 'over' && new_tab.className != tab_prefix + '-on') {
        new_tab.className = tab_prefix + '-over';
    } else if (new_tab.className != tab_prefix + '-on') {
        new_tab.className = tab_prefix + '-off';
    }
}

