"
top.frames[1].document.close();
top.frames[1].document.write(txt);
top.frames[1].document.close();
top.frames[0].document.close();
}
function PlotMonth(country, rd) {
var leap = ((yr % 4)==0) && !((yr % 100)==0) || ((yr % 400)==0);
if (leap) {
d=d.substring(0,2) +"29" + d.substring(4,d.length);
}
// Pick the ultimo from the d string for this month.
pos0 = 2*mo;
pos2 = pos0 + 2;
ultimo = eval(d.substring(pos0,pos2));
// frstsund = (dy==6)? 1 : 7 - dy; // Original code
frstsund = 7 - dy;
spansund = ultimo - frstsund;
lastsund = ultimo - (spansund % 7);
if(country=="A") {HolidA(); var ll=1;} // Calendrical calc. *
if(country=="CDN") {HolidCDN(); var ll=0;} // *
if(country=="CH") {HolidCH(); var ll=1;} // *
if(country=="D") {HolidD(); var ll=1;} // *
if(country=="E") {HolidE(); var ll=3;} // *
if(country=="F") {HolidF(); var ll=2;} // *
if(country=="GB") {HolidGB(); var ll=0;} // *
if(country=="I") {HolidI(); var ll=4;} // *
if(country=="USA") {HolidUSA(); var ll=0;} // Calendrical calc. *
// Initiate the HTML for an inner table; write month, year.
txt += "
"
+""+M[ll][mo]+" "+ yr + "
";
// Write the days of the week to header row
var ctr=0;
for (ii=0;ii<7;ii++) {
getColor(ctr);
txt += "
"
+""+D[ll][ii]+"
"; // ll -dito-
}
txt += ("
");
// Increment cells to dy (1st of month); write thru only rest of 1st week.
for (ii=0;ii<7;ii++){
if (ii ";
}
else{
ctr++;
getColor(ctr);
bc=(ctr==rd)? "0000FF" : bc;
txt += "
"+ctr+" "+
hname + "
";
}
}
txt += "
";
// Increment, print cells thru ultimo, then print blank cells
while (ctr < ultimo){
for (ii=0;ii<7;ii++){
ctr++;
getColor(ctr);
bc=(ctr==rd)? "#0000FF" : bc;
if (ctr > ultimo){
txt += "
";
}
else{
txt += ("
"+ctr+" "
+ hname + "
");
}
}
txt += ("
");
}
txt += ("
");
}
function currentTimes(p0m) { // caller: cal1()
var pdy = new Date();
var pmo = pdy.getMonth();
var pyr = pdy.getYear();
if(pyr < 200) pyr = 1900 + pyr; // originally < 100 failed on Ns>3.x
yr=pyr;
mo=pmo+p0m;
if(pmo==0 && p0m==-1) {
yr=parseInt(pyr)-1;
mo=11;
}
if(pmo==11 && p0m==1) {
yr=parseInt(pyr)+1;
mo=0;
}
var bgn = new Date(M[0][mo] + " 1," + yr); // Date(US-style for 1st of mo)
dy = bgn.getDay() - 1; // getDay -> 0...6 (0=So...,6=Sa)
if(dy==-1) {dy = 6;} // -> 0=Mo,...5=Sa, 6=So
rd0= pdy.getDate(); // d of week of 1st of month
}
function userTimes(p0m) { // caller cal2()
yr=pyr;
mo=pmo+p0m;
if(pmo==0 && p0m==-1) {
yr=pyr-1;
mo=11;
}
if(pmo==11 && p0m==1) {
yr=pyr+1;
mo=0;
}
var leap =((yr % 4)==0) && !((yr % 100)==0) || ((yr % 400)==0);
var ny = yr - 1;
var dd = (leap)? suml[mo] : sumr[mo];
with(Math) {
absolute = 365*ny + floor(ny/4) - floor(ny/100) + floor(ny/400) + dd;
dy = absolute % 7; // d of w of 1st of mo (0=Mo, 6=So)
}
}
function getColor(ctr) { // caller: PlotMonth()
bg=(ii<6)? bg1 : bg2; // BGcolor weekd : sundy
bc=(ii<6)? "#000000" : "#FF0000"; // Font color weekd : sundy
var lim1 = H[mo].indexOf("~" + ctr + " "); // indexOf=-1 on no match holidy
hname=" ";
if (lim1 > -1) { // Do the holidays for "mo":
hname1 = H[mo].substring(lim1 + 3, H[mo].length);
var lim2 = hname1.indexOf("!"); // ...search H[] and extract
hname = hname1.substring(0, lim2);
bg = hname1.substring(lim2+1, lim2+10);
bc = "#FFFFFF";
}
}
// ****************Holiday calculus; and, definitions into H(12)******************
function Easter() {
with(Math) {
var a = yr % 19;
var b = floor(yr/100);
var c = yr % 100;
var d = floor(b/4);
var e = b % 4;
var g = floor((8*b + 13)/25);
var h = (19*a + b - d - g + 15) % 30;
var m = floor((a + 11*h)/319);
var i = floor(c/4);
var k = c % 4;
var l = (2*e + 2*i - k - h + m + 32) % 7;
this.n= floor((h - m + l + 90)/25); // n th month
this.p= (h - m + l + this.n + 19) % 32; // p th day = Easter Sunday
}
}
function FixedHd(day, holid, color) { // month = civil numeration
H[mo] += "~" + day + " " + holid + "!'" + color + "'";
}
function EpivotHd(esundy, emo, delta, holid, color) {
if(emo>3 || emo < 2) {alert("Error 100, please report to hvogel@travlang.com")};
var leap =new Boolean( ((yr % 4)==0) && !((yr % 100)==0) || ((yr % 400)==0) );
var leapDay = (leap)? 1 : 0;
var sum = (leap)? suml[emo] : sumr[emo];
sum += esundy + delta;
var hd = sum - 31; // the holiday of month
var hm = 1; // the holimonth
if(hd > 28 + leapDay) { // in Feb?
hd = hd - 28 - leapDay;
hm++;
}
var num = 31;
while(hd > num) { // in Mar, Apr, ...?
hd -= num; // (will be false for Aug(!) )
hm++;
num = (num==31)? 30 : 31;
}
if(hm>6) alert("Sorry, our error; please notify us, "+holid+
" cannot be in mo="+hm);
var word = "~" +hd+ " " +holid+ "!'" +color+ "'";
H[hm] += word;
}
// *********************Utility Programs***********************************
function NulloutH() { // H used in HolidCDN, etc, as H +=...
for(var i=0; i<=11; i++) {H[i] = "";}
}
// New window upon click of form "window0". See file yrmo_usa.htm
function doNew(form) { // v. Danny Goodman "Handbook" (1996)
var x = form.xyz.value.toLowerCase(); // Chap 7 "Methods, open"p.105-109
myWind=window.open("holcom"+x+".htm","HComm");
myWind=window.open("holcom"+x+".htm","HComm");
myWind.creator = window; // Chap 16 "New Windows" p. 393-395
}
function collectTxt(kind, land) { // callers: cal1(), cal2()
if(kind=="title") { // ***
if(land=="A" ) var txt=titleA();
if(land=="CDN") var txt=titleCDN();
if(land=="CH" ) var txt=titleCH();
if(land=="D" ) var txt=titleD();
if(land=="E" ) var txt=titleE();
if(land=="F" ) var txt=titleF();
if(land=="GB" ) var txt=titleGB();
if(land=="I" ) var txt=titleI();
if(land=="USA") var txt=titleUSA();
}
if(kind=="gloss") { // ***
if(land=="A" ) var txt=glossA();
if(land=="CDN") var txt=glossCDN();
if(land=="CH" ) var txt=glossCH();
if(land=="D" ) var txt=glossD();
if(land=="E" ) var txt=glossE();
if(land=="F" ) var txt=glossF();
if(land=="GB" ) var txt=glossGB();
if(land=="I" ) var txt=glossI();
if(land=="USA") var txt=glossUSA();
}
return txt;
}
// Form input checking routines
function chkInp(form) { // in yrmo_???.htm
In[0]=form.year.value; // instantiation
In[1]=form.month.value; // instantiation
if(dataRecord(0) && dataRecord(1)) { // Utility programs
for(var i=0; i<=1; i++) { // strip any/all leading 0s
var x = In[i]
while(x.charAt(0) == "0") {
x=x.substring(1,x.length);
}
In[i]=x; // x is now string
}
cal2(form); // key work routine
} else {
if(! dataRecord(0)) {
form.year.focus();
form.year.select();
}
if(! dataRecord(1)) {
form.month.focus();
form.year.select();
}
}
}
function dataRecord(mode) { // caller: chkInp()
if(! isEmpty(mode)) {
if(isPosInt(mode)) {
if(mode==0 && In[0]>0 && In[0]<9999) return true;
if(mode==1 && In[1]>0 && In[1]<13) return true;
alert("Year to be in range 1....9998, month in range 1...12");
return false;
} else {
alert("Only unsigned integer numbers are accepted");
return false;
}
} else {
alert("Please submit a number for, each, year and month");
return false;
}
}
function isEmpty(mode) { // check whether empty
if(In[mode]==null || In[mode]=="") return true;
return false;
}
function isPosInt(mode) { // check whether positive integer
inputStr="" + In[mode];
for(var i=0; i "9") return false;
}
return true;
}
// **********************Holidays, Titles and Glossaries*******************
function HolidA() {
NulloutH();
var edt = new Easter(); // edt.p=ESundy; edt.n=Emonth
if(mo==0 && yr>1581) FixedHd(1, "Neujr", "#dc143c");
if(mo==0 && yr>1581) FixedHd(6, "Hlg3K", "#c71585");
if(mo==2 && yr>1960) FixedHd(lastsund, " SZt", "#cd853f");
if(mo==4 && yr>1888) FixedHd(1, "1 Mai", "#ff00ff");
if(mo==7 && yr>1581) FixedHd(15,"Maria", "#ff1493");
if(mo==9 && yr>1815) FixedHd(26,"Fahne", "#4682b4");
if(mo==9 && yr>1996) FixedHd(lastsund, " SZt", "#cd853f");
if(mo==10 && yr>1581) FixedHd(1, "Aller", "#ff7f50");
if(mo==11 && yr>1581) FixedHd(8, "Empf ", "#d2691e");
if(mo==11 && yr>1581) FixedHd(25,"Weihn", "#ba55d3");
if(mo==11 && yr>1581) FixedHd(26,"Steph", "#ba55d3");
if(yr>1581) EpivotHd(edt.p, edt.n-1, -2, "Karfr", "#008000");
if(yr>1581) EpivotHd(edt.p, edt.n-1, 0, "Oster", "#ff0000");
if(yr>1581) EpivotHd(edt.p, edt.n-1, 1, "Oster", "#ff0000");
if(yr>1581) EpivotHd(edt.p, edt.n-1, 39, "ChrHi", "#3cb371");
if(yr>1581) EpivotHd(edt.p, edt.n-1, 49, "Pfing", "#ff8c00");
if(yr>1581) EpivotHd(edt.p, edt.n-1, 50, "Pfing", "#ff8c00");
if(yr>1581) EpivotHd(edt.p, edt.n-1, 60, "Fronl", "#228b22");
}
function titleA() {
text = "