

// slideshow1:

function slideSwitch1() {
    var $active = $('#slideshowok1 DIV.activeok');

    if ( $active.length == 0 ) $active = $('#slideshowok1 DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshowok1 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');

    $next.css({opacity: 0.0})
        .removeClass('notactiveok')
        .addClass('activeok')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('activeok last-active');
        });
}

// slideshow2:

function slideSwitch2()
{
    var $active = $('#slideshowok2 DIV.activeok');

    if ( $active.length == 0 ) $active = $('#slideshowok2 DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshowok2 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');

    $next.css({opacity: 0.0})
        .removeClass('notactiveok')
        .addClass('activeok')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('activeok last-active');
        });
}
 function slideSwitch3()
{
    var $active = $('#slideshowok3 DIV.activeok');

    if ( $active.length == 0 ) $active = $('#slideshowok3 DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshowok3 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');

    $next.css({opacity: 0.0})
        .removeClass('notactiveok')
        .addClass('activeok')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('activeok last-active');
        });
}
 function slideSwitchdm()
{
    var $active = $('#slideshowokdm  DIV.activeok');

    if ( $active.length == 0 ) $active = $('#slideshowokdm  DIV:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshowokdm  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');

    $next.css({opacity: 0.0})
        .removeClass('notactiveok')
        .addClass('activeok')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('activeok last-active');
        });
}
// ham chung:

$(function() 
{
    setInterval( "slideSwitch1()", 4000 ); 
    setInterval( "slideSwitch2()", 4000 ); 
    setInterval( "slideSwitch3()", 4000 );  
    setInterval( "slideSwitchdm()", 4000 );  
});




