
var background_speed = 1000;

function slideSwitchForward(){

    background_speed = $('input[id*=TextBox2]').val();
    var $active = $('#slideshow .image.active');
    
    if ($active.length == 0) 
        $active = $('#slideshow .image:last');
    
    var $next = $active.next().length ? $active.next() : $('#slideshow .image:first');
    
    $active.addClass('last-active');
    
    $next.css({
        opacity: 0.0
    }).addClass('active').animate({
        opacity: 1.0
    }, parseInt(background_speed), function(){
        $active.removeClass('active last-active');
          animated= false;
    });
  
}

function slideSwitchBackward(){
 background_speed = $('input[id*=TextBox2]').val();
    var $active = $('#slideshow .image.active');
    
    if ($active.length == 0) 
        $active = $('#slideshow .image:last');
    
    var $next = $active.prev().length ? $active.prev() : $('#slideshow .image:last');
    
    $active.addClass('last-active');
    
    $next.css({
        opacity: 0.0
    }).addClass('active').animate({
        opacity: 1.0
    }, parseInt(background_speed), function(){
        $active.removeClass('active last-active');
        animated = false;
    });
   
}

