﻿$(document).ready(function () {

    $("a#home_video").fancybox();

    $("a#home_video").click(function () {
        $("div#homeVideo").html($("div#video_content").html());
    });

    //home page carousel activation
    $(".main_carousel .carousel_controls > ul").tabs({ fx: { opacity: "toggle"} }).tabs("rotate", 15000, true);

    $('.carousel_controls ul li').mouseover(function () {
        $(this).find('a img.active_image').hide();
        $(this).find('img.inactive_image').show();
    }).mouseout(function () {
        $(this).find('a img.active_image').removeAttr('style');
        $(this).find('img.inactive_image').removeAttr('style');
    });


    //home page team slider
    $('.team_slider').Slider({
        speed: 800,
        pause: 5000
    });

    //home page gallery slider
    $('.photo_carousel').Slider({
        speed: 1200,
        pause: 2000,
        auto: false
    });

    //hide all buttons on sliders
    $('span.prevBtn, span.nextBtn').hide();

    //meat team block show hide buttons
    $('.meat_team_block').hover(function () {
        $('span.prevBtn, span.nextBtn', this).show();
    }, function () {
        $('span.prevBtn, span.nextBtn', this).hide();
    });

    //team photo block show hide buttons
    $('.team_photo_block').hover(function () {
        $('span.prevBtn, span.nextBtn', this).show();
    }, function () {
        $('span.prevBtn, span.nextBtn', this).hide();
    });

    //home page legend
    $('.legend a').hover(function () {
        var position = $(this).position();
        $(this).next().css('left', position.left - 4 + 'px');
        $(this).next().show();
    }, function () {
        $(this).next().hide();
    })
});

