//TRINPsite, 55.51.4-62.16.7, JS/StatWind.js

/*Copyright (C) 53-55 ASWW, M. Vincent van Mechelen. 
 All Rights Reserved.This script may be re-used for non-commercial puposes,
 if credit isgiven to the author and to TRINPsite in the source code.*/

function Greg_to_Metr(yChrEI,mGregI,dGregI)
{
  this.year=yChrEI-1945;
  if (mGregI==1) add_days=10;
  if (mGregI==2) add_days=41;
  if (mGregI==3) add_days=69;
  if (mGregI==4) add_days=100;
  if (mGregI==5) add_days=130;
  if (mGregI==6) add_days=161;
  if (mGregI==7) add_days=191;
  if (mGregI==8) add_days=222;
  if (mGregI==9) add_days=253;
  if (mGregI==10) add_days=283;
  if (mGregI==11) add_days=314;
  if (mGregI==12)
   { if (dGregI<22) yr_day=344+dGregI;
      else { this.year=this.year+1; yr_day=dGregI-21 }
   }
   else yr_day=dGregI+add_days;
  this.day=0;
  if (yChrEI%4==0)  // Gregorian leap year
   { if (yr_day>69 && mGregI>2)
      { yr_day=yr_day+1;
        if (yr_day==366) { this.week=52; this.day=8 }
      }
   }
  if (yr_day==183)
   { this.week=26; this.day=8 };
  if (this.day==0)
   { if (yr_day>182) yr_day=yr_day-1;
     this.day=1+((yr_day-1)%7);
     this.week=1+((yr_day-this.day)/7) }
  this.month=Math.floor((this.week+3)/4);
}

function two_digitS(number)
{ numberS=number;
  if (number<10) numberS="0"+numberS
  return(numberS)
}

function TodayF()
{ 
  today=new Date();
  yChrE=today.getYear();
  if (yChrE<2000)
   { if (yChrE>99) yChrE=yChrE+1900; else yChrE=yChrE+2000 }
  mGreg=today.getMonth()+1;
  dGreg=today.getDate();
  Today= new Greg_to_Metr(yChrE,mGreg,dGreg);
  yNow=Today.year; mNow=Today.month;
  month_noS=two_digitS(mNow);
  wNow=Today.week;
  week_noS=two_digitS(wNow);
  dNow=Today.day;
}

function StatWind(T)
{
 TodayF();
 beginS="Today's date is ";
 dateS=yNow+"."+week_noS+"."+dNow;
 endS="";
 if ((week_noS=="01")&&(dNow==1))
  endS=".  HAPPY NEW YEAR!"
 if (T) window.defaultStatus=beginS+dateS+endS;
  else document.write(dateS);
}

iFrameT=false; allFrameT=false; PathS="";
  // internal frame default values for formats older than M1 (56.15.7)
  // added on 61.31.2, because error message when not using HeadObjs.js or BodyObjs.js
contacT=true;
  // ContTRNP.js default value for formats older than M1 (56.15.7)
  // added on 62.16.7, because error message when not using HeadObjs.js or BodyObjs.js

//Copyright M.Vincent van Mechelen, DNI Foundation