jQuery(function(){
	
	function resetElementos1() {
		jQuery('div.elementos-1').children('div').each(function(){
			jQuery(this).css({'display' : 'none'});
		});
	}
	
	function resetElementos2() {
		jQuery('div.elementos-2').children('div').each(function(){
			jQuery(this).css({'display' : 'none'});
		});
	}
	
	function resetElementos3() {
		jQuery('div.elementos-3').children('div').each(function(){
			jQuery(this).css({'display' : 'none'});
		});
	}
	
	function mostraElementos1() {
		jQuery('div.elementos-3').hide();
		resetElementos3();
		jQuery('div.elementos-1').show();
		jQuery('.elemento_sorvete').fadeIn(500,function(){
			jQuery('.que_lembra_1').fadeIn(500,function(){
				jQuery('.elemento_bola').fadeIn(500,function(){
					jQuery('.que_lembra_2').fadeIn(500,function(){
						jQuery('.elemento_joystick').fadeIn(500,function(){
							window.setTimeout(mostraElementos2,4000);
						});
					});
				});
			});
		});
	}
	
	function mostraElementos2() {
		jQuery('div.elementos-1').hide();
		resetElementos1();
		jQuery('div.elementos-2').show();
		jQuery('.elemento_amarelinha').fadeIn(500,function(){
			jQuery('.que_lembra_3').fadeIn(500,function(){
				jQuery('.elemento_balao').fadeIn(500,function(){
					jQuery('.que_lembra_4').fadeIn(500,function(){
						jQuery('.elemento_iphone').fadeIn(500,function(){
							window.setTimeout(mostraElementos3,4000);
						});
					});
				});
			});
		});
	}
	
	function mostraElementos3() {
		jQuery('div.elementos-2').hide();
		resetElementos2();
		jQuery('div.elementos-3').show();
		jQuery('.elemento_lapis').fadeIn(500,function(){
			jQuery('.que_lembra_5').fadeIn(500,function(){
				jQuery('.elemento_ilha').fadeIn(500,function(){
					jQuery('.que_lembra_6').fadeIn(500,function(){
						jQuery('.elemento_camera').fadeIn(500,function(){						
							window.setTimeout(mostraElementos1,4000);
						});
					});
				});
			});
		});
	}

	window.setTimeout(mostraElementos1,500);
	
});
	
jQuery(document).ready(function() {
	 jQuery(".insertpromo").fancybox({
		'padding'			: 0,
		'width'				: 570,
		'height'			: 300,
        'autoScale'     	: false,
        'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'titleShow'			: false
		});
});
