/* ----------------------------------------------------------------------------------
/  SlideShow de fotos
-----------------------------------------------------------------------------------*/

pause = false;
velocidade = 5000;
transicao = 9;

var Pic = montaFotos(lista, 0);
var Desc = montaFotos(lista, 1);

var t;
var st = 1;
var j = -1;
var p = Pic.length;
var preLoad = new Array();

for (i = 0; i < p; i++)
{
	preLoad[i] = new Image();
	preLoad[i].src = Pic[i];
}
function trocaFoto()
{
	j++;
	if (j > (p - 1)) j = 0;
	if (document.all)
	{
		document.SlideShow.style.filter="blendTrans(duration=2)";
		document.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
		document.SlideShow.filters.blendTrans.Apply();
	}
	document.SlideShow.src = preLoad[j].src;
	if (document.all)
	{
		document.SlideShow.filters.blendTrans.Play();
	}
	//document.getElementById("descricao_foto").innerHTML = Desc[j];
}
function RodarSlide() 
{
	if(! pause)
	{
		trocaFoto();							
		t = setTimeout('RodarSlide()', velocidade);
	}
}
function montaFotos(texto, dim)
{
	fotos = texto.split(';');
	saida = new Array (fotos.length);
	
	for (i = 0; i < fotos.length; i++)
	{
		desc = fotos[i].split('@');
		saida[i] = desc[dim];
	}
	
	return saida;
}
function Pausar()
{
	if (pause)
	{
		document.getElementById("pausar").innerHTML = "<img src='layout/parar.jpg' border=0>";
		pause = false;
		RodarSlide();
	}
	else
	{
		document.getElementById("pausar").innerHTML = "<img src='layout/iniciar.jpg' border=0>";
		pause = true;
	}
}
function Avancar()
{
	trocaFoto();
}
function Voltar()
{
	j = j - 2;
	if (j < -1)
	{
		j = p-2;
	}
	trocaFoto();
}
