
    /**
     * News Module         
    */
    
    function goback() {
        history.go(-1);
    }

    /**
     * Tabs Controller
     * Element: Homepage_Tabs    
    */   
    
    $(document).ready(function() {
    
        /**
         * Schuivende blokken rechts
        */

        $(".sk-blok").css("cursor","pointer");
        $(".blok-rechts.click").css("cursor","pointer");

        $(".blok-rechts.click").click(function() {
            
            var href = $(this).find('a').attr('href');
            window.open(href,'_blank');
        });
        
        $(".blok-rechts.click").mouseenter(function() {
            
            $(this).addClass('hover');
            
            $(this).animate({
            'padding-left': '12px',
            'padding-top': '0px'
            }, 120, function() {    
            });
            
        }).mouseleave(function() {
        
            $(this).removeClass('hover');
        
            $(this).animate({
            'padding-left': '0px',
            'padding-top': '0px'
            }, 120, function() {    
            });
        });
        
        /**
         * Schuivende blokken boven
        */
        
        $(".sk-blok .overlay").fadeTo(1 ,'0.5');
        
        $(".sk-blok").mouseenter(function() {
        
            $(this).animate({
            'padding-top': '15px'
            }, 300, function() {    
            });
            
            $('.overlay',this).fadeTo(200,'0');
            
            
        }).mouseleave(function() {
        
            $(this).animate({
            'padding-top': '0px'
            }, 300, function() {
            
            });
            
            $('.overlay',this).fadeTo(200,'0.5');
        
        });
                
        /**
         * Kalender
        */
        
        $('.kalender tr td:not(:has(.kalender-ical))').click(function(){
        
            if($('a', this).length > 0){
           
                window.location = $('a', this).attr('href');
            } 
            
            return false;
        });
        
        $(".kalender tr").each(function() {
                    
            if($('a', this).length > 0){
                $(this).css("cursor","pointer");
            } else {
                $(this).css("cursor","auto");
            }
        });     
    });
    
    // begin het eerste plaatje te loaden    

    $(function(){
    
        var image_index = 0;
        var total = $('a.bg-slides').length;

        if(total > 0){
        
            var image = $('a.bg-slides')[0];
            
            var imageDOM = "<img src='"+ $(image).attr('href') +"' />";
            
            $(imageDOM).load(function(){
                $('.bg').css("background",'url(' + $(image).attr('href') + ') #030d17 no-repeat top center');
                
                if(total > 1) animateImage(1, total);
                
            });
        }
    });
    
    function animateImage(index, total){
        
        var image = $('a.bg-slides')[index];
        var index = index;
        var imageDOM = "<img src='"+ $(image).attr('href') +"' />";
        
        $(imageDOM).load(function(){
            
            $('.bg-helper').css("background-image", $('.bg').css('background-image'));
            $('.bg').css("background-image", 'url(' + $(image).attr('href') + ')');

            $('.bg-helper').css("opacity",1);
            
            index ++;
            if(index == total) index = 0;
            
              $('.bg-helper').delay(4000).animate({
                opacity: 0
              }, 2000, function() {
                animateImage(index, total);
              });
        });
    }

