/* 
 *      Basic jQuery photo rotator
 *      http://jonraasch.com/blog/a-simple-jquery-slideshow
 */

function slideSwitch() {
    var $active = $('div.active');

    if ( $active.length == 0 ) $active = $('.jquery_banner').first();
    
    var $next =  $active.next().attr('style')!= undefined ? $active.next() : $('.jquery_banner').first();

    $active.animate({opacity: 0.0}, 500,
        function(){
            $(this).css('display','none');

            $next.css({opacity: 0.0})
                .css('display','block')
                .addClass('active')
                .animate({opacity: 1.0}, 1000, function() {
                    $active.removeClass('active');
                });
        }
    );
}

$(document).ready( function(){ // default function BEGIN
    // setup rotator on home page
    $banner = $('.mainimg').children('div').first();
    $banner.addClass('active');
    setInterval( "slideSwitch()", 8000 );
});
