/* Portfolio Slideshow Image One Start */

function slideSwitchOne() {
    var $active = $('#portfolio-one img.active');

    if ( $active.length == 0 ) $active = $('#portfolio-one img:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#portfolio-one img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibsOne  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibsOne.length );
    var $next  = $( $sibsOne[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchOne()", 5300 );
});

/* Portfolio Slideshow Image One End */


/* Portfolio Slideshow Image Two Start */

function slideSwitchTwo() {
    var $active = $('#portfolio-two img.active');

    if ( $active.length == 0 ) $active = $('#portfolio-two img:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#portfolio-two img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibsTwo  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibsTwo.length );
    var $next  = $( $sibsTwo[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchTwo()", 3800 );
});

/* Portfolio Slideshow Image Two End */


/* Portfolio Slideshow Image Three Start */

function slideSwitchThree() {
    var $active = $('#portfolio-three img.active');

    if ( $active.length == 0 ) $active = $('#portfolio-three img:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#portfolio-three img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibsThree  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibsThree.length );
    var $next  = $( $sibsThree[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchThree()", 2700 );
});

/* Portfolio Slideshow Image Three End */


/* Portfolio Slideshow Image Four Start */

function slideSwitchFour() {
    var $active = $('#portfolio-four img.active');

    if ( $active.length == 0 ) $active = $('#portfolio-four img:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#portfolio-four img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibsFour  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibsFour.length );
    var $next  = $( $sibsFour[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitchFour()", 6000 );
});

/* Portfolio Slideshow Image Four End */