var z, ativo, i, next = 1, iP, lnks;
function Change(x) {
	if (x == ativo) return false;
	ativo = x;
	$(lnks).removeClass('ativo');
	$($(lnks)[x]).addClass('ativo');
	var obj = $($('#box .slide')[x]);

	var texto = $(obj).children('.texto');
	clearInterval(i);
	$(texto).hide();
	
	$(obj).hide().css('z-index',z).fadeIn(400,function(){
		$(texto).slideDown(200);
	});
	z++;
	next = ativo;
	if (next < (num - 1)) next++; else next = 0;
}
$(function(){
	z = num = $('#box .slide').length;
	lnks = $('#box_selection a');
	$('#box_selection a').click(function(){
		Change($(this).attr('name'));
		clearInterval(iP);
		iP = setInterval(function(){
			Change(next);
		},6000);
		return false;
	});
	iP = setInterval(function(){
		Change(next);
	},6000);
	$($('#box .slide')[0]).children('.texto').slideDown(200);
	$($(lnks)[0]).addClass('ativo');
});

