slideSwitch = function() {
	var $active = $('#slideshow li.active');
	
	if ( $active.length == 0 ) $active = $('#slideshow li:last');
	
	var $next =  $active.next().length ? $active.next()
        : $('#slideshow li:first');
    
    $active.addClass('last-active');

    $next.css({opacity: 0.0,display:'block'})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
			$active.css({display:'none'})
        });
}

onStartClick = function(el) {
	if (intval!='') {
		var title = $('#stop').html();
		$('#stop').html($(el).html());
		$(el).html(title);
		window.clearInterval(intval);
		intval='';
	} else {
		var title = $('#stop').html();
		$('#stop').html($(el).html());
		$(el).html(title);
		intval=window.setInterval( "slideSwitch()", 6000 );
	}
}
startSlider = function(){
	$('#slideshow li.active').css({opacity: 0.0,display:'none'});
	$('#slideshow li').removeClass('active last-active');
	$('#slideshow li:eq(0)').addClass('active');
	$('#slideshow li.active').css({opacity: 1.0,display:'block'});
	intval=window.setInterval( "slideSwitch()", 6000 );
}
$(document).ready(function() {
	startSlider();
});
