﻿var acthora=""
function cargafecha(){
var fcha = new Date()
var nano=fcha.getFullYear()
var nmes=fcha.getMonth()
var ndia=fcha.getDate()
var nhora=fcha.getHours()
var nmin=fcha.getMinutes()
document.getElementById("txaa").value=nano
document.getElementById("slda").value=ndia
document.getElementById("slma").value=ameses[nmes]
document.getElementById("txha").value=nhora
document.getElementById("txma").value=nmin
grerom()
buscafecha()
}
function grerom(){
var fcha = new Date()
ngre=document.getElementById("txaa").value
nrom=aburbe(ngre)
document.getElementById("txau").value=nrom
document.getElementById("txac").value=hazroar(nrom)
document.getElementById("txar").value=hazarro(ngre)
ndia=document.getElementById("slda").value
nmes=document.getElementById("slma").selectedIndex-1
ndias=ldias[nmes]
nnonas=lnonas[nmes]
nidus=lidus[nmes]
nhor=parseInt(document.getElementById("txha").value,"10")
nmin=parseInt(document.getElementById("txma").value,"10")
nmin=(nhor*60)+nmin
nhor=horaromana(nmes,nmin)
cfchrom=hazkalendas(ndia,nmes,ndias,nnonas,nidus)
document.getElementById("slpr").value=cpridie
document.getElementById("sldr").value=cdiem
document.getElementById("slkr").value=ckalendas
document.getElementById("slmr").value=cmensis.substring(0,3)+"."
document.getElementById("slhr").value=lhoras[nhor]
verhora()
buscafecha()
}
function romgre(){
ngre=hazroar(document.getElementById("txar").value)-urbecondita
//nrom=aburbe(ngre)
//document.getElementById("txau").value=nrom
//document.getElementById("txac").value=hazroar(nrom)
nmesrom=document.getElementById("slmr").selectedIndex-1
nhorrom=document.getElementById("slhr").selectedIndex
nminutos=horaactual(nmesrom,nhorrom)
nhor=parseInt((nminutos/60),"10")
nmin=nminutos-(nhor*60)
document.getElementById("txha").value=nhor
document.getElementById("txma").value=nmin
cdiarom=document.getElementById("sldr").value
cprirom=document.getElementById("slpr").value
ckalrom=document.getElementById("slkr").value
ndia=dadia(cprirom,cdiarom,ckalrom,nmesrom)
document.getElementById("slda").value=ndia
document.getElementById("slma").selectedIndex=nmensis+1
nano=document.getElementById("txar").value
nano=hazroar(nano)
document.getElementById("txaa").value=nano
buscafecha()
}
function urbgre(){
nmesrom=document.getElementById("slmr").selectedIndex-1
nhorrom=document.getElementById("slhr").selectedIndex
nminutos=horaactual(nmesrom,nhorrom)
nhor=parseInt((nminutos/60),"10")
nmin=nminutos-(nhor*60)
document.getElementById("txha").value=nhor
document.getElementById("txma").value=nmin
cdiarom=document.getElementById("sldr").value
cprirom=document.getElementById("slpr").value
ckalrom=document.getElementById("slkr").value
ndia=dadia(cprirom,cdiarom,ckalrom,nmesrom)
document.getElementById("slda").value=ndia
document.getElementById("slma").selectedIndex=nmensis+1
nano=document.getElementById("txau").value
nano=hazroar(nano)
document.getElementById("txar").value=hazarro(nano+753)
document.getElementById("txaa").value=nano+753
document.getElementById("txac").value=nano+753
}
function verhora(){
chora=document.getElementById("slhr").value.toLowerCase()
if (chora!=""){
	if (estaen(chora,"vigilia")>-1){
		chora=cambiacadena(chora," vigilia","")
		carc="gadgets/imagenes/v_"+chora+".gif"
	}
	else {
		carc="gadgets/imagenes/h_"+chora+".gif"
	}
}
else {
	carc="images/nada.gif"
}
document.getElementById("reloj").src=carc
}
function buscafecha(){
ndia=document.getElementById("slda").value
nmes=document.getElementById("slma").selectedIndex
datos=""
if (datos==""){
   nreg=buscadia(nmes,ndia)
   }
else {
     nreg=buscadatos(datos.toUpperCase())
     ndia=dia[nreg]
     nmes=mes[nreg]
     document.getElementById("slda").selectedIndex=ndia
     document.getElementById("slma").selectedIndex=nmes
     }
if (nreg>0){
cfiestas=fiesta[nreg]
csucesos=hechos[nreg]
cfasto=fasto[nreg]
cfasto2=""
cfiesta="fiestas.gif"
cfecha=fecha[nreg].toUpperCase()
if (cfiestas.toUpperCase().indexOf("SATURNO")>-1){cfiesta="fs_saturno.jpg"}
if (cfiestas.toUpperCase().indexOf("VENUS")>-1){cfiesta="fs_venus.jpg"}
if (cfiestas.toUpperCase().indexOf("CARMENTA")>-1){cfiesta="fs_carmenta.jpg"}
if (cfiestas.toUpperCase().indexOf("JANO")>-1){cfiesta="fs_jano.jpg"}
if (cfiestas.toUpperCase().indexOf("JÃšPITER")>-1){cfiesta="fs_jupiter.jpg"}
if (cfiestas.toUpperCase().indexOf("NEPTUNO")>-1){cfiesta="fs_neptuno.jpg"}
if (cfiestas.toUpperCase().indexOf("LIBER")>-1){cfiesta="fs_liber.jpg"}
if (cfiestas.toUpperCase().indexOf("CERES")>-1){cfiesta="fs_ceres.jpg"}
if (cfiestas.toUpperCase().indexOf("CIBELES")>-1){cfiesta="fs_cibeles.jpg"}
if (cfiestas.toUpperCase().indexOf("APOLO")>-1){cfiesta="fs_apolo.jpg"}
if (cfiestas.toUpperCase().indexOf("VENUS")>-1){cfiesta="fs_venus.jpg"}
if (cfiestas.toUpperCase().indexOf("FORNICALIA")>-1){cfiesta="fs_fornicalia.jpg"}
if (cfiestas.toUpperCase().indexOf("FLORA")>-1){cfiesta="fs_flora.jpg"}
if (cfiestas.toUpperCase().indexOf("TÃ‰RMINO")>-1){cfiesta="fs_terminus.jpg"}
if (cfiestas.toUpperCase().indexOf("ISIS")>-1){cfiesta="fs_isis.jpg"}
if (cfiestas.toUpperCase().indexOf("INFERIORES")>-1){cfiesta="fs_inferiores.jpg"}
if (cfiestas.toUpperCase().indexOf("MINERVA")>-1){cfiesta="fs_minerva.jpg"}
if (cfiestas.toUpperCase().indexOf("AUGUSTO")>-1){cfiesta="fs_augusto.jpg"}
if (cfiestas.toUpperCase().indexOf("FAUNUS")>-1){cfiesta="fs_fauno.jpg"}
if (cfiestas.toUpperCase().indexOf("CÃSTOR")>-1){cfiesta="fs_castorypolux.jpg"}
if (cfiestas.toUpperCase().indexOf("PÃ“LUX")>-1){cfiesta="fs_castorypolux.jpg"}
if (cfasto=="Fas"){cfasto2="fas";caltfas="Se trata de un día fasto apropiado para llevar a cabo acciones y proyectos"}
if (cfasto=="Nefas"){cfasto2="nefas";caltfas="Se trata de un día nefasto, solamente apropiado para acciones religiosas"}
if (cfasto=="Comitialis"){cfasto2="fas";caltfas="Se trata de un día apropiado para asambleas populares"}
if (cfasto=="NP"){cfasto2="nefas";caltfas="Es un dí no apropiado en parte para actividades no religiosas"}
if (cfasto=="EN"){cfasto2="nefas";caltfas="La actividad no religiosa solamente en una parte del dÍ"}
//document.getElementById("ta00").innerHTML=cfecha+"\r"+cfiestas+" - "+csucesos
//document.images["diafasto"].src="images/"+cfasto+".gif"
//document.images["diafasto"].alt=caltfas
//document.images["fiesta"].src="images/"+cfiesta
//document.images["mes"].src="images/mes"+nmes+".gif"
document.getElementById("fastos").innerHTML="<B>"+cfasto.toUpperCase()+"</B>&nbsp;"+caltfas+"<br>"+cfiestas+" - "+csucesos
//document.getElementById("diafasto").title=caltfas
//document.getElementById("diafasto").alt=caltfas
nregant=nreg+1
}
else {
     nregant=0
     document.getElementById("fastos").innerHTML=""
     //document.images["mes"].src="images/mes.jpg"
     //document.images["diafasto"].src="images/nada.gif"
     //document.images["fiesta"].src="images/fiestas.gif"
     }
}
function buscadia(nmes,ndia){
nregtot= hechos.length - 1
nregact=1
cvlrcpo=""
for (nregact=1;nregact<=nregtot;++nregact) {
    if (mes[nregact]==nmes && dia[nregact]==ndia){
       return (nregact)
    }
}
return (0)
}


