var delayPlanes = 5000;
var delayPromos = 6000;
var reinicioManual = false;
var reinicioManualPromos = false;
$(document).ready(function(){
			
	$('#contenedor_planes ul').css( "width", $('#contenedor_planes li').length * 300 );
	//$('#slideshow_contenido ul').css( "width", $('#slideshow_contenido li').length * 682 );
	
	$('#contenedor_planes').serialScroll({
		items: 'li',
		interval: delayPlanes,
		axis: 'x',
		duration: 1300,
		step: 1,
		start: 0,
		cycle: true,
		force: true,
		onBefore:function( e, elem, $pane, $items, pos ){
			//alert(pos);
			if( pos >= 3 ) {
				planesGoTo(0, '#contenedor_planes');
				reinicioManual = true;
				return false;
			} else if( pos == 1 ) {
				if( reinicioManual == true ) {
					setTimeout("planesGoTo(1, '#contenedor_planes')", delayPlanes, false);
					return false;
				} else {
					return true;
				}
			} else {
				return true;
			}
		}
	});
	
	/*$('#slideshow_contenido').serialScroll({
		items: 'li',
		interval: delayPromos,
		axis: 'y',
		duration: 1300,
		step: 1,
		start: 0,
		cycle: true,
		force: true
	});*/
});
function planesGoTo(pos, elemento, promos)
{
	if( reinicioManual == true ) reinicioManual = false;
	if( reinicioManualPromos == true ) reinicioManualPromos = false;
	$(elemento).trigger( 'goto', [ pos ] );
}
