/*

Galería de Fotos de Camping Deva. 

Design By Mediasur Networks S.L.

*/

//======================================================================================

//ESPECIFICACIONES:
/*El nombre de las fotos debe de ser un número correlativo a partir del 1. Se debe de especificar el número de las 
fotos. Se podrá especificar el titulo de las fotos mediante el arraya "titulos".*/

//======================================================================================

//Declaración de variables globales

var actual;
var num_fotos;
var img_anterior;
var img_siguiente;
var mostrar_titulo;
var mostrar_mensaje;
var mostrar_botones;
titulos = new Array(num_fotos);

//======================================================================================

//OPCIONES DE CONFIGURACIÓN

num_fotos = 42;

img_anterior = "/galeria/anterior.jpg"
img_siguiente = "/galeria/siguiente.jpg"

titulos[1] = "Bungalows";
titulos[2] = "Bungalows";
titulos[3] = "Bungalows";
titulos[4] = "Bungalows";
titulos[5] = "Bungalows";
titulos[6] = "Bungalows";
titulos[7] = "Bungalows";
titulos[8] = "Bungalows";
titulos[9] = "Bungalows";
titulos[10] = "Bungalows";
titulos[11] = "Bungalows";

titulos[12] = "Cabañas";
titulos[13] = "Cabañas";
titulos[14] = "Cabañas";
titulos[15] = "Cabañas";

titulos[16] = "Chalets";

titulos[17] = "Tiendas";
titulos[18] = "Tiendas";
titulos[19] = "Tiendas";
titulos[20] = "Tiendas";
titulos[21] = "Tiendas";
titulos[22] = "Tiendas";
titulos[23] = "Tiendas";
titulos[24] = "Tiendas";
titulos[25] = "Tiendas";
titulos[26] = "Tiendas";

titulos[27] = "Entorno";
titulos[28] = "Entorno";
titulos[29] = "Entorno";
titulos[30] = "Entorno";
titulos[31] = "Entorno";
titulos[32] = "Entorno";

titulos[33] = "Otros Servicios";
titulos[34] = "Otros Servicios";
titulos[35] = "Otros Servicios";
titulos[36] = "Otros Servicios";
titulos[37] = "Otros Servicios";
titulos[38] = "Otros Servicios";
titulos[39] = "Otros Servicios";
titulos[40] = "Otros Servicios";
titulos[41] = "Otros Servicios";
titulos[42] = "Otros Servicios";

mostrar_titulo = true;
mostrar_mensaje = true;
mostrar_botones = true;

//======================================================================================

//Función que muestra las imagenes

function cambiar_imagen(cad){


	var titulo;
	var url;
	var mensaje;
	var botones;
	
	
	var array = new Array();
	
	array=cad.split('.');
	
	actual = array[0];


	if(mostrar_titulo == true){
		titulo = '<div align="center" class="titulo_imagen">' + titulos[actual] + '</div>';
	}else{
		titulo = "";	
	}


	url = '<div style="width:600px; text-align:center;"><img src="/galeria/' + cad + '"  height="450" onclick="javascript:cerrar_imagen()"></div>';


	if (mostrar_mensaje == true){
		mensaje = '<br><div align="center" class="mensaje_imagen">*Pulse sobre la imagen para volver a la página principal</div>';
	}else{
		mensaje = "";
	}
	
	
	if (mostrar_botones == true){
		botones = '<br><div align="center"><table><tr><td><img src=' + img_anterior + ' onClick="javascript:anterior();" style="cursor:pointer;"></td><td><img src=' + img_siguiente + ' onClick="javascript:siguiente();" style="cursor:pointer;"></td></tr></table></div>';
	}else{
		botones = "";
	}
	
	
	document.getElementById('galeria').style.display='block';
	
	document.getElementById('fondo-galeria').style.display='block';
	
	document.getElementById('galeria').innerHTML = titulo + url + mensaje + botones;

}

//======================================================================================

//Funciones para navegar por las fotos

function siguiente(){
	actual = parseInt(actual) + 1;
	if(actual>num_fotos){actual=1;}
	cambiar_imagen(actual + '.jpg');
}

function anterior(){
	actual = parseInt(actual) - 1;
	if(actual<1){actual=num_fotos;}
	cambiar_imagen(actual + '.jpg');	
}

//======================================================================================

//Función para ocultar la Imagen

function cerrar_imagen(){
	
	document.getElementById('galeria').style.display='none';
	
	document.getElementById('fondo-galeria').style.display='none';
	
}

//======================================================================================