//
// written by Debbi McDaniel mailto:mdnitecreepr@earthlink.net
//
// This JavaScript function will create a text variable indicating
// the last time your page was modified.  It includes the day of
// the week, name of the month, day, year, and time (in a 12 hour
// clock format).
//
function LastUpdate()
{
var Days = new Array("Sunday",
   "Monday", "Tuesday", "Wednesday",
   "Thursday", "Friday", "Saturday");           //Day Names array
var Months = new Array(
   "January", "February", "March",
   "April", "May", "June", "July",
   "August","September", "October",
   "November", "December");                      //Month Names array

var Updated = new Date(document.lastModified);   //last modified date
var dName   = Days[Updated.getDay()];            //name of the day of the week
var mName   = Months[Updated.getMonth()];        //name of the month
var d       = Updated.getDate();                 //date
var dSuf    = "th";                              //date suffix
if (d == 1 || d == 21 || d == 31) dSuf="st";     //change date suffix for 1s
if (d == 2 || d == 22) dSuf = "nd";              //change date suffix for 2s
if (d == 3 || d == 23) dSuf = "rd";              //change date suffix for 3s
var y       = Updated.getFullYear();             //year
var h       = Updated.getHours();                //hour
var ampm    = "am"                               //AM
if (h >=12) ampm = "pm";                         //change am to pm, if after noon
if (h > 12) h -= 12;                             //change pm to 12 hour clock
if (h == 0) h = 12;                              //change 0 to midnight
var m       = Updated.getMinutes();              //minutes
if (m < 10) m = "0" + m;                         //2-digit minutes
var UpdateText="Last modified: " +
   dName + " " + mName + " " +  d +
   "<sup>" + dSuf + "</sup>" + ", " + y +
   " at " + h + ":" + m + ampm + ".";            //The Last Updated Statement
return UpdateText
}

function openAnyWindow(url, name) {
     var l = openAnyWindow.arguments.length;
     var w = "";
     var h = "";
     var features = "";

     for (i=2; i<l; i++) {
          var param = openAnyWindow.arguments[i];
          if ( (parseInt(param) == 0) ||
               (isNaN(parseInt(param))) ) {
               features += param + ',';
          } else {
               (w == "") ? w = "width=" + param + "," :
               h = "height=" + param;
          }
     }

     features += w + h;
     var code = "popupWin = window.open(url, name";
     if (l > 2) code += ", '" + features;
     code += "')";
     eval(code);
}
//--->

function browsername()
{
	var tmp = navigator.appName;
    return tmp;
}

function browservers()
{
	var tmp = val( navigator.appVersion );
	return tmp;
}

function platform()
{
	var tmp = navigator.platform;
    return tmp;
}

function bvers()
{
	var tmp = navigator.userAgent;
	var bname = browsername();
	var tmp1 = left( bname, 5 );
	var xname = ucase( tmp1 );
	var vers = val( navigator.appVersion );
    if ( xname=="MICRO" )
	{
		// The version number is inconsistently reported in IE 5.x.
		// It depends, apparently, on the level of customization that
		// the program undergoes when it is used by redistributors.
		// AOL "7.0", for example, uses IE 5.5 but appVersion reports
		// it as 4.9x because appVersion picks up the wrong number.
		var ii = instr( tmp, "MSIE" );
		if (ii >= 0)
		{
			var dummy = mid( tmp, ii );
			var ii = instr( dummy, " " );
			var tmp2 = mid( dummy, ii+1 );
			var jj = instr( tmp2, ";" );
            var vers = left( tmp2, jj );
		}
	}
	else if ( xname=="NETSC" )
    {
		// This segment verifies that we are dealing with some version
		// of Netscape, all versions ofwhich have "U;" as part of the
		// userAgent string.  Netscape 6.x presents itself as Mozilla
		// 5.0 and "appVersion" returns 5.x.  The version that Netscape
		// calls itself (i.e., 6.2), can also be found in the userAgent
		// string.   Mozilla, on the other hand, also presents itself
		// as Netscape 5.x but does not have an alternative version
		// number.  Earlier versions had only the "Mozilla" numbers.
		var ii = instr( tmp, "(" );
		var tmp1 = mid( tmp, ii+1 );
		var ii = instr( tmp1, "U;" ); //verify that this is Netscape
		if (ii >= 0)
		{
			if (vers >= 5)
			{
				var ii = instr( tmp1, ")" );
				if (ii >= 0)
				{
					tmp2 = ucase( mid( tmp1, ii+1 ) );
					ii = instr( tmp2, "NETSC" );
					if (ii >= 0)
					{
						ii = revinstr( tmp2, "/" );
						var vers = val( mid( tmp2, ii+1 ) );
					}
				}
			}
		}
	}
	return vers;
}

function WhichBrowser ()
{
	tmp = browsername() + " " + bvers();
	return tmp;
}

function ewcfooter()
{
	document.write("<p align='center'>");
	document.write("<font size=1 color=white face='sans-serif'>", "<b>", LastUpdate());
	document.write("<br>", "Designed by Enterprise-Wide Computing, Inc.");
	document.write("<br>", "For information contact ", "<a href='mailto:info@ewc-inc.com'>info@ewc-inc.com</a>");
	document.write("</b></font></p>");
}

var xyear;
function cYear( xyear )
{
 	var x = today();
	var y = YMD[0];
	var cy = y + xyear;
	var pgm = "/springfieldemanuel/cgi/cal.exe?~wh1~s~c12~y"+cy
	openAnyWindow( pgm, 'cal', 'top=0', 'left=0', 'width=475', 'height=400', 'scrollbars=yes', 'status=no', 'resizable=yes' );
}

function PresentCal()
{
	var x = bvers(); // WhichBrowser();
	// if ((x==2)||(x==4))
	if (x >= 5)
	{
		document.write("<font size='2' face='sans-serif,arial,geneva'>");
		document.write("<p align='center'><b>");
		document.write("If you need a reference calendar, click on one of the following<br>");
		document.write("<a target='_blank' onClick='cYear( -1 );'>[<font color=blue>Last Year</font>]</a>");
		document.write("<a target='_blank' onClick='cYear( 0 );'>[<font color=blue>This Year</font>]</a>");
		document.write("<a target='_blank' onClick='cYear( 1 );'>[<font color=blue>Next Year</font>]</a>");
		document.write("</b></p></font>");
	}
}
