// JavaScript Document

function slideSwitch1() {
    var $active = $('#slideshow1 DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow1 DIV:last');

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

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');
		
		$active.fadeOut(500,function() {			
			$next.addClass('active').css("display","none")			
			//$next.addClass('active');
			$next.delay(200).fadeIn(500,function() {
					slideSwitch2(); //
			});
			$active.removeClass('active last-active');
		});
}

function slideSwitch2() {
    var $active = $('#slideshow2 DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow2 DIV:last');

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

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');
		
		$active.fadeOut(500,function() {			
			$next.addClass('active').css("display","none")			
			//$next.addClass('active');
			$next.delay(200).fadeIn(500, function(){
				slideSwitch3();
			});
			$active.removeClass('active last-active');
		});
}

function slideSwitch3() {
    var $active = $('#slideshow3 DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow3 DIV:last');

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

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');
		
		$active.fadeOut(500,function() {			
			$next.addClass('active').css("display","none")			
			//$next.addClass('active');
			$next.delay(200).fadeIn(500, function(){
				slideSwitch4();
			});
			$active.removeClass('active last-active');
		});
}

function slideSwitch4() {
    var $active = $('#slideshow4 DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow4 DIV:last');

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

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');
		
		$active.fadeOut(500,function() {			
			$next.addClass('active').css("display","none")			
			//$next.addClass('active');
			$next.delay(200).fadeIn(500, function(){
				//slideSwitch5();
			});
			$active.removeClass('active last-active');
		});
}


function slideSwitch5() {
    var $active = $('#slideshow5 DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow5 DIV:last');

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

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');
		
		$active.fadeOut(500,function() {			
			$next.addClass('active').css("display","none")			
			//$next.addClass('active');
			$next.delay(200).fadeIn(500, function(){
				slideSwitch6();
			});
			$active.removeClass('active last-active');
		});
}


function slideSwitch6() {
    var $active = $('#slideshow6 DIV.active');

    if ( $active.length == 0 ) $active = $('#slideshow6 DIV:last');

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

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );

		$active.addClass('last-active');
		
		$active.fadeOut(500,function() {			
			$next.addClass('active').css("display","none")			
			//$next.addClass('active');
			$next.delay(200).fadeIn(500, function(){
				//slideSwitch1();
			});
			$active.removeClass('active last-active');
		});
}

