$(document).ready(function () {
    initSlideshow();
    if (jQuery.embedSwf) {
        $.embedSwf();
    }

    /*IE5-IE6 support from conflicting absolute position*/
    var fixheight1 = $(".nav-left-content").height()
    $(".nav-left-middle").css({
        "height": fixheight1 - 117
    });

    var fixheight2 = $(".latest-news-content").height()
    $(".latest-news-middle").css({
        "height": fixheight2 - 129
    });


    if ($.browser.msie) {
        if ($.browser.version < 7) {
            fixMenuHover();
        }
    }
    initMenu();
    initSubMenu();
    
    fixPng();

    loadLightboxes();

    initInlineTooltips();
});

function fixMenuHover() {
    $('.nav-left-content ul li').hover(
        function () {
            $(this).css('background-image', 'url(images/nav-left-hover-ie6.png)');
            $(this).css('background-repeat', 'repeat-x');
            $(this).css('background-position', 'center center');
            //$(this).children('.subMenu').css('visibility', 'visible'); /* li:hover werkt niet in IE6 aangezien de hover in IE6 enkel het bovenste element neemt (dus de span of a in dit geval) */
        },
        function () {
            $(this).css('background-image', 'url(images/border-line.png)');
            $(this).css('background-repeat', 'no-repeat');
            $(this).css('background-position', 'bottom');
        }
    );
}

function fixPng() { /* ABSOLUUT ENKEL EN ALLEEN IN IE6 UITVOEREN, GEEFT ERROR IN IE7+ ! PLUS HET SCRIPT ZELF WORDT ENKEL IN IE6 GEINITIALISEERD ! */
    if ($.browser.msie) {
        if ($.browser.version < 7) {
            DD_belatedPNG.fix('.png');
        }
    }
}

function loadLightboxes() {
    $('a[rel^=lightbox]').prettyPhoto({
        animationSpeed: 'fast',
        padding: 50,
        opacity: 0.85,
        showTitle: true,
        allowresize: true,
        counter_separator_label: ' / ',
        theme: 'facebook',
        social_tools: '',
        deeplinking: false
    });
}

function initSlideshow() {
    $('#bannerslideshow').slides({
        preload: false,
        pagination: false,
        generatePagination: false,
        fadeSpeed: 5000,
        fadeEasing: "easeInOutSine",
        effect: 'fade',
        crossfade: true,
        play: 5000,
        hoverPause: false
    });
}

function initInlineTooltips() {
    $('.inlinetooltip').inputdescription({ correction_top: -1, correction_left: -20, color: '#878787' }); //voor nieuwsbriefinschrijving
}
