Não é possível obter variáveis globais dentro da função (javascript)

var selection = document.getElementById('selection');
var closed = true;

function openorclosebar() {

    if(closed == false){
        selection.style.webkitAnimation='bounceOutDown 1s forwards';
        selection.style.animation='bounceOutDown 1s forwards';
        closed = false;
    }
    else{
        selection.style.webkitAnimation='bounceInUp 1s forwards';
        selection.style.animation='bounceInUp 1s forwards';
        closed = true;
    };
}

Como posso obter variáveis globais "seleção" e "fechado" para usá-las. Eu tentei "window.selection" e "window.closed", mas nada ajuda. Se você tem uma idéia, me ajude, por favor, é um projeto tão importante.

questionAnswers(1)

yourAnswerToTheQuestion