﻿// set up the clock 
 var enabled = 1;
function TOfunc() {
  TO = window.setTimeout("TOfunc()",10000);
  var today = new Date();
  var hrStr = today.getHours();
  var minStr = today.getMinutes();
//document.write (minStr " " minStr.length);
  document.forms[0].elements[0].value = "This Computer's Time " + hrStr + ":" + minStr;
}

function setUpClock(){
document.write("<div class=\"chron_posn\">");
document.write("<form>");
document.write("<input type='text' name='disp' value='' size='25' onFocus='this.blur()'>");
document.write("<\/form>");
TO = window.setTimeout("TOfunc()",1000);
document.write("<\/div>");
}

//** ****************************** ****
//**  Script functions to generate  **** 
//**         calendar               **** 
//** ****************************** ****


function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
{
   this[0] = m0;
   this[1] = m1;
   this[2] = m2;
   this[3] = m3;
   this[4] = m4;
   this[5] = m5;
   this[6] = m6;
   this[7] = m7;
   this[8] = m8;
   this[9] = m9;
   this[10] = m10;
   this[11] = m11;
}
function calendar()
{
   var monthNames = "JanFebMarAprMayJunJulAugSepOctNovDec";
   var today = new Date();
   var thisDay;
   var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30,
      31, 30, 31);
   var monthBg = new Array(  "snow_truckBG.jpg", "daffodil1BG.jpg", "pansyBG.jpg", "easter_lilyBG.jpg", "petuniaBG.jpg", "demo_garden_beg1BG.jpg", "geo_burns_roseBG.jpg", "climb_roseBG.jpg", "gerberaBG.jpg", "leafcolorBG.jpg", "pumpkn02BG.jpg", "xmas_cactusBG.jpg");
   year = today.getYear();
   thisDay = today.getDate();
// Try to adjust year for firefox and other oddball situations
   if (year < 2000) {
   if (year < 10) year = year + 2000;
   if (year > 100) year = (year % 100) + 2000;
    }
// do the classic leap year calculation
   if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
      monthDays[1] = 29;
// figure out how many days this month will have...
   nDays = monthDays[today.getMonth()];
   // and go back to the first day of the month...
   firstDay = today;
   firstDay.setDate(1);
// and figure out which day of the week it hits...
   startDay = firstDay.getDay();
   document.writeln("<p class=\"chron_center\">");
// Get the calendar background image for this month
   calBg = monthBg[today.getMonth()];
   document.write("<table border background='"  +calBg +"'>");
//   document.write("<table border background='" +'\/blackbox\/' +calBg +"'>");
   document.write("<tr><th COLSPAN=7>");
   document.write(monthNames.substring(today.getMonth() * 3,
      (today.getMonth() + 1) * 3));
   document.write(". ");
   document.write(year);
   document.write("<tr><th>Sun<th>Mon<th>Tue<th>Wed<th>Thu<th>Fri<th>Sat");
// now write the blanks at the beginning of the calendar
   document.write("<tr>");
   column = 0;
   for (i=0; i<startDay; i++)
   {
      document.write("<td>");
      document.write("&nbsp;");
      column++;
   }
   for (i=1; i<=nDays; i++)
   {
      document.write("<td class=\"chron_center\">");
       if (i == thisDay)
         document.write("<span class=\"chron_bold\"><span class=\"chron_color\">");
         document.write(i);
      if (i == thisDay)
         document.write("<\/span><\/span>");
         document.write("<\/td>");
         column++;
      if (column == 7)
      {
         document.write("<\/tr><tr>"); // start a new row
         column = 0;
      }
   }
   document.write("<\/tr><\/table>");
   document.writeln("<\/p>");
}
