// BD217 Client & server-side Scripting    
// Final Project - Web site                  
// Kathleen M. Fulginiti - Fall 2001
//  
                                           
function MTime() {
// Script Routine to return page last update - 
// downloaded from More Excellent HTML text book	
// CD chapter 14 - year calculation bug fixed by KMF      

//			This set of functions is stored in a file!
//			Get the date last modified, and stuff 
//			in into the variable now
//			Notice that is is different than the 
//			previous incarnation of this function!
        now = new Date(document.lastModified);
//			Using the current time, 
//			parse out the hours data
        hours = now.getHours();
//			Parse out the minutes
        minutes = now.getMinutes();
//			Now for some magical stuff:
//
//			Add the hours to a string called timeVal       //
	timeVal = " " + ((hours > 12) ? hours - 12 : hours);
//
//			What this does:  If the hours are greater
//			than 12 (it is afternoon), subtract 12 from
//			the hours number because we will put an AM/PM
//			indicator on the time block.
        timeVal  += ((minutes < 10) ? ":0" : ":") + minutes;
//			In this case, if the minutes are less than
//			ten, put in the leading zero.  This is a very
//			nice example of using this structure.  It is
//			read "If the minutes are less than 10, then
//			add :0 to timeVal, otherwise just add : to
//			timeVal.  Then append the value for minutes
//			to timeVal.  
        timeVal  += (hours >= 12) ? " PM" : " AM";
//			The statement below returns the value of
//			the string timeVal created by this function.
//			That allows us to use the function call
//			directly as if it were this value.
   	return(timeVal);
}
function MDay() {
        when= new Date(document.lastModified);
	day = when.getDay();
//			This is one way to select a value based on
//			the number (0-7) returned by the getDay 
//			method.  In each case, the value returned and
//			stored in day is checked against one of the
//			possible values, and if it matches, a string
//			value is assigned to the variable day.  Not
//			terribly elegant, a cleaner solution is 
//			shown in the next function.
	if (day == 0) day=" Sunday";
	if (day == 1) day=" Monday";
	if (day == 2) day=" Tuesday"
	if (day == 3) day="Wednesday";
	if (day == 4) day="Thursday";
	if (day == 5) day=" Friday";
	if (day == 6) day="Saturday";
        return(day);
}
function MDate() {
huh=new Date(document.lastModified);
mMonth=huh.getMonth();
dDate=huh.getDate();
//yYear=huh.getYear() + 1900; this is a bug adds 1900 to 2001
//		The year returns years since 1900...add 1900 to
//		get the correct year...No Y2K problmes w/ this
//		script!  :-)
yYear=huh.getFullYear();
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";
//		The code below will set the variable mMonth to
//		the correct string by using the numerical value
//		as an index into the array MonthName created just
//		above.  A more elegant way to select a string, but
//		it does require more memory.  There are always
//		tradeoffs.
mMonth=MonthName[mMonth];
//		Since the getMonth function returns the numerical
//		value for the month, (0-11), we need to translate
//		that to a character string to make it friendly.
dater_str=" "+mMonth + " " + dDate + ", " + yYear;
return(dater_str);
}
