<!--

// refresh every 12 hours
	document.write("<meta http-equiv=refresh content=43200>");

var today = new Date();
var year = today.getFullYear();
var date = today.getDate();
var month = today.getMonth();
var weekday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
var day = weekday[today.getDay()];
var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");

// the number of weeks since 1970...
var weeknum = Math.floor(today.getTime() / 1000 / 60 / 60 / 24 / 7);

// the week number of the year...
var janfirst = new Date("Sun, 1 Jan " + year + " 00:00:00");
var weekinyear = Math.floor((today - janfirst) / 1000 / 60 / 60 / 24 / 7) + 1;

 
 function GetSuffix(adate) {
    if ( adate > 9 ) var substring = String(adate).substr(1,1);
    else   var substring = String(adate).substr(0,1);
//    document.write(" " + substring);
    if ( substring == "1" ) { suffix = "st" } 
    else 
    if ( substring == "2" ) { suffix = "nd" } 
    else 
    if ( substring == "3" ) { suffix = "rd"} 
    else { suffix = "th" }
    if (( adate >= 11 ) && ( adate <= 13 )) { suffix = "th" }
    return suffix;
 }


        var TableLength = 0;

        dstZones = new Array ();
        qReport = new Array ();
        TableTimes = new Array();
        currentQuery = null;
        var NAV4 = (navigator.appVersion.charAt(0) == "4" && navigator.appVersion.charAt(2) == "0" && navigator.appName=="Netscape") ? true : false;
        var timerID = null;
        var timerRunning = false;
        var Local = new Date();
        var GMToffset = Local.getTimezoneOffset();

        if (!(navigator.appName.charAt(0) == "M" && navigator.appVersion.charAt(0)==3))  {
                if (GMToffset < 0) {GMToffset = Math.abs(GMToffset)}
                else {GMToffset = GMToffset - (Math.abs(GMToffset) *2)};
        };
        var newline= (navigator.appVersion.lastIndexOf('Win') != -1) ? "\r\n" : "\n";

function Into24hrs (time) {
        if ( time > 1440)
                { time -= 1440}
        else
                { if ( time <0) { time = 1440 + time } };
        return time;
        } // --- Into24hrs

function GMTnow (GMT) {
        var time = new Date();
        hrs = time.getHours();
        mins = time.getMinutes();
        GMT = (hrs*60 + mins) - GMToffset;
        GMT = Into24hrs(GMT);
        return GMT;
        }

function formatRelative (time) {
        var Report = null;
        var Direction  = (time > 0) ? " ahead" : " behind";
        time = Math.abs (time);
        var Hours = Math.floor (time/60);
        var Mins = (time - Hours * 60);
        Report = Hours + "h ";
        if (Mins != 0) {Report=Report+Mins + "m "};
        Report = Report+ Direction;
        if (time== 0) {Report="Same Time"};
        return Report;
        }; 

function formatTime (time) {
        var fHours = Math.floor (time/60) ;
        if (fHours <= 9) {fHours = "0" + fHours}; 
        var fMins = time - (fHours * 60);
        if (fMins <= 9) {fMins = "0" + fMins}; 
        var fTime = fHours + ":" + fMins;
        return fTime;
        };

function CheckDST () {
        var uNow = new Date();  
        var uYear = uNow.getYear();
        var leap = ((uYear % 4 == 0 && uYear % 100 != 0) || uYear % 400 == 0 )? true : false;
        MonthDays = new Array (0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);
        var TodayNum = MonthDays [uNow.getMonth()] + uNow.getDate();    
        if (leap && TodayNum > 59) {TodayNum += 1};   
//FirstSun8Feb, FirstSun15Mar, LastSunMar, FirstSunApr, LastSunSep, FirstSunOct, FirstSun15Oct,LastSunOct, 
        ChangeDays = new Array (43, 78, 85, 92, 274, 281, 295, 302); 
        var NumChangeDays = ChangeDays.length;
        if (leap) { for (var idx = 0; idx <= 6; idx++) {ChangeDays [idx] += 1} };
        DSTdays = new Array ();
        LastJan1 = new Date("Jan 1, " + uYear);
        DayJan1 = LastJan1.getDay ();   
        for (var idx2 = 0; idx2 < NumChangeDays; idx2++) {
                DSTdays [idx2] = ( TodayNum >= ChangeDays [idx2] - DayJan1 ) ? true : false; 
                };
        dstZones[0] = null;
        dstZones[1] = null;
        dstZones[2] =  ( DSTdays[3] && !DSTdays[7] ) ? true : false;//usa/canada
        dstZones[3] =  ( DSTdays[2] && !DSTdays[7] ) ? true : false;//uk/europe
        dstZones[4] =  ( DSTdays[7] || !DSTdays[2] ) ? true : false;//aus       
        dstZones[5] =  ( DSTdays[5] || !DSTdays[2] ) ? true : false;//aus-tasmania
        dstZones[6] =  ( DSTdays[5] || !DSTdays[1] ) ? true : false;//nz
        dstZones[7] =  ( DSTdays[2] && !DSTdays[4] ) ? true : false;//russia
        }

function qReply (ZoneData) {
        currentQuery = ZoneData;
        qHandler (ZoneData);
        document.forms[1].elements[0].value =
                "Current Time = " + formatTime ( qReport[0] )
                + newline + "Relative to Local = "+ qReport[1] 
                + newline + "Relative to GMT = "+ qReport[2]
                + newline + "Using Daylight Savings? = " + qReport[3]; 
        }


function qHandler(ZoneData) {
        qReport[0] = ""; qReport[1] = ""; qReport[2] = ""; qReport[3] = "";     

        var qGMTparse = parseFloat(ZoneData);
        var qGMToffset_hrs = parseInt(qGMTparse, 10) ; 
        var qGMToffset_min= parseInt ( Math.round((qGMTparse-qGMToffset_hrs) * 100), 10);
        var qDSTperiod = ZoneData.charAt (ZoneData.length - 1);
        var qGMTperiod = 1440/60;
        if ( (qGMToffset_hrs > 12) || (qGMToffset_hrs <-11) ) {qReport[0] = "BAD DATA"; return};
        if (qDSTperiod > dstZones.length) {qReport[3] = "BAD DATA"};

        var relGMT = (qGMToffset_hrs * 60) + qGMToffset_min; 
        if (qDSTperiod>1 && dstZones [qDSTperiod]) {relGMT += 60; qReport[3] = "Yes (+1 hour)"} else {qReport[3] = "No"};
        if (qDSTperiod == 0) {qReport[3] = "n/a"};
        if (qDSTperiod == 1) {qReport[3] = "uncertain"};

        var qPlaceTotMins = GMTnow (qPlaceTotMins);
        qPlaceTotMins += relGMT; 
        qPlaceTotMins = Into24hrs (qPlaceTotMins);
        qReport[0] = qPlaceTotMins;

        qReport[2] = formatRelative (relGMT);

        var relLoc = relGMT - GMToffset;
        qReport[1] = formatRelative (relLoc);
        }

function writeClocks () {
        var GMT = GMTnow (GMT);
        var fTime = formatTime ( Into24hrs (GMT + GMToffset) );
	        document.getElementById("localtime").innerHTML = "  "+ fTime; 
//        var fTime = formatTime ( Into24hrs (GMT) ); 
//	        document.getElementById("gmttime").innerHTML = "  "+ fTime; 
        var TableClock = null;
        for (var idx = 0; idx < TableLength; idx++) {
                TableClock = null;
                TableClock += (GMT+TableTimes[idx]);
			eleid = "time" + idx;
	                document.getElementById(eleid).innerHTML = "  "+ formatTime ( Into24hrs ( TableClock ) );
        };
        if (currentQuery != null) {qReply (currentQuery)};      
}

function stopclocks (){
        if(timerRunning)
                clearTimeout(timerID);
        timerRunning = false;
        }

function showclocks () {
        writeClocks();
        timerID = setTimeout("showclocks()",1000);
        timerRunning = true;
        }

function startClocks () {
//      if (NAV4) {writeClocks();alert ("Sorry, the 'real time' clocks have been disabled for Netscape4(communicator)"
//                    +" as they crash the browser.\n\n"
//                    +"Reload to update the times.\n\nSoon to be fixed")
//              }
//      else {
stopclocks(); 
showclocks()};
//      }




function writeTable () {

        document.write("<SPAN class='small' id='localtime'>&nbsp;</SPAN>&nbsp;&nbsp;");

}



// -->