$(function(){ 
    // init and stop the inner slideshows
    var inners = $('.slide-up').cycle().cycle('stop');
	
    var slideshow = $('#home-slides').cycle({
    fx: 'fade',
    speed: 300,
    timeout: 0,
    before: function(curElement, nextElement, options, forwardFlag) {
        if($(nextElement).children('.slide-up').length != 0) {
            $(nextElement).children('.slide-up').cycle({
                fx: 'fade',
                timeout: 2000,
                autostop: true,
                end: function() { slideshow.cycle('next'); }
            });
        }
        else {
            setTimeout(function(){ slideshow.cycle('next'); }, 2000);
        }
    }
});

});

