function slideSwitch() {

//active button
 var current= $('#onlist .on');
 
  if(current.next().length==0 ){
    $next_btn= $('#onlist li:first')
  }
  else {
    $next_btn=  current.next();
  }
$next_btn.addClass('on'); 
 current.removeClass('on'); 
     
     
//switch slide
    var $active = $('#slideshow div.active');

    if ( $active.length == 0 ) $active = $('#slideshow div:last');
    
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow div:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}
//end slideSwitch()

run=1;

$("#onlist li").hover(
  function () {
  
  	//stop animation
	clearInterval(timer);
	
  	//clear other hover states
  	
  	$('#onlist .on').removeClass('on');
    $(this).addClass('on');
    
    //find position
    var index = $("#onlist li").index(this);
    
    //change slide
    var $active = $('#slideshow div.active');
    var $next =  $('#slideshow div').eq(index);

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
    
    
  }, 
  function () {
  //restart animation 
    timer = setInterval("slideSwitch()", 5000);
  }
);


	$(function() {
    	timer=setInterval( "slideSwitch()", 5000 );
	});

