var curpage=0;
var timer=null;
var imagesWidth=null;
var imagesHeight=null;
var slideHeight=0;
var stopped = false;
var numpages = 0;
var arraySlides;
var obj;

function test()
{}


function fnc_next()
{
	if (curpage > numpages-1)
	{
		curpage=0;
	}

	obj=arraySlides[curpage];
	obj.style.visibility = "hidden";
	obj.style.display = "none";
	obj.style.height = "1px";

	curpage++;

	if (curpage>numpages - 1) 
	{
		curpage = 0;
	}

	obj=arraySlides[curpage];
	obj.style.visibility = "visible";
	obj.style.display = "block";
	obj.style.height = slideHeight + "px";

	if(!stopped)
	{
		clearTimeout(timer);
		start();
	}

}

function fnc_prev()
{
	if (curpage>numpages)	curpage = 0;

	//Obtengo la nota Actual
	obj= arraySlides[curpage];

	if(obj)
	{
		obj.style.visibility = "hidden";
		obj.style.display = "none";
		obj.style.height = "1px";
	}
	
	curpage--;
	if (curpage<0)	curpage = numpages-1;

	//Obtengo la nota Anterior
	obj=arraySlides[curpage];
	if(obj)
	{
		obj.style.visibility = "visible";
		obj.style.display = "block";
		obj.style.height = slideHeight + "px";
	}

	if(!stopped)
	{
		clearTimeout(timer);
		start();
	}
}

function stopstart(img) 
{
	if (stopped) {
		img.src="../imagenes/"+img.id+".gif";
		img.onmouseover="sgppnov(this);";
		img.onmouseout="sgppnou(this);";
		start();
	} else {
		img.src="../imagenes/"+img.id+"_over.gif";
		img.onmouseover="";
		img.onmouseout="";
		stop();
	}
}

function stop() 
{
	if (!(stopped)) 
	{
		clearTimeout(timer);
		stopped=true;
	}
}
function start() 
{
	timer=setTimeout('fnc_next()',10000);
	//timer=setTimeout('fnc_next()',3500);
	stopped=false;
}

function firsthideImgs()
{
	arraySlides = document.getElementsByName("rota");

	numpages = arraySlides.length;
	//Oculto cada una de las imagenes
	for (i=0;i <= numpages;i++)
	{
		var obj=arraySlides[i];
		if(obj)
		{
			if(i==0) 
			{
				imagesWidth	 = document.getElementById('imgSlide').width;
				imagesHeight = document.getElementById('imgSlide').height;
			}
			
		//slideHeight = imagesHeight + ((muestraTitulo==0)?88:0); aqui
			slideHeight = imagesHeight-3;
			obj.style.visibility="hidden";
			obj.style.display = "none";
			obj.style.height = "1px";
			obj.style.overflow ="hidden";
			obj.style.top = "0px";
			obj.style.position = "relative";
			obj.style.border = "0px solid";
			obj.style.zIndex = 1;
		}
	}

	//Ubico la botonera segun el alto de la primer imagen

	//Muestro la primer imagen
	curpage = 0;
	var firstSlide = arraySlides[0];
	if(firstSlide)
	{
		firstSlide.style.visibility = "visible";
		firstSlide.style.display = "block";
		firstSlide.style.height = imagesHeight + "px";
		slideHeight = imagesHeight;
		start();
	}
}


function firsthide()
{
	arraySlides = document.getElementsByName("rota");
	numpages = arraySlides.length;

	var x = navigator

	//Oculto cada una de las imagenes
	for (i=0;i < numpages ;  i ++)
	{
		obj=arraySlides[i];
		if(obj)
		{
			if(i==0) 
			{
				imagesWidth	 = document.getElementById('imgSlide').width;
				imagesHeight = document.getElementById('imgSlide').height;
			}
			if (x.appName == "Netscape"){
				slideHeight = imagesHeight-5;
			}else
			{
				slideHeight = imagesHeight+171;
			}
			obj.style.visibility="hidden";
			obj.style.display = "none";
			obj.style.height = "1px";
			obj.style.overflow ="hidden";
			obj.style.top = "0px";
			obj.style.position = "relative";
			obj.style.border = "0px solid";
			obj.style.zIndex = 1;
		}
	}

	//Ubico la botonera segun el alto de la primer imagen
	if (numpages > 1)
	{
		var botonera=document.getElementById('botoneraSlide');
		if(botonera)
		{
			var top = imagesHeight - 14;
			var left = imagesWidth - 95;
			botonera.style.visibility = "visible";
			botonera.style.display = "block";
			botonera.style.top = top + "px";
			botonera.style.left = left+ "px";
			botonera.style.zIndex = "5";
		}
	}

	//Muestro la primer imagen
	curpage = 0;
	var firstSlide = arraySlides[0];
	if(firstSlide)
	{
		firstSlide.style.visibility = "visible";
		firstSlide.style.display = "block";
		firstSlide.style.height = slideHeight + "px";
		start();
	}
	

}

function sgppnov(img)
{
	img.src="../imagenes/"+img.id+"_over.gif";
}
function sgppnou(img)
{
	img.src="../imagenes/"+img.id+".gif";
}

function firsthide_simple()
{
	

	arraySlides = document.getElementsByName("rota");

	numpages = arraySlides.length;

	//Oculto cada una de las imagenes

	for (i=0;i < numpages ;  i ++)
	{
		obj=arraySlides[i];
		if(obj)
		{
			if(i==0) 
			{
				imagesWidth	 = document.getElementById('imgSlide').width;
				imagesHeight = document.getElementById('imgSlide').height;
			}
			slideHeight = imagesHeight + 148;
			obj.style.visibility="hidden";
			obj.style.display = "none";
			obj.style.height = "1px";
			obj.style.overflow ="hidden";
			obj.style.top = "0px";
			obj.style.position = "relative";
			obj.style.border = "0px solid";
			obj.style.zIndex = 1;
		}
	}

	//Ubico la botonera segun el alto de la primer imagen
	if (numpages > 1)
	{
		var botonera=document.getElementById('botoneraSlide');
		if(botonera)
		{
			var top = imagesHeight - 18;
			var left = imagesWidth - 95;
			botonera.style.visibility = "visible";
			botonera.style.display = "block";
			botonera.style.top = top + "px";
			botonera.style.left = left+ "px";
			botonera.style.zIndex = "5";
		}
	}

	//Muestro la primer imagen
	curpage = 0;
	var firstSlide = arraySlides[0];
	if(firstSlide)
	{
		firstSlide.style.visibility = "visible";
		firstSlide.style.display = "block";
		firstSlide.style.height = slideHeight + "px";
		start();
	}
	

}