Diferencia entre revisiones de «Widget:Calendario maya»
Ir a la navegación
Ir a la búsqueda
Busca en cnbGuatemala con Google
Línea 1: | Línea 1: | ||
<form name="dayForm" style="margin:0; padding:0"> | <form name="dayForm" style="margin:0; padding:0"> | ||
− | <div style="text-align:left; background-color:#ffffff; width:734px"> | + | <div style="text-align:left; background-color:#ffffff; width:734px"> |
− | <div style="padding:40px 15px 0 30px"> | + | <div style="padding:40px 15px 0 30px"> |
− | <span class="title">Calendario maya</span> | + | <span class="title">Calendario maya</span> |
− | <!-- <img src="images/header_ancientMayan.png" title="Ancient Mayan Calendars" alt="Ancient Mayan Calendars" width="383" height="36" border="0"> | + | <!-- <img src="images/header_ancientMayan.png" title="Ancient Mayan Calendars" alt="Ancient Mayan Calendars" width="383" height="36" border="0"> |
− | <div style="background-image:url(images/calculator_bkgd.jpg); background-repeat: no-repeat; width:690px; height:294px"> --> | + | <div style="background-image:url(images/calculator_bkgd.jpg); background-repeat: no-repeat; width:690px; height:294px"> --> |
− | <div style="margin:20px 0 0 20px"> | + | <div style="margin:20px 0 0 20px"> |
− | <table border="0" cellspacing="0" cellpadding="0" width="600" style="padding-top:30px"> | + | <table border="0" cellspacing="0" cellpadding="0" width="600" style="padding-top:30px"> |
− | + | <tbody> | |
− | + | <tr> | |
− | + | <td valign="top"> | |
− | + | <table border="0" cellspacing="4" width="280"> | |
− | + | <tbody> | |
− | + | <tr> | |
+ | <td valign="top" class="calc">Año</td> | ||
+ | <td valign="top"><input type="text" name="year" value="2017" size="5"></td> | ||
− | + | </tr> | |
− | + | <tr> | |
− | + | <td valign="top" class="calc">Mes</td> | |
− | + | <td valign="top"> | |
− | + | <select name="month"> | |
− | + | <option>Enero</option> | |
− | + | <option>Febrero</option> | |
− | + | <option>Marzo</option> | |
− | + | <option>Abril</option> | |
− | + | <option>Mayo</option> | |
− | + | <option>Junio</option> | |
− | + | <option>Julio</option> | |
− | + | <option>Agosto</option> | |
− | + | <option>Septiembre</option> | |
− | + | <option>Octubre</option> | |
− | + | <option>Noviembre</option> | |
− | + | <option>Diciembre</option> | |
− | + | </select> | |
− | + | </td> | |
− | + | </tr> | |
− | + | <tr> | |
− | + | <td valign="top" class="calc">Día</td> | |
− | + | <td valign="top"> | |
− | + | <select name="day"> | |
− | + | <option>1</option> | |
− | + | <option>2</option> | |
− | + | <option>3</option> | |
− | + | <option>4</option> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <option>5</option> | |
− | + | <option>6</option> | |
− | + | <option>7</option> | |
− | + | <option>8</option> | |
− | + | <option>9</option> | |
− | |||
− | |||
− | + | <option>10</option> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <option>11</option> | |
− | + | <option>12</option> | |
− | + | <option>13</option> | |
− | + | <option>14</option> | |
− | + | <option>15</option> | |
− | |||
− | |||
− | + | <option>16</option> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <option>17</option> | |
− | + | <option>18</option> | |
− | + | <option>19</option> | |
− | + | <option>20</option> | |
− | + | <option>21</option> | |
− | |||
− | |||
− | + | <option>22</option> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <option>23</option> | |
− | + | <option>24</option> | |
− | + | <option>25</option> | |
− | + | <option>26</option> | |
− | + | <option>27</option> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <option>28</option> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <option>29</option> | |
− | + | <option>30</option> | |
− | + | <option>31</option> | |
− | + | </select> | |
− | + | </td> | |
− | + | </tr> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <tr> | |
− | + | <td valign="top" class="calc">Correlativo (calendario juliano)</td> | |
− | + | <td> | |
− | + | <select name="corrType"> | |
− | + | <option>584,283</option><!-- maya moderno --> | |
− | + | <option>584,285</option><!-- académico --> | |
− | + | </select> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | </td> | |
− | + | </tr> | |
− | + | <tr> | |
− | + | <td colspan="2" style="padding:15px 0 0 0" align="center"><input type="button" | |
− | </ | + | style="color:#000000" |
+ | value="Calcular" | ||
+ | onclick="maya(document.dayForm)"> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </tbody> | ||
+ | </table> | ||
+ | </td> | ||
+ | <td width="10"> </td> | ||
+ | <td valign="top"> | ||
+ | <table border="0" cellspacing="4" cellpadding="0" style="width: 280px; margin:0 0 0 0"> | ||
+ | <!-- Sid Changes Start --> | ||
+ | <tbody> | ||
+ | <tr> | ||
+ | <td valign="top" align="right" nowrap=""><input type="button" name="ybrad" value="9" | ||
+ | size="5"> | ||
+ | <input type="button" name="yb" value="Eb" size="9"></td> | ||
+ | <td valign="top" class="calc2">Día</td> | ||
+ | </tr> | ||
+ | <!-- Sid Changes End --> | ||
+ | <tr> | ||
+ | <td valign="top" align="right"><input type="button" name="baktun" value="12" | ||
+ | size="4"></td> | ||
+ | <td valign="top" class="calc2">Baktun</td> | ||
− | </ | + | </tr> |
+ | <tr> | ||
+ | <td valign="top" align="right"><input type="button" name="katun" value="19" | ||
+ | size="4"></td> | ||
+ | <td valign="top" class="calc2">Katun</td> | ||
− | </div> | + | |
− | <div id="kinimg" width="100px" height="100px"></div> | + | </tr> |
− | <div id="tzolkinimg" width="100px" height="100px"></div> | + | <tr> |
− | <div id="haabimg" width="100px" height="100px"></div> | + | <td valign="top" align="right"><input type="button" name="tun" value="15" size="4"> |
+ | </td> | ||
+ | <td valign="top" class="calc2">Tun</td> | ||
+ | |||
+ | </tr> | ||
+ | <tr> | ||
+ | <td valign="top" align="right"><input type="button" name="uinal" value="2" size="4"> | ||
+ | </td> | ||
+ | <td valign="top" class="calc2">Uinal</td> | ||
+ | |||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td valign="top" align="right"><input type="button" name="kin" value="2" size="4"> | ||
+ | </td> | ||
+ | <td valign="top" class="calc2">Kin</td> | ||
+ | |||
+ | </tr> | ||
+ | <tr> | ||
+ | <td valign="top" align="right" nowrap=""><input type="button" name="tzolrad" | ||
+ | value="1" size="5">, | ||
+ | <input type="button" name="tzolkin" value="Ik" size="9"></td> | ||
+ | <td valign="top" class="calc2">Tzolkin</td> | ||
+ | |||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td valign="top" align="right" nowrap=""><input type="button" name="haabrad" | ||
+ | value="10" size="5">, | ||
+ | <input type="button" name="haab" value="Kayab" size="9"></td> | ||
+ | <td valign="top" class="calc2">Haab'</td> | ||
+ | |||
+ | </tr> | ||
+ | |||
+ | <tr> | ||
+ | <td valign="top" align="right" nowrap=""><input type="button" name="lon" value="6" | ||
+ | size="4"></td> | ||
+ | <td valign="top" class="calc2">Señor de la noche | ||
+ | <!-- <img src="../images/calc_lord.gif" alt="Lord of the Night" width="115" height="18" /> --> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </tbody> | ||
+ | </table> | ||
+ | |||
+ | </td> | ||
+ | </tr> | ||
+ | </tbody> | ||
+ | </table> | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | </div> | ||
+ | |||
+ | </div> | ||
+ | <div id="kinimg" width="100px" height="100px"></div> | ||
+ | <div id="tzolkinimg" width="100px" height="100px"></div> | ||
+ | <div id="haabimg" width="100px" height="100px"></div> | ||
</form> | </form> | ||
<script> | <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 (tzolkin == 1) { | ||
+ | date.tzolkin.value = "Imix"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/c/cd/Imix.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 2) { | ||
+ | date.tzolkin.value = "Ik"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/e/e6/Ik.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 3) { | ||
+ | date.tzolkin.value = "Ak'bal"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/4/4c/Akbal.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 4) { | ||
+ | date.tzolkin.value = "K'an"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/9/9e/Kan.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 5) { | ||
+ | date.tzolkin.value = "Chikchan"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/4/4f/Chikchan.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 6) { | ||
+ | date.tzolkin.value = "Kimi"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/2/29/Kimi.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 7) { | ||
+ | date.tzolkin.value = "Manik"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/a/a9/Manik.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 8) { | ||
+ | date.tzolkin.value = "Lamat"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/4/46/Lamat.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 9) { | ||
+ | date.tzolkin.value = "Muluk"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/1/16/Muluk.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 10) { | ||
+ | date.tzolkin.value = "Ok"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/ba/Ok.gif" 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="http://cnbguatemala.org/images/0/01/Eb.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 13) { | ||
+ | date.tzolkin.value = "Ben"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/b2/Ben.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 14) { | ||
+ | date.tzolkin.value = "Ix"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/fb/Ix.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 15) { | ||
+ | date.tzolkin.value = "Men"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/f1/Men.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 16) { | ||
+ | date.tzolkin.value = "Kib"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/bf/Kib.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 17) { | ||
+ | date.tzolkin.value = "Kaban"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/e/e5/Kaban.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 18) { | ||
+ | date.tzolkin.value = "Etz'nab"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/f8/Etznab.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 19) { | ||
+ | date.tzolkin.value = "Kawak"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/55/Kawak.gif" width="64px">'; | ||
+ | } | ||
+ | else if (tzolkin == 0) { | ||
+ | date.tzolkin.value = "Ajau"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/2/2b/Ahau.gif" 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="http://cnbguatemala.org/images/0/0a/Pop.gif" width="64px">'; | |
− | + | } | |
− | + | else if (haabkin == 1) { | |
− | + | date.haab.value = "Uo"; | |
− | + | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/58/Uo.gif" width="64px">'; | |
− | + | } | |
− | + | else if (haabkin == 2) { | |
− | + | date.haab.value = "Zip"; | |
− | + | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/3/3d/Sip.gif" width="64px">'; | |
+ | } | ||
+ | else if (haabkin == 3) { | ||
+ | date.haab.value = "Zotz"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/bb/Zotz.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 4) { | ||
+ | date.haab.value = "Tzec"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/c/c1/Sek.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 5) { | ||
+ | date.haab.value = "Xul"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/6/6d/Xul.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 6) { | ||
+ | date.haab.value = "Yaxkin"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/55/Yaxkin.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 7) { | ||
+ | date.haab.value = "Mol"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/54/Mol.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 8) { | ||
+ | date.haab.value = "Chen"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/2/25/Chen.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 9) { | ||
+ | date.haab.value = "Yax"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/bd/Yax.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 10) { | ||
+ | date.haab.value = "Zac"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/c/c1/Sak.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 11) { | ||
+ | date.haab.value = "Ceh"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/51/Keh.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 12) { | ||
+ | date.haab.value = "Mac"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/d/de/Mak.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 13) { | ||
+ | date.haab.value = "Kankin"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/58/Kankin.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 14) { | ||
+ | date.haab.value = "Muwan"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/a/ac/Muwan.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 15) { | ||
+ | date.haab.value = "Pax"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/fe/Pax.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 16) { | ||
+ | date.haab.value = "Kayab"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/e/e3/Kayab.gif" width="64px">'; | ||
+ | } | ||
+ | else if (haabkin == 17) { | ||
+ | date.haab.value = "Cumkú"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/d/d4/Cumku.gif" width="64px">'; | ||
+ | } | ||
+ | else { | ||
+ | date.haab.value = "Uayeb"; | ||
+ | document.getElementById("haabimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/bd/Wayeb.gif" width="64px">'; | ||
+ | } | ||
− | |||
− | |||
− | + | lonight = days - (9 * (Math.floor((days - 1) / 9))); | |
− | + | date.lon.value = lonight; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | <!-- Sid Code Start --> | |
− | + | yb = (tzolkin - haabradical) % 20; | |
− | + | if (yb <= 0) yb = yb + 20; | |
− | + | if (yb == 1) { | |
− | + | date.yb.value = "Imix"; | |
− | + | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/c/cd/Imix.gif" width="64px">'; | |
− | + | } | |
− | + | else if (yb == 2) { | |
− | + | date.yb.value = "Ik"; | |
− | + | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/e/e6/Ik.gif" width="64px">'; | |
− | + | } | |
− | + | else if (yb == 3) { | |
− | + | date.yb.value = "Ak'bal"; | |
− | + | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/4/4c/Akbal.gif" width="64px">'; | |
− | + | } | |
− | + | else if (yb == 4) { | |
− | + | date.yb.value = "K'an"; | |
− | + | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/9/9e/Kan.gif" width="64px">'; | |
− | + | } | |
− | + | else if (yb == 5) { | |
− | + | date.yb.value = "Chikchan"; | |
− | + | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/4/4f/Chikchan.gif" width="64px">'; | |
+ | } | ||
+ | else if (yb == 6) { | ||
+ | date.yb.value = "Kimi"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/2/29/Kimi.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 7) { | ||
+ | date.yb.value = "Manik"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/a/a9/Manik.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 8) { | ||
+ | date.yb.value = "Lamat"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/4/46/Lamat.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 9) { | ||
+ | date.yb.value = "Muluk"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/1/16/Muluk.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 10) { | ||
+ | date.yb.value = "Ok"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/ba/Ok.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 11) { | ||
+ | date.yb.value = "Chuen"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/wiki/Archivo:Chuen.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 12) { | ||
+ | date.yb.value = "Eb"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/0/01/Eb.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 13) { | ||
+ | date.yb.value = "Ben"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/b2/Ben.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 14) { | ||
+ | date.yb.value = "Ix"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/fb/Ix.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 15) { | ||
+ | date.yb.value = "Men"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/f1/Men.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 16) { | ||
+ | date.yb.value = "Kib"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/b/bf/Kib.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 17) { | ||
+ | date.yb.value = "Kaban"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/e/e5/Kaban.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 18) { | ||
+ | date.yb.value = "Etz'nab"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/f/f8/Etznab.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 19) { | ||
+ | date.yb.value = "Kawak"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/5/55/Kawak.gif" width="64px">'; | ||
+ | } | ||
+ | else if (yb == 0) { | ||
+ | date.yb.value = "Ajau"; | ||
+ | document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/images/2/2b/Ahau.gif" width="64px">'; | ||
+ | } | ||
− | + | ybrad = (tzolradical - haabradical - (haabkin * 7)) % 13 | |
− | |||
− | |||
+ | if (ybrad <= 0) ybrad = ybrad + 13; | ||
+ | date.ybrad.value = ybrad; | ||
− | <!-- Sid Code | + | <!-- Sid Code End --> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | } | |
− | + | 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]; | |
− | function loadImages(){ | + | 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){ | + | function flip(imgName, imgSrc) { |
− | + | if (document.images) { | |
− | + | document[imgName].src = imgSrc | |
− | + | } | |
− | } | + | } |
− | //--> | + | //--> |
</script> | </script> |
Revisión del 22:10 2 ene 2018
<form name="dayForm" style="margin:0; padding:0">
Calendario maya
<tbody>
</tbody>
<tbody>
</tbody>
|
<tbody>
|
</form>
<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 (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="" width="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("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 2) { date.yb.value = "Ik"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 3) { date.yb.value = "Ak'bal"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 4) { date.yb.value = "K'an"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 5) { date.yb.value = "Chikchan"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 6) { date.yb.value = "Kimi"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 7) { date.yb.value = "Manik"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 8) { date.yb.value = "Lamat"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 9) { date.yb.value = "Muluk"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 10) { date.yb.value = "Ok"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 11) { date.yb.value = "Chuen"; document.getElementById("tzolkinimg").innerHTML = '<img src="http://cnbguatemala.org/wiki/Archivo:Chuen.gif" width="64px">'; } else if (yb == 12) { date.yb.value = "Eb"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 13) { date.yb.value = "Ben"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 14) { date.yb.value = "Ix"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 15) { date.yb.value = "Men"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 16) { date.yb.value = "Kib"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 17) { date.yb.value = "Kaban"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 18) { date.yb.value = "Etz'nab"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 19) { date.yb.value = "Kawak"; document.getElementById("tzolkinimg").innerHTML = '<img src="" width="64px">'; } else if (yb == 0) { date.yb.value = "Ajau"; document.getElementById("tzolkinimg").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>