// Content Fixes and Interactions

(function($) {
    $.extend({
        init: function() {

            $(window).resize(function() {
            });

            $(window).load(function() {
                $(".PopupOverlay").click(function() {
                    $(this).hide();
                    $(".Popup").hide();
                });
                $(".Popup .PopupContent .Close").click(function() {
                    $(".PopupOverlay").hide();
                    $(".Popup").hide();
                    return false;
                });

                var snippets = $("img.processing");
                for (var i = 0; i < snippets.length; i++) {
                    $(snippets[i]).wrap(function() {
                        return '<div class="snippetswrapper">' + $(snippets[i]).html() + '</div>';
                    });
                }
				
				if(!$('#hoofdnavigatie').children('a:first').hasClass('actief')){
					var mainnavColors = new Array();
					mainnavColors = ['blue', 'orange', 'green', 'lila'];
					var usedNavs = $('#hoofdnavigatie').children('a:visible:not(:first)');
					var activeIndex;
					usedNavs.each(function(i){
						if($(this).hasClass('actief')){
							activeIndex = i;
						}
					});
					$('body').addClass(mainnavColors[activeIndex%mainnavColors.length]);
				}
				else {
					$('body').addClass('violet');
				}
				
            });
        }
    });

})(jQuery);

jQuery( function( $ ) {
	$.init(); // Inits content fixes
});
function OpenPopup() {
    $(".PopupOverlay").height($(document).height());
    var topMargin = -($(".Popup").height() + 10) / 2;
    $(".PopupOverlay").show();
    $(".Popup").css({ "margin-top": topMargin });
    $(".Popup").show();
}
