var print_version_state = false;
var old_menu_display = '';
var old_header_display = '';
var lights_count = 0;


function print_version()
{
    print_version_state = !print_version_state;

    if (print_version_state)
    {
        document.body.id = 'print';

        if (window.navigator.userAgent.indexOf('MSIE')) {
            old_menu_display = document.getElementById('menu').style.display;
            old_header_display = document.getElementById('header').style.display;
            document.getElementById('menu').style.display = 'none';
            document.getElementById('header').style.display = 'none';
            if (document.getElementById('print_icon')) document.getElementById('print_icon').style.display = 'none';
        }

        lights_count = 0;
        window.setTimeout('lightBacklink()', 300);
    }
    else
    {
        document.body.id = '';

        if (window.navigator.userAgent.indexOf('MSIE')) {
            document.getElementById('menu').style.display = old_menu_display;
            document.getElementById('header').style.display = old_header_display;
            if (document.getElementById('print_icon')) document.getElementById('print_icon').style.display = 'block';
        }
    }

    return false;
}


function lightBacklink() {
    lights_count = lights_count + 1;
    obj = document.getElementById('print_backlink');
    if (obj) {
        if (Math.round(lights_count/2)*2 != lights_count) obj.style.visibility = 'hidden';
        if (Math.round(lights_count/2)*2 == lights_count) obj.style.visibility = 'visible';
        if (lights_count < 12) {
            window.setTimeout('lightBacklink();', 300);
        }
    }
}