// JavaScript Document
// Cambia stages del home
var timerID=0;
var actual=1;
var n;
function stopTimer()
{
	clearTimeout(timerID);
}
function startTimer()
{
	timerID = setTimeout("slide_efecto()", 1000);
}
function slide_efecto()
{
	stopTimer();
	n = $(".imager").size();
	
	if(actual<n)
	{
		anterior=actual;
		actual++;
	}else{
		anterior=n;
		actual=1;
	}
	//alert(actual)
	$("#imagen_"+anterior).fadeOut("slow",function(){
		$("#imagen_"+actual).fadeIn("slow");
		timerID = setTimeout("slide_efecto()", 3000);
	});
}
function cambia_stage(nuevo)
{
	stopTimer();
	anterior=actual;
	actual=nuevo;	
	$("#imagen_"+anterior).fadeOut("slow",function(){
		$("#imagen_"+actual).fadeIn("slow");
		timerID = setTimeout("slide_efecto()", 3000);
	});
}
