// Code is inserted into the head part of "calendar" var iMonth, iYear, iDay, currentDate, iNumberDays, iCurrentDate, I, sBuff, sTitle, sRevision, aDate, sType, aDateIndex, aDatePtr; function PutItTogether(n, s) { var buff=""; buff=buff + ""; buff=buff + n + "@" + s + ""; return(buff); } function DivideMe(m, d) { return (m / d - m % d / d); } function MonthName(m) { switch(m){ case 1: return "January"; case 2: return "February"; case 3: return "March"; case 4: return "April"; case 5: return "May"; case 6: return "June"; case 7: return "July"; case 8: return "August"; case 9: return "September"; case 10: return "October"; case 11: return "November"; case 12: return "December"; default: return "Unknown"; } } function WeekdayName(d) { var I; I=d % 7; switch (I) { case 0: return "Sunday"; case 1: return "Monday"; case 2: return "Tuesday"; case 3: return "Wednesday"; case 4: return "Thursday"; case 5: return "Friday"; case 6: return "Saturday"; default: return "Unknown"; } } function DaysPerMonth (m, y) { if (m < 1 || m > 12) return 0; if (m == 4 || m == 6 || m == 9 || m == 11) return 30; // Apr,Jun,Sep,Nov if (m == 2) { // Feb if ((y & 3) == 0) return 29; // Leap year return 28; } return 31; // Jan, Mar, May, Jul, Aug, Oct, Dec } function CalDays () { var J, iY, iD, iNum; iNum=0; if (iYear < 1901 || iYear > 2099) return 0; iY=iYear-1900; // Becomes 0-199 if (iMonth == 0 || iMonth > 12 || iDay == 0) return 0; if (iDay > DaysPerMonth(iMonth,iY)) return 0; iD=iDay; for (J=1; J < iMonth; J++) { // Calculate julian date iD=iD+DaysPerMonth(J,iY); } iNum=iD+(iY*365)+DivideMe(iY-1,4); // Days since 1-1-1900 return iNum; } function Decimal (n, l) { var b = new Number(n), buff; buff=b.toString(); while (buff.length < l) { buff="0"+buff; } return buff; } function Binary (buff, iSizeBuff) { var D, I, J, b; // parseInt() may not be available D=0; J=0; while (iSizeBuff > 0) { iSizeBuff=iSizeBuff-1; b=buff.charAt(J); J=J+1; I=0; if (b == "1") I=1; else if (b == "2") I=2; else if (b == "3") I=3; else if (b == "4") I=4; else if (b == "5") I=5; else if (b == "6") I=6; else if (b == "7") I=7; else if (b == "8") I=8; else if (b == "9") I=9; D=(D*10)+I; } return D; } function AddTheDate(s, t) { aDate[aDateIndex]="$"+s+t; aDateIndex=aDateIndex+1; } function AddTheDateStr(s) { aDate[aDateIndex]="#"+s+":"; aDateIndex=aDateIndex+1; } function AddDescription(ident, s) { aDate[aDateIndex]="@"+Decimal(ident,1)+s; aDateIndex=aDateIndex+1; } function AddTheEmail(ident, u, d) { aDate[aDateIndex]="&"+Decimal(ident,1)+u+"\n"+d; aDateIndex=aDateIndex+1; } function AddRevision(s) { sRevision=s; } function GetRevision() { return sRevision; } function GetTheDate(X) { var sBuff, sDate; sType=""; sDate=X; if (sDate.length > 11) sType=sDate.charAt(11); sBuff=sDate.substr(1,4); iYear=Binary(sBuff,4); sBuff=sDate.substr(6,2); iMonth=Binary(sBuff,2); sBuff=sDate.substr(9,2); iDay=Binary(sBuff,2); iNumberDays=CalDays(); } function SkipToDate() { var sBuff; while (aDatePtr < aDateIndex) { // Make sure we are looking Date entry sBuff=aDate[aDatePtr]; if (sBuff.charAt(0) == "$") break; aDatePtr=aDatePtr+1; } } function InitializeStuff () { aDate = new Array(); aDateIndex=0; currentDate=new Date(); iMonth=currentDate.getMonth()+1; iYear=currentDate.getFullYear(); iDay=currentDate.getDate(); iCurrentDate=CalDays(); } InitializeStuff();