function cambia_banner(){
	var lis = $("#slide_entradas .image_thumb ul li");
	for(var i=0;i<lis.length;i++){
		if($(lis[i]).is(".active")){
			if((i*1+1)==lis.length){
				$(lis[0]).click();
//				console.log("Cambio: 0");
				return false;
			}
			else{
				$(lis[(i*1+1)]).click();
//				console.log("Cambio: "+(i*1+1));
				return false;
			}
		}
	}
}
var auto = true;
var intervalo = "";

$(document).ready(function(){	
	$("#slide_entradas .main_image .desc").show(); //Mostrar banner
	$("#slide_entradas .main_image .block").animate({ opacity: 0.85 }, 1 ); //Poner opacidad
	
	$("#slide_entradas .image_thumb ul li:first").addClass('active'); //Clase para elemento seleccionado
	$("#slide_entradas .image_thumb ul li img,#slide_entradas .image_thumb ul li a").click(function(){
		auto = false;	
	});
	$("#slide_entradas .image_thumb ul li").click(function(){
		clearInterval(intervalo);
		if(auto) intervalo = setInterval("cambia_banner()",6000);
		
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgSrc = $(this).find('img').attr("src"); //Get Alt Tag of Image
		var imgTitle = $(this).find('h2 > a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('.block').html();  //Get HTML of the "block" container
		var imgDescHeight = $("#slide_entradas .main_image").find('.block').height(); //Find the height of the "block"
	
		if ($(this).is(".active")) {  //If the list item is active/selected, then...
			return false; // Don't click through - Prevents repetitive animations on active/selected list-item
		} else { //If not active then...
			//Animate the Description
			$("#slide_entradas .main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)
				$("#slide_entradas .main_image .block").html(imgDesc).animate({ opacity: 0.85,  marginBottom: "0" }, 250 ); //swap the html of the block, then pull the block container back up and set opacity
				$("#slide_entradas .main_image img").attr({ src: imgSrc , alt: imgAlt}); //Switch the main image (URL + alt tag)
				$("#slide_entradas .main_image a.imagen_grande").attr({ href: imgTitle}); //Switch the main image (URL + alt tag)
			});
		}
		//Show active list-item
		$("#slide_entradas .image_thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
		$(this).addClass('active');  //Add class of 'active' on the selected list
		$("#slide_entradas .main_image .info_entrada").html($(this).find(".info_entrada").html()); //Poner opacidad
		return false;
	
	}) .hover(function(){ //Hover effects on list-item
		$(this).addClass('hover'); //Add class "hover" on hover
		}, function() {
		$(this).removeClass('hover'); //Remove class "hover" on hover out
	});
	
	intervalo = setInterval("cambia_banner()",6000);
	
		

//	setTimeout("clearInterval("+id+")",15000);
	
	
	
});
