<!-- Copyright 2002 Bontrager Connection, LLC
// See http://willmaster.com/possibilities/archives/ for more info
//
// Specify the spelling of month names. They can be abbreviated 
//    or completely spelled out, and can be in any written language.

Month1  = 'January';
Month2  = 'February';
Month3  = 'March';
Month4  = 'April';
Month5  = 'May';
Month6  = 'June';
Month7  = 'July';
Month8  = 'August';
Month9  = 'September';
Month10 = 'October';
Month11 = 'November';
Month12 = 'December';


//
// Specify the spelling of month names. They can be abbreviated 
//    or completely spelled out, and can be in any written language.

Weekday1  = 'Sunday';
Weekday2  = 'Monday';
Weekday3  = 'Tuesday';
Weekday4  = 'Wednesday';
Weekday5  = 'Thursday';
Weekday6  = 'Friday';
Weekday7  = 'Saturday';



// Specify the format you want for your date/time display. Whatever 
//    you type between the quotes will be printed, except the 
//    following placeholders will be replaced with live data --
//
// Note 1: All placeholders are case sensitive.
//
//       YEAR -- The 4-digit year.
//         YR -- The 2-digit year.
//
//      MONTH -- The month name.
//         MT -- The month number.
//        0MT -- The month number, with a zero leading single digits.
// Note 2: The first character of 0MT is a zero, not a capital letter Oh.
//
//    WEEKDAY -- The day of the week.
//
//        DAY -- The day of the month.
//       0DAY -- The day of the month, with a zero leading single digits.
// Note 3: The first character of 0DAY is a zero, not a capital letter Oh.
//
//        H12 -- replaced with the hour (12-hour clock).
//       0H12 -- replaced with the hour (12-hour clock), with a zero leading single digits.
//        H24 -- replaced with the hour (24-hour clock).
//       0H24 -- replaced with the hour (24-hour clock), with a zero leading single digits.
//         MM -- replaced with the minute.
//         0M -- replaced with the minute, with a zero leading single digits.
//         SS -- replaced with the second.
//         0S -- replaced with the second, with a zero leading single digits.
//       AMPM -- replaced with "AM" if the time is before noon, "PM" otherwise.
// Note 4: The first character of 0H12, 0H24, 0M, and 0S is a zero, not a capital letter Oh.
//
// Here, specify the format:

DateTimeFormat = "WEEKDAY, MONTH DAY, YEAR";



//
// No further customization is necessary.
//

function FormatDateTimeString(fixedtime) {
var currentYear     = fixedtime.getFullYear();
var currentMonth    = fixedtime.getMonth();
var currentWeekDay  = fixedtime.getDay();
var currentMonthDay = fixedtime.getDate();
var currentHour     = fixedtime.getHours();
var currentMinute   = fixedtime.getMinutes();
var currentSecond   = fixedtime.getSeconds();
var re = '';
var datetimeString = DateTimeFormat;
re = /YEAR/g;
datetimeString = datetimeString.replace(re,currentYear);
var st = new String(currentYear);
var shortYear = st.charAt(2) + st.charAt(3);
re = /YR/g;
datetimeString = datetimeString.replace(re,shortYear);
currentMonth = currentMonth + 1;
st = String('st2 = Month' + currentMonth);
var st2 = '';
eval(st);
re = /MONTH/g;
datetimeString = datetimeString.replace(re,st2);
var si = '';
if(currentMonth < 10) { si = '0' + currentMonth; }
else                  { si =       currentMonth; }
re = /0MT/g;
datetimeString = datetimeString.replace(re,si);
re = /MT/g;
datetimeString = datetimeString.replace(re,currentMonth);
currentWeekDay = currentWeekDay + 1;
st = String('st2 = Weekday' + currentWeekDay);
eval(st);
re = /WEEKDAY/g;
datetimeString = datetimeString.replace(re,st2);
si = '';
if(currentMonthDay < 10) { si = '0' + currentMonthDay; }
else                     { si =       currentMonthDay; }
re = /0DAY/g;
datetimeString = datetimeString.replace(re,si);
re = /DAY/g;
datetimeString = datetimeString.replace(re,currentMonthDay);
var AmPm = 'pm';
if(currentHour < 12) { AmPm = 'am'; }
var twelveHour = currentHour;
if(currentHour > 12) { twelveHour = currentHour - 12; }
var zeroCurrentHour = currentHour;
if(currentHour < 10) { zeroCurrentHour = '0' + currentHour; }
var zeroCurrentMinute = currentMinute;
if(currentMinute < 10) { zeroCurrentMinute = '0' + currentMinute; }
var zeroCurrentSecond = currentSecond;
if(currentSecond < 10) { zeroCurrentSecond = '0' + currentSecond; }
var zeroTwelveHour = twelveHour;
if(twelveHour < 10) { zeroTwelveHour = '0' + twelveHour; }
re = /AMPM/g;
datetimeString = datetimeString.replace(re,AmPm);
re = /0H12/g;
datetimeString = datetimeString.replace(re,zeroTwelveHour);
re = /H12/g;
datetimeString = datetimeString.replace(re,twelveHour);
re = /0H24/g;
datetimeString = datetimeString.replace(re,zeroCurrentHour);
re = /H24/g;
datetimeString = datetimeString.replace(re,currentHour);
re = /0M/g;
datetimeString = datetimeString.replace(re,zeroCurrentMinute);
re = /MM/g;
datetimeString = datetimeString.replace(re,currentMinute);
re = /0S/g;
datetimeString = datetimeString.replace(re,zeroCurrentSecond);
re = /SS/g;
datetimeString = datetimeString.replace(re,currentSecond);
re = /am/g;
datetimeString = datetimeString.replace(re,'AM');
re = /pm/g;
datetimeString = datetimeString.replace(re,'PM');
return datetimeString;
} // end of function FormatDateTimeString()

function GetAndRelayCurrentDateTime() {
var mytime = new Date();
return FormatDateTimeString(mytime);
} // end of function GetAndRelayCurrentDateTime()

function UpdateDateTime() {
var t = GetAndRelayCurrentDateTime();
document.datetimeform.timespot.value = t;
setTimeout('UpdateDateTime()',1000);
} // end of function UpdateDateTime()
//-->

