/*
$(document).ready(function(){
    $("div.expanded").removeClass("expanded").addClass("collapsed");
    //artikelen answer toggle
    $("div.answer h2 a").click(function() {
        if( $(this).parent("h2").parent("div").is(".collapsed") ) {
                $(this).parent("h2").parent("div").removeClass("collapsed").addClass("expanded");
        } else {
                $(this).parent("h2").parent("div").removeClass("expanded").addClass("collapsed");
        }
        return false;
    });
});
*/

function newWindow(theURL, winName, width, height) { //v2.0
    var screenX = screen.width;
    var screenY = screen.height;

    var popupWidth  = width;
    var popupHeight = height;

    var popupLeft = parseInt((screenX - popupWidth)  / 2);
    var popupTop  = parseInt((screenY - popupHeight) / 2);
    var prefixHref = location.pathname.substring(0, location.pathname.lastIndexOf ('/') + 1);

    browWindow=window.open(prefixHref + theURL, winName, 'width=' + width + ', height=' + height + ', top=' + popupTop + ', left=' + popupLeft + 'toolbar=0,resizable=1,scrollbars=0,location=0,directories=0,status=0,menubar=0');

    if(window.browWindow) {
        if(!window.browWindow.closed) {
            window.browWindow.focus();
        }
    }
}

function toggleAnswer(id) {
    var theId=id;
    if (document.getElementById) {
        if (document.getElementById(theId).style.display=="none") {
            document.getElementById(theId).style.display="";
        } else {
            document.getElementById(theId).style.display="none";
        }
    }
}

function toggleCorrectAnswer(elaborationId, id) {
    var theElaborationSetId='elaborations'+elaborationId;
    var theElaborationId='elaboration'+id;
    var theAnswerId='elaboration-img'+id;
    if (document.getElementById) {
        theElaborationHeader = document.getElementById(theElaborationId);
        theElaboration = document.getElementById(theElaborationId);
        theElaborationSet = document.getElementById(theElaborationSetId);
        if (theElaboration) {
            theElaboration.style.display="";
            theElaborationSet.style.display="";
        }

        theAnswer = document.getElementById(theAnswerId);
        if (theAnswer) {
            theAnswer.style.visibility="";
        }
    }
}

function toggleArticleAnswer(object) {
    if (object.parentNode.parentNode.className == "answer collapsed") {
        object.parentNode.parentNode.className = "answer expanded";
    } else {
        object.parentNode.parentNode.className = "answer collapsed";
    }
    return false;
}


