<!-- Hide script from older browsers
//
// Set a value in a read-only text box to the current time and date, e.g.,
// "11:14:21 am Thu Dec 9, 2004"
// Then, call this function recursively at 1 Hz to maintain the time display.
//
function DispDT() {
  var now = new Date()
  var Hours = now.getHours()
  var Minutes = now.getMinutes()
  var Seconds = now.getSeconds()
  var Time = "" + ((Hours > 12) ? Hours - 12 : Hours)
  Time += ((Minutes < 10) ? ":0" : ":") + Minutes
  Time += ((Seconds < 10) ? ":0" : ":") + Seconds
  Time += (Hours >= 12) ? " pm" : " am"
  var DayList = new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
	var Day = DayList[now.getDay()]
	var MonthList = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun",
							              "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
	var Month = MonthList[now.getMonth()]
	var Date1 = now.getDate()
	var Year = now.getFullYear()

	Time = Time + " " + Day + " " + Month + " " + Date1 + ", " + Year
    document.clocktext.clock.value = Time
    setTimeout("DispDT()", 1000)
}
//
// Display an HTML file in a pop-up window. Sample call:
// href='JavaScript:openPopWin("popup_tj.htm", 540, 435, "" , 20, 20)
// winURL = name of HTML file to displaye
// winWidth = width of window for HTML file
// winHeight = height of window for HTML file
// winFeatures = parameters for window.open call
// winLeft = X-coordinate of window
// winTop = y-coordinate of window
//    
var popWin = null
var winCount = 0
var winName = "popWin"
function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop) {
  var d_winLeft = 20              // x-Axis Position
  var d_winTop = 20               // y-Axis Position
  winName = "popWin" + winCount++ // unique name for each pop-up window
  closePopWin()                   // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4) // any additional features? 
    winFeatures = "," + winFeatures
  else 
    winFeatures = "" 
  winFeatures = ",scrollbars=0,status=0,resizable=0,status=0" // override any passed winFeatures
  // IE: behaves as if status=1
  // NN: perfect
  // FF: behaves as if status=1 and resizable=1
  // OP: behaves as if scrollbars=1 and resizable=1; ignores status; cannot
  //     move popup outside parent window; opens and quickly closes a similar
  //     popup window called "Blank page" just prior to opening the requested one.
  if (openPopWin.arguments.length == 6) // location specified
    winFeatures += getLocation(winWidth, winHeight, winLeft, winTop)
  else
    winFeatures += getLocation(winWidth, winHeight, d_winLeft, d_winTop)
  popWin = window.open(winURL, winName, "width=" + winWidth 
           + ",height=" + winHeight + winFeatures)
}
//
// Close a pop-up window if any is open. Logic follows:
// (If browser is IE or browser's version number GE 4) and
// (a pop-up window exists and is not closed) then
//   close it.
// appName and appVersion for my 4 browsers:
// IE 6.0:      Microsoft Internet Explorer  4.0 (compatible ... 1.4322)
// NN 7.2:      Netscape  5.0 (Windows; en-US)
// Opera 7.0:   Opera  7.54 (Windows NT 5.1; U)
// Firefox 1.0: Netscape  5.0 (Windows;en-US)
//
function closePopWin() { 
  if (navigator.appName != "Microsoft Internet Explorer" 
   || parseInt(navigator.appVersion) >=4) //do not close if early IE
  if(popWin != null)
     if(!popWin.closed) popWin.close() 
}
//
// Convert width, height, and x- and y-coordinates to a location parameter.
//
function getLocation(winWidth, winHeight, winLeft, winTop) {
  var winLocation = ""
  if (winLeft < 0)
    winLeft = screen.width - winWidth + winLeft
  if (winTop < 0)
    winTop = screen.height - winHeight + winTop
  if (winTop == "cen")
    winTop = (screen.height - winHeight)/2 - 20
  if (winLeft == "cen")
    winLeft = (screen.width - winWidth)/2
  if (winLeft>0 & winTop>0)
    winLocation =  ",screenX=" + winLeft + ",left=" + winLeft	
                + ",screenY=" + winTop + ",top=" + winTop
  else
    winLocation = ""
  return winLocation
}

//
// The following code is designed to be equivalent to:
// body {onunload="closePopWin()"}
// for all pages that include this .js file.

// The code was adapted from:
// http://www.brothercake.com/site/resources/scripts/onload/
// However, applyst was changed to loadfunc since no applyst function exists.
//
function loadfunc() {
    if( window.XTRonload ) { window.XTRonload(); }
}
function unloadfunc() {
    closePopWin();
    if( window.XTRonunload ) { window.XTRonunload(); }
}
if( window.addEventListener ) {
    window.addEventListener( 'load', loadfunc, false );
    window.addEventListener( 'unload', unloadfunc, false );
} else if( document.addEventListener ) {
    document.addEventListener('load' , loadfunc, false );
    document.addEventListener( 'unload', unloadfunc, false );
} else if( window.attachEvent ) {
    window.attachEvent( 'onload', loadfunc ); // changed from applyst
    window.attachEvent( 'onunload', unloadfunc);
} else {
    if( window.onload ) { window.XTRonload = window.onload; }
    if( window.onunload ) { window.XTRonunload = window.onunload; }
    window.onload = loadfunc;
    window.onunload = unloadfunc;
}
// End hiding script from older browsers -->
