
/**
* init
**/
$(document).ready(function(){
    Website.init();
});

Website.init = function() {

    this.initCufon();
    this.initFormCheckFields();
    this.initClearOnFocus();
    this.setExternalLinks();
    this.socialBoxHandlers();

};


// Alle links met rel="external" in een nieuw venster openen
Website.setExternalLinks = function() {

    $('a[rel="external"]').click( function() {
        window.open( jQuery(this).attr('href') );
        return false;
    });

}

/**
* Form Check Fields
**/
Website.initFormCheckFields = function() {

    $('.swisFormCheck').attr('value', Website.Config.sSpamCheckValue);

};

/**
* Input clear on focus
**/
Website.initClearOnFocus = function() {

    // clear input on focus
    $('.clearOnFocus').focus(function() {
        if($(this).val() == $(this).attr('title')) {
            $(this).val('');
        }
    });

    // if field is empty afterward, add text again
    $('.clearOnFocus').blur(function() {
        if($(this).val() == '') {
            $(this).val($(this).attr('title'));
        }
    });
}

/**
*	Cufon
**/
Website.initCufon = function() {

    Cufon.replace('.portalnav_alt h2', {fontFamily: 'dearjoe2'});
    Cufon.replace('.sr #main .tekstblok h1', {fontFamily: 'loved'});
    Cufon.replace('.sr #main .tekstblok h2', {fontFamily: 'loved'});
    Cufon.replace('.partners h2, .totaalbedrag span.bedrag span', {fontFamily: 'loved'});
    Cufon.replace('.twittercontainer  .twitter-header h2', {fontFamily: 'loved'});

}

Website.socialBoxHandlers = function(){
    $('.box-toggle').bind("click", function(e){
        e.preventDefault();

        $(this).closest(".box-3fm").toggleClass("closed");
    });
}


