﻿
App = function () {

    /* Private */

    /* Properties */

    var cmp = {};





    /* Defaults */

    TVI.debug = true;





    /* Methods */

    var init = function () {

        /* Constructor */

        // GALLERY

        // Functionality
        $('.gallery .thumbnail').click(function () {

            // Get <img /> to move
            var imgToMove = $('.gallery .mainImgContainer IMG');

            // Change <img /> attributes
            imgToMove.attr('src', $(this).attr('data-mainImage'));

            $('.caption').html($(this).attr('data-caption'));

            return false;
        });

        $('.caseStudyGallery .thumbnail').live('click', function () {

            // Get <img /> to move
            var imgToMove = $('.caseStudyGallery .mainImgContainer IMG');

            // Change <img /> attributes
            imgToMove.attr('src', $(this).attr('data-mainImage'));

            $('.caption').html($(this).attr('data-caption'));

            return false;
        });

        if ($('.caseStudyItem').length != 0) {
            $('.caseStudyItem').fancybox({
                padding: '0',
                cyclic: true
            });
        }


        $('#navServices a:first').click(function () {
            $('#servicesDropdown').slideToggle("fast");
            $(this).toggleClass("open");
            return false;
        });

    };

    var menu = function (name) {
        TVI.ready(function () {

            $('#nav' + name).children('a').addClass('active');

        });
    };




    /* Public */

    TVI.apply(cmp, {

        /* Properties */

        test: 'test',

        /* Methods */

        menu: function (name) {

            menu(name);

        }


    });


    TVI.ready(init);


    return cmp;


} ();
