var	dc_activo = 1;

var dc_timer;


jQuery(document).ready( function() {

	// Inicializar
	dc_to('play');

} );


function	dc_to ( target ) {
	
	var next;


	if ( target != '' && target != 'play' ) {
		
		clearTimeout(dc_timer);

		jQuery('.data-central .controles .pause').hide();
		
		jQuery('.data-central .controles .play').show();

	}

	
	// Play slideshow
	if ( target == 'play' ) {

		dc_timer = setInterval( function() {
		
			dc_to('');

		}, 5000);


		jQuery('.data-central .controles .play').hide();
		
		jQuery('.data-central .controles .pause').show();

	// Previo slideshow
	} else if ( target == 'prev' ) {
		
		next = ( dc_activo == 1 ? 3 : dc_activo-1 );


	// Específico
	} else if ( target == '1' || target == '2' || target == '3' ) {

		next = target;


	} else {
		
		next = ( dc_activo == 3 ? 1 : dc_activo+1 );

	}


	if ( target != 'play' && target != 'stop' ) {
		
		jQuery('.data-central ul .dc-' + dc_activo).hide();
		
		jQuery('.data-central .cuadros .dc-' + dc_activo).removeClass('activo');
	
	
		jQuery('.data-central ul .dc-' + next).show();
		
		jQuery('.data-central .cuadros .dc-' + next).addClass('activo');
		
		
		dc_activo = next;

	}


	return false;

}
