/* $Id: enf.js,v 1.9 2005/06/16 00:00:08 geoff Exp $ */
/* Copyright (c) 2000-2004 Peck Labs, Inc. All rights reserved. */

function PopFAA(url) {
    FAApopup = window.open('', 'FAApopup', 'scrollbars=1');
    FAApopup.location.href = url;
    if (FAApopup.opener == null) FAApopup.opener = window;
    FAApopup.focus();
}

function Pop(url) {
    popup = window.open('', 'popup', 'height=300,width=450,scrollbars=1');
    popup.location.href = url;
    if (popup.opener == null) popup.opener = window;
    popup.focus();
}

function PopTR() {
    popup = window.open('', 'TravelPopup', 'scrollbars=1');
    popup.location.href = 'http://www.travelstoremaker.com/cgit/porch?agentid=enflight';
    if (popup.opener == null) popup.opener = window;
    popup.focus();
}

function PopP(url) {
    popup = window.open('', 'Procedure', 'width=620,scrollbars=1');
    popup.location.href = url;
    if (popup.opener == null) popup.opener = window;
    popup.focus();
}

function PopH(url) {
    popup = window.open('', 'Help', 'width=500,height=500,scrollbars=1');
    popup.location.href = url;
    if (popup.opener == null) popup.opener = window;
    popup.focus();
}

function PopAPD(url) {
    popup = window.open('', 'AirportDiagram', 'width=620,scrollbars=1');
    popup.location.href = url;
    if (popup.opener == null) popup.opener = window;
    popup.focus();
}

function PopBig(url) {
    popup = window.open('', 'pop', 'height=520,width=720,scrollbars=1');
    popup.location.href = url;
    if (popup.opener == null) popup.opener = window;
    popup.focus();
}

function aopaDir (a) {
    var f
    f = a.charAt(0).toUpperCase()
    if ( a.length == 4 && isalpha(a) && (f == 'K' || f == 'P' || f == 'C' || f == 'M')) {
	a = a.substring(1,4)
    }
    aopadir = window.open('', 'aopadir', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=640,height=480');
    aopadir.location.href = 'http://www.aopa.org/members/airports/detail.cfm?identifier=' + a;
    if (aopadir.opener == null) aopadir.opener = window;
    aopadir.focus();
}

function aptDir (a) {
    var f
    f = a.charAt(0).toUpperCase()
    if ( a.length == 4 && isalpha(a) && (f == 'K' || f == 'P' || f == 'C' || f == 'M')) {
	a = a.substring(1,4)
    }
    dw = window.open('', 'aopadir', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=660,height=480');
    dw.location.href = 'apt.php?p=1&id=' + a;
    if (dw.opener == null) dw.opener = window;
    dw.focus();
}

function isalpha(s) {
    var i
    for ( i = 0 ; i < s.length ; i++ )
	if ( !((s.charAt(i) >= 'A' && s.charAt(i) <= 'Z') || (s.charAt(i) >= 'a' && s.charAt(i) <= 'z')) )
	    return false
    return true
}

function calcTimeOffset()
{
    var current = new Date();

    var offset = current.getTime() - " . time() * 1000 . "; 
    return offset;
}
var offset = calcTimeOffset();

function currentTime()
{
    var current = new Date();
    current = new Date(current.getTime() - offset);
    var utctime = current.toGMTString();
    utctime = '&nbsp;&nbsp;' + utctime.substring(0, utctime.length - 7) + ' UTC&nbsp;&nbsp;';
    if (document.all) {
	document.all.clockDiv.innerHTML = utctime;
	setTimeout('currentTime()', 1000);
    // } else if (document.layers) { 
	// This doesn't work in Netscape 4.x unless clockDiv is
	// positioned absolutely.
	//document.clockDiv.document.open()
	//document.clockDiv.document.write(utctime);
	//document.clockDiv.document.close()
	//setTimeout('currentTime()', 1000);
    // } else if (document.getElementById) {
	// Netscape 6
	// document.getElementById('clockDiv').innerHTML = utctime;
	// setTimeout('currentTime()', 1000);
    }
}
