var animating;

function setPic(index) {
	if (index == picIndex) return;
	if (animating) return;
	
	animating = true;
	var currPic = $('#fp-news div.item:eq('+picIndex+')');
	var newPic =  $('#fp-news div.item:eq('+index+')');
	
	currPic.animate({opacity:0}, 500, function(){ $(this).css('display','none')});
	newPic.css('display','block');
	newPic.animate({opacity:1}, 500, function(){picIndex = index; animating=false;});
	
	$('.paging ul li a').removeClass('ac');
	$('.paging ul li:eq('+index+') a').addClass('ac');
}

function nextSlide() {
	if (slideCount <= 1) return;
	
	var nextInd = picIndex + 1;
	if (nextInd >= slideCount) {
		nextInd = 0;
	}
	
	setPic(nextInd);
}

