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

    if ( $active.length == 0 ) $active = $('#new_product_slideshow div:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#new_product_slideshow div:first');

    $active.addClass('last-active');

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


$(function() 
{
    $('#new_product_slideshow div:first').addClass('active');
    setInterval("slideSwitch()", 4000);
});
