var indiceNoticiaFlash = 0;
var cancelFlash = false;
// creo la variable que contiene el indice de cada una de las cajas de contenido
var indice = new Array();
indice['momento'] = 1;
indice['foto'] = 1;
indice['florynata'] = 1;
indice['sanvalentin'] = 1;

function cargar_contenido(id, nombre, contenido) {
	var noticia = contenido[id];
	var indice_local = indice[nombre];
	$('#numero_'+nombre).html(id+1);
	$('#seccion_'+nombre).html("<a href='"+noticia[4]+"' >"+noticia[1]+"</a>");
	$('#texto_'+nombre).html(noticia[2]);
	$('#foto_'+nombre+indice_local).fadeIn();
}

function sig_contenido(nombre, contenido) {
	var indice_local = indice[nombre];
	$('#foto_'+nombre+indice_local).hide();
	indice[nombre]++;
	if (indice[nombre] > contenido.length) {
		indice[nombre] = 1;
	}
	cargar_contenido(indice[nombre] - 1, nombre, contenido);
}

function ant_contenido(nombre, contenido) {
	var indice_local = indice[nombre];
	$('#foto_'+nombre+indice_local).hide();
	indice[nombre]--;
	if ( indice[nombre] < 1) {
		indice[nombre] =  contenido.length;
	}
	cargar_contenido(indice[nombre]- 1, nombre, contenido);
}

function mostrar_pestania(tab, posicion) {
	// La funcion busca todos los divs con el id 'pestania_'+tab+'_'+nro
	// y muestra el que debe mostrar
	// mod_clase modifica la clase base a mostrar
	var i = 1;
	while ($('#pestania_'+tab+'_'+i).html() != null) {
		if (i == posicion) {
			$('#pestania_'+tab+'_'+i).show();
			$('#pestania_'+tab+'_'+i).removeClass('hide');
			$('#pestania_titulo_'+tab+'_'+i).removeClass('solapa_abajo');
			$('#pestania_titulo_'+tab+'_'+i).addClass('solapa_arriba');
		} else {
			$('#pestania_'+tab+'_'+i).hide();
			$('#pestania_titulo_'+tab+'_'+i).removeClass('solapa_arriba');
			$('#pestania_titulo_'+tab+'_'+i).addClass('solapa_abajo');
		}
		i++;
	}
}

function mostrar_pestania_grande(tab, posicion) {
	// La funcion busca todos los divs con el id 'pestania_'+tab+'_'+nro
	// y muestra el que debe mostrar
	// mod_clase modifica la clase base a mostrar
	var i = 1;
	while ($('#pestania_'+tab+'_'+i).html() != null) {
		if (i == posicion) {
			$('#pestania_'+tab+'_'+i).show();
			$('#pestania_'+tab+'_'+i).removeClass('hide');
			$('#pestania_titulo_'+tab+'_'+i).removeClass('solapa_abajo_grande');
			$('#pestania_titulo_'+tab+'_'+i).addClass('solapa_arriba_grande');
		} else {
			$('#pestania_'+tab+'_'+i).hide();
			$('#pestania_titulo_'+tab+'_'+i).removeClass('solapa_arriba_grande');
			$('#pestania_titulo_'+tab+'_'+i).addClass('solapa_abajo_grande');
		}
		i++;
	}
}
function cargarFlash(id) {
	$("#titular_flash_informativo").css("left","0px");
	$("#titular_flash_informativo").html("<p>" + noticias_flash[id] + "</p>");

}
function prevFlash() {
	indiceNoticiaFlash--;
	if (indiceNoticiaFlash < 0) {
		indiceNoticiaFlash= noticias_flash.length - 1;
	}
	cargarFlash(indiceNoticiaFlash);
}

function nextFlash() {
	indiceNoticiaFlash++;
	if (indiceNoticiaFlash >= noticias_flash.length) {
		indiceNoticiaFlash= 0;
	}
	cargarFlash(indiceNoticiaFlash);
}

function stopFlash() {
	cancelFlash = true;
}



