jQuery.fn.center = function (absolute) {
    return this.each(function () {
        var t = jQuery(this);

        t.css({
            position:    absolute ? 'absolute' : 'fixed', 
            left:        '50%', 
            top:        '50%', 
            zIndex:        '99'
        }).css({
            marginLeft:    '-' + (t.outerWidth() / 2) + 'px', 
            marginTop:    '-' + (t.outerHeight() / 2) + 'px'
        });

        if (absolute) {
            t.css({
                marginTop:    parseInt(t.css('marginTop'), 10) + jQuery(window).scrollTop(), 
                marginLeft:    parseInt(t.css('marginLeft'), 10) + jQuery(window).scrollLeft()
            });
        }
    });
};

$(function() {
	$('#header').click(function() {
		document.location.href = baseUrl + 'index';
	});
	
	$('input#start_wijzer').click(function() {
		document.location.href = baseUrl + 'vragen';
	});
	
	$('#bouwer,#keeper,#gelukszoeker,#rots').click(function() {
		$('div#' + this.id + '_uitleg').show();
	});
	
	$('div.close').click(function() {
		$(this).parents('div').eq(0).hide();
	});
	
	$('.antwoord').click(function() {
		$(this).parents('div').eq(1).find('div.active').removeClass('active');
		$(this).find('input').eq(0).attr('checked', 'checked');
		$(this).addClass('active');
	});
	
	$('.errorscontainer').center();
});
