function y2k(number) { return (number < 1000) ? number + 1900 : number; }

var now = new Date();
var yrs = y2k(now.getYear());
var then = new Date("December 30, 2009");
var newyr = new Date("January 1, 2010");
var gap3 = now.getTime() - newyr.getTime();
gap3 = Math.floor(gap3 / (1000 * 60 * 60 * 24));
var newmoon = new Date("December 31, 2009");
var newciv = new Date("December 31, 2009");
var gap2 = gap3+3; //now.getTime() - newciv.getTime();
// gap2 = Math.floor(gap2 / (1000 * 60 * 60 * 24));
var gap = then.getTime() - now.getTime();
gap = Math.floor(gap / (1000 * 60 * 60 * 24));
var gap1 = now.getTime() - newmoon.getTime();
gap1 = Math.floor(gap1 / (1000 * 60 * 60 * 24));
gap0 = gap1-3;   //+19;
if (gap1 < 1) { gap1 = 366 + gap1; }
//document.write("Only " + gap + " days \'till the fourth of July");
//document.write("This is day " + gap1 + " in the Graeco-Roman year");
var winctr = 0;
  
  function callup() {
     var yr="The Greek year: OLympiad ";
     var athyr=0;
     var athyr2=0;
     var romyr=0;
     athyr = Math.floor((yrs + 776)/4);
     athyr2 = (yrs + 776)%4;
     romyr = yrs + 753;
     yr=yr + " " + athyr + "." + athyr2;
     yr=yr + ";  the Roman year: AUC " + romyr;
     document.f[0].value = yr;
     document.f[1].value = "This is day " + gap0 + " in the Gregorian year";
     document.f[2].value = "This is " + rom[gap1] + " in the Republican Roman year";
     document.f[3].value = "This is " + ath[gap1] + " in the Athenian festival year";
     document.f[4].value = "This is " + pryt[gap2] + " in the Athenian civil year";
     document.f[5].value = "This is " + astr[gap3] + " in the Athenian astron/agricultural year";
     }

var g1=gap1;
var g2=gap2;
var g3=gap3;

  function plus() {
     g1 = g1 + 1;
     g2 = g2 + 1;
     g3 = g3 + 1;
    
     more.document.write("<body bgcolor=blue text=yellow>");
     more.document.write("Next is "+ath[g1]+" in the Athenian Festival year<br>");
     more.document.write("Next is "+pryt[g2]+" in the Athenian civil year<br>");
     more.document.write("Next is "+astr[g3]+" in the Athenian astro-agricultural year<br>");
}


/*     
  winctr++
  if (winctr == 1 ) {
              opwin1=window.open("","opwin1",",,,,scrollbars=yes,resizable=yes,,width=500,height=400");
              opwin1.document.write("This is day " + gap0 + " in the Gregorian year");
              opwin1.document.write("<br>Only " + gap + " days \'till Spring Vacation");
              opwin1.document.write("<br><br>This is day " + gap1 + " in the Graeco-Roman year<br>");
            for (k=gap1-5; k<gap1+6; k++) {
            if (k==gap1){ 
                opwin1.document.write("<br><font color=red>This is " + rom[k] + " in the Republican Roman year</font>"); }
            else {
                opwin1.document.write("<br>This is " + rom[k] ); }
                }
              opwin1.document.close();
              callup(2);
              }
  else {
     if (winctr == 2 ) {
              opwin2=window.open("","opwin2",",,,,scrollbars=yes,resizable=yes,,width=500,height=400");
              opwin2.document.write("<br><br>This is day " + gap1 + " in the Athenian festival calendar<br>");
            for (k=gap1-5; k<gap1+6; k++) {
            if (k==gap1){ 
                opwin2.document.write("<br><font color=red>This is " + ath[k] + " in the Athenian festival year</font>"); }
            else {
                opwin2.document.write("<br>This is " + ath[k] ); }
                }
              opwin2.document.close();
              }
     else {
        if (winctr == 3 ) {
              opwin3=window.open("","opwin3",",,,,scrollbars=yes,resizable=yes,,width=500,height=400");
              opwin3.location=targ;
              opwin3.document.close();
              }
        else {      winctr = 0;
              }
        }
      }
  }
*/  
  

