cacheImg = new Array();

imagemSelecionada = "";
indiceImagemSelecionada = "";
diretorioImagemSelecionada = "";

function imgPreLoad(i,img)
{
	cacheImg[i] = new Image();
	cacheImg[i].src = img;
}

function trocaimg(nomeimg, sufixo, indice, diretorio)
{
	if (nomeimg != imagemSelecionada) 
		eval('document.' + nomeimg + indice + '.src = "' + diretorio + nomeimg + '_' + sufixo + '.gif"' );
}

function fixaimg(nomeimg, indice, diretorio)
{
	if (nomeimg != imagemSelecionada) 
	{	
		if (imagemSelecionada != "")
			eval('document.' + imagemSelecionada + indiceImagemSelecionada + '.src = "' + diretorioImagemSelecionada + imagemSelecionada + '_off.gif"' );

		imagemSelecionada = nomeimg;
		indiceImagemSelecionada = indice;
		diretorioImagemSelecionada = diretorio;
		eval('document.' + nomeimg + indice + '.src = "' + diretorio + nomeimg + '_on.gif"' );
	}
}

function rollover(img)
{
	var
		s1, s2;
		
	if (img.src.indexOf("_on") >= 0)
	{
		s1 = "_on";
		s2 = "_off";
	}
	else
	{
		s1 = "_off";
		s2 = "_on";
	}
	
	img.src = img.src.replace(s1, s2);
}
