/**************************************************
	mlf_lib.js
	Midlife Flight JavaScript Library
	Functions called by multiple pages
	This file is pathed to be in the main directory
	Paste the following into each page after the TITLE tag:
		<SCRIPT LANGUAGE=JavaScript SRC="ref/mlf_lib.js"></SCRIPT>
**************************************************/

/**************************************************
  txtModDate: shows the last modified date in a text string
	Paste  into page to show date
**************************************************/
function txtModDate(){
modDate = new Date(document.lastModified);
day = modDate.getDate();
month = modDate.getMonth();
year = modDate.getYear();
weekday = modDate.getDay();

  //Arrays to assign text to days and months
    dayArray = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    monthArray = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September",  "October", "November", "December") ;

txtWeekday = dayArray[weekday];
txtMonth = monthArray[month];

modDateString = "Page last modified " + txtWeekday + ", " + txtMonth + " "
modDateString += + day + ", " + year + ".  "

document.write(modDateString)
}


/**************************************************
  Zulu Time:  Returns and updates times in local and Zulu format in a text box
  It's made up of a number of functions that perform a set of tasks interdependently.
	Paste the following in the BODY tag:
					ONLOAD="startclock()"
	Paste the folowing where you want the clock to show:
					<FORM NAME="timedisplay"><CENTER><P><INPUT TYPE="text" NAME="displayface" SIZE="27" VALUE STYLE="font-family: Courier"></CENTER></FORM>
**************************************************/
function stopclock (){
timerID = null;
timerRunning = false;
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}

function showtime () {
IE3 = (navigator.appName.indexOf('Microsoft') >= 0
        && parseInt(navigator.appVersion) < 4);
now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
utcOffset=now.getTimezoneOffset()/60;
     //Correction for error in IE3 interpretation
if (IE3) utcOffset = -utcOffset;
utcHours=hours + utcOffset
timeValue = "" + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += (hours >= 12) ? " PM" : " AM"
utcValue = ((utcHours >= 24) ? "0" + (utcHours -24) : ((utcHours <10) ? "0" + utcHours : utcHours))
utcValue += ((minutes < 10) ? "0" : "") + minutes + " Zulu"
document.timedisplay.displayface.value="" + utcValue + " -- " + timeValue + " Local"
timerID = setTimeout("showtime()",10000);
timerRunning = true;
}

function startclock() {
stopclock();
showtime();
}

/**************************************************
	buttonPreload
	Preloads the button images
	Paster the following in the BODY tag:
			ONLOAD="buttonPreload()"
**************************************************/
function buttonPreload(){
bltBlue = new Image(); bltGreen= new Image();
bltBlue.src = "images/bluedot.gif"; bltGreen.src = "images/grndot.gif";
}


/**************************************************
	MouseOver Button Changing Functions
**************************************************/
function mOver(img_name) {
document [img_name].src="images/grndot.gif";
}

function mOut(img_name) {
document [img_name].src="images/bluedot.gif";
}

/**************************************************
	PopMsg:	Opens url in a pop-up window
					Used for mail form and some information screens
**************************************************/
function PopMsg (url) {
var msg=window.open(url,"","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=450,height=400");
msg.focus();
}


/**************************************************
	pickListItem: Opens the url chosen out of an option list
								Used in Places and Stories pages
	(Currently called goPlaces -- change in the primary pages)
**************************************************/
function pickListItem(selectObj){
var i=selectObj.selectedIndex;
var URL = selectObj.options[i].value;
window.location.href = URL;
}

