﻿/// <reference path="jquery-vsdoc.js" />
//*************************************************************************************
// File     : braingnat.js
// Requires : jquery.js (version 1.3.2+), braingnat.js (version 0.4.5+)
// Author   : Kyle Weems (ksw)
// Origin   : mindfly.com
// Created  : Jun 15, 2010
// Modified : Jun 16, 2010
//*************************************************************************************

$(document).ready(function() {
    if ($('.home #banner').length > 0) {
        BrainGnat.slideshow.ajaxLoadCrossfade('/Controls/NHDY/imageList.aspx?dir=/Uploads/banner/', '.home #banner .wrapper', 'img', 5000, 1000, false);
    }
    if ($('.overlay ul li').length > 0) {
        $('.overlay li:first-child').addClass('active');
        var t = setTimeout('rotateTestimony();', 10000);
    }
});

function rotateTestimony() {
    $('.overlay .active').animate({ opacity: '0' }, function() {
        var i = $('.overlay li').index($('.overlay .active'));
        i++;
        $('.overlay .active').css({ opacity: 'auto', display: 'none' });
        $('.overlay .active').removeClass('active');
        if (i == $('.overlay li').length) {
            i = 0;
        }
        $('.overlay li:eq(' + i + ')').css({ display: 'block', opacity: '0' });
        $('.overlay li:eq(' + i + ')').animate({ opacity: '1' }, function() {
            $(this).addClass('active');
            $(this).css({ opacity: 'auto' });
            var t = setTimeout('rotateTestimony();', 10000);
        });
    });
}
