$(document).ready(function(){
    $(".tabbed").tabs("#sidebar > div", {
        current: 'current',
        effect: 'fade',
        tabs: 'li.tabs'
    });

    // add new effect to the tabs 
    $.tools.tabs.addEffect("slide", function(i, done) { 
 
        this.getPanes().slideUp();
 
        this.getPanes().eq(i).slideDown(function()  { 

            // the supplied callback must be called after the effect has finished its job 
            done.call(); 
        }); 
    });
    
    $("#accordion").tabs("#accordion div.pane", {tabs: 'h6', effect: 'slide', initialIndex: null});
    $("#accordion2").tabs("#accordion2 div.pane", {tabs: 'h6', effect: 'slide', initialIndex: null});
    
    if($("#wheeled").hasClass("small")){
        $("#wheeled.small").scrollable({ size: 4 }).mousewheel();
    } else {
        $("#wheeled").scrollable({ size: 6 }).mousewheel();
    }

    $('#slides').cycle({ 
        fx:    'fade', 
        timeout: 4000,
	    delay: 1000,
	    pause:   1,
        before: onBefore
    });

    function onBefore(currSlideElement, nextSlideElement, options, forwardFlag){
        var title = $(this).find('img').attr('alt');
        $('#banner h5 span').hide().fadeIn("slow").text(title);
    }
    
    $('.notification li').hide().fadeIn("slow").fadeTo("1.0", "slow").fadeOut("slow");
    
    var loading_img = $('<img />').attr('src', media_url + 'img/loader.gif');

    $('input[class="button reservation"]').click(function(){
        $(this).fadeOut("fast");
        $('form').append('<p class="waiting">Het reserveren kan even duren. Een ogenblik geduld. <br /></p>');
        $('form .waiting').append(loading_img);
    });
});
