var n = 0;
var numMaximoPaginas
var numAtual


function proxima() {
	if (n >= arr_fotos.length - 1) {
		n = 0;
	} else {
		n++;
	}
	carregaFoto();
	informaFotoAtual();
	montaIndiceDePaginas(n);
};

function anterior() {
	if (n <= 0) {
		n = arr_fotos.length - 1;
	} else {
		n--;
	}
	carregaFoto();
	informaFotoAtual();
	montaIndiceDePaginas(n);
};

function informaFotoAtual() {
	numMaximoPaginas = arr_fotos.length;
	numAtual = n + 1;
	o = document.getElementById("foto_atual_info");
	o.innerHTML = 'Foto ' + numAtual + ' de ' + numMaximoPaginas;
};

function carregaFoto() {
	o = document.getElementById("foto");
	o.innerHTML = '<img src="' + caminho_foto + arr_fotos[n] + '" border="0" />';
};

function montaIndiceDePaginas(n) {
	o = document.getElementById("indice_de_fotos");
	html = '';
	for (i = 0; i < arr_fotos.length; i++) {
		css = '';
		if (i == n) {
			css = 'class="on"';
		}
		if (i == arr_fotos.length - 1) {
			html += '<a href="javascript:void(modificaIdDoArray(' + i + '));" ' + css + '>' + (i + 1) + '</a>';
		} else {
			html += '<a href="javascript:void(modificaIdDoArray(' + i + '));" ' + css + '>' + (i + 1) + '</a>' + ' - ';
		}
		
	};
	o.innerHTML = html;
};

function modificaIdDoArray(i) {
	n = i;
	carregaFoto();
	informaFotoAtual();
	montaIndiceDePaginas(n);
};