function LinkOutros(obj) {
	var reflink = obj.options[obj.selectedIndex].value;
	if (reflink != "0")
		document.location = reflink;
}

function mostrarThumbs(codf, indice) {
	foto_anterior = false;
	foto_proxima = false;
	link_anterior = false;
	link_proxima = false;
	html_anterior = " ";
	html_proxima = " ";
	html_paganterior = "<span class=\"semanterior\">Anterior</span> ";
	html_pagproxima = "<span class=\"semproxima\">Pr&oacute;xima</span>";
	indicecodf = getIndiceArray(codf, listafotos);
	if (indice == -1) {
		if (lado == 1) {
			fotoant = indicecodf;
			fotoprox = indicecodf + 1;
		}
		else {
			fotoant = indicecodf - 1;
			fotoprox = indicecodf;
		}
	}
	else {
		fotoant = indice;
		fotoprox = indice + 1;
	}
	//html_anterior = "<a href=\"imagem.kmf?codfoto=" + listafotos[fotoant] + "&amp;lado=1&amp;codalbum=" + codalbum + "\" title=\"Foto anterior\"><img width=\"85\" height=\"80\" src=\"" + urlfotos + listafotosthumb[fotoant] + "\" alt=\"Foto anterior\" /></a>\n";
	img_anterior = urlfotos + listafotosthumb[fotoant];
	url_anterior = "imagem.kmf?codfoto=" + listafotos[fotoant] + "&lado=1&codalbum=" + codalbum;
    if (listafotos[fotoprox])
		//html_proxima = "<a href=\"imagem.kmf?codfoto=" + listafotos[fotoprox] + "&amp;lado=2&amp;codalbum=" + codalbum + "\" title=\"Pr&oacute;xima foto\"><img width=\"85\" height=\"80\" src=\"" + urlfotos + listafotosthumb[fotoprox] + "\" alt=\"Pr&oacute;xima foto\" /></a>\n";
	   img_proxima = urlfotos + listafotosthumb[fotoprox];
       url_proxima = "imagem.kmf?codfoto=" + listafotos[fotoprox] + "&lado=2&codalbum=" + codalbum;
    if (listafotos[fotoant - 1]) {
		indice = fotoant - 2;
		if (indice < 0) indice = 0;
		html_paganterior = "<a href=\"javascript:mostrarThumbs('" + indicecodf + "', " + indice + ")\" title=\"P&aacute;gina anterior\" class=\"anterior\">Anterior</a>\n";
	}
	if (listafotos[fotoprox + 1])
		html_pagproxima = "<a href=\"javascript:mostrarThumbs('" + indicecodf + "', " + (fotoprox + 1) + ")\" title=\"Pr&oacute;xima p&aacute;gina\" class=\"proxima\">Pr&oacute;xima</a>\n";
	document.getElementById("li-anterior").src = img_anterior;
	document.getElementById("li-anterior_a").href = url_anterior;
	document.getElementById("li-proxima").src = img_proxima;
   	document.getElementById("li-proxima_a").href = url_proxima;
	document.getElementById("pag-anterior").innerHTML = html_paganterior;
	document.getElementById("pag-proxima").innerHTML = html_pagproxima;
}

function getIndiceArray(value, lista) {
	var i;
	for (i = 0; i < lista.length; i++) {
		if (lista[i] === value) {
			return i;
		}
	}
	return false;
}