<!--  to hide script contents from old browsers

var never = new Date()
never.setTime(never.getTime() + 2000*24*60*60*1000);

// name is a string of the name of the cookie
// value is the value corresponding to name
function SetCookie(name, value) {
 	var expString = "; expires=" + never.toGMTString();
 	document.cookie = name + "=" + escape(value) + expString + "; path=/";
}

// returns value of cookie or null if cookie does not exist
function GetCookie(name) {
 	var result = null;
 	var myCookie = " " + document.cookie + ";";
 	var searchName = " " + name + "=";
 	var startOfCookie = myCookie.indexOf(searchName);
 	var endOfCookie;
 	if (startOfCookie != -1) {
  		startOfCookie += searchName.length; // skip past name of cookie
  		endOfCookie = myCookie.indexOf(";", startOfCookie);
  		result = unescape(myCookie.substring(startOfCookie, endOfCookie));
 	}
 	return result;
}

function DateToJulian(y, m, d) {
   	var Y = y;
   	if (Y < 0) { Y = Y + 1};
   	var M = m;
   	var D = d;
   	if (M<3)	{
		Y--;
		M += 12;
	}
	
	var A = Math.floor(Y/100);
	var B = Math.floor(A/4);
	var C = 2 - A + B;
	var E = Math.floor(365.25*(Y + 4716));
	var F = Math.floor(30.6001*(M + 1));
	var julianday = C + eval(D) + E + F - 1524;
	return julianday;
   
};

function calc()
{
   
   var yearb = "terminal";
   var corr = 584283;
   var yearc = 162;
   var cname = "Alfonso Caso";
   
    var mode = GetCookie ("mode");
    if (mode == null) {
    	SetCookie ("mode", "Normal");
   		mode = "Normal";
    };
     
    if (mode == "Normal") {
    	var correlation = GetCookie("correlation");
		if (correlation == null) { 
			SetCookie("correlation", "Caso");
			correlation = "Caso";
	    };
		if (correlation == "Horden") {
			corr = 584280;
			cname = "Francisco Rodriguez Cortes"
		};
	} else {
		yearb = GetCookie('bearer');
		corr = GetCookie ("constant");
		yearc = GetCookie ("start");
		cname = GetCookie ("name");
	};
    

	daysigns = new Array(20);
	daysigns[0] = 20;
		daysigns[1]  = "Cipactli";	   daysigns[2] = "Ehecatl";  daysigns[3]  = "Calli";
		daysigns[4]  = "Cuetzpalin";   daysigns[5] = "Coatl";    daysigns[6]  = "Miquiztli";
		daysigns[7]  = "Mazatl";       daysigns[8] = "Tochtli";  daysigns[9]  = "Atl";
		daysigns[10] = "Itzcuintli";   daysigns[11]= "Ozomahtli";daysigns[12] = "Malinalli";
		daysigns[13] = "Acatl";        daysigns[14]= "Ocelotl";  daysigns[15] = "Cuauhtli";
		daysigns[16] = "Cozcacuauhtli";daysigns[17]= "Ollin";    daysigns[18] = "Tecpatl";
		daysigns[19] = "Quiahuitl";    daysigns[20]= "Xochitl";

        daysignst = new Array(20);
        daysignst[0] = 20;
                daysignst[1]  = "crocodile";    daysignst[2] = "wind";     	daysignst[3]  = "house";
                daysignst[4]  = "lizard";   	daysignst[5] = "snake";    	daysignst[6]  = "death";
                daysignst[7]  = "deer";       	daysignst[8] = "rabbit";  	daysignst[9]  = "water";
                daysignst[10] = "dog";   	daysignst[11]= "monkey";	daysignst[12] = "grass";
                daysignst[13] = "reed";        	daysignst[14]= "jaguar";  	daysignst[15] = "eagle";
                daysignst[16] = "vulture";	daysignst[17]= "movement";    	daysignst[18] = "flint knife";
                daysignst[19] = "rain";    	daysignst[20]= "flower";

		
	counts = new Array(12)
    counts[0] = 13; 
		counts[1]  = "Ce";            counts[2] = "Ome";            counts[3]  = "Yei";
		counts[4]  = "Nahui";         counts[5] = "Mahcuilli";      counts[6]  = "Chicuacen";
		counts[7]  = "Chicome";       counts[8] = "Chicuei";        counts[9]  = "Chicunahui";
		counts[10] = "Mahtlactli";    counts[11]= "Mahtlactli-once";counts[12] = "Mahtlactli-omome";
		counts[13] = "Mahtlactli-omei";
	
	weekdays = new Array(7);
	weekdays[0] = 7;
		weekdays [1] = "Sunday";	weekdays [2] = "Monday";	weekdays [3] = "Tuesday";
		weekdays [4] = "Wednesday";	weekdays [5] = "Thursday";	weekdays [6] = "Friday";
		weekdays [7] = "Saturday";
		
	months = new Array(12)
    months[0] = 12;
		months[1]  = "January";months[2] = "February";months[3]  = "March";
		months[4]  = "April";  months[5] = "May";     months[6]  = "June";
		months[7]  = "July";   months[8] = "August";  months[9]  = "September";
		months[10] = "October";months[11]= "November";months[12] = "December";

	meztli = new Array(19);
	meztli[0] = 19;
		meztli[1]  = "Izcalli";	       meztli[2] = "Cuauhuitlehua";   meztli[3]  = "Tlacaxipehualiztli";
		meztli[4]  = "Tozoztontli";    meztli[5] = "Hueitozoztli";    meztli[6]  = "Toxcatl";
		meztli[7]  = "Etzcualiztli";   meztli[8] = "Tecuilhuitontli"; meztli[9]  = "Hueitecuilhuitl";
		meztli[10] = "Tlaxochimaco";   meztli[11]= "Xocolhuetzi";     meztli[12] = "Ochpaniztli";
		meztli[13] = "Teotleco";       meztli[14]= "Tepeilhuitl";     meztli[15] = "Quecholli";
		meztli[16] = "Panquetzaliztli";meztli[17]= "Atemoztli";       meztli[18] = "Tititl";
		meztli[19] = "Nenmontemi";    
	
	meztlig = new Array(19);
	meztlig[0] = 19;
		meztlig[1]  = "I";	    meztlig[2] = "II";   meztlig[3]  = "III";
		meztlig[4]  = "IV";    	meztlig[5] = "V";    meztlig[6]  = "VI";
		meztlig[7]  = "VII";   	meztlig[8] = "VIII"; meztlig[9]  = "IX";
		meztlig[10] = "X";   	meztlig[11]= "XI";   meztlig[12] = "XII";
		meztlig[13] = "XIII";   meztlig[14]= "XIV";  meztlig[15] = "XV";
		meztlig[16] = "XVI";	meztlig[17]= "XVII"; meztlig[18] = "XVIII";
		meztlig[19] = "Useless"; 
		
var	lords = new Array(10);		
lords[0] =  10;
lords[1] = "<a href='/god/Xiuhtecuhtli.html'>Xiuhtecuhtli</a>";
lords[2] = "<a href='/god/Itztli.html'>Itztli</a>";
lords[3] = "<a href='/god/Piltzintecuhtli.html'>Piltzintecuhtli</a>";
lords[4] = "<a href='/god/Centeotl.html'>Centeotl</a>";
lords[5] = "<a href='/god/Mictlantecuhtli.html'>Mictlantecuhtli</a>";
lords[6] = "<a href='/god/Chalchihuitlicue.html'>Chalchiuhtlicue</a>";
lords[7] = "<a href='/god/Tlazolteotl.html'>Tlazolteotl</a>";
lords[8] = "<a href='/god/Tepeyollotl.html'>Tepeyollotl</a>";
lords[9] = "<a href='/god/Tlaloc.html'>Tlaloc</a>";
lords[10] = "<a href='/god/Tepeyollotl.html'>Tepeyollotl</a> / <a href='/god/Tlaloc.html'>Tlaloc</a>";
		

   var today = new Date();
   year = today.getYear();
   if (year < 1900) { year = year + 1900};
   month = today.getMonth();
   date = today.getDate();
   hour = today.getHours();

   document.write("(", weekdays[today.getDay()+1], ", ", months[today.getMonth()+1], " ", date, ", ", year, ") is: </SPAN><p>");
      
   var julday = DateToJulian (year, month + 1, date);
   var daysum = julday + 5757 + 584283 - corr;
   
   var tonal = (julday - 164 + 584283 - corr) % 260;
   
   var tonalnum = ((daysum - 6) % 13) + 1;
   tonalnum = tonalnum - (tonalnum % 1);
   var tonalname = ((daysum - 1) % 20) + 1;
   tonalname = tonalname - (tonalname % 1);
   var yearbcorr = 0;
   if (yearb == "initial") {
   		yearbcorr = - 359;
   };
   var yearscorr = (yearc % 365) - 162;
   var xihuitltemp = (daysum - 39 + yearscorr) % 365;
   var xihuitlnum = ((daysum + 353 + yearbcorr - xihuitltemp) % 13) + 1;
   var xihuitlname = ((daysum +358 + yearbcorr - xihuitltemp) % 20) + 1;
   var trecenas = tonalname + 1 - tonalnum;
   if (trecenas < 1) 
   {
   		trecenas = trecenas + 20
    };
   var meztliname = Math.floor(xihuitltemp / 20) + 1;
   var meztlinum = (xihuitltemp % 20) + 1;
   var lctemp = julday - corr;
   
   var baktun = Math.floor(lctemp / 144000);
   lctemp = lctemp - baktun * 144000;
   
   var katun = Math.floor(lctemp / 7200);
   lctemp = lctemp - katun * 7200;
   
   var tun = Math.floor(lctemp / 360);
   lctemp = lctemp - tun * 360;
   
   var uinal = Math.floor(lctemp / 20);
   var kin = lctemp - uinal * 20;
   
   var nightlord=(tonal % 9) + 1;
   if (tonal==259) { nightlord=10 };
   
   document.write("<br>\n");
   document.write("<table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">");
   document.write("<tr><td width=200><h2>Xihuitl:</h2><i>solar year</i></td><td width=200><h2>Trecena:</h2><i>13-day period</i></td><td width=200><h2>Tonalli:</h2><i>day</i></td></tr>");
   document.write("<tr><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td></tr>");
   document.write("<tr><td align=center valign=top><IMG SRC=\"/images/axayacatl/count/"+counts[xihuitlnum]+".jpg\" ALIGN=TOP BORDER=\"0\"><A HREF=\"xihuitl/"+daysigns[xihuitlname]+".html\"><IMG SRC=\"/images/axayacatl/"+daysigns[xihuitlname]+".jpg\" ALIGN=TOP BORDER=\"0\" ALT=\""+daysignst[xihuitlname]+"\"></A></td>");
   document.write("<td align=center valign=top><IMG SRC=\"/images/axayacatl/count/Ce.jpg\" ALIGN=TOP BORDER=\"0\"><A HREF=\"trecena/",daysigns[trecenas]+ ".html\"><IMG SRC=\"/images/axayacatl/"+daysigns[trecenas]+".jpg\" ALIGN=TOP BORDER=\"0\" ALT=\""+daysignst[trecenas]+"\"></A></td>");
   document.write("<td align=center valign=top><A HREF=\"/daycount/",counts[tonalnum]+ ".html\"><IMG SRC=\"/images/axayacatl/count/"+counts[tonalnum]+".jpg\" ALIGN=TOP BORDER=\"0\"></A><A HREF=\"/tonal/",daysigns[tonalname]+".html\"><IMG SRC=\"/images/axayacatl/"+daysigns[tonalname]+".jpg\" ALIGN=TOP BORDER=\"0\" ALT=\""+daysignst[tonalname]+"\"></A></td></tr>");
   document.write("<tr><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td></tr>");
   document.write("<tr><td>"+xihuitlnum+" - <A HREF=\"xihuitl/"+daysigns[xihuitlname]+".html\">"+daysigns[xihuitlname]+"</A> ("+daysignst[xihuitlname]+")</td>");
   document.write("<td><A HREF=\"trecena/",daysigns[trecenas]+ ".html\">1 - "+daysigns[trecenas]+"</A> ("+daysignst[trecenas]+")</td>");
   document.write("<td> <A HREF=\"daycount/",counts[tonalnum]+ ".html\">"+tonalnum+"</a> - <A HREF=\"tonal/",daysigns[tonalname]+".html\">"+daysigns[tonalname]+"</A> ("+daysignst[tonalname]+")</td></tr>");
   //if (mode == "Expert") {
     document.write("<tr><td colspan=\"3\">&nbsp;</td></tr>");
     document.write("<tr><td width=200><h2>Yoaltecuhtli:</h2><i><i>Lord of the Night</i></i></td><td width=200><h2>Xiuhpohualli:</h2><i>365-day calendar</i></td><td width=200><h2>Long Count:</h2><i>(Maya Calendar)</i></td></tr>");
     document.write("<tr><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td></tr>");
     document.write("<tr><td>"+lords[nightlord]+"</td><td>"+ meztlinum + " - " + meztli[meztliname] + " (" +meztlig[meztliname] +")</td><td>"+ baktun + "." + katun + "." + tun + "." + uinal + "." + kin +"</td></tr>");
     document.write("<tr><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td><td><IMG SRC=\"images/dot_red.gif\" ALIGN=TOP WIDTH=\"175\" HEIGHT=\"1\" BORDER=\"0\" VSPACE=\"4\"></td></tr>");
   //};
   
   
   document.write("</table><br>");
   
   
   
   
   if ((tonalnum == 1) && ((tonalname == 3)  ||  (tonalname ==  7) || (tonalname == 11) || (tonalname == 15) || (tonalname == 19)))
   {
   		document.write("This very day is influenced by the <A HREF=\"teotl/Cihuateteo.html\">Cihuateteo</A>.<br>")
   };
   if (tonalname == 1){
   		if (tonalnum == 1){
   			document.write("1-Cipactli is a favourable day to start a trade expedition or to give a singing feast (cuicuicaliztli). <br>");
   		};
   };
   if (tonalname == 2){
   		if (tonalnum == 4){
   			document.write("4-Ehecatl has positive and negative aspects. On this day the Huey Tlahtoani (supreme ruler of the Aztec empire) regained powers to recuperate from the negative influence of the <A HREF=\"teotl/Cihuateteo.html\">Cihuateteo</A> of day 1-<A HREF=\"tonal/Quiahuitl.html\">Quiahuitl</A>. People burned special herbs in their fires to protect them from bad spirits (nanahualtin).<br>");
   		} else
   		if (tonalnum == 9){
   			document.write("9-Ehecatl is an other name/personification of <A HREF=\"teotl/Quetzalcoaltl.html\">Quetzalcoatl</A>.<br>");
   		};
   };
   if (tonalname == 3){
   		if (tonalnum == 5){
   			document.write("5-Calli is the name day of Macuilcalli, a patron god of the jewel workers.<br>");
   		} else
   		if (tonalnum == 7){
   			document.write("7-Calli is a good day to return from a trade expedition and have a necxipahquiliz (feet washing) ceremony.<br>");
   		};
   };
   if (tonalname == 5){
   		if (tonalnum == 1){
   			document.write("1-Coatl is a good day to start a trade expedition.<br>");
   		} else
   		if (tonalnum == 7){
   			document.write("7-Coatl is the name day of Chicomecoatl, Corn Goddess, the female equivalent of <A HREF=\"/god/Xochipili.html\">Xochipili</A>. A good day to start a trade expedition. Ceremony for the <A HREF=\"teotl/Cihuateteo.html\">Cihuateteo</A> at the temple of Aticpac. <br>");
   		};
   };
   if (tonalname == 8){
   		if (tonalnum == 1){
   			document.write("1-Tochtli is the day for the feast of Xiuhtecuhtli, Lord of the Year, and Fire God.<br>");
   		} else
   		if (tonalnum == 2){
   			document.write("2-Tochtli is the name day of Ometochtli, a pulque (<i>octli</i>) god. <br>");
   		} else
   		if (tonalnum == 5){
   			document.write("5-Tochtli is the name day of Macuiltochtli, a patron god of the feather-mosaic workers. <br>");
   		};
   };
   if (tonalname == 10){
   		if (tonalnum == 1){
   			document.write("1-Itzcuintli is dedicated to Xiuhtecuhtli-Tlalxictentica, Lord of the Year, a Fire God. This god is honored by offering precious gifts and burning them. This ceremony is called Nextlahualli (payment).<br>");
   		} ;
   };
   if (tonalname == 11){
   		if (tonalnum == 1){
   			document.write("1-Ozomahtli is the first day of eight in a row specially associated with pulque (<i>octli</i>).<br>");
   		} else
   		if (tonalnum == 7){
   			document.write("7-Ozomahtli is a good day for a singing feast (cuicuicaliztli). It is also a good day to return from a trade expedition and have a necxipahquiliz (feet washing) ceremony.<br>");
   		} ;
   };
   if (tonalname == 12){
   		if (tonalnum == 2){
   			document.write("2-Malinalli is the second day of eight days in a row specially associated with pulque (<i>octli</i>). <br>");
   		} ;
   };
   if (tonalname == 13){
   		if (tonalnum == 1){
   			document.write("1-Acatl is the name day of <A HREF=\"teotl/Quetzalcoatl.html\">Quetzalcoatl</A>.<br>");
   		} else
   		if (tonalnum == 2){
   			document.write("2-Acatl is the name day of <A HREF=\"teotl/Tezcatlipoca.html\">Tezcatlipoca</A>.<br>");
   		} else
   		if (tonalnum == 3){
   			document.write("3-Acatl is the third day of eight days in a row specially associated with pulque (<i>octli</i>). <br>");
   		} else
   		if (tonalnum == 4){
   			document.write("4-Acatl is the calendric sign of Xiuhtecuhtli, Lord of the Year, the God of Fire. <br>");
   		}else
   		if (tonalnum == 13){
   			document.write("On day 13-Acatl the present age, the Fifth Sun, was born (see <A HREF=\"teotl/Tonatiuh.html\">Tonatiuh</A>). <br>");
   		};
   };
   if (tonalname == 14){
   		if (tonalnum == 4){
   			document.write("4-Ocelotl is is the fourth day of eight days in a row specially associated with pulque (<i>octli</i>). <br>");
   		} else
   		if (tonalnum == 5){
   			document.write("5-Ocelotl is the name day of the earth god Macuilocelotl, a patron god of the feather mosaic workers.<br>");
   		} ;
   };
   if (tonalname == 15){
   		if (tonalnum == 5){
   			document.write("5-Cuauhtli is the fifth day of eight days in a row specially associated with pulque (<i>octli</i>).<br>");
   		} ;
   };
   if (tonalname == 16){
   		if (tonalnum == 6){
   			document.write("6-Cozcacuauhtli is the sixth day of eight days in a row specially associated with pulque (<i>octli</i>).<br>");
   		} ;
   };
   if (tonalname == 17){
   		if (tonalnum == 4){
   			document.write("4-Ollin is the name of the fifth and present era, in which <A HREF=\"teotl/Tonatiuh.html\">Tonatiuh</A> is the sun.<br>");
   		} else
   		if (tonalnum == 7){
   			document.write("7-Ollin is the seventh day of eight days in a row specially associated with pulque (<i>octli</i>).<br>");
   		};
   };
   if (tonalname == 18){
   		if (tonalnum == 1){
   			document.write("1-Tecpatl is a day to honor Huitzilopochtli, the Hummingbird Sorcerer, god of the will and the intent, Lord of the South. <br>");
   		} else
   		if (tonalnum == 7){
   			document.write("7-Tecpatl is a day for the feast of the Corn Goddess Chicomecoatl, Seven Snake.<br>");
   		} else
   		if (tonalnum == 8){
   			document.write("8-Tecpatl is the last of eight days in a row specially associated with pulque (<i>octli</i>).<br>");
   		};
   };
   if (tonalname == 20){
   		if (tonalnum == 5){
   			document.write("5-Xochitl is the name day of Macuilxochitl, the God of Dancing and Singing, often represented by a monkey.<br>");
   		} ;
   };
   
   //document.write("");
   if (mode == "Expert") {
   		document.write("(" + cname + " correlation)")
   } else {
   		if (correlation == "Horden") { document.write("(Francisco Rodriguez Cortes correlation)")}
   		else {document.write("(Alfonso Caso correlation)")}
   };
   document.write("<br>");
   
   document.close();
};
   

calc();
<!-- end hiding contents from old browsers  -->
