var timeout;
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
function cycleImages(){
    var active = jQuery('.header .featured_image .active');
    var next = (jQuery('.header .featured_image .active').next().length > 0) ? jQuery('.header .featured_image .active').next() : jQuery('.header .featured_image img:first');
    next.css('z-index',2);//move the next image up the pile
	  active.fadeOut(1500,function(){//fade out the top image
	  active.css('z-index',1).show().removeClass('active');//reset the z-index and unhide the image
    next.css('z-index',3).addClass('active');//make the next image the top one
    });
  }
jQuery(document).ready(function() {
    jQuery('#carousel').jcarousel({
		scroll: 4,
        auto: 7.5,
        wrap: 'circular',
        //animationStepCallback:cycleImages,
        buttonNextHTML:null,
        buttonPrevHTML:null
    });
    timeout=setTimeout("cycleImages();",15000);
});
