﻿// Función para mostrar el menu desplegable
var t;

function activar()
{
	clearTimeout(t);
}

/*function mostrar_equipo()
{
	var capa = document.getElementById('equipo');
    capa.style.visibility = "visible";
}*/

function mostrar_servicios()
{
	var capa = document.getElementById('servicios');
    capa.style.visibility = "visible";
}

function mostrar_productos()
{
	var capa = document.getElementById('productos');
    capa.style.visibility = "visible";
}

function mostrar_noticias()
{
	var capa = document.getElementById('noticias');
    capa.style.visibility = "visible";
}
function mostrar_reservas()
{
	var capa = document.getElementById('reservas');
    capa.style.visibility = "visible";
}

function ocultar_submenus()
{
	var capa1 = document.getElementById('reservas');
    capa1.style.visibility = "hidden";
	/*
	var capa2 = document.getElementById('servicios');
    capa2.style.visibility = "hidden";
	var capa3 = document.getElementById('productos');
    capa3.style.visibility = "hidden";
	var capa4 = document.getElementById('noticias');
    capa4.style.visibility = "hidden";
	var capa5 = document.getElementById('faq');
    capa5.style.visibility = "hidden";
	*/
}
function retardo()
{
	t=setTimeout('ocultar_submenus()',800);
}

// fin del menú desplegable

//popup's imagenes

function PopUp(img){
	foto1= new Image();
	foto1.src=(img);
	Control(img);
}

function Control(img){
	if((foto1.width!=0)&&(foto1.height!=0)){
		verFoto(img);
	}
	else{
		funcion="Control('"+img+"')";
		intervalo=setTimeout(funcion,20);
	}
}

function verFoto(img){
	ancho=foto1.width+20;
	alto=foto1.height+20;
	anchoPantalla=screen.width;
	altoPantalla=screen.height;
	cadena="width="+ancho+",height="+alto+",left="+(anchoPantalla-foto1.width)/2+",top="+(altoPantalla-foto1.height)/2;
	ventana=window.open(img,"",cadena);
	ventana.document.writeln ('<html>');
	ventana.document.writeln ('<head>'); 
    ventana.document.writeln ('<title></title>');
	ventana.document.writeln ('</head>');
	ventana.document.writeln ('<body>');
	ventana.document.writeln ('<img src="'+img+'" style="border:2px #e5e5e5 solid;";');
	ventana.document.writeln ('</body>');
	ventana.document.writeln ('</html>');
}

//***********************************************************************************************
// validarFecha(dia,mes, año)
//
// Valida que el día y el mes introducidos sean correctos. Además valida que el año introducido
// sea o no bisiesto
//
//***********************************************************************************************
function validarFecha(dia,mes,anio)
{
var elMes = parseInt(mes);

if(elMes>12)
return 1;
// MES FEBRERO
if(elMes == 2){
if(esBisiesto(anio)){
if(parseInt(dia) > 29){
return 1;
}
else
return 0;
}
else{
if(parseInt(dia) > 28){
return 1;
}
else
return 0;
}
}
//RESTO DE MESES

if(elMes== 4 || elMes==6 || elMes==9 || elMes==11){
if(parseInt(dia) > 30){
return 1;
}
}
return 0;

}
//*****************************************************************************************
// esBisiesto(anio)
//
// Determina si el año pasado com parámetro es o no bisiesto
//*****************************************************************************************
function esBisiesto(anio)
{
var BISIESTO;
if(parseInt(anio)%4==0){
if(parseInt(anio)%100==0){
if(parseInt(anio)%400==0){
BISIESTO=true;
}
else{
BISIESTO=false;
}
}
else{
BISIESTO=true;
}
}
else
BISIESTO=false;

return BISIESTO;
} 