function getYYYYMMDD()
{d=new Date();
 return d.getDate()+100*(d.getMonth()+1)+10000*d.getFullYear();
 };

function getTZ()
{d=new Date(); 
 dt=d.getTimezoneOffset();
 m=(dt<0)?-1:1;
 dt=m*dt;
 dt=Math.floor(dt/60)*100+(dt%60);
 dt=m*dt;
 return -dt; // We want + for East and - for West.
 };

function highlightToday()
{if (parseInt(navigator.appVersion) >=4 
     && navigator.appName!="Netscape"
	 )
   {x=eval('document.all.d' + getYYYYMMDD());
    if (x!=null)
	  x.className="today";
	};
 };

function conditionallyReloadPage(date,tz)
{if (date==0 || date==getYYYYMMDD())
   return; // The date is correct.
 if (tz==9999 || tz<-1200 || tz>1200)
   return; // Don't override Today and Tomorrow.
 myTZ=getTZ();
 if (tz==myTZ)
   return; // TZ is correct, so reloading won't help.
 url=window.location.pathname;
 for (i=0;;i=iNext)
  {iNext=url.indexOf("/",i+1);
   if (iNext==-1)
     {iNext=i;
	  break;
	  };
   v=parseInt(url.substring(i+1,iNext));
   if (!isNaN(v)
       && v<18000000
	   )
	 break;
   };
 /* So now i shows the first slash we should replace,
     and iNext shows the last slash. */
 url=url.substring(0,i+1)+myTZ+url.substring(iNext);
 if (url.substring(url.length-1)=="/")
   url=url+"today.htm"; // Get over an Internet Explorer bug: it strips the final slash.
 //window.location.pathname=url; // Appends the old window to History
 window.location.replace(url); // Replaces the old window in History.
 return;
 };
 
