Busca en cnbGuatemala con Google
<form name="dayForm" style="margin:0; padding:0">
Calendario maya
<tbody>
</tbody>
<tbody>
</tbody>
|
<tbody>
|
<script>
function maya(date) { year = Number(date.year.value); month = date.month.selectedIndex + 1; day = date.day.selectedIndex + 1;
julianday = getjulian(year, month, day);
if (date.corrType.selectedIndex == 1) { corrNumber = 584285; } else { corrNumber = 584283; }
days = julianday - corrNumber; xdays = days;
baktun = Math.floor(xdays / 144000); date.baktun.value = baktun; xdays -= baktun * 144000; katun = Math.floor(xdays / 7200); date.katun.value = katun; xdays -= katun * 7200; tun = Math.floor(xdays / 360); date.tun.value = tun; xdays -= tun * 360; uinal = Math.floor(xdays / 20); date.uinal.value = uinal;
kin = xdays - (uinal * 20); date.kin.value = kin;
xdays = days - (260 * (Math.floor(days / 260)));
tzolradical = 4 + xdays - (13 * (Math.floor((xdays + 3) / 13))); date.tzolrad.value = tzolradical; tzolkin = xdays - (20 * (Math.floor((xdays) / 20)));
if (tzolradical == 1) { date.tzolrad.value = "1"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 2) { date.tzolrad.value = "2"; document.getElementById("tzolradimg").innerHTML = '<img src="" height="64px">'; } else if (tzolradical == 3) { date.tzolrad.value = "3"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 4) { date.tzolrad.value = "4"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 5) { date.tzolrad.value = "5"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 6) { date.tzolrad.value = "6"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 7) { date.tzolrad.value = "7"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 8) { date.tzolrad.value = "8"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 9) { date.tzolrad.value = "9"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 10) { date.tzolrad.value = "10"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 11) { date.tzolrad.value = "11"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 12) { date.tzolrad.value = "12"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 13) { date.tzolrad.value = "13"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 14) { date.tzolrad.value = "14"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 15) { date.tzolrad.value = "15"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 16) { date.tzolrad.value = "16"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 17) { date.tzolrad.value = "17"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 18) { date.tzolrad.value = "18"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical == 19) { date.tzolrad.value = "19"; document.getElementById("tzolradimg").innerHTML = '<img src="" width="64px">'; } else if (tzolradical > 19) date.tzolrad.value = "error";
if (tzolkin == 1) { date.tzolkin.value = "Imix"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 2) { date.tzolkin.value = "Ik"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 3) { date.tzolkin.value = "Ak'bal"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 4) { date.tzolkin.value = "K'an"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 5) { date.tzolkin.value = "Chikchan"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 6) { date.tzolkin.value = "Kimi"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 7) { date.tzolkin.value = "Manik"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 8) { date.tzolkin.value = "Lamat"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 9) { date.tzolkin.value = "Muluk"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 10) { date.tzolkin.value = "Ok"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 11) { date.tzolkin.value = "Chuen"; document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/wiki/Archivo:Chuen.gif" width="64px">'; } else if (tzolkin == 12) { date.tzolkin.value = "Eb"; document.getElementById("tzolkinimg").innerHTML = '<img src="" height="64px">'; } else if (tzolkin == 13) { date.tzolkin.value = "Ben"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 14) { date.tzolkin.value = "Ix"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 15) { date.tzolkin.value = "Men"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 16) { date.tzolkin.value = "Kib"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 17) { date.tzolkin.value = "Kaban"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 18) { date.tzolkin.value = "Etz'nab"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 19) { date.tzolkin.value = "Kawak"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin == 0) { date.tzolkin.value = "Ajau"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (tzolkin > 19) date.tzolkin.value = "error";
xdays = days + 348 - (365 * (Math.floor((days + 348) / 365)));
haabradical = xdays - (20 * (Math.floor(xdays / 20))); date.haabrad.value = haabradical;
if (xdays > 360) date.haab.value = "Uayeb";
haabkin = Math.floor(xdays / 20);
if (haabkin == 0) { date.haab.value = "Pop"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 1) { date.haab.value = "Uo"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 2) { date.haab.value = "Zip"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 3) { date.haab.value = "Zotz"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 4) { date.haab.value = "Tzec"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 5) { date.haab.value = "Xul"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 6) { date.haab.value = "Yaxkin"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 7) { date.haab.value = "Mol"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 8) { date.haab.value = "Chen"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 9) { date.haab.value = "Yax"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 10) { date.haab.value = "Zac"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 11) { date.haab.value = "Ceh"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 12) { date.haab.value = "Mac"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 13) { date.haab.value = "Kankin"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 14) { date.haab.value = "Muwan"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 15) { date.haab.value = "Pax"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 16) { date.haab.value = "Kayab"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else if (haabkin == 17) { date.haab.value = "Cumkú"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; } else { date.haab.value = "Uayeb"; document.getElementById("haabimg").innerHTML = '<img src="" width="64px">'; }
lonight = days - (9 * (Math.floor((days - 1) / 9))); date.lon.value = lonight;
yb = (tzolkin - haabradical) % 20; if (yb <= 0) yb = yb + 20;
if (yb == 1) { date.yb.value = "Imix"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 2) { date.yb.value = "Ik"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 3) { date.yb.value = "Ak'bal"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 4) { date.yb.value = "K'an"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 5) { date.yb.value = "Chikchan"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 6) { date.yb.value = "Kimi"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 7) { date.yb.value = "Manik"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 8) { date.yb.value = "Lamat"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 9) { date.yb.value = "Muluk"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 10) { date.yb.value = "Ok"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 11) { date.yb.value = "Chuen"; document.getElementById("ybimg").innerHTML = '<img src="http://cnbguatemala.org/wiki/Archivo:Chuen.gif" width="64px">'; } else if (yb == 12) { date.yb.value = "Eb"; document.getElementById("ybimg").innerHTML = '<img src="" height="64px">'; } else if (yb == 13) { date.yb.value = "Ben"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 14) { date.yb.value = "Ix"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 15) { date.yb.value = "Men"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 16) { date.yb.value = "Kib"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 17) { date.yb.value = "Kaban"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 18) { date.yb.value = "Etz'nab"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 19) { date.yb.value = "Kawak"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 0) { date.yb.value = "Ajau"; document.getElementById("ybimg").innerHTML = '<img src="" width="64px">'; }
ybrad = (tzolradical - haabradical - (haabkin * 7)) % 13
if (ybrad <= 0) ybrad = ybrad + 13; date.ybrad.value = ybrad;
}
function getjulian(year, month, day) {
if (month < 3) { month += 12; year -= 1 } ;
a = Math.floor(year / 100); b = 2 - a + Math.floor(a / 4); j = Math.floor(365.25 * (year + 4716)) + Math.floor(30.6001 * (month + 1)) + day + b - 1524;
return j;
}
//A required global variable for the loadImages() function loadedImages = null;
function loadImages() { var img; if (document.images) { if (!loadedImages) loadedImages = new Array(); for (var i = 0; i < arguments.length; i++) { img = new Image(); img.src = arguments[i]; loadedImages[loadedImages.length] = img; } } }
/** * flip(imgName, imgSrc) sets the src attribute of a named * image in the current document. The function must be passed * two strings. The first is the name of the image in the document * and the second is the source to set it to. **/ function flip(imgName, imgSrc) { if (document.images) { document[imgName].src = imgSrc } }
//-->
</script>