$(document).ready(function() {

    // Alle links met rel="external" in een nieuw venster openen
    $("a[rel=external]").each(function(i){
        this.target="_blank";
    });

    // Bij alle anker links de pagina url ervoor plakken
    sCurrentUrl = window.location.href;
    var iDashPos = sCurrentUrl.indexOf('#', 0);
    if(iDashPos !== -1){
        sCurrentUrl = sCurrentUrl.substring(0,iDashPos);
    }
    $('.tekstblok a[href^="#"]').each(function(){
       $(this).attr('href',sCurrentUrl + $(this).attr('href'));
    });

    // Prefill text for inputs
    $("input[type='text']").example(function() {
        return $(this).attr('title');
    }, {className: 'exampletxt'});

    // Form check fields
    $('.swisCheckField').val('swis_check_ok');

    // Forms submitten
    $('.btn-bewerkgegevens, .btn-mijngegevens').click(function(e){
        e.preventDefault();
        $('#bewerkGegevens').submit();
    });

    $('form .btn-maakeenkennistoets').click(function(e){
        e.preventDefault();
        $('#beginToets').submit();
    });

    // Wachtwoord popup
    $('.wwPopup').click(function(e){
        e.preventDefault();
        sUrl = $(this).attr('href');

        window.open(sUrl,'Wachtwoord','height=400,width=500');
    });

    // Overlay om ISSUU artikelen in te tonen
    $(".colorbox").colorbox({width:"90%", height:"90%", iframe:true});

    $(".profiel-wijzigen-toelichting").colorbox({width:"30%", inline:true, href:"#txt-profiel-wijzigen-toelichting"});

});


// Cufon!
Cufon.replace('.arvo, .toetsen ul li a, .headlines h3, .col-wrap h1, .col-wrap h2, .col-wrap h3', {
    hover: true,
    fontFamily: 'Arvo'
});

Cufon.replace('.mainnav a', {
    fontFamily: 'Gotham'
});

