﻿
//Global JQuery Functions
//---------------------------------------------------------------------------


//Fade - Homepage Use
//---------------------------------------------------------------------------
$(document).ready(function () {
    $("#contentItems").children().hover(

    function () {
        $(this).siblings().stop().fadeTo(500, 0.4);
    },

    function () {
        $(this).siblings().stop().fadeTo(250, 1);
    });
});

//Carousel - Homepage Use
//---------------------------------------------------------------------------
$(document).ready(function () {
    function mycarousel_initCallback(carousel) {
        $("#ulPagnation a").bind('click', function () {
            carousel.scroll($.jcarousel.intval($(this).text()));
            return false;
        });    
    };

    $("#featuredContent").jcarousel({
        scroll: 1,
        auto: 8,
        wrap: "circular",
        initCallback: mycarousel_initCallback,
        buttonNextHTML: null,
        buttonPrevHTML: null,
        itemVisibleInCallback: { onAfterAnimation: function (c, o, i, s) {

            --i;

            $('#ulPagnation a').removeClass('selected').addClass('unactive');
            $('#ulPagnation a:eq(' + i + ')').removeClass('unactive').addClass('active');
        }
        }

    });   
});

//Colourbox - Contact Page Launch
//---------------------------------------------------------------------------
$(document).ready(function () {
    $(".launchContact").colorbox();
});

//Team - Tabs
//---------------------------------------------------------------------------
$(document).ready(function () {

    $("#teamInformation .teamInfoBox").hide();
    $("#teamBoxes .teamItem:first").addClass("active").show();
    $("#teamInformation .teamInfoBox:first").show();

    $("#teamBoxes .teamItem").click(function () {
        $("#teamBoxes .teamItem").removeClass("active");
        $(this).addClass("active");
        $("#teamInformation .teamInfoBox").hide();

        var activeTab = $(this).find("a.tabLink").attr("href");
        $(activeTab).fadeIn();
        return false;
    });
});

//Team - Tabs Amended
//---------------------------------------------------------------------------
$(document).ready(function () {

    $(".articleBoxes").hide();
    $("ul#ulNews li:first").addClass("active").show();
    $(".articleBoxes:first").show();

    //On Click Event
    $("ul#ulNews li").click(function () {

        $("ul#ulNews li").removeClass("active");
        $(this).addClass("active");
        $(".articleBoxes").hide();

        var activeTab = $(this).find("a").attr("href"); 
        $(activeTab).fadeIn();
        return false;
    });
});
