﻿$(function() {
    // het menu aanroepen
    $('ul.sf-menu').superfish({
        autoArrows: false,
        animation: { opacity: 'show', height: 'show' },  // fade-in and slide-down animation 
        speed: 'normal'                          // faster animation speed 

    });
    resizeWindow();
    //om de projecten slider te tonen als javascript aan staat
    $("#projecten").css("display", "block");
    $("#projecten").css("height", "200px");

    //rechterkolom omkadering alleen tonen als die inhoud heeft       
    if ($("#rightcol .box").children().length == 0) {
        $("#rightcol .box").hide();
    }

    //deobfuscate email adressen
    $("a[href^=znvygb:]").each(function() {
        //deobfuscate de link
        var email = $(this).attr('href');
        email = email.replace("*", "@");
        $(this).attr('href', $.rotate13(email))
        //deobfuscate text indien deze ook een email adres bevat
        if ($(this).html().match(/[*]/)) {
            //console.log("* gevonden in link text")
            var linktext = $(this).html();
            linktext = linktext.replace("*", "@");
            $(this).html($.rotate13(linktext));
        }
    });
});

$(window).bind("resize", resizeWindow);
function resizeWindow() {
	//de hoogte van de twocols div aanpassen aan schermhoogte
	var h = $(window).height();
	$("#twocols").css("min-height", h - 225);
	var w = $(window).width();
	//de rechter schaduw veroorzaakt een horizontale scrollbalk op breedte 1024, dus boven de 1000 scrollbalk weglagten, en schaduw tonen
	if (w>1000){
		$("body").css("overflow-x", "hidden");
		$("#rb").css("padding-right", "40px");
	} else {
		$("body").css("overflow-x", "scroll");
		//schaduw verbergen, zodat scrollbalk goede breedte heeft
		$("#rb").css("padding-right", "0px");
	}
}		

