// definieer kleuren CDT (uit logo)
var $kleurcdt = {
    rood: '#e81b18',
    geel: '#f7df19',
    oranje: '#f87019',
    blauw: '#61c5f6'
};

var $maincols = ['cdt', 'duikschoolcdt', 'duiken', 'contact', 'http://www.cdt-brugge.be/CDT'];

var disclaimerStatus = false;

var aantalSubmenuFigs = 13;

var initDisclaimer = function(){
    $('#footer p span.link').click(function(event){
        enableDisclaimer();
    })
    
    $('div#disclaimerbackground').click(function(){
        disabeleDisclaimer();
    })
    
    $('a#disclaimerClose').click(function(){
        disabeleDisclaimer();
    })
    
    
    // met muis over link in footer
    $('#footer p span.link').hover(function(){
        $(this).css({
            'color': $kleurcdt.rood,
            'cursor': 'pointer'
        })
    }, function(){
        $(this).css({
            'color': 'black'
        })
    });
    
    // alle links
    $('a').css({
        'color': 'black'
    })
    $('a:not(#disclaimerClose)').hover(function(){
        $(this).css({
            'color': $kleurcdt.rood,
            'cursor': 'pointer'
        })
    }, function(){
        $(this).css({
            'color': 'black'
        })
    });
    
    //opacity
    $('div#disclaimerbackground').css({
        opacity: 0.9
    })
    
    $('div#main > div#header > #submenudock > div > div.submenuBtn img').css({
        opacity: 0.0
    })
}


$(document).ready(function(){

    // voeg ids toe aan tekstkolommen
    $('div#textparts div.main').each(function(){
        $(this).attr('id', 'col' + $maincols[$(this).index()]);
    })
    
    initDisclaimer();
    
    (new hoofdMenu()).maak($('#mainmenudock'));
    
    // disable het gebruik van tab om van link naar link te springen
    // one-page website wordt niet goed weergegeven door het gebruik van tab
    $('a').attr('tabindex', '-1');
});

// scroll naar eerste pagina, kan pas als volledig geladen
$(window).load(function(){
    ($('#lnkmenucdt')).trigger('click');
});



// extra hulpfuncties voor jquery
jQuery(function($){
    // hoe scrollen naar tekst-element ('hoe ver oversturen?'), instellingen easing 
    $.easing.elasout = function(x, t, b, c, d){
        var s = 0.1;
        var p = 0;
        var a = c;
        if (t == 0) 
            return b;
        if ((t /= d) == 1) 
            return b + c;
        if (!p) 
            p = d * 1.75;
        if (a < Math.abs(c)) {
            a = c;
            var s = p / 4;
        }
        else 
            var s = p / (2 * Math.PI) * Math.asin(c / a);
        return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
    }
})

// definieer een random-functie tussen een minimun en maximum
jQuery.extend({
    random: function(min, max){
        return Math.round(min + ((max - min) * (Math.random() % 1)));
    }
});

