﻿
/*
    tabContentSelect = the selector for the divs containing the actual content of the tab
    tabSelector = the selector for the UL tag containing the tabs
    tabActiveClass = the css class to place on the LI tag when a tab is active
*/
function initTabs(tabContentSelector, tabSelector, tabActiveClass)
{
    // setup the onclick event for each hyperlink
    $(tabSelector + " li a").click(
        function() {
            $(tabContentSelector + '.' + tabActiveClass).fadeOut('slow'); // hide the currently active tab content;
            $("ul." + tabClass + " li").removeClass(tabActiveClass); //Remove any "active" class
            $(this).parent('li').addClass(tabActiveClass); //Add "active" class to selected tab

            var activeTabIdx = $("ul." + tabClass + " li").index($(this).parent('li'));
            var activeTab = $(tabContentSelector + ':eq(' + activeTabIdx + ')');
            $(activeTab).fadeIn('slow'); //Fade in the active ID content
            return false;
        });
}

function initContentTabs(tabClass, tabContentSelector)
{
    //When page loads...
    $(tabContentSelector).hide(); //Hide all content
    $("ul." + tabClass + " li:first").addClass("active").show(); //Activate first tab
    $(tabContentSelector + ":first").show(); //Show first tab content

    //On Click Event
    $("ul." + tabClass + " li").click(
        function()
        {
            $("ul." + tabClass + " li").removeClass("active"); //Remove any "active" class
            $(this).addClass("active"); //Add "active" class to selected tab
            $(tabContentSelector).hide(); //Hide all tab content

            var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
            $(activeTab).fadeIn(); //Fade in the active ID content
            return false;
        });
}

function initHeaderTabs(tabClass, tabContentSelector)
{
    //When page loads...
    $(tabContentSelector).hide(); //Hide all content
    $("ul." + tabClass + " li:first").addClass("active").show(); //Activate first tab
    $(tabContentSelector + ":first").show(); //Show first tab content

    //On Click Event
    $("ul." + tabClass + " li").click(
        function() {
            $("ul." + tabClass + " li").removeClass("active"); //Remove any "active" class
            $(this).addClass("active"); //Add "active" class to selected tab
            $(tabContentSelector).hide(); //Hide all tab content

            var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
            $(activeTab).fadeIn(); //Fade in the active ID content
            return false;
        });
}


$(document).ready(function() {
	$('a.fancyImage').fancybox();
	$('a.fancyVideo').fancybox({'autoDimensions':true});
});


