var GALERIAS = {};

GALERIAS.destacaFoto = function(indice) {
	var totalFotos = 0;
	var indActual = 0;
		
	$("#galeria").find(".mod_galeria").each(function(index) { // Oculto la foto actual
		totalFotos++;
		$(this).hide();
	});
	
	$("#galeria").find("#rotatorio-" + indice + " .mod_galeria").show();
	$("#galeria").find("#rotatorio-" + indice).show();

	


	$("#galeria").find("#rotatorio-" + indice).find(".fotos").each(function(index) { // Tratamiento de los thumbs
		if(index == indice - 1) {
			if($(this).is(":hidden")) { // Oculto la primera visible para poder mostrar esta
				$("#galeria").find("#rotatorio-" + indice).find(".fotos").each(function (index) {
					if(!$(this).is(":hidden")) {
						$(this).hide();
						return false;
					}
				});
				$(this).show();
			}
			$(this).attr("id", "activo");
		} else if(!$(this).is(":hidden")) {
			$(this).attr("id", "");
		}
	});

	// Enlaces anterior-siguiente
	var siguiente = indice >= totalFotos ? 1 : indice + 1;
	var anterior = indice > 1 ? indice - 1 : (totalFotos - 1);

	$(".thnav_ant").attr({ href: "javascript:GALERIAS.destacaFoto(" + anterior + ")"});
	$(".thnav_sig").attr({ href: "javascript:GALERIAS.destacaFoto(" + siguiente + ")"});

};

GALERIAS.cargaThumbs = function(path_publicacion, id_galeria) {

};