function getBackgroundDimensions () {
    var container = $('#flashBackground');
    container.height($(document).height());
    var height = $(document).height();
    //alert('getBackgroundDimensions: ' + height);
    return (height);
}

function setDimensions () {
    var obj = thisMovie("flashBackgroundObject");
    if (obj && typeof obj.setDimensions=='function') {
        obj.setDimensions();
    }
}

function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

$(document).ready(function(){
    setDimensions();
    $(window).resize(function(){
        setDimensions();
    });
});

function init () {
    $('div.paged').paging({
        elementType: 'div',
        prevText: 'vorige',
        nextText: 'volgende'
    }).bind('pagingBeforePageChange',function(){
        $('>div',$(this)).removeClass('open');
    });
    
    $('div.toggleBttn a', 'div.boxcontent').each(function(i,a){
        if ( $(a).hasClass('flash-thickbox') ) {
            tb_init($(a));
        } else {
            $(a).click(function(){
                $('.boxcontent>div').not($(this).parent().parent()).removeClass('open');
		        $(this).parent().parent().toggleClass('open');
                getBackgroundDimensions();
		        return false;
            });
        }
    });
    
    $('h4', 'div.boxcontent').each(function(i,a){
        $(a).click(function () {
            if($('div.moreContent', $(this).parent()).length > 0) {
    		    $('.boxcontent>div').not($(this).parent()).removeClass('open');
	    	    $(this).parent().toggleClass('open');
                getBackgroundDimensions();
		        return false;
            }
        });
    });
    
    

	// Enable first FAQ item
	$('div.accordionlistblock.faqfirst a.active').click();

	$('div.starttestButton a').each(function(){
		tb_init($(this));
	});
}

$(document).ready(init);
