document.getElementById("Binicio").style.display = 'block';
function Boff()
{
	document.getElementById("Binicio").style.display = 'none';
	document.getElementById("Bcasa").style.display = 'none';
	document.getElementById("Bapartamentos").style.display = 'none';
	document.getElementById("Bentorno").style.display = 'none';
	document.getElementById("Bgaleria").style.display = 'none';
	document.getElementById("Btarifas").style.display = 'none';
	document.getElementById("Bllegar").style.display = 'none';
	document.getElementById("Benlaces").style.display = 'none';
	
	document.getElementById("Bcorrala").style.display = 'none';
	document.getElementById("Bpajar").style.display = 'none';
	document.getElementById("Balcoba").style.display = 'none';
	document.getElementById("Bsauco").style.display = 'none';
	document.getElementById("Bpalomar").style.display = 'none';
	document.getElementById("Bbuhardilla").style.display = 'none';
	
	
	document.getElementById("Fentorno").style.display = 'none';
	document.getElementById("Fcasa").style.display = 'none';
	document.getElementById("Fcomun").style.display = 'none';
	document.getElementById("Fcorrala").style.display = 'none';
	document.getElementById("Fpajar").style.display = 'none';;
	document.getElementById("Falcoba").style.display = 'none';
	document.getElementById("Fsauco").style.display = 'none';
	document.getElementById("Fpalomar").style.display = 'none';
	document.getElementById("Fbuhardilla").style.display = 'none';
	document.location.href = "#www.bosbrazon.com";
}

function inicio()
{
	Boff();
	document.getElementById("Binicio").style.display = 'block';
}
function casa()
{
	Boff();
	document.getElementById("Bcasa").style.display = 'block';
	document.getElementById("Bapartamentos").style.display = 'block';
	document.getElementById("Fcasa").style.display = 'block';
	document.getElementById("Fcomun").style.display = 'block';
}
function entorno()
{
	Boff();
	document.getElementById("Bentorno").style.display = 'block';
	document.getElementById("Fentorno").style.display = 'block';
}
function galeria()
{
	Boff();
	document.getElementById("Bgaleria").style.display = 'block';
	document.getElementById("Fentorno").style.display = 'block';
	document.getElementById("Fcasa").style.display = 'block';
	document.getElementById("Fcomun").style.display = 'block';
	document.getElementById("Fcorrala").style.display = 'block';
	document.getElementById("Fpajar").style.display = 'block';;
	document.getElementById("Falcoba").style.display = 'block';
	document.getElementById("Fsauco").style.display = 'block';
	document.getElementById("Fpalomar").style.display = 'block';
	document.getElementById("Fbuhardilla").style.display = 'block';
}
function tarifas()
{
	Boff();
	document.getElementById("Btarifas").style.display = 'block';
}
function llegar()
{
	Boff();
	document.getElementById("Bllegar").style.display = 'block';
}
function enlaces()
{
	Boff();
	document.getElementById("Benlaces").style.display = 'block';
}

function infoflotante(idapartamento)
{
	document.getElementById(idapartamento).style.display = 'block';
}
function infoflotanteoff(idapartamento)
{
	document.getElementById(idapartamento).style.display = 'none';
}

function corrala()
{
	Boff();
	document.getElementById("Bcorrala").style.display = 'block';
	document.getElementById("Fcorrala").style.display = 'block';
}
function pajar()
{
	Boff();
	document.getElementById("Bpajar").style.display = 'block';
	document.getElementById("Fpajar").style.display = 'block';
}
function alcoba()
{
	Boff();
	document.getElementById("Balcoba").style.display = 'block';
	document.getElementById("Falcoba").style.display = 'block';
}
function sauco()
{
	Boff();
	document.getElementById("Bsauco").style.display = 'block';
	document.getElementById("Fsauco").style.display = 'block';
}
function palomar()
{
	Boff();
	document.getElementById("Bpalomar").style.display = 'block';
	document.getElementById("Fpalomar").style.display = 'block';
}
function buhardilla()
{
	Boff();
	document.getElementById("Bbuhardilla").style.display = 'block';
	document.getElementById("Fbuhardilla").style.display = 'block';
}

function fotooff()
{
	document.getElementById("imagenfoto").src = " ";
	document.getElementById("marcofoto").style.display = 'none';
}

function fotoon(direccionfoto)
{
	document.getElementById("marcofoto").style.display = 'block';
	document.getElementById("imagenfoto").src = " ";
	fotogrande(direccionfoto);
}

function fotogrande(direccionfoto)
{
	document.getElementById("imagenfoto").src = direccionfoto;
}
function externalLinks()
{   
	if (!document.getElementsByTagName)
	{
		return;
	}
	var anchors = document.getElementsByTagName("a");   
	for (var i=0; i<anchors.length; i++)
	{   
		var anchor = anchors[i];   
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
		{
			anchor.target = "_blank";  
		}
	}   
}
window.onload = externalLinks;



//Comprovaciones de formularios --------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
function permite(elEvento, permitidos) {
	var numeros = "0123456789";
	var caracteres = " abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ";
	var numeros_caracteres = numeros + caracteres;
	var teclas_especiales = [8, 37, 39, 46];
	switch(permitidos)
	{
		case 'num':
			permitidos = numeros;
			break;
		case 'car':
			permitidos = caracteres;
			break;
		case 'num_car':
			permitidos = numeros_caracteres;
			break;
	}
	var evento = elEvento || window.event;
	var codigoCaracter = evento.charCode || evento.keyCode;
	var caracter = String.fromCharCode(codigoCaracter);
	var tecla_especial = false;
	for(var i in teclas_especiales)
	{
		if(codigoCaracter == teclas_especiales[i])
		{
			tecla_especial = true;
			break;
		}
	}
	return permitidos.indexOf(caracter) != -1 || tecla_especial;
}
function validarFormulario() {
	c = 2;
	d = 1;
	color = "#aaaaff";
	var campos = [telefono1,email];
	for (i=0;i<campos.length;i++)
	{
		if(campos[i].value=="")
		{
			campos[i].parentNode.style.backgroundColor  = color;
			c = 0;
		}else{
			campos[i].parentNode.style.backgroundColor  = "";
		}
	}
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email.value))
	{
		email.parentNode.style.backgroundColor  = "";
	} else {
		email.parentNode.style.backgroundColor  = color;
		d = 0;
	}
	return c + d;
}
var nombre = document.forms["FReserva"].Nombre;
var apellidos = document.forms["FReserva"].Apellidos;
var telefono1 = document.forms["FReserva"].Telefono1;
var telefono2 = document.forms["FReserva"].Telefono2;
var email = document.forms["FReserva"].Email;
var fentrada = document.forms["FReserva"].FEntrada;
var fsalida = document.forms["FReserva"].FSalida;
var npersonas = document.forms["FReserva"].NPersonas;
var apartamento = document.forms["FReserva"].Apartamento;
var comentario = document.forms["FReserva"].Comentario;
//Ajax formulario de envio -------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
function enviodeFormulario(){
	var mensajeError = ["El formulario está incompleto.\nCumplimenta las casillas marcadas en azul.\n\n","La dirección de email " + email.value + " es incorrecta.\nComprueba que esta bien escrita (persona@servidor.dominio).\n\n"];
	switch(validarFormulario())
	{
		case 3:
			document.forms["FReserva"].from.value = document.forms["FReserva"].Email.value;
			alert("Su formulario ha sido enviado satisfactoriamente. En un plazo inferior a 24 horas contestaremos a su solicitud.");
			return true;
			break;
		case 2:
			alert(mensajeError[1]);
			return false;
			break;
		case 1:
			alert(mensajeError[0]);
			return false;
			break;
		case 0:
			alert(mensajeError[0] + mensajeError[1]);
			return false;
			break;
	}
	
}


