 $(document).ready(function() {
 
 	$('.btn_izq a').click(function() { 	    	
	   $('.cont_not').hide();
	   mostrarNoticia($('#id_noticia').val() - 1);
	});
	
	precargarImagenes();
	
	$.preload([
		"images/tendencia0.png",
		"images/tecnologia0.png",
		"images/accion0.png"
	], {
		init: function(loaded, total) {			
		},
		loaded: function(img, loaded, total) {
		},
		loaded_all: function(loaded, total) {
		}
	});
	
  });
 
 
 function cargarAnimacion(){
	 $('.btn_dcha a').click(function() { 	   
		$('.cont_not').hide();
		mostrarNoticia($('#id_noticia').val() -0 + 1); // El .0 es para que siga siendo entero y no string
	});
	
	$('#pastilla_1').delay(200).animate({left: '0px'}, 'slow');
	$('#pastilla_2').delay(200).animate({top: '0px'}, 'slow'); 
	$('#pastilla_3').delay(200).animate({left: '660px'}, 'slow');
	
	
	$('#carrusel').delay(700).fadeIn();
	$('.noticias, .botones').delay(1000).fadeIn();
	
	//$('.imagen_recurso').delay(500).animate({left: '300px'}, 'slow'); 
	
	mostrarNoticia(2);
 }
 
 function mostrarNoticia(obj){
	$.ajax({
		type: 'GET',
		url: '_noticias_home.php',
		data: {id : obj},
		success: function(data) {			
			$('#carrusel').html(data);
			$('.cont_not').fadeIn();		
		}
	});
}

