/* Document Information

- Document: Script JS
- Version:  1.0.0
- Client:   Focus on Ability
 
*/

var FoA = {

    Init: function () {
        this.RenderFonts();
        this.Modal();
        this.HomeBannerRotator();
    },
    RenderFonts: function () {
        if ($('.render').length > 0) {
            Cufon('.render', { hover: true });
        }
    },
    Modal: function () {
        if ($('.modal-link').length > 0) {
            $('.modal-link').fancybox({
                showCloseButton: false,
                showNavArrows: false,
                overlayColor: '#000',
                overlayOpacity: '0.6',
                autoScale: false
            });
        }
    },
    HomeBannerRotator: function () {
        if ($('.home-banner').length > 0) {

            $('.home-banner img').hide();

            var imgCount = $('.home-banner img').length;
            var currentImgIndex = 0;
            var image = $('.home-banner img');

            var delay = 5000;

            image.eq(currentImgIndex).fadeIn(1000);

            var infiniteLoop = setInterval(function () {
                image.eq(currentImgIndex).fadeOut(2500);

                if (currentImgIndex == imgCount - 1) {
                    currentImgIndex = 0;
                } else {
                    currentImgIndex++;
                }
                image.eq(currentImgIndex).fadeIn(2500);
            }, delay);
        }
    }
}

$(document).ready(function () {
    FoA.Init();
});
