﻿// Función para mostrar el menu desplegable
var t;

function activar()
{
	clearTimeout(t);
}

function mostrar_ortodoncia()
{
	var capa = document.getElementById('ortodoncia');
    capa.style.visibility = "visible";
}

function mostrar_conozcanos()
{
	var capa = document.getElementById('conozcanos');
    capa.style.visibility = "visible";
}

function mostrar_soypaciente()
{
	var capa = document.getElementById('soypaciente');
    capa.style.visibility = "visible";
}

function ocultar_submenus()
{

	var capa2 = document.getElementById('ortodoncia');
    capa2.style.visibility = "hidden";
	
	var capa3 = document.getElementById('conozcanos');
    capa3.style.visibility = "hidden";
	
	var capa4 = document.getElementById('soypaciente');
	capa4.style.visibility = "hidden";
}
function retardo()
{
	t=setTimeout('ocultar_submenus()',800);
}

// fin del menú desplegable


var nav4 = window.Event ? true : false;

function acceptNum(evt){          

// NOTE: Backspace = 8, Enter = 13, '0' = 48, '9' = 57, '.' = 46 , ',' = 44  

var key = nav4 ? evt.which : evt.keyCode;         

return (key <= 13 || (key >= 48 && key <= 57) );

}

//***********************************************************************************************
// 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;
} 
