/**
 * @package    Church Resources
 * @subpackage View
 * @author     Stephen Callaghan
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 * @updated    07/10/2011
 */


function imageSwitch() {
  var $active = $('#homepic IMG.active');

  if ( $active.length == 0 ) $active = $('#homepic IMG:last');

  var $next =  $active.next().length ? $active.next()
    : $('#homepic IMG:first');

  $active.addClass('last-active')
    .css({opacity: 1.0})

  $next.css({opacity: 0})
    .addClass('active')
    .animate({opacity: 1.0}, 1500, function() {
        $active.removeClass('active last-active');
    });
}


$(window).load(function() {
  $(function() {
    /*$('#homepic IMG.last-active').animate({opacity: 0});*/
    setInterval( "imageSwitch()", 8000 );
  });
});

