// Copyright (C) ?E?D?e?c (http://www.losttechnology.jp/)
// f??i? ?\?|?d?A?3?E?P?e?I?2?c?R?E?N?g??-???3?
function IntRandom(max) {
  return Math.floor(Math.random()*max);
}
var hexStr = '0123456789abcdef';
function byte2Hex(b) {
  return hexStr.charAt(Math.floor(b / 16)) + hexStr.charAt(b % 16);
}
function RandomColor(id,timing,m) {
  if ((document.all)||(document.getElementById)) {
    m=(!m)?0:1;
    c=(document.all)?document.all(id).style:document.getElementById(id).style;
    cc='#'+byte2Hex(IntRandom(256))+byte2Hex(IntRandom(256))+byte2Hex(IntRandom(256));
    switch(m) {
      case(0):
        c.color=cc;
        break;
      case(1):
        c.backgroundColor=cc;
        break;
    }
    setTimeout('RandomColor("'+id+'",'+timing+','+m+')',timing);
  }
} 
function ColorMessage(id) {
  if ((document.all)||(document.getElementById)) {
    if (document.all) c=document.all.item(id)
    else c=document.getElementById(id);
    c.style.color='#'+byte2Hex(IntRandom(256))+byte2Hex(IntRandom(256))+byte2Hex(IntRandom(256));
    setTimeout('ColorMessage(\''+id+'\')',300);
  }
} 
function BGColorMessage(id) {
  if ((document.all)||(document.getElementById)) {
    if (document.all) c=document.all.item(id)
    else c=document.getElementById(id);
    c.style.backgroundColor='#'+byte2Hex(IntRandom(256))+byte2Hex(IntRandom(256))+byte2Hex(IntRandom(256));
    setTimeout('BGColorMessage(\''+id+'\')',300);
  }
}

function dispDate(dateVal) {
DaystoAdd=dateVal
TodaysDate = new Date();
TodaysDay = new Array('Sunday', 'Monday', 'Tuesday','Wednesday', 'Thursday', 'Friday', 'Saturday');
TodaysMonth = new Array('January', 'February', 'March','April', 'May','June', 'July', 'August', 'September','October', 'November', 'December');
DaysinMonth = new Array('31', '28', '31', '30', '31', '30', '31', '31', '30', '31', '30', '31');
function LeapYearTest (Year) {
if (((Year % 400)==0) || (((Year % 100)!=0) && (Year % 4)==0)) {
return true;
}
else {
return false;
}
}
CurrentYear = TodaysDate.getYear();
if (CurrentYear < 2000)
CurrentYear = CurrentYear + 1900;
currentMonth = TodaysDate.getMonth();
DayOffset = TodaysDate.getDay();
currentDay = TodaysDate.getDate();
month = TodaysMonth[currentMonth];
if (month == 'February') {
if (((CurrentYear % 4)==0) && ((CurrentYear % 100)!=0) || ((CurrentYear % 400)==0)) {
DaysinMonth[1] = 29;
}
else {
DaysinMonth[1] = 28;
}
}
days = DaysinMonth[currentMonth];
currentDay += DaystoAdd;
if (currentDay > days) {
if (currentMonth == 11) {
currentMonth = 0;
month = TodaysMonth[currentMonth];
CurrentYear = CurrentYear + 1
}
else {
month =
TodaysMonth[currentMonth+1];
}
currentDay = currentDay - days;
}
DayOffset += DaystoAdd;
function offsettheDate (offsetCurrentDay) {
if (offsetCurrentDay > 6) {
offsetCurrentDay -= 6;
DayOffset = TodaysDay[offsetCurrentDay-1];
offsettheDate(offsetCurrentDay-1);
}
else {
DayOffset = TodaysDay[offsetCurrentDay];
return true;
}
}
offsettheDate(DayOffset);TheDate  = DayOffset + ', ';
TheDate += month + ' ';
TheDate += currentDay + ', ';
if (CurrentYear<100) CurrentYear="19" + CurrentYear;
TheDate += CurrentYear;
document.write(' '+TheDate);
}

 

