
$(document).ready(function(){
	//Times miliseconds until the animations do the things
	var tiempo_inicio_anim = 0;
	var tiempo_entre_img = 7000;
	var tiempo_fade = 4000;
	var contador = 1;
	//Change max if you want to add or remove some photos, also enum the photos starting on 1 until the number that you want.
	var max = 10;
	
//$("#clickshow").click(function(){vistalech = divs ();});
	
	function animacion_simple() {

		// after 4000 ms show the second photo, 4000 ms later the third
		setTimeout(function() {
			// hide photo 1
	
			$(".foto"+contador).fadeOut(tiempo_fade);
			// Show photo +1
			if (max ==contador)	contador = 0;

			$(".foto"+(contador+1)).fadeIn(tiempo_fade);
			contador ++;
			animacion_simple();
		
		}, tiempo_entre_img);	
	}
	
	//Empezamos la animación a los 200 milisegundos
	setTimeout(function() {
		$(".logo").fadeIn(tiempo_fade);
		$(".foto1").fadeIn(tiempo_fade);
		animacion_simple();
	}, tiempo_inicio_anim);	
	
	slide("#sliding-navigation", 25, 15, 150, .8);
	divs();
});

function slide(navigation_id, pad_out, pad_in, time, multiplier)  
{  
    // creates the target paths  
    var list_elements = navigation_id + " li.sliding-element";  
    var link_elements = list_elements + " a";  
  
    // initiates the timer used for the sliding animation  
    var timer = 0;  
  
    // creates the slide animation for all list elements  
    $(list_elements).each(function(i)  
    {  
        // margin left = - ([width of element] + [total vertical padding of element])  
        $(this).css("margin-left","-180px");  
        // updates timer  
        timer = (timer*multiplier + time);  
        $(this).animate({ marginLeft: "0" }, timer);  
        $(this).animate({ marginLeft: "15px" }, timer);  
        $(this).animate({ marginLeft: "0" }, timer);  
    });  
  
    // creates the hover-slide effect for all link elements  
    $(link_elements).each(function(i)  
    {  
        $(this).hover(  
        function()  
        {  
            $(this).animate({ paddingLeft: pad_out }, 150);  
        },  
        function()  
        {  
            $(this).animate({ paddingLeft: pad_in }, 150);  
        });  
    });  
}


function divs()	
	{	
	$(".pShow").show(1000);
	$(".pShow").fadeIn(5000);			
	
	}//fin function

