﻿$(function() {
    
    //if (!$('#slides').slides || (typeof $('#slides').slides) == 'undefined') {
    //    jQuery.getScript('/OneStopCMS/Core/jQuery/Plugins/SSlide/slides.min.jquery.js');
    //}

    $('#slides').slides({
        play: 5000,
        pause: 2500,
        hoverPause: true,
        effect: 'fade',
        preloadImage: '/OneStopCMS/Sites/CumberlandLodge2011/Theme/images/loading.gif',
        animationStart: function(current) {
            $('.caption').animate({
                bottom: -90
            }, 100);
            if (window.console && console.log) {
                // example return of current slide number
                console.log('animationStart on slide: ', current);
            };
        },
        animationComplete: function(current) {
            $('.caption').animate({
                bottom: 50
            }, 200);
            if (window.console && console.log) {
                // example return of current slide number
                console.log('animationComplete on slide: ', current);
            };
        },
        slidesLoaded: function() {
            $('.caption').animate({
                bottom: 50
            }, 200);
        }
    });


    // Changes body class for the third not so fancy link box on GC page
    var x = 0;
    $(".GCWrap .box").each(function() {
        x++;
        if (x == 3) { $(this).addClass("boxNoMargin"); x = 0; }
    });
    // Changes body class for the third not so fancy link box on SHP page
    var x = 0;
    $(".SHPWrap .box").each(function() {
        x++;
        if (x == 3) { $(this).addClass("boxNoMargin"); x = 0; }
    });

    $.featureList(
        $("#tabs li a"),
        $("#output li"),
        {
            start_item: 1
        });


    // Date Pickers for From- and To-Dates. (on home page)
    $(".fromDate").datepicker({ dateFormat: 'dd/mm/yy', showButtonPanel: true });
    $(".toDate").datepicker({ dateFormat: 'dd/mm/yy', showButtonPanel: true });

    //This be the noticeboard scroller config
    $('div.scrollable').scrollable
		    ({
		        size: 0,
		        items: '.channelSummaryContainer, .latestNewsContain',
		        vertical: true,
		        keyboard: false
		    });

});
