/**
 * site.js
 */

$(document).ready(function()
{
    $('div.menu > a').textShadow();

    $('table.boat tr:even td').addClass('even');
    $('table.boat tr:odd td').addClass('odd');

    // home effects
    initHomeEffects();

    // initiate slideshow
    initSlideshow();

    if ($.browser.msie && parseInt($.browser.version) < 8) {
        ie_zIndex();
    }
});

function initHomeEffects()
{
	$('#big-slider').nivoSlider({
	    effect: 'fade',
	    pauseTime: 5000,
        pauseOnHover: true,
        directionNav: false,
        controlNav: false
    });

    setTimeout(function() {
    	$('#small-slider1').nivoSlider({
    	    effect: 'fade',
    	    pauseTime: 4500,
            directionNav: false,
            controlNav: false
        });
    }, 1500);

    setTimeout(function() {
    	$('#small-slider2').nivoSlider({
    	    effect: 'fade',
    	    pauseTime: 4500,
            directionNav: false,
            controlNav: false
        });
    }, 3000);

    $('a.quicklink').hover(
        function() {
            $(this).stop().animate({
                backgroundColor: "#98989a",
                color: "#feffff"
            }, 250);
        },
        function(){
            $(this).stop().animate({
                backgroundColor: "#ececed",
                color: "#98989a"
            }, 250);
        }
    );

    $('a.offer').hover(
        function() {
            $(this).stop().animate({
                backgroundColor: "#2562c0"
            }, 250);
        },
        function(){
            $(this).stop().animate({
                backgroundColor: "#7fc732"
            }, 250);
        }
    );
}

function initSlideshow()
{
    $("a.slideshow").colorbox({
        slideshow:true, 
        opacity: 0.80,
        speed: 500,
        slideshowStart: "Play",
        slideshowStop: "Pauze",
        current: "Afbeelding {current} van {total}",
        previous: "vorige",
        next: "volgende"
    });
}

function ie_zIndex()
{
    $(function() {
    	var zIndexNumber = 1000;
    	$('div').each(function() {
    		$(this).css('zIndex', zIndexNumber);
    		zIndexNumber -= 10;
    	});
    });
}

