﻿$(document).ready(function() {


    // lcick event naar de login-pagina
    $('#Footer_nav-web-menu-item-3-depthnr2').click(function(e) {
        window.location = "/templates/MTM/Inschrijven.aspx";
        e.stopPropagation();
        e.preventDefault();
        return false;
    });
    

    $("ul.breadCrumb li:first a").addClass("firstItem");

    //$("ul.mainMenu li:last-child ul").css("margin-left", "-60px");

    //$("ul.mainMenu li:last-child ul li ul").css("margin-left", "-200px");

    $("#inschrijving div.zoekprofielitem span span:nth-child(1)").css("width", "100px");
    $("#inschrijving div.zoekprofielitem span span:nth-child(2)").css("width", "60px");
    $("#inschrijving div.zoekprofielitem span span:nth-child(3)").css("width", "75px");

    $("ul.mainMenu li:nth-child(1)").addClass("listItem1");
    $("ul.mainMenu li:nth-child(2)").addClass("listItem2");
    $("ul.mainMenu li:nth-child(3)").addClass("listItem3");
    $("ul.mainMenu li:nth-child(4)").addClass("listItem4");
    $("ul.mainMenu li:nth-child(5)").addClass("listItem5");
    $("ul.mainMenu li:nth-child(6)").addClass("listItem6");

    // FAQ ---------------------------------------------------------------------------/
    $('.Toggler').hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); });
    //$('.Toggler .faqAntwoord:first').show();
    $('.Toggler').click(function() {
        var i = $('.Toggler').index(this);
        $('.Toggler .faqAntwoord').hide();
        $('.Toggler .faqAntwoord').eq(i).show();
        $('.Toggler').removeClass('active');
        $(this).addClass('active');
    });

    // functionaliteit voor de slideshow op de header
//    $('.slideshow').cycle({
//        fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
//    });

    //Print event
    $('.print').click(function() {
        window.print();
        return false;
    });

    ///////////////////////////////////////////////////////////////////////////////////////
    // footer slide functionaliteit
    // als je op de footer klikt schuift het naar boven
    // klik je vervolgens ergens buiten de footer, dan schuit het naar beneden
    ///////////////////////////////////////////////////////////////////////////////////////
    var positionFooter = 'down';
    var footerClicked = false;

    $("#footer").click(function(e) {
        positionFooter = 'up';
        footerClicked = true;
    });

    $("#contentBody").click(function(e) {
        if (positionFooter == 'up' && footerClicked) {
            positionFooter = 'down';
            $("#footer").animate({ "height": "376px" }, "fast");
        }
        else {
            footerClicked = false;
            positionFooter = 'up';
            $("#footer").animate({ "height": "75px" }, "fast");
        }
    });
    ///////////////////////////////////////////////////////////////////////////////
    ///////////////  Einde footer slide functionaliteit  //////////////////////////
    ///////////////////////////////////////////////////////////////////////////////
});

function ElfProef(bsn) {
    // verwijder alle tekens die geen cijfers zijn
    bsn = bsn.replace(/\D/, "");
    var x = 9;
    var aantal_tekens = bsn.length;
    var som = 0;
    // loop door de eerste 8 cijfers met de 11 proef formule
    for (i = 0; i < aantal_tekens - 1; i++) {
        getal = bsn.charAt(i);
        som += getal * (x - i);
    }
    //Laatste cijfer niet met 1 maar -1 vermenigvuldigen
    getal = bsn.charAt(aantal_tekens - 1);
    som += getal * -1;
    // geef resultaat van check terug
    if (som % 11 == 0 && aantal_tekens == 9) {
        return true
    } else {
        return false
    }
}
