// This file contains the code for the time specific routines that are used on
// most of my pages.....


// This first one is the last modified date for the pages......
// strg is the label, it defaults to "Page last updated on " if left null.
function ModifiedDate(strg) {

	var rtnstrg;

	var MonthName = new Array(12);
	MonthName[0] = 'January';
	MonthName[1] = 'February';
	MonthName[2] = 'March';
	MonthName[3] = 'April';
	MonthName[4] = 'May';
	MonthName[5] = 'June';
	MonthName[6] = 'July';
	MonthName[7] = 'August';
	MonthName[8] = 'September';
	MonthName[9] = 'October';
	MonthName[10] = 'November';
	MonthName[11] = 'December';

	var DayName = new Array(7);
	DayName[0] = 'Sunday';
	DayName[1] = 'Monday';
	DayName[2] = 'Tuesday';
	DayName[3] = 'Wednesday';
	DayName[4] = 'Thursday';
	DayName[5] = 'Friday';
	DayName[6] = 'Saturday';
	
	var modDate = new Date(document.lastModified);
	
	var Year = modDate.getYear();
	if (Year < 1000) {
		if (Year < 70) {
			Year = Year + 2000;
		} else {
			Year = Year + 1900;
		}
	}
	
	var Month = modDate.getMonth() + 1;			// Date works on a 0 - 11 system......
	var DayNumber = modDate.getDate();
	var Day = modDate.getDay();
	
	var Hour = modDate.getHours();
	if (Hour > 12) {
		Hour = Hour - 12;
		end = 'P.M.';
	} else {
		end = 'A.M.';
	}
	
	var Minute = modDate.getMinutes();
	if (Minute < 10) {
		Minute = '0'+Minute;
	}
	
	var Second = modDate.getSeconds();
	if (Second < 10) {
		Second = '0'+Second;
	}
	
	
	if (!strg) {
		strg = 'Page Last Updated on ';
	}
	
	rtnstrg = strg+DayName[Day]+', '+MonthName[Month-1]+' '+DayNumber+', '+Year+' '+Hour+':'+Minute+':'+Second+' '+ end;

	return rtnstrg;

	//document.write(strg+DayName[Day]+', '+MonthName[Month-1]+' '+DayNumber+', '+Year+' '+Hour+':'+Minute+':'+Second+' '+ end);

}


// This will write the current date to the page
function GetDate(strg) {

	var rtnstrg;

	var MonthName = new Array(12);
	MonthName[0] = 'January';
	MonthName[1] = 'February';
	MonthName[2] = 'March';
	MonthName[3] = 'April';
	MonthName[4] = 'May';
	MonthName[5] = 'June';
	MonthName[6] = 'July';
	MonthName[7] = 'August';
	MonthName[8] = 'September';
	MonthName[9] = 'October';
	MonthName[10] = 'November';
	MonthName[11] = 'December';

	var DayName = new Array(7);
	DayName[0] = 'Sunday';
	DayName[1] = 'Monday';
	DayName[2] = 'Tuesday';
	DayName[3] = 'Wednesday';
	DayName[4] = 'Thursday';
	DayName[5] = 'Friday';
	DayName[6] = 'Saturday';
	
	var modDate = new Date();
	
	var Year = modDate.getYear();
	if (Year < 1000) {
		if (Year < 70) {
			Year = Year + 2000;
		} else {
			Year = Year + 1900;
		}
	}
	
	var Month = modDate.getMonth() + 1;			// Date works on a 0 - 11 system......
	var DayNumber = modDate.getDate();
	var Day = modDate.getDay();
	
	if (!strg) {
		strg = 'Current Date : ';
	}

	rtnstrg = strg+DayName[Day]+', '+MonthName[Month-1]+' '+DayNumber+', '+Year;
	
	return rtnstrg;
	
	//document.write(strg+DayName[Day]+', '+MonthName[Month-1]+' '+DayNumber+', '+Year);

}


// This will write the current time to the page
function GetTime(strg) {

	var rtnstrg;
	
	var modDate = new Date();
	
	var Hour = modDate.getHours();
	if (Hour > 12) {
		Hour = Hour - 12;
		end = 'P.M.';
	} else {
		end = 'A.M.';
	}
	
	var Minute = modDate.getMinutes();
	if (Minute < 10) {
		Minute = '0'+Minute;
	}
	
	var Second = modDate.getSeconds();
	if (Second < 10) {
		Second = '0'+Second;
	}
	
	
	if (!strg) {
		strg = 'Current Time : ';
	}
	
	rtnstrg = strg+Hour+':'+Minute+':'+Second+' '+ end;
	
	return rtnstrg;

	//document.write(strg+Hour+':'+Minute+':'+Second+' '+ end);

}
